Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Mar 2013 07:40:39 -0700
From:      hiren panchasara <hiren.panchasara@gmail.com>
To:        Sean Bruno <seanwbruno@gmail.com>
Cc:        Kevin Oberman <rkoberman@gmail.com>, freebsd-acpi@freebsd.org
Subject:   Re: thinkpad keys T520
Message-ID:  <CALCpEUFrZh8KfjF3S2hiFFOimPNZKLOOrHughD3xLyo9Fz5ZZQ@mail.gmail.com>
In-Reply-To: <CALCpEUEjKpSMDiO0XWKyVPW9C1JraDiG_DQc8-4HrrkMg6j%2BXw@mail.gmail.com>
References:  <1363125437.79135.2.camel@localhost> <CAN6yY1ugU6Mf0O2ZNHWssOHo8UcmSxCDxB6FJMdi1xYb7t6Qog@mail.gmail.com> <1363130522.79135.8.camel@localhost> <CALCpEUEjKpSMDiO0XWKyVPW9C1JraDiG_DQc8-4HrrkMg6j%2BXw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Mar 12, 2013 at 7:38 PM, hiren panchasara
<hiren.panchasara@gmail.com> wrote:
> On Tue, Mar 12, 2013 at 4:22 PM, Sean Bruno <seanwbruno@gmail.com> wrote:
>> On Tue, 2013-03-12 at 15:56 -0700, Kevin Oberman wrote:
>>> On Tue, Mar 12, 2013 at 2:57 PM, Sean Bruno <seanbru@yahoo-inc.com>
>>> wrote:
>>>         the Fn key seems to send the system the same key command as
>>>         the power
>>>         button *should* send.  This leads to many problems on this
>>>         machine.
>>>
>>>         How can I start tracing code the key strokes for keys that are
>>>         not the
>>>         normal keyboard keys?  e.g. the Fn key or vol up/down and the
>>>         power
>>>         button?
>>>
>>>         If I load acpi_ibm(4), it doesn't seem to ever get used so I
>>>         am confused
>>>         as to where to start.
>
> As Sean pointed out, we are on this mysterious journey to find out
> what happens when buttons are pressed.
> I am playing with my T420 to understand how physical button press
> event is sent down to acpi_ibm via devd.
> I've started putting "device_printf" inside acpi_ibm to see if
> individual functions are getting called or not.
> I was not seeing anything in dmesg until I set following:
>
> sysctl dev.acpi_ibm.0.events=1

It seems, I also need to do:
sysctl dev.acpi_ibm.0.handlerevents='0x01 0x02 0x03.....whatever I need'.
I am setting all the things from 0x01 to 0x17 as acpi_ibm(4) manpage
says although I do not know exact mapping for T420 that I am using.

I am poking in acpi_ibm_eventhandler() to see what events its getting
when I press different keys.

Interesting part is that it is generating and catching brightness
increase/decrease and thinklight events but volume increase/decrease
and mute button is not even generating any events. Are those being
intercepted by something else? probably sound drivers?

Also, all the interesting bits on my T420 looks like this:

$ sysctl dev.acpi_ibm.0
dev.acpi_ibm.0.%desc: IBM ThinkPad ACPI Extras
dev.acpi_ibm.0.%driver: acpi_ibm
dev.acpi_ibm.0.%location: handle=\_SB_.PCI0.LPC_.EC__.HKEY
dev.acpi_ibm.0.%pnpinfo: _HID=LEN0068 _UID=0
dev.acpi_ibm.0.%parent: acpi0
dev.acpi_ibm.0.initialmask: 2060
dev.acpi_ibm.0.availmask: 134217727
dev.acpi_ibm.0.events: 1
dev.acpi_ibm.0.eventmask: 134217727
dev.acpi_ibm.0.hotkey: 1331
dev.acpi_ibm.0.lcd_brightness: 7
dev.acpi_ibm.0.volume: 10
dev.acpi_ibm.0.mute: 0
dev.acpi_ibm.0.thinklight: 0
dev.acpi_ibm.0.bluetooth: 0
dev.acpi_ibm.0.wlan: 1
dev.acpi_ibm.0.fan_speed: 65535
dev.acpi_ibm.0.fan_level: 0
dev.acpi_ibm.0.fan: 1
dev.acpi_ibm.0.handlerevents: 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08
0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x13 0x15 0x16 0x17

I am unclear in the sense that how all different components like devd,
acpi_ibm and sound drivers work together.

Puzzling journey continues :-)

cheers,
Hiren

>
> From the manpage, it seems, this tunable enables ACPI events and set
> the eventmask to availmask.
>
> where eventmask is how things are laid out specific to your hardware
> and availmask is what all you want to intercept by acpi_ibm.
>
> Is this a correct assumption or I am completely off the track here?
>
> Also, I am trying to find out pin layout for T420 and T520 as
> acpi_ibm(4) lists for T41p. If someone can help me find it, that will
> be awesome.
>
> Thanks in advance,
> Hiren
>
>>>
>>> Sean,
>>>
>>> I'm confused. I also have a T520, but the Fn key does not seem to
>>> mis-behave on it at all. I have not gotten brightness adjustment to
>>> work correctly to this point, but Fn has never triggered a power
>>> operation for me. Your statement about acpi_ibm(4) is also baffling as
>>> I have no problems with it with 9.1-Stable or head. It was broken in
>>> some earlier versions before the Lenovo ID was added.
>>>
>>> Does your ThinkLight turn on and off if you set
>>> dev.acpi_ibm.0.thinklight? When you press Fn+PgUp? Both work on my
>>> T520.
>>>
>>> Perhaps I am not completely understanding the issue.
>>>
>>> --
>>> R. Kevin Oberman, Network Engineer
>>> E-mail: rkoberman@gmail.com
>>
>>
>> On my T520, I do not need acpi_ibm(4) for the thinklight to function.
>> It works with/without the module loaded.
>>
>> Hiren and I found adding this to the driver section of xorg.conf allows
>> the fn-brightness keys to work:
>> Option         "RegistryDwords" "EnableBrightnessControl=1"
>>
>> The audio "mute" button actually seems to be working through the sound
>> driver.
>>
>> The fn key seems to generate an unhandled APIC0 event, that is processed
>> somewhere as a shutdown event.  I'm using XFCE4 as my desktop and all
>> the parts that come with it.
>>
>> Sean
>>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CALCpEUFrZh8KfjF3S2hiFFOimPNZKLOOrHughD3xLyo9Fz5ZZQ>