Skip to content

Instantly share code, notes, and snippets.

@madchap
Last active June 20, 2020 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save madchap/03aff8f3ceef5c01bc12a4c5fc13f8a8 to your computer and use it in GitHub Desktop.
Save madchap/03aff8f3ceef5c01bc12a4c5fc13f8a8 to your computer and use it in GitHub Desktop.
Plugable TBT3-UDV Docking Station udev rules

For more info

See related gist for the Dell TB16 udev rules. https://gist.github.com/madchap/b5e6f9baf489d127b5ca2dbcd71adf63

system info

Tested with kernel 5.0.5-1-default on Dell XPS 13 And now with 5.6.2-1-default on Lenovo X1 Carbon 2019

on Opensuse Tumbleweed.

udev

  looking at device '//devices/pci0000:00/0000:00:1d.4/0000:05:00.0/0000:06:00.0/0000:07:00.0/domain0/0-0/0-1':
    KERNEL=="0-1"
    SUBSYSTEM=="thunderbolt"
    DRIVER==""
    ATTR{nvm_version}=="35.0"
    ATTR{generation}=="3"
    ATTR{authorized}=="1"
    ATTR{rx_lanes}=="2"
    ATTR{vendor}=="0x173"
    ATTR{unique_id}=="004631c1-4080-7301-ffff-ffffffffffff"
    ATTR{tx_speed}=="10.0 Gb/s"
    ATTR{vendor_name}=="Plugable"
    ATTR{device_name}=="TBT3-UDV Docking Station"
    ATTR{tx_lanes}=="2"
    ATTR{boot}=="0"
    ATTR{device}=="0x2002"
    ATTR{rx_speed}=="10.0 Gb/s"
    ATTR{nvm_authenticate}=="0x0"
$ udevadm info -ap /devices/pci0000:00/0000:00:1c.0/0000:01:00.0/0000:02:00.0/0000:03:00.0/domain0/0-0/0-1

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '//devices/pci0000:00/0000:00:1c.0/0000:01:00.0/0000:02:00.0/0000:03:00.0/domain0/0-0/0-1':
    KERNEL=="0-1"
    SUBSYSTEM=="thunderbolt"
    DRIVER==""
    ATTR{unique_id}=="d4030000-0070-7718-230c-04988d62221e"
    ATTR{nvm_version}=="35.0"
    ATTR{vendor_name}=="Plugable"
    ATTR{boot}=="0"
    ATTR{nvm_authenticate}=="0x0"
    ATTR{device_name}=="TBT3-UDV Docking Station"
    ATTR{vendor}=="0x173"
    ATTR{authorized}=="1"
    ATTR{device}=="0x2002"

rules

/etc/udev/rules.d/99-plugable-tbt3-udv-docking.rules

# plug and unplug actions for the Plugable TBT3-UDV Docking Station
ACTION=="add", SUBSYSTEM=="thunderbolt", ATTR{vendor}=="0x173", ATTR{device}=="0x2002", RUN="/usr/bin/at -M -f /home/fblaise/bin/udev_plug_dock.sh now"
ACTION=="remove", SUBSYSTEM=="thunderbolt", ENV{DEVPATH}=="/devices/pci0000:00/0000:00:1c.0/0000:01:00.0/0000:02:00.0/0000:03:00.0/domain0/0-0/0-1", RUN="/usr/bin/at -M -f /home/fblaise/bin/udev_unplug_dock.sh now"

# https://www.linuxquestions.org/questions/linux-desktop-74/udev-not-doing-remove-rules-841733/
# no access to ATTR upon remove and not much ENV variables available
# ACTION=="remove", SUBSYSTEM=="thunderbolt", ATTR{vendor}=="0xd4", ATTR{device}=="0xb054", RUN="/tmp/test_remove.sh"

The atd daemon may be disabled, hence the RUN would not appear to run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment