diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml index e7f4ae5..e454143 100644 --- a/doc/spec/hal-spec-properties.xml +++ b/doc/spec/hal-spec-properties.xml @@ -508,6 +508,15 @@ + usb_device.configuration (int) + + example: Bulk transfer configuration + No + Human-readable description of the current configuration the USB device is in + + + + usb_device.num_configurations (int) example: 1 @@ -750,6 +759,14 @@ + usb.interface.description (int) + + example: SyncML interface + No + Human-readable description for the interface provided by the device + + + usb.interface.number (int) example: 1 diff --git a/hald/freebsd/hf-usb.c b/hald/freebsd/hf-usb.c index 7a30a61..f7b2bf0 100644 --- a/hald/freebsd/hf-usb.c +++ b/hald/freebsd/hf-usb.c @@ -371,6 +371,18 @@ hf_usb_device_new (HalDevice *parent, { can_wake_up = (config_desc.bmAttributes & UC_REMOTE_WAKEUP) != 0; num_interfaces = config_desc.bNumInterface; + + if (config_desc->iConfiguration != 0) + { + char *configuration; + + configuration = hf_usb_get_string_descriptor(controller->fd, di->udi_addr, config_desc->iConfiguration, NULL); + if (configuration) + { + hal_device_property_set_string(device, "usb_device.configuration", configuration); + g_free(configuration); + } + } } hal_device_property_set_bool(device, "usb_device.can_wake_up", can_wake_up); @@ -435,6 +447,19 @@ hf_usb_interface_device_new (HalDevice *parent, hal_device_property_set_int(device, "usb.interface.protocol", desc->bInterfaceProtocol); hal_device_property_set_int(device, "usb.interface.number", desc->bInterfaceNumber); + if (desc->iInterface != 0) + { + char *interface; + + interface = hf_usb_get_string_descriptor(controller->fd, di->udi_addr, desc->iInterface, NULL); + if (interface) + { + hal_device_property_set_string(device, "usb.interface.description", interface); + g_free(interface); + } + } + + hf_usb_device_compute_udi(device); return device; diff --git a/hald/linux/device.c b/hald/linux/device.c index 3936229..fe05fe9 100644 --- a/hald/linux/device.c +++ b/hald/linux/device.c @@ -1494,6 +1494,7 @@ usb_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de hal_device_property_set_string (d, "usb_device.linux.sysfs_path", sysfs_path); + hal_util_set_string_from_file(d, "usb_device.configuration", sysfs_path, "configuration"); hal_util_set_int_from_file (d, "usb_device.configuration_value", sysfs_path, "bConfigurationValue", 10); hal_util_set_int_from_file (d, "usb_device.num_configurations", sysfs_path, "bNumConfigurations", 10); hal_util_set_int_from_file (d, "usb_device.num_interfaces", sysfs_path, "bNumInterfaces", 10); @@ -1589,6 +1590,7 @@ usb_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de hal_util_set_int_from_file (d, "usb.interface.class", sysfs_path, "bInterfaceClass", 16); hal_util_set_int_from_file (d, "usb.interface.subclass", sysfs_path, "bInterfaceSubClass", 16); hal_util_set_int_from_file (d, "usb.interface.protocol", sysfs_path, "bInterfaceProtocol", 16); + hal_util_set_string_from_file(d, "usb.interface.description", sysfs_path, "interface"); usbif_set_name (d, hal_device_property_get_int (d, "usb.interface.class"),