LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting to USB devices with libusb-win32, is it possible?

Hi David,

    The device is not listed in the VISA interactive control.

What should i do to make the device recognized in the VISA interactive control.

 

 

 

 

0 Kudos
Message 21 of 29
(5,398 Views)

Not all USB devices will or should be listed in MAX. For example, mice, keyboards, and other USB HID devices will not be listed. Exactly how is the device described in windows device manager? What is the actual device you are trying to communicate to? Does it come with it's own windows driver? If so, did you remove that driver before trying to create an NI-VISA driver.Earlier, you mentioned USBTMC. Do you know for a fact that the device driver from the vendor is USBTMC?

 

There are numerous ways to communicate to USB devices and NI-VISA is just one option and not always the best one. To help, you have to provide a lot more information. 

Message 22 of 29
(5,395 Views)

Hi Denis,

   >>Exactly how is the device described in windows device manager?

     The device is listed as LibUSB-win32 Devices in the device manager.

>>What is the actual device you are trying to communicate to? Does it come with it's own windows driver?
  The device did not come along with windows.
   I downloaded the driver files from the following link
   http://libusb-win32.sourceforge.net
>>If so, did you remove that driver before trying to create an NI-VISA driver.
  NO.
>>Do you know for a fact that the device driver from the vendor is USBTMC?
  Since the device is detected by the windows after consulting with NI Support engineer i confirmed that the device is USBTMC.


0 Kudos
Message 23 of 29
(5,385 Views)

A libusb device is not USBTMC. The actual device is something that you created? If so, you should be familiar enough to create an NI-VISA inf filw with the wizard and use the USB functions. You've already gotten links to a tutorial on how to do that. If you want to keep the driver you downloaded, I believe you will have to use the libusb0.dll with the Call Library function node. In that case, the device will not appear in MAX.

 

If this is not a device you designed, I ask again what it is? Do you have details on the USB protocol it implements from the vendor? If yu don't, using the libusb functions or NI-VISA functions are going to be difficult if not impossible.
Message 24 of 29
(5,380 Views)

@Dennis Knutson wrote:

 

If this is not a device you designed, I ask again what it is? Do you have details on the USB protocol it implements from the vendor? If yu don't, using the libusb functions or NI-VISA functions are going to be difficult if not impossible.

I would even say that unless you have either written some other VISA raw or libusb based drivers already or at least designed an USB device from ground up, AND also have access to a real USB analyzer (a physical device, not those Windows executables claiming to be one) it is simply impossible to talk to a USB device on both VISA raw or libusb level without detailed information from the manufacturer about the bytestreamprotocols used. Difficult would be a big understatement here.

 

Rolf Kalbermatter

Rolf Kalbermatter
My Blog
Message 25 of 29
(5,367 Views)

"I just finished using libusb with LabVIEW 8.5.  The way to do it is to create a C language DLL that wraps around the libusb.dll.  This way you can abstract away any incompatible structs, handles, etc.  We started with 4 entry points: openUSB, readUSB, writeUSB and closeUSB.  The read and write DLL functions call the "bulk" I/O functions.  The open DLL function calls the "init", "find" and "open" functions.  The close DLL function calls the "release" and "reset" functions.  So far, everything is working great.

WB"

 

Hello wwwbrown.

 

How did you pass the handle to your device between your readUSB and writeUSB functions? I'm having trouble passing the structures around.

 

Basically how exactly are you abstracting away everything?

 

Thanks

Message Edited by crazyjay on 02-15-2010 08:00 PM
0 Kudos
Message 26 of 29
(4,924 Views)

wwwbrown -

Any chance you could email your source code for the DLL wrapper?  I use pyusb with Python to talk to libusb but have a friend who uses Labview who asked how he can talk to my instrument - I'm not the greatest C programmer (I can usually kludge stuff together in C but starting from scratch is not my forte).   My email is mstevens1107 at gmail "dot" com

-Hyped

 

0 Kudos
Message 27 of 29
(4,558 Views)

Hello,

 

Does someone made a code with Labwindows CVI using this Lib?

 

Thanks.

0 Kudos
Message 28 of 29
(4,122 Views)

@Engima wrote:

Hello,

 

Does someone made a code with Labwindows CVI using this Lib?


libusb having really a C API it would be as simple as adding the correct include directory for the libusb headers to your CVI project and adding the according Visual C import library for the build DLL to your project and then starting to program. No it won't be as easy as selecting a LabWindows CVI instrument driver library and filling in function panels for adding calls to the library to your code (although with enough determination creating such an instrument driver wouldn't really be to difficult) but there is no special magic to calling a library like libusb to any other DLL library you might want to include in your project.

Rolf Kalbermatter
My Blog
0 Kudos
Message 29 of 29
(2,627 Views)