Bug 59671

Summary: Packard Bell EasyNote: Backlight keys don't work correctly out-the-box
Product: ACPI Reporter: analca3
Component: Power-VideoAssignee: Aaron Lu (aaron.lu)
Status: CLOSED DOCUMENTED    
Severity: low CC: aaron.lu, analca3, tianyu.lan
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.9.5-1 Subsystem:
Regression: No Bisected commit-id:
Attachments: An acpi dump from my laptop using acpidump.
A dmidecode from my laptop
Add debug statement in _Q11/_Q12

Description analca3 2013-06-13 17:12:18 UTC
Hello. I have noticed for a long ago this bug, and I have "solved" it with Archlinux forums help. I don't understand a lot of things of the Linux Kernel, but I try to explain.

I have a Packard Bell EasyNote TS with nVidia Optimus. Out-the-box backlight keys work correctly, but I can't set brightness with this nor xbacklight. If I add to the kernel line "acpi_backlight=vendor", I can set brightness with xbacklight, but backlight keys don't work. In that forum an user recommends me add acpi_osi="!Windows 2006" acpi_osi="!Windows 2009" to the kernel line and it solved my problem, but this user think is a bug (I think this too, in a too old kernel version it works correctly with acpi_backlight=vendor line).

I attach an acpidump and show you the topic.

https://bbs.archlinux.org/viewtopic.php?id=164662

Sorry for my English :).

Regards.
Comment 1 analca3 2013-06-13 17:13:40 UTC
Created attachment 104651 [details]
An acpi dump from my laptop using acpidump.
Comment 2 Lan Tianyu 2013-06-14 02:41:03 UTC
Please provide the output of dmidecode and it's better to do a quirk for this machine to use vendor video driver defaultly.
Comment 3 analca3 2013-06-14 11:49:18 UTC
Created attachment 104721 [details]
A dmidecode from my laptop
Comment 4 analca3 2013-06-14 11:50:43 UTC
Hello Lan Tianyu, I have uploaded an dmidecode. I hope that helps.

Regards.
Comment 5 analca3 2013-06-14 12:01:22 UTC
Oh, I realized KDE/xbacklight can't set brightness... I prefer doing it by keys, but I share all I can =).

Regards.
Comment 6 Aaron Lu 2013-06-17 05:50:16 UTC
1 Please show me the output of:
$ ls /sys/class/backlight

I saw your post of the arch page, do you have only one file intel_backlight there?

2 Please use acpi_listen to check if any event is received when pressing the backlight hotkey. acpi_listen is provided by acpid package.

Thanks.
Comment 7 analca3 2013-06-17 08:48:13 UTC
1.- This is the output:

acpi_video0  intel_backlight

Yes, I have only one file intel_backlight.

2.- No... I can see CDPLAY, CDSTOP, CDNEXT events, but no anything when I press backlight hotkeys.

Thank you =).

Regards.
Comment 8 Aaron Lu 2013-06-17 08:56:17 UTC
(In reply to comment #7)
> 1.- This is the output:
> 
> acpi_video0  intel_backlight

I think this is two :-)

Does manually change brightness using acpi_video0 work?
# cd /sys/class/backlight/acpi_video0
# echo 2 > brightness
# echo 5 > brightness
Any effect?

> 
> Yes, I have only one file intel_backlight.
> 
> 2.- No... I can see CDPLAY, CDSTOP, CDNEXT events, but no anything when I
> press
> backlight hotkeys.

This means we have a bug in hotkey notification, I'll prepare a debug asl file for you to test a moment later.
Comment 9 Aaron Lu 2013-06-17 09:00:11 UTC
Can you build kernel from source?
Comment 10 analca3 2013-06-17 09:56:47 UTC
(In reply to comment #8)
 
> I think this is two :-)
> 
> Does manually change brightness using acpi_video0 work?
> # cd /sys/class/backlight/acpi_video0
> # echo 2 > brightness
> # echo 5 > brightness
> Any effect?

No, it has no effect :(. If I not use acpi_osi lines in kernel line in GRUB2, I can change brightness with this method, but in intel_backlight/brightness file.


> This means we have a bug in hotkey notification, I'll prepare a debug asl
> file
> for you to test a moment later.

Ok, I am ready to help :). But I need you explain me how to do this :).

(In reply to comment #9)
> Can you build kernel from source?

I should need to learn it... I think this is enough https://wiki.archlinux.org/index.php/Kernels/Compilation/Traditional . If I don't have to configure anything I think I don't have any problem :).

Regards.
Comment 11 Aaron Lu 2013-06-17 10:33:34 UTC
(In reply to comment #10)
> (In reply to comment #8)
> 
> > I think this is two :-)
> > 
> > Does manually change brightness using acpi_video0 work?
> > # cd /sys/class/backlight/acpi_video0
> > # echo 2 > brightness
> > # echo 5 > brightness
> > Any effect?
> 
> No, it has no effect :(. If I not use acpi_osi lines in kernel line in GRUB2,
> I
> can change brightness with this method, but in intel_backlight/brightness
> file.

So only intel_backlight works, right?

> 
> I should need to learn it... I think this is enough
> https://wiki.archlinux.org/index.php/Kernels/Compilation/Traditional . If I
> don't have to configure anything I think I don't have any problem :).

Just remembered no need to compile kernel at this time, override DSDT in initrd should do the trick too. I'll attach a DSDT table named dsdt.aml, please follow the below steps to replace your initrd:
// make a copy of your original initrd, after test, restore it
$ sudo cp /boot/initramfs-xxx.img /boot/initram-xxx.img.orig
// insert the new DSDT table into a new initrd
$ mkdir $HOME/initrd/kernel/firmware/acpi
$ cd $HOME/initrd
// the dsdt.aml is the new DSDT table I'll attach shortly
$ cp dsdt.aml kernel/firmware/acpi
// generate the new initrd
$ find kernel |cpio -H newc --create > new_initrd
// cat it with the original one
$ cat /boot/initramfs-xxx.img >> new_initrd
Now the new initrd is ready, use it to boot the system. Also, make sure to add the following kernel command line, no other command line option required:
acpi.aml_debug_output=1

After boot, press backlight hotkey, and then attach dmesg output here, thanks.
If you have any problem, please let me know.
Comment 12 Aaron Lu 2013-06-17 10:34:48 UTC
Created attachment 104921 [details]
Add debug statement in _Q11/_Q12

Add some debug statements in DSDT table to check some value in asl code.
Comment 13 analca3 2013-06-17 12:28:58 UTC
Yes, only intel_backlight works. I have removed all acpi lines in GRUB (only stays the debug one). Intel_backlight method still works, but xbacklight can't set brightness. Dsmeg:

[  115.698208] [ACPI Debug]  String [0x0B] "_Q11, LMST="
[  115.698234] [ACPI Debug]  Integer 0x00000000
[  115.698247] [ACPI Debug]  String [0x0B] "_Q11, OSYS="
[  115.698256] [ACPI Debug]  Integer 0x000007D9
[  115.698268] [ACPI Debug]  String [0x0A] "_Q11, OBV="
[  115.698274] [ACPI Debug]  Integer 0x00000086
[  122.476867] [ACPI Debug]  String [0x0B] "_Q12, LMST="
[  122.476897] [ACPI Debug]  Integer 0x00000000
[  122.476922] [ACPI Debug]  String [0x0A] "_Q12, OBV="
[  122.476930] [ACPI Debug]  Integer 0x00000086

115.* lines are "Brighness down" hotkey, and 122.* "Brightness up" hotkey.

I remember: without acpi lines in GRUB, xev recognize the keys, but OSD brightness only works if I push "alternate-ly" "Brightness down" and "Brightness up" keys. I don't understand, really XD.

Thanks for helping :).

Regards.
Comment 14 Aaron Lu 2013-06-17 14:56:49 UTC
According to the debug message, the notification is sent out.

Please add the following content to /etc/X11/xorg.conf(if not exist, just create it):

Section "Device"
Identifier  "Intel Graphics"
Driver      "intel"
Option      "AccelMethod"  "sna"
Option     "Backlight"          "intel_backlight"
Identifier  "Card0"
Driver      "intel"
BusID       "PCI:0:2:0"
EndSection

Then reboot, this time, no kernel command line is required. Let me know if everything works fine, thanks.
Comment 15 analca3 2013-06-17 16:46:32 UTC
It's ok now, but I had to remove

Identifier  "Card0"
Driver      "intel"
BusID       "PCI:0:2:0"

because Xorg told me a parse error: 2 fields identifier. 

So is it no a bug? Is it only an error? In my old installation I have no Xorg.conf for my intel card... It doesn't disturb me but I have to ask it =).

All is OK now. I'm sorry for disturb, guys. I'll save this Xorg safely :).
Comment 16 Aaron Lu 2013-06-17 23:58:13 UTC
No problem.

The problem is, userspace(X for example) would pick acpi_video0 interface by default, which is broken on your system. So we have to tell X to use an workable interface, as is done in xorg.conf. Then for backlight brightness change, you have intel_backlight for it; for hotkey notification, you have ACPI for that. This is the current way we workaround backlight problems, maybe we need a better one in the future...

Thanks for testing! I'll close the bug as DOCUMENTED.