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

USB
[Linux 2.6 support]

USB. More...

Data Structures

struct  usb_proc_info_s
 Key information about USB devices from /proc that is not available in sysfs. More...


Defines

#define USB_IDS_MAX_LINE_LEN   512
 Maximum length of lines in usb.ids.


Typedefs

typedef usb_proc_info_s usb_proc_info
 Key information about USB devices from /proc that is not available in sysfs.


Functions

void usb_ids_line_iter_init ()
 Initialize the usb.ids line iterator to the beginning of the file.

char * usb_ids_line_iter_get_line (unsigned int *line_len)
 Get the next line from usb.ids.

dbus_bool_t usb_ids_line_iter_has_more ()
 See if there are more lines to process in usb.ids.

void usb_ids_find (int vendor_id, int product_id, char **vendor_name, char **product_name)
 Find the names for a USB device.

dbus_bool_t usb_ids_load (const char *path)
 Load the USB database used for mapping vendor, product, subsys_vendor and subsys_product numbers into names.

dbus_bool_t usb_ids_free ()
 Free resources used by to store the USB database.

usb_proc_infousb_proc_find_virtual_hub (int bus_number)
 Find the USB virtual root hub device for a USB bus.

usb_proc_infousb_proc_find_virtual_hub_child (int bus_number, int port_number)
 Find a child of a USB virtual root hub device for a USB bus.

usb_proc_infousb_proc_find_on_hub (int bus_number, int port_number, int parent_device_number)
 Find a child of a given hub device given a bus and port number.

void usb_proc_handle_topology (usb_proc_info *info, char *s)
 Parse the topology field.

void usb_proc_handle_device_info (usb_proc_info *info, char *s)
 Parse the device descriptor field.

void usb_proc_device_done (usb_proc_info *info)
 Called when an entry from /proc/bus/usb/devices have been parsed.

void usb_proc_parse_line (char *s)
 Parse a line from /proc/bus/usb/devices.

void usb_proc_parse ()
 Parse /proc/bus/usb/devices.

void usb_add_caps_from_class (HalDevice *d, int if_class, int if_sub_class, int if_proto)
 Set capabilities from interface and/or device class.

void usb_device_init ()
 Init function for USB handling.

void usb_device_shutdown ()
 Shutdown function for USB handling.

dbus_bool_t usb_device_accept (BusDeviceHandler *self, const char *path, struct sysfs_device *device, dbus_bool_t is_probing)
 Specialised accept function since both USB devices and USB interfaces share the same bus name.

char * usb_device_compute_udi (HalDevice *d, int append_num)
void usb_merge_info_from_proc (HalDevice *d)
void usb_device_pre_process (BusDeviceHandler *self, HalDevice *d, const char *sysfs_path, struct sysfs_device *device)

Variables

char * usb_ids = NULL
 Pointer to where the usb.ids file is loaded.

unsigned int usb_ids_len
 Length of data store at at usb_ids.

unsigned int usb_ids_iter_pos
 Iterator position into usb_ids.

usb_proc_infousb_proc_head = NULL
 First element in usb proc linked list.

usb_proc_infousb_proc_cur_info = NULL
 Unique device id of the device we are working on.

BusDeviceHandler usb_bus_handler
 Method specialisations for bustype usb.


Detailed Description

USB.


Function Documentation

void usb_add_caps_from_class HalDevice *  d,
int  if_class,
int  if_sub_class,
int  if_proto
[static]
 

Set capabilities from interface and/or device class.

Parameters:
d The HalDevice to set the caps
if_class Interface class
if_sub_class Interface sub class
if_proto Interface protocol

Definition at line 524 of file usb_bus_device.c.

References hal_device_add_capability().

dbus_bool_t usb_device_accept BusDeviceHandler self,
const char *  path,
struct sysfs_device *  device,
dbus_bool_t  is_probing
[static]
 

Specialised accept function since both USB devices and USB interfaces share the same bus name.

Parameters:
self Pointer to class members
path Sysfs-path for device
device libsysfs object for device
is_probing Set to TRUE only on initial detection

Definition at line 579 of file usb_bus_device.c.

void usb_ids_find int  vendor_id,
int  product_id,
char **  vendor_name,
char **  product_name
[static]
 

Find the names for a USB device.

The pointers returned are only valid until the next invocation of this function.

Parameters:
vendor_id USB vendor id or 0 if unknown
product_id USB product id or 0 if unknown
vendor_name Set to pointer of result or #NULL
product_name Set to pointer of result or #NULL

Definition at line 122 of file usb_bus_device.c.

References usb_ids_line_iter_get_line(), usb_ids_line_iter_has_more(), usb_ids_line_iter_init(), and USB_IDS_MAX_LINE_LEN.

dbus_bool_t usb_ids_free  )  [static]
 

Free resources used by to store the USB database.

Parameters:
#FALSE if the USB database wasn't loaded

Definition at line 259 of file usb_bus_device.c.

References usb_ids.

Referenced by usb_device_shutdown().

char* usb_ids_line_iter_get_line unsigned int *  line_len  )  [static]
 

Get the next line from usb.ids.

Parameters:
line_len Pointer to where number of bytes in line will be stored
Returns:
Pointer to the line; only valid until the next invocation of this function

Definition at line 80 of file usb_bus_device.c.

References usb_ids, usb_ids_iter_pos, usb_ids_len, and USB_IDS_MAX_LINE_LEN.

Referenced by usb_ids_find().

dbus_bool_t usb_ids_line_iter_has_more  )  [static]
 

See if there are more lines to process in usb.ids.

Returns:
#TRUE iff there are more lines to process

Definition at line 106 of file usb_bus_device.c.

References usb_ids_iter_pos, and usb_ids_len.

Referenced by usb_ids_find().

dbus_bool_t usb_ids_load const char *  path  )  [static]
 

Load the USB database used for mapping vendor, product, subsys_vendor and subsys_product numbers into names.

Parameters:
path Path of the usb.ids file, e.g. /usr/share/hwdata/usb.ids
Returns:
#TRUE if the file was succesfully loaded

Definition at line 220 of file usb_bus_device.c.

References usb_ids, and usb_ids_len.

Referenced by usb_device_init().

void usb_proc_device_done usb_proc_info info  )  [static]
 

Called when an entry from /proc/bus/usb/devices have been parsed.

Parameters:
info Structure representing the entry

Definition at line 395 of file usb_bus_device.c.

References usb_proc_info_s::next, usb_proc_head, and usb_proc_info.

Referenced by usb_proc_parse(), and usb_proc_parse_line().

usb_proc_info* usb_proc_find_on_hub int  bus_number,
int  port_number,
int  parent_device_number
[static]
 

Find a child of a given hub device given a bus and port number.

Parameters:
bus_number USB bus number
port_number The port number, starting from 1
parent_device_number The Linux device number
Returns:
The usb_proc_info structure with information retrieved from /proc or #NULL if not found

Definition at line 343 of file usb_bus_device.c.

References usb_proc_info_s::next, usb_proc_info_s::t_bus, usb_proc_info_s::t_parent, usb_proc_info_s::t_port, usb_proc_head, and usb_proc_info.

usb_proc_info* usb_proc_find_virtual_hub int  bus_number  )  [static]
 

Find the USB virtual root hub device for a USB bus.

Parameters:
bus_number USB bus number
Returns:
The usb_proc_info structure with information retrieved from /proc or #NULL if not found

Definition at line 301 of file usb_bus_device.c.

References usb_proc_info_s::next, usb_proc_info_s::t_bus, usb_proc_info_s::t_level, usb_proc_head, and usb_proc_info.

usb_proc_info* usb_proc_find_virtual_hub_child int  bus_number,
int  port_number
[static]
 

Find a child of a USB virtual root hub device for a USB bus.

Parameters:
bus_number USB bus number
port_number The port number, starting from 1
Returns:
The usb_proc_info structure with information retrieved from /proc or #NULL if not found

Definition at line 321 of file usb_bus_device.c.

References usb_proc_info_s::next, usb_proc_info_s::t_bus, usb_proc_info_s::t_level, usb_proc_info_s::t_port, usb_proc_head, and usb_proc_info.

void usb_proc_handle_device_info usb_proc_info info,
char *  s
[static]
 

Parse the device descriptor field.

Parameters:
info Structure to put information into
s Line from /proc/bus/usb/devices starting with "D:"

Definition at line 384 of file usb_bus_device.c.

References usb_proc_info_s::d_version_bcd, find_bcd2(), and usb_proc_info.

Referenced by usb_proc_parse_line().

void usb_proc_handle_topology usb_proc_info info,
char *  s
[static]
 

Parse the topology field.

Parameters:
info Structure to put information into
s Line from /proc/bus/usb/devices starting with "T:"

Definition at line 365 of file usb_bus_device.c.

References find_bcd2(), find_num(), usb_proc_info_s::t_bus, usb_proc_info_s::t_count, usb_proc_info_s::t_device, usb_proc_info_s::t_level, usb_proc_info_s::t_max_children, usb_proc_info_s::t_parent, usb_proc_info_s::t_port, usb_proc_info_s::t_speed_bcd, and usb_proc_info.

Referenced by usb_proc_parse_line().

void usb_proc_parse_line char *  s  )  [static]
 

Parse a line from /proc/bus/usb/devices.

Parameters:
s Line from /proc/bus/usb/devices

Definition at line 408 of file usb_bus_device.c.

References DIE, usb_proc_cur_info, usb_proc_device_done(), usb_proc_handle_device_info(), usb_proc_handle_topology(), and usb_proc_info.

Referenced by usb_proc_parse().


Variable Documentation

BusDeviceHandler usb_bus_handler
 

Initial value:

 {
    usb_device_init,           
    bus_device_detection_done, 
    usb_device_shutdown,       
    bus_device_tick,           
    usb_device_accept,         
    bus_device_visit,          
    bus_device_removed,        
    usb_device_compute_udi,    
    usb_device_pre_process,    
    bus_device_got_udi,        
    "usb",                     
    "usb"                      
}
Method specialisations for bustype usb.

Definition at line 942 of file usb_bus_device.c.


Generated on Sat Apr 24 19:57:51 2004 for HAL by doxygen 1.3.6-20040222