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

Getting 'Invalid argument' errors #1

Open
pllop opened this issue Nov 19, 2015 · 7 comments
Open

Getting 'Invalid argument' errors #1

pllop opened this issue Nov 19, 2015 · 7 comments

Comments

@pllop
Copy link

pllop commented Nov 19, 2015

I have a T410 and I am running Ubuntu 15.10 with kernel 4.2.0-18 (64-bit). I compiled and inserted the module without any errors and I am able to read the current value of any setting in /sys/devices/platform/thinkpad-wmi and also all values from /sys/kernel/debug/thinkpad-wmi/bios_settings.

However, when trying set anything I get 'Invalid argument' errors. For example, trying to set PowerOnNumLock to On (just for testing):

# echo On > /sys/devices/platform/thinkpad-wmi/PowerOnNumLock
bash: echo: write error: Invalid argument

Also, when trying list_valid_choices for PowerOnNumLock:

# echo PowerOnNumLock > /sys/kernel/debug/thinkpad-wmi/argument
# cat /sys/kernel/debug/thinkpad-wmi/list_valid_choices 
cat: /sys/kernel/debug/thinkpad-wmi/list_valid_choices: Invalid argument

I don't have any passwords set. Am I missing some step needed to make it work?

@iksaif
Copy link
Owner

iksaif commented Nov 19, 2015

Any extra information in dmesg ?
Can you paste the output of bios_settings in debugfs ? (remove sensitive information if needed)

@pllop
Copy link
Author

pllop commented Nov 19, 2015

Nothing in dmesg. Here is bios_settings:

WakeOnLAN=ACOnly
FlashOverLAN=Enable
EthernetLANOptionROM=Enable
HarddriveDMA=Enable
WirelessLANandWiMAXRadios=On
PCIINTA=11
PCIINTB=11
PCIINTC=11
PCIINTD=11
PCIINTE=11
PCIINTF=11
PCIINTG=11
PCIINTH=11
USBBIOSSupport=Enable
AlwaysOnUSB=Enable
AlwaysOnUSBMode=Automatic
TrackPoint=Automatic
FnCtrlKeySwap=Disable
OnByAcAttach=Disable
TouchPad=Automatic
FnKeyLock=Disable
ThinkPadNumLock=Independent
PowerOnNumLock=Auto
BootDisplayDevice=LCD
GraphicsDevice=SwitchableGfx
OsDetectionForSwitchableGraphics=Enable
TimerWakeWithBattery=Disable
SpeedStep=Enable
SpeedStepModeAC=Automatic
SpeedStepModeBattery=BatteryOptimized
AdaptiveThermalManagementAC=MaximizePerformance
AdaptiveThermalManagementBattery=Balanced
CDROMSpeed=Normal
CPUPowerManagement=Automatic
PCIPowerManagement=Automatic
PCIExpressPowerManagement=Automatic
PowerControlBeep=Enable
LowBatteryAlarm=Enable
PasswordBeep=Disable
KeyboardBeep=Enable
ExtendedMemoryTest=Disable
SATAControllerMode=AHCI
CoreMultiProcessing=Enable
HyperThreadingTechnology=Enable
VirtualizationTechnology=Enable
VTdFeature=Enable
AMTControl=Enable
HostBasedConfiguration=Disable
AMTUnprovisioning=Disable
HardwarePasswordManager=Enable
Passphrase=Enable
LockBIOSSetting=Disable
MinimumPasswordLength=Disable
BIOSPasswordAtUnattendedBoot=Enable
FingerprintPredesktopAuthentication=Enable
FingerprintReaderPriority=External
FingerprintSecurityMode=Normal
FingerprintPasswordAuthentication=Enable
SecurityChip=Inactive
TXTFeature=Disable
BIOSUpdateByEndUsers=Enable
DataExecutionPrevention=Enable
EthernetLANAccess=Enable
WirelessLANAccess=Enable
WiMAXAccess=Enable
WirelessWANAccess=Enable
BluetoothAccess=Enable
ModemAccess=Enable
USBPortAccess=Enable
IEEE1394Access=Disable
ExpressCardAccess=Disable
UltrabayAccess=Enable
MemoryCardSlotAccess=Enable
SmartCardSlotAccess=Enable
IntegratedCameraAccess=Disable
MicrophoneAccess=Enable
FingerprintReaderAccess=Enable
eSATAPortAccess=Enable
ComputraceModuleActivation=Enable
ATpModuleActivation=Disable
BootMode=Quick
StartupOptionKeys=Enable
BootDeviceListF12Option=Enable
BootOrder=USBFDD:ATAPICD0:USBCD:HDD0:PCILAN:USBHDD:HDD1
NetworkBootOrder=PCILAN:USBFDD:ATAPICD0:USBCD:HDD0:USBHDD:HDD1

@iksaif
Copy link
Owner

iksaif commented Nov 20, 2015

Can you try:

In debugfs
$ echo 1 > instance
$ cat bios_setting
$ echo PowerOnNumLock > argument
$ cat list_valid_choices

In sysfs:
$ cat PowerOnNumLock

@pllop
Copy link
Author

pllop commented Nov 20, 2015

root@X:~# cd /sys/kernel/debug/thinkpad-wmi
root@X:/sys/kernel/debug/thinkpad-wmi# echo 1 > instance
root@X:/sys/kernel/debug/thinkpad-wmi# cat bios_setting
FlashOverLAN=Enable
root@X:/sys/kernel/debug/thinkpad-wmi# echo PowerOnNumLock > argument
root@X:/sys/kernel/debug/thinkpad-wmi# cat list_valid_choices
cat: list_valid_choices: Invalid argument
root@X:/sys/kernel/debug/thinkpad-wmi# cd /sys/devices/platform/thinkpad-wmi
root@X:/sys/devices/platform/thinkpad-wmi# cat PowerOnNumLock
Auto

root@X:/sys/devices/platform/thinkpad-wmi# 

Interestingly, writing to instance seems successful. I tried with other numbers too and the result of bios_setting is as expected.

@pllop
Copy link
Author

pllop commented Nov 21, 2015

Ok, I poked around the code a bit and managed to get it to change settings successfully. There were two problems:

  • Newlines are not trimmed from the string containing the value. Doing echo -n can work around that.
  • store_settings returns ret which is the return value of the last call to thinkpad_wmi_xxx, instead of the number of bytes written. When the calls are successful this is 0, and returning that causes an infinite loop. After changing it to return count, it works.

I still don't know what the problem with list_valid_choices is, but it is something different from the ones with changing settings.

@iksaif
Copy link
Owner

iksaif commented Nov 22, 2015

Hmmm, so somehow, we can't list valid choices. In the BIOS, what are the valid choices for PoweOnNumLock (there should be a something in the UI somewhere)

Could you send me a patch for your changes ? (I wrote this code 2 years ago, and I might have uploaded the wrong version :/)

@iksaif
Copy link
Owner

iksaif commented Sep 4, 2017

Please try with the latest version

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

2 participants