ftdi d2xx conflict with ftdi_sio on linux - How to remove ftdi_sio automatically
Asked Answered
D

3

7

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?

Dialect answered 29/11, 2015 at 8:59 Comment(0)
D
0

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.

Dialect answered 18/5, 2016 at 15:47 Comment(0)
P
5

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'"
Publisher answered 1/12, 2015 at 13:35 Comment(3)
No luck. I've added that to 99-ftdi-sio.rule, then tried reloading rules with sudo udevadm control --reload-rules then connected the device again, lsmod | grep ftdi still shows ftdi_sio and usbserial mods loaded.Dialect
Also, I got the vendor and product from lsusb: Bus 002 Device 006: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC 0403 for vendor, 6001 for product.Dialect
File should be called somename.rules not .rule Try to unload only ftdi_sio at first. It worked for me. Also is rmmod visible or should be /sbin/rmmod ?Publisher
D
0

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.

Dialect answered 18/5, 2016 at 15:47 Comment(0)
C
-2

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. :)

Coparcener answered 3/12, 2015 at 12:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.