- if_class = sysfs_attr_get_value(dev_interface->devpath, "bInterfaceClass");
- if (!if_class) {
- info("%s: cannot get bInterfaceClass attribute", dev_interface->kernel_name);
- return 1;
- }
- if_class_num = strtoul(if_class, NULL, 16);
- if (if_class_num != 8) {
- set_usb_iftype(type_str, if_class, sizeof(type_str)-1);
- protocol = 0;
- } else {
- if_subclass = sysfs_attr_get_value(dev_interface->devpath, "bInterfaceSubClass");
- protocol = set_usb_ifsubtype(type_str, if_subclass, sizeof(type_str)-1);
- }
+ /* mass storage */
+ if (protocol == 6 && !use_usb_info) {
+ struct sysfs_device *dev_scsi;
+ const char *scsi_model, *scsi_vendor, *scsi_type, *scsi_rev;
+ int host, bus, target, lun;
+
+ /* get scsi device */
+ dev_scsi = sysfs_device_get_parent_with_subsystem(udev, dev, "scsi");
+ if (dev_scsi == NULL) {
+ info(udev, "unable to find parent 'scsi' device of '%s'\n", devpath);
+ goto fallback;
+ }
+ if (sscanf(dev_scsi->kernel, "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4) {
+ info(udev, "invalid scsi device '%s'\n", dev_scsi->kernel);
+ goto fallback;
+ }