From owner-freebsd-acpi@FreeBSD.ORG Mon Feb 11 21:30:11 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 448D416A41B for ; Mon, 11 Feb 2008 21:30:11 +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 F2ECD13C4D9 for ; Mon, 11 Feb 2008 21:30:10 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from localhost (localhost [127.0.0.1]) by falcon.cybervisiontech.com (Postfix) with ESMTP id 07B1243E2FE for ; Mon, 11 Feb 2008 23:30:10 +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 10027) with ESMTP id f-Ychh6JAICm for ; Mon, 11 Feb 2008 23:30:09 +0200 (EET) Received: from [10.74.70.239] (unknown [193.138.145.53]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by falcon.cybervisiontech.com (Postfix) with ESMTP id 7C0DF43E207 for ; Mon, 11 Feb 2008 23:30:09 +0200 (EET) Message-ID: <47B0BE5E.1070108@icyb.net.ua> Date: Mon, 11 Feb 2008 23:30:06 +0200 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.9 (X11/20071208) MIME-Version: 1.0 To: freebsd-acpi@freebsd.org References: <47A3451E.5060803@icyb.net.ua> In-Reply-To: <47A3451E.5060803@icyb.net.ua> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: 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: Mon, 11 Feb 2008 21:30:11 -0000 on 01/02/2008 18:13 Andriy Gapon said the following: > I noticed that I can force AC state change via sysctl if current state > is none/-1. Typo above, it should read "I can not". > 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. Small extra note: this is because the "none" state (least/zero cooling activity) has code -1, while other states are arranged so that the lower the number the higher cooling activity is. So there is an exclusion from normal integer comparison. > 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 ? > Should I file a PR ? Does anybody care ? I think that this is a possible situation to want this in real life. -- Andriy Gapon