Logging in to GUI/KDE unmutes speakers
tl;dr After logging in to the desktop, something is over-riding the speaker volume state, making it so even though headphones are plugged in, the speakers are also active, until they are un-plugged/re-plugged or sync script manually run.
Even though this seems like it should correctly sync the initial headphone state on power up, it is not the case. If headphones are connected whilst the PBP is booting, 'Playback Polarity' is correctly set, but 'Speaker' is not. If I restart with the headphones connected the whole time, it is again wrong (i.e. like the below 1 instead of 3), so doesn't appear to linked to the save state. I thought after 4 that it was a case of the sync script not running properly, but I then checked the service output (5), and it had, and had apparently synced correctly. I did one final test, and instead of logging in to the desktop logged into tty2, and speaker state was what it was supposed to be. But as soon as I logged into the desktop, it was wrong. i.e. Something is happening during login that un-mutes the speakers. Perhaps a post-login hook would fix that up? Sorry for rambling... several reboots were involved, and understanding of what was really happening as I wrote this ;)
- bootup with headphones plugged in, after logging in:
[pfeerick@pinebookpro ~]$ sudo amixer sget 'Speaker' && sudo amixer sget 'Playback Polarity'
Simple mixer control 'Speaker',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [on]
Simple mixer control 'Playback Polarity',0
Capabilities: enum
Items: 'Normal' 'R Invert' 'L Invert' 'L + R Invert'
Item0: 'Normal'
- after unplugging the headphones:
[pfeerick@pinebookpro ~]$ sudo amixer sget 'Speaker' && sudo amixer sget 'Playback Polarity'
Simple mixer control 'Speaker',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [on]
Simple mixer control 'Playback Polarity',0
Capabilities: enum
Items: 'Normal' 'R Invert' 'L Invert' 'L + R Invert'
Item0: 'R Invert'
- after re-plugging the headphones back in:
[pfeerick@pinebookpro ~]$ sudo amixer sget 'Speaker' && sudo amixer sget 'Playback Polarity'
Simple mixer control 'Speaker',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'Playback Polarity',0
Capabilities: enum
Items: 'Normal' 'R Invert' 'L Invert' 'L + R Invert'
Item0: 'Normal'
- after a restart, headphones plugged in the whole time, and then manually running the sync script
[pfeerick@pinebookpro ~]$ sudo amixer sget 'Speaker' && sudo amixer sget 'Playback Polarity'
Simple mixer control 'Speaker',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [on]
Simple mixer control 'Playback Polarity',0
Capabilities: enum
Items: 'Normal' 'R Invert' 'L Invert' 'L + R Invert'
Item0: 'Normal'
[pfeerick@pinebookpro ~]$ sudo /usr/bin/sync.sh
Simple mixer control 'Speaker',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'Playback Polarity',0
Capabilities: enum
Items: 'Normal' 'R Invert' 'L Invert' 'L + R Invert'
Item0: 'Normal'
- and more confusingly... it seems that it did sync to the correct values at boot as the headphones were plugged in during the boot.
May 07 18:40:57 pinebookpro systemd[1]: Starting Sync initial headphone plug state...
May 07 18:40:57 pinebookpro sync.sh[841]: Simple mixer control 'Speaker',0
May 07 18:40:57 pinebookpro sync.sh[841]: Capabilities: pswitch pswitch-joined
May 07 18:40:57 pinebookpro sync.sh[841]: Playback channels: Mono
May 07 18:40:57 pinebookpro sync.sh[841]: Mono: Playback [off]
May 07 18:40:57 pinebookpro sync.sh[844]: Simple mixer control 'Playback Polarity',0
May 07 18:40:57 pinebookpro sync.sh[844]: Capabilities: enum
May 07 18:40:57 pinebookpro sync.sh[844]: Items: 'Normal' 'R Invert' 'L Invert' 'L + R Invert'
May 07 18:40:57 pinebookpro sync.sh[844]: Item0: 'Normal'
May 07 18:40:57 pinebookpro systemd[1]: Finished Sync initial headphone plug state.