From owner-freebsd-mobile Sat Jun 13 22:28:31 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id WAA20637 for freebsd-mobile-outgoing; Sat, 13 Jun 1998 22:28:31 -0700 (PDT) (envelope-from owner-freebsd-mobile@FreeBSD.ORG) Received: from rover.village.org (rover.village.org [204.144.255.49]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id WAA20630 for ; Sat, 13 Jun 1998 22:28:28 -0700 (PDT) (envelope-from imp@village.org) Received: from harmony [10.0.0.6] by rover.village.org with esmtp (Exim 1.71 #1) id 0yl5Kx-0001Kp-00; Sat, 13 Jun 1998 23:28:15 -0600 Received: from harmony.village.org (localhost [127.0.0.1]) by harmony.village.org (8.8.8/8.8.3) with ESMTP id XAA11752 for ; Sat, 13 Jun 1998 23:28:14 -0600 (MDT) Message-Id: <199806140528.XAA11752@harmony.village.org> To: mobile@FreeBSD.ORG Subject: apm vs apmconf Date: Sat, 13 Jun 1998 23:28:14 -0600 From: Warner Losh Sender: owner-freebsd-mobile@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org OK. I'm putting some finishing touches on some APM 1.2 enhancements to FreeBSD. I have a couple of questions, so I thought I'd share what I have done so far then ask the questions. This is a little long, so please bear with me. I'm very interested in hearing what others who have looked into this problem have to think about what I've done and where I'd like to take it. First, I have added a "go into standby mode" IOCTL to the apm driver. I've also tweaked syscons to have a STBY key just like it has a SUSP key now. I've tweaked kbdconfig to grok this key. I've tweaked a couple places in the driver to issue a standby command rather than a suspend (like for a user requested standby). This is accessible to the user in apm(8) via -Z. Seemed like a good thing to me. This is in the kernel because it needs to know when we go into STANDBY mode so it can call the right suspend/resume hooks. I'm using this in conjunction with X screen savers because it turns off the display (of at least my libretto). While the libretto 50CT won't charge in this mode (more's the pitty), it does crank the power consumption way down. I've modified the APMIO_BIOS ioctl to not return EIO when an error happens. Rather, it clears the ah portion of the eax value returned on success. This isn't bad because all of the calls that return stuff in ah are APM driver only calls (that's what the APM standard calls them). You would need to check ah to see if it was non-zero to see if the ioctl succeeded. I've also implemented the APM 1.2 set/get/disable resume timer functionality in apm(8) (although I'm starting to think this might be better in apmconf(8), which is what motivated this message). apm(8) reports the time that the computer will resume from {suspend,standby} mode. For the moment, you can only specify the number of seconds from now to have the timer expire, but I plan to convert to using strptime. This is in userland using APMIO_BIOS. I've added the resume on ring indicator, but have no modem connected to my libretto to test it. It reports that this is disabled on my box. This is in userland using APMIO_BIOS. I've expanded the information that APMIO_GETINFO to include the number of batteries installed on the laptop as well as the APM capabilities that exist for this box (eg can resume from timer for standby, for suspend, etc). I've also tweaked the relevant man pages. What's left to be done before I commit: o resume timer in absolute time (strptime) format o reporting wakeup timer in the right locale format o have a way to report just the resume time o have a way to report just the resume on ring indicator status o enhance apm(4) man page o better trapping of the 1.2 only features of my enhancements. o better APM error reporting in apm(8) o GMT issue (see questions) o proof read my man page tweaks What's waiting on PnP BIOS code access: o Fine grain power control (eg display having different brightnesses, CPU having different speeds, etc). o Even more reporting on power management things that apm 1.2 supports. Nice to have, but not yet: o OEM specific function from the command line, at least to a limited extent (giving number args is easy, but giving pointers to things is much harder for anything but strings). o The ability to get notified when new capabilities happen to the system, eg docking at a docking port. Since I don't think the libretto 50CT generates these, I may not implement them for some time. Long term goal: o have the ability to write a powerd that sits and gets APM events and deals with them in the way that it sees to be most fit. This would allow for easier configuration of power management policies. This likely won't happen for quite some time. o move more of the driver into userland. Maybe have a libapm to facilitate sharing of common code between modules (apm, apmconf and the currently mythical powerd). This would also make it possible for apm(8) to be less dependent on ioctls that go into the kernel for info since it can get this information itself with the APMIO_BIOS ioctl. My question: o does configuring the APM BIOS's wakeup timer belong in apm or apmconf? o ditto with ring indicator resume o ditto with the OEM functions o the timer values that I use MUST be in RTC time. how do I tell if that is GMT or localtime, my guess is that it is one of the following sysctls: machdep.adjerntz or machdep.wall_cmos_clock? There doesn't seem to be docs for them in any of the usual places. o should I commit well tested portions of this work, or wait for all pieces to in place first? Comments in general? Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-mobile" in the body of the message