OK, today the GPIO pin suddenly started working as desired, but I had no
idea which of the many things I fiddled with had done the trick. 
So I've spent a lot of time experimenting, being very methodical to try
and find out what fixed it.

Here's what I found. Bear in mind this is on a RPi4 using piCorePlayer
6.1.0.

1. Flash SD card with a fresh piCorePlayer image and boot up.
2. SSH in and check some things:
a). GPIO 13 is in mode IN, voltage low.
b). ps -ef shows squeezelite running with these options: *-o
hw:CARD=ALSA -a 80 1*
3. Try playing a track: No audio, pause causes track to restart rather
than pause, seek skips to position but then plays back a loop of about 5
secs.
4. Set power on/off to GPIO 13, active high. Squeezelite restarts.
5. readall.sh now shows GPIO in mode OUT, voltage high (even though
player is off).
6. Switching player on & off makes no difference; GPIO 13 remains high
at all times.
7. ps -ef shows squeezelite with options: *-o hw:CARD=ALSA -a 80 1 -G 13
H*
8. Try playing a track: no change, behaviour as in (3) above.
9. Restart squeezelite: no change.
10. Reboot piCorePlayer: no change.
11. Change audio output to RPiDAC and save, then back to analog audio
and save. Squeezelite fails to restart.
12. Reboot.
13. Now we have a fully functioning player!
a). GPIO 13 behaves as required: voltage low when player is off, high
when player is on.
b). Playback works correctly: pause pauses, seek skips as it should.
c). ps -ef shows squeezelite options: *-o hw:CARD=ALSA -a 80 0 -G 13 H*

So it would seem that switching the audio output device is the crucial
step that gets everything going.
(I speculate that the reason others say "it just works" is perhaps
because they had already set their output device to something other than
the default analog audio).

I am also intruiged by the change in the parameters to the -a option
that happened.
That second parameter (0 instead of 1) is presumably the thing that got
the audio output working.
The documentation says that this is the "period count or size in bytes".
No idea what that means.

In summary, to get it working on the Pi4, the minimum sequence of steps
is:

1. Flash SD card with piCorePlayer, boot up.
2. Set power on/off to desired GPIO.
3. Set audio output to something else, save.
4. Set audio output back to analog, save.
5. Reboot.
6. Player now behaves as expected.

Mysteries that remain:

1. Why does changing the audio output fix the behaviour of the GPIO
control?
2. Why did pause and seek do the wrong things until the audio output was
fixed? (It's not like LMS has any idea that the player's output device
is set up wrong).

Thanks to everyone who helped me with this.
It was a bit of an ordeal, but of course orders of magnitude less work
than creating my own plugin, as I had originally thought I would need to
do!



Transporter -> ATC SCM100A
------------------------------------------------------------------------
cliveb's Profile: http://forums.slimdevices.com/member.php?userid=348
View this thread: http://forums.slimdevices.com/showthread.php?t=113507

_______________________________________________
discuss mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/discuss

Reply via email to