uudruid74 wrote: 
> Yes, that was from this thread.  The script isn't the issue, but I
> wouldn't mind seeing the latest version (I'm NOT searching through 30
> pages!), but I doubt it would help
> 
> 
> 
> Tried, but thats not the issue.  Without sudo it just runs as whatever
> permissions "udev" has left it and we need MORE permissions, not less.  
> 
> My issue is that I route my DAC through a tube preamp and then into my
> AVR.  I "turn on" my squeezebox by selecting the input on the AVR.  The
> AVR switches to the jivelite interface on the TC screen and uses its
> trigger out to turn on the DAC and tube preamp.  I have a remote with a
> USB dongle that can operate the UI (as well as use my phone, tablet,
> etc).  I don't turn off the Pi because it doesn't use much power and I
> don't want to wait for a long boot process.  The DAC isn't used for
> other media since non-music content is surround sound and I use the DACs
> in the AVR so its strictly for music.
> 
> Apparently, udevd drops some permission that squeezelite needs to start.
> I believe it could be a real-time priority permission.  Either an
> upgrade to udev caused this drop or an upgrade to squeezelite caused it
> to request it, so running a script from udev will fail.  The busy waits
> I've seen posted here using "sleep" is just a bad idea.  You are causing
> a context switch every second and polling for an event that the system
> can notify you of.  That is the whole point of udev!
> 
> Here is my solution:
> 
> /HOME/TC/ATNOWD> 
Code:
--------------------
  >   > 
  > #!/bin/sh
  > 
  > FIFO="/tmp/atnowd.fifo"
  > echo "Starting atnowd"
  > 
  > rm -f $FIFO 2>/dev/null
  > mkfifo $FIFO
  > 
  > while true
  > do
  > sleep 10
  > if read command <$FIFO
  > then
  > echo $command
  > ($command)
  > fi
  > done
  > 
--------------------
> > 
> 
> -NOTE: Kids!  Don't try this at home!  On any other system executing
> whatever we write to a pipe that is world-writable is a huge security
> problem.  In this instance, I think its OK for a media player that
> only you have access to.  Just don't use this trick on production
> systems!  *You run this by putting "/home/tc/atnowd >>/tmp/dac.txt" as
> a "User Command" under "Tweaks" in the picoreplayer web interface.* 
> The redirection to a file can be left off once you are done testing. 
> Just ssh in and "tail -f /tmp/dac.txt" to see what it's doing so you
> can test everything.-
> 
> /HOME/TC/ATNOW> 
Code:
--------------------
  >   > 
  > #!/bin/sh
  > FIFO="/tmp/atnowd.fifo"
  > echo $@ >>$FIFO
  > 
--------------------
> > 
> 
> /ETC/UDEV/RULES.D/10-DAC.RULES> 
Code:
--------------------
  >   > 
  > SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", 
ENV{PRODUCT}=="152a/85dd/206", RUN+="/home/tc/atnow /home/tc/DAC.sh"
  > SUBSYSTEM=="usb", ACTION=="remove", ENV{DEVTYPE}=="usb_device", 
ENV{PRODUCT}=="152a/85dd/206", RUN+="/home/tc/atnow /home/tc/noDAC.sh"
  > 
--------------------
> > 
> 
> -NOTE: I used "usb_device" as the DEVTYPE since my DAC will add the
> USB device and then add a bunch of USB interfaces, and I don't want to
> run any of this multiple times.  There is possibility that the DAC.sh
> might be run before the interfaces are loaded, but this is a race
> condition in theory and not in practice!  Obviously, substitute the
> "PRODUCT" for your DAC - that is for an SMSL SU-9-
> 
> /HOME/TC/NODAC.SH> 
Code:
--------------------
  >   > 
  > #!/bin/sh
  > PIDFILE=/var/run/squeezelite.pid
  > 
  > echo "Stopping squeezelite"
  > pcp stop
  > sudo /usr/local/etc/init.d/squeezelite stop
  > sleep 5
  > killall -9 squeezelite
  > rm $PIDFILE
  > sleep 1
  > sudo /usr/local/etc/init.d/squeezelite status
  > 
--------------------
> > 
> 
> -NOTE: You can probably remove the status stuff at the end.  And yes,
> this is kinda brute force.  The idea is to make sure no processes are
> holding onto stale file handles, possibly preventing new processes
> from starting. -
> 
> /HOME/TC/DAC.SH> 
Code:
--------------------
  >   > 
  > #!/bin/sh
  > 
  > echo "Starting squeezelite"
  > sudo /usr/local/etc/init.d/squeezelite start
  > sudo /usr/local/etc/init.d/squeezelite status
  > pcp play
  > 
--------------------
> > 
> 
> -BUG:  When turning on the DAC, squeezelite is started and shows it to
> be paused right where you left it.  The moment it is unpaused, it
> starts at the beginning of the playlist.  I have tried all sorts of
> stuff in both DAC.sh and noDAC.sh to try and fix this, but it just
> doesn't work.  Its a lot better than rebooting your Pi when you turn
> on your DAC.-
> 
> Hope this helps someone.  Remember to do a "pcp br" so that all the
> files are saved (and remember to chmod +x all the scripts), the atnowd
> starts, and your udev rules are read.  You can do all that manually
> for testing, but this should work out of the box if you just change
> the PRODUCT.Someone else had a similar issue. Their posts start here.
https://forums.slimdevices.com/showthread.php?p=1012890

Sent from my Pixel 3a using Tapatalk




------------------------------------------------------------------------
slartibartfast's Profile: http://forums.slimdevices.com/member.php?userid=35609
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