chiark / gitweb /
extras: fix mis-spelling of "environment"
[elogind.git] / extras / usb_id / usb_id.c
index 91e3ecce4d38213090eda14225c7518041d1314c..0565e6403f2fd358844a33d2ebd228a10660c9c1 100644 (file)
@@ -54,28 +54,40 @@ static void set_usb_iftype(char *to, int if_class_num, size_t len)
        case 1:
                type = "audio";
                break;
+       case 2: /* CDC-Control */
+               break;
        case 3:
                type = "hid";
                break;
+       case 5: /* Physical */
+               break;
+       case 6:
+               type = "media";
+               break;
        case 7:
                type = "printer";
                break;
        case 8:
                type = "storage";
                break;
-       case 2: /* CDC-Control */
-       case 5: /* Physical */
-       case 6: /* Image */
-       case 9: /* HUB */
+       case 9:
+               type = "hub";
+               break;
        case 0x0a: /* CDC-Data */
+               break;
        case 0x0b: /* Chip/Smart Card */
+               break;
        case 0x0d: /* Content Security */
+               break;
        case 0x0e:
                type = "video";
                break;
        case 0xdc: /* Diagnostic Device */
+               break;
        case 0xe0: /* Wireless Controller */
-       case 0xf2: /* Application-specific */
+               break;
+       case 0xfe: /* Application-specific */
+               break;
        case 0xff: /* Vendor-specific */
                break;
        default:
@@ -180,7 +192,7 @@ static int usb_id(struct udev_device *dev)
        dbg(udev, "syspath %s\n", udev_device_get_syspath(dev));
 
        /* usb interface directory */
-       dev_interface = udev_device_get_parent_with_subsystem(dev, "usb");
+       dev_interface = udev_device_get_parent_with_subsystem_devtype(dev, "usb", "usb_interface");
        if (dev_interface == NULL) {
                info(udev, "unable to access usb_interface device of '%s'\n",
                     udev_device_get_syspath(dev));
@@ -206,7 +218,7 @@ static int usb_id(struct udev_device *dev)
             udev_device_get_syspath(dev_interface), if_class_num, protocol);
 
        /* usb device directory */
-       dev_usb = udev_device_get_parent_with_subsystem(dev_interface, "usb");
+       dev_usb = udev_device_get_parent_with_subsystem_devtype(dev_interface, "usb", "usb_device");
        if (!dev_usb) {
                info(udev, "unable to find parent 'usb' device of '%s'\n",
                     udev_device_get_syspath(dev));
@@ -220,7 +232,7 @@ static int usb_id(struct udev_device *dev)
                int host, bus, target, lun;
 
                /* get scsi device */
-               dev_scsi = udev_device_get_parent_with_subsystem(dev, "scsi");
+               dev_scsi = udev_device_get_parent_with_subsystem_devtype(dev, "scsi", "scsi_device");
                if (dev_scsi == NULL) {
                        info(udev, "unable to find parent 'scsi' device of '%s'\n",
                             udev_device_get_syspath(dev));
@@ -383,7 +395,7 @@ int main(int argc, char **argv)
                        printf("Usage: usb_id [--usb-info] [--num-info] [--export] [--help] <devpath>\n"
                               "  --usb-info  use usb strings instead\n"
                               "  --num-info  use numerical values\n"
-                              "  --export    print values as environemt keys\n"
+                              "  --export    print values as environment keys\n"
                               "  --help      print this help text\n\n");
                default:
                        retval = 1;