hal and battery status

David Zeuthen david at fubar.dk
Tue Jul 6 11:43:26 PDT 2004


On Mon, 2004-07-05 at 22:54, Nathaniel McCallum wrote:
> Well, I'm not very knowledgeable about apm or pmud (apples power
> management).  However, we are generally dealing with several types of
> data:
> 	1. Hardware attributes (non-changing, ie. battery size)
> 	2. State attributes (changing, ie. current battery charge)

Right. On a HalDevice (see hald/hal_device.h) this corresponds to
properties, these are typed. Whenever they are updated, notifications
are broadcast on the system message bus.

> 	3. Events
> 

This corresponds to DeviceConditions in HAL. We already do this for
announcing that a block device have been unmounted.

> All this stuff is available in /proc/acpi/... I have no idea what will
> be available in sysfs in the future, if ever.
> 

Good question.

> Regarding the splitting up of devices (power button, lid, etc).  I don't
> think there is any info for several of those devices (other than
> events).  ie. for the types of data listed above, power buttons, lids,
> etc have only events.  So I'm not sure how exactly we would profile it. 

Isn't this in /proc/acpi, in [1] is how it looks like on my Dell
Inspiron 7500. So I guess lid, power and sleep in /proc/acpi/button is
what we are after; we create one HalDevice for each of them.

> What about profiling acpi as the device? (and apm and pmud as seperate
> devices).  

This I think is a bad idea - we really want to abstract this into
concepts (e.g. buttons, batteries, CPU's that is in every box) that can
be mapped to the architecture in use.

> Other than that, I like your division:  Power, standby and
> lid etc buttons, battery bays, and cpu.
> 
> I'm really not familiar with how hal works internally, but I can learn.
> 

Nice - it should be pretty easy. Just create a HalDevice, populate it
with some propoerties and then add it to the GDL (Global Device List)
and then it should be visible in hal-device-manager.

I've got a Powerbook, so I'm happy to do the Apple parts.

Cheers,
David

[1] :

[david at laptop david]$ tree /proc/acpi/
/proc/acpi/
|-- ac_adapter
|   `-- AC
|       `-- state
|-- alarm
|-- asus
|-- battery
|   |-- BAT0
|   |   |-- alarm
|   |   |-- info
|   |   `-- state
|   `-- BAT1
|       |-- alarm
|       |-- info
|       `-- state
|-- button
|   |-- lid
|   |   `-- LID
|   |       |-- info
|   |       `-- state
|   |-- power
|   |   `-- PWRB
|   |       `-- info
|   `-- sleep
|       `-- SBTN
|           `-- info
|-- dsdt
|-- embedded_controller
|   `-- EC0
|       `-- info
|-- event
|-- fadt
|-- fan
|   |-- FAN0
|   |   `-- state
|   `-- FAN1
|       `-- state
|-- info
|-- power_resource
|   |-- PFN0
|   |   `-- state
|   `-- PFN1
|       `-- state
|-- processor
|   `-- CPU0
|       |-- info
|       |-- limit
|       |-- power
|       `-- throttling
|-- sleep
`-- thermal_zone
    `-- THRM
        |-- cooling_mode
        |-- polling_frequency
        |-- state
        |-- temperature
        `-- trip_points



_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal



More information about the Hal mailing list