summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2009-01-22 19:23:33 +0100
committerKay Sievers <kay.sievers@vrfy.org>2009-01-22 19:23:33 +0100
commite339233993ede35a1e8eba5c0644e20622d6ba40 (patch)
tree2b4b82c574af2bf807933a7ebb571e742008000c
parent5db88229d1d1d727ee1e60de583cedc6c6aa6d73 (diff)
usb_id: handle ATAPI devices like SCSI devices
Some weird mass storage devices identify the disks as ATAPI/cdrom devices, and all disks in such enclusure get the same ids which overwrite each other, in such cases, get the typ of device from the scsi device, which has more knowledge what kind of device it really is.
-rw-r--r--extras/usb_id/usb_id.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c
index 0565e6403f..3d007f9ee5 100644
--- a/extras/usb_id/usb_id.c
+++ b/extras/usb_id/usb_id.c
@@ -107,7 +107,7 @@ static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len
if (eptr != from) {
switch (type_num) {
case 2:
- type = "cd";
+ type = "atapi";
break;
case 3:
type = "tape";
@@ -127,7 +127,6 @@ static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len
}
}
util_strlcpy(to, type, len);
-
return type_num;
}
@@ -205,8 +204,10 @@ static int usb_id(struct udev_device *dev)
udev_device_get_sysname(dev));
return 1;
}
+
if_class_num = strtoul(if_class, NULL, 16);
if (if_class_num == 8) {
+ /* mass storage */
if_subclass = udev_device_get_sysattr_value(dev_interface, "bInterfaceSubClass");
if (if_subclass != NULL)
protocol = set_usb_mass_storage_ifsubtype(type_str, if_subclass, sizeof(type_str)-1);
@@ -225,8 +226,8 @@ static int usb_id(struct udev_device *dev)
return 1;
}
- /* mass storage */
- if (protocol == 6 && !use_usb_info) {
+ /* mass storage : SCSI or ATAPI */
+ if ((protocol == 6 || protocol == 2) && !use_usb_info) {
struct udev_device *dev_scsi;
const char *scsi_model, *scsi_vendor, *scsi_type, *scsi_rev;
int host, bus, target, lun;