libftdi Archives

Subject: Re: Writing succeeds, but reading fails

From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Thu, 8 May 2014 12:51:35 +0200
>>>>> "Magnus" == Magnus Therning <magnus@xxxxxxxxxxxx> writes:

    Magnus> On Thu, May 8, 2014 at 10:56 AM, Uwe Bonnes
    Magnus> <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
    >>>>>>> "Magnus" == Magnus Therning <magnus@xxxxxxxxxxxx> writes:
    >> 
    Magnus> I'm completely new to using libftdi, but I'm running into
    Magnus> problems a little sooner than I'd like.  Hopefully it's
    Magnus> something silly that someone on the list quickly can point me
    Magnus> to.  I've read the API reference, and searched online without
    Magnus> finding anything that can explain the behaviour I see.
    >> 
    >> If you need plain serial communication, why don't you use
    >> /dev/ttyUSBx?

    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


    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?

Bye
-- 
Uwe Bonnes                bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
# Files in /etc/udev/rules are called sorted order until first fit is found
#
# So use a low number for own rules
# Other files may also be overwritten
#

#FX2
SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="fffe", 
ATTRS{idProduct}=="0018", GROUP:="users", MODE:="0660"
SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="fffe", 
ATTRS{idProduct}=="001a", GROUP:="users", MODE:="0660"
SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="04b4", 
ATTRS{idProduct}=="8613", RUN+="/sbin/fxload -v -t fx2 -I 
/usr/share/usrp_main.ihx -D $tempnode "

#FT2232 Adapter
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", 
ATTRS{idProduct}=="6010", GROUP:="users", MODE:="0660"
#FT232 Adapter
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", 
ATTRS{idProduct}=="6001", GROUP:="users", MODE:="0660"
#FT Adapter
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", 
ATTRS{idProduct}=="6006", GROUP:="users", MODE:="0660"
#FT230 Adapter
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", 
ATTRS{idProduct}=="6015", GROUP:="users", MODE:="0660"

ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0456", 
ATTRS{idProduct}=="b403", GROUP:="users", MODE:="0660"

SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{../manufacturer}=="IKDA", 
SYMLINK="%s{../product}_%s{../serial}_%s{bInterfaceNumber}"


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

Current Thread