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

"thinklmi getsettings" returns "query_apps open: No such file or directory" #21

Open
aravindhp opened this issue Feb 21, 2022 · 13 comments

Comments

@aravindhp
Copy link

I am on a Lenovo P1 running Fedora 35 5.16.9-200.fc35.x86_64. When I run:

thinklmi-user   master ?:1  sudo ./thinklmi getsettings
query_apps open: No such file or directory

I do see:

thinklmi-user   master ?:1  ls /sys/bus/wmi/drivers/think-lmi/
51F5230E-9677-46CD-A1CF-C0B23EE34DB7  bind  module  uevent  unbind

Am I missing something else?

@mrhpearson
Copy link
Collaborator

Hi,
Not sure on why that's not working - will have to check that out - but as you're on a 5.16 kernel you'll be better off using the upstream driver. I think you just need to do:
sudo modprobe think-lmi

And then you can access the attributes under /sys/class/firmware-attributes/thinklmi/attributes
There is some kernel documentation on the firmware-attributes class - but let me know if any questions
Mark

@aravindhp
Copy link
Author

So just interact directly with /sys/class/firmware-attributes/thinklmi/attributes and not use thinklmi?

@mrhpearson
Copy link
Collaborator

Yes.
We need to an updated user space utility to make this easier - I believe it's on Sugu's todo list. But using the built-in kernel driver avoids the hassle of having to build a kernel module, and it's using the standard firmware-attributes class which is better.
Mark

@mrhpearson
Copy link
Collaborator

Hi - I did just check this out on my P1G4 with the same Fedora kernel - and it worked for me correctly so it's curious it's not working for you. Still recommend the built in one (especially as it's already in Fedora) but :

Do you have /dev/thinklmi on your system?
Any clues in the dmesg as to issues loading the module?

Mark

@aravindhp
Copy link
Author

Do you have /dev/thinklmi on your system?

No

Any clues in the dmesg as to issues loading the module?

Not that I can see.

thinklmi-user   master ?:1  lsmod | grep think_lmi
think_lmi              24576  0
firmware_attributes_class    16384  1 think_lmi
wmi                    32768  5 intel_wmi_thunderbolt,wmi_bmof,think_lmi,mxm_wmi,nouveau
thinklmi-user   master ?:1  dmesg | grep think_lmi

@mrhpearson
Copy link
Collaborator

OK - I think you might have the built-in kernel think_lmi module loaded...which is stopping your self-built version loading.
Do 'rmmod think_lmi', then load the version you built - and that should work.

@aravindhp
Copy link
Author

Yes I was using the built-in kernel module. Sorry for not calling that out clearly. Does the CLI not work with the built-in module?

@mrhpearson
Copy link
Collaborator

Afraid not currently
@sugudsl is looking at it I think.

@ckuethe
Copy link

ckuethe commented Jul 15, 2022

Afraid not currently @sugudsl is looking at it I think.

I guess the big question here is: "how do I authenticate using sysfs so I can make changes?" Sysfs works very well for retrieving parameters, but I'm not sure where or what to echo into a device to change a setting.

Device: Lenovo ThinkPad T14 Gen 2a, model 20XK001BUS
Distro: Ubuntu 20.04.4 LTS
Kernel: 5.14.0-1045-oem #51-Ubuntu SMP Mon Jul 4 06:41:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

@mrhpearson
Copy link
Collaborator

If you're using the upstream version (not the one on github) that uses the /sys/class/firmware-attributes interface - and documentation is available here: https://github.com/torvalds/linux/blob/master/Documentation/ABI/testing/sysfs-class-firmware-attributes

I'm not sure if the think module is in 20.04.4 though - can you do a 'modprobe think-lmi' and see if it's there. In the long term it's the way to go.

@ckuethe
Copy link

ckuethe commented Jul 15, 2022

Derp, I forgot to include think-lmi info.

Are you saying that the Dell auth method - echo password into /sys/class/firmware-attributes/thinklmi/authentication/Admin/current_password, do stuff, echo null into current_password- also works for Lenovo? Huh, I didn't think to try that, since it looked like it was Dell-specific.

$ ls /sys/class/firmware-attributes/thinklmi/attributes/*/current_value | wc
     86      86    7202

$ dpkg -S $(find /lib/modules/$(uname -r) -name think-lmi.ko )
linux-modules-5.14.0-1045-oem: /lib/modules/5.14.0-1045-oem/kernel/drivers/platform/x86/think-lmi.ko

$ modinfo think-lmi
filename:       /lib/modules/5.14.0-1045-oem/kernel/drivers/platform/x86/think-lmi.ko
license:        GPL
description:    ThinkLMI Driver
author:         Corentin Chary <[email protected]>
author:         Mark Pearson <[email protected]>
author:         Sugumaran L <[email protected]>
srcversion:     B30CB6A982D296A51EFAC3D
alias:          wmi:51F5230E-9677-46CD-A1CF-C0B23EE34DB7
depends:        wmi,firmware_attributes_class
retpoline:      Y
intree:         Y
name:           think_lmi
vermagic:       5.14.0-1045-oem SMP mod_unload modversions 
sig_id:         PKCS#7
signer:         Build time autogenerated kernel key
sig_key:        4D:C4:AC:96:07:8D:F7:33:22:CD:F8:88:80:DB:0F:AC:46:54:09:DD
sig_hashalgo:   sha512
signature:      79:14:38:31:2C:FE:16:57:6E:16:B9:A9:1A:36:3F:51:3A:C4:6C:07:
		71:7F:A6:41:CD:30:67:C0:71:F1:E2:0C:C8:A5:B4:A0:A5:67:5D:DD:
		40:6C:B6:9E:9B:21:73:23:E5:A6:EB:31:B5:4F:E3:79:16:09:FF:DB:
		D9:01:7F:9D:D4:57:68:CD:EB:1B:04:C9:A3:E8:3A:67:56:F8:47:72:
		40:CA:1D:9E:B7:3D:75:5E:36:5A:EE:DB:2E:AC:71:0C:32:0B:2E:2A:
		84:1F:64:0C:F1:3E:37:41:2C:B5:32:DA:70:49:0F:4C:84:0B:4E:16:
		71:00:F8:CC:70:5E:D7:8F:49:29:01:40:F5:0E:15:1B:3C:68:4A:D2:
		7F:62:C7:88:8D:A1:D6:E8:0D:9D:B1:37:77:BA:A1:AD:09:DC:88:BD:
		41:77:1E:14:F5:EF:81:0D:57:7E:EF:8A:A2:3F:6B:55:28:FB:E4:5D:
		15:C1:67:13:A7:15:E0:A1:51:E5:F7:13:BF:9E:61:0D:F5:F6:35:85:
		61:EC:03:9E:EA:AC:57:7F:AF:25:5F:FF:E7:93:92:34:D7:6F:57:83:
		62:B6:45:4D:B8:3E:D2:97:CF:3F:53:E6:94:D6:09:DD:13:E7:83:66:
		B0:E6:BD:E9:6D:40:C4:C7:CF:88:68:7E:A2:A7:F3:E4:F1:7E:29:F0:
		DD:D5:62:7A:B1:28:F3:45:9D:22:A0:31:5D:12:98:AE:67:AD:D6:21:
		4C:24:94:E1:F3:4B:E2:07:DE:6C:94:49:1E:91:8E:70:B8:62:A2:93:
		30:6F:56:96:D2:21:CD:F1:7E:EB:5B:6F:95:98:C0:AB:12:D6:9A:30:
		EB:0E:84:B4:32:E6:BA:11:49:55:1D:2B:93:29:68:09:80:A6:55:8D:
		8B:A0:95:78:73:9A:27:F7:DC:D5:8E:48:D3:C3:72:15:BC:9C:65:EB:
		C9:E2:F8:76:D6:72:D4:F4:47:9F:B9:D6:56:B4:A9:E2:88:55:DA:51:
		86:20:A1:D6:A4:B0:DD:93:58:FB:C4:00:E9:39:EF:D4:5B:EE:EB:CF:
		D4:19:90:DB:00:2F:CC:9F:50:4E:F2:B2:92:0F:33:23:58:AB:C4:6E:
		6D:41:70:19:23:1B:84:C6:BA:3E:00:8C:1C:7E:78:18:53:04:AD:CE:
		B0:C8:64:6A:8F:E4:98:54:9E:69:7B:4F:CC:78:7D:89:85:97:0A:0D:
		C9:18:B1:29:E1:45:C8:85:5C:59:74:D5:C9:59:10:7C:34:A1:1F:7B:
		CD:99:92:76:5C:F7:4D:C0:7C:D6:2F:37:90:07:46:A2:46:EE:9C:E2:
		B0:A4:4C:09:9E:9E:DE:FB:FB:97:B3:34

@mrhpearson
Copy link
Collaborator

Yep - the firmware-attributes class is generic. We implemented think-lmi on top of it (with some differences in between the two to, but for the basics it should behave the same). Under the hood the implementation of this driver (which uses ioctl''s) and the upstream one (using the class) are very different :)

Mark

@ckuethe
Copy link

ckuethe commented Jul 17, 2022

Ah. Will have to do up a PR, then, to move the description of the auth mechanism to indicate that it's not just a dell-specific thing. Thanks.

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