MSP430 Java HID Demo App -- Release Notes
Welcome to the MSP430 Java HID USB Demo App! This is an
example of a host-side HID application. It's designed to use the
HID-Datapipe format (see the Programmer's Guide for more information).
However, it could also be used for any custom HID device -- that is, an
HID device not driven directly by the OS, like a mouse/keyboard.
The project is composed
of a Java GUI and C drivers. The communication between Java
and the C
drivers is Java Native Interface (JNI) based. This means
there
is an accompanying SO in the same path as the *.jar file that contains
the native calls.
This document is divided into the following sections:
The HID
Demo App can be run with any of the HID-Datapipe examples included in
the USB Developers Package. Please refer to the Examples Guide in the
Developers Package for usage information.
The Hid
Demo App may be executed from a command line, by navigating to the
directory in
which the *.jar file is located, and typing the following command:
java
-jar -Djava.library.path=/<path_to_.so_file>/ HidDemo.jar
This should
bring up the HID Demo App. If it does not, check to ensure that a
Java Virtual Machine (JVM) is listed in your PC's path.
After the HID Demo App
appears and before connecting to the device, the following is required
to allow access to the HID port connected to the device:
- Bring up terminal window and type in: ls /dev/hid*
- Connect the msp430 device to USB port and re-type in: ls /dev/hid*
- Note the difference in result between the two steps listed above.
- Change permission on the HID port as follows:
sudo chmod 0666 /dev/hidrawX (where X is the number assigned to the HID port connected to the msp430 device).
This
update can build 32- and 64-bit
libraries. The project contains:
com |
Top Level Java and Class files |
doc |
Release Notes image files |
icons |
User interface resources |
jni |
C sources and library |
There is also a Makefile, at top level, for rebuilding the application
(*.jar
file and SO). To rebuild, please see pre-requisites.
The HID Demo App was
developed only as an example, so you're encouraged to modify and update
it.
In order to do this, you will need the following software
installed:
The OpenJDK may be
downloaded from:
http://openjdk.java.net/install/
libusb may be
downloaded from:
http://www.libusb.org/
Modify the Makefile (in
hidDemo-java/Makefile) to add
the location of the JDK and libusb you have installed on your system.
If the compilers were installed correctly, the only changes that should
be needed is the JDK path.
ifeq (${Linux},1)
CC=gcc
CXX=gcc
CCFLAGS=-m64 -fPIC
JDK="/usr/lib/jvm/java-6-openjdk-amd64"
LIB_NAME=libHidCommunicationManagerLinux64.so
JNICFLAGS=-c -I${JDK}/include -I${JDK}/include/linux -std=gnu99 -D__int64="long long" -fPIC
JNILDFLAGS=-Wall -D_JNI_IMPLEMENTATION_
LNXOBJS=${HIDAPI_ROOT}/linux/hid-libusb.c
LNXLIBS=-lusb-1.0
JNI_FLAGS=-Xmx512M
else
CC=gcc
CXX=gcc
CCFLAGS=-m32 -fPIC
JDK="/usr/lib/jvm/java-6-sun-1.6.0.26"
LIB_NAME=libHidCommunicationManagerLinux.so
JNICFLAGS=-c -I${JDK}/include -I${JDK}/include/linux -std=gnu99 -D__int64="long long"
JNILDFLAGS=-Wall -D_JNI_IMPLEMENTATION_
LNXOBJS=${HIDAPI_ROOT}/linux/hid-libusb.c
LNXLIBS=-lusb-1.0
JNI_FLAGS=-Xmx512M
endif
The JDK paths should point to where your system's JDK is installed (the
JDK
directory right above bin/ that contains javah.exe).
The
final step is to open a terminal window and run "make" (or
"make Linux=1", for 64-bit build) in the /Java_HID_Demo/Linux directory.
The 32-bit version has been tested on a 32-bit
Linux machine and the 64-bit version has been tested on a 64-bit
Linux machine.
If
the HID port connected to the device does not have read and write
permissions, the Java Hid Demo App will disapper upon connection
to the device.
This is demo code, and therefore there is no versioning.
First check the
Examples Guide and MSP430 USB API Programmer's Guide in the USB
Developers Package for more information. If you still need support,
please
visit the MSP430
E2E forum.
or e-mail us directly at msp430ware@list.ti.com.