Date: Tue, 12 Feb 2008 00:28:57 -0800 From: Nate Lawson <nate@root.org> To: Andriy Gapon <avg@icyb.net.ua> Cc: freebsd-acpi@freebsd.org Subject: Re: no way to force AC state if current one is none Message-ID: <47B158C9.1030007@root.org> In-Reply-To: <47B0BE5E.1070108@icyb.net.ua> References: <47A3451E.5060803@icyb.net.ua> <47B0BE5E.1070108@icyb.net.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
Andriy Gapon wrote: > 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. Don't file a PR, I'll review what you sent. Thanks for both bug fixes/hunting. -- Nate
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47B158C9.1030007>