I have a rf-reader with ftdio usb to serial chip. I was able to write a program to control it using ftdi d2xx library. So far so good.
The issue is that when the reader is reconnected to the PC I have to remove ftdi_sio and usbserial mods using this command:
sudo rmmod ftdi_sio
sudo rmmod usbserial
I can't use ftdi d2xx library to connect to the reader if I don't run the code.
I want to be able to add a udev rule so whenever the reader is connected kernel unload the ftdi_sio and usbserial (or not load them in first place)
I've added a new udev rul to /etc/udev/rules.d with name 99-ftdi-sio.rule
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", RUN+="/bin/sh -c 'rmmod ftdi_sio && rmmod usbserial'"
but it's not working. Anyone has any ideas how to solve this issue?
is idVendor and idProduct correct ?
Then try:
ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", MODE="0666", RUN+="/bin/sh -c 'rmmod ftdi_sio && rmmod usbserial'"
If you know the device number you can try this script instead:
RUN+="/bin/sh -c 'echo -n 1-1:1.0 > /sys/bus/usb/drivers/ftdi_sio/unbind'"
I was able to fix the problem by using a different library.
Instead of d2xx
library, I started using pylibftdi
which is based on libftdi
and it's not sensitive to ftdi_sio
.
Insted of adding a new file .rules, i added that new rule line in the 70-persistent-ipoib.rules already existent and worked for me. :)
来源:https://stackoverflow.com/questions/33981056/ftdi-d2xx-conflict-with-ftdi-sio-on-linux-how-to-remove-ftdi-sio-automatically