Generic HID Host Applications in JAVA

New Member
  • Total Posts : 11
  • Reward points : 0
  • Joined: 2007/04/02 18:43:25
  • Location: Hong Kong
  • Status: offline
2007/08/30 00:31:49 (permalink)

Generic HID Host Applications in JAVA

This piece of work was ported from the example codes on "The HID Page" of

4 Replies Related Threads

    humans, die, please
    • Total Posts : 53195
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: porcodioland
    • Status: offline
    RE: Generic HID Host Applications in JAVA 2007/08/30 01:42:18 (permalink)
    Cool, it might be useful to be used in some circumstances.
    I'll take a look at it.


    miami bridge is falling down, falling down ♪ :)

    Super Member
    • Total Posts : 1148
    • Reward points : 0
    • Joined: 2005/12/18 06:06:09
    • Location: UK
    • Status: offline
    RE: Generic HID Host Applications in JAVA 2007/08/30 03:28:34 (permalink)
    Few years ago I have looked into Java for cross-platform USB application development but at the time there was no compatible multiplatform USB support libraries.  Java itself does not have USB support classes built in.

    Is the situation still the same?

    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: Generic HID Host Applications in JAVA 2007/08/30 05:37:13 (permalink)
    Your best bet is still libusb. But libusb is not so good for cross-platform HID support. libhid authors have some good thoughts (using native APIs) but no time to implement it. Personally I like libusb very much and I monitor both libusb and libusb-win32 mailing list.
    There are some work on Java USB: . There seems to be some codes released but I am no so sure about the usability.
    Apparently Sun recognized this as a problem and even commit some engineers to fork libusb to a new project openusb but there are no usable codes released yet after some hot initial disscussions on the API early this year in libusb mailing list.
    New Member
    • Total Posts : 3
    • Reward points : 0
    • Joined: 2011/07/18 07:22:10
    • Location: 0
    • Status: offline
    RE: Generic HID Host Applications in JAVA 2011/08/08 01:35:46 (permalink)

    Hi there, firstly I am very grateful for your piece of code.

    However I am encountering some problems and your help will be grately appreciated. Your program is able to

    - Find HID device
    - Get input, output and feature report size
    - Read data from the device
    - write data from the device (I did not test if it sends correctly or not but I dont care)

    My purpose is to send a piece of string to PIC as send data command and to read the data sent by PIC. So I just altered your code for my purpose. However the problem I am facing is also true for your code. The problem is when write command runs, java gives ntdll.dll error and it gets out of JVM. After some tries, it does not gets out of JVM on some occasions (without touching code)

    In PIC coding I added a delay of 1 second between (get command and send data to PC) and it improved the chance of successive run.

    I have a tool that can monitor the HID port coming data. So when I run write command from the java, it surely sends to PIC and the PIC starts to send data as a response but java gives error after write command is done.

    I think I miss a point in PIC programming.  I just use functions of find device, read(doread), write(dowrite). As feature report byte it is always null.
    Jump to:
    © 2018 APG vNext Commercial Version 4.5