0

I hope someone can help me with this one.

I am trying to connect a spectrometer device (ThorLabs vendor) via a USB interface in a Linux environment (I am using openSUSE 15.1). However, this manufacturer only supports Windows systems but, because it included the driver source code in it's software bundle, I believe it is possible to compile the drivers in Linux to use the device. The only thing that seems to be required are VISA libraries to communicate with USB interface, which I was glad to know are available in Linux via NI-VISA (NI-VISA for Linux).

So thus far I have compiled the device driver source code on my Linux machine, but the problem is that I am still unable to interact with the device. However, here's what I managed to know so far:

  • Using the command lsusb in Linux shows the vendor (0x1313) and product IDs (0x8080), but not the serial number. Also the product ID is not what I expect to see, which is 0x8081.
    $ lsusb
    Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 001 Device 003: ID 04f2:b685 Chicony Electronics Co., Ltd 
    Bus 001 Device 002: ID 06cb:00a8 Synaptics, Inc. 
    Bus 001 Device 004: ID 8087:0029 Intel Corp. 
    Bus 001 Device 005: ID 1313:8080 ThorLabs 
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
  • The results of usb-devices show that my device does not have a driver attached to it. However I do not know how I could do it with my compiled driver library.
    T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  5 Spd=480 MxCh= 0
    D:  Ver= 2.00 Cls=ff(vend.) Sub=ff Prot=ff MxPS=64 #Cfgs=  1
    P:  Vendor=1313 ProdID=8080 Rev=00.00
    C:  #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
    I:  If#= 0 Alt= 0 #EPs= 0 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
  • Used pyvisa python package to list all interfaces with the libvisa.so backend. This did not return my device, even when passing the query ?*.

  • This page (https://zone.ni.com/reference/en-XX/help/370131S-01/ni-visa/configuringni-visarecognizerawusbdevice/) explains how to configure NI-VISA for RAW devices (this is actually the case for my device). It mentions that it requires kernel support for usbfs. However, after some reading it seems this feature is old and not used on modern distros. Actually, I tried to mount the device anyway but did not find any entry for it in /dev, or at least nothing I could recognize it to be.

Although I am fairly comfortable with Linux systems I never dealt in depth with the intricacies of hardware configuration. At this point I am out of ideas. What else should I look for to debug this issue? Can I somehow define my compiled driver to handle the device, since in the second point above shows no driver connected to it? Any hints/suggestions would be greatly appreciated!

EDIT: Clarified context for issue. Added NI-VISA reference.

1
  • I am currently trying to get Thorlabs CCS200 spectrometre work under Linux; a trouble is in that it apparently does not report correctly in open-source VISA (using RAW class). Recently I have asked Thorlabs for some guidance writing a low-level USB protocol for Python.
    – dominecf
    Commented Feb 22, 2021 at 11:02

1 Answer 1

0

I know this is a stupid question, but sometimes they need to be asked. Assuming that the module was compiled out-of-tree, have you installed it and made sure that it's loaded (modprobe etc.)?

12
  • I wouldn't definitely think of it as a stupid question because I am just starting to learn how to do this stuff. And I guess I may need more steps to make it work. I just compiled the driver libraries for the device and not really sure how to go from here to actually make them available in my system to recognize the device. What next steps should I be looking for?
    – marqsman
    Commented Oct 8, 2020 at 9:40
  • Take a look for any file named INSTALL or README- although they might just be generic. You are likely to find that there will be a separate make install stage which (a) inserts the module file into the right place in /lib/modules, and (b) you might also find it necessary to use modprobe explicitly after plugging in the device if udev etc. doesn't know about it. In extremis look at the Makefile and see if there's an install section in it, which will probably run depmod as its final action. Commented Oct 8, 2020 at 9:55
  • That's where I get into trouble. I don't have any README or INSTALL files for the driver, just a C file with the source code and a couple header files. The driver was originally compiled and included with ThorLabs software for Windows to use this device. I was lucky that the vendor included the source code in the original software bundle. I basically had to track down the required libraries for Linux to compile it. So after reading your answer I am thinking that I may have to make some more tinkering with the source file to compile it.
    – marqsman
    Commented Oct 11, 2020 at 19:57
  • I might have been making the wrong assumption (based on your reference to "driver source code") that you were building a kernel module. Where did you get the source stuff from and did it have a makefile? Commented Oct 11, 2020 at 20:35
  • Sorry if I wasn't clear in providing context for this issue. The manufacturer (ThorLabs) provided the driver source code containing the required functions to communicate with the device (e.g. collecting data, checking device status, etc.). The catch is that it was intended to be used on Windows systems, although I think it's possible to build it to work on Linux. No makefile was available, only the C code for the device driver and some header files for libraries. Until now I managed to compile it linking the required libraries but was unable to make it visible on Linux.
    – marqsman
    Commented Oct 12, 2020 at 8:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .