# FTDI FT232RL USB<->USART and new udev-197

## cz0

Hello folks!

Well, seems new udev is a pain not only for me, but here is my story. Being and embedded developer for a long period, I have my AVR programmer, based on FTDI FT232RL USB to USART bridge with me for years now. Besides, I have a number of devices and some other stuff I need to talk to my PC, based on same FT232RL bridge (and all of them emerge as ttyUSBn in system). So, not to make a mess, I wrote a simple udev rule, the after my programmed is plugged in, name it as /dev/avrusb500v2 and make a symlink to this name from the original kernel device name like ttyUSBn.

cat /etc/udev/rules.d/09--avrusb500v2.rules

```

KERNEL=="ttyUSB[0-9]*", ATTRS{product}=="AVRUsb500v2", ATTRS{idProduct}=="6001", ATTRS{idVendor}=="0403", NAME="avrusb500v2", SYMLINK="%k", GROUP="uucp", MODE="0660"
```

That used to work perfectly until the udev-197 came to life. Now udev ignores this and names programmer as a regular /dev/ttyUSBn, where n - number of such devices attached to the system at this moment. Sure, I have "product" variable programmed into FT232RL EEPROM, so it shows up in lsusb -v like this:

```

Bus 006 Device 009: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC

Device Descriptor:

  bLength                18

  bDescriptorType         1

  bcdUSB               2.00

  bDeviceClass            0 (Defined at Interface level)

  bDeviceSubClass         0 

  bDeviceProtocol         0 

  bMaxPacketSize0         8

  idVendor           0x0403 Future Technology Devices International, Ltd

  idProduct          0x6001 FT232 USB-Serial (UART) IC

  bcdDevice            6.00

  iManufacturer           1 cz0

  iProduct                2 AVRUsb500v2

  iSerial                 3 A4QTO6NI

  bNumConfigurations      1

  Configuration Descriptor:

    bLength                 9

    bDescriptorType         2

    wTotalLength           32

    bNumInterfaces          1

    bConfigurationValue     1

    iConfiguration          0 

    bmAttributes         0xa0

      (Bus Powered)

      Remote Wakeup

    MaxPower               90mA

    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 AVRUsb500v2

      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

Device Status:     0x0000

  (Bus Powered)

```

Here is what udevadm monitor --kernel --udev --property shows while connecting the programmer:

```

monitor will print the received events for:

UDEV - the event which udev sends out after rule processing

KERNEL - the kernel uevent

KERNEL[251155.094230] add      /devices/pci0000:00/0000:00:1d.0/usb6/6-1 (usb)

ACTION=add

BUSNUM=006

DEVNAME=/dev/bus/usb/006/013

DEVNUM=013

DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb6/6-1

DEVTYPE=usb_device

MAJOR=189

MINOR=652

PRODUCT=403/6001/600

SEQNUM=20692

SUBSYSTEM=usb

TYPE=0/0/0

KERNEL[251155.101071] add      /devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.0 (usb)

ACTION=add

DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.0

DEVTYPE=usb_interface

INTERFACE=255/255/255

MODALIAS=usb:v0403p6001d0600dc00dsc00dp00icFFiscFFipFF

PRODUCT=403/6001/600

SEQNUM=20693

SUBSYSTEM=usb

TYPE=0/0/0

KERNEL[251155.101156] add      /devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.0/ttyUSB0 (usb-serial)

ACTION=add

DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.0/ttyUSB0

SEQNUM=20694

SUBSYSTEM=usb-serial

KERNEL[251155.103102] add      /devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.0/ttyUSB0/tty/ttyUSB0 (tty)

ACTION=add

DEVNAME=/dev/ttyUSB0

DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.0/ttyUSB0/tty/ttyUSB0

MAJOR=188

MINOR=0

SEQNUM=20695

SUBSYSTEM=tty

UDEV  [251155.116463] add      /devices/pci0000:00/0000:00:1d.0/usb6/6-1 (usb)

ACTION=add

BUSNUM=006

DEVNAME=/dev/bus/usb/006/013

DEVNUM=013

DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb6/6-1

DEVTYPE=usb_device

ID_BUS=usb

ID_MODEL=AVRUsb500v2

ID_MODEL_ENC=AVRUsb500v2

ID_MODEL_ID=6001

ID_PRODUCT_FROM_DATABASE=FT232 USB-Serial (UART) IC

ID_REVISION=0600

ID_SERIAL=cz0_AVRUsb500v2_A4QTO6NI

ID_SERIAL_SHORT=A4QTO6NI

ID_USB_INTERFACES=:ffffff:

ID_VENDOR=cz0

ID_VENDOR_ENC=cz0

ID_VENDOR_FROM_DATABASE=Future Technology Devices International, Ltd

ID_VENDOR_ID=0403

MAJOR=189

MINOR=652

PRODUCT=403/6001/600

SEQNUM=20692

SUBSYSTEM=usb

TYPE=0/0/0

USEC_INITIALIZED=1155094234

UDEV  [251155.117355] add      /devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.0 (usb)

ACTION=add

DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.0

DEVTYPE=usb_interface

ID_PRODUCT_FROM_DATABASE=FT232 USB-Serial (UART) IC

ID_VENDOR_FROM_DATABASE=Future Technology Devices International, Ltd

INTERFACE=255/255/255

MODALIAS=usb:v0403p6001d0600dc00dsc00dp00icFFiscFFipFF

PRODUCT=403/6001/600

SEQNUM=20693

SUBSYSTEM=usb

TYPE=0/0/0

USEC_INITIALIZED=55101115

UDEV  [251155.117766] add      /devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.0/ttyUSB0 (usb-serial)

ACTION=add

DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.0/ttyUSB0

SEQNUM=20694

SUBSYSTEM=usb-serial

USEC_INITIALIZED=55101134

UDEV  [251155.118765] add      /devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.0/ttyUSB0/tty/ttyUSB0 (tty)

ACTION=add

DEVLINKS=/dev/serial/by-id/usb-cz0_AVRUsb500v2_A4QTO6NI-if00-port0 /dev/serial/by-path/pci-0000:00:1d.0-usb-0:1:1.0-port0 /dev/ttyUSB0

DEVNAME=/dev/ttyUSB0

DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.0/ttyUSB0/tty/ttyUSB0

ID_BUS=usb

ID_MODEL=AVRUsb500v2

ID_MODEL_ENC=AVRUsb500v2

ID_MODEL_ID=6001

ID_PATH=pci-0000:00:1d.0-usb-0:1:1.0

ID_PATH_TAG=pci-0000_00_1d_0-usb-0_1_1_0

ID_PRODUCT_FROM_DATABASE=FT232 USB-Serial (UART) IC

ID_REVISION=0600

ID_SERIAL=cz0_AVRUsb500v2_A4QTO6NI

ID_SERIAL_SHORT=A4QTO6NI

ID_TYPE=generic

ID_USB_DRIVER=ftdi_sio

ID_USB_INTERFACES=:ffffff:

ID_USB_INTERFACE_NUM=00

ID_VENDOR=cz0

ID_VENDOR_ENC=cz0

ID_VENDOR_FROM_DATABASE=Future Technology Devices International, Ltd

ID_VENDOR_ID=0403

MAJOR=188

MINOR=0

SEQNUM=20695

SUBSYSTEM=tty

USEC_INITIALIZED=55103130

```

I played with rule, but without any luck. Besides, I tried to use this rule on machine, running udev-172, and it works just perfect, giving me /dev/avrusb500v2 device with a symlink to /dev/ttyUSB0. So, what should be done to get this little thing work again?

----------

## cz0

Seems it somehow connected with NAME parameter. If I cut it out and leave only SYMLINK+="avrusb500v2", it work flawlessly, making /dev/ttyUSBn as a primary device file and a symlink /dev/avrusb500v2 , pointing to it.

----------

