From owner-freebsd-acpi@FreeBSD.ORG Fri Mar 15 08:00:55 2013 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 048D3B73; Fri, 15 Mar 2013 08:00:55 +0000 (UTC) (envelope-from hiren.panchasara@gmail.com) Received: from mail-ee0-f45.google.com (mail-ee0-f45.google.com [74.125.83.45]) by mx1.freebsd.org (Postfix) with ESMTP id 0F8F68DE; Fri, 15 Mar 2013 08:00:53 +0000 (UTC) Received: by mail-ee0-f45.google.com with SMTP id b57so1413946eek.4 for ; Fri, 15 Mar 2013 01:00:53 -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=DU8BerhEMYC968xSS+5ccxOyncQTIDxbSKFONpniv3o=; b=V0CnSeK+j/+blmKRz1PX/HLLHphtFR5YXWQ58IamIC6V5DpKwhab6Y5PbA+n1VjM3B 6vKQvJEcjirjXoYEwx8qwZ8e9RujHdropyj2Ny1UNqtcM/7ZfxD0AermV3qOORkgHHWx 8mEvRjDfDfxgW9PnKa9a4JBYb4T3mPhhBOFWnUtrmFT60+QN+D44eXK5v1NGrT84sIrk GjJFrsSJPtbRT4g/rGK5w+hSP4MM/7jLEolm45vW2vKKYkyipo5lzvw4VvAF8tYELTqX V4USjiSlq+wflc2/9zjlT1Yc04AXjfdVgMqGMHqm+tUuMAdYWaqXU2tTFrGXnrxUv2xP DrRg== MIME-Version: 1.0 X-Received: by 10.14.216.198 with SMTP id g46mr15410442eep.30.1363334452890; Fri, 15 Mar 2013 01:00:52 -0700 (PDT) Received: by 10.14.133.204 with HTTP; Fri, 15 Mar 2013 01:00:52 -0700 (PDT) In-Reply-To: References: <1363125437.79135.2.camel@localhost> <1363130522.79135.8.camel@localhost> Date: Fri, 15 Mar 2013 01:00:52 -0700 Message-ID: Subject: Re: thinkpad keys T520 From: hiren panchasara To: Sean Bruno Content-Type: text/plain; charset=UTF-8 Cc: Kevin Oberman , markus@freebsd.org, 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: Fri, 15 Mar 2013 08:00:55 -0000 On Wed, Mar 13, 2013 at 7:40 AM, hiren panchasara wrote: > 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 I've a possible stupid question here. Why do I need to explicitly set this variable when I am already loading acpi_ibm.ko ? > > It seems, I also need to do: > sysctl dev.acpi_ibm.0.handlerevents='0x01 0x02 0x03.....whatever I need'. Also, why not set catch all the possible events when acpi_ibm.ko gets loaded? I have a 2-fold question: Is acpi_ibm any useful without these 2 sysctls set? and is there any side effect of setting these sysctls by default that I am not aware of? cheers, Hiren > 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 >>>