I am using multiple USB devices connected to an Ubuntu machine and I would like to create a symlink to their corresponding device file so that I can read from these devices in Python.
For example, for the device "ka3305p" I created the rules file /etc/udev/rules.d/ka3305p.rules.
ATTR{idVendor}=="0416", ATTR{idProduct}=="5011", SYMLINK+="ka3305p", MODE="0660", GROUP="dialout"
When I plug in the device, I see a symlink /dev/ka3305p appear:
lrwxrwxrwx 1 root root 15 Sep 21 10:08 ka3305p -> bus/usb/001/003
However, when I try to read from this file in python I get an error message:
def __init__(self,portname='/dev/ka3305p'):
self.ser = serial.Serial(
port=portname,
baudrate=9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1
)
SerialException: Could not configure port: (25, 'Inappropriate ioctl for device')
Can I change the rules file to avoid this error?
I can read / communicate with the device normally if I use the device file /dev/ttyACM0.