title: Udev Rule to Create SymLink to USB Device Through Hub
body: <p>I'm trying to create a SymLink to a device that goes through a usb hub which I imagine is causing my problems. I've tried the below udev rules but only the first one finds the device when I plug it in. Though it finds it, it links to /dev/bus/usb/001/020 rather than to /dev/ttyUSB0. What should my rule look like to get the proper SymLink for this device??</p>
  
  <pre><code>SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="0403", ATTR{idProduct}=="6011", SYMLINK+="ttyGpsSerial"
  SUBSYSTEM=="tty", ACTION=="add", ATTR{idVendor}=="0403", ATTR{idProduct}=="6011", SYMLINK+="ttyGpsSerial"
  KERNEL=="ttyUSB*", ACTION=="add", ATTR{idVendor}=="0403", ATTR{idProduct}=="6011", SYMLINK+="ttyGpsSerial"
  </code></pre>
  
  <p>Output From "udevadm info --attribute-walk --name /dev/ttyUSB0":</p>
  
  <pre><code>  looking at device '/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/ttyUSB0/tty/ttyUSB0':
      KERNEL=="ttyUSB0"
      SUBSYSTEM=="tty"
      DRIVER==""
  
    looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/ttyUSB0':
      KERNELS=="ttyUSB0"
      SUBSYSTEMS=="usb-serial"
      DRIVERS=="ftdi_sio"
      ATTRS{latency_timer}=="16"
      ATTRS{port_number}=="0"
  
    looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0':
      KERNELS=="1-4:1.0"
      SUBSYSTEMS=="usb"
      DRIVERS=="ftdi_sio"
      ATTRS{authorized}=="1"
      ATTRS{bAlternateSetting}==" 0"
      ATTRS{bInterfaceClass}=="ff"
      ATTRS{bInterfaceNumber}=="00"
      ATTRS{bInterfaceProtocol}=="ff"
      ATTRS{bInterfaceSubClass}=="ff"
      ATTRS{bNumEndpoints}=="02"
      ATTRS{interface}=="USB &lt;-&gt; Serial Cable"
      ATTRS{supports_autosuspend}=="1"
  
    looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-4':
      KERNELS=="1-4"
      SUBSYSTEMS=="usb"
      DRIVERS=="usb"
      ATTRS{authorized}=="1"
      ATTRS{avoid_reset_quirk}=="0"
      ATTRS{bConfigurationValue}=="1"
      ATTRS{bDeviceClass}=="00"
      ATTRS{bDeviceProtocol}=="00"
      ATTRS{bDeviceSubClass}=="00"
      ATTRS{bMaxPacketSize0}=="64"
      ATTRS{bMaxPower}=="100mA"
      ATTRS{bNumConfigurations}=="1"
      ATTRS{bNumInterfaces}==" 4"
      ATTRS{bcdDevice}=="0800"
      ATTRS{bmAttributes}=="80"
      ATTRS{busnum}=="1"
      ATTRS{configuration}==""
      ATTRS{devnum}=="29"
      ATTRS{devpath}=="4"
      ATTRS{idProduct}=="6011"
      ATTRS{idVendor}=="0403"
      ATTRS{ltm_capable}=="no"
      ATTRS{manufacturer}=="FTDI"
      ATTRS{maxchild}=="0"
      ATTRS{product}=="USB &lt;-&gt; Serial Cable"
      ATTRS{quirks}=="0x0"
      ATTRS{removable}=="removable"
      ATTRS{serial}=="FT1RAIYI"
      ATTRS{speed}=="480"
      ATTRS{urbnum}=="23"
      ATTRS{version}==" 2.00"
  
    looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1':
      KERNELS=="usb1"
      SUBSYSTEMS=="usb"
      DRIVERS=="usb"
      ATTRS{authorized}=="1"
      ATTRS{authorized_default}=="1"
      ATTRS{avoid_reset_quirk}=="0"
      ATTRS{bConfigurationValue}=="1"
      ATTRS{bDeviceClass}=="09"
      ATTRS{bDeviceProtocol}=="01"
      ATTRS{bDeviceSubClass}=="00"
      ATTRS{bMaxPacketSize0}=="64"
      ATTRS{bMaxPower}=="0mA"
      ATTRS{bNumConfigurations}=="1"
      ATTRS{bNumInterfaces}==" 1"
      ATTRS{bcdDevice}=="0415"
      ATTRS{bmAttributes}=="e0"
      ATTRS{busnum}=="1"
      ATTRS{configuration}==""
      ATTRS{devnum}=="1"
      ATTRS{devpath}=="0"
      ATTRS{idProduct}=="0002"
      ATTRS{idVendor}=="1d6b"
      ATTRS{interface_authorized_default}=="1"
      ATTRS{ltm_capable}=="no"
      ATTRS{manufacturer}=="Linux 4.15.0-33-generic xhci-hcd"
      ATTRS{maxchild}=="16"
      ATTRS{product}=="xHCI Host Controller"
      ATTRS{quirks}=="0x0"
      ATTRS{removable}=="unknown"
      ATTRS{serial}=="0000:00:14.0"
      ATTRS{speed}=="480"
      ATTRS{urbnum}=="1232"
      ATTRS{version}==" 2.00"
  
    looking at parent device '/devices/pci0000:00/0000:00:14.0':
      KERNELS=="0000:00:14.0"
      SUBSYSTEMS=="pci"
      DRIVERS=="xhci_hcd"
      ATTRS{broken_parity_status}=="0"
      ATTRS{class}=="0x0c0330"
      ATTRS{consistent_dma_mask_bits}=="64"
      ATTRS{d3cold_allowed}=="1"
      ATTRS{dbc}=="disabled"
      ATTRS{device}=="0xa12f"
      ATTRS{dma_mask_bits}=="64"
      ATTRS{driver_override}=="(null)"
      ATTRS{enable}=="1"
      ATTRS{irq}=="122"
      ATTRS{local_cpulist}=="0-7"
      ATTRS{local_cpus}=="ff"
      ATTRS{msi_bus}=="1"
      ATTRS{numa_node}=="-1"
      ATTRS{revision}=="0x31"
      ATTRS{subsystem_device}=="0x06d9"
      ATTRS{subsystem_vendor}=="0x1028"
      ATTRS{vendor}=="0x8086"
  
    looking at parent device '/devices/pci0000:00':
      KERNELS=="pci0000:00"
      SUBSYSTEMS==""
      DRIVERS==""
  </code></pre>