Cedrus RB-844 not detected by ftd2xx on Linux

Hi,

I am trying to use the RB-844 with Psychopy (v2022.2.5) on Debian 11 (bullseye) but python (v3.8.16) is unable to find the device.

import ftd2xx
devs = ftd2xx.listDevices()
for d in devs:
    dev = ftd2xx.openEx(d)
    dev.setBaudRate(115200)
    dev.setDataCharacteristics(8, 0, 0)
    dev.setTimeouts(50, 50)
    dev.setUSBParameters(64,64)
    dev.setLatencyTimer(10)
    dev.purge()
    dev.write(b'_c1')
    print(dev.read(5))
    print(dev)
    dev.close()

returns the following error:
Traceback (most recent call last):

Cell In[6], line 3
devs = ftd2xx.listDevices()

File ~/Environments/psychopy-py38/lib/python3.8/site-packages/ftd2xx/ftd2xx.py:155 in listDevices
call_ft(_ft.FT_ListDevices, ba, c.byref(n), _ft.DWORD(defines.LIST_ALL | flags))

File ~/Environments/psychopy-py38/lib/python3.8/site-packages/ftd2xx/ftd2xx.py:133 in call_ft
raise DeviceError(status)

DeviceError: DEVICE_NOT_FOUND

On a Windows 11 laptop the response box is successfully detected.

Any ideas or hints will be appreciated!

nantfawr

We cannot assist with debugging code, especially when it doesn’t even involve our own library (D2xx in this case).

Why don’t you use our pyxid2 library? You can get it from PyPi. It has all the basic functions that you would need including listing all devices.

Even if you choose not to use pyxid2 directly, it is open-sourced and you can peak to see how it handles the FTDI’s D2xx driver.

Thank you for your answer. I should of course have mentioned that I initially used pyxid2 to access the device. From the resulting error message I gathered that the error occurs in module ftd2xx and hence only posted the minimally sufficient code to (possibly) reproduce the error. When I use pyxid2 with code from one of your samples provided on github I get the same error:

import pyxid2

# get a list of all attached XID devices
devices = pyxid2.get_xid_devices()

if devices:
    print(devices)
else:
    print("No XID devices detected")
    exit()

Error message:
Traceback (most recent call last):

Cell In[1], line 4
devices = pyxid2.get_xid_devices()

File ~/Environments/psychopy-py38/lib/python3.8/site-packages/pyxid2/init.py:10 in get_xid_devices
scanner = XidScanner()

File ~/Environments/psychopy-py38/lib/python3.8/site-packages/pyxid2/pyxid_impl.py:18 in init
self.detect_xid_devices()

File ~/Environments/psychopy-py38/lib/python3.8/site-packages/pyxid2/pyxid_impl.py:28 in detect_xid_devices
devs = ftd2xx.listDevices()

File ~/Environments/psychopy-py38/lib/python3.8/site-packages/ftd2xx/ftd2xx.py:155 in listDevices
call_ft(_ft.FT_ListDevices, ba, c.byref(n), _ft.DWORD(defines.LIST_ALL | flags))

File ~/Environments/psychopy-py38/lib/python3.8/site-packages/ftd2xx/ftd2xx.py:133 in call_ft
raise DeviceError(status)

DeviceError: DEVICE_NOT_FOUND

Thank you in advance for any pointers!

nantfawr

Thank you for clarifying.

I frankly don’t know what to recommend from here. On Windows or Mac, I would have suggested that you start with our Xidon 2 software to make sure that there is no hardware fault and that the USB driver is installed. Alas, we don’t support Linux.

This might not be the same error, but I had 2 system configuration tweaks needed before pyxid2 would work on linux for me

  1. add user to the group that owns the /dev/ttyUSB0 device
  2. remove the conflicting ftdi_sio module

Started with a snanity check. I see the DEVICE_NOT_FOUNDerror but dmesg shows the system sees the device

import ftd2xx; devs = ftd2xx.listDevices() # DeviceError: DEVICE_NOT_FOUND
import pyxid2; pyxid2.get_xid_devices()    #  []

dmesg -w

[ 5742.201934] usb 1-8.1: new full-speed USB device number 9 using xhci_hcd
[ 5742.295968] usb 1-8.1: New USB device found, idVendor=0403, idProduct=6001, bcdDevice= 6.00
[ 5742.295983] usb 1-8.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 5742.295988] usb 1-8.1: Product: FT232R USB UART
[ 5742.295992] usb 1-8.1: Manufacturer: FTDI
[ 5742.303576] ftdi_sio 1-8.1:1.0: FTDI USB Serial Device converter detected
[ 5742.303629] usb 1-8.1: Detected FT232R
[ 5742.304366] usb 1-8.1: FTDI USB Serial Device converter now attached to ttyUSB0

dialouthas default read-write acccess, so I added my user to that

ls -l /dev/ttyUSB0
# crw-rw---- 1 root dialout 188, 0 Oct 29 16:02 /dev/ttyUSB0

gpasswd -a lncd dialout
# Adding user lncd to group dialout`

But still can’t find the device. The (slower?) open source pyftdi does though. Looks like the problem is ftdi_sio (for what it’s worth, I haven’t figured out how to successfully add blacklist ftdi_sio to a /etc/modules.conf/blacklist.conf file. Something else must be pulling it in on Debian sid)

# libusb shows the device!
python3 -c 'from pyftdi.ftdi import Ftdi; print(Ftdi.show_devices())'
# Available interfaces:
#  ftdi://ftdi:232:1:8/1  (FT232R USB UART)


# but ftd2xx and downstream pyxid2 do not
python3 -c 'import ftd2xx as ft; print(ft.listDevices())'
# [b'']

python3 -c 'import pyxid2; print(pyxid2.get_xid_devices())'
# []


### remove conflicting module!
sudo /sbin/rmmod ftdi_sio

# pyxid2 finds it!
python3 -c 'import pyxid2; print(pyxid2.get_xid_devices())'
# [<XidDevice "Cedrus RB-840">]
1 Like