Newsgroup: it.comp.os.linux.sys
Titolo: Regola udev per USB Dongle.

Ciao,
ho una pennetta Hauwei E169 che dopo il modeswitch mi crea tre porte ttyUSB* vorrei dargli dei nomi
piu' umani e ho scritto questa regola nel primo file di /etc/udev/rules.d :
 
SUBSYSTEM=="usb",ATTRS{idVendor}=="12d1",ATTRS{idProduct}=="1001",ATTRS{bInterfaceNumber}=="00", SYMLINK+="ttyUSB_utps_modem"
 
Ho letto che non si possono mixare attributi di diversi livelli di parentela, ma non ne sono sicura ,
  sarebbe impossibile riconoscere un sottodevice altrimenti, comunque la regola non funziona ,
eppure sembra semplicissima.
 
 
allego sotto udevadmin info del device tty :
 
 
sudo udevadm info --attribute-walk /dev/ttyUSB4
 
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-6/3-6:1.0/ttyUSB4/tty/ttyUSB4':
     KERNEL=="ttyUSB4"
     SUBSYSTEM=="tty"
     DRIVER==""
 
   looking at parent device '/devices/pci0000:00/0000:00:14.0/usb3/3-6/3-6:1.0/ttyUSB4':
     KERNELS=="ttyUSB4"
     SUBSYSTEMS=="usb-serial"
     DRIVERS=="option1"
     ATTRS{port_number}=="0"
 
   looking at parent device '/devices/pci0000:00/0000:00:14.0/usb3/3-6/3-6:1.0':
     KERNELS=="3-6:1.0"
     SUBSYSTEMS=="usb"
     DRIVERS=="option"
     ATTRS{bInterfaceClass}=="ff"
     ATTRS{bInterfaceSubClass}=="ff"
     ATTRS{bInterfaceProtocol}=="ff"
     ATTRS{bNumEndpoints}=="03"
     ATTRS{supports_autosuspend}=="1"
     ATTRS{bAlternateSetting}==" 0"
     ATTRS{bInterfaceNumber}=="00"
     ATTRS{interface}=="Data Interface"
 
   looking at parent device '/devices/pci0000:00/0000:00:14.0/usb3/3-6':
     KERNELS=="3-6"
     SUBSYSTEMS=="usb"
     DRIVERS=="usb"
     ATTRS{bDeviceSubClass}=="00"
     ATTRS{bDeviceProtocol}=="00"
     ATTRS{devpath}=="6"
     ATTRS{idVendor}=="12d1"
     ATTRS{speed}=="12"
     ATTRS{bNumInterfaces}==" 4"
     ATTRS{bConfigurationValue}=="1"
     ATTRS{bMaxPacketSize0}=="64"
     ATTRS{busnum}=="3"
     ATTRS{devnum}=="14"
     ATTRS{configuration}==""
     ATTRS{bMaxPower}=="500mA"
     ATTRS{authorized}=="1"
     ATTRS{bmAttributes}=="a0"
     ATTRS{bNumConfigurations}=="1"
     ATTRS{maxchild}=="0"
     ATTRS{bcdDevice}=="0000"
     ATTRS{avoid_reset_quirk}=="0"
     ATTRS{quirks}=="0x0"
     ATTRS{version}==" 1.10"
     ATTRS{urbnum}=="8671253"
     ATTRS{ltm_capable}=="no"
     ATTRS{removable}=="removable"
     ATTRS{idProduct}=="1001"
     ATTRS{bDeviceClass}=="00"
     ATTRS{product}=="HUAWEI Mobile"
 
   looking at parent device '/devices/pci0000:00/0000:00:14.0/usb3':
     KERNELS=="usb3"
     SUBSYSTEMS=="usb"
     DRIVERS=="usb"
     ATTRS{bDeviceSubClass}=="00"
     ATTRS{bDeviceProtocol}=="01"
     ATTRS{devpath}=="0"
     ATTRS{idVendor}=="1d6b"
     ATTRS{speed}=="480"
     ATTRS{bNumInterfaces}==" 1"
     ATTRS{bConfigurationValue}=="1"
     ATTRS{bMaxPacketSize0}=="64"
     ATTRS{authorized_default}=="1"
     ATTRS{busnum}=="3"
     ATTRS{devnum}=="1"
     ATTRS{configuration}==""
     ATTRS{bMaxPower}=="0mA"
     ATTRS{authorized}=="1"
     ATTRS{bmAttributes}=="e0"
     ATTRS{bNumConfigurations}=="1"
     ATTRS{maxchild}=="12"
     ATTRS{bcdDevice}=="0313"
     ATTRS{avoid_reset_quirk}=="0"
     ATTRS{quirks}=="0x0"
     ATTRS{serial}=="0000:00:14.0"
     ATTRS{version}==" 2.00"
     ATTRS{urbnum}=="297"
     ATTRS{ltm_capable}=="no"
     ATTRS{manufacturer}=="Linux 3.13.0-8-generic xhci_hcd"
     ATTRS{removable}=="unknown"
     ATTRS{idProduct}=="0002"
     ATTRS{bDeviceClass}=="09"
     ATTRS{product}=="xHCI Host Controller"
 
   looking at parent device '/devices/pci0000:00/0000:00:14.0':
     KERNELS=="0000:00:14.0"
     SUBSYSTEMS=="pci"
     DRIVERS=="xhci_hcd"
     ATTRS{irq}=="44"
     ATTRS{subsystem_vendor}=="0x8086"
     ATTRS{broken_parity_status}=="0"
     ATTRS{class}=="0x0c0330"
     ATTRS{enabled}=="1"
     ATTRS{consistent_dma_mask_bits}=="64"
     ATTRS{dma_mask_bits}=="64"
     ATTRS{local_cpus}=="00000000,00000000,00000000,00000000,00000000,00000000,00000000,0000000f"
     ATTRS{device}=="0x8c31"
     ATTRS{msi_bus}==""
     ATTRS{local_cpulist}=="0-3"
     ATTRS{vendor}=="0x8086"
     ATTRS{subsystem_device}=="0x2052"
     ATTRS{numa_node}=="-1"
     ATTRS{d3cold_allowed}=="1"
 
   looking at parent device '/devices/pci0000:00':
     KERNELS=="pci0000:00"
     SUBSYSTEMS==""
     DRIVERS==""

 Ciao,
 
queste regole mi funzionano, per adesso mi basta cosi....grazie!!
 
SUBSYSTEMS=="usb",  KERNEL=="ttyUSB*", ATTRS{bInterfaceNumber}=="00", ATTRS{bInterfaceProtocol}=="ff", SYMLINK+="ttyUSB_utps_modem"
  SUBSYSTEMS=="usb",  KERNEL=="ttyUSB*", ATTRS{bInterfaceNumber}=="01", ATTRS{bInterfaceProtocol}=="ff", SYMLINK+="ttyUSB_utps_diag"
  SUBSYSTEMS=="usb",  KERNEL=="ttyUSB*", ATTRS{bInterfaceNumber}=="02", ATTRS{bInterfaceProtocol}=="ff", SYMLINK+="ttyUSB_utps_pcui"
 
 
Giulia
 
 

 
 
https://redtowers.org/txt/va.a.capo.dopo.72.colonne.txt