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)
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
add user to the group that owns the /dev/ttyUSB0 device
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">]