Discussion:
Mute, FnLock keyboard LEDs don't work
Subhaditya Nath
2021-06-03 16:11:51 UTC
Permalink
Hi

I have noticed that the Speaker Mute LED and the FnLock LED doesn't work on my
Thinkpad E495.


Behaviour of Speaker mute button -
-------------------------------
When pressed, it toggles the output.mute parameter in sndioctl.
The sound is muted/unmuted.
The LED doesn't light up in either case.


Behaviour of FnLock button -
-------------------------
(I am not aware of any command to toggle FnLock from the command line)
When pressed, it toggles the state of FnLock. (ie. the button is working)
The LED doesn't normally light up. But, if the laptop resumes from sleep with
FnLock enabled, then the FnLock LED lights up. But, it doesn't turn off until
the next sleep-resume cycle.

ie. effectively, the FnLock LED does work, but it is not getting refreshed. It
only gets refreshed when the laptop is sleep and then resume.
(Sorry for my bad english)

The "refresh" issue of FnLock LED was also persistent in the Linux kernel till a
few months ago. It was resolved only recently. See this -
https://bugzilla.kernel.org/show_bug.cgi?id=207841



How can these issues be fixed?
Stuart Henderson
2021-06-04 10:10:35 UTC
Permalink
Post by Subhaditya Nath
Hi
I have noticed that the Speaker Mute LED and the FnLock LED doesn't work on my
Thinkpad E495.
Behaviour of Speaker mute button -
-------------------------------
When pressed, it toggles the output.mute parameter in sndioctl.
The sound is muted/unmuted.
The LED doesn't light up in either case.
Behaviour of FnLock button -
-------------------------
(I am not aware of any command to toggle FnLock from the command line)
When pressed, it toggles the state of FnLock. (ie. the button is working)
The LED doesn't normally light up. But, if the laptop resumes from sleep with
FnLock enabled, then the FnLock LED lights up. But, it doesn't turn off until
the next sleep-resume cycle.
ie. effectively, the FnLock LED does work, but it is not getting refreshed. It
only gets refreshed when the laptop is sleep and then resume.
(Sorry for my bad english)
The "refresh" issue of FnLock LED was also persistent in the Linux kernel till a
few months ago. It was resolved only recently. See this -
https://bugzilla.kernel.org/show_bug.cgi?id=207841
How can these issues be fixed?
I believe this is a firmware bug.

Untested (I don't have hardware) but from the comments in the kernel.org
bug ticket and other related discussion something like this might do the
trick for fnlock. Seems like it should be safe for older thinkpads too.

I wonder if running GMKS may possibly also update the speaker mute led
too, if so it could be called from the relevant code for that too.

Index: sys/dev/acpi/acpithinkpad.c
===================================================================
RCS file: /cvs/src/sys/dev/acpi/acpithinkpad.c,v
retrieving revision 1.68
diff -u -p -r1.68 acpithinkpad.c
--- sys/dev/acpi/acpithinkpad.c 31 Dec 2019 01:38:33 -0000 1.68
+++ sys/dev/acpi/acpithinkpad.c 4 Jun 2021 10:06:38 -0000
@@ -166,6 +166,7 @@ int thinkpad_brightness_up(struct acpith
int thinkpad_brightness_down(struct acpithinkpad_softc *);
int thinkpad_adaptive_change(struct acpithinkpad_softc *);
int thinkpad_activate(struct device *, int);
+int thinkpad_get_mediakey_status(struct acpithinkpad_softc *);

/* wscons hook functions */
void thinkpad_get_thinklight(struct acpithinkpad_softc *);
@@ -465,6 +466,10 @@ thinkpad_hotkey(struct aml_node *node, i
sc->sc_sens[THINKPAD_SENSOR_PORTREPL].status =
SENSOR_S_OK;
break;
+ case THINKPAD_BUTTON_FN_TOGGLE:
+ /* force status led to update */
+ thinkpad_get_mediakey_status(sc);
+ break;
default:
/* unknown or boring event */
DPRINTF(("%s: unhandled event 0x%03llx\n", DEVNAME(sc),
@@ -642,6 +647,18 @@ thinkpad_activate(struct device *self, i
break;
}
return (0);
+}
+
+int
+thinkpad_get_mediakey_status(struct acpithinkpad_softc *sc)
+{
+ int ret;
+ int64_t res;
+
+ ret = aml_evalinteger(sc->sc_acpi, sc->sc_devnode, "GMKS", 0, NULL,
+ &res);
+
+ return ret;
}

void

Loading...