On 11/28/24 2:25 PM, E. Liddell via tde-users wrote:
On Thu, 28 Nov 2024 13:22:30 -0600
Darrell Anderson via tde-users <users(a)trinitydesktop.org> wrote:
I browsed the tdeutils/kmilo code but did not
find anything obvious with
how Fn keys are mapped or detected on Thinkpads.
If I'm reading the code correctly, it isn't detecting your key presses
per se at all.
If you fish through the READMEs, it looks like kmilo's Thinkpad
support was at least in part carried over from an application called tpb
(
http://www.nongnu.org/tpb/ ), whose developers reverse-engineered
what the extended keys were doing by observing nvram. kmilo seems to
be using offsets and bitmasks hard-coded into the
ThinkPadMonitor::getNvramState function in kmilo/thinkpad/thinkpad.cpp
to determine what the nvram contents mean.
I think there are instructions somewhere on the tpb site for monitoring
nvram. That seems to be what you would have to do to derive a new
set of magic numbers that work with your T580.
It's a weird and brittle system, and to be honest, I'm surprised it works
at all on modern hardware.
I looked at kmilo/thinkpad/README. As mentioned, the text implies that
Thinkpad special key mappings are stored in the hardware nvram, of which
the /dev/nvram device node is used to read the contents.
On my (Slackware) system the default permissions for /dev/nvram is 0600.
TDE kmilo/thinkpad code is designed to expect full read permissions and
prefers write permissions for certain functions. Yet these expectations
do not seem required for KDE or Xfce. My wild guess is those read/write
limitations should be removed from TDE code.
TDE reads some T580 special keys correctly but not the brightness keys
and reads the T400 brightness keys just fine. My guess is the hardcoding
method in kmilo/thinkpad/thinkpad.cpp (thinkpad_state->brightness_level
and thinkpad_state->brightness_toggle) is presuming only the old style
Thinkpad key mappings of Fn+Home|End.
I'm guessing with KDE and Xfce the code interrogates nvram to discover
the mappings. The old way used in TDE code doesn't do this.
A paper cut bug but most of us know the old proverb about paper cuts. :(