libftdi Archives

Subject: (Re:) libftdi only works if /dev/ttyUSBx is accessed by other method first

From: Johan Ström <johan@xxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Sat, 23 Jan 2016 15:29:50 +0100
Hi,

I had a problem with a FT232R based device, the LinkUSB 1-wire dongle, and my libftdi-based owfs (software package).
The issue was, after boot and/or device reconnect, I was not able to communicate at all with my device, but once I had interacted with it using the OS serial layer, it worked perfectly fine.

Upon researching the issue I found http://developer.intra2net.com/mailarchive/html/libftdi/2012/msg00331.html, which described the
exact same issue, but gave no solution.

In my case, I found the solution!
The FreeBSD (10.2) ucom/uftdi driver (provides /dev/cuaUx from FTDI devices) will, upon first open(), set RTS and DTR to 1.
By adding ftdi_setdtr_rts(ctx, 1, 1) to my code, it now works fine even if freshly booted and/or reconnected.
I did try setting SIO_RTS_CTS_HS instead, but that did not help at all.. Also, it seems it is enough to set RTS 1 and leave DTR 0.

So, three things:
a) Pelle Windestam (whom I cannot CC, since the email is hidden), I found a solution! Maybe it works for you too :)
b) Anyone else with the same problem, try this!
c) Would it make sense for libftdi to set rts/dts defaults to 1, as both Linux and FreeBSD seems to do this (when opening as a regular serial port)? Although, devices may use RTS/DTR for any purpose, it might be best to leave it alone..?

Anyway, this info might spare someone else trying to debug it!

Regards
Johan


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


Current Thread