dell / libsmbios

library for interacting with Dell SMBIOS tables
Other
192 stars 39 forks source link

Latitude E5470 keyboard backlight support #3

Closed nunojpg closed 7 years ago

nunojpg commented 8 years ago

Hi :smile:

My E5470 with the current linux tree driver turns on the backlight when linux boots, and logs some errors. I am trying to bring support for it, and after cross-checking with this lib, I see it also gives some errors with my laptop.

sudo ./smbios-sys-info
Libsmbios version:      2.3.1
Product Name:           Latitude E5470
Vendor:                 Dell Inc.
BIOS Version:           1.9.4
sudo ./smbios-keyboard-ctl -g
Helper function to print current status of keyboard illumination

 Current status of KeyBoard Illumination setting on your system: 
-------------------------------------------------------------------

 Configured mode state: 
     Auto: Input-activity-based On (illumination level 100%); input-activity based Off

 Your Keyboard will illumination on: 
    Any Keystroke
    Touchpad activity

 Keyboard illumination timeout has bee set at: 10  Seconds

 Current setting of ALS value that turns the light on or off: 0
 Current ALS Reading : 0
 Current keyboard light level : 0
sudo ./smbios-keyboard-ctl --set-mode
Setting USER Selectable Keyboard Mode

 Supported USER Selectable Modes: 
    Option  Mode
------------------------------------------------
    0   Always OFF
    1   Always ON
    6   Auto: Input-activity-based On (illumination level 50%); input-activity based Off
    8   Auto: Input-activity-based On (illumination level 100%); input-activity based Off

 Note: some modes might need the keyboard set at specific illumination levels

Select Mode: 0
      Set Trigger Failed. Failed to write config
     Error Return Code : cbRES1: 0x-2 cbRES2: 0xA000000 cbRES3: 0x0 
superm1 commented 8 years ago

So for your problem of it turning on at boot, it's entirely a userspace problem. It's in both upower and gnome-settings-daemon.

The upower fix went upstream but it isn't yet in a released version (https://cgit.freedesktop.org/upower/commit/?id=793642bfb752494b97c3ef96eb60ae0ec573723b) https://bugs.freedesktop.org/show_bug.cgi?id=95457

The gnome settings daemon problem has 3 patches that are not yet accepted. https://bugzilla.gnome.org/show_bug.cgi?id=773402 https://bugzilla.gnome.org/show_bug.cgi?id=773403 https://bugzilla.gnome.org/show_bug.cgi?id=773405

nunojpg commented 8 years ago

Thank you so much for the info. Regarding this lib error (which doesn't really matter to my problem anyway), if you need to test any patch in this machine, I will also be happy to do it.

superm1 commented 8 years ago

Thanks, I'll leave this open and let @prabhakarpujeri comment if they want to drill further into the libsmbios problem.

tiwai commented 8 years ago

I see the same problem on Dell Latitude E7270. (I was instructed to reach here after reporting the similar issue for kernel dell-laptop driver.)

The keyboard backlight issue has nothing to do with upower and else. It happens purely in kernel, without desktop environment. I bet dell-desktop driver tries to access the kbd setup and this turns on the backlight falsely.

I noticed the same behavior in smbios-keyboard-ctl; it also turns on the kbd backlight always when running --set-mode or such, no matter which mode is set.

superm1 commented 8 years ago

Hmm, OK. There is definitely a userspace problem as I linked above, but I'm suspecting a secondary firmware problem specific to last year's generation too.

@nunojpg can you please update to the latest firmware (1.10.5) http://www.dell.com/support/home/us/en/19/Drivers/DriversDetails?driverId=D3HCR&fileId=3580276649&osCode=WB64A&productCode=latitude-e5470-laptop&languageCode=en&categoryId=BI and confirm if it's still happening?

@tiwai can you please update to the latest firmware (1.10.4) http://www.dell.com/support/home/us/en/19/Drivers/DriversDetails?driverId=J6J48&fileId=3580453661&osCode=WB64A&productCode=latitude-e7270-ultrabook&languageCode=en&categoryId=BI and confirm it's still happening?

In case you're not aware,

  1. save the .EXE file to a FAT32 USB stick (or to your FAT32 EFI System partition),
  2. reboot the machine.
  3. from POST menu, press F12.
  4. in boot menu select the option to flash the BIOS update
  5. select the file from your ESP or USB disk.
nunojpg commented 8 years ago
sudo ./smbios-sys-info
[sudo] password for nuno: 
Libsmbios version:      2.3.1
Product Name:           Latitude E5470
Vendor:                 Dell Inc.
BIOS Version:           1.10.5
System ID:              0x06DE
Asset Tag:              Not Specified
Property Ownership Tag: 
sudo ./smbios-keyboard-ctl -g
Helper function to print current status of keyboard illumination

 Current status of KeyBoard Illumination setting on your system: 
-------------------------------------------------------------------

 Configured mode state: 
     Auto: Input-activity-based On (illumination level 100%); input-activity based Off

 Your Keyboard will illumination on: 
    Any Keystroke
    Touchpad activity

 Keyboard illumination timeout has bee set at: 10  Seconds

 Current setting of ALS value that turns the light on or off: 0
 Current ALS Reading : 0
 Current keyboard light level : 0
sudo ./smbios-keyboard-ctl --set-mode
Setting USER Selectable Keyboard Mode

 Supported USER Selectable Modes: 
    Option  Mode
------------------------------------------------
    0   Always OFF
    1   Always ON
    6   Auto: Input-activity-based On (illumination level 50%); input-activity based Off
    8   Auto: Input-activity-based On (illumination level 100%); input-activity based Off

 Note: some modes might need the keyboard set at specific illumination levels

Select Mode: 0
      Set Trigger Failed. Failed to write config
     Error Return Code : cbRES1: 0x-2 cbRES2: 0xA000000 cbRES3: 0x0 
tiwai commented 7 years ago

Sorry for the late reply.

I did update BIOS on Latitude E7270 to the latest version 1.10.4, but it didn't help either. I get the very same outputs and the error code as nunojpg showed.

thuandt commented 7 years ago

I have same problem in Latitude E7470, BIOS version 1.11.3

darose commented 7 years ago

FYI, I had the same problem on a E7470 (on a non-gnome system) and was able to solve it by the steps described here:

https://bugs.launchpad.net/dell-sputnik/+bug/1510344/comments/104 https://bugs.launchpad.net/dell-sputnik/+bug/1510344/comments/101

tiwai commented 7 years ago

@darose, it's just a way how not to touch the broken interface, and not the way to fix the problem...

darose commented 7 years ago

Not sure what you mean. It fixed the problem for me - my keyboard backlight now turns itself off after 5 seconds of inactivity.

tiwai commented 7 years ago

You cannot change the keyboard backlight to other value (e.g. off) from Linux, right? If so, what you suggested is essentially a way how not to touch the buggy interface. But the bug itself is still present. Whenever you touch the interface, it falsely resets to 10s backlight mode no matter what value to set; that's the problem we're facing, after all.

zaszlo commented 7 years ago

I also have this problem on Dell Latitude E5570. Have updated the bios to 1.11 but the dmesg " dell_laptop: Setting old previous keyboard state failed" outputs are still coming.

divad commented 7 years ago

I also have this problem on a Dell Precision 7510.

kdanielm commented 7 years ago

+1

Same problem on a Latitude E7470 Bios 1.12.3.

msjyoo commented 7 years ago

Also experiencing this bug,

Libsmbios version:      2.3.1
Product Name:           Latitude E7470
Vendor:                 Dell Inc.
BIOS Version:           1.9.4

Unrelated question: How does smbios relate to /sys/class/leds/dell::kbd_backlight/brightness? Is smbios just an information store, or does it actually control the brightness?

msjyoo commented 7 years ago

Looks like sudo bash -c "echo 0 > /sys/class/leds/dell::kbd_backlight/brightness" doesn't work either. It turns my keyboard backlight on full brightness (exactly same as what happens as when using the smbios scripts here). It also causes the dmesg message dell_laptop: Setting old previous keyboard state failed. Looking at the Linux driver source, it looks like the driver tries to revert to an old setting after the 'set' operation fails, and even that fallback is failing?


Also regarding the backlight always going back to full brightness, the service systemd-backlight saves and restores backlight state between reboots. On my system, that's stored at /var/lib/systemd/backlight/platform-dell-laptop:leds:dell::kbd_backlight with content 0. When I run sudo /lib/systemd/systemd-backlight load leds:dell::kbd_backlight, it obviously tries to set the backlight brightness as I did above, and the backlight turns full brightness even when it tries to restore a value of 0.

Pe3ucTop commented 7 years ago

+1 Similar problem on Dell Precision 3510 Any news ? Update ? Patch ?

hall0j commented 7 years ago

+1 E7270

tigerfoot commented 7 years ago

Same here with now a almost one year and a half

Libsmbios: 2.3.0 System ID: 0x06D9 Service Tag: XXXXXX Express Service Code: 123123123456 Asset Tag: Not Specified Product Name: Precision 7510 BIOS Version: 1.9.5 Vendor: Dell Inc. Is Dell: 1 OEM String 1: Dell System OEM String 2: 1[06D9] OEM String 3: 3[1.0] OEM String 4: 12[www.dell.com] OEM String 5: 14[1] OEM String 6: 15[0]

Linux 4.10.1-1-default #1 SMP PREEMPT Sun Feb 26 12:43:10 UTC 2017 (1ecd5af) x86_64 x86_64 x86_64 GNU/Linux

To stop the error message which where just noise, and also keep the keyboard off I've done the following (the order of action is important) systemctl mask systemd-backlight@leds:dell::kbd_backlight.service systemctl reboot enter bios put keyboard illumination on off put delay to 5sec instead 10 Save & exit.

You now have a keyboard that stay off.

I'm not sure if I read correctly those, but I found that none has a bit too much information here. (like numlock, and or all state the battery and power can have which then render the right action impossible no ?

cat /sys/devices/platform/dell-laptop/leds/dell\:\:kbd_backlight/trigger [none] kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock usb-gadget usb-host disk-activity ide-disk cpu0 cpu1 cpu2 cpu3 cpu4 cpu5 cpu6 cpu7 mmc0 AC-online bluetooth-power BAT0-charging-or-full BAT0-charging BAT0-full BAT0-charging-blink-full-solid rfkill0 rfkill1 rfkill2 rfkill3 phy0rx phy0tx phy0assoc phy0radio

My old 4600 and 4300 are still working as expected ....

marcino239 commented 7 years ago

Similar issue on 7370, although Fn+F10 works:

sudo smbios-keyboard-ctl --set-level=0
Old Keyboard illumination level is: 0
      Set Trigger Failed. Failed to write config
     Error Return Code : cbRES1: 0x-2 cbRES2: 0xA000000 cbRES3: 0x0 

sudo smbios-keyboard-ctl --set-level=1
Value out of range, range is 0-0

sudo smbios-keyboard-ctl -i
Libsmbios version : 2.3.0
smbios-keyboard-ctl version : 2.3.0

 Capabilities of KeyBoard Illumination on your system: 
-------------------------------------------------------------------
 Supported USER Selectable Modes : 
     Always OFF
     Always ON
     Auto: Input-activity-based On (illumination level 50%); input-activity based Off
     Auto: Input-activity-based On (illumination level 100%); input-activity based Off

 Supported Keyboard illumination type :  Backlight

 Supports Keyboard illumination on : 
    Any Keystroke
    Touchpad activity
    Pointing stick

 Can configure Keyboard illumination timeout unit in : 
    Seconds
    Minutes
    Hours

 Supported Keyboard light brightness levels :  0

 Maximum acceptable seconds timeout value   :  255

 Maximum acceptable minutes timeout value   :  255

 Maximum acceptable hours timeout value     :  12

 Maximum acceptable days timeout value      :  0
rozie commented 7 years ago

Same issue here on E5470. I believe it's in the software itself as coleague from work has the same(?) hardware and it works. Can provide details about versions of software and hardware, just let me know what info you need.

superm1 commented 7 years ago

Hi everyone, sorry it's taken some time to identify what the cause of this was, but I believe we have a fix through libsmbios for it now. Can those affected please try the fix on my branch above?

milanzelenka commented 7 years ago

@superm1 thanks for patch... I've tested on ubuntu yakkety on my latitude e7270.

$ sudo smbios-sys-info
Libsmbios version:      2.3.3
Product Name:           Latitude E7270
Vendor:                 Dell Inc.
BIOS Version:           1.12.3
System ID:              0x06DB
Service Tag:            6L3NDC2
Express Service Code:   14336612930
Asset Tag:              Not Specified
Property Ownership Tag:

Turning illumination OFF by: # smbios-keyboard-ctl --set-mode works for now.

$ sudo smbios-keyboard-ctl --set-mode
Setting USER Selectable Keyboard Mode

 Supported USER Selectable Modes: 
        Option  Mode
------------------------------------------------
        0       Always OFF
        1       Always ON
        6       Auto: Input-activity-based On (illumination level 50%); input-activity based Off
        8       Auto: Input-activity-based On (illumination level 100%); input-activity based Off

 Note: some modes might need the keyboard set at specific illumination levels

Select Mode: 0

New mode parameter set Successfully

Turning illumination ON works, but returns this error:

$ sudo smbios-keyboard-ctl --set-mode
Setting USER Selectable Keyboard Mode

 Supported USER Selectable Modes: 
        Option  Mode
------------------------------------------------
        0       Always OFF
        1       Always ON
        6       Auto: Input-activity-based On (illumination level 50%); input-activity based Off
        8       Auto: Input-activity-based On (illumination level 100%); input-activity based Off

 Note: some modes might need the keyboard set at specific illumination levels

Select Mode: 1
          Set Trigger Failed. Failed to write config
         Error Return Code : cbRES1: 0x-2 cbRES2: 0xA000000 cbRES3: 0x0

Mode 6 or 8 does not work. Illumination has been set, but does not react to input-activity (still on).

Turning illumination by --set-level does not work:

$ sudo smbios-keyboard-ctl --set-level 0

Old Keyboard illumination level is: 0

New level parameter set Successfully

Keyboard still keeps illuminate and --set-level 1 returns this error:

$ sudo smbios-keyboard-ctl --set-level 1

 Value out of range, range is 0-0

All attemps of setting illumination by graphical power management tools in KDE Plasma ends with illumination ON on 100%.

superm1 commented 7 years ago

Setting specific level is actually deprecated, I think the code will still need to be updated to double check the valid range to tell if it will work (on your platform it wouldn't).

Can you show me the output of smbios-keyboard-ctl -g -v? I'll see if something else is standing out missing.

milanzelenka commented 7 years ago
$ sudo smbios-keyboard-ctl -g -v
Helper function to print current status of keyboard illumination

 Current status of KeyBoard Illumination setting on your system: 
-------------------------------------------------------------------
Get Keyboard Illumination Configuration: res[smi.cbRES1]=0x-2,res[smi.cbRES2]=0x0,res[smi.cbRES3]=0x0
 Info: Unable to fetch Keyboard Illumination Configuration information: Feature Not supported on this system

Get Keyboard illumination Current State: res[smi.cbRES1]=0x0,res[smi.cbRES2]=0xA030100,res[smi.cbRES3]=0xA000000

 Configured mode state: 
         Auto: Input-activity-based On (illumination level 100%); input-activity based Off

 Your Keyboard will illumination on: 
        Any Keystroke
        Touchpad activity

 Keyboard illumination timeout on battery has been set at: 10  Seconds
 Note - Timeout value of 0 means its always ON 

 Keyboard illumination timeout on AC has been set at: 10  Seconds
 Note - Timeout value of 0 means its always ON 

 Current setting of ALS value that turns the light on or off: 0
 Current ALS Reading : 0
 Current keyboard light level : 0
superm1 commented 7 years ago

KDE's plasma power tools will be using the interface to dell-laptop, not the smbios-keyboard-ctl IIRC.

Can you please unload the dell-laptopkernel module while testing smbios-keyboard-ctl? I think we need everything working properly in smbios-keyboard-ctl and then can sort out the proper patches todell-laptopafter.

milanzelenka commented 7 years ago

dell_laptop removed, but behaviour of smbios-keyboard-ctl still the same:

 bs@seraph:~$ sudo rmmod dell_laptop 
 bs@seraph:~$ sudo smbios-keyboard-ctl --set-mode
 Setting USER Selectable Keyboard Mode

  Supported USER Selectable Modes: 
         Option  Mode
 ------------------------------------------------
         0       Always OFF
         1       Always ON
         6       Auto: Input-activity-based On (illumination level 50%); input-activity based Off
         8       Auto: Input-activity-based On (illumination level 100%); input-activity based Off

  Note: some modes might need the keyboard set at specific illumination levels

 Select Mode: 0

 New mode parameter set Successfully

 bs@seraph:~$ sudo smbios-keyboard-ctl --set-mode
 Setting USER Selectable Keyboard Mode

  Supported USER Selectable Modes: 
         Option  Mode
 ------------------------------------------------
         0       Always OFF
         1       Always ON
         6       Auto: Input-activity-based On (illumination level 50%); input-activity based Off
         8       Auto: Input-activity-based On (illumination level 100%); input-activity based Off

  Note: some modes might need the keyboard set at specific illumination levels

 Select Mode: 1
           Set Trigger Failed. Failed to write config
          Error Return Code : cbRES1: 0x-2 cbRES2: 0xA000000 cbRES3: 0x0 
 bs@seraph:~$ sudo smbios-keyboard-ctl --set-mode
 Setting USER Selectable Keyboard Mode

  Supported USER Selectable Modes: 
         Option  Mode
 ------------------------------------------------
         0       Always OFF
         1       Always ON
         6       Auto: Input-activity-based On (illumination level 50%); input-activity based Off
         8       Auto: Input-activity-based On (illumination level 100%); input-activity based Off

  Note: some modes might need the keyboard set at specific illumination levels

 Select Mode: 6

 New mode parameter set Successfully
superm1 commented 7 years ago

@milanzelenka The "Always on" mode shouldn't be offered, there is a mistake in that it's being offered. I've adjusted my pull request to mask out the always on mode. The fixes I put in place do fix the other two modes.

dell-laptop will still need to be fixed, but @pali will need to make some architectural changes to the approach the dell-laptop kernel module takes considering this.

pali commented 7 years ago

Why is then "Always on" mode offered by smbios? Firmware bug? Anyway "Always on" is already ignored by dell-laptop.ko as it cause problems also for older machines...

superm1 commented 7 years ago

@pali I'm still in discussion about it because it's against what our spec says. Please continue to ignore the bit. If I have something to share contrary to that I'll let you know.

petr-nehez commented 7 years ago

Could I ask in which version we can expect this fix to be published?

superm1 commented 7 years ago

@petr-nehez it will be in the next version of libsmbios. I'm unsure of how much else @prabhakarpujeri has planned before the next release however.

FYI To this thread, a kernel patch reflecting the same change is available here: https://patchwork.kernel.org/patch/9695271/

If you are affected by this problem it would be great if you could provide feedback to that patch on LKML.

petr-nehez commented 7 years ago

Thanks for info but I am not so big expert to try the mentioned patch. I will have to wait for a new version of libsmbios.

petr-nehez commented 7 years ago

Any news about a new version of libsmbios? I have tried to build .deb files but I have not succeeded - see #20.

pali commented 7 years ago

@superm1 And any news what is with "Always on"?

superm1 commented 7 years ago

@petr-nehez @prabhakarpujeri will have to comment on plans for future releases. We can track deb file building problems in your other issue.

@pali I confirmed with internal team, it is intended behavior with current Dell platforms. Please continue to ignore this bit.