device model wakeup

David Zeuthen david at fubar.dk
Mon May 7 10:36:54 PDT 2007


Hi Johannes!

Sorry for the lag,

On Sat, 2007-05-05 at 12:57 +0200, Johannes Berg wrote:
> On Thu, 2007-04-12 at 16:07 -0400, David Zeuthen wrote:
> 
> > So I think if this is the case we just introduce a new capability
> > "wakeup" along with an interface with two methods
> > 
> >  bool org.freedesktop.Hal.Device.Wakeup.GetWakeUp()
> >  void org.freedesktop.Hal.Device.Wakeup.SetWakeUp(bool should_wakeup)
> > 
> > and then gpm, kpowersave and other policy agents can present a nice UI
> > around that for common devices like keyboards / mice etc.? Would that
> > work?
> 
> So I tried looking at the code but didn't really get far. Should I be
> adding this to hotplug_event_begin_add_dev? Or what other place has a
> chance to poke at all possible devices?

We should probably tag device objects that can wake up with the
capability 'wakeup'. This would go in device.c when the various bus
devices are investigated. With this, I think this can be achieved by
just a single fdi file that should go in 

 fdi/policy/10osvendor/10-wakeup.fdi

        <?xml version="1.0" encoding="UTF-8"?>
        
        <deviceinfo version="0.2">
          <device>
            <match key="info.capabilities" string="wakeup">
              <append key="info.interfaces" type="strlist">org.freedesktop.Hal.Device.Wakeup</append>
                
              <append key="org.freedesktop.Hal.Device.Wakeup.method_names" type="strlist">GetWakeUp</append>
              <append key="org.freedesktop.Hal.Device.Wakeup.method_signatures" type="strlist"></append>
              <append key="org.freedesktop.Hal.Device.Wakeup.method_argnames" type="strlist"></append>
              <append key="org.freedesktop.Hal.Device.Wakeup.method_execpaths" type="strlist">hal-wakeup-getwakeup</append>

              <append key="org.freedesktop.Hal.Device.Wakeup.method_names" type="strlist">SetWakeUp</append>
              <append key="org.freedesktop.Hal.Device.Wakeup.method_signatures" type="strlist">b</append>
              <append key="org.freedesktop.Hal.Device.Wakeup.method_argnames" type="strlist">should_wakeup</append>
              <append key="org.freedesktop.Hal.Device.Wakeup.method_execpaths" type="strlist">hal-wakeup-setwakeup</append>
        
            </match>
          </device>
        </deviceinfo>

The only problem is that we right now only allow return codes to be
integers. That will be fixed for 0.5.10 such that int, uint64, bool,
string, strlist can be returned.

More info here

http://people.freedesktop.org/~david/hal-spec/hal-spec.html#device-properties-info-method-calls

Does this help?

     David




More information about the hal mailing list