libftdi Archives

Subject: RE: Disconnect by usbfs, /dev/ttyUSB0 disappears when using libftdi

From: "Michael Plante" <michael.plante@xxxxxxxxx>
To: <libftdi@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 3 Jun 2011 07:45:11 -0400
Michael Soire wrote:
>> I am using a 4 port ftdi chip TYPE_4232H. When I plug in my ftdi4232H
hardware I see 4 new devices, /dev/ttyUSB0, /dev/ttyUSB1, /dev/ttyUSB2 and
/dev/ttyUSB3.
>>
>> After I run an application using libftdi such as the example "simple.c" I
find /dev/ttyUSB0 has disappear. If I unplug, then plugin the ftdi4232H
hardware all four /dev/ttyUSBn device come back.
>>
>> Dmesg shows:
>> ftdi_sio 2-2.2:1.0: disconnect by usbfs
>> ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from
ttyUSB0
>> ftdi_sio 2-2.2:1.0: device disconnected
>>
>> How do I use libftdi without disconnecting the serial device convertor
from ttyUSB0?


libftdi detaches ftdi_sio so it can use libusb which uses usbfs.
ftdi_usb_open_dev() calls libusb_detach_kernel_driver() in libftdi-1 and
usb_detach_kernel_driver_np() in libftdi-0.  Maybe the corresponding
reattach call will help at the end of your program, after you close the
device.  Alternatively, I think there might be something you can do from the
shell in /proc or /sys or something if you don't want to modify your code or
if it crashes before it can clean up, but I don't remember what.  ftdi_sio
is responsible for /dev/ttyUSB* on ftdi devices.

Incidentally, while searching, I noticed the comments above
ftdi_usb_open_dev() in libusb-1 have a typo:

-\retval -11: libusb_etach_kernel_driver() failed
+\retval -11: libusb_detach_kernel_driver() failed

Regards,
Michael


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread