Skip to content

Bug with udev symlink and pySerial #14

@xerxes1986

Description

@xerxes1986

I have finally found a udev rule that assigns a consistent link to the coldbox (instead of the random /dev/ttyUSB#) which is:

ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", GROUP="usb", MODE="0664", SYMLINK+="ttyUSBColdbox"

The problem is that this symlink creates a link to the wrong thing. For example, the coldbox is /dev/ttyUSB0 but the symlink /dev/ttyUSBColdbox points to bus/usb/003/005 instead of /dev/ttyUSB0. When trying to run the coldbox client, it gives the following error:

fnalpix2@fnalpix2-Inspiron-660:~/elComandante/coolingBox$ ./coolingBoxClient.py -d /dev/ttyUSBColdbox 
    |  CoolingBoxLog: Set Logfile to "./CoolingBox.log"
SerialPort: /dev/ttyUSBColdbox
Could not initialize Jumo. Try again: 1/10, Could not configure port: (25, 'Inappropriate ioctl for device')
Exception AttributeError: "jumo_coolingBox instance has no attribute 'controlling'" in <bound method jumo_coolingBox.__del__ of <jumo_coolingBox.jumo_coolingBox instance at 0x2600950>> ignored

The solution I've found for now is to use the automatically created symlinks in /dev/serial/by-id/:

fnalpix2@fnalpix2-Inspiron-660:~/elComandante/coolingBox$ ls -alh /dev/serial/by-id/usb-FTDI_USB__-__Serial-if00-port0 
lrwxrwxrwx 1 root root 13 Jun  9 15:43 /dev/serial/by-id/usb-FTDI_USB__-__Serial-if00-port0 -> ../../ttyUSB0

I think these symlinks will work, but I was hoping the symlink option in udev would work as it seems like it would be more consistent across platforms. Has anyone gotten this to work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions