Linux UDEV und rules + FTTI

Gast #2642908
Lesenswert?

Hallo,
ich habe versucht einen Gerät und linux sinnvolle Alias namen zu 
vergeben. Leider will die Regel nicht so wie ich will.
Das ganze ist ein CardReader mit einem FTTI, er liefert ttyUSB1, ttyUSB2 
und ttyUSB3

Folgende habe ich Probiert:

Im netzt gefunden:
SUBSYSTEMS=="usb", ENV{ID_IFACE}="$attr{bInterfaceNumber}", 
KERNEL=="ttyUSB*", ATTRS{serial}=="000003d5", 
SYMLINK+="tripleeen$env{ID_IFACE}"

geht teilweise aber die variable ENV{ID_IFACE} ist immer leer, damit 
wird immer der gleiche namen zusammengebaut.

eigene Versuche:

keine der Regeln macht was

SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="00", KERNEL=="ttyUSB*", 
ATTRS{serial}=="000003d5", SYMLINK+="tripleeen_00"
SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="01", KERNEL=="ttyUSB*", 
ATTRS{serial}=="000003d5", SYMLINK+="tripleeen_01"
SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="02", KERNEL=="ttyUSB*", 
ATTRS{serial}=="000003d5", SYMLINK+="tripleeen_02"

diese Regel geht, aber ich brauche die 3 device:

SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{serial}=="000003d5", 
SYMLINK+="tripleeen_xx"


Scheinbar ist die ATTRS{bInterfaceNumber}=="01" nie true aber warum?

Hier noch die eigenschaften von dem gerät:

udevadm info --query=all --name=/dev/ttyUSB2 --attribute-walk

  looking at device 
'/devices/pci0000:00/0000:00:11.0/0000:02:02.0/usb1/1-2/1-2:1.1/ttyUSB1/ 
tty/ttyUSB1':
    KERNEL=="ttyUSB1"
    SUBSYSTEM=="tty"
    DRIVER==""

  looking at parent device 
'/devices/pci0000:00/0000:00:11.0/0000:02:02.0/usb1/1-2/1-2:1.1/ttyUSB1' 
:
    KERNELS=="ttyUSB1"
    SUBSYSTEMS=="usb-serial"
    DRIVERS=="ftdi_sio"
    ATTRS{latency_timer}=="1"
    ATTRS{port_number}=="0"

  looking at parent device 
'/devices/pci0000:00/0000:00:11.0/0000:02:02.0/usb1/1-2/1-2:1.1':
    KERNELS=="1-2:1.1"
    SUBSYSTEMS=="usb"
    DRIVERS=="ftdi_sio"
    ATTRS{bInterfaceNumber}=="01"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{bNumEndpoints}=="02"
    ATTRS{bInterfaceClass}=="ff"
    ATTRS{bInterfaceSubClass}=="ff"
    ATTRS{bInterfaceProtocol}=="ff"
    ATTRS{supports_autosuspend}=="1"
    ATTRS{interface}=="Triple Reader+"

  looking at parent device 
'/devices/pci0000:00/0000:00:11.0/0000:02:02.0/usb1/1-2':
    KERNELS=="1-2"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bNumInterfaces}==" 3"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="a0"
    ATTRS{bMaxPower}=="150mA"
    ATTRS{urbnum}=="19"
    ATTRS{idVendor}=="0403"
    ATTRS{idProduct}=="6011"
    ATTRS{bcdDevice}=="0500"
    ATTRS{bDeviceClass}=="00"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{speed}=="480"
    ATTRS{busnum}=="1"
    ATTRS{devnum}=="16"
    ATTRS{devpath}=="2"
    ATTRS{version}==" 2.00"
    ATTRS{maxchild}=="0"
    ATTRS{quirks}=="0x0"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{authorized}=="1"
    ATTRS{manufacturer}=="Argolis"
    ATTRS{product}=="Triple Reader+"
    ATTRS{serial}=="000003d5"


  looking at parent device 
'/devices/pci0000:00/0000:00:11.0/0000:02:02.0/usb1':
    KERNELS=="usb1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bMaxPower}=="  0mA"
    ATTRS{urbnum}=="387"
    ATTRS{idVendor}=="1d6b"
    ATTRS{idProduct}=="0002"
    ATTRS{bcdDevice}=="0302"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{speed}=="480"
    ATTRS{busnum}=="1"
    ATTRS{devnum}=="1"
    ATTRS{devpath}=="0"
    ATTRS{version}==" 2.00"
    ATTRS{maxchild}=="6"
    ATTRS{quirks}=="0x0"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{authorized}=="1"
    ATTRS{manufacturer}=="Linux 3.2.0-2-686-pae ehci_hcd"
    ATTRS{product}=="EHCI Host Controller"
    ATTRS{serial}=="0000:02:02.0"
    ATTRS{authorized_default}=="1"

  looking at parent device 
'/devices/pci0000:00/0000:00:11.0/0000:02:02.0':
    KERNELS=="0000:02:02.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="ehci_hcd"
    ATTRS{vendor}=="0x15ad"
    ATTRS{device}=="0x0770"
    ATTRS{subsystem_vendor}=="0x15ad"
    ATTRS{subsystem_device}=="0x0770"
    ATTRS{class}=="0x0c0320"
    ATTRS{irq}=="16"
    ATTRS{local_cpus}=="ffffffff"
    ATTRS{local_cpulist}=="0-31"
    ATTRS{dma_mask_bits}=="32"
    ATTRS{consistent_dma_mask_bits}=="32"
    ATTRS{enable}=="1"
    ATTRS{broken_parity_status}=="0"
    ATTRS{msi_bus}==""
    ATTRS{companion}==""
    ATTRS{uframe_periodic_max}=="100"

  looking at parent device '/devices/pci0000:00/0000:00:11.0':
    KERNELS=="0000:00:11.0"
    SUBSYSTEMS=="pci"
    DRIVERS==""
    ATTRS{vendor}=="0x15ad"
    ATTRS{device}=="0x0790"
    ATTRS{subsystem_vendor}=="0x15ad"
    ATTRS{subsystem_device}=="0x0790"
    ATTRS{class}=="0x060401"
    ATTRS{irq}=="0"
    ATTRS{local_cpus}=="ffffffff"
    ATTRS{local_cpulist}=="0-31"
    ATTRS{dma_mask_bits}=="32"
    ATTRS{consistent_dma_mask_bits}=="32"
    ATTRS{enable}=="1"
    ATTRS{broken_parity_status}=="0"
    ATTRS{msi_bus}=="1"

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""
Gast #2642985
Lesenswert?

Rufus Τ. Firefly schrieb:
> Du meinst eine USB-Seriell-Bridge von FTDI. Wie bastelt man sich damit
> einen Cardreader?

den kauft man einfach

http://www.google.de/products/catalog?oe=utf-8&rls=org.mozilla:de:official&client=firefox-a&q=smargo+triple+reader&um=1&ie=UTF-8&tbm=shop&cid=9834880902756663036&sa=X&ei=RL-PT4n1OdK5hAecodSvBA&ved=0CDsQ8wIwAg

Konrad S. schrieb:
> Meine udev-Regeln sehen typischerweise so aus:

das wird nicht helfen, dann es sind 3 leser über einen FTTI diese will 
ich trennen
(Firma: O.D.I.S.) #2643005
Lesenswert?

Hallo Peter II,

ich nutze immer folgende Zeilen:

# BST Dual USB-Serial-Adapter (Chipset: pl2303)
SUBSYSTEMS=="usb", DRIVERS=="usb", ACTION=="add", 
ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", 
ATTRS{bcdDevice}=="0300", KERNELS=="*.1", SYMLINK+="ttyFix0"
SUBSYSTEMS=="usb", DRIVERS=="usb", ACTION=="add", 
ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", 
ATTRS{bcdDevice}=="0300", KERNELS=="*.2", SYMLINK+="ttyFix1"

# Digitus Single USB-Serial-Adapter (Chipset: FT232R)
SUBSYSTEMS=="usb", DRIVERS=="usb", ACTION=="add", 
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", 
ATTRS{bcdDevice}=="0600", ATTRS{serial}=="A700aeXw", SYMLINK+="ttyFix2"
SUBSYSTEMS=="usb", DRIVERS=="usb", ACTION=="add", 
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", 
ATTRS{bcdDevice}=="0600", ATTRS{serial}=="A800dDaK", SYMLINK+="ttyFix3"


Wie Du siehst ist die Seriennummer entscheidend.

Gruß

Olaf
(Firma: O.D.I.S.) #2643045
Lesenswert?

Dann mus Du den ATTRS-String der entsprechenden Zeile hinzufügen.
Die einzelnen kommaseparierten Strings / ATTRS sind UND-verknüpft.
Für jeden Anschluß erstellst Du eine eigene Zeile und weist
einen eigenen Symlink zu. Der ist dann immer fix.

Gruß

Olaf
Gast #2643076
Lesenswert?

Olaf Dreyer schrieb:
> Hast Du auch den udevd neu gestartet, bzw. ihn angewiesen die
> Konfiguration neu zu laden?

nein, denn die zeile ohne ATTRS{bInterfaceNumber}=="01" geht je auch 
ohne neustart. Und sie wurde später eingefügt.

Ich versteht nicht die hierarchie von dem UDEV (siehe ersten Post), denn 
es gibt ja mehre ebenen wo die Attribute sind. Wie bekommt man raus 
welche Attribute wirklich verwendbar sind?

Es gibt z.b.

ATTRS{serial}=="000003d5"
und
ATTRS{serial}=="0000:02:02.0"

woher weiss er welches der beiden er nehmen muss?
(Firma: O.D.I.S.) #2643261
Lesenswert?

Schau Dir doch mal mein Beispiel an:

Der pl2303 ist ein Dual-Port-RS232-Adapter.
Die FT232R sind zwei Single-Port-RS232-Adapter.

Bei Deinen Chip ist das Attribut ATTRS{serial}=="0000:02:02.0"
wohl die Seriennummer des Hubs (ev. auch eines internen Hubs).

Ich würde eher auf ATTRS{serial}=="000003d5" tippen.

Tip meinerseits an die Vorgehensweise:

Steck den/die Adapter an den gleichen Port dran.
Mach jeweils ein "lsusb -v" und lass über die Ausgaben ein "diff" 
laufen.

Gruß

Olaf
Gast #2643325
Lesenswert?

Olaf Dreyer schrieb:
> Bei Deinen Chip ist das Attribut ATTRS{serial}=="0000:02:02.0"
> wohl die Seriennummer des Hubs (ev. auch eines internen Hubs).
>
> Ich würde eher auf ATTRS{serial}=="000003d5" tippen.

ja das ist mir klar, war als Beispiel genannt. Die Abfrage der 
ATTRS{serial} funktioniert ja, aber nicht die Abfrage nach 
ATTRS{bInterfaceNumber}.

> Mach jeweils ein "lsusb -v" und lass über die Ausgaben ein "diff"
das habe ich auch gemacht darum habe ich geschrieben:

Das einzigste was unterschiedlich ist:

ATTRS{bInterfaceNumber}=="00"
ATTRS{bInterfaceNumber}=="01"
ATTRS{bInterfaceNumber}=="02"
Gast #2643752
Lesenswert?

Olaf Dreyer schrieb:
> poste doch mal die Ausgabe von "lsusb -d 15ad: -v"

nichts

bei

lsusb -d 0403: -v

kommt (seht aber auch schon im ersten post):

Bus 001 Device 022: ID 0403:6011 Future Technology Devices 
International, Ltd FT4232H Quad HS USB-UART/FIFO IC
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x0403 Future Technology Devices International, Ltd
  idProduct          0x6011 FT4232H Quad HS USB-UART/FIFO IC
  bcdDevice            5.00
  iManufacturer           1 Argolis
  iProduct                2 Triple Reader+
  iSerial                 3 000003d5
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           78
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              150mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              2 Triple Reader+
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              2 Triple Reader+
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              2 Triple Reader+
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x85  EP 5 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x06  EP 6 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
Device Status:     0x0000
  (Bus Powered)
Gast #2706182
Lesenswert?

Kannst Du so machen
1
SUBSYSTEMS=="usb",KERNEL=="ttyUSB*", ATTRS{interface}=="Triple Reader+",ATTRS{bInterfaceNumber}=="00", SYMLINK+="triple1"
2
SUBSYSTEMS=="usb",KERNEL=="ttyUSB*", ATTRS{interface}=="Triple Reader+",ATTRS{bInterfaceNumber}=="01", SYMLINK+="triple2"
3
SUBSYSTEMS=="usb",KERNEL=="ttyUSB*", ATTRS{interface}=="Triple Reader+",ATTRS{bInterfaceNumber}=="02", SYMLINK+="triple3"

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren