From owner-freebsd-acpi@FreeBSD.ORG Fri Feb 1 16:13:20 2008 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EBF4016A418 for ; Fri, 1 Feb 2008 16:13:20 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from falcon.cybervisiontech.com (falcon.cybervisiontech.com [217.20.163.9]) by mx1.freebsd.org (Postfix) with ESMTP id A417B13C4D5 for ; Fri, 1 Feb 2008 16:13:20 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from localhost (localhost [127.0.0.1]) by falcon.cybervisiontech.com (Postfix) with ESMTP id 4A18643E75F for ; Fri, 1 Feb 2008 18:13:19 +0200 (EET) X-Virus-Scanned: Debian amavisd-new at falcon.cybervisiontech.com Received: from falcon.cybervisiontech.com ([127.0.0.1]) by localhost (falcon.cybervisiontech.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id y+sLCWyrA13q for ; Fri, 1 Feb 2008 18:13:19 +0200 (EET) Received: from [10.2.1.87] (gateway.cybervisiontech.com.ua [88.81.251.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by falcon.cybervisiontech.com (Postfix) with ESMTP id 0273C43E74B for ; Fri, 1 Feb 2008 18:13:18 +0200 (EET) Message-ID: <47A3451E.5060803@icyb.net.ua> Date: Fri, 01 Feb 2008 18:13:18 +0200 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.9 (X11/20080123) MIME-Version: 1.0 To: freebsd-acpi@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: no way to force AC state if current one is none 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: Fri, 01 Feb 2008 16:13:21 -0000 I noticed that I can force AC state change via sysctl if current state is none/-1. acpi_tz_monitor() has the following lines: /* Handle user override of active mode */ if (sc->tz_requested != TZ_ACTIVE_NONE && sc->tz_requested < newactive) newactive = sc->tz_requested; If say tz_requested is 1, but auto-calculated newactive is -1 (none), then this check fails and tz_requested is ignored. It seems there should be a check that newactive is not -1: if (sc->tz_requested != TZ_ACTIVE_NONE && (newactive == TZ_ACTIVE_NONE || sc->tz_requested < newactive)) What do you think ? -- Andriy Gapon