Menu

Unable to open con.: Composite CDC + HID Dev.

Help
2008-02-11
2012-12-06
  • Diricx Bart

    Diricx Bart - 2008-02-11

    Hi,

    I've made a composite CDC + HID device. The device has one configuration which has three interfaces. The first two are for the CDC device (Virtual COM Port) and the third is for the HID device (Generic HID device). I'm using two .inf files, one for the CDC device and one for the HID device. In the .inf file for the CDC device there's USB\VID_****&PID_****&MI_00, in the .inf file for the HID device there's USB\VID_****&PID_****&MI_02.

    My application is written in Java and I've managed to communicate over the Virtual COM Port (CDC) using the API @ rxtx.org

    Now I have some problems cummunicating with the HID device:
    I have this method for initiating the USB communication:

        public void initUSBComm(){
            // get a device instance with vendor id and product id
            dev = USB.getDevice((short) 0x0208, (short) 0x1611); // just random
            // open the device with configuration 1, interface 2 and without altinterface
            // this will initialise Libusb-win32
            try {
                dev.open(1, 2, -1);
            } catch (USBException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

    So configuration 1, interface 2. VID and PID are random values, but off course the same as in the USB device.

    This results in this exception:

    Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: ch.ntb.usb.LibusbJava.usb_error_no(I)I
        at ch.ntb.usb.LibusbJava.usb_error_no(Native Method)
        at ch.ntb.usb.LibusbJava.<clinit>(LibusbJava.java:372)
        at ch.ntb.usb.Device.initUSB(Device.java:50)
        at ch.ntb.usb.Device.open(Device.java:179)
        at usbKeypadEmulator.USBComm.initUSBComm(USBComm.java:39)
        at usbKeypadEmulator.TestApplication.initialize(TestApplication.java:61)
        at usbKeypadEmulator.TestApplication.<init>(TestApplication.java:56)
        at usbKeypadEmulator.TestApplication$7.run(TestApplication.java:395)
        at java.awt.event.InvocationEvent.dispatch(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)

    Since there's an UnsatisfiedLinkError I tried calling the dll's explicitely (the same way I succesfully call them for the rxtx API):
            System.load(System.getProperty("user.dir")+"/lib/LibusbJava.dll");
            System.load(System.getProperty("user.dir")+"/lib/libusb0.dll");
    But this doesn't solve my problem.

    Does anyone know what I did wrong? Any suggestions?

    Best regards,
    RoDeNtJe

     
    • andi

      andi - 2008-02-11

      Hi RoDeNtJe

      You probably don't have the newest dll. The method usb_error_no() has been added some time ago.
      To check which version you have right click on LibusbJava.dll and go to the tab 'Version'. The newest version is 0.2.2.0. If you are unsure which version you have, just download the current from the downloads section.
      You may also have a different version in the windows/system32 folder...

      Hope that solves the problem!

      Regards, Spandi

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.