Bug 46791

Summary: asus n56v - module asus-wmi - no keyboard backligth
Product: Platform Specific/Hardware Reporter: Mirto Silvio Busico (m.busico)
Component: x86-64Assignee: platform_x86_64 (platform_x86_64)
Status: RESOLVED CODE_FIX    
Severity: normal CC: acelan, alan, ashjas, drunkenbatman, karolherbst, m.busico
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.10 Subsystem:
Regression: No Bisected commit-id:
Attachments: xev events
fn + f3 & f4
fn
echo'd command to enable backlight
test patch

Description Mirto Silvio Busico 2012-08-31 13:43:24 UTC
The only funcion keys working are those related to sound.
Th Fn-F3 and FnF4 have no effect: no keyboard backlight.
Framework:
Asus N56V notebook
Kubuntu 12.04 + kernel 3.5.0-13-generic from /ubuntu-x-swat/q-lts-backport/ ppa

What info have I to gater from the system?
Comment 1 Alan 2012-08-31 17:39:49 UTC
Good question - might be best to ask the maintainers

There is a list acpi4asus-user@lists.sourceforge.net which is the best place to start from.
Comment 2 Mirto Silvio Busico 2012-09-05 07:34:31 UTC
Well I investigated and found http://dev.iksaif.net/issues/242
There they said:
###- fn+f3 and fn+f4 (keyboard backlight) --> do not work but can be controled with echo ###"3">/sys/class/leds/asus\:\:kbd_backlight/brightness
###
###Then here asus-wmi's jobs is done, it's up to the distribution / desktop environment to ###handle key codes.

and really, in my case, the values are changed in /sys/ .... ::kbd_backlight/brightness
so the problem seems to be in another component
Comment 3 Ashish 2013-04-05 16:01:35 UTC
This bug also affects me. i have N56VJ one of the many in the N56V series notebooks.Apart from this asus zenbooks and many other asus notebooks have this bug.
Comment 4 Ashish 2013-04-05 16:03:38 UTC
just to add this bug is present in ubuntu 13.04 beta with 3.8.0-15-generic kernel.
Comment 5 Karol Herbst 2013-05-09 13:40:10 UTC
I bisect this issue and found out that commit 6cae06e603339f99334bc6b276e2ac619cf0d476 is the bad guy. After reverting this commit keyboard backlighs are working again for me.

Path downloaded here: https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/patch/?id=6cae06e603339f99334bc6b276e2ac619cf0d476
and reverted this way: patch -p1 -R < $

By the way, it worked for me with 3.6, 3.7 and 3.8 with the FN keys
Comment 6 AceLan Kao 2013-05-10 09:32:11 UTC
Hi,
It's interesting that my patch be pointed out is for wlan led, it can't affect the keyboard backlight.

Could you help me to collect more logs?
1. sudo su
2. cd /sys/kernel/debug/tracing/
3. echo :mod:asus-wmi > set_ftrace_filter
4. echo function > current_tracer
5. press the fn key
6. cp trace /tmp/trace_asus_wmi.log
7. echo nop > current_tracer

Then, repeat the steps 1 ~ 4
5. echo "3" > /sys/class/leds/asus\:\:kbd_backlight/brightness
6. cp trace /tmp/trace_asus_wmi_2.log
7. echo nop > current_tracer

Please upload the 2 logs to me, so that I can have a more clear image of what happens inside the driver, thanks.

Ashish,
Did you mean you open a bug on launchpad?
Could you give me the bug number?
Thanks.
Comment 7 Ashish 2013-05-10 10:03:43 UTC
no i havent open the bug on launchpad.

moreover i dont have access to  my notebook as of now. so i wont be able to help for a couple of months now.

Thanks.
Comment 8 drunkenbatman 2013-05-28 22:47:49 UTC
Created attachment 102751 [details]
xev events
Comment 9 drunkenbatman 2013-05-28 22:49:04 UTC
Created attachment 102761 [details]
fn + f3 & f4
Comment 10 drunkenbatman 2013-05-28 22:49:35 UTC
Created attachment 102771 [details]
fn
Comment 11 drunkenbatman 2013-05-28 22:50:02 UTC
Created attachment 102781 [details]
echo'd command to enable backlight
Comment 12 drunkenbatman 2013-05-28 22:50:49 UTC
Acelan,

It can effect the keyboard backlight by causing asus-nb-wmi to error out and not load. I had the same issue and was also able to narrow it down to your patch... eg, on an n76 (essentially the same as n56) on 3.8.10 and acpi_osi="!Windows 2012" in grub, everything works 100% (even backlight due to grub line). From 3.9 to 3.9.4, with your patch (and no acpi_osi info on grub):

[    6.923057] asus_wmi: ASUS WMI generic driver loaded
[    6.924566] asus_wmi: Initialization: 0x1
[    6.924587] asus_wmi: BIOS WMI version: 7.9
[    6.924609] asus_wmi: SFUN value: 0x6a0877
[    6.925253] input: Asus WMI hotkeys as /devices/platform/asus-nb-wmi/input/input6
[    7.022245] asus-nb-wmi: probe of asus-nb-wmi failed with error -5

If you made the mistake of not building it as a module it locks up the kernel at boot. Since asus-nb-wmi isn't loading, no keyboard backlight and it messes up bluetooth/wifi/etc. After boot, you can manually load it, but it's then a weird situation...

modprobe asus-nb-wmi
[  117.722873] asus_wmi: Initialization: 0x1
[  117.722894] asus_wmi: BIOS WMI version: 7.9
[  117.722918] asus_wmi: SFUN value: 0x6a0877
[  117.723431] input: Asus WMI hotkeys as /devices/platform/asus-nb-wmi/input/input9
[  117.796021] asus_wmi: Backlight controlled by ACPI video driver

...wifi LED locks on, wifi is wonky (vaguely shows APs but the distances are off and can't connect), though disabling wifi and bluetooth stops the wifi LED. No keyboard backlight, no screen brightness, only sound works.

Reverting your patch (6cae06e603339f99334bc6b276e2ac619cf0d476) and using acpi_osi="!Windows 2012" on 3.9.2 - 3.9.4 means everything is working.

I've attached:

1. Requested log files (for others doing this, you'll want to echo ':mod:asus_wmi' not :mod:asus-wmi, along with one doing fn+f3 and fn+4.

2. List of xev output for fn+keys on system with no acpi_osi, asus-nb-wmi manually loaded, and your patch left in.

*gives the horns*
Comment 13 AceLan Kao 2013-05-29 02:26:44 UTC
Thanks for the log,
I have some ideas and will make a patch for this soon.
Comment 14 AceLan Kao 2013-05-29 07:36:51 UTC
Created attachment 102811 [details]
test patch

Hi,
I don't have any ASUS machines on hand, so could you please help me to test if the attached patch works for you.
Thanks.
Comment 15 Karol Herbst 2013-05-29 19:28:38 UTC
It seems to work for me (I have a NV56VM)
Comment 16 drunkenbatman 2013-05-29 21:38:25 UTC
Success with the patch on gentoo-sources-3.9.4!

*gives the horns*
Comment 17 AceLan Kao 2013-05-30 02:20:18 UTC
Thank you guys, I'm going to submit the patch.
Comment 18 drunkenbatman 2013-07-01 03:55:50 UTC
*poke*

Looks like this didn't make it into any 3.9 bugfixes or 3.10?
Comment 19 AceLan Kao 2013-07-11 02:43:43 UTC
Metthew just submitted the patch for 3.11.

You can try to build a asus-wmi dkms package during the time before you have the fixed kernel.

Here are the steps do build a dkms by yourself
1. mkdir asus-wmi-1.0
2. cd asus-wmi-1.0
3. cp KERNEL_SRC_PATH/drivers/platform/x86/{asus-nb-wmi.c,asus-wmi.c,asus-wmi.h} . # make sure you have already applied the patch
4. cat > Makefile
obj-m := asus-wmi.o eeepc-wmi.o

ifeq (,$(KVER))
KERNELBUILD := /lib/modules/`uname -r`/build
else
KERNELBUILD := /lib/modules/$(KVER)/build
endif

all:
        make -C $(KERNELBUILD) M=$(shell pwd) modules
clean:
        rm -rf *.o .*.cmd *.ko *.mod.c .tmp_versions modules.order  Module.symvers
# you can hit "make" to see if the driver to be built correctly.
5. cat > dkms.conf
PACKAGE_NAME="asus-wmi"
PACKAGE_VERSION="1.0"
AUTOINSTALL="yes"
POST_INSTALL=""
POST_REMOVE=""

MAKE="make KVER=$kernelver"
CLEAN="make KVER=$kernelver clean"

BUILT_MODULE_NAME[0]="asus-wmi"
BUILT_MODULE_LOCATION[0]="./"
DEST_MODULE_LOCATION[0]="/updates/kernel/"

BUILT_MODULE_NAME[1]="asus-nb-wmi"
BUILT_MODULE_LOCATION[1]="./"
DEST_MODULE_LOCATION[1]="/updates/kernel/"
6. cd .. ; sudo cp -a asus-wmi-1.0 /usr/src
7. sudo dkms add -m asus-wmi -v 1.0
8. sudo dkms install -m asus-wmi -v 1.0
9. reboot.
Comment 20 drunkenbatman 2013-07-11 18:13:47 UTC
Appreciate the info @ 3.11, as does my list of out-of-tree patches.

*gives the horns8