usb.linux
Class HID

java.lang.Object
  |
  +--usb.linux.HID

public class HID
extends java.lang.Object

Simple Linux-specific HID access, using the kernel hid and evdev driver modules. If you have both of those modules loaded, you may use this class; if neither is loaded, you may be able to write a pure Java HID driver; otherwise, you can't currently access HID devices.

This is experimental, and its documentation and functionality is known to be incomplete. Experiment! You'll likely want the HID spec in hand.


Inner Class Summary
static class HID.Event
          Encapsulates HID i/o event reports.
 
Constructor Summary
HID(Device dev)
          Constructs a HID object associated with the device's single HID interface.
HID(Interface intf)
          Constructs a HID object associated with a given interface.
 
Method Summary
 void close()
          Closes the underlying "event device" file handle
static void main(java.lang.String[] argv)
           
 HID.Event readEvent()
          Blocks until an input event is reported.
 void sendEvent(HID.Event event)
          Sends an event (not repeated).
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HID

public HID(Device dev)
    throws java.io.IOException
Constructs a HID object associated with the device's single HID interface.
Throws:
java.lang.IllegalArgumentException - if the device doesn't have exactly one HID interface, or it's not claimed by the kernel HID driver
java.io.IOException - if it can't find the input device or has difficulty examining the device configuration

HID

public HID(Interface intf)
    throws java.io.IOException
Constructs a HID object associated with a given interface.
Throws:
java.lang.IllegalArgumentException - if the interface is not claimed by the kernel HID driver
java.io.IOException - if it can't find the input device
Method Detail

close

public void close()
Closes the underlying "event device" file handle

sendEvent

public void sendEvent(HID.Event event)
               throws java.io.IOException
Sends an event (not repeated).

readEvent

public HID.Event readEvent()
                    throws java.io.IOException
Blocks until an input event is reported.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] argv)


Associated source code is licenced under the LGPL.
See http://jusb.sourceforge.net
This documentation was derived from that source code on 24-Jul-2002.