From owner-freebsd-mobile@FreeBSD.ORG Wed Apr 18 05:05:22 2007 Return-Path: X-Original-To: mobile@freebsd.org Delivered-To: freebsd-mobile@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 82E1A16A402 for ; Wed, 18 Apr 2007 05:05:22 +0000 (UTC) (envelope-from nate@root.org) Received: from root.org (root.org [67.118.192.226]) by mx1.freebsd.org (Postfix) with ESMTP id 6B1DF13C45A for ; Wed, 18 Apr 2007 05:05:22 +0000 (UTC) (envelope-from nate@root.org) Received: (qmail 10075 invoked from network); 18 Apr 2007 05:05:24 -0000 Received: from ppp-71-139-34-102.dsl.snfc21.pacbell.net (HELO ?10.0.0.235?) (nate-mail@71.139.34.102) by root.org with ESMTPA; 18 Apr 2007 05:05:24 -0000 Message-ID: <4625A70C.1000506@root.org> Date: Tue, 17 Apr 2007 22:05:16 -0700 From: Nate Lawson User-Agent: Thunderbird 1.5.0.7 (X11/20061027) MIME-Version: 1.0 To: Rong-en Fan References: <6eb82e0704171645n5f7b2ca6h41b41016cdafad24@mail.gmail.com> <4625601C.9000201@root.org> <6eb82e0704172055l5bddca81t5b7e9e45a297a839@mail.gmail.com> In-Reply-To: <6eb82e0704172055l5bddca81t5b7e9e45a297a839@mail.gmail.com> X-Enigmail-Version: 0.94.1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: acpi@freebsd.org, mobile@freebsd.org Subject: Re: acpi_ibm(4): new radio kill switch (readonly) sysctl X-BeenThere: freebsd-mobile@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Mobile computing with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Apr 2007 05:05:22 -0000 Rong-en Fan wrote: > On 4/18/07, Nate Lawson wrote: >> Rong-en Fan wrote: >> > As pointed out by Henrik Brix Andersen, I adds a sysctl entry >> > that shows the status of radio kill switch found on some ThinkPad: >> > >> > http://people.freebsd.org/~rafan/acpi_ibm_killswitch.diff >> > >> > dev.acpi_ibm.0.killswitch = 0 means the switch is off. It seems that >> > no acpi event will be generated when the value changes (actually, >> > my x60 does not generate any events when I presses FN+something). >> > Otherwise, we can hook it in devd.conf and remove wireless driver when >> > kill switch is on... >> > >> > Any comments? >> >> Seems fine to me. But as to the name of the sysctl -- it should be more >> logical. How about renaming it to dev.acpi_ibm.0.radio_enable and when >> 1, the radio is enabled? Even if you have to invert the logic of the >> ACPI method, it would make more sense to users. They don't need to know >> what's going on under the hood. > > Good idea. I updated the patch: > > http://people.freebsd.org/~rafan/acpi_ibm_radio_switch.diff > > If you have ThinkPad other than X60, please help test this. This code seems suspect: + case ACPI_IBM_METHOD_RADIO_SWITCH: + acpi_GetInteger(sc->handle, IBM_NAME_RADIO_SWITCH_GET, &val); + sc->radio_switch_state = val; + val = (val != 0); + break; The switch state is set to the return value of the AML method. Then if it is 0, val is set to 0 and if it is 1, val is set to 1. Don't you mean to invert val? If so, this should be sufficient: /* Invert the radio kill switch for the user. */ sc->radio_switch_state = !val; -- Nate