From owner-freebsd-acpi@FreeBSD.ORG Wed Mar 13 14:40:41 2013 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 759FE3FA; Wed, 13 Mar 2013 14:40:41 +0000 (UTC) (envelope-from hiren.panchasara@gmail.com) Received: from mail-ea0-x22b.google.com (mail-ea0-x22b.google.com [IPv6:2a00:1450:4013:c01::22b]) by mx1.freebsd.org (Postfix) with ESMTP id DC51EABD; Wed, 13 Mar 2013 14:40:40 +0000 (UTC) Received: by mail-ea0-f171.google.com with SMTP id b15so479886eae.16 for ; Wed, 13 Mar 2013 07:40:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=rdpRLM6cR3loyIRcUEw4m/HadCbo6afHSda86vx2JY8=; b=fXh2S7DzOGr0YVVJP3KO+syFAQKGMRhiM3z2XfQGjKugAc6WZFh/22qNNMTn88PTRt 7AaVs7Fwd+sN+6dqj4EG5afVx2SMgm13MEzuxJ/hMSW2AiChes46rfDIXi5lzV34856a 8hgpAS+5LnKadtT5t8nFYbV1UhjaU+vXyOa6h//yJ71BPIbdSMkKCpr6L4vFa5/NpKvZ ip965zspMxTvmCVyFDKhvLsGjZLoIH8bR06acI6ARwYBKldPLRX4NFmkWSx+bh+aiyr6 lSUoLu5Wt7GVUbipNDDowRm9qS8W6XxRIHUNTqXDAtVHQW6yf7+oLLW+LWr9D31zBwBj hUYw== MIME-Version: 1.0 X-Received: by 10.14.219.129 with SMTP id m1mr11196612eep.16.1363185639200; Wed, 13 Mar 2013 07:40:39 -0700 (PDT) Received: by 10.14.133.204 with HTTP; Wed, 13 Mar 2013 07:40:39 -0700 (PDT) In-Reply-To: References: <1363125437.79135.2.camel@localhost> <1363130522.79135.8.camel@localhost> Date: Wed, 13 Mar 2013 07:40:39 -0700 Message-ID: Subject: Re: thinkpad keys T520 From: hiren panchasara To: Sean Bruno Content-Type: text/plain; charset=UTF-8 Cc: Kevin Oberman , freebsd-acpi@freebsd.org X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Mar 2013 14:40:41 -0000 On Tue, Mar 12, 2013 at 7:38 PM, hiren panchasara wrote: > On Tue, Mar 12, 2013 at 4:22 PM, Sean Bruno wrote: >> On Tue, 2013-03-12 at 15:56 -0700, Kevin Oberman wrote: >>> On Tue, Mar 12, 2013 at 2:57 PM, Sean Bruno >>> 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 >>