Então dirkt fez um comentário que me fez pensar e eu verifiquei alguns fatos novamente. Com o monitor do udevadm e, em seguida, conectando os dispositivos, obtive o seguinte:
Cobalt :
KERNEL[25393.161856] add /devices/pci0000:00/0000:00:14.0/usb3/3-8 (usb)
KERNEL[25393.165873] add /devices/pci0000:00/0000:00:14.0/usb3/3-8/3-8:1.0 (usb)
KERNEL[25393.165941] bind /devices/pci0000:00/0000:00:14.0/usb3/3-8 (usb)
UDEV [25393.183044] add /devices/pci0000:00/0000:00:14.0/usb3/3-8 (usb)
UDEV [25393.185175] add /devices/pci0000:00/0000:00:14.0/usb3/3-8/3-8:1.0 (usb)
UDEV [25393.186958] bind /devices/pci0000:00/0000:00:14.0/usb3/3-8 (usb)
D4i
KERNEL[24333.615580] add /devices/pci0000:00/0000:00:14.0/usb3/3-8 (usb)
KERNEL[24333.618406] add /devices/pci0000:00/0000:00:14.0/usb3/3-8/3-8:1.0 (usb)
KERNEL[24333.618444] add /devices/pci0000:00/0000:00:14.0/usb3/3-8/3-8:1.0/ttyUSB0 (usb-serial)
KERNEL[24333.618615] add /devices/pci0000:00/0000:00:14.0/usb3/3-8/3-8:1.0/ttyUSB0/tty/ttyUSB0 (tty)
KERNEL[24333.618644] bind /devices/pci0000:00/0000:00:14.0/usb3/3-8/3-8:1.0/ttyUSB0 (usb-serial)
KERNEL[24333.618685] bind /devices/pci0000:00/0000:00:14.0/usb3/3-8/3-8:1.0 (usb)
KERNEL[24333.618729] bind /devices/pci0000:00/0000:00:14.0/usb3/3-8 (usb)
UDEV [24333.637591] add /devices/pci0000:00/0000:00:14.0/usb3/3-8 (usb)
UDEV [24333.639773] add /devices/pci0000:00/0000:00:14.0/usb3/3-8/3-8:1.0 (usb)
UDEV [24333.641366] add /devices/pci0000:00/0000:00:14.0/usb3/3-8/3-8:1.0/ttyUSB0 (usb-serial)
UDEV [24333.648159] add /devices/pci0000:00/0000:00:14.0/usb3/3-8/3-8:1.0/ttyUSB0/tty/ttyUSB0 (tty)
UDEV [24333.648969] bind /devices/pci0000:00/0000:00:14.0/usb3/3-8/3-8:1.0/ttyUSB0 (usb-serial)
UDEV [24333.649799] bind /devices/pci0000:00/0000:00:14.0/usb3/3-8/3-8:1.0 (usb)
UDEV [24333.650906] bind /devices/pci0000:00/0000:00:14.0/usb3/3-8 (usb)
Com isso, imaginei que os subsistemas do udev corretos deveriam ser:
- d4i - > tty
- cobalto - > usb
E como dirkt mencionou, use ATTRS ao invés de ATTR para combinar em todo o devicepath. Então eu mudei as regras do udev para:
# My Cobalt2 DiveComputer
SUBSYSTEM=="usb", ATTR{idVendor}=="0471", ATTR{idProduct}=="0888", SYMLINK+="my_cobalt", GROUP="dialout", MODE="0660"
# My Suunto D4i DiveComputer
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="DiYISDGK", SYMLINK+="my_d4i", GROUP="dialout", MODE="0660"
Depois de reiniciar o udev e reconectar o dispositivo que recebi:
ls -l / dev / tty_d4i
lrwxrwxrwx 1 root root 7 mei 22 00:43 tty_d4i -> ttyUSB0
E isso fez funcionar como eu queria. Eu ainda não estou 100% certo porque, mas esse é o meu conhecimento limitado do udev, eu acho. Eu continuarei investigando o udev, mas por enquanto isso parece estar resolvido. Então, graças ao dirkt pela dica.
Para referência, a saída de:
sudo udevadm info -a -n / dev / ttyUSB0
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:14.0/usb3/3-7/3-7:1.0/ttyUSB0/tty/ttyUSB0': KERNEL=="ttyUSB0" SUBSYSTEM=="tty" DRIVER=="" looking at parent device '/devices/pci0000:00/0000:00:14.0/usb3/3-7/3-7: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/usb3/3-7/3-7:1.0': KERNELS=="3-7: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 Serial Cable" ATTRS{supports_autosuspend}=="1" looking at parent device '/devices/pci0000:00/0000:00:14.0/usb3/3-7': KERNELS=="3-7" 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}=="8" ATTRS{bMaxPower}=="500mA" ATTRS{bNumConfigurations}=="1" ATTRS{bNumInterfaces}==" 1" ATTRS{bcdDevice}=="0600" ATTRS{bmAttributes}=="a0" ATTRS{busnum}=="3" ATTRS{configuration}=="" ATTRS{devnum}=="14" ATTRS{devpath}=="7" ATTRS{idProduct}=="6001" ATTRS{idVendor}=="0403" ATTRS{ltm_capable}=="no" ATTRS{manufacturer}=="Smartinterface" ATTRS{maxchild}=="0" ATTRS{product}=="USB Serial Cable" ATTRS{quirks}=="0x0" ATTRS{removable}=="removable" ATTRS{serial}=="DiYISDGK" ATTRS{speed}=="12" ATTRS{urbnum}=="15" ATTRS{version}==" 2.00" looking at parent device '/devices/pci0000:00/0000:00:14.0/usb3': KERNELS=="usb3" 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}=="3" 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-20-generic xhci-hcd" ATTRS{maxchild}=="15" ATTRS{product}=="xHCI Host Controller" ATTRS{quirks}=="0x0" ATTRS{removable}=="unknown" ATTRS{serial}=="0000:00:14.0" ATTRS{speed}=="480" ATTRS{urbnum}=="264" 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}=="0x8d31" ATTRS{dma_mask_bits}=="64" ATTRS{driver_override}=="(null)" ATTRS{enable}=="1" ATTRS{irq}=="19" ATTRS{local_cpulist}=="0-11" ATTRS{local_cpus}=="fff" ATTRS{msi_bus}=="1" ATTRS{numa_node}=="0" ATTRS{revision}=="0x05" ATTRS{subsystem_device}=="0x7a54" ATTRS{subsystem_vendor}=="0x1462" ATTRS{vendor}=="0x8086" looking at parent device '/devices/pci0000:00': KERNELS=="pci0000:00" SUBSYSTEMS=="" DRIVERS==""