1

I am a beginer on USB. I found libusbdotnet on http://sourceforge.net/projects/libusbdotnet/ i am using the library. But i can't find my device by command

MyUsbDevice = UsbDevice.OpenUsbDevice(MyUsbFinder); 
//public UsbDeviceFinder MyUsbFinder = new UsbDeviceFinder(0xc251, 0x2722);

The vendor and product ID are the vender, product ID of Keil ULINK2.

MyUsbDevice always null although The USB is attached.

Thank for help!

Dai
  • 141,631
  • 28
  • 261
  • 374
  • Please format your code correctly, ensure each code line is on a new line and indent each line with 4 spaces to apply syntax highlighting. I would edit it myself but I am not sure where your line breaks are in relation to your comments – musefan Aug 26 '14 at 09:25
  • @musefan - yeah i realised that as soon as submitted my edit, but now unsure how to remove my edit because as you say it is hard to say what the desired code should be with that comment, also can;t change the UsbDeviceFinder to be in the line below as the edit does not contain enough changes to be saved – Quince Aug 26 '14 at 09:33
  • @Quince: Don't worry, it is still better than the original, and it doesn't really effect the example to have the `UsbDeviceFinder` bit in the comment. The OP can fix it if they want – musefan Aug 26 '14 at 09:38
  • check [this SO question](http://stackoverflow.com/questions/25714930/libusbdotnet-no-devices-found-when-calling-usbdevice-alldevices) out? perhaps it will help. – wiz_lee Jun 04 '15 at 10:20

1 Answers1

1

You need to download LibUsbDotNet_Setup.2.2.8.exe and run setup. During setup you should enable filter and choose your input device per your vendor id. Then your code will find the device afterwards

BachPhi
  • 142
  • 11
  • There's a NuGet option but it doesn't install this filter, nor the two libusb-1.0.dll libraries (x86 and 64 bit). All a bit of a shamozzle. – SteveCinq Jul 01 '22 at 17:40