Re: [SlimDevices: Unix] My Alpine Linux Repo for LMS and Squeezelite

2022-02-20 Thread chill


Thanks both!  I look forward to trying these out.  That won't be until
this evening unfortunately, so perhaps I should look forward instead to
Michael showing us whether they work under iSH. :)

EDIT: Had a quick try with Squeezelite.  There don't seem to be any
sound output devices under iSH. :(

Code:

Chriss-iPad:~# squeezelite -l
  Output devices:
  null   - Discard all samples (playback) or generate 
zero samples (capture)




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

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


Re: [SlimDevices: Unix] My Alpine Linux Repo for LMS and Squeezelite

2022-02-20 Thread chill


mherger wrote: 
> 
> I have a latest generation iPhone.

I'd be keen to try it out too.  I've installed iSH on an iPad - must
admit, I didn't look into whether it's available for an iPhone, so
haven't tried it.



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

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


Re: [SlimDevices: Unix] My Alpine Linux Repo for LMS and Squeezelite

2022-02-20 Thread chill


ralphy wrote: 
> I have an alpine i686 build system that I'm using to repurpose my O2
> joggler.
> So far, I only have squeezeplay and squeezelite apks but I should be
> able to build the lms packages.
> 

That would interesting - do you have any iDevices to try those builds
under iSH?  Squeezeplay on an iPad would be fun, although I'd be
surprised if the graphics would work.  But Squeezelite on an iPhone
would be a good thing to have.



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

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


Re: [SlimDevices: Unix] My Alpine Linux Repo for LMS and Squeezelite

2022-02-20 Thread chill


mherger wrote: 
> iSH is using i686.

Am I right that an i686 build would therefore allow, for instance, LMS
to run on an iPad, and Squeezelite to run on an iPhone? That would be
interesting.



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

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


Re: [SlimDevices: Unix] Jivelite on a Joggler

2022-02-12 Thread chill


mnd wrote: 
> 
> If you don't mind me asking again - maybe you have an applet for
> jivelite of the superdatetime plugin? 
> 
> I think I remember entering it's settings/info through "Extras" menu
> entry, but now the entry for superdatetime is gone and I don't see it in
> the Applet Installer. I use superdatetime's info in the custom clock
> applet. It still displays the weather info now, but the long discription
> of the forecast no longer appears. I used to enter the applet on the
> joggler, and after selecting the different menus in it, it would
> probably refresh it's info and the custom clock screen saver would start
> showing everything related to weather, that would not appear initially
> after turning on the joggler.

I'm afraid I don't.  I don't use superdatetime or the custom clock
myself.  I see there is an entry for custom clock under Settings ->
Advanced -> Applet Installer, but beyond that I'm afraid I can't help.



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

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


Re: [SlimDevices: Unix] Jivelite on a Joggler

2022-02-08 Thread chill


mnd wrote: 
> Hi, I followed your progress from the first pages of this thread, and
> managed to install jivelite on Ubuntu bionic 5.4 from 'here'
> (https://birdslikewires.net/debian-for-openframe). 
> I understand there was quite some progress from that point (after the
> post I quoted), but if you don't mind me asking - is there a quick way
> to make the quit button in jivelite to shut down the joggler? Maybe by
> copying an applet to jivelite's folder, or executing some commands over
> ssh? 
> I'm trying to have both LMS and jivelite running on the the same
> joggler.
> 
> Or is it simpler just to install LMS to the USB stick with your
> joggler/alpha04/ image? I have found castalla's post about that only
> today..

Hi - if you already have an installation that you're happy with and
don't want to switch to the alpha04 image, you can add the JogglerPower
applet from the alpha04 image.  It adds some options to the Quit
button.


The applet files are in the attached zip.  Put the script file in
/opt/jivelite/bin, and put the applet's folder in
/opt/jivelite/share/jive/applets.


+---+
|Filename: JogglerPower.zip |
|Download: http://forums.slimdevices.com/attachment.php?attachmentid=37174|
+---+


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

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


Re: [SlimDevices: Unix] jivelite.sh is not writeable

2021-12-16 Thread chill


You can put your own copy of jivelite.sh in /mnt/mmcblk0p2/tce/.  If
present, pCP will use this version instead of the system jivelite.sh.



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

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


Re: [SlimDevices: Unix] Jivelite on a Pirate Audio 240x240 screen

2021-11-16 Thread chill


mftech wrote: 
> 
> I end up creating a folder home/tc by removing the sd card and edit it
> on my PC and save the file as .sh.
> 

As Paul suggests, this has created the file in the wrong location.  With
the SD card inserted into your PC you will not be able to see the
default /home folder.  Because of the way pCP works, you need to work on
a 'live' system, i.e. you need to boot pCP and then access it remotely
with, e.g. WinSCP.  It would probably be best if you put your SD card
back into your PC and remove that new home/tc folder that you created.

On my Macbook I use Filezilla to access my pCP devices.  Filezilla is
also available for Windows I believe.  I like Filezilla because it
allows me to set up a default file editor, so that I can download, edit,
then re-upload files all from within the Filezilla interface.  For the
editor I use BBEdit which, like Notepad++, can be set up to use the
correct line endings for Linux.



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

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


Re: [SlimDevices: Unix] Jivelite on a Pirate Audio 240x240 screen

2021-11-15 Thread chill


mftech wrote: 
> even if Jivelite is not configured properly should I see verbose on
> the display ?
> 

I'm afraid I don't remember for certain.  I think the framebuffer needs
to be configured correctly for the console messages to appear.

Have you checked that you've changed the Framebuffer to /dev/fb1 in the
Jivelite section of the Tweaks page?



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

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


Re: [SlimDevices: Unix] Jivelite on a Pirate Audio 240x240 screen

2021-11-14 Thread chill


mftech wrote: 
> 
> I've read the thread but it's unclear to me if the code from Chill hans
> been check-in in Picoreplayer 8.0.
> 

I've done a couple of fresh installs under pCP8.0.0 (one on a Pi Zero W
and one on a Pi Zero 2 W), and can confirm that following all the steps
described 'this post'
(https://forums.slimdevices.com/showthread.php?111502-Jivelite-on-a-Pirate-Audio-240x240-screen=971970=1#post971970)
will still get all functions of the Pirate Audio boards working.

Is it just Jivelite that isn't working or do you not see anything on the
screen during boot up either?



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

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


Re: [SlimDevices: Unix] Jivelite on a Pirate Audio 240x240 screen

2021-11-03 Thread chill


carsten_h wrote: 
> The part with the buttons is not really what I like. :-)
> 

I agree - the button locations do create a problem for case designers. 
I see that there are several case designs at the above Thingiverse link
that simply leave the full face of the Pirate Audio board exposed - they
look quite good in my opinion, since the Pirate boards are screen
printed as though they are intended to be visible.  That approach works
particularly well for the version that has an integrated speaker.

There's one design that's just caught my eye - it's a replacement lid
for the 'official' zero case which leaves the full face exposed:
https://www.thingiverse.com/thing:4884769

Now if Pimoroni could just start selling a professionally moulded
version of such a lid.



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

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


Re: [SlimDevices: Unix] Announce: piCorePlayer 8.0.0

2021-11-03 Thread chill


paul- wrote: 
> Press the "Set Write Permissions" button in the web interface.
> 

Thanks Paul - I wish I'd seen that before I dug out an old Windows
machine and eventually figured out the same solution.  I guess the
fdisk/mkfs.ext4 process has created a file system that belongs to root,
so user tc only has read permissions.



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

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


Re: [SlimDevices: Unix] Jivelite on a Pirate Audio 240x240 screen

2021-11-02 Thread chill


paul- wrote: 
> 
> In my office when I can get time on it.
> https://www.raise3d.com/e2/

Nice.  Mine's a lot of trouble to keep working properly, and even when
fettled to the best of my ability it's still quite unreliable.  Looking
at recent adverts they seem to have come on a long way in recent years,
with lots of useful features.  I may have to upgrade.



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

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


Re: [SlimDevices: Unix] Announce: piCorePlayer 8.0.0

2021-11-02 Thread chill


I guess the samba share might have worked more like you're used to if
the drive had been formatted as NTFS, rather than EXT4.  I suppose
that's still an option, but EXT4 works better with Linux, and I think it
should be fine once this permissions issue is resolved.

Another option, although unlikely to be as attractive as simply mapping
a drive letter, is to use something like FileZilla to access the pCP
machine, allowing you to get to any of the mounted disks via the /mnt
folder - this is what I use on my Macbook to copy files back and forth
to an EXT4 drive over the network.



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

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


Re: [SlimDevices: Unix] Announce: piCorePlayer 8.0.0

2021-11-02 Thread chill


kidstypike wrote: 
> 
> However it seems to contain a folder named "lost-found" that I cannot
> delete.
> 
> I also cannot create new folders to add my music files.
> 

Hmm - evidently something to do with permissions on the samba share. 
But I'm out of my depth here - hopefully someone more knowledgable can
help.



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

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


Re: [SlimDevices: Unix] Announce: piCorePlayer 8.0.0

2021-11-02 Thread chill


I'm afraid I don't know enough about Windows these days to know where
that S: drive came from.  I believe you will need to explicitly 'share'
your new EXT4 drive from your pCP machine in order to see it from a
Windows machine.  Take a look in the LMS -> 'Setup Samba Share' section
on the pCP pages.



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

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


Re: [SlimDevices: Unix] Announce: piCorePlayer 8.0.0

2021-11-02 Thread chill


kidstypike wrote: 
> Thanks all, getting there.:D
> 
> However the partition seems to be only 3.37GB, how do I expand that?
> 
> 36088
> 
> 36089

Your first image shows that it's an EXT4 disk with 223 GB.  Your second
image appears to be of a different disk, since it's identified as NTFS,
rather than EXT4.  Have you shared (samba?) the new 223GB EXT4 disk from
pCP.  I suspect you're seeing a different share from an earlier attempt
in that second image.



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

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


Re: [SlimDevices: Unix] Announce: piCorePlayer 8.0.0

2021-11-02 Thread chill


paul- wrote: 
> > 
Code:

  >   > 
  > sudo mkfs.ext4 /dev/sda1
  > 

> > 

Ah good - I couldn't remember whether 'sudo' was required.



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

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


Re: [SlimDevices: Unix] Announce: piCorePlayer 8.0.0

2021-11-02 Thread chill


The format command wasn't complete, so the disk isn't yet formatted.

The full command is:

Code:

mkfs.ext4 /dev/sda1



>From memory I think this command might take a little bit longer to
complete.



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

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


Re: [SlimDevices: Unix] Announce: piCorePlayer 8.0.0

2021-11-02 Thread chill


kidstypike wrote: 
> Done this, has it been created?
> 
> What next?
> 

If that's all worked as intended, you should now see a /dev/sda1 if you
issue the 'fdisk -l' command again.

If so, then it's on to the formatting command, mkfs.ext4.



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

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


Re: [SlimDevices: Unix] Announce: piCorePlayer 8.0.0

2021-11-02 Thread chill


Well I'm on slightly dodgy ground now, but from memory I think you need
to do

o   create a new empty DOS partition table
n   add a new partition (it'll ask some more questions - not sure
exactly the order or the options, but make it a primary partition that
fills the whole disk)
then
w   write table to disk and exit



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

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


Re: [SlimDevices: Unix] Announce: piCorePlayer 8.0.0

2021-11-02 Thread chill


Aaargh - I'm an eejit.  It's fdisk, not fdisc.  Sorry!



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

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


Re: [SlimDevices: Unix] Announce: piCorePlayer 8.0.0

2021-11-02 Thread chill


kidstypike wrote: 
> Chill, thanks.
> 
> Can't even get started . . . 
> 
> > 
Code:

  >   > tc@musicbox:~$ fdisc -1-sh: fdisc: not found
  > tc@musicbox:~$

> > 

That first command should be just 


Code:

fdisk -l



(in case of any confusion that's a lower case L, not a 'one')



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

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


Re: [SlimDevices: Unix] Announce: piCorePlayer 8.0.0

2021-11-02 Thread chill


My memory of what I did under pCP to format an SSD in the Argon case
isn't great, but I can give some clues.

>From your dmesg it looks like the SSD is device sda.  If you SSH into
the RPi and type


Code:

fdisk -l



you should see some output like this:


Code:

tc@pCPTV:~$ fdisk -l
  Disk /dev/sda: 224 GB, 240057409536 bytes, 468862128 sectors
  29185 cylinders, 255 heads, 63 sectors/track
  Units: sectors of 1 * 512 = 512 bytes
  
  Device  Boot StartCHSEndCHSStartLBA EndLBASectors  Size 
Id Type
  /dev/sda10,1,1   1023,254,63 63  468862127  468862065  223G 
83 Linux
  Disk /dev/sdb: 932 GB, 1000204886016 bytes, 1953525168 sectors
  121601 cylinders, 255 heads, 63 sectors/track
  Units: sectors of 1 * 512 = 512 bytes
  
  Device  Boot StartCHSEndCHSStartLBA EndLBASectors  Size 
Id Type
  /dev/sdb10,32,33 1023,254,63   2048 1953523711 1953521664  931G 
83 Linux
  Disk /dev/sdc: 15 GB, 16005464064 bytes, 31260672 sectors
  15264 cylinders, 64 heads, 32 sectors/track
  Units: sectors of 1 * 512 = 512 bytes
  
  Device  Boot StartCHSEndCHSStartLBA EndLBASectors  Size 
Id Type
  /dev/sdc1128,0,1 127,3,16  8192 139263 131072 64.0M  
c Win95 FAT32 (LBA)
  /dev/sdc21023,3,16   267,63,32   139264 548863 409600  200M 
83 Linux
  /dev/sdc31023,63,32  1023,63,32 2596864   31260671   28663808 13.6G 
83 Linux



In the above example, I have /dev/sda which is the SSD in the Argon
case, /dev/sdb which is a 1Tb external drive, and dev/sdc which is a
16Gb SD card.

For each of these devices there are partitions on the drive, e.g.
/dev/sda1, /dev/sdb1, /dev/sdc1, /dev/sdc2 etc.  So if this command
confirms that your SSD is /dev/sda then look to see if it has a
partition /dev/sda1.

If it doesn't, you'll need to create one.  Use:

Code:

sudo fdisk /dev/sda



...type 'm' to see the command options, then use the appropriate
commands to create a new partition, type 83, then write the partition
table to the disk and exit.

Then you'll need to format the partition:


Code:

mkfs.ext4 /dev/sda1



*EDIT: That mkfs.ext4 command may need to be preceded with 'sudo'



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

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


Re: [SlimDevices: Unix] Jivelite on a Pirate Audio 240x240 screen

2021-11-02 Thread chill


carsten_h wrote: 
> Is there anywhere a good looking case available (to buy) for the Pi Zero
> and a Pirate Audio Hat with display?

I've struggled with this myself.  I'm surprised Pimoroni/Pirate Audio
themselves don't make a case that fits nicely around a Zero and a Pirate
Audio board.  The best I've come up with is something that you have to
print yourself.  There are a few options here:
https://www.thingiverse.com/search?q=pirate+audio=things=relevant

I've printed one of these: https://www.thingiverse.com/thing:4087948

'[image:
http://www.cjh.me.uk/MyPhotobucket/cache/DIYHifi/Jivelite/Pirate%20Earth_640.jpg]'
(http://www.cjh.me.uk/MyPhotobucket/albums/DIYHifi/Jivelite/Pirate%20Earth.jpg)

I believe others have ordered a print of this case from various places -
that might be an option if you don't have your own 3D printer.



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

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


Re: [SlimDevices: Unix] Announce: piCorePlayer 8.0.0

2021-11-02 Thread chill


Just in case we're overlooking something obvious - have you used the
little USB link piece to connect the disk tray to the RPi once
assembled?

I have a couple of these Argon cases, both running pCP (one's my server,
the other runs a player and does some housekeeping jobs overnight).  My
memory is a little hazy, but I probably did format the drives under pCP.
I suspect someone else will post the steps before I can remember what I
did!



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

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


Re: [SlimDevices: Unix] New RPi Zero 2 W

2021-11-01 Thread chill


I have a PI0W and a PI02W, both set up identically with a fresh pCP8.0.0
(64-bit on the PI02W) and with Pirate Audio sound cards/displays.  I did
a quick speed test.  From applying power to the start of audio playback
the original PI0W takes 49 seconds, and the new PI02W takes 28 seconds. 
That's a healthy improvement.  Still nowhere near ESP32 territory, but
good nonetheless.



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

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


Re: [SlimDevices: Unix] New RPi Zero 2 W

2021-10-31 Thread chill


lozcspi wrote: 
> I've used the 64bit image (is this right?)

That's what I started with.

lozcspi wrote: 
> Accessing on a windows PC and can only see a folder called overlays
> (drive is called PCP_BOOT)
> 
> Do I create a boot folder?

I hesitate to imply that these are the definitive steps needed - I
simply copied what was done before.  And this will all become redundant
anyway as soon as Paul gets hold of his PI02 and makes an image that
works out of the box.  But in the meantime:

1) bcm2710-rpi-zero-2.dtb goes in top level of that PCP_BOOT drive - no
need to make another folder.  You should see a number of other dtb files
in there already.

2) config.txt is also in the top level of PCP_BOOT.  You need to use an
editor that won't change line endings or add another file extension etc.
Not sure what's best on Windows - Notepad?

3) For the final step you'll need to somehow mount the second partition
(PCP_ROOT) in order to place firmware-rpi-wifi in
PCP_ROOT/tce/optional/.  I suspect you won't be able to mount it on a
Windows machine.  I used a Linux laptop to do this step.  I guess you
could probably mount both partitions of this SD card on another
Raspberry Pi that's running pCP.



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

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


Re: [SlimDevices: Unix] New RPi Zero 2 W

2021-10-31 Thread chill


The Pirate Audio setup seems to work exactly as it did for the Zero 1.

'[image:
http://www.cjh.me.uk/MyPhotobucket/cache/DIYHifi/Jivelite/240x240/PI02_640.jpg]'
(http://www.cjh.me.uk/MyPhotobucket/albums/DIYHifi/Jivelite/240x240/PI02.jpg)



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

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


Re: [SlimDevices: Unix] New RPi Zero 2 W

2021-10-31 Thread chill


Man in a van wrote: 
> Is "boot" partition a typo ?
> 
> i could only find the file in "Root" :confused:
> 
> ronnie

It is!  Sorry - meant root: PCP_ROOT/tce/optional/firmware-rpi-wifi.tcz

Will correct my post.



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

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


Re: [SlimDevices: Unix] New RPi Zero 2 W

2021-10-31 Thread chill


My Zero 2 arrived yesterday while I was away, but following the steps in
this thread mine now seems to be up and running - thanks Paul and
Ronnie.

1) Added bcm2710-rpi-zero-2.dtb to the boot partition
2) Added a PI02 section to config.txt
3) Replaced the firmware-rpi-wifi package in the boot partition

Squeezelite is currently playing happily through a Dragonfly USB
headphone adapter.  Once I've soldered the header pins in place I'll try
out one of the Pirate audio boards.



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

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


Re: [SlimDevices: Unix] Drop outs, drop out, drop outs...

2021-09-22 Thread chill


dkskl wrote: 
> and a RPI4b/pCP8 streaming client (LMS not installed). 
> A RPI3b client is also on the network.
> 

Are these two clients synced?  If so, try unsyncing and perhaps (soft)
powering off one of the clients.  If they're not synced, do you get the
dropouts on both clients?

I had a similar problem some years ago (pCP Squeezelite synced to two
Booms) and found that restarting Squeezelite (not rebooting) would
usually fix it.  Several upgrades of pCP later and I no longer get this
issue.



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

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


Re: [SlimDevices: Unix] Jivelite on a Joggler

2021-06-08 Thread chill


Jivelite can certainly be set up to blank the screen when the player it
is controlling is powered off.  The setting to do this is in 'Settings'
-> 'Screen' -> 'Screensavers' -> 'When off'.  If you set this to 'Blank
Screen', then whenever/however the player that Jivelite is controlling
is powered off the screen will be blanked.

A few things to note:
1) Jivelite can be configured to control any player that's attached to
LMS, and it is the power state of that player that is monitored by the
screensaver.  Equally, the power button at top-left operates on the same
player.
2) You can configure how long it takes for the screensaver to kick in
under 'Settings' -> 'Screen' -> 'Screensavers' -> 'Delay'.  For reasons
that I never investigated, there seems to be no delay if the player is
powered off by a different controller (e.g. iPeng).  But certainly, if
you're using the power button in the top-left of Jivelite, then the
delay should apply, so make sure that you're not simply concluding that
it doesn't work before you've allowed that delay to elapse.  I have mine
set to the minimum value of 10 seconds.*
3) The blank screen screensaver in Jivelite isn't quite the same as the
one in SqueezeplayOS, because the hardware control that SqueezeplayOS
uses to turn off the screen (or backlight - can't remember for sure)
doesn't work under the base OS that Jivelite uses.  So in Jivelite the
screensaver simply sets the backlight to its minimum setting of 0%.  So
in a dark bedroom you may still see a faint glow from the screen.  My
workaround is to make sure my eyelids are closed when I'm going to sleep
:-)

*Actually I don't use the blank screen screensaver - I use 'Digital
Clock (Black)', and I leave the backlight on 0% for the Joggler in the
bedroom, which is still quite usable during the day.  I use 'Digital
Clock (Transparent)' for the 'When stopped' screensaver, so that I can
tell at a glance whether the player is still powered, i.e. I can see the
wallpaper behind the clock if the player is on.



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

___
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-11 Thread chill


Point taken.  So pgf's original approach is best - init.d stop, followed
by pkill.  Maybe add a short sleep between the two, to give squeezelite
a chance to finish its orderly shutdown.



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-11 Thread chill


Paul Webster wrote: 
> Given that the situation is relatively rare and that an extra few
> seconds is unlikely to make a difference then a 
> SIGHUP then pause and check again and SIGKILL if still running should be
> OK.

Do you mean as a general purpose approach for the init.d script?  For
this USB DAC script, I see no harm in using SIGKILL immediately.  Is
there anything important that Squeezelite would have wanted to do first
if given the chance?  If it can't do that, does it matter, given that
the DAC has gone?

Here's where I'm currently at with pgf's script.  I separated the
start/stop tasks into their own function (the commands are only wrapped
inside 'log' commands to keep the log file tidy):

Code:

squeezelite()
  {
case $1 in
start)
log $(/usr/local/etc/init.d/squeezelite start 2>&1)
;;
stop)
  # log $(/usr/local/etc/init.d/squeezelite stop 2>&1)
log "Stopping Squeezelite player: Squeezelite..."
result=$(start-stop-daemon --stop --quiet -s SIGKILL -p 
/var/run/squeezelite.pid 2>&1)
if [ "$result" ]; then log $result; fi
sudo rm -f /var/run/squeezelite.pid 
;;
esac
  }
  




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-11 Thread chill

paul- wrote: 
> Are you guys using the absolute latest squeezelite package?  The have
> been changes after pCP 7 was released that affected the -C option.

On my test Pi3A+ I've been using the Squeezelite version that was part
of the the pCP7.0.0 image: v1.9.8-1287-pCP.  I've just updated to
v1.9.9-1364-pCP.  With this version, the symptoms are the same with the
-C option: if no music is playing the init.d script kills the process,
but with music playing it doesn't.

paul- wrote: 
> I’m not sure what you are expecting SIGTERM to do.  This just tells the
> program to shutdown normally.   In all of these cases being discussed,
> abnormal conditions are present, so the shutdown process is unable to
> complete.  Using an escalated termination signal is quite expected.

I agree - it seems unfair to ask Squeezelite to shut down 'normally'
when the DAC that it's playing to suddenly disappears.  Given that
argument, I think the SIGKILL signal seems like the way forward.  

There might be a case for updating the init.d script to use '-s
SIGKILL', so that it works in all eventualities, but as pgf points out,
that would deny Squeezelite the opportunity to do what it might want to
under a normal shutdown.  So maybe it's best left as is, and the subject
of this thread can be tackled in the knowledge that this is an abnormal
situation that requires a different call to the start-stop-daemon.



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-10 Thread chill


pgf wrote: 
> FYI, Ralph just helped me learn (while diagnosing the SIGTERM thing)
> that the shutdown bug doesn't happen if -C is used.  I get the
> impression (and I'm going to confirm with him) that -C should always be
> used with USB devices that might be unplugged or turned off.  (Clearly
> it should shut down correctly in either case, of course.)

There had to be a simple explanation.  I can confirm that on my Pi3A+,
where I experienced the issue, I did not have the -C option, but when I
add -C the behaviour is different.  I won't say it's cured though.  If
there is no audio playing when the DAC is removed, the squeezelite
process dies completely without the extra pkill, but if there's audio
playing, the process doesn't die unless I include the extra pkill, even
if I wait much longer that the 5 seconds I specified with the -C option.



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-10 Thread chill


I removed the old udev script from my main Pi4B player, and installed
your new script (with a few personalisations: logfile named after the
audio card, player powered up in LMS after a restart, 'restart' split
into new-style stop and init.d start).  It's working perfectly.  Not
really a surprise, but merely a confirmation that the 'kill' workaround
doesn't interfere on a device where the original 'kill' worked reliably.



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-10 Thread chill


pgf wrote: 
> If any of our dear readers know the answer, please let me know.  ;-)
> 

Ralphy's yer man for Squeezelite.  He's already seen the thread, so I'm
sure he'll see your suggestions.



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-10 Thread chill


pgf wrote: 
> 
> You should do whatever you want with this, though now that you have a
> good workaround for stopping squeezelite properly, maybe you'll just use
> your script.
> 

That's brilliant, thanks Paul.  I don't really see the benefit of the
udev approach over your approach.  Your script is leaner, and doesn't
require any 'installation', other than to call it from a User Command. 
If this was StackExchange, this should be the top answer to the question
"How do I start/restart Squeezelite when I plug in my USB DAC?"

I'm left with a couple of nagging doubts.
1) If I'm remembering and interpreting correctly, I think Bogg also
reported that his system would not start squeezelite via the
start-stop-daemon.  That was the reason I implemented a copy of the
'start' approach in my script.  It would be interesting if Bogg could
uninstall the old udev script and give this one a try, to see if that's
still the case.
2) Your script uses the 'restart' option of the init.d script, which
simply does a behind-the-scenes 'stop' then 'start'.  It would probably
be safer for your script to explicitly do a new-style 'stop' followed by
an init.d 'start', although I recognise that it should never get to the
state that causes this problem, i.e. where the DAC has disappeared just
before the script does a restart, without the script explicitly doing a
new-style stop first.  I hope that explanation is not too muddled.



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-10 Thread chill


pgf wrote: 
> Any reason you can't just use the "pcp" command (which I just stumbled
> across).  Seems safer than loading their internal files.
> > 
Code:

  >   > 
  > ==kitchen(tc)>> pcp help
  > 
=
  > Basic piCorePlayer CLI
  > 
-
  > Squeezelite/LMS
  > ---
  > - pcp play   : play current track in playlist
  > - pcp stop   : stop current track
  > - pcp pause  : pause current track
  > - pcp up : volume up
  > - pcp down   : volume down
  > - pcp next   : next track
  > - pcp prev   : previous track
  > - pcp rand   : generate random playlist
  > - pcp power [on|off] : software power on or off
  > - pcp volume [0-100] : set volume between 0 to 100
  > - pcp rescan : look for new and changed media files in connected 
LMS library
  > - pcp wipecache  : clear connected LMS library and rescan
  > - pcp mode   : display Squeezelite's current mode
  > 
-
  > piCore
  > --
  > - pcp bu : (b)ack(u)p
  > - pcp sd : (s)hut(d)own
  > - pcp bs : (b)ackup then (s)hutdown
  > - pcp rb : (r)e(b)oot
  > - pcp br : (b)ackup then (r)eboot
  > 
-
  > piCorePlayer
  > 
  > - pcp d0 : debug off
  > - pcp d1 : debug on
  > 
-
  > Jivelite
  > 
  > - pcp kj : (k)ill (j)ivelite
  > 
-

> > 

Tsk.  Even simpler.  If we dig deep enough there's probably a command to
start squeezelite when the DAC is powered up..



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-10 Thread chill


pgf wrote: 
> No -- SIGTERM is the default, for all versions of kill/pkill/killall.
> 
> For some reason, if the audio device has gone away (probably not a
> well-tested scenario), one of squeezelite's threads doesn't die from the
> first kill -TERM, but does die from the second.
> 
> I've put a similar workaround in my script.
> 
> I want to look at your soft power-off code, then I'll publish a new
> version.

Forget my earlier soft power-off code.  Do this:
Put this somewhere near the top:

Code:

. /usr/local/etc/pcp/pcp.cfg
  audiodev=$(echo $OUTPUT | awk -FCARD= '{print $2}' | awk -F, '{print $1}' )
  . /var/www/cgi-bin/pcp-functions
  . /var/www/cgi-bin/pcp-lms-functions
  


The first line populates a load of pCP squeezelite variables, so you can
get audiodev from $OUTPUT, and $NAME holds the player name.  Then after
the restart command, this is all that's needed.

Code:

# turn on player in LMS
pcp_lms_power 1
  




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-10 Thread chill


>From the busybox source code (for debianutils)
(https://github.com/brgl/busybox/blob/master/debianutils/start_stop_daemon.c)

Code:

Options which are valid for --stop only:
  -s,--signal SIG Signal to send (default:TERM)



Could the piCore version of the source code be different?



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-10 Thread chill


pgf wrote: 
> Have you tried using SIGTERM again, rather than SIGKILL?

Well blow me - that works too.  What signal does it send if you don't
specify one?



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-10 Thread chill


pgf wrote: 
> You'll be happy to know I'm seeing an incomplete kill of squeezelite on
> my system as well.  I'll look into it.
> 
> Note that squeezelite, while not killed completely, has been crippled: 
> 2 of its 4 threads do die.
> 
> paul

Well that's encouraging, in a way.  What model RPi are you running?

As a last resort, this works for me now:

Code:

#   sudo /usr/local/etc/init.d/squeezelite stop
sudo start-stop-daemon --stop --quiet -s SIGKILL -p 
/var/run/squeezelite.pid
sudo rm -f /var/run/squeezelite.pid
  




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-10 Thread chill


ralphy wrote: 
> pCP uses and includes 'JSON.awk' (https://github.com/step-/JSON.awk) to
> parse json output.

Haha - while I was browsing through the pCP source code to find an
example of JSON.awk in use, I found 'pcp_lms_power' (and all the other
defined functions).  All the hard work has been done by the pCP team!

All I have to do is set NAME to be the LMS player name, then call
'psp_lms_power 1' or 'pcp_lms_power 0' to turn the player on or off. 
Fantastic.



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-10 Thread chill


ralphy wrote: 
> pCP uses and includes 'JSON.awk' (https://github.com/step-/JSON.awk) to
> parse json output.

Perfect - thank you for the tip.



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-10 Thread chill


Greg Erskine wrote: 
> Thx.

Ahem.  It doesn't work reliably.  Not surprising for a JSON newbie I
suppose.  It seems that the player details aren't always returned in the
same order, so I can't 'awk' for the player name THEN the MAC address. 
I was hoping to get away without parsing the JSON rigorously - is there
an easy way to do that in a shell 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-10 Thread chill


I changed 'sudo /usr/local/etc/init.d/squeezelite stop' to 'sudo
start-stop-daemon --stop --quiet -p /var/run/squeezelite.pid' in your
script, and it made no difference.

But then I discovered that the start-stop-daemon has the '-s' flag to
determine which signal is sent.  And what do you know, sending SIGKILL
(the equivalent of 'kill -9' that you told me not to use :)) 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

2021-03-10 Thread chill


chill wrote: 
> Aargh!  Guess what.  On my Pi3A+, the command
> '/usr/local/etc/init.d/squeezelite stop', when called within your script
> (with or without 'sudo'), only deletes the pidfile.  It does NOT kill
> the squeezelite process.  Exactly the same behaviour as I was seeing
> with the udev script.
> 
> Calling 'sudo /usr/local/etc/init.d/squeezelite stop' from the command
> line DOES kill the process, but only if the pidfile is present.

On this Pi3A+, the 'Restart Squeezelite with new settings' button on the
pCP main page DOES succeed in killing the old process and starting a new
one.  So I assumed it must be doing something different.  But in fact
'main.cgi' calls 'restartsqlt.cgi' which calls 'pcp_squeezelite_stop'
then 'pcp_squeezelite_start'.  No prizes for guessing that
'pcp_squeezelite_stop' calls 'sudo /usr/local/etc/init.d/squeezelite
stop'.

So how on earth can it be that 'sudo /usr/local/etc/init.d/squeezelite
stop', when called by pCP or by user tc from the command line, will
successfully stop the process, but when called from a User Command
script or a udev script it will not?  Makes no sense!



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-10 Thread chill


Greg Erskine wrote: 
> Where does the softpower function come from? I don't do json stuff.

Nor do I!  I cobbled it together from other examples I found in
pcp-lms-functions.



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-10 Thread chill


Aargh!  Guess what.  On my Pi3A+, the command
'/usr/local/etc/init.d/squeezelite stop', when called within your script
(with or without 'sudo'), only deletes the pidfile.  It does NOT kill
the squeezelite process.  Exactly the same behaviour as I was seeing
with the udev script.

Calling 'sudo /usr/local/etc/init.d/squeezelite stop' from the command
line DOES kill the process, but only if the pidfile is present.



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-10 Thread chill


pgf wrote: 
> 
> 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.  
> 
That was my feeling too.  Isn't this the way a daemon works (something
like pigpiod that constantly watches for gpio events), or does they all
use a different approach, like system events?

pgf wrote: 
> You go guy!   I have no idea what you're talking about.  :-)
> 
I found that if the player is switched off in LMS before the script
stops squeezelite, the next time the script restarts squeezelite it
comes back in the same 'soft off' state.  It's a really minor issue, but
I prefer that if the DAC is powered up, squeezelite should restart in
the 'soft on' state.  This is my attempt to do that by sending the
appropriate command to LMS.  Call it with 'softpower "$NAME" 1', where
$NAME is obtained from /usr/local/etc/pcp/pcp.cfg.  I'm totally new to
the JSON interface, so there may well be more efficient ways to do this.
And I suspect my function will go wrong if the player's $NAME has
spaces in it, because it will look like more than one argument.

Code:


#
  # send JSON command to soft power on/off (1/0) the player
  
#
  softpower() { 
player_name=$1
pwr=$2

#get LMS address and port
. /var/www/cgi-bin/pcp-functions
LMSIP=$(pcp_lmsip)
. /usr/local/etc/pcp/pcp.cfg
[ x"" = x"$LMSWEBPORT" ] && LMSPORT=9000 || LMSPORT=$LMSWEBPORT
  
log "LMS address = $LMSIP:$LMSPORT" $logfile
  
# get player's MAC address from the player name
player_info=$(busybox wget -q -O- 
--post-data='{"id":1,"method":"slim.request","params": [ "-", [ "players", "0", 
"999" ] ]}' --header 'Content-Type: application/json' 
http://$LMSIP:$LMSPORT/jsonrpc.js)
MAC=$(echo $player_info | awk -F "$player_name" '{print $2}' | awk -F 
playerid '{print $2}' | awk -F \" '{print $3}')
  
# send soft power request to LMS
result=$(busybox wget -q -O- 
--post-data='{"id":1,"method":"slim.request","params": 
["'$MAC'",["power",'$pwr']]}' --header 'Content-Type: application/json' 
http://$LMSIP:$LMSPORT/jsonrpc.js)
log "$result" $logfile
  }



pgf wrote: 
> 
> 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.
> 
I realise that didn't make a lot of sense without an explanation that,
for me, the obvious missing function is to stop squeezelite when the DAC
is powered down - so a '/usr/local/etc/init.d/squeezelite stop' command
in the second section of the script.  That way, squeezelite will come
and go with the DAC.  Clearly you personally don't need that function,
so you'd be a candidate for the --nostop option, which would prevent any
of the commands in the second section from being triggered.



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-09 Thread chill


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] ANNOUNCE: piCorePlayer 7.0.0

2021-03-09 Thread chill


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] Start/restart squeezelite when plug-in USB dac

2021-03-09 Thread chill


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

2021-03-09 Thread chill

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

2021-03-09 Thread chill


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

2021-03-09 Thread chill


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

2021-03-09 Thread chill


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

2021-03-09 Thread chill


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

2021-03-09 Thread chill


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

2021-03-09 Thread chill


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] Start/restart squeezelite when plug-in USB dac

2021-03-09 Thread chill


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

2021-03-09 Thread chill


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


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

2021-03-08 Thread chill


Thanks again - very instructive, and it gives me something to look into
tomorrow.  I know that the path available to a script called by udev is
indeed rather shorter than the one available under a user shell (i'll
post it again tomorrow).  But does this make a difference if a command
is part of busybox?  If it's part of busybox, does it even bother to
look in the path for a separate binary?  Or do I have this wrong, and
the busybox commands ARE all separately linked to somewhere in the path?
And assuming the busybox built-in version is found, what could cause a
built-in command to fail when called in the udev environment (on some
setups), whereas the explicitly specified binary doesn't? 

And the other thing that's puzzling me - what could explain the 'stop'
part of the start-stop-daemon working on some setups and not others,
when the setups are based on the same pCP base.



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-08 Thread chill


Yeah, I was wrong about 'restart' killing the old process.  It doesn't
on the Pi3A+.  Ok, so that's slightly more consistent - the 'stop'
function of the daemon doesn't seem to work at all.

I tried making the init.d script use /sbin/start-stop-daemon, but it
made no difference.



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-08 Thread chill


Thanks Paul, that's all useful information.  I've noticed that some of
these commands that don't seem to work without specifying a path seem to
be exactly the same versions in the default shell and in the specific
binary location, whereas some seem to be different.  For instance, awk
--help reports 'BusyBox v1.31.1 (2020-12-18 22:25:41 EST)' when called
as either awk or /usr/bin/awk, whereas '/bin/echo --help' reports
'BusyBox v1.31.1 (2020-12-18 22:25:41 EST)' but without the path it
simply echoes '--help'.  So I'm curious where the separate executables
come from.  Are some simply links to the busybox versions, whereas
others are standalone binaries?

I've reverted to the original script on my Pi3A+, where the
start-stop-daemon apparently won't 'stop' the process, but it does
'start' it.  But I'm getting very confused and will probably call it a
day very soon.  I'm getting confused because:
1) The script doesn't call the start-stop-daemon itself - it calls the
init.d script which uses the start-stop-daemon appropriately.
2) When I call the init.d script to 'stop' squeezelite, the process
doesn't actually get killed
3) When I call the init.d script to 'restart' squeezelite, the old
process gets killed and a new one is started.  The odd thing about this
is that to do a 'restart', the init.d script simply asks the daemon to
do a 'stop' followed by a 'start'.  So why does 'stop' on its own not
work, whereas 'stop' followed by 'start' does?  I need to double check
this behaviour again, Pi3A+ versus Pi4B, because it doesn't make sense. 


I've tried loading bash and forcing my script to run under bash, as well
as forcing the init.d script to run under bash, but neither seem to make
the start-stop-daemon successfully stop squeezelite.

The start-stop-daemon seems to be part of busybox.  It would be
interesting I think to look at the source code to try and understand
what it actually does.  And maybe I should try making the init.d script
use /sbin/start-stop-daemon instead of the default version, but I note
that both versions report 'BusyBox v1.31.1 (2020-12-18 22:25:41 EST)'.



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-08 Thread chill


Bogg wrote: 
> I'm very very grateful for all the effort you have taken Chill. I though
> when I first posted that I had just made a simple mistake that someone
> would point out and I'd be up and running like everyone else. Instead I
> caused hours of work to resolve all kinds of problem. 
> 
> Should I consider that script gold standard, no future changes needed,
> or are you likely to still tinker some more?

I certainly wouldn't treat it as the final version.  Even when I believe
there's nothing else to do there's always more to learn, as this example
shows!  But in this case I -know- there's more to do - this was only
really a test to work around a problem, and as a result, as mentioned,
your Squeezelite configuration is currently hard-wired.  Any changes you
make via the pCP Squeezelite page won't be reflected in this script. 
That aspect needs fixing, and I suspect that the longer-term solution
will depend on finding out why the start-stop-daemon doesn't work in
some cases.



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-08 Thread chill


Bogg wrote: 
> Success Again !
> And better tested this time. I've on and off half a dozen times in a
> row, and it's reacted perfectly every time !
> The pcp web and skins are always in sync, sqlite is always killed, and
> always comes back. 
> I've even rebooted pcp with the dac off. sqlite doesn't start, and
> switch on dac, and  sqlite starts !
> 
> It's fantastic :D

Excellent, thank you.  That's how it's supposed to work!

So I reckon the failure of the start-stop-daemon and the non-functioning
of the built-in commands (echo, awk, kill etc) must be related.  It's
odd that things work on some installations and not on others.

If the daemon was called from the USB script itself I could try
prefixing it with its path (/sbin/start-stop-daemon), but it's not -
it's the init.d script that calls it.  I guess I could try that with my
own Pi3A+ setup to see if that fixes it, but that wouldn't be a viable
option for the script, since the init.d script isn't readily editable
for end users.

Anyone know how I can check for these built-in commands from within a
script?  What makes them 'built-in' - is it some default shell
configuration?  Could I manually load that configuration at the start of
the script, so that even if these built-in commands aren't available to
udev they would be to 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-08 Thread chill


Did I say 'a moment'?  That was a frustrating hour and a half!

First I'd neglected to launch Squeezelite into the background, so I was
getting all sorts of confusing issues  - sometimes things would work,
sometimes they wouldn't.
Second, some more of the basic built-in commands weren't doing what they
should, so I've had to provide the full path to /bin/echo and
/usr/bin/awk (and change what awk was doing, because awk '{printf "%s ",
$1}' was giving me an invalid token with /usr/bin/awk).  There's
something weird there - are the built-in versions not available in a
udev shell perhaps?

Anyway - this now seems to work for me.  @Bogg - if you're up for
another test, replace the whole SQLITErestart() function with this:

Code:

SQLITErestart() {
local logfile=$1
local attempts=5 # number of tries
local interval=0.25 # interval between tries (seconds)
local result

local count=$attempts 
local status="Squeezelite not running."
while [ "$status" == "Squeezelite not running." ]; do
if [ $((count--)) -le 0 ]; then
log  "Squeezelite failed to initialize within $attempts 
attempts." $logfile
exit 1 
fi
  # result=$(sudo /usr/local/etc/init.d/squeezelite restart)
log "Forcing a restart of Squeezelite..." $logfile
SQLITEstop
  
  # result="$(sudo /usr/local/etc/init.d/squeezelite start)"
  # log "$result" $logfile
  
  # /usr/local/bin/squeezelite -n piCorePlayer -o 
hw:CARD=DragonFly,DEV=0 -a "80 4  1" &
/usr/local/bin/squeezelite -n piCorePlayer -o hw:CARD=M6,DEV=0 
-a "80 4  1"  -v &
sleep $interval
local PID=$(/bin/busybox pgrep /usr/local/bin/squeezelite | 
/usr/bin/awk '{print $1}')
  # log "Squeezelite process ID = $PID" $logfile
sudo /bin/echo "$PID" > /var/run/squeezelite.pid
status="$(sudo /usr/local/etc/init.d/squeezelite status)"
log "$status" $logfile
done
# determine cardname from squeezelite process id
local PID=$(sudo /usr/local/etc/init.d/squeezelite status | awk -F PID= 
{'print $2'})
local cardname=$(ps | grep $PID | awk -F CARD= {'print $2'} | awk -F , 
{'print $1'})
log "Restoring alsa settings for $cardname" $logfile
sudo /usr/local/sbin/alsactl restore $cardname
  }




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-08 Thread chill


Wait - I should have tested this at my end first.  It doesn't work. 
Give me another moment



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-08 Thread chill


I think this should create the PIDFILE and keep everything in sync.

Insert these two lines after the 'sleep $interval' line in the same
function, like this:

Code:

sleep $interval
PID=$(/bin/busybox pgrep /usr/local/bin/squeezelite | awk 
'{printf "%s ", $1}')
sudo echo $PID > /var/run/squeezelite.pid
  



I'll emphasise that this is a quick and dirty approach to see if we can
work around the failure of the start-stop-daemon.  The Squeezelite
command line options are hard-coded, so if you change the Squeezelite
options in the pCP interface they won't be reflected in this script.  So
I'm not recommending this as a permanent fix.



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-08 Thread chill


Ah, yes, this is because the workaround is only partial at the moment -
it doesn't create the PIDFILE that is necessary for the other parts to
stay in sync.  Give me a mo.



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-08 Thread chill


Bogg wrote: 
> 
> Hi, It stops my sqlite, and now shows it not running in pcp web and also
> killed on material.
That's a start.

Bogg wrote: 
> 
> But I still get failed to start

Oh my, I wasn't expecting that.  I really thought I'd cracked it.  It
looks as though the start-stop-daemon is failing to do the 'start'
function.  So that looks like three different behaviours:
1) On my Pi3B+(now dead) and my Pi4, the start-stop-daemon is able to
stop and restart Squeezelite
2) On my Pi3A+, it won't stop squeezelite, but it will start it.
3) On your Pi??, it won't do either.
I'm sure this will be simple when we find out why there is this
variation.

As a quick check, can you try modifying your copy of the script by
commenting out a couple of lines (# character at the beginning) in the
SQLITErestart() function and adding a new line, like this:

Code:

#   result="$(sudo /usr/local/etc/init.d/squeezelite start)"
  # log "$result" $logfile
/usr/local/bin/squeezelite -n piCorePlayer -o hw:CARD=M6,DEV=0 
-a "80 4  1"  -v
  



This is a very specific modification for your case.  It should bypass
the start-stop-daemon and start Squeezelite manually.  It will tell us
whether bypassing the daemon is worth pursuing.  Generalising this would
be a lot more work.



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-08 Thread chill

I found that if the DAC is playing as part of a synced group, then it
causes the other players to stop after a while if squeezelite is unable
to send audio to the DAC. This doesn’t happen if squeezelite is stopped.
A soft power-off would probably work too.





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-08 Thread chill


pgf wrote: 
> 
> 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
  > 

> > 

This is indeed a much simpler approach than all this udev stuff, and it
could quite easily be generalised to automatically work with whatever
DAC device is configured in pCP (i.e. to get $audiodev from
/usr/local/etc/pcp/pcp.cfg).  The only downside compared to the udev
approach seems to be that it's polling, as you point out, but a script
that wakes up once every 4 seconds and then runs a few quick commands
will not be a drain on resources. 

You could easily add the same sort of logic as the 'if it only just
became available...' to check whether it 'only just disappeared...' and
then stop Squeezelite accordingly.  And I guess that since it's a user
command, rather than something being run by udev, there may not be the
same issues with the built-in 'kill' not working properly.



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-08 Thread chill


Here's a tidied up version that uses the 'forced' approach to stopping
Squeezelite - not the full 'kill-anything-that's-called-Squeezelite'
approach, just the 'synchronised' approach that uses the PIDFILE to kill
the specified process.  This seems to work on my Pi3A+.

@Bogg - it would be interesting to know if this works on your system.

PS - I've taken the bold step of giving this a version number 1.0.0
(more digits than I'll need!), to help keep track :)


+---+
|Filename: SQLITE-control.sh.zip|
|Download: http://forums.slimdevices.com/attachment.php?attachmentid=33702|
+---+


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-08 Thread chill


pgf wrote: 
> Well, kill is an ash builtin, so without the full path, that's what
> you're getting -- but that alone doesn't explain why it doesn't do its
> job.  (It's unlikely to be an internal ash problem in any case -- ash is
> a very good shell.)
> 

Thanks Paul - yes, contrary to what I expected, /bin/kill is not the
same as kill:

Code:

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
  
  tc@pCP:~$ kill --help
  sh: bad signal name '-help'



So that explains the apparent anomaly with the path, but as you say, it
doesn't explain why the ash version isn't doing its job.

Thanks for the other tips - very useful.

And thanks too for the alternative approach that you posted earlier.  I
haven't had time to study it, but it certainly looks more
straightforward than this udev approach.



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-08 Thread chill


Hmm - well this is odd.  I can make the kill command work if I specify
the location of the binary, i.e. 'sudo /bin/kill -9 $PID'.  But I don't
understand that, because the path available to the script when called by
udev, although rather shorter than for a normal user shell, does contain
/bin:

Code:

/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin



The same applies to rm - I have to specify the full path to the binary,
i.e. 'sudo /bin/rm -f $PIDFILE'.

Very strange - I'd be interested if anyone can explain why this is.

But at least it could explain why things were getting out of sync.  
With this workaround I can now get the forced stop to work properly.  It
turns out that I can replace

Code:

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


with

Code:

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



and it all works fine.  I can do this because the script only needs to
start and stop squeezelite - it shouldn't need to -re-start it if things
remain in sync.  Nevertheless I may anyway include a forced stop before
calling the above init.d start, so that it mimics the normal restart
option.  Attempting to stop it if it isn't running I doesn't do any
harm.

So since the start-stop-daemon is able to do the start function but not
the restart function, it suggests that the start-stop-daemon might also
be using 'kill' to do the stopping, and perhaps the same issue arises -
for some reason it's not finding kill without the full path.  On some
RPis ?

I'll rework the script and tidy it up and post a complete script for
Bogg 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

2021-03-08 Thread chill


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

I think I got to the root of this.  The line:

Code:

sudo ps | grep squeezelite | grep -v grep | awk '{print $1}' | 
xargs kill -9


was also killing the init.d script file itself (because its name is
simply 'squeezelite') so it died before it had a chance to issue '$0
start'.

I changed it to the following to also exclude the init.d process, and it
now works when called by udev.

Code:

sudo ps | grep squeezelite | grep -v grep | grep -v init.d | 
awk '{print $1}' | xargs kill -9
  



Actually, I'm not sure it matters where it's called from - while it's
name is 'squeezelite', that command should have prevented anything
downstream from running.  Strange.

Modifying the init.d script is not practical for users of this USB DAC
script, so instead I'm trying to incorporate the 'force' approach into
the USB script.  I'd rather not use the full force approach, whereby
first the PID in the PIDFILE is killed and PIDFILE is deleted, and
second ALL squeezelite processes are killed.  The second part of that
approach is clearly aimed at cases where things have got out of sync,
but when this USB script is working properly that shouldn't happen, so
to start with I'm going to implement only the first part.

You'd think it would be straightforward, but at the moment I'm
struggling because the 'sudo kill -9 $PID' isn't working for some
reason.  It works from the command line, but I can't get the script to
do that simple thing successfully.  I guess it's something to do with
permissions/environment, but I don't know of anything beyond 'sudo' to
deal with it.  Any thoughts would be welcomed!!

I suspect this may be at the root of the problem that Bogg identified,
whereby the start-stop-daemon isn't killing the process either.  And
oddly, that's now also the case on my test setup - I had to switch to a
spare RPi 3A+ because my test 3B+ seems to have died :(  

Oh well, at least I now have a test bench for working through this
myself, without having to ask Bogg to jump through hoops.



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


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] 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 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 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] 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 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 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 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 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


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

2021-03-06 Thread chill


Bogg wrote: 
> 
> This makes things work again ! . 
> I follow your three steps from post 199, and the dac reconnects !
> Here's the output
> 
> > 
Code:

  >   > 
  > tc@pCP:~$ /home/tc/SQLITE-control.sh restart M6 1-1.2
  > /home/tc/SQLITE-control.sh: line 87: can't create /var/log/pcp_M6.log: 
Permission denied
  > /home/tc/SQLITE-control.sh: line 87: can't create /var/log/pcp_M6.log: 
Permission denied
  > /home/tc/SQLITE-control.sh: line 125: can't create /tmp/M6.kername: 
Permission denied
  > tc@pCP:~$ /home/tc/SQLITE-control.sh: line 87: can't create 
/var/log/pcp_M6.log: Permission denied
  > /home/tc/SQLITE-control.sh: line 87: can't create /var/log/pcp_M6.log: 
Permission denied
  > /home/tc/SQLITE-control.sh: line 87: can't create /var/log/pcp_M6.log: 
Permission denied
  > No state is present for card M6
  > No state is present for card M6

> > 
> 
> The log file doesn't show any update after it had already failed 5
> times. 


Well I suppose that's progress of sorts!  Some immediate thoughts:
1) When you said 'This makes things work again', do you mean that
Squeezelite then starts and stops with the DAC power from that point on,
or only that you managed to make it restart once?
2) The 'Permission denied' messages indicate that I should have
specified 'sudo' in front of the command, i.e.

Code:

sudo /home/tc/SQLITE-control.sh restart M6 1-1.2


3) This same 'Permission denied' problem is the reason that the log file
doesn't show any further updates.  It would be useful to see the logfile
after repeating those steps but with 'sudo' as above.

Thanks for the dmesg log - I will take a look when I have a bit more
time.

Bogg wrote: 
> I've tried disconnect dac, grep and kill then reconnect dac. It didn't
> make work. 
> 
> > 
Code:

  >   > tc@pCP:~$ ps | grep squeezelite
  > 10606 root  0:19 /usr/local/bin/squeezelite -n piCorePlayer -o 
hw:CARD=M6,DEV=0 -a 80 4  1  -v
  > 11122 tc0:00 grep squeezelite
  > tc@pCP:~$ sudo kill -9 10606
  > tc@pCP:~$ ps | grep squeezelite
  > 11319 tc0:00 grep squeezelite
  > 

> > 

I see that the Squeezelite command above (process number 10606) is
slightly different from the one in, say, post #198, process number 4226.
Is this a change that you've made to the Squeezelite setup regarding
the ALSA settings?


Code:

10606 root  0:19 /usr/local/bin/squeezelite -n piCorePlayer -o 
hw:CARD=M6,DEV=0 -a 80 4  1  -v


versus

Code:

 4226 root  0:14 /usr/local/bin/squeezelite -n piCorePlayer -o 
hw:CARD=M6,DEV=0 -a  -v
  




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-05 Thread chill


Bogg wrote: 
> When I run the script with --nostop I get quite different results.
> 
> When I stop the dac the sqlite stays listed on material / apps
> the pcp web says not running

This bit is rather strange.  The --nostop option makes a rules file that
does not have a rule for when the DAC is removed.  Because the script
will no longer attempt to kill Squeezelite, I would expect it to stay
visible in the list of players in Material (which it apparently is), but
I would also expect it to stay 'running' in the pCP web interface (which
it apparently is not).  Strange.

Bogg wrote: 
> 
> and when I turn the dac back on  it reconnects fine and works as
> expected.
> except the pcp web says it's not running - clearly not a problem.

Your log file shows that it's not actually restarting Squeezelite - it's
reporting the same failure after 5 attempts.  However, since nothing had
stopped Squeezelite previously, the original process simply carries on
working.  The fact that the pCP web interface says otherwise is odd.  I
don't understand how it can get out of sync.

Bogg wrote: 
> 
> The problem is that unless I power off the sqlite through the web app
> etc then the rest of the sync group pauses for about 20 seconds every
> minute or so. And the sync ends up miles off when I do reconnect the
> dac.
> If I could change your script to just soft off (is that the phrase) the
> sqlite when the dac disconnects and soft on when it reconnects I think
> it would work for me. Is that odd or normal behaviour?
> 
This is the very reason that I added the 'stop' option - I had the same
behaviour.  I guess a 'soft' off would be another way to do that.  And
in fact, a 'soft' on after reconnection would be a useful feature too -
I've noticed that sometimes my DAC reconnects but the soft power is off
- maybe it remembers the previous soft power state.  I don't know how to
script a soft power change, but I'm sure it's possible.

Breaking this down, I think there are two problems at the moment.  
Firstly - the original symptom - the restart command issued by the
script always seems to fail after 5 attempts, regardless of the
scenario.
Secondly, the pCP web interface doesn't seem to reflect the actual
Squeezelite process status.

I'm not going to have a chance to look at this again until tomorrow, so
I'll think about ways to diagnose this further.  In the meantime can you
confirm that your pCP only has a single instance of Squeezelite, and
that it's configured only via the Squeezelite web page of the pCP
interface?  The second problem above -could- suggest that you have a
separate Squeezelite process initiated by a User Command perhaps. 
Starting Sqeezelite from a user command would mean that its status would
not be reflected in the pCP web interface.

One other thing you could try, again clutching at straws, is to run the
script manually rather than using the command line to restart
Squeezelite.
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.**
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, run the script manually from the command
line:

Code:

/home/tc/SQLITE-control.sh restart M6 1-1.2


I can't really see why this would make a difference, since that's
exactly how the script would be called by the triggering rule, so I
expect the logfile to show the same failure after 5 attempts, but let's
see.

Could you also post the output of 'dmesg' after this test?

** Another odd thing is that the result of your 'ps | grep squeezelite'
command shows that Squeezelite is still running, even though it appears
to have stopped.  You could experiment by manually killing the process. 
The digits at the beginning of the 'ps | grep squeezelite' output
indicate the process id (4226 in your earlier example).  From the
command line you could issue 'sudo kill -9 ' (e.g. 'sudo
kill -9 4226'), to see if that changes the subsequent behaviour.



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-05 Thread chill


Bogg wrote: 
> 
> I'm sorry, I don't understand where to or what to actually add for

In the file /home/tc/SQLITE-control.sh, make the two changes highlighted
in bold below.  I'm clutching at straws I'm afraid - I don't believe
this is the cause of the problem, but it's a loophole that should be
closed anyway.


Code:

SQLITErestart() {
local logfile=$1
local attempts=5 # number of tries
local interval=1 # interval between tries (seconds)
*local result*

local count=$attempts 
*local* status="Squeezelite not running."
while [ "$status" == "Squeezelite not running." ]; do
if [ $((count--)) -le 0 ]; then
log  "Squeezelite failed to initialize within $attempts 
attempts." $logfile
exit 1 
fi
result="$(sudo /usr/local/etc/init.d/squeezelite restart)"
log "$result" $logfile
sleep $interval
status="$(sudo /usr/local/etc/init.d/squeezelite status)"
log "$status" $logfile
done
# determine cardname from squeezelite process id
local PID=$(sudo /usr/local/etc/init.d/squeezelite status | awk -F PID= 
{'print $2'})
local cardname=$(ps | grep $PID | awk -F CARD= {'print $2'} | awk -F , 
{'print $1'})
log "Restoring alsa settings for $cardname" $logfile
sudo /usr/local/sbin/alsactl restore $cardname
  }




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-05 Thread chill


Bogg wrote: 
> When I boot with dac off sqlite does not start.
> When I then turn on the dac sqlite still does not start.
> When I then restart sqlite from command line sqlite starts.

I can't understand this behaviour at all.  There's nothing in the
'restart' part of the script that relies on previously discovering the
DAC, or any other variables etc - it simply issues the restart command. 
And your log files confirm that it's clearly issuing the command - the
exact same command that you issue from the command line - because the
multiple "Squeezelite is not running.  Starting Squeezelite player:
Squeezelite..." lines in the log file are the responses to that restart
command (the $result in the script below).

So why does this command work when called from the command line, but not
when called by the script?

Here's the bit of the script that issues the restart command, in case
anyone else has any bright ideas.

Code:

SQLITErestart() {
local logfile=$1
local attempts=5 # number of tries
local interval=1 # interval between tries (seconds)

local count=$attempts 
status="Squeezelite not running."
while [ "$status" == "Squeezelite not running." ]; do
if [ $((count--)) -le 0 ]; then
log  "Squeezelite failed to initialize within $attempts 
attempts." $logfile
exit 1 
fi
result="$(sudo /usr/local/etc/init.d/squeezelite restart)"
log "$result" $logfile
sleep $interval
status="$(sudo /usr/local/etc/init.d/squeezelite status)"
log "$status" $logfile
done
# determine cardname from squeezelite process id
local PID=$(sudo /usr/local/etc/init.d/squeezelite status | awk -F PID= 
{'print $2'})
local cardname=$(ps | grep $PID | awk -F CARD= {'print $2'} | awk -F , 
{'print $1'})
log "Restoring alsa settings for $cardname" $logfile
sudo /usr/local/sbin/alsactl restore $cardname
  }



I've just noticed that I did not declare $result or $status to be a
local variables inside the SQLITErestart() function.  I wonder what the
effect of that is in this case, where the main script that spawned this
SQLITErestart() function into the background, has already finished some
seconds ago.  Perhaps you could add 'local result' and 'local status' to
the beginning of this function, where all the other local variables are
declared.  I don't believe this is causing your issue, since the command
is evidently being issued anyway, but you never know!



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-05 Thread chill


Bogg wrote: 
> Hi, 
> Starting from a playing sqlite.
> 
> I turn off dac,
> > 
Code:

  >   > 
  > tc@pCP:~$ ps | grep squeezelite
  > 12419 root  0:02 /usr/local/bin/squeezelite -n piCorePlayer -o 
front:CARD=M6,DEV=0 -a  -v
  > 15212 tc0:00 grep squeezelite
  > 

> > 

I've also noticed that the squeezelite process hangs around for a while
after it has apparently been killed.  I've assumed this is to do with it
holding on to the output device, but that's just a guess.  You could try
using the 'Close output setting' - I have it set to 5, which means that
the output device will be closed 5 seconds after playback stops.  Maybe
that will cause the killed process to disappear more quickly.

Bogg wrote: 
> 
> Restarting from  command line
> > 
Code:

  >   > 
  > tc@pCP:~$ sudo /usr/local/etc/init.d/squeezelite restart
  > Restarting Squeezelite player...
  > Squeezelite is not running.
  > Starting Squeezelite player: Squeezelite...
  > 

> > 

That's really odd.  The command line that you typed is exactly the same
one that the script issues, so I'm at a loss as to why it's not working
when called by the script in your case.  It shouldn't matter that
there's still a squeezelite process hanging around, since the command is
asking it to -*re*-start (which I believe means it tries to kill the old
process before starting a new one).

Just for further clues, what happens if you boot your Pi with the DAC
disconnected, and then connect it?  Does Squeezelite start up in that
case?



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-05 Thread chill


Bogg wrote: 
> Hi, I installed the script from post 183. it seems to have installed ok,
> it finds my M6 dac and shuts squeezelite down as expected. 
> Unfortunately it doesn't restart squeezelite when I turn on the dac.
> 

I'm not sure.  A few things you can try, to help understand what's going
on:

1) When Squeezelite is stopped (i.e. you've removed the DAC), try
checking whether the process has actually been stopped:

Code:

ps | grep squeezelite



2) Try restarting Squeezelite from the command line, to see if you get
any more feedback:

Code:

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



3) Try restarting Squeezelite from the pCP interface (Main page, first
button).



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

2021-03-05 Thread chill


Thanks Paul - that's very helpful.

paul- wrote: 
> 
> Do you really need them in the initrd?
> 

I assumed they were needed at boot, but that's because I'm a bit out of
my depth here!  I didn't think of using a separate extension - would
those files be available at the right time? 

Thanks for the pointer about the files already being available.  I
assume you were referring only to (4) and (5), fbtft.ko and
fb_ili9486.ko.  I guess I need to check whether the Inno versions are
the same, and figure out how to replace them if they're not.



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

2021-03-05 Thread chill

I've bought a 3.5" capacitive touchscreen ('this one'
(https://www.amazon.co.uk/gp/product/B07Q8171LB)).  I was attracted to
this particular screen because it was relatively cheap (I paid £27,
although it now seems to be unavailable), and it has a built-in RTC,
which may prove useful for a planned install where network time won't
always be available).

It has drivers for kernel 5.4.83, so I'm trying to get it working under
pCP7.0.1.  The problem I have is that the install script that Inno-maker
have supplied assumes a standard linux distribution, where kernel
modules are in conventional storage, and I'm struggling to replicate
what the script does because the kernel modules in pCP are all stored in
modules-5.4.83-pcpCore-v8.gz on the boot partition.

The install script uses 'sudo install -p -m 664' to attempt to install
the following files:

1) lcd35_spi.dtbo into /boot/overlays
2) ft6236.ko into
/lib/modules/5.4.83-pcpCore-v8/kernel/drivers/input/touchscreen
3) ili9486-i2c into
/lib/modules/5.4.83-pcpCore-v8/kernel/drivers/input/touchscreen
4) fbtft.ko into
/lib/modules/5.4.83-pcpCore-v8/kernel/drivers/staging/fbtft
5) fb_ili9486.ko into
/lib/modules/5.4.83-pcpCore-v8/kernel/drivers/staging/fbtft

I can do (1) by manually copying lcd35_spi.dtbo into the overlays folder
on the boot partition.  I'm not sure about the difference between 'sudo
install' and just copying the file, but this seems to work, since I can
see output on the screen during boot (albeit rather garbled - see
below).

(4) and (5) already seem to be present at the correct points in the
path.

So that leaves (2) and (3).  How can I accomplish the same result under
pCP7?

If I need to add those files to modules-5.4.83-pcpCore-v8.gz, how do I
do that?  I've struggled with tar and gzip but haven't managed to make a
new version of that file that works.

Is there an alternative procedure for installing 'user' kernel modules?

The screen -almost- works.  The display is visible, and Jivelite works -
I can even use the touch function to navigate (just about).  But as you
can see the image is repeating, as though the it's not scanning
correctly for the 480x320 resolution.  I don't know if this is because
of the two .ko files that I haven't been able to install, or some other
reason, so any advice will be welcomed.

33654


+---+
|Filename: inno800.jpeg |
|Download: http://forums.slimdevices.com/attachment.php?attachmentid=33654|
+---+


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


  1   2   3   4   5   6   7   8   >