JMRI Install Guide: USB Components
Starting in version 2.1.5, JMRI contains some
tools for direct access to USB devices. We built in this support
initially so that we could directly access the
QSI Programmer
and certain Insteon
Powerline
adapters, but hope that it will eventually be generally useful.
JInput
Certain types of USB devices can be attached as a "HID device".
(That stands for "Human Interface Device device", but let's not get distracted)
The
JInput project
has provided tools for accessing these devices which we can use
to connect HID devices to events within the JMRI programs.
As a first approach to this, you can find a "USB Input Control"
under the Debug menu in JMRI 2.1.5 and later.
When you open the tool, you'll get a window that lets
you browse the HID devices on your computer, and attach
them to specific JMRI sensors and memories. You can
then have Routes, Logix and scripts access that information to
do whatever you'd like with the device inputs.
For more information, including some info on limitations,
please see the
help page
for the tool.
LibUSB
LibUSB (also known as libusb and libUSB) is a powerful, but tough to
use, library for general access to all USB devices, not just HID devices.
We intend to use it in JMRI to access Insteon adapters and other
devices that have complicated (i.e. powerful) interfaces.
In JMRI 2.1.5, there's only a "USB Device Viewer"
browsing tool that we'll be using to
check connections to various USB devices on various types of computers.
By putting this out in the general test release, even if
it doesn't do anything model-railroad related, it makes it much
easier to test how well this works in various situations.
Eventually, we'll have more in this section.
Limitations
The browsing tool comes directly from libusb, and is coded
to end the application when the window is closed. The libusb authors
consider this a feature. Since we don't want to distribute our
own version of the library with that behavior changed, we'll just
live with it for now.
Installing LibUSB
Before you can use LibUSB on your computer, you have to download
and install a library. The following sections talk about how to
do that.
Windows XP and later
Download and install
the
libusb-win32 installer.
This is called the "filter mode driver", and it's the one you want.
There is currently no version of LibUSB for versions of Windows before XP,
due to limitations in their USB support.
Ubuntu Linux
Start by opening
System > Administration > Synaptic Package Manager
and search for "libusb". There are four packages that start with that name;
install them all.
Mac OS X
You need to install a library package to use libUSB on Mac OS X.
Click
here
for an installer
(you don't need the TWAIN or others, just LibUSB),
or you can download an installer using one of the following direct links.