From owner-freebsd-acpi@FreeBSD.ORG Mon Jun 16 15:39:57 2014 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 41001506; Mon, 16 Jun 2014 15:39:57 +0000 (UTC) Received: from mail-ob0-x236.google.com (mail-ob0-x236.google.com [IPv6:2607:f8b0:4003:c01::236]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ED5072DE1; Mon, 16 Jun 2014 15:39:56 +0000 (UTC) Received: by mail-ob0-f182.google.com with SMTP id nu7so6002004obb.27 for ; Mon, 16 Jun 2014 08:39:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:content-type; bh=XgsvPi/BI34L5+5dsZ/5VLAuGAeH/xoPOfEvPs02goA=; b=nQPVDh/Uob+PuPH4Y3cKiQh50sBmpF/E5sHpyyQA1EaabJzMTMcvqrNeRYba+QyMrC DxcyqrJwxcIU2+ANjYRe9HlOpB6Ug7u7cNT16zgWJcqLUZy7zBHe2QHUTc3OTpSRVG8g CYGUuvpV8wu2CophTL+hKruDjyaxBa9+kTv5TCkJbtBrvuJYvPcALX76wNjoDU3nG6dM Y2EuoY46UUeqgqm7lWZ6HVVjy554jlzqCPAn48vlm8aFYClwkG9UliFrDo33YD7ljWFX rUbeIX7d98THreT+V2Yfk7Z4sD7oHs3H+GL85x4oAqt0zcCsSym3/580Yq3pQ3GBej4U z66A== MIME-Version: 1.0 X-Received: by 10.60.56.98 with SMTP id z2mr3581166oep.62.1402933196291; Mon, 16 Jun 2014 08:39:56 -0700 (PDT) Sender: tomek.cedro@gmail.com Received: by 10.202.75.207 with HTTP; Mon, 16 Jun 2014 08:39:56 -0700 (PDT) In-Reply-To: <20140616153254.GE1187@albert.catwhisker.org> References: <20140616153254.GE1187@albert.catwhisker.org> Date: Mon, 16 Jun 2014 17:39:56 +0200 X-Google-Sender-Auth: 4J8eNZjrY6Hf0VIgztB6oag9fP8 Message-ID: Subject: Re: sysctl hw.acpi.acline From: CeDeROM To: David Wolfskill , freebsd-hackers@freebsd.org, freebsd-acpi@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jun 2014 15:39:57 -0000 On Mon, Jun 16, 2014 at 5:32 PM, David Wolfskill wrote: > On Mon, Jun 16, 2014 at 04:36:42PM +0200, CeDeROM wrote: >> ... >> How can I tell the power source on my FreeBSD (i.e. AC, Battery, UPS)? >> >> man acpi: >> ... >> hw.acpi.acline >> AC line state (1 means online, 0 means on battery power). >> .... > > From the perspective of the running system, you should not be able to > tell (merely from the state of the power supply, at least) whether power > is being supplied by UPS or "house wiring". > > You can make that distinction by querying the state of a UPS, if one is > connected (and set up to provide power to the system in question). I am porting from Linux code that use "/sys/class/power_supply/type" and can tell "Mains", "UPS", or "Battery". It would be nice if FreeBSD had something similar :-) >From ACPI manual it seems that "hw.acpi.acline" shoud do the job, but this OID is not available on desktops.. and this is not noted anywhere that "hw.acpi.acline" is only available on a laptops.. so I am not sure if my code should depend on this OID and if this is a bug? Thanks! :-) Tomek -- CeDeROM, SQ7MHZ, http://www.tomek.cedro.info