libftdi Archives

Subject: Re: Writing succeeds, but reading fails

From: Ryan Tennill <rtennill@xxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Thu, 08 May 2014 08:28:22 -0500

On 5/8/2014 7:15 AM, Magnus Therning wrote:
On Thu, May 8, 2014 at 12:51 PM, Uwe Bonnes
<bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
"Magnus" == Magnus Therning <magnus@xxxxxxxxxxxx> writes:
     Magnus> The full application I want to port uses ftd2xx to find devices
     Magnus> to talk to, I think doing that discovery is easiest via libftdi.
     Magnus> However, maybe a combination works well enough, as long as I
     Magnus> somehow can tie the items in a `ftdi_device_list` to
     Magnus> /dev/ttyUSBx somehow.

To name the kernel device, I use udev. Look at appended udev rule. I program
deviced like:
usb 3-10: new full-speed USB device number 7 using xhci_hcd
usb 3-10: New USB device found, idVendor=0403, idProduct=6001
usb 3-10: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 3-10: Product: CPS_CONN
usb 3-10: Manufacturer: IKDA
usb 3-10: SerialNumber: 0003

and the udev rule created a link like:
crw-rw----  1 root dialout 188,   0  8. Mai 12:00 ttyUSB0
lrwxrwxrwx  1 root root           7  8. Mai 12:00 CPS_CONN_0003_00 -> ttyUSB0
Yes, I did find some mentions of using udev to generate names for
devices.  It's neat on one level, but I have to say I'm not
enthusiastic about users having to install extra udev rules just to
use the program.  It may very well be the best way though as
everything points to it being impossible to tie a `libusb_device` to a
`/dev/ttyUSBx` in an easy way, apparently one has to go via sysfs :(

Thanks for the udev rule file, the ones I've found have not been as
clear and easy to follow.

     Magnus> Then it's of course also irritating; serial communication via
     Magnus> libftdi ought to work, right? ;)

Well, is should. I tested your program on my own hardware with loopback
here, and nothing is read too. Perhaps somebody else has any hints?
Hopefully, but in any case you have given me a way to proceed now, and
you've even removed the dependency on libftdi ;)

/M


In my experience (Linux, same device) I had to explicitly set RTS to get bidirectional coms. I ran out of time to see if I only needed to do it once so I set RTS accordingly before and after a block of my code runs. This appears to be working but at a much slower baud of 115.2k 8N1 in a system using 60 devices. The target OS is Ubuntu 12.04 but runs on 10.04 and 13.10 as well if that's of any use.
rv = ftdi_set_rts(ftdi,0);

Ryan

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