I've updated the script to simplify the setup process, and to improve
the feedback that it provides, so I thought it was worth posting the
update.

SHORT SETUP INSTRUCTIONS:

1) Use whatever tools you are comfortable with to create a script file
in your home directory, then paste the contents of the script (in the
next post because I've exceeded the character limit) into it.  You can
call your script file anything you like - mine is called
SQLITE-control.sh, so I'll use that name in these instructions.  Make
this file executable with:

Code:
--------------------
    chmod +x SQLITE-control.sh
--------------------


2) Ensure your USB DAC is configured in pCP's Squeezelite Settings page,
and is connected and powered up.
Run the script once to create and modify the necessary files.

Code:
--------------------
    sudo ./SQLITE-control.sh install
--------------------


3) Backup and reboot

Code:
--------------------
    pcp br
--------------------


That's it.
Squeezelite should now start and stop in response to your DAC powering
up and down.
You should find a log file, named after your DAC, in pCP's diagnostics
page ('Main Page' -> 'Diagnostics' -> 'Logs'). Note that you need to
update that page by clicking 'Show' whenever new DAC events occur.

LONGER EXPLANATION:

The 'install' option of the script now finds the DAC card name from the
pCP configuration file: /usr/local/etc/pcp/pcp.cfg.  The output from the
'install' option is now more helpful.  It should look something like
this:

Code:
--------------------
    tc@pCPTest:~$ sudo ./SQLITE-control.sh install
  Squeezelite output device found in /usr/local/etc/pcp/pcp.cfg = DragonFly
  DragonFly found on card1
  DragonFly idVendor = 21b4 and idProduct = 0081
  udev rules written to etc/udev/rules.d/10-DragonFly.rules
  etc/udev/rules.d/10-DragonFly.rules added to /opt/.filetool.lst
  
  Installation complete
  Squeezelite is now set up to autostart/stop with DragonFly power
  Backup and reboot ('pcp br') to enable
  
--------------------


Calling the script with the 'find' option is now done in
/opt/bootlocal.sh, rather than as a User Command on the Tweaks page. 
Keep that in mind if ever you want to 'uninstall' this script (maybe I
need to add an 'uninstall' option to do the cleaning up).  If you have
previously installed the earlier script, you can now remove the User
Command that you entered on the Tweaks page.

The script creates a 'rules' file in /etc/udev/rules.d.  It will take
the form '10-<cardname>.rules.  There will be two lines in that file -
one for the 'add' event when the DAC is connected/powered up, and one
for the 'remove' event when the DAC is disconnected/powered down.  This
file can be edited if, say, you only want the 'add' rule, but note that
it was created with 'sudo' so is owned by 'root'.  The rules
specifically reference, by name, the script file that you created in
step 1, so if you change the name of that script, it's best to re-run
the 'install' command.

When in use, you may see a file named <cardname>.kername in the /tmp
directory.  This contains the kernel name of the DAC, and is necessary
because the 'remove' event will fire when ANY USB device is removed, and
we only want the script to do something (stop Squeezelite) when that
particular device is removed.

I've tried to automate this as much as possible, but as yet there's very
little in the way of error checking or fallback code if something goes
wrong.  So please do report if something unexpected happens.  It's also
possible that the commentary at the top of the script doesn't quite
align with the current version, but that won't affect its operation.


------------------------------------------------------------------------
chill's Profile: http://forums.slimdevices.com/member.php?userid=10839
View this thread: http://forums.slimdevices.com/showthread.php?t=113661

_______________________________________________
unix mailing list
unix@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to