Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automatically enable fn_lock #46

Closed
sonnyp opened this issue Jul 11, 2019 · 8 comments
Closed

automatically enable fn_lock #46

sonnyp opened this issue Jul 11, 2019 · 8 comments

Comments

@sonnyp
Copy link

sonnyp commented Jul 11, 2019

I have the following udev rule:

/etc/udev/rules.d/10-thinkpad-usb-keyboard.rules

SUBSYSTEM=="hid", ATTRS{idVendor}=="17ef", ATTRS{idProduct}=="6047", RUN+="/opt/thinkpad-usb-keyboard-hotkeys"

and script:

#!/bin/sh
FILENAMES=(/sys/bus/hid/devices/*:17EF:6047*/fn_lock)

for FILENAME in ${FILENAMES}
do
  echo 0 > ${FILENAME}
done

It works well, but is there a better way?

@sonnyp sonnyp changed the title automatically enable Fn-Lock automatically enable fn_lock Jul 11, 2019
@lentinj
Copy link
Owner

lentinj commented Jul 15, 2019

Not really. You could probably simplify this by using udev variable substitutions to find the path, something like RUN += "/bin/sh -c 'echo 0 > $devpath/fn_lock'", but it's not a dramatic difference.

@amosbird
Copy link

Hmm, but I cannot see any fn_lock files on arch

 ❯ ls /sys/bus/hid/devices/*
'/sys/bus/hid/devices/0003:17EF:306F.001F':
country  driver  hidraw  input  modalias  power  report_descriptor  subsystem  uevent

'/sys/bus/hid/devices/0003:17EF:3077.001E':
country  driver  hidraw  modalias  power  report_descriptor  subsystem  uevent

'/sys/bus/hid/devices/0003:17EF:60B5.002C':
country  driver  hidraw  input  modalias  power  report_descriptor  subsystem  uevent

'/sys/bus/hid/devices/0003:17EF:60B5.002D':
country  driver  hidraw  input  modalias  power  report_descriptor  subsystem  uevent

'/sys/bus/hid/devices/0003:17EF:60B5.002E':
country  driver  hidraw  input  modalias  power  quirks  report_descriptor  subsystem  uevent

@sonnyp
Copy link
Author

sonnyp commented Oct 16, 2019

@amosbird you don't seem to have any Thinkpad Compact keyboard

ls /sys/bus/hid/devices/*:17EF:6047*/

@amosbird
Copy link

I don't. But I'm refering to this

Linux kernels 3.17 and above (or any kernel with the kernel-patches applied) have built in support for the keyboards. This means all keys should work out the box, and you can control whether fn_lock is enabled by:

@sonnyp
Copy link
Author

sonnyp commented Oct 16, 2019

it's referring to Thinkpad Compact keyboards

@amosbird
Copy link

Ah, I see. But it's still a thinkpad keyboard, hacked from x1 tablet 3.

image

@amosbird
Copy link

I'm trying to base on the hid-lenovo.c and add fn_lock support for x1-tab3. Is there any way of finding the hid events for that keyboard's fn_lock functionality?

@lentinj
Copy link
Owner

lentinj commented Oct 17, 2019

The patches / utilities in here are for the compact keyboards, and will not support anything else. The fn_lock files are compact keyboard specific, and not how most Thinkpad keyboards work, where the Fn key is managed by the Embedded Controller.

I'm trying to base on the hid-lenovo.c and add fn_lock support for x1-tab3

https://github.com/lentinj/tp-compact-keyboard#how-i-did-it

Regardless, this is definitely off-topic for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants