slightlynybbled / di2008

Object-oriented API for DATAQ DI-2008
MIT License
5 stars 2 forks source link

Use in Linux (fedora) #14

Open comcamot opened 2 months ago

comcamot commented 2 months ago

This is not an issue, it is just a comment that might be useful for Linux users.

No additional drivers needed, but one needs to install also the pyusb library (pip install pyusb). After plugging the device, one can check it is OK by typing lsusb

the output should contain a line like

Bus 001 Device 030: ID 0683:2008 DATAQ Instruments Generic Bulk Device

with the led in "green". If it is "yellow" push the button as indicated in the Readme.

*Still, the test program does not work if run from the user account because it does not have permissions to access the USB. To be able to access the di2008 from the user account (I do not know if there is a better method) I added to the /etc/udev/rules.d/ directory the file "50-dataq.rules" containing the lines


SUBSYSTEM !="usb_device", ACTION !="add", GOTO="dataq_rules_end" SYSFS{idVendor} =="0683", SYSFS{idProduct} =="2008", SYMLINK+="dataq" MODE="0666", OWNER="yourusername", GROUP="root" LABEL="dataq_rules_end"


after that, one can access the device. However, the first three readings for each channel are (obtained by using plain print instead of the formatted print)


None None info message not understood: 'info 9\r\n 8000\r'


Then, the formatted print (print(f'{an0.value:.02f}')) stops the program. Then after changing the formatted print to plain print (print(an0.value)) everything seems two work (apart from the first 3 values)

Thanks for the library.