Failed to Connect FT232RL Device with Pylibftdi (Thorlabs APT DC Motor Controller)

我是研究僧i 提交于 2020-01-03 01:58:27

问题


I have a Thorlabs DC motor controller, which can be detected with the following dmesg log:

usb 5-2: new full-speed USB device number 6 using uhci_hcd
usb 5-2: New USB device found, idVendor=0403, idProduct=faf0
usb 5-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 5-2: Product: APT DC Motor Controller
usb 5-2: Manufacturer: Thorlabs
usb 5-2: SerialNumber: 83858610
ftdi_sio 5-2:1.0: FTDI USB Serial Device converter detected
usb 5-2: Detected FT232RL
usb 5-2: Number of endpoints 2
usb 5-2: Endpoint 1 MaxPacketSize 64
usb 5-2: Endpoint 2 MaxPacketSize 64
usb 5-2: Setting MaxPacketSize 64
usb 5-2: FTDI USB Serial Device converter now attached to ttyUSB0

It can also be found under lsusb:

Bus 005 Device 007: ID 0403:faf0 Future Technology Devices International, Ltd

Based on above information, I set up /etc/udev/rules.d/99-libftdi.rules:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="faf0", GROUP="dialout", MODE="0660"

(I have also tried users group and 0666 mode.)

And then I ran the command

$ udevadm test -a -p  $(udevadm info -q path -n /dev/ttyUSB0)

Which yields

GROUP 20 /etc/udev/rules.d/99-libftdi.rules:1
MODE 0660 /etc/udev/rules.d/99-libftdi.rules:1
handling device node '/dev/ttyUSB0', devnum=c188:0, mode=0660, uid=0, gid=20
preserve permissions /dev/ttyUSB0, 020660, uid=0, gid=20
preserve already existing symlink '/dev/char/188:0' to '../ttyUSB0'
found 'c188:0' claiming '/run/udev/links/\x2fserial\x2fby-id\x2fusb-Thorlabs_APT_DC_Motor_Controller_83858610-if00-port0'
creating link '/dev/serial/by-id/usb-Thorlabs_APT_DC_Motor_Controller_83858610-if00-port0' to '/dev/ttyUSB0'
preserve already existing symlink '/dev/serial/by-id/usb-Thorlabs_APT_DC_Motor_Controller_83858610-if00-port0' to '../../ttyUSB0'
found 'c188:0' claiming '/run/udev/links/\x2fserial\x2fby-path\x2fpci-0000:00:1d.0-usb-0:2:1.0-port0'
creating link '/dev/serial/by-path/pci-0000:00:1d.0-usb-0:2:1.0-port0' to '/dev/ttyUSB0'
preserve already existing symlink '/dev/serial/by-path/pci-0000:00:1d.0-usb-0:2:1.0-port0' to '../../ttyUSB0'

Now for the software side. Libftdi v1.0 is installed under Linux Mint 17 by following instruction:

Pylibftdi library not working (serial mode, UM232H)

and pylibftdi is installed via pip:

$ sudo -H env PATH=$PATH pip install pylibftdi

It can echo the correct version of libftdi:

$ python -m pylibftdi.examples.info

pylibftdi version     : 0.15.0
libftdi version       : libftdi_version(major=1, minor=0, micro=0, version_str='1.0', snapshot_str='v1.0')
libftdi library name  : libftdi1.so.2
libusb version        : libusb_version(major=1, minor=0, micro=17, nano=10830, rc='', describe='http://libusbx.org')
libusb library name   : libusb-1.0.so.0
Python version        : 2.7.10
OS platform           : Linux-3.13.0-37-generic-x86_64-with-debian-jessie-sid

However, it won't list any connected FTDI devices, even with sudo:

$ sudo python -m pylibftdi.examples.list_devices
$ (nothing printed)

Is there a way to test libftdi and pylibftdi individually? Or, do we already have enough information to get this work? Thanks in advance.


回答1:


The device is not detected because it has a weird idProduct. Official Q&A gives a hint to a viable solution: http://pylibftdi.readthedocs.org/en/latest/how_to.html

Open up .../pylibftdi/examples/list_devices.py and add following lines after line 24:

from pylibftdi import USB_PID_LIST
USB_PID_LIST.append(0xfaf0)

and try to fire the command again:

$ python -m pylibftdi.examples.list_devices
Thorlabs:APT DC Motor Controller:83858610


来源:https://stackoverflow.com/questions/31143376/failed-to-connect-ft232rl-device-with-pylibftdi-thorlabs-apt-dc-motor-controlle

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!