无法将FT232RL设备与Pylibftdi(Thorlabs APT直流电动机控制器)连接 [英] Failed to Connect FT232RL Device with Pylibftdi (Thorlabs APT DC Motor Controller)

查看:62
本文介绍了无法将FT232RL设备与Pylibftdi(Thorlabs APT直流电动机控制器)连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Thorlabs直流电动机控制器,可以通过以下dmesg日志进行检测:

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

它也可以在lsusb下找到:

It can also be found under lsusb:

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

基于上述信息,我设置了/etc/udev/rules.d/99-libftdi.rules :

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"

(我还尝试了 users 组和 0666 模式.)

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

然后我运行命令

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

哪个产量

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'

现在是软件方面.按照以下说明将Libftdi v1.0安装在Linux Mint 17下:

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

Pylibftdi库不起作用(串行模式,UM232H)

和pylibftdi通过pip安装:

and pylibftdi is installed via pip:

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

它可以回显libftdi的正确版本:

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

但是,即使使用 sudo ,它也不会列出任何已连接的FTDI设备:

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

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

有没有一种方法可以分别测试libftdi和pylibftdi?或者,我们是否已经有足够的信息来完成这项工作?预先感谢.

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

推荐答案

未检测到该设备,因为它具有奇怪的 idProduct .官方问答集提示了一种可行的解决方案: http://pylibftdi.readthedocs.org/en/latest/how_to.html

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

打开 .../pylibftdi/examples/list_devices.py 并在第24行之后添加以下行:

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

这篇关于无法将FT232RL设备与Pylibftdi(Thorlabs APT直流电动机控制器)连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆