Date: Sun, 29 Oct 2000 14:14:35 -0800 (PST) From: nsayer@quack.kfu.com To: FreeBSD-gnats-submit@freebsd.org Subject: ports/22400: klaptopdaemon is useless Message-ID: <200010292214.e9TMEZc12697@icarus.kfu.com>
next in thread | raw e-mail | index | archive | help
>Number: 22400 >Category: ports >Synopsis: klaptopdaemon is useless >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Oct 29 14:20:00 PST 2000 >Closed-Date: >Last-Modified: >Originator: Nick Sayer >Release: FreeBSD 4.1.1-RELEASE i386 >Organization: Just me >Environment: misc/kdeutils2 port >Description: The code to poll the apm subsystem for battery status appears to be embryonic. It always returns 'on battery, 100%, 0 time remaining'. >How-To-Repeat: >Fix: Add this as a patch to the port, then feed it back to the vendor. --- klaptopdaemon/portable.cpp.orig Wed Sep 6 01:26:14 2000 +++ klaptopdaemon/portable.cpp Sun Oct 29 14:08:35 2000 @@ -547,7 +547,27 @@ struct power_result laptop_portable::poll_battery_state() { struct power_result p; - p.powered = 0; + int ret; + + int fd = ::open(APMDEV, O_RDWR); + + if (fd == -1) + goto bad; + + struct apm_info info; + ret=ioctl(fd, APMIO_GETINFO, &info); + ::close(fd); + + if (ret == -1) + goto bad; + + p.powered = info.ai_acline; + p.percentage = info.ai_batt_life; + p.time = info.ai_batt_time; + return(p); + +bad: + p.powered = 1; p.percentage = 100; p.time = 0; return(p); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200010292214.e9TMEZc12697>