1

I'm using libusb for communicating with usb device in java. My operating system is linux. But I have problem about open device.

    DeviceHandle handle = LibUsb.openDeviceWithVidPid(null, VENDOR_ID, PRODUCT_ID_1);

    if(handle == null){

        System.out.println("Device Not Opened");
    }else{

        System.out.println("Device Opened");
    }

I'm getting the error that "handle must not be null".

How can I solve this problem. Thanks for your reply from now.

bzkrtmurat
  • 189
  • 1
  • 3
  • 15

1 Answers1

0

I came across your question while searching for another problem. I don't usually program in Java, so there might be some slight differences in the names of the function.

I think the first step you have to do is obtain a Session Handle, which describes the entire operation you are trying to do. Then pass that session handle instead of the NULL to the function you used above.

Here's a reference to MonoUsbSessionHandler: http://libusbdotnet.sourceforge.net/V2/html/b35376bb-ab07-ee75-8c90-b9f9b12ce067.htm

jcoppens
  • 5,306
  • 6
  • 27
  • 47