From owner-freebsd-acpi@FreeBSD.ORG Sun Feb 12 03:03:06 2006 Return-Path: X-Original-To: freebsd-acpi@freebsd.org Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5A29316A420 for ; Sun, 12 Feb 2006 03:03:06 +0000 (GMT) (envelope-from nike_d@cytexbg.com) Received: from mail.interbgc.com (mx01.interbgc.com [217.9.224.225]) by mx1.FreeBSD.org (Postfix) with SMTP id 6507743D45 for ; Sun, 12 Feb 2006 03:03:04 +0000 (GMT) (envelope-from nike_d@cytexbg.com) Received: (qmail 90961 invoked from network); 12 Feb 2006 03:03:02 -0000 Received: from nike_d@cytexbg.com by keeper.interbgc.com by uid 1002 with qmail-scanner-1.14 (uvscan: v4.2.40/v4374. spamassassin: 2.63. Clear:SA:0(0.1/8.0):. Processed in 3.22512 secs); 12 Feb 2006 03:03:02 -0000 X-Spam-Status: No, hits=0.1 required=8.0 Received: from niked.ddns.cablebg.net (HELO tormentor.totalterror.net) (85.130.14.211) by mx01.interbgc.com with SMTP; 12 Feb 2006 03:02:59 -0000 Received: (qmail 98714 invoked from network); 12 Feb 2006 03:02:57 -0000 Received: from unknown (HELO ?10.0.0.12?) (ndenev@10.0.0.12) by tormentor.totalterror.net with (DHE-RSA-AES256-SHA encrypted) SMTP; 12 Feb 2006 03:02:57 -0000 Message-ID: <43EEA588.3080802@cytexbg.com> Date: Sun, 12 Feb 2006 05:03:36 +0200 From: Niki Denev User-Agent: Thunderbird 1.5 (X11/20060210) MIME-Version: 1.0 To: freebsd-acpi@freebsd.org Content-Type: multipart/mixed; boundary="------------080708020302030200060506" Subject: [PATCH] debug sysctl for acpi_ibm hiding the event printfs X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Feb 2006 03:03:06 -0000 This is a multi-part message in MIME format. --------------080708020302030200060506 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hello, For some time i started using my IBM TP X31 with the following sysctl enabled : dev.acpi_ibm.0.events=1 and the following lines in devd.conf : notify 10 { match "system" "ACPI"; match "subsystem" "IBM"; match "notify" "0x05"; action "/usr/local/sbin/wlan_toggle.sh"; }; With this stuff i am able to use the wireless/radio (Fn-F5) button on my laptop to enable/disable the wireless interface with the help of a simple shell script. But as annoying side effect of dev.acpi_ibm.0.events enabled now i get printfs with the event codes each time i press a special combination. So i decided to hide the printfs in acpi_ibm behind a debug sysctl, in my case : dev.acpi_ibm.0.debug The patch is attached. (it is for -CURRENT) P.S.: As another side effect of dev.acpi_ibm.0.events enabled i can no longer use the suspend (Fn-F4) and display output (Fn-F7) keys because now they generate events to devd. This seems a little strange because the brightness and think light combinations continue to work and do not generate events. --niki --------------080708020302030200060506 Content-Type: text/plain; name="acpi_ibm-debug-sysctl.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="acpi_ibm-debug-sysctl.patch" --- acpi_ibm.c.orig Wed Feb 8 23:48:20 2006 +++ acpi_ibm.c Sun Feb 12 04:41:43 2006 @@ -67,6 +67,7 @@ #define ACPI_IBM_METHOD_FANLEVEL 11 #define ACPI_IBM_METHOD_FANSTATUS 12 #define ACPI_IBM_METHOD_THERMAL 13 +#define ACPI_IBM_METHOD_DEBUG 14 /* Hotkeys/Buttons */ #define IBM_RTC_HOTKEY1 0x64 @@ -172,6 +173,12 @@ int access; } acpi_ibm_sysctls[] = { { + .name = "debug", + .method = ACPI_IBM_METHOD_DEBUG, + .description = "Show debug messages", + .access = CTLTYPE_INT | CTLFLAG_RW + }, + { .name = "events", .method = ACPI_IBM_METHOD_EVENTS, .description = "ACPI events enable", @@ -249,6 +256,8 @@ ACPI_SERIAL_DECL(ibm, "ACPI IBM extras"); +static int acpi_ibm_debug = 0; + static int acpi_ibm_probe(device_t dev); static int acpi_ibm_attach(device_t dev); static int acpi_ibm_detach(device_t dev); @@ -508,6 +517,9 @@ ACPI_SERIAL_ASSERT(ibm); switch (method) { + case ACPI_IBM_METHOD_DEBUG: + val = acpi_ibm_debug; + break; case ACPI_IBM_METHOD_EVENTS: acpi_GetInteger(sc->handle, IBM_NAME_EVENTS_STATUS_GET, &val); break; @@ -641,6 +653,11 @@ ACPI_SERIAL_ASSERT(ibm); switch (method) { + case ACPI_IBM_METHOD_DEBUG: + if (arg < 0 || arg > 1) + return (EINVAL); + acpi_ibm_debug = arg; + break; case ACPI_IBM_METHOD_EVENTS: if (arg < 0 || arg > 1) return (EINVAL); @@ -795,6 +812,7 @@ ACPI_HANDLE ledb_handle; switch (method) { + case ACPI_IBM_METHOD_DEBUG: case ACPI_IBM_METHOD_EVENTS: /* Events are disabled by default */ return (TRUE); @@ -919,9 +937,11 @@ ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, notify); - printf("IBM:NOTIFY:%x\n", notify); - if (notify != 0x80) - printf("Unknown notify\n"); + if (acpi_ibm_debug) { + printf("IBM:NOTIFY:%x\n", notify); + if (notify != 0x80) + printf("Unknown notify\n"); + } for (;;) { acpi_GetInteger(acpi_get_handle(dev), IBM_NAME_EVENTS_GET, &event); @@ -929,14 +949,16 @@ if (event == 0) break; - printf("notify:%x\n", event); + if (acpi_ibm_debug) + printf("notify:%x\n", event); type = (event >> 12) & 0xf; arg = event & 0xfff; switch (type) { case 1: if (!(sc->events_availmask & (1 << (arg - 1)))) { - printf("Unknown key %d\n", arg); + if (acpi_ibm_debug) + printf("Unknown key %d\n", arg); break; } --------------080708020302030200060506--