DBUS API questions

Michael E Brown Michael_E_Brown at dell.com
Tue May 1 12:09:55 PDT 2007


    Not sure the best place to ask these questions. If there is a better
email list to discuss this, please let me know.

    I would like to start on a DBUS api for libsmbios.
(http://linux.dell.com/libsmbios/main) I am afraid I dont have a lot of
experience in dbus, though, so I wanted somebody else to help me a bit
so I dont mess it up too badly.

    I thought it would be a good start to define my interfaces and
object paths. Here is what I have come up with so far. This is all
pseudocode. Final implementation will most likely be either glib or
python (most likely). I wanted to get the interfaces/paths/etc right
before I started coding this.

    I think I understand the difference between interfaces and object
paths. I am still somewhat confused about how bus paths enter the
picture. Some enlightenment would be appreciated.

    The motivation behind this is that almost all of the utilities in
libsmbios require root access for various reasons. Right now, I have
cmdline programs that must be run as root or using sudo. I'd like to
write graphical interfaces for some of them, and think that splitting
the graphical interface from the backend root stuff is the best way to
go. Dbus seemed like a good choice so that users could write their own
UI code for other desktop environments if they dont like mine (which
will likely be gnome components written in glade/python)

    This is in addition to the work that other folks have already done
to integrate some of my libsmbios stuff into HAL (which I *greatly*
appreciate, btw.)

--
Michael

==============================================================================
Interface: org.libsmbios.table
    Methods: 
        reReadTable()
        getNumberOfStructures()
            # call with iterStatic = 0, then repeatedly call with output
            # from last call to iterate over structures of a specific
            # type
            # not sure if this is necessary or not...
        object_path iterOverType(in typeId, in/out iterStatic)

Interface: org.libsmbios.table.struct
    Methods:
        u8 getType()
        u8 getLength()
        u16 getHandle()
        u8 *getData(offset, len)
        string getStringFromOffset(offset)
        string getStringByStringNumber(number)

Object paths:
    /org/libsmbios/table  (object with interface org.libsmbios.table)
            |--> byHandle
            |   |--> <handle id#> (object with interface org.libsmbios.table.struct)
            |   |--> <handle id#> (object with interface org.libsmbios.table.struct)
            |   |--> <handle id#> (object with interface org.libsmbios.table.struct)
            |--> byType
                |--> <type id#>
                |   |--> <handle id#> (object with interface org.libsmbios.table.struct)
                |   |--> <handle id#> (object with interface org.libsmbios.table.struct)
                |   |--> <handle id#> (object with interface org.libsmbios.table.struct)
                |--> <type id#>

Example:
    /org/libsmbios/table/byHandle/0xd400
    /org/libsmbios/table/byHandle/0xd401
    /org/libsmbios/table/byHandle/0xd402
    /org/libsmbios/table/byHandle/0x0001
    /org/libsmbios/table/byHandle/0x0100
    /org/libsmbios/table/byHandle/0x0200
    /org/libsmbios/table/byType/0xd4/0xd400
    /org/libsmbios/table/byType/0xd4/0xd401
    /org/libsmbios/table/byType/0x01/0x0001
    /org/libsmbios/table/byType/0x02/0x0200

This means that there are two ways to get to any particular table
structure. Directly, using byHandle, or by iterating over the
sub-objects under a specific type (byType)

I am assuming here that there is a native DBUS interface for getting a
list of all objects under a specific path. (something like: ls
/org/libsmbios/table/byHandle/*) In that case, iterOverType() may not be
necessary.


==============================================================================
Interface: org.libsmbios.dell.tokenTypeBool
    Methods:
        tryPassword(string)
        isActive()
        activate()
            -> this should emit a signal when it is called so that other
users know something changed. Note sure what that would be.

Interface: org.libsmbios.dell.tokenTypeString
    Methods:
        tryPassword(string)
        getLength()
        getString()
        setString()
            -> this should emit a signal when it is called so that other
users know something changed. Note sure what that would be.

Object Paths:
    /org/libsmbios/dell/tokens/
                        |--> <token id#> (object implementing either interface tokenTypeBool or tokenTypeString)


==============================================================================
# 
# Note: not sure I want to export such a low-level dbus api. This is how
# dellWirelessCtl, dellLedCtl, etc are implemented now, but might want
# to actually export higher-level interfaces so that we can send signals
# when things change.
#
# for example, instead of calling doSimpleCallingInterfaceSmi() to set
# radio parameters, we might have an API, setRadioStatus(), that sends a
# signal when the radio status changes, so interested parties can all
# coordinate and not step on each other. eg. the HAL interface could get
# updated if the user runs a cmdline app to set radio status.
# 
#Interface: org.libsmbios.dell.smi
#    Methods:
#        doSimpleCallingInterfaceSmi( u16 class, u8 select, u32 args[4], u32 res[4])
#
#Object Paths:
#    /org/libsmbios/dell/smi (object implementing org.libsmbios.dell.smi)


==============================================================================
Interface: org.libsmbios.dell.rbu 
    Methods:
        updateBios( bios_file, override_bios_ver_check, override_sysid_check)
            -> this should emit a signal when it is called so that other
users know something changed. Note sure what that would be.


==============================================================================


More information about the dbus mailing list