]> err.no Git - systemd/commitdiff
rules: v4l - add by-id/ links for USB devices
authorKay Sievers <kay.sievers@vrfy.org>
Thu, 20 Nov 2008 01:26:13 +0000 (02:26 +0100)
committerKay Sievers <kay.sievers@vrfy.org>
Thu, 20 Nov 2008 01:26:13 +0000 (02:26 +0100)
/dev/v4l
|-- by-id
|   |-- usb-046d_09a4_C4B15020-video-index0 -> ../../video0
|   `-- usb-05a9_a511-video-index0 -> ../../video1
`-- by-path
    |-- pci-0000:00:1d.0-usb-0:1:1.0-video-index0 -> ../../video1
    `-- pci-0000:00:1d.7-usb-0:2:1.0-video-index0 -> ../../video0

extras/usb_id/usb_id.c
rules/rules.d/60-persistent-v4l.rules

index 6dd1d450fb7a4aa366f5eb616a5b97978c0a911d..00d8a4c139e7353d37940ea092c3ec87c46fd602 100644 (file)
@@ -70,7 +70,9 @@ static void set_usb_iftype(char *to, int if_class_num, size_t len)
        case 0x0a: /* CDC-Data */
        case 0x0b: /* Chip/Smart Card */
        case 0x0d: /* Content Security */
-       case 0x0e: /* Video */
+       case 0x0e:
+               type = "video";
+               break;
        case 0xdc: /* Diagnostic Device */
        case 0xe0: /* Wireless Controller */
        case 0xf2: /* Application-specific */
index 0d673ab39627a311bebab816797a777d105c48f4..fb961b79e0ca763c2bb27b485a4bea36948e9fd4 100644 (file)
@@ -3,6 +3,9 @@
 ACTION!="add|change", GOTO="persistent_v4l_end"
 SUBSYSTEM!="video4linux", GOTO="persistent_v4l_end"
 
+SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export"
+KERNEL=="video*", ENV{ID_SERIAL}=="?*", SYMLINK+="v4l/by-id/$env{ID_BUS}-$env{ID_SERIAL}-video-index$attr{index}"
+
 # check for valid "index" number
 TEST!="index", GOTO="persistent_v4l_end"
 ATTR{index}!="?*", GOTO="persistent_v4l_end"