简体   繁体   中英

Read/Write on USB, C#

I use LibUsbDotNet to read data from USB with following code:

public static UsbDeviceFinder MyUsbFinder = new UsbDeviceFinder(Convert.ToInt32(0x046D), Convert.ToInt32(0xC06A));  
public static UsbDevice MyUsbDevice;  
MyUsbDevice = UsbDevice.OpenUsbDevice(MyUsbFinder);  

it doesn't work. can not find my USB device.
can you help me?!
you can download library and samples from here

Have you installed the necessary drivers? The help file for LibUsbDotNet says:

Before LibUsbDotNet can access a usb device on a Windows operating system the device must be installed with either WinUSB or libusb-win32 usb drivers.

Otherwise I can't see anything wrong with your code when compared to the examples.


As an aside your use of Convert.ToInt32() is redundant. This will do the same thing:

public static UsbDeviceFinder MyUsbFinder = new UsbDeviceFinder(0x046D, 0xC06A);

But that has nothing to do with your problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM