Main Page | Modules | Data Structures | File List | Data Fields | Related Pages

ClassDeviceHandler_s Struct Reference

Method and property table for ClassDeviceHandler. More...

#include <class_device.h>


Data Fields

void(* init )(ClassDeviceHandler *self)
 Called when the HAL daemon is starting up.

void(* detection_done )(ClassDeviceHandler *self)
 Called when all device detection (on bootstrap) is done.

void(* shutdown )(ClassDeviceHandler *self)
 Called just before the HAL daemon is shutting down.

void(* tick )(ClassDeviceHandler *self)
 Called regulary (every two seconds) for polling etc.

dbus_bool_t(* accept )(ClassDeviceHandler *self, const char *sysfs_path, struct sysfs_class_device *class_device, dbus_bool_t is_probing)
 Called when processing a new device instance to determine whether this class accepts this kind of device.

void(* visit )(ClassDeviceHandler *self, const char *sysfs_path, struct sysfs_class_device *class_device, dbus_bool_t is_probing)
 Called when a new instance of a class device is detected either through hotplug or through initial detection.

void(* removed )(ClassDeviceHandler *self, const char *sysfs_path, HalDevice *d)
 Called when the class device instance have been removed.

void(* udev_event )(ClassDeviceHandler *self, HalDevice *d, char *dev_file)
 Called when the device file (e.g.

void(* get_device_file_target )(ClassDeviceHandler *self, HalDevice *d, const char *sysfs_path, struct sysfs_class_device *class_device, char *dev_file_prop, int dev_file_prop_len)
 Get the name of that the property that the device file should be put in.

void(* pre_process )(ClassDeviceHandler *self, HalDevice *d, const char *sysfs_path, struct sysfs_class_device *class_device)
 This method is called just before the device is either merged onto the sysdevice or added to the GDL (cf.

void(* post_merge )(ClassDeviceHandler *self, HalDevice *d)
 Called when an inferior HalDevice is merged.

void(* got_udi )(ClassDeviceHandler *self, HalDevice *d, const char *udi)
 Called when the UDI has been determined, but before the device is added to the GDL.

char *(* compute_udi )(HalDevice *d, int append_num)
 This function will compute the device udi based on other properties of the device.

const char * sysfs_class_name
 name of device class the instance handles (name mentioned in /sys/class

const char * hal_class_name
 hal class name - if merge_or_add==FALSE then info.bus will have this name

dbus_bool_t require_device_file
 TRUE if the class device should get the device file from udev (using udevinfo on probing / waiting for dbus signal on hotplug).

dbus_bool_t merge_or_add
 TRUE if the class device should be merged onto the sysdevice; if FALSE the class device will be added as a child to the parent of the sysdevice.


Detailed Description

Method and property table for ClassDeviceHandler.

Definition at line 36 of file class_device.h.


Field Documentation

dbus_bool_t(* ClassDeviceHandler_s::accept)(ClassDeviceHandler *self, const char *sysfs_path, struct sysfs_class_device *class_device, dbus_bool_t is_probing)
 

Called when processing a new device instance to determine whether this class accepts this kind of device.

Parameters:
self Pointer to class members
sysfs_path The path in sysfs (including mount point) of the device in sysfs
class_device Libsysfs object representing new class device instance
is_probing Set to TRUE only on initial detection
Returns:
Must return TRUE if this class should process this device

Referenced by visit_class_device().

char*(* ClassDeviceHandler_s::compute_udi)(HalDevice *d, int append_num)
 

This function will compute the device udi based on other properties of the device.

It only makes sense to implement this method if, and only if, merge_or_add==FALSE

Requirements for udi:

  • do not rely on bus, port etc.; we want this id to be as unique for the device as we can
  • make sure it doesn't rely on properties that cannot be obtained from the minimal information we can obtain on an unplug event

Parameters:
d HalDevice object
append_num Number to append to name if not -1
Returns:
New unique device id; only good until the next invocation of this function

void(* ClassDeviceHandler_s::detection_done)(ClassDeviceHandler* self)
 

Called when all device detection (on bootstrap) is done.

Parameters:
self Pointer to class members

Referenced by osspec_probe().

void(* ClassDeviceHandler_s::get_device_file_target)(ClassDeviceHandler* self, HalDevice *d, const char *sysfs_path, struct sysfs_class_device *class_device, char* dev_file_prop, int dev_file_prop_len)
 

Get the name of that the property that the device file should be put in.

Parameters:
self Pointer to class members
d The HalDevice object of the instance of this device class
sysfs_path The path in sysfs (including mount point) of the class device in sysfs
class_device Libsysfs object representing class device instance
dev_file_prop Device file property name (out)
dev_file_prop_len Maximum length of string

Referenced by class_device_visit().

void(* ClassDeviceHandler_s::got_udi)(ClassDeviceHandler *self, HalDevice *d, const char *udi)
 

Called when the UDI has been determined, but before the device is added to the GDL.

Note that this is only invoked if merge_or_add is FALSE.

Parameters:
self Pointer to class members
d The HalDevice object, see above
udi UDI of device

void(* ClassDeviceHandler_s::init)(ClassDeviceHandler* self)
 

Called when the HAL daemon is starting up.

Parameters:
self Pointer to class members

Referenced by osspec_init().

void(* ClassDeviceHandler_s::post_merge)(ClassDeviceHandler *self, HalDevice *d)
 

Called when an inferior HalDevice is merged.

This is the last step when merging in devices. This is only invoked if merge_or_add is TRUE.

Parameters:
self Pointer to the class members
d The HalDevice object recently merged

void(* ClassDeviceHandler_s::pre_process)(ClassDeviceHandler* self, HalDevice *d, const char *sysfs_path, struct sysfs_class_device *class_device)
 

This method is called just before the device is either merged onto the sysdevice or added to the GDL (cf.

merge_or_add). This is useful for extracting more information about the device through e.g. ioctl's using the device file property and also for setting info.category|capability.

Note that the UDI is not yet valid, use function got_udi to

Parameters:
self Pointer to class members
d The HalDevice object of the instance of this device class
sysfs_path The path in sysfs (including mount point) of the class device in sysfs
class_device Libsysfs object representing class device instance

void(* ClassDeviceHandler_s::removed)(ClassDeviceHandler* self, const char *sysfs_path, HalDevice *d)
 

Called when the class device instance have been removed.

Parameters:
self Pointer to class members
sysfs_path The path in sysfs (including mount point) of the class device in sysfs
d The HalDevice object of the instance of this device class

dbus_bool_t ClassDeviceHandler_s::require_device_file
 

TRUE if the class device should get the device file from udev (using udevinfo on probing / waiting for dbus signal on hotplug).

FALSE if there is no special device file for the device class (such as net devices).

If set to TRUE then class_device_target_property must be implemented.

Definition at line 231 of file class_device.h.

Referenced by class_device_got_parent_device(), class_device_got_sysdevice(), and class_device_visit().

void(* ClassDeviceHandler_s::shutdown)(ClassDeviceHandler* self)
 

Called just before the HAL daemon is shutting down.

Parameters:
self Pointer to class members

void(* ClassDeviceHandler_s::tick)(ClassDeviceHandler* self)
 

Called regulary (every two seconds) for polling etc.

Parameters:
self Pointer to class members

Referenced by osspec_timer_handler().

void(* ClassDeviceHandler_s::udev_event)(ClassDeviceHandler* self, HalDevice *d, char *dev_file)
 

Called when the device file (e.g.

a file in /dev) have been created for a particual instance of this class device

Parameters:
self Pointer to class members
d The HalDevice object of the instance of this device class
dev_file Device file, e.g. /udev/input/event4

Referenced by class_device_visit(), and handle_udev_node_created_found_device().

void(* ClassDeviceHandler_s::visit)(ClassDeviceHandler* self, const char *sysfs_path, struct sysfs_class_device *class_device, dbus_bool_t is_probing)
 

Called when a new instance of a class device is detected either through hotplug or through initial detection.

This function should create a HalDevice object if we are interested in the class device (e.g. if it maps to a particular hardware device). If a HalDevice object is created and we need to wait for an udev event, then the string property

.udev.sysfs_path

must be set to the sysfs_path given and the string property

.udev.class_name

need to carry the appropriate class device name (e.g. from /sys/class such as input, net).

Parameters:
self Pointer to class members
sysfs_path The path in sysfs (including mount point) of the class device in sysfs
class_device Libsysfs object representing new class device instance
is_probing Set to TRUE only initial detection

Referenced by visit_class_device().


The documentation for this struct was generated from the following file:
Generated on Sat Apr 24 19:57:46 2004 for HAL by doxygen 1.3.6-20040222