Re: [SlimDevices: Unix] ANNOUNCE: piCorePlayer 7.0.0
bluetdi wrote: > Not really helpful your reply. I want to turn off the lightning. If you think it is not helpful, why are you looking now for a new power supply? I told you that the voltage of your power supply is not enough for the Pi and that is the reason for the lightning. pi4 4gb picoreplayer with lms and squeezelite for usb inside an argon one case pi3b+ (7\" display, hifiberry dac+ pro) picoreplayer with squeezlite/jivelite for hifiberry and bluetooth headphone inside a smartipi touch case two airport express ikea symfonisk carsten_h's Profile: http://forums.slimdevices.com/member.php?userid=69113 View this thread: http://forums.slimdevices.com/showthread.php?t=113512 ___ unix mailing list unix@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/unix
Re: [SlimDevices: Unix] ANNOUNCE: piCorePlayer 7.0.0
Thanks for your answers. I read some reviews of PS for the Pi with a 7"-screen and now ordered the official one. It will be delivered tomorrow and I hope it has enough power for both so the lighning disappears. My other 2 Pi with screen dont have this problem so I presume it must be the PS that delivers enough current but voltage drops because the cable is too thin. 3xPi3B-7"+pCP 6.0 | LMS 8.0.1 | Transporter | 2xTouch | 2xClassic | 2xBoom | 2xRadio | iPeng [Discarded: 2xOdroid U3+m2p+LMS] bluetdi's Profile: http://forums.slimdevices.com/member.php?userid=20633 View this thread: http://forums.slimdevices.com/showthread.php?t=113512 ___ 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
> The cardname is then part of the $OUTPUT variable, e.g. > "hw:CARD=DragonFly,DEV=0", from which 'DragonFly' would need to be > extracted. > I can make that be the default, but I'll allow overriding it on the command line. > 2) Do you have any thoughts on the frequency that this script checks for > the DAC? You've currently set 4 seconds, but how much of a drain on > resources would it cause if that was, say, 1 second? Maybe make this a > command line argument? > Anything would work. I can make it 1 second. I confess it makes me twitch a little, but 1 second is eons in modern computer clock speed time. > 3) If you put the log file in /var/log/, and precede its name with > 'pcp_', it will show up in the pCP -> Diagnostics -> Logs page, so users > won't have to use a separate shell to see what's going on. It needs root > permissions to write to this folder, but I think that's OK because User > Commands are run as root. > Okay. Didn't know about that. Can do. > 4) For my own setup I prefer that Squeezelite is soft powered on when > the DAC is turned on, regardless of its previous soft power state, so > I've been learning about the necessary JSON commands to do that this > evening. So for my own copy I'm going to add a function to do that and > add it to the commands that are run when the device appears. > You go guy! I have no idea what you're talking about. :-) > 5) There's at least one user of the udev script who does not want > Squeezelite to be killed when the DAC is powered off. I added the > --nostop option so that the 'remove' udev rule was omitted in the > installation. I wonder if a --nostop command line option could be added > to your script to achieve the same result. > I'm not sure what a --nostop would do. All I call is "restart" now, not "stop". If they don't want "restart" either, then... why would they run this script? The only thing that happens right now when unplugging the device is a log message. > Whilst I'll be happy to do these modifications for myself, I'm more than > keen to see how an experienced programmer would make them . I > learn a little bit more every time I look at someone else's code. > Don't worry -- my sense of ownership will fade very quickly, and I'll be happy to let you take over. ;-) 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
pgf wrote: > Since you're thinking of looking at my script, here's a cleaned up > version. It makes it a little more obvious where to put one's > commands. > > I call it "watch_usb_audio". > That's great - so many neat little tricks that I've not seen before, as befits a busybox contributor! Thanks for posting. I shall enjoy playing with that tomorrow. Some immediate thoughts: 1) Audiodev can be read from /usr/local/etc/pcp/pcp.cfg. That would make it completely general, and would mean it doesn't need a command line argument. It would also mean it would adapt to a different DAC when it is configured in the pCP Squeezelite settings. I did this in the udev script with Code: cardname=$(cat /usr/local/etc/pcp/pcp.cfg | grep ^OUTPUT | awk -FCARD= {'print $2'} | awk -F, {'print $1'}) but I saw the pCP team's much neater way of doing it in the init.d script: Code: # Read from config file . /usr/local/etc/pcp/pcp.cfg The cardname is then part of the $OUTPUT variable, e.g. "hw:CARD=DragonFly,DEV=0", from which 'DragonFly' would need to be extracted. 2) Do you have any thoughts on the frequency that this script checks for the DAC? You've currently set 4 seconds, but how much of a drain on resources would it cause if that was, say, 1 second? Maybe make this a command line argument? 3) If you put the log file in /var/log/, and precede its name with 'pcp_', it will show up in the pCP -> Diagnostics -> Logs page, so users won't have to use a separate shell to see what's going on. It needs root permissions to write to this folder, but I think that's OK because User Commands are run as root. 4) For my own setup I prefer that Squeezelite is soft powered on when the DAC is turned on, regardless of its previous soft power state, so I've been learning about the necessary JSON commands to do that this evening. So for my own copy I'm going to add a function to do that and add it to the commands that are run when the device appears. 5) There's at least one user of the udev script who does not want Squeezelite to be killed when the DAC is powered off. I added the --nostop option so that the 'remove' udev rule was omitted in the installation. I wonder if a --nostop command line option could be added to your script to achieve the same result. Whilst I'll be happy to do these modifications for myself, I'm more than keen to see how an experienced programmer would make them :). I learn a little bit more every time I look at someone else's code. 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] Howto create a linux kernel IR remote keytable for Jivelite on piCorePlayer 5
NoobNR7 wrote: > Jeff you saved my day/ saved me days... > > You made me realize I was thinking the wrong way around... > > It's working! :D:D:D > > Man that was easy:cool: > Haha... > > I will try some other stuff. Very satisfying after struggling for hours. > Making it so difficult. Going way to deep for my knowing... lirc... > inputlircd... jivelite jivelite ir... tweaks bashing around,,, > Being a noob... in every possible way... :o > Ah man that feels fine... and stupid in another way. Anyhow I am so > happy it's working now.:):):) Glad you got it working Yes you only need to mess around if you are controlling squeezelite, controlling Jivelite is easy with the FLIRC Jeff *Want a webapp ?* Get SqueezeLite-X ! https://forums.slimdevices.com/showthread.php?108550-Announce-Squeezelite-X=903953=1#post903953 Jeff07971's Profile: http://forums.slimdevices.com/member.php?userid=49290 View this thread: http://forums.slimdevices.com/showthread.php?t=110640 ___ unix mailing list unix@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/unix
Re: [SlimDevices: Unix] Howto create a linux kernel IR remote keytable for Jivelite on piCorePlayer 5
Jeff07971 wrote: > When using the Flirc USB Dongle you do not use lirc or keytables, the > FLIRC emulates a keyboard > > So program the FLIRC dongle to send the appropriate keys for the remote > control operation you want > > Jeff Jeff you saved my day/ saved me days... You made me realize I was thinking the wrong way around... It's working! :D:D:D Man that was easy:cool: Haha... I will try some other stuff. Very satisfying after struggling for hours. Making it so difficult. Going way to deep for my knowing... lirc... inputlircd... jivelite jivelite ir... tweaks bashing around,,, Being a noob... in every possible way... :o Ah man that feels fine... and stupid in another way. Anyhow I am so happy it's working now.:):):) NoobNR7's Profile: http://forums.slimdevices.com/member.php?userid=71477 View this thread: http://forums.slimdevices.com/showthread.php?t=110640 ___ 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
Heh. Yup. 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
Very nice. A minor point, I think your second comment should read: "# commands to run when the device is unplugged go here". coyrls's Profile: http://forums.slimdevices.com/member.php?userid=44253 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] Howto create a linux kernel IR remote keytable for Jivelite on piCorePlayer 5
Jeff07971 wrote: > When using the Flirc USB Dongle you do not use lirc or keytables, the > FLIRC emulates a keyboard > > So program the FLIRC dongle to send the appropriate keys for the remote > control operation you want > > Jeff Thank you Jeff for answering my question. I bought the flirc some time ago. Hoping it would make my pcp life easier... I did not got it to work a while ago... The past weekend was my second attempt. I programmed the flirc with some keys on my Windows PC. If I use the flirc dongle on my Windows system I can see the keys I have programmed when I use notepad. On my picoreplayer nothing happens? If I understand you correct? I do not need to activate lirc? I do not have to activate jivelite and/or jivelite ir settings? Jivelite was the keytable way? Just put in the correct keys when I am programming the flirc usb receiver? Ah ok... I just connected my Logitech wireless keyboard. It works like that? Oh... well my Logitech keyboard works of course... I used when I installed pcp for first time... I am going to try some things... Will be back to let you know. You just put my thoughts on a different track. Thank you Jeff :D NoobNR7's Profile: http://forums.slimdevices.com/member.php?userid=71477 View this thread: http://forums.slimdevices.com/showthread.php?t=110640 ___ 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
Since you're thinking of looking at my script, here's a cleaned up version. It makes it a little more obvious where to put one's commands. I call it "watch_usb_audio". Code: #!/bin/sh exec >/home/tc/watch_usb_audio.log 2>&1 audiodev=$1 usage() { cat <&2 usage: $0 audio-device-name The only argument to this script should be your USB audio device name, as seen in /proc/asound. On my machine my Harman Kardon Soundsticks show up as "Soundsticks": $ ls -F /proc/asound Headphones@ card1/ hwdeppcm version SoundSticks@ cardsmodules seq/ card0/ devices oss/ timers EOF exit 1 } if [ ! "$audiodev" ] then usage fi log() { echo $(date +%Y-%m/%d-%X) "$@" } device_present() { test -e /proc/asound/$audiodev } wait_for_device() { while ! device_present do sleep 4 done } wait_for_device_to_go_away() { while device_present do sleep 4 done } watch_usb_audio() { while : loop forever do wait_for_device log $audiodev is now present # commands to run when the device is plugged in go here alsactl restore /usr/local/etc/init.d/squeezelite restart wait_for_device_to_go_away log $audiodev has vanished # commands to run when the device is plugged in go here done } log "Watching for USB device '$audiodev'" if ! device_present then log Device not present at startup. Will wait... fi watch_usb_audio & 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] ANNOUNCE: piCorePlayer 7.0.0
chill wrote: > I don't think a dual-PS, if such a thing exists, would be any different > from a splitter attached to a single PS. The important thing is that > the PS should be regulated. An unregulated supply can measure higher > than the rated voltage under no load, but can drop below the rated > voltage under a high enough load.Even regulated power supplies can be > problematic if the output cable is too thin. I don't think any Pi power supplies have remote voltage sensing. 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=113512 ___ unix mailing list unix@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/unix
Re: [SlimDevices: Unix] ANNOUNCE: piCorePlayer 7.0.0
bluetdi wrote: > Thank you @paul- > > I will look for a dual-PS with enough power for the screen and the Pi > and feed them separately. I don't think a dual-PS, if such a thing exists, would be any different from a splitter attached to a single PS. The important thing is that the PS should be regulated. An unregulated supply can measure higher than the rated voltage under no load, but can drop below the rated voltage under a high enough load. chill's Profile: http://forums.slimdevices.com/member.php?userid=10839 View this thread: http://forums.slimdevices.com/showthread.php?t=113512 ___ unix mailing list unix@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/unix
Re: [SlimDevices: Unix] ANNOUNCE: piCorePlayer 7.0.0
Thank you @paul- I will look for a dual-PS with enough power for the screen and the Pi and feed them separately. 3xPi3B-7"+pCP 6.0 | LMS 8.0.1 | Transporter | 2xTouch | 2xClassic | 2xBoom | 2xRadio | iPeng [Discarded: 2xOdroid U3+m2p+LMS] bluetdi's Profile: http://forums.slimdevices.com/member.php?userid=20633 View this thread: http://forums.slimdevices.com/showthread.php?t=113512 ___ unix mailing list unix@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/unix
Re: [SlimDevices: Unix] Howto create a linux kernel IR remote keytable for Jivelite on piCorePlayer 5
NoobNR7 wrote: > Hi Ralphy, > > Hoping you can help me out? I am struggling to get IR working on my old > raspberry with pcp. > > Trying to install/ use flirc ir usb receiver with a remote lying around > in the house. > (wich is preferred ir remote (easiest/ future proof) method in > 2021?(Jivelite or Lirc?)) > > Trying your steps from your first post. > With Jivelite IR enabled my Flirc usb dongle is not working. > > sudo ir-keytable doesn't seem to show my flirc usb device? > I think it only shows gpio_ir_receiver? No usb device mentioned. > When i "sudo ir-keytable -t" I do not see anything being displayed. So I > have yet to make my own keytable file/ settings? > > I had the remote working :D for a little while on pcp. But when I > rebooted I had to take all steps again. > So I think the Philips remote and flirc do work? > The time I got it working was when I followed the steps mentioned > further down in this thread. I tried it with inputlircd. But now I do > not seem to get that working anymore? > > I am sorry I am a noob. > Enjoying my pcp. Wish I could use ir remote with it. > I do not know what is wrong: flirc usb dongle? My remote? Me trying to > config pcp? > > I read quite some hours already. Believing de solution is around the > corner. I just can't see it. > Hoping you can help me find it. When using the Flirc USB Dongle you do not use lirc or keytables, the FLIRC emulates a keyboard So program the FLIRC dongle to send the appropriate keys for the remote control operation you want Jeff *Want a webapp ?* Get SqueezeLite-X ! https://forums.slimdevices.com/showthread.php?108550-Announce-Squeezelite-X=903953=1#post903953 Jeff07971's Profile: http://forums.slimdevices.com/member.php?userid=49290 View this thread: http://forums.slimdevices.com/showthread.php?t=110640 ___ unix mailing list unix@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/unix
Re: [SlimDevices: Unix] ANNOUNCE: piCorePlayer 7.0.0
I do not believe there is a way to turn it off. That is handled in the firmware, which is not open source. Common problems are with too cheap of a cable/connector on the power supply, or something connected the the USB port that is pulling the RPI internal voltage too low. If you are using the RPI 7" display, do not power it from the GPIO, use a splitter and power it separately. 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=U7JHY5WYHCNRU=GB_code=USD=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=113512 ___ unix mailing list unix@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/unix
Re: [SlimDevices: Unix] ANNOUNCE: piCorePlayer 7.0.0
carsten_h wrote: > You see the difference? It really is undervoltage, not undercurrent! > When the *voltage* is too low the lightning appears. I have a few power > supplies that deliver 3A, but the voltage is at 4,9V when the Pi is > drawing 1A and that is too low for the Pi. Not really helpful your reply. I want to turn off the lightning. And: As you can read in the post from @slartibartfast 4,9 Volt should be enough, so it seems to me your voltage measure is not correct or theres something wrong with your system. 3xPi3B-7"+pCP 6.0 | LMS 8.0.1 | Transporter | 2xTouch | 2xClassic | 2xBoom | 2xRadio | iPeng [Discarded: 2xOdroid U3+m2p+LMS] bluetdi's Profile: http://forums.slimdevices.com/member.php?userid=20633 View this thread: http://forums.slimdevices.com/showthread.php?t=113512 ___ 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
chill wrote: > > More good advice, thank you. But why is it a bad habit? > > When a process receives a signal, it usually has a chance to do something -- in fact, some signals are -only- used for "doing something", and don't kill a process by default. They might be used to tell the process to re-read its config file, for instance. But even if it's being told to die (which is what SIGTERM, the default signal from kill) is usually used for, it still might want to flush some output buffers, or if it has created its own pidfile, it might want to remove it. At the very least, the process might want to log that it's dying because of a signal. So it would do any of those things before calling exit. Now, a misbehaved (or buggy) process might catch your SIGTERM signal and then not exit. That's what SIGKILL (i.e., kill -9) is for. SIGKILL can't be caught and handled by a process -- it just kills it immediately. If you use it by habit, you may be preventing the process you're killing from doing an orderly shutdown. Kind of like pulling the plug on your PC instead of typing shutdown. It'll usually be fine when you start it back up, but then that one time ;-) 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
[SlimDevices: Unix] Help..rpi4 and WAP fail to download......and pi4 lms/squeezelite standalone question
Hello.. On my rpi4 (2gb) no mater what I do .fresh pcp 7.0 64 bit installs and/or anywhere along the process of installing lms, resizing partitions, etc I cannot successfully execute the WAP install , always get a downloading package error?..anybody have any ideas, thx in advance. 2nd question is with a rpi4 standalone (meaning both lms/squeezlite running on same rpi4 from/with usb stick/drive or 3rd partition sd card and built in WiFi) using a router to be able to control from iPad, etc .. is the music files actually being sent from lms server wirelessly to router and back again to rpi/squeezelite ...or is the router just relaying the wireless commands? Thx again all LanceL's Profile: http://forums.slimdevices.com/member.php?userid=68344 View this thread: http://forums.slimdevices.com/showthread.php?t=114111 ___ 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
pgf wrote: > Just a nit. This line, from your script, does _not_ create the pidfile > using sudo: > > Code: > > sudo /bin/echo "$PID" > $PIDFILE > > > > Ooh, thank you - I did wonder about that. Thanks for the tip about tee. pgf wrote: > > I still don't believe that "kill" will do anything different than > /bin/kill, given the two are running in an identical environment. (I > also don't believe you should be using "-9" everywhere. Squeezelite > dies perfectly happily with a plain "kill". Using -9 is a bad habit.) > More good advice, thank you. But why is it a bad habit? pgf wrote: > > I do have a couple of other comments on and questions about your script, > if you don't mind. Not that I see anything explicitly wrong, but maybe > they can be simplified, and simpler code is easier and safer. > > First: > Is there any reason not to just use the shell to find the binary? And, > why does it matter if it's a symlink. > I copied this code from the init.d script. I believe it uses this approach because of the pCP option to use a bespoke squeezelite binary instead of the supplied one. Not sure about the symlink stuff. pgf wrote: > > Second: > Anything wrong with letting the shell tell you the PID? That's what $! > is for. It always contains the pid of the last process put into the > background. > Yeah, that's my code. And I didn't know better. Now I do :) pgf wrote: > > Lastly, even though you're no longer using the init.d script to > start/stop the daemon, you're still using it to check the daemon's > status. But all it does when you ask, is checks to see if the pidfile > exists. You should also also check to see if the process represented by > that pidfile exists. You can do that with the "-0" option to kill: > The init.d script does check whether a process with the same PID as the one in the pidfile is running: Code: status) # Check if our squeezelite daemon is running. if [ -f $PIDFILE ]; then PID=`cat $PIDFILE` PIDS=`/bin/busybox pgrep $DAEMON | awk '{printf "%s ", $1}'` for GOTPID in $PIDS; do if [ x"$GOTPID" = x"$PID" ]; then echo "$PNAME is running. PID=$PID" exit 0 fi done fi echo "$PNAME not running." exit 1 ;; I think this approach allows for the possibility that a user might start a second squeezelite process via a command line, e.g. a bluetooth player. pgf wrote: > Anyway, I'm sure you'll figure out your problem. You set yourself a > lofty goal when you started this project, and you've done well so far! > I'm more and more starting to think that your approach would be a better way to do this! As a user command, it would probably avoid all the issues around the start-stop-daemon behaving differently under udev. 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
chill wrote: > > I can't recall whether I've tried modifying the init.d script to use > sudo with the start-stop-daemon. Something else to try Made no difference. The daemon was unable to stop the process on my Pi3A+. I have a new Pi4B arriving tomorrow*, so I'm going to start afresh with virgin pCP7 images just to make sure I'm comparing like with like. *Bought it from Digikey, only because I needed something to take me over the free carriage threshold. So that saved me £13, and it was £11 cheaper than in the UK as well, so £24 'saved'. It would have been rude not to. :) 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
chill wrote: > Thanks for taking a look in that much detail. I'd love to agree with > your final statement, but I've been very careful to make sure that the > pidfile and the process stay in sync. My current test script avoids the > init.d script altogether - it starts Squeezelite manually (it doesn't > use 'sudo', but since it's called by udev the process is owned by root > anyway), and the pidfile is created with 'sudo bin/echo...' (perhaps the > sudo isn't necessary for the same reason that the script is run under > udev). > Just a nit. This line, from your script, does _not_ create the pidfile using sudo: Code: sudo /bin/echo "$PID" > $PIDFILE The echo runs as sudo, but the redirection into the pidfile is done as the non-sudoed script. In the shell language, redirections belong to the shell, not the command that they're redirecting. There are various workarounds, but the most popular I think is to use tee to write the file for you. (It turns out there aren't that many programs which will simply take stdin and put it into a file. Using tee for this is convenient, even if you have to discard the output from tee itself.) Code: echo $PID | sudo tee $PIDFILE >/dev/null As you say, the distinction should be moot, if it's being run from udev, so as I said, this is just a nit, and an FYI. > > > So with everything in sync, the default 'kill' is NOT able to kill the > process, whereas /bin/kill IS. In both cases, the kill command is being > called directly by the udev script (i.e. without invoking the > start-stop-daemon) in response to the DAC being unplugged, > > And of course there's the other thorny little complication that the > behaviour of 'start-stop-daemon stop' is different on my Pi4B, where it > works. I still don't believe that "kill" will do anything different than /bin/kill, given the two are running in an identical environment. (I also don't believe you should be using "-9" everywhere. Squeezelite dies perfectly happily with a plain "kill". Using -9 is a bad habit.) I do have a couple of other comments on and questions about your script, if you don't mind. Not that I see anything explicitly wrong, but maybe they can be simplified, and simpler code is easier and safer. First: Code: # Set DAEMON to the actual binary [ -f $TCEMNT/tce/squeezelite ] && DAEMON=`readlink $TCEMNT/tce/squeezelite` || DAEMON=/usr/local/bin/squeezelite # Legacy check, incase this is the binary instead of symlink. [ "$DAEMON" = "" ] && DAEMON=$TCEMNT/tce/squeezelite Is there any reason not to just use the shell to find the binary? And, why does it matter if it's a symlink. Code: DAEMON=$(which squeezelite) Second: Code: $DAEMON -n "$NAME" .& sleep 1 local PID=$(/bin/busybox pgrep $DAEMON | /usr/bin/awk '{print $1}') sudo /bin/echo "$PID" > $PIDFILE Anything wrong with letting the shell tell you the PID? That's what $! is for. It always contains the pid of the last process put into the background. Code: $DAEMON -n "$NAME" & echo $! >$PIDFILE Lastly, even though you're no longer using the init.d script to start/stop the daemon, you're still using it to check the daemon's status. But all it does when you ask, is checks to see if the pidfile exists. You should also also check to see if the process represented by that pidfile exists. You can do that with the "-0" option to kill: Code: if [ -e $PIDFILE ] && kill -0 $(cat $PIDFILE) then echo process is running else echo no process found fi Anyway, I'm sure you'll figure out your problem. You set yourself a lofty goal when you started this project, and you've done well so far! paul 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
pgf wrote: > One more possible gotcha with the init.d script: > I'd say this counts as an edge case that is unlikely to arise, because in normal operation pCP runs everything as root and everything stays in sync nicely. I don't believe these possible loopholes are what's behind the inability of the start-stop-daemon, on some devices, to kill the squeezelite process when invoked by a udev rule. But I could be wrong :) I can't recall whether I've tried modifying the init.d script to use sudo with the start-stop-daemon. Something else to try 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
chill wrote: > > > So with everything in sync, ... > That's a bit of a red herring in this particular case, since my test script calls the kill command without regard to the pidfile - purely for test purposes of course. I then tidy up if necessary by deleting both the pidfile and the squeezelite process to get back to a known state. 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
coyrls wrote: > In bash, you can disable a builtin with "enable -n" but the busybox > shell is ash, not bash and ash does not have the enable command. I have > struggled to find decent documentation for ash but what I have found > doesn't document any way to disable builtins. What is the issue with > using /bin/kill as the command? Thanks for looking into this. I have no issue with calling /bin/kill directly, but I wondered if the start-stop-daemon was relying on the default kill command. pgf has confirmed that it is using the system kill command however. 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
pgf wrote: > > I think there are a lot of places where scripts and test cases can go > wrong without needing to investigate the kill command itself. > Thanks for taking a look in that much detail. I'd love to agree with your final statement, but I've been very careful to make sure that the pidfile and the process stay in sync. My current test script avoids the init.d script altogether - it starts Squeezelite manually (it doesn't use 'sudo', but since it's called by udev the process is owned by root anyway), and the pidfile is created with 'sudo bin/echo...' (perhaps the sudo isn't necessary for the same reason that the script is run under udev). So with everything in sync, the default 'kill' is NOT able to kill the process, whereas /bin/kill IS. In both cases, the kill command is being called directly by the udev script (i.e. without invoking the start-stop-daemon) in response to the DAC being unplugged, And of course there's the other thorny little complication that the behaviour of 'start-stop-daemon stop' is different on my Pi4B, where it works. 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
One more possible gotcha with the init.d script: run the start script, using sudo. run the stop script, without sudo. the pid file is now gone, but the squeezelite processes are still there. run the start script again, using sudo. the script doesn't see a pidfile, so it starts a new squeezelite, and records its pid. but that squeezelite can't run, because another instance is already running. so it dies. you still have the old squeezelite running, but the pidfile is now incorrect. Code: ==kitchen(tc)>> sudo killall squeezelite ==kitchen(tc)>> sudo rm -f /var/run/squeezelite.pid ==kitchen(tc)>> sudo /usr/local/etc/init.d/squeezelite start Starting Squeezelite player: Squeezelite... ==kitchen(tc)>> cat /var/run/squeezelite.pid 4918 ==kitchen(tc)>> /usr/local/etc/init.d/squeezelite stop Stopping Squeezelite player: Squeezelite... start-stop-daemon: warning: killing process 4918: Operation not permitted ==kitchen(tc)>> cat /var/run/squeezelite.pid cat: can't open '/var/run/squeezelite.pid': No such file or directory ==kitchen(tc)>> sudo /usr/local/etc/init.d/squeezelite start Starting Squeezelite player: Squeezelite... ==kitchen(tc)>> ps | grep s[q]ueeze 4918 root 0:00 /usr/local/bin/squeezelite -n kitchen -o hw:CARD=SoundSticks,DEV=0 -a 80 4 1 -m 00 00 00 00 00 41 -s localhost ==kitchen(tc)>> cat /var/run/squeezelite.pid 4944 Honestly, chill, I'm surprised you've done as well as you have, given the tools you're working with. :-) 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
kill (from within ash) and /bin/kill (linked to busybox) are the same program, almost. The version in ash has to first handle job ids ("kill %2"), but then the common code is called. start-stop-daemon doesn't invoke a kill program at all. Like any reasonable program, it simply invokes the kill() system call itself. But decades of doing shell programming on unix/linux tell me that your problem isn't because kill isn't doing its job. There's something else wrong -- either kill isn't really being invoked, or its trying to kill the wrong process, or the pidfile contains the wrong pid, or something. Regarding the script /usr/local/etc/init.d/squeezelite: if it finds /var/run/squeezelite it thinks it's running. If it doesn't find it, it thinks it's not. That would be fine, except: If I kill squeezelite manually, with killall squeezelite, or pkill squeezelite, the processes go away, but the pid file remains. If (after removing /var/run/squeezelite.pid) I invoke "/usr/local/etc/init.d/squeezelite start" *without* sudo, squeezelite will happily start, running as the user "tc", but the pidfile won't be created (because tc doesn't have permissions to write to /var/run). Running the script again whether as tc or as root, yields "Squeezelite is not running.", simply because the pid file doesn't exist. Alternatively, if I run the ".../squeezelite start" with sudo, and then run the "stop" without sudo, then of course the processes are left running (tc doesn't have permission to kill them), but the pidfile is removed!! That's because the init.d script uses "sudo rm -f $PIDFILE". Sigh. If it's going to remove the pid file with sudo, it should invoke start-stop-daemon with sudo. But really, why is a system script using sudo at all?? I think there are a lot of places where scripts and test cases can go wrong without needing to investigate the kill command itself. paul 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
chill wrote: > That makes sense, thank you. > > So assuming that's the case, is there a way to override the default, > such that 'kill' (specified without a path) will use the busybox version > in /bin? > > It still seems possible that the start-stop-daemon is using the default > external command, rather than doing the same thing as kill via its own > source code, so I'd like to change the default and see if the behaviour > of the start-stop-daemon changes. In bash, you can disable a builtin with "enable -n" but the busybox shell is ash, not bash and ash does not have the enable command. I have struggled to find decent documentation for ash but what I have found doesn't document any way to disable builtins. What is the issue with using /bin/kill as the command? coyrls's Profile: http://forums.slimdevices.com/member.php?userid=44253 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] Howto create a linux kernel IR remote keytable for Jivelite on piCorePlayer 5
NoobNR7 wrote: > > I had the remote working :D for a little while on pcp. But when I > rebooted I had to take all steps again. > 'pcp bu' (https://docs.picoreplayer.org/information/pcp_cli/) ? jeroen2's Profile: http://forums.slimdevices.com/member.php?userid=70418 View this thread: http://forums.slimdevices.com/showthread.php?t=110640 ___ 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
coyrls wrote: > I think the "default" kill will be the shell built in version. > That makes sense, thank you. So assuming that's the case, is there a way to override the default, such that 'kill' (specified without a path) will use the busybox version in /bin? It still seems possible that the start-stop-daemon is using the default external command, rather than doing the same thing as kill via its own source code, so I'd like to change the default and see if the behaviour of the start-stop-daemon 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
I think the "default" kill will be the shell built in version. coyrls's Profile: http://forums.slimdevices.com/member.php?userid=44253 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] Howto create a linux kernel IR remote keytable for Jivelite on piCorePlayer 5
ralphy wrote: > . Hi Ralphy, Hoping you can help me out? I am struggling to get IR working on my old raspberry with pcp. Trying to install/ use flirc ir usb receiver with a remote lying around in the house. (wich is preferred ir remote (easiest/ future proof) method in 2021?(Jivelite or Lirc?)) Trying your steps from your first post. With Jivelite IR enabled my Flirc usb dongle is not working. sudo ir-keytable doesn't seem to show my flirc usb device? I think it only shows gpio_ir_receiver? No usb device mentioned. When i "sudo ir-keytable -t" I do not see anything being displayed. So I have yet to make my own keytable file/ settings? I had the remote working :D for a little while on pcp. But when I rebooted I had to take all steps again. So I think the Philips remote and flirc do work? The time I got it working was when I followed the steps mentioned further down in this thread. I tried it with inputlircd. But now I do not seem to get that working anymore? I am sorry I am a noob. Enjoying my pcp. Wish I could use ir remote with it. I do not know what is wrong: flirc usb dongle? My remote? Me trying to config pcp? I read quite some hours already. Believing de solution is around the corner. I just can't see it. Hoping you can help me find it. NoobNR7's Profile: http://forums.slimdevices.com/member.php?userid=71477 View this thread: http://forums.slimdevices.com/showthread.php?t=110640 ___ unix mailing list unix@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/unix
Re: [SlimDevices: Unix] ANNOUNCE: piCorePlayer 7.0.0
bluetdi wrote: > Is it possible to switch off the lighning that shows undervoltage? > > My Pi 3+ works fine, but when I play flac there constantly this lighning > flickers. > The power supply delivers 3A, that seems to be more then enough. Or is > there differnt problem I should investigate first?If you can, check your > voltage. The undervoltage warning is not meant to appear unless it drops below 4.63V https://www.raspberrypi.org/documentation/hardware/raspberrypi/power/README.md 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=113512 ___ 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
chill wrote: > I have a theory that I'd like to test, but I'm not sure how. > > I've now methodically repeated my earlier tests on my troublesome > Pi3A+. > 1) Called from within my own script (bypassing the init.d script), the > command 'start-stop-daemon --stop -p $PIDFILE' reports that it has > stopped the process, but the process stays running. > 2) If I replace that command with 'sudo kill -9 $PID', the process stays > running. > 3) If I replace that command with 'sudo /bin/kill -9 $PID', the process > is successfully killed. > 4) From the command line, all three of these methods successfully kill > the process. > > So 1-3 versus 4 shows there's something different about the udev > environment compared to a normal user shell. > Hmm, this is odd - /bin/kill IS the same as the default kill. Code: tc@pCP:~$ type kill; which -a kill kill is a shell builtin /bin/kill tc@pCP:~$ ll /bin/kill lrwxrwxrwx1 root root 7 Jan 1 1970 /bin/kill -> busybox But it behaves differently: Code: tc@pCP:~$ kill --help sh: bad signal name '-help' tc@pCP:~$ /bin/kill --help BusyBox v1.31.1 (2020-12-18 22:25:41 EST) multi-call binary. Usage: kill [-l] [-SIG] PID... Send a signal (default: TERM) to given PIDs -l List all signal names and numbers 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] ANNOUNCE: piCorePlayer 7.0.0
bluetdi wrote: > that shows *undervoltage*? > > The power supply delivers *3A* You see the difference? It really is undervoltage, not undercurrent! When the *voltage* is too low the lightning appears. I have a few power supplies that deliver 3A, but the voltage is at 4,9V when the Pi is drawing 1A and that is too low for the Pi. pi4 4gb picoreplayer with lms and squeezelite for usb inside an argon one case pi3b+ (7\" display, hifiberry dac+ pro) picoreplayer with squeezlite/jivelite for hifiberry and bluetooth headphone inside a smartipi touch case two airport express ikea symfonisk carsten_h's Profile: http://forums.slimdevices.com/member.php?userid=69113 View this thread: http://forums.slimdevices.com/showthread.php?t=113512 ___ 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
I have a theory that I'd like to test, but I'm not sure how. I've now methodically repeated my earlier tests on my troublesome Pi3A+. 1) Called from within my own script (bypassing the init.d script), the command 'start-stop-daemon --stop -p $PIDFILE' reports that it has stopped the process, but the process stays running. 2) If I replace that command with 'sudo kill -9 $PID', the process stays running. 3) If I replace that command with 'sudo /bin/kill -9 $PID', the process is successfully killed. 4) From the command line, all three of these methods successfully kill the process. So 1-3 versus 4 shows there's something different about the udev environment compared to a normal user shell. But the theory I want to test is that the start-stop-daemon is using the default kill. I'm guessing that in fact it's simply using the same source code within busybox, so there'll be no way to change that. But if it is instead calling the default binary for the kill command, how can I change the default binary to be the one in /bin? Assuming the default kill command is a symlink to the busybox command, can I replace that symlink with one that points to /bin/kill, and if so, how? If I can do that I could then repeat the test with the start-stop-daemon to see if that has forced it to use /bin/kill. 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
chill wrote: > > @Bogg - it would be good to know if this version still works in your > case. Just replace the entire script. No need to re-run the install, > unless you give this script a different name. > v1.1.0 - 'workaround' version to bypass start-stop-daemon Hi Chill, I can confirm v1.1.0 works perfectly on my 3B (non plus) It kills and restarts many times in a row without fail, and starts when booted without dac. Everything appears great. 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
I'm not sure how to tackle finding out why the start-stop-daemon doesn't work consistently, but in the meantime... The path available from within my udev script is: Code: /sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin Compare that with the path available from a user shell: Code: /home/tc/.local/bin:/usr/local/sbin:/usr/local/bin:/apps/bin:/usr/sbin:/usr/bin:/sbin:/bin:/etc/sysconfig/tcedir/ondemand I've made a full version of the 'workaround' script - one that doesn't use the start-stop-daemon at all, and which fully implements all the proper squeezelite settings in the same as the start-stop-daemon. I simply lifted the code directly from the daemon. I don't like to do this because it's a duplication of code, and if the start-stop-daemon gets updated to cope with new Squeezelite options this will also need to be updated. But unless, or until, I get to the bottom of the start-stop-daemon issues this can serve as a working generalised version for now. @Bogg - it would be good to know if this version still works in your case. Just replace the entire script. No need to re-run the install, unless you give this script a different name. v1.1.0 - 'workaround' version to bypass start-stop-daemon +---+ |Filename: SQLITE-control.sh_v1.1.0.zip | |Download: http://forums.slimdevices.com/attachment.php?attachmentid=33714| +---+ 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