NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/58031: audio keys don't work on thinkpad X200
>Number: 58031
>Category: kern
>Synopsis: audio keys don't work on thinkpad X200
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Mar 12 07:10:00 +0000 2024
>Originator: Andreas Hecht
>Release: NetBSD 10.99.10
>Organization:
N/A
>Environment:
System: NetBSD pc.domain.home 10.99.10 NetBSD 10.99.10 (MYKERNEL) #89: Mon Mar 11 12:38:31 CET 2024 andreas%pc.domain.home@localhost:/home/andreas/git/netbsd/src/sys/arch/amd64/compile/obj/MYKERNEL amd64
Architecture: x86_64
Machine: amd64
>Description:
The volume up/down hotkeys on the thinkpad X200 do not work. The problem is
probably not limited to the X200 but might affect any model which has its audio
keys handled by the pckbd driver (-> see fix below).
>How-To-Repeat:
On the X200, press volume up/down key and observe the output of 'mixerctl -a':
The volume will not change.
>Fix:
The pckbd driver fails to forward the volume up (176), volume down (174) and
volume mute (160) keycodes to the wskbd driver's wskbd_input function. The
patch below (inspired by OpenBSD's implementation) fixes this.
wskbd_input calls wskbd_translate and internal_command functions in turn where
the keys get treated as internal commands:
KS_Cmd_VolumeUp, KS_Cmd_VolumeDown and KS_Cmd_VolumeToggle.
These internal commands inject
PMFE_AUDIO_VOLUME_UP, PMFE_AUDIO_VOLUME_DOWN and PMFE_AUDIO_VOLUME_TOGGLE
events via the PMF framework which, when processed, cause the audio driver's
audio_volume_up, audio_volume_down and audio_volume_toggle
functions to be called.
So, everything regarding volume control seems to be in place already
except for the volume hotkey related keycode forwarding in the pckbd
driver.
Index: sys/dev/pckbport/pckbd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pckbport/pckbd.c,v
retrieving revision 1.39
diff -u -p -r1.39 pckbd.c
--- sys/dev/pckbport/pckbd.c 9 Feb 2024 22:08:36 -0000 1.39
+++ sys/dev/pckbport/pckbd.c 11 Mar 2024 16:37:17 -0000
@@ -1010,19 +1010,27 @@ pckbd_input(void *vsc, int data)
struct pckbd_softc *sc = vsc;
int key;
u_int type;
+ bool is_decoded;
data = pckbd_scancode_translate(sc->id, data);
if (data == 0)
return;
+ is_decoded = pckbd_decode(sc->id, data, &type, &key);
+
#ifdef WSDISPLAY_COMPAT_RAWKBD
if (sc->rawkbd) {
u_char d = data;
wskbd_rawinput(sc->sc_wskbddev, &d, 1);
- return;
+
+ /*
+ * Pass audio keys to wskbd_input anyway.
+ */
+ if ((!is_decoded) || (key != 160 && key != 174 && key != 176))
+ return;
}
#endif
- if (pckbd_decode(sc->id, data, &type, &key))
+ if (is_decoded)
wskbd_input(sc->sc_wskbddev, type, key);
}
Home |
Main Index |
Thread Index |
Old Index