Re: [SlimDevices: Unix] Start/restart squeezelite when plug-in USB dac

2021-03-07 Thread pgf


Whoa, this is fast-moving thread!  I thought I was all caught up, and
suddenly there are another dozen messages!  :-)

I'm pretty impressed by chill's script.  Nice work.  Keeping track of
all that statefulness, via multiple entry points to the script, is
tricky.  The self-installation is a nice touch.

I found the thread while looking for something somewhat related, and
thought I'd share my (partial) solution to the USB audio detection
problem.  I also happen to have a set of H-K Soundstick speakers, which
I've only recently hooked up to picoreplayer.  Keeping things going when
the speakers are turned off or unplugged is an issue.

So...  my script relies on polling (which doesn't worry me in the
least), and probably won't cover many corner cases, but it serves my
purposes.  It relies on the USB audio device coming and going from
/proc/asound when it's un/plugged.

The script is invoked as one of the "user commands" on the Tweaks page. 
The copy here is trimmed from the script I actually run, since mine does
some other unrelated stuff as well, but I don't think I've introduced
any new bugs.  It's pretty simple -- hope it might help someone.

paul (another one)


Code:

#!/bin/sh
  
  watch_usb_audio()
  {
  # loop forever
  while :
  do
  # loop while the device exists
  while [ -e /proc/asound/$audiodev ]
  do
  # if it only just became available...
  if [ "$prev_usbaudio" != "present" ]
  then
  alsactl restore
  /usr/local/etc/init.d/squeezelite restart
  fi
  prev_usbaudio=present
  sleep 4
  done
  
  # loop while the device doesn't exist
  while [ ! -e /proc/asound/$audiodev ]
  do
  prev_usbaudio=notpresent
  sleep 4
  done
  done
  }
  
  audiodev=SoundSticks
  watch_usb_audio &
  
  exit
  




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


Re: [SlimDevices: Unix] Start/restart squeezelite when plug-in USB dac

2021-03-07 Thread Greg Erskine


I only use "force" option on the command line. I'm wondering if $0 gets
set correctly if calling from a script.



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


Re: [SlimDevices: Unix] Start/restart squeezelite when plug-in USB dac

2021-03-07 Thread chill


Greg Erskine wrote: 
> Maybejust maybe
> 
> Way back somewhere I mentioned using the "force" option instead of the
> "stop" option during testing.
> 

Thanks Greg.  I had noticed the 'force' option, but hadn't looked beyond
the comment: "# Force should only be used for testing purposes."

But now I see that it's a brute force replacement for the 'restart'
option.  So I've given it a try on my own setup, i.e. I replaced 

Code:

result="$(sudo /usr/local/etc/init.d/squeezelite restart)"


with

Code:

result="$(sudo /usr/local/etc/init.d/squeezelite force)"



And now - the weirdest thing - Squeezelite won't restart on my test
setup!  The running process is killed, and the PIDFILE is deleted, but
the part of the init.d script that does the 'start', i.e. '$0 start',
doesn't seem to do anything.  I understand that this should re-run the
init.d script with the 'start' option, and therefore I should see one of
the two echoed messages in my log file, but I see neither, and there's
no new Squeezelite process afterwards.

For reference, here's the bit of the init.d script that does the 'force'
restart:

Code:

force)
# Force should only be used for testing purposes.
echo "Forcing a restart of $PNAME..."
if [ -f $PIDFILE ]; then
sudo kill `cat $PIDFILE`
sudo rm -f $PIDFILE
fi
sudo ps | grep squeezelite | grep -v grep | awk '{print $1}' | 
xargs kill -9
sleep 1
$0 start
;;



I see the 'Forcing...' message echoed in my log file, the PIDFILE
disappears, and the squeezelite process is killed.  But there's no
evidence that '$0 start' is even being triggered.

And for reference, here's the 'start' part of the init.d script - I
should at least get one of the two echoed messages in the log file.


Code:

start)
if [ -f $PIDFILE ]; then
echo "$PNAME already running."
exit 1
fi
echo "Starting $DESC: $PNAME..."
start-stop-daemon --start --quiet -b -m -p $PIDFILE --exec 
$DAEMON -- -n "$NAME" $OUTPUT $ALSA_PARAMS $BUFFER_SIZE $_CODEC $XCODEC 
$PRIORITY $MAX_RATE $UPSAMPLE $MAC_ADDRESS $SERVER_IP $LOGLEVEL $DSDOUT $VIS 
$CLOSEOUT $UNMUTE $ALSAVOLUME $LIRC $POWER_GPIO $POWER_SCRIPT $OTHER
;;



I think it's time for me to sleep on this and look at it again with a
fresh pair of eyes tomorrow.



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


Re: [SlimDevices: Unix] piCorePlayer 7.0.1 + CM4 + Mini I/O Board not Used USB-DAC

2021-03-07 Thread tx2toda


Is it possible to enable piCorePlayer to recognize the CM4's USB port?
I could not do it.



tx2toda's Profile: http://forums.slimdevices.com/member.php?userid=71378
View this thread: http://forums.slimdevices.com/showthread.php?t=113903

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


Re: [SlimDevices: Unix] Start/restart squeezelite when plug-in USB dac

2021-03-07 Thread Greg Erskine


Maybejust maybe

Way back somewhere I mentioned using the "force" option instead of the
"stop" option during testing.

I found when you are testing things manually, you do things like forget
to use "sudo" or use kill, and you end up with the squeezelite process
and the pid file out of sync. I think its a permission thing, running
things as tc or root, AND an orphan pid file issue.

I added the force "option" (with sudo) as a brute force stop and
tidyup.

When a user is only using pCP interfaces everything is kept in sync and
everyone one is happy.

Also, as pCP is mainly in RAM a reboot means any orphan pid files are
effectively removed. This can add to the confusion when testing.

The reason for all this is: I like to use "start-stop-daemon" and pid
files.

Of course this is only in reference to pCP other distribution do things
differently.



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


Re: [SlimDevices: Unix] Start/restart squeezelite when plug-in USB dac

2021-03-07 Thread chill


That confirms that the start-stop-daemon isn't stopping the process. 
The fact that the process hasn't stopped may or may not be enough to
prevent the subsequent start, but since the same start-stop-daemon is
used to start the process, it may well be failing to do that too.

I'm not sure yet what can be done about this, but we're chipping away at
the problem :-)



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


Re: [SlimDevices: Unix] Start/restart squeezelite when plug-in USB dac

2021-03-07 Thread Bogg


reboot with dac on


Code:

tc@pCP:~$ ps | grep squeezelite
  5405 root  0:01 /usr/local/bin/squeezelite -n piCorePlayer -o 
hw:CARD=M6,DEV=0 -a 80 4  1  -v
  10084 tc0:00 grep squeezelite
  tc@pCP:~$ cat /var/run/squeezelite.pid
  5405
  tc@pCP:~$
  



dac off


Code:

tc@pCP:~$ ps | grep squeezelite
  5405 root  0:03 /usr/local/bin/squeezelite -n piCorePlayer -o 
hw:CARD=M6,DEV=0 -a 80 4  1  -v
  10163 tc0:00 grep squeezelite
  tc@pCP:~$ cat /var/run/squeezelite.pid
  cat: can't open '/var/run/squeezelite.pid': No such file or directory
  tc@pCP:~$
  



dac back on (sqlite working)


Code:

tc@pCP:~$ ps | grep squeezelite
  5405 root  0:04 /usr/local/bin/squeezelite -n piCorePlayer -o 
hw:CARD=M6,DEV=0 -a 80 4  1  -v
  10327 tc0:00 grep squeezelite
  tc@pCP:~$ cat /var/run/squeezelite.pid
  cat: can't open '/var/run/squeezelite.pid': No such file or directory
  




The same log throughout the on off on process


Code:

[  16.66] Script parameters: find M6 
  [  16.70] Searching for M6 with idVendor=0d8c and idProduct=0004 in dmesg
  [  16.72] M6 detected on  1-1.2
  [  16.73] Restoring alsa settings for M6
  [ 245.27] Script parameters: stop M6 1-1.2:1.1
  [ 245.28] Script parameters: stop M6 1-1.2:1.0
  [ 245.40] Script parameters: stop M6 1-1.2:1.2
  [ 245.42] Script parameters: stop M6 1-1.2
  [ 245.43] M6 on 1-1.2 removed
  [ 245.47] Stopping Squeezelite player: Squeezelite...
  [ 245.48] /tmp/M6.kername deleted
  [ 311.33] Script parameters: restart M6 1-1.2
  [ 311.34] M6 detected on 1-1.2
  [ 312.40] Restarting Squeezelite player...
  Squeezelite is not running.
  Starting Squeezelite player: Squeezelite...
  [ 313.43] Squeezelite not running.
  [ 314.49] Restarting Squeezelite player...
  Squeezelite is not running.
  Starting Squeezelite player: Squeezelite...
  [ 315.53] Squeezelite not running.
  [ 316.59] Restarting Squeezelite player...
  Squeezelite is not running.
  Starting Squeezelite player: Squeezelite...
  [ 317.63] Squeezelite not running.
  [ 318.68] Restarting Squeezelite player...
  Squeezelite is not running.
  Starting Squeezelite player: Squeezelite...
  [ 319.72] Squeezelite not running.
  [ 320.77] Restarting Squeezelite player...
  Squeezelite is not running.
  Starting Squeezelite player: Squeezelite...
  [ 321.81] Squeezelite not running.
  [ 321.82] Squeezelite failed to initialize within 5 attempts.




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


Re: [SlimDevices: Unix] 5" Touchscreen display that works with Jivelite right out of the box.

2021-03-07 Thread wtnh


Howard Passman wrote: 
> Hmmm, Just double checked my 3.5. Back lighting control works fine. I'm
> running pi3B | piCorePlayer v7.0.1 | www v00016 | linux
> 5.4.83-pcpCore-v8 | piCore v12.0pCP | Squeezelite v1.9.8-1287-pCP.
> 
> Might try resetting or reinstalling Jivelite??  Ooops sorry it's upside
> down...But you can see the gist of it.
> 
> Howard

Got it! Thanks for the hint. Resetting did not work but Updating
Jivelite worked! (it said "update required" when I clicked the button
and went ahead and downloaded the latest Jivelite code. I guess I had
forgotten to click the Jivelite update button after flashing a new card
yesterday. Seems like Jivelight should get updated along with the other
piCorePlayer stuff, but oh well ;)

Anyway - I'm good to go now - thanks!



wtnh's Profile: http://forums.slimdevices.com/member.php?userid=36993
View this thread: http://forums.slimdevices.com/showthread.php?t=113708

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


Re: [SlimDevices: Unix] 5" Touchscreen display that works with Jivelite right out of the box.

2021-03-07 Thread Howard Passman


Hmmm, Just double checked my 3.5. Back lighting control works fine. I'm
running pi3B | piCorePlayer v7.0.1 | www v00016 | linux
5.4.83-pcpCore-v8 | piCore v12.0pCP | Squeezelite v1.9.8-1287-pCP.

Might try resetting or reinstalling Jivelite??

Howard

wtnh wrote: 
> Hmm - when I try the "Adjust Display Backlight Brightness" in
> PiCorePlayer settings, I get a popup that says "No official Raspberry Pi
> display found!". The popup goes away after about 2 seconds.
> 
> When I touch the next menu item, "Adjust Display Backlight Brightness
> When Powered Off", nothing happens - the display jiggles a bit to
> indicate it does not like that ;).
> 
> Everything else in Jivelite works perfectly, the same as the official
> display in my other player. So still baffled.
> 
> BTW - this is running piCorePlayer 7.0.0 with the latest patches. My
> Osoyoo board is marked V1.0.



Howard Passman's Profile: http://forums.slimdevices.com/member.php?userid=16674
View this thread: http://forums.slimdevices.com/showthread.php?t=113708

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


Re: [SlimDevices: Unix] Start/restart squeezelite when plug-in USB dac

2021-03-07 Thread chill


Bogg wrote: 
> As requested  this is with dac still off - 
> 
> > 
Code:

  >   > 
  > tc@pCP:~$ ps | grep squeezelite
  > 6330 root  0:01 /usr/local/bin/squeezelite -n piCorePlayer -o 
hw:CARD=M6,DEV=0 -a 80 4  1  -v
  > 10355 tc0:00 grep squeezelite
  > tc@pCP:~$ cat /var/run/squeezelite.pid
  > cat: can't open '/var/run/squeezelite.pid': No such file or directory
  > tc@pCP:~$
  > 

> > 
> > 
Code:

  >   > [  17.15] Script parameters: find M6 
  > [  17.20] Searching for M6 with idVendor=0d8c and idProduct=0004 in 
dmesg
  > [  17.24] M6 detected on  1-1.2
  > [  17.26] Restoring alsa settings for M6
  > [  79.87] Script parameters: stop M6 1-1.2:1.1
  > [  79.87] Script parameters: stop M6 1-1.2:1.0
  > [  79.99] Script parameters: stop M6 1-1.2:1.2
  > [  80.01] Script parameters: stop M6 1-1.2
  > [  80.03] M6 on 1-1.2 removed
  > [  80.06] Stopping Squeezelite player: Squeezelite...
  > [  80.07] /tmp/M6.kername deleted
  > 

> > 

Great, thank you.  I guess for completeness I should have asked for
those same commands to be run before you powered off the DAC and again
after you powered it off. Sorry.

Code:

ps | grep squeezelite
  cat /var/run/squeezelite.pid



But it seems clear that the init.d script has attempted to stop
Squeezelite - it has deleted the PIDFILE but it hasn't actually stopped
the process. 


Code:

stop)
if [ ! -f $PIDFILE ]; then
echo "$PNAME is not running."
exit 1
fi
echo "Stopping $DESC: $PNAME..."
start-stop-daemon --stop --quiet -p $PIDFILE   *<-- This bit 
didn't work*
sudo rm -f $PIDFILE*<-- This bit 
did work*
;;
  



I wonder if there's any reason that /sbin/start-stop-daemon would behave
differently when called from udev.  I'll have a think about a way to
test this.



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


Re: [SlimDevices: Unix] Start/restart squeezelite when plug-in USB dac

2021-03-07 Thread Paul Webster


Looks like the kill did not work as squeezelite is still running ... but
the pid has gone ... so next step is to work out why the kill did not
work.



Paul Webster
http://dabdig.blogspot.com
author of \"now playing\" plugins covering radio france (fip etc), kcrw,
supla finland, abc australia, cbc/radio-canada and rte ireland

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


Re: [SlimDevices: Unix] 5" Touchscreen display that works with Jivelite right out of the box.

2021-03-07 Thread wtnh


jeroen2 wrote: 
> I am using the precise same display on PiCorePlayer and can adjust the
> backlight brightness from the settings in JiveLite. (It's under the
> PiCorePlayer settings, not under Display settings)
Hmm - when I try the "Adjust Display Backlight Brightness" in
PiCorePlayer settings, I get a popup that says "No official Raspberry Pi
display found!". The popup goes away after about 2 seconds.

When I touch the next menu item, "Adjust Display Backlight Brightness
When Powered Off", nothing happens - the display jiggles a bit to
indicate it does not like that ;).

Everything else in Jivelight works perfectly, the same as the official
display in my other player. So still baffled.

BTW - this is running piCorePlayer 7.0.0 with the latest patches.



wtnh's Profile: http://forums.slimdevices.com/member.php?userid=36993
View this thread: http://forums.slimdevices.com/showthread.php?t=113708

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


Re: [SlimDevices: Unix] Start/restart squeezelite when plug-in USB dac

2021-03-07 Thread Bogg


> Boot up as normal with the DAC attached and powered, then turn the DAC
> off. Then:
> And could you also post the log file from this sequence.

As requested  this is with dac still off - 


Code:


  tc@pCP:~$ ps | grep squeezelite
  6330 root  0:01 /usr/local/bin/squeezelite -n piCorePlayer -o 
hw:CARD=M6,DEV=0 -a 80 4  1  -v
  10355 tc0:00 grep squeezelite
  tc@pCP:~$ cat /var/run/squeezelite.pid
  cat: can't open '/var/run/squeezelite.pid': No such file or directory
  tc@pCP:~$
  



Code:

[  17.15] Script parameters: find M6 
  [  17.20] Searching for M6 with idVendor=0d8c and idProduct=0004 in dmesg
  [  17.24] M6 detected on  1-1.2
  [  17.26] Restoring alsa settings for M6
  [  79.87] Script parameters: stop M6 1-1.2:1.1
  [  79.87] Script parameters: stop M6 1-1.2:1.0
  [  79.99] Script parameters: stop M6 1-1.2:1.2
  [  80.01] Script parameters: stop M6 1-1.2
  [  80.03] M6 on 1-1.2 removed
  [  80.06] Stopping Squeezelite player: Squeezelite...
  [  80.07] /tmp/M6.kername deleted
  




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


Re: [SlimDevices: Unix] 5" Touchscreen display that works with Jivelite right out of the box.

2021-03-07 Thread Howard Passman


Same here and on the 5" model too.

Howard


jeroen2 wrote: 
> I am using the precise same display on PiCorePlayer and can adjust the
> backlight brightness from the settings in JiveLite. (It's under the
> PiCorePlayer settings, not under Display settings)



Howard Passman's Profile: http://forums.slimdevices.com/member.php?userid=16674
View this thread: http://forums.slimdevices.com/showthread.php?t=113708

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


Re: [SlimDevices: Unix] 5" Touchscreen display that works with Jivelite right out of the box.

2021-03-07 Thread jeroen2


wtnh wrote: 
> The only thing left to do is to figure out how to adjust the backlight,
> which is a little too bright. The standard piCorePlayer adjustment does
> not work since it does not recognize the Osoyoo as an official Raspberry
> Pi display. Osoyoo has a suggestion in their user manual, but that does
> not work on the piCorePlayer distro.

I am using the precise same display on PiCorePlayer and can adjust the
backlight brightness from the settings in JiveLite. (It's under the
PiCorePlayer settings, not under Display settings)



jeroen2's Profile: http://forums.slimdevices.com/member.php?userid=70418
View this thread: http://forums.slimdevices.com/showthread.php?t=113708

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


Re: [SlimDevices: Unix] Getting HDMI CEC to work on pCP 7.0

2021-03-07 Thread daJoe


Hmmm, I see. Thanks a lot for the reply. Yeah, on Raspbian CEC seems to
work fine, but when it came to Jivelite it was quite slow.
So I guess, for now, it is easiest to get a RPi 2 or later, as that
seems to work for you.



daJoe's Profile: http://forums.slimdevices.com/member.php?userid=71450
View this thread: http://forums.slimdevices.com/showthread.php?t=113784

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


Re: [SlimDevices: Unix] Start/restart squeezelite when plug-in USB dac

2021-03-07 Thread chill


@Bogg - perhaps you could run another quick test.

Boot up as normal with the DAC attached and powered, then turn the DAC
off.  Then:

Code:

ps | grep squeezelite
  cat /var/run/squeezelite.pid



And could you also post the log file from this sequence.



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


Re: [SlimDevices: Unix] Start/restart squeezelite when plug-in USB dac

2021-03-07 Thread chill


Thanks both Pauls - just working my way through the init.d script now. 
WWWROOT is not used.  And what I can't fathom is if there's a problem
with the environment in Bogg's fresh pCP7 install, why isn't there a
problem with the environment in my fresh pCP7 install?

Bogg wrote: 
> Here's my adjusted script. The stop part is in there as far I can see.
> I've (hopefully) just changed the 2 local bits near the beginning, and
> the sudo line just now.
> 
> 33671
> 
> Starting from a fresh reboot, dac on, working sqlite etc, then dac off,
> and dac back on. 
> M6 Log
> > 
Code:

  >   > [  18.48] Script parameters: find M6 
  > [  18.55] Searching for M6 with idVendor=0d8c and idProduct=0004 in 
dmesg
  > [  18.59] M6 detected on  1-1.2
  > [  18.61] Restoring alsa settings for M6
  > [  67.33] Script parameters: stop M6 1-1.2:1.1
  > [  67.33] Script parameters: stop M6 1-1.2:1.0
  > [  67.47] Script parameters: stop M6 1-1.2:1.2
  > [  67.49] Script parameters: stop M6 1-1.2
  > [  67.50] M6 on 1-1.2 removed
  > [  67.53] Stopping Squeezelite player: Squeezelite...
  > [  67.55] /tmp/M6.kername deleted
  > [  90.64] Script parameters: restart M6 1-1.2
  > [  90.65] M6 detected on 1-1.2
  > [  91.72] Restarting Squeezelite player...
  > Squeezelite is not running.
  > Starting Squeezelite player: Squeezelite...
  > [  92.76] Squeezelite not running.
  > [  93.82] Restarting Squeezelite player...
  > Squeezelite is not running.
  > Starting Squeezelite player: Squeezelite...
  > [  94.86] Squeezelite not running.
  > [  95.92] Restarting Squeezelite player...
  > Squeezelite is not running.
  > Starting Squeezelite player: Squeezelite...
  > [  96.96] Squeezelite not running.
  > [  98.02] Restarting Squeezelite player...
  > Squeezelite is not running.
  > Starting Squeezelite player: Squeezelite...
  > [  99.06] Squeezelite not running.
  > [ 100.12] Restarting Squeezelite player...
  > Squeezelite is not running.
  > Starting Squeezelite player: Squeezelite...
  > [ 101.16] Squeezelite not running.
  > [ 101.17] Squeezelite failed to initialize within 5 attempts.

> > 
> 
> /etc/udev/rules.d/10-M6.rules
> > 
Code:

  >   > SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="0d8c", 
ATTR{idProduct}=="0004", RUN+="/home/tc/SQLITE-control.sh restart M6 $kernel"
  > SUBSYSTEM=="usb", ACTION=="remove", RUN+="/home/tc/SQLITE-control.sh stop 
M6 $kernel"
  > 

> > 

Thanks - that all looks fine, and the log file shows that the init.d
script has been asked to stop the process, and then its status report
confirms that it thinks the process has stopped.

What I can see in the init.d script is that the status check will only
return 'Squeezelite is running. PID=x' if there's a process ID
stored in /var/run/squeezelite.pid AND there's a currently running
squeezelite process with the same process ID.  Otherwise it will return
'Squeezelite not running.'  So for pCP to report that it's not running,
but for it to continue to work in LMS, I can only conclude that the stop
command has deleted /var/run/squeezelite.pid but didn't actually kill
the process.  The bit of the init.d script that handles this is:

Code:

stop)
if [ ! -f $PIDFILE ]; then
echo "$PNAME is not running."
exit 1
fi
echo "Stopping $DESC: $PNAME..."
start-stop-daemon --stop --quiet -p $PIDFILE
sudo rm -f $PIDFILE
;;
  



So there's an opportunity in there for an inconsistency to appear: the
$PIDFILE will be deleted immediately after the start-stop-daemon is
asked to stop the process, without checking that the process was
actually stopped.  Is it possible that the start-stop-daemon isn't
actually succeeding in stopping the process for some reason?



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


Re: [SlimDevices: Unix] 5" Touchscreen display that works with Jivelite right out of the box.

2021-03-07 Thread wtnh


Here is a build I just finished using the 3.5" Osoyoo display. I used a
2U "Galaxy" chassis from the 'DIY Audio Store'
(https://diyaudiostore.com/collections/galaxy/products/2u-w-steel-covers?variant=12174833028)
and had them custom CNC the front panel.

This photo shows the display mounted to the back of the panel in a
recessed cavity and held in place by 4 plastic clips. Also, a rotary
encoder which I set up to allow navigation of the piCorePlayer display.
Details of that are in 'this post'
(https://forums.slimdevices.com/showthread.php?107001-ANNOUNCE-SqueezeButtonPi-Tool-to-use-buttons-and-rotary-encoders-on-a-RPi&p=1010055&viewfull=1#post1010055).

33672

Here is the interior. The Pi is on the left and the 5 Volt linear power
supply board (which I had leftover from another project) is next to it.
I am using a 'Khadas Tone 1 USB DAC' (https://www.khadas.com/tone1). I
had to replace the short Osoyoo cable with a longer one, which I got
from Amazon - make sure you get a type A flat cable (the Raspberry Pi
version is type B and won't work with the Osoyoo).

33673

Here is the back of the unit. I am also using a USB Wifi dongle and an
RF remote.

33674

And here is the front of the completed project. The only thing left to
do is to figure out how to adjust the backlight, which is a little too
bright. The standard piCorePlayer adjustment does not work since it does
not recognize the Osoyoo as an official Raspberry Pi display. Osoyoo has
a suggestion in their user manual, but that does not work on the
piCorePlayer distro.

33675


+---+
|Filename: IMG_1094.jpg |
|Download: http://forums.slimdevices.com/attachment.php?attachmentid=33675|
+---+


wtnh's Profile: http://forums.slimdevices.com/member.php?userid=36993
View this thread: http://forums.slimdevices.com/showthread.php?t=113708

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


Re: [SlimDevices: Unix] [How To] Using the Argon One case for the Pi 4B together with piCorePlayer (7.x)

2021-03-07 Thread tobal2


Thanks for this tutorial!
Everything working as expected. 

Cheers,
CSL


Sent from my iPhone using Tapatalk





tobal2's Profile: http://forums.slimdevices.com/member.php?userid=68995
View this thread: http://forums.slimdevices.com/showthread.php?t=113575

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


Re: [SlimDevices: Unix] Start/restart squeezelite when plug-in USB dac

2021-03-07 Thread paul-


chill wrote: 
> Hi Paul - good to have another pair of eyes on this.  No, I don't
> believe there's anything different.  I think udev calls the script as
> root, but the crucial line that seems to be acting differently between
> the scenarios is 'sudo'ed anyway.
> > 
Code:

  >   > sudo /usr/local/etc/init.d/squeezelite restart
  > 

> > 
> 
> If there is anything different about the environment, I can't
> understand why it's affecting Bogg, and not me or a couple of others
> who have tried this.

The environment under udev is going to be a lot different



piCorePlayer a small player for the Raspberry Pi in RAM. 
Homepage: https://www.picoreplayer.org

Please 'donate'
(https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=U7JHY5WYHCNRU&lc=GB¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted)
if you like the piCorePlayer

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


Re: [SlimDevices: Unix] Start/restart squeezelite when plug-in USB dac

2021-03-07 Thread Paul Webster


Material will be getting its info from LMS - but pCP web interface
possibly doing its own local check ... perhaps checking for pid file.

You could edit the init.d script to put some tracing in it.



Paul Webster
http://dabdig.blogspot.com
author of \"now playing\" plugins covering radio france (fip etc), kcrw,
supla finland, abc australia, cbc/radio-canada and rte ireland

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


Re: [SlimDevices: Unix] Start/restart squeezelite when plug-in USB dac

2021-03-07 Thread Bogg


Here's my adjusted script. The stop part is in there as far I can see.
I've (hopefully) just changed the 2 local bits near the beginning, and
the sudo line just now.

33671

Starting from a fresh reboot, dac on, working sqlite etc, then dac off,
and dac back on. 
M6 Log

Code:

[  18.48] Script parameters: find M6 
  [  18.55] Searching for M6 with idVendor=0d8c and idProduct=0004 in dmesg
  [  18.59] M6 detected on  1-1.2
  [  18.61] Restoring alsa settings for M6
  [  67.33] Script parameters: stop M6 1-1.2:1.1
  [  67.33] Script parameters: stop M6 1-1.2:1.0
  [  67.47] Script parameters: stop M6 1-1.2:1.2
  [  67.49] Script parameters: stop M6 1-1.2
  [  67.50] M6 on 1-1.2 removed
  [  67.53] Stopping Squeezelite player: Squeezelite...
  [  67.55] /tmp/M6.kername deleted
  [  90.64] Script parameters: restart M6 1-1.2
  [  90.65] M6 detected on 1-1.2
  [  91.72] Restarting Squeezelite player...
  Squeezelite is not running.
  Starting Squeezelite player: Squeezelite...
  [  92.76] Squeezelite not running.
  [  93.82] Restarting Squeezelite player...
  Squeezelite is not running.
  Starting Squeezelite player: Squeezelite...
  [  94.86] Squeezelite not running.
  [  95.92] Restarting Squeezelite player...
  Squeezelite is not running.
  Starting Squeezelite player: Squeezelite...
  [  96.96] Squeezelite not running.
  [  98.02] Restarting Squeezelite player...
  Squeezelite is not running.
  Starting Squeezelite player: Squeezelite...
  [  99.06] Squeezelite not running.
  [ 100.12] Restarting Squeezelite player...
  Squeezelite is not running.
  Starting Squeezelite player: Squeezelite...
  [ 101.16] Squeezelite not running.
  [ 101.17] Squeezelite failed to initialize within 5 attempts.



/etc/udev/rules.d/10-M6.rules

Code:

SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="0d8c", 
ATTR{idProduct}=="0004", RUN+="/home/tc/SQLITE-control.sh restart M6 $kernel"
  SUBSYSTEM=="usb", ACTION=="remove", RUN+="/home/tc/SQLITE-control.sh stop M6 
$kernel"
  



+---+
|Filename: SQLITE-control (2).zip   |
|Download: http://forums.slimdevices.com/attachment.php?attachmentid=33671|
+---+


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


Re: [SlimDevices: Unix] Start/restart squeezelite when plug-in USB dac

2021-03-07 Thread chill


and just to check, can you post the contents of your
/etc/udev/rules.d/10-M6.rules file.



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


Re: [SlimDevices: Unix] Start/restart squeezelite when plug-in USB dac

2021-03-07 Thread chill


Bogg wrote: 
> Twice more, and I made sure I wasn't using --nostop as it had the same
> behaviour
> 
> I just did the install and reboot a third time, just to be sure, and
> everything is as I describe above, including not being able to restart
> sqlite from the webpage.

You're right - it does appear as though the stop command isn't working
now.  What does the M6.log file show?  Double check that the new stop
command has been entered correctly in the script?



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


Re: [SlimDevices: Unix] Start/restart squeezelite when plug-in USB dac

2021-03-07 Thread Bogg


chill wrote: 
> Tsk - that's just muddied the waters even more!
> 
> I take it you've done a reboot since making the latest script changes?

Twice more, and I made sure I wasn't using --nostop as it had the same
behaviour



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


Re: [SlimDevices: Unix] Start/restart squeezelite when plug-in USB dac

2021-03-07 Thread chill


Tsk - that's just muddied the waters even more!

I take it you've done a reboot since making the latest script changes?



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


Re: [SlimDevices: Unix] Start/restart squeezelite when plug-in USB dac

2021-03-07 Thread Bogg


That's made a lot of difference!
It seems to have the same effect as using --nostop. But I'd have to do
all the same procedures in --nostop to check.

Starting with 
Dac on - sqlite showing working in pcp web and default /material / apps
Dac off - now shows Not running in pcp web, BUT now shows working in
default /material, 
I can still operate the sqlite player from jivelite or material, I can
switch it on and off and jivelite display reacts as expected. 
Other players that are synced to the sqlite player that is still on now
pause ever minute or so like when using --nostop. If I soft off the
sqlite the pausing seems to go away.
Dac On - Music starts so it's running - pcp continues to show not
running - default shows it's running and connected.

This may be of interest - after the above now that pcp web shows not
running but it is, if I click restart squeezlite from pcp web main page
I get this - 

Restarting Squeezelite
[ INFO ] Squeezelite is not running.

[ INFO ] Starting Squeezelite player: Squeezelite...

[ ERROR ] Squeezelite not running.



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


Re: [SlimDevices: Unix] Start/restart squeezelite when plug-in USB dac

2021-03-07 Thread chill


Bogg wrote: 
> Hi again. And thanks again. On with the show.
> 
> Here are my steps for clarity - 
> Dac on - run install without --nostop - pcp br - dac off (sqlite auto
> killed, not showing in material, but showing on pcp web)
> 
> > 
Code:

  >   > tc@pCP:~$ ps | grep squeezelite
  > 6066 root  0:02 /usr/local/bin/squeezelite -n piCorePlayer -o 
hw:CARD=M6,DEV=0 -a 80 4  1  -v
  > 9987 tc0:00 grep squeezelite
  > tc@pCP:~$ sudo /usr/local/etc/init.d/squeezelite status
  > Squeezelite is running. PID=6066
  > 

> > 
> 
> 


So here we see again the symptom that the pCP interface is apparently
out of sync with the actual state of squeezelite.  When you power off
the DAC it disappears from Material, yet it's apparently still running:
ps is still showing it has a PID of 6066 and the pCP web interface says
it's running.

So I would start to doubt that the 'stop' function of the script is
working, except that it disappears from Material.  I wonder how that can
be the case - how can 'sudo /usr/local/etc/init.d/squeezelite status'
report that it's running, but Material doesn't see it?  Maybe this is
the key to what's going on.

When it disappears from Material, are you able to select the player and
play something on it in the default LMS interface?  Of has it gone from
the default interface too?

Bogg wrote: 
> Dac on - sqlite still killed on material, changes to killed on pcp web
> (I've checked this so many times, it's definitely not me not refreshing
> the browser)
> 
> > 
Code:

  >   > 
  > tc@pCP:~$ ps | grep squeezelite
  > 10558 tc0:00 grep squeezelite
  > tc@pCP:~$ sudo /usr/local/etc/init.d/squeezelite status
  > Squeezelite not running.
  > 

> > 

And here's the other half of the same problem - reconnecting the DAC
apparently -stops- Squeezelite to the satisfaction of both Material and
the pCP web page!

Ah, wait
I've just noticed that the 'stop' section of the script is not using
'sudo' to issue the stop command.  I don't believe this makes a
practical difference - I see an 'Operation not permitted', but it kills
Squeezelite nonetheless.  But it might be worth seeing if this fixes
things in your case.  At line 138 in the original script (probably 139
in yours after adding the 'local' declaration), change this line:

Code:

result=$(/usr/local/etc/init.d/squeezelite stop)
  


to this:

Code:

result="$(sudo /usr/local/etc/init.d/squeezelite stop)"
  




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


Re: [SlimDevices: Unix] Start/restart squeezelite when plug-in USB dac

2021-03-07 Thread Bogg


Hi again. And thanks again. On with the show.

Here are my steps for clarity - 
Dac on - run install without --nostop - pcp br - dac off (sqlite auto
killed, not showing in material, but showing on pcp web)


Code:

tc@pCP:~$ ps | grep squeezelite
  6066 root  0:02 /usr/local/bin/squeezelite -n piCorePlayer -o 
hw:CARD=M6,DEV=0 -a 80 4  1  -v
  9987 tc0:00 grep squeezelite
  tc@pCP:~$ sudo /usr/local/etc/init.d/squeezelite status
  Squeezelite is running. PID=6066
  



Dac on - sqlite still killed on material, changes to killed on pcp web
(I've checked this so many times, it's definitely not me not refreshing
the browser)


Code:


  tc@pCP:~$ ps | grep squeezelite
  10558 tc0:00 grep squeezelite
  tc@pCP:~$ sudo /usr/local/etc/init.d/squeezelite status
  Squeezelite not running.
  




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


Re: [SlimDevices: Unix] Start/restart squeezelite when plug-in USB dac

2021-03-07 Thread chill


Paul Webster wrote: 
> I haven't read through this all so apologies if this does not help ...
> 
> I assume that when run via udev it is not necessarily being run as the
> same user and with the same environment as when run interactively.
> So - is there anything in the called startup script that relies on stuff
> that is not setup because of that?

Hi Paul - good to have another pair of eyes on this.  No, I don't
believe there's anything different.  I think udev calls the script as
root, but the crucial line that seems to be acting differently between
the scenarios is 'sudo'ed anyway.

Code:

sudo /usr/local/etc/init.d/squeezelite restart
  



If there is anything different about the environment, I can't understand
why it's affecting Bogg, and not me or a couple of others who have tried
this.



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


Re: [SlimDevices: Unix] Start/restart squeezelite when plug-in USB dac

2021-03-07 Thread Paul Webster


I haven't read through this all so apologies if this does not help ...

I assume that when run via udev it is not necessarily being run as the
same user and with the same environment as when run interactively.
So - is there anything in the called startup script that relies on stuff
that is not setup because of that?



Paul Webster
http://dabdig.blogspot.com
author of \"now playing\" plugins covering radio france (fip etc), kcrw,
supla finland, abc australia, cbc/radio-canada and rte ireland

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


Re: [SlimDevices: Unix] Start/restart squeezelite when plug-in USB dac

2021-03-07 Thread chill


Bogg wrote: 
> Sorry, in my excitement for progress I wasn't too clear.
> Unfortunatly it only restarts once, and the restart command needs to be
> run each time.
> 
> Here's the new sudo output and log when it has worked
> Dac on (working) - dac off - dac on (not working) - run restart
> 
> > 
Code:

  >   > tc@pCP:~$ sudo /home/tc/SQLITE-control.sh restart M6 1-1.2
  > tc@pCP:~$ No state is present for card M6
  > No state is present for card M6
  > 

> > 
> 
> > 
Code:

  >   > 
  > [ 305.14] Script parameters: stop M6 1-1.2:1.1
  > [ 305.14] Script parameters: stop M6 1-1.2:1.0
  > [ 305.31] Script parameters: stop M6 1-1.2:1.2
  > [ 305.33] Script parameters: stop M6 1-1.2
  > [ 305.34] M6 on 1-1.2 removed
  > [ 305.38] Stopping Squeezelite player: Squeezelite...
  > [ 305.39] /tmp/M6.kername deleted
  > [ 331.27] Script parameters: restart M6 1-1.2
  > [ 331.28] M6 detected on 1-1.2
  > [ 332.36] Restarting Squeezelite player...
  > Stopping Squeezelite player: Squeezelite...
  > Starting Squeezelite player: Squeezelite...
  > [ 333.39] Squeezelite not running.
  > [ 334.45] Restarting Squeezelite player...
  > Squeezelite is not running.
  > Starting Squeezelite player: Squeezelite...
  > [ 335.48] Squeezelite not running.
  > [ 336.54] Restarting Squeezelite player...
  > Squeezelite is not running.
  > Starting Squeezelite player: Squeezelite...
  > [ 337.57] Squeezelite not running.
  > [ 338.63] Restarting Squeezelite player...
  > Squeezelite is not running.
  > Starting Squeezelite player: Squeezelite...
  > [ 339.67] Squeezelite not running.
  > [ 340.73] Restarting Squeezelite player...
  > Squeezelite is not running.
  > Starting Squeezelite player: Squeezelite...
  > [ 341.77] Squeezelite not running.
  > [ 341.78] Squeezelite failed to initialize within 5 attempts.
  > [ 356.94] Script parameters: restart M6 1-1.2
  > [ 356.95] M6 detected on 1-1.2
  > [ 358.02] Restarting Squeezelite player...
  > Squeezelite is not running.
  > Starting Squeezelite player: Squeezelite...
  > [ 359.08] Squeezelite is running. PID=11530
  > [ 359.15] Restoring alsa settings for M6
  > 

> > 
> 

Well this has me completely confused I'm afraid.  What the above shows
is that the very same script, the one that is failing to start
Squeezelite after 5 attempts when triggered by the udev rule, works when
called manually from the command line. i.e.:
The udev rule calls the script at 331.27 seconds in:

Code:

[ 331.27] Script parameters: restart M6 1-1.2


This apparently failed to start Squeezelite 5 times.

The manual script call was at 356.94 seconds in:

Code:

[ 356.94] Script parameters: restart M6 1-1.2


This evidently managed to start Squeezelite at the first attempt.

And it's not even the script itself that is failing - it's being
triggered with the right parameters, the built-in restart command is
being called correctly and is attempting to start Squeezelite, but seems
to fail to work in the former case:

Code:

sudo /usr/local/etc/init.d/squeezelite restart



I can see no reason for this, and what's doubly confusing is that I
don't see this behaviour with either of the USB DAC setups that I have
here, yet you clearly have a very standard setup.  I will have to think
carefully about how to isolate the problem.

Since I can't recreate the problem, the only way I can think to tackle
it is to ask you to do some experimenting:
At the point where you called the script manually, could you try some
different steps.  So, from the top:

1) Re-run the 'install' option but without the --nostop option. This
should recreate the rules file with both options. Reboot.
2) Disconnect the DAC. This should kill the Squeezelite process.

Code:

ps | grep squeezelite
  sudo /usr/local/etc/init.d/squeezelite status


3) Reconnect the DAC. The expected behaviour would be for Squeezelite to
restart, but we know that in your case this is not working - it fails
after 5 attempts. At this point, instead of issuing the restart command
manually from the command line, let's see what's going on:

Code:

ps | grep squeezelite
  sudo /usr/local/etc/init.d/squeezelite status




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