tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Thinkpad X200 volume hotkeys
On Wed, Jan 24, 2024 at 08:24:21AM +0100, Andreas Hecht wrote:
> On Mon, Jan 22, 2024 at 10:39:28PM +0000, Taylor R Campbell wrote:
> > > Date: Mon, 22 Jan 2024 20:49:56 +0100
> > > From: Andreas Hecht <a.e.hecht%t-online.de@localhost>
> > >
> > > I am trying to get the volume hotkeys (VolumeUp, VolumeDown, VolumeMute) on my
> > > Lenovo Thinkpad X200 to work. Unfortunately the respective hotkey events are
> > > not seen by thinkpad_acpi driver's thinkpad_notify_handler. The comments (->
> > > "Not seen on T61") in the driver indicate that these volume hotkeys are not
> > > working for the Thinkpad T61 either. Could someone please point me in the right
> > > direction how to fix this? The volume hotkeys work fine on the same X200 with
> > > OpenBSD 7.4.
> >
> > Some things to try:
> >
> > 1. Post the output of `acpidump -dt' somewhere -- maybe it will have
> > clues.
> >
> > 2. Run
> >
> > dtrace -n 'sdt:thinkpad:hotkey:MHKP { print(args[1]) }'
> >
> > and then try hitting the hotkeys, and post what comes out. (Hit ^C
> > when done.)
> >
> > 3. If that doesn't turn anything up, could try:
> >
> > (a) dtracing fbt::wskbd_input:entry (print args[0]->dv_xname,
> > args[1], and args[2]) and see if anything interesting comes
> > out,
> > (b) building a new kernel to printf what's happening inside
> > thinkpad_attach to see if that helps, and maybe comparing with
> > what OpenBSD does.
> >
> > And, if this is NetBSD 9.x, try NetBSD 10.0_RC3 -- it has had some
> > changes in the Thinkpad hotkey driver.
>
> Tested the volume hotkeys with a netbsd-10-0-RC3 kernel with ACPI_DEBUG
> option enabled but volume hotkey events did not show up. Will try the
> suggestions you've made and post my findings.
I've been able to figure out somethings regarding the X200 volume
hotkeys in the meantime and wanted to share my findings:
VolumeMute is handled by the X200's embedded controller not the
operating system, so probably nothing can be changed about its behavior.
It mutes the speakers but does not mute the headphones. (Wanted it to
mute the headphones also.)
In openbsd the VolumeUp/VolumeDown keys are handled by the pckbd and wskbd
drivers. The respective keycodes get intercepted and appropriate audio driver
functions called which regulate the mixer. Netbsd can do the same with the
patch below.
Unfortunately, the audio driver's audio_volume_up & audio_volume_down
functions only regulate the volume of the output labeled "master" which
on the X200 happens to be the headphones (-> mixerctl: "outputs.master",
"DAC00"). The volume of the speakers (-> mixerctl: "outputs.master2",
"DAC02") remains unchanged.
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 18 Feb 2024 20:12:22 -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