Using USB Mouse support in an application
This support module uses the libusb-1.0 library to read data from
a USB mouse. Several files need minor modifications to use
this support in an application:
- Add the full path to the USB Mouse support directory to the
application configure/RELEASE file:
USBMOUSE=xxxx/modules/instrument/usbMouse/<release>
Where <release> is the release number of of the
USB mouse support.
- Add instrument support to application database definition file
The application database definition file must include the
database definition files for the USB mouse support. There are
two ways that this can be done:
- If you are building your application database definition
file from an xxxInclude.dbd file you
include the additional database definitions in that file:
include "base.dbd"
include "usbMouse.dbd"
- If you are building your application database definition
file from the application Makefile you specify the aditional
database definitions there:
xxx_DBD += base.dbd
xxx_DBD += usbMouse.dbd
- Add the USB mouse support libraries to the application
You must link the USB mouse support library, the ASYN support
library and the libusb-1.0 library with the application. Add the
following lines:
xxx_LIBS += usbMouse
xxx_LIBS += asyn
USR_SYS_LIBS += usb-1.0
before the
xxx_LIBS += $(EPICS_BASE_IOC_LIBS)
in the application Makefile.
- Configure the USB mouse in the application startup script:
usbMouseConfigure(<PORT>, <vendor ID>,
<product ID>, <interface number>, <poll
interval (ms)>, <priority>)
The default interface number is 0, the default poll interval is
the value provided by the device itself and the default priority
is epicsThreadMedium.
- Load the USB mouse support database records in the application
startup script:
cd $(USBMOUSE) (cd
USBMOUSE if using the vxWorks shell)
dbLoadRecords("db/usbMouse.db,"P=<P>,R=<R>,PORT=<PORT>")
You'll have to provide appropriate values for the PV name
prefixes (<P> and <R>) and the
ASYN port name (<PORT>). The port name
must match the value specified in a startup script usbMouseConfigure
command.
Installation and Building
After obtaining a copy of the distribution, it must be installed and
built for use at your site.
- Create an installation directory for the module. The path name
of this directory should end with modules/instrument/usbmouse.
- Place the distribution file into this directory.
- Execute the following commands:
cd modules/instrument/usbMouse
gunzip usbMouse<release>.tar.gz
tar xvf usbMouse<release>.tar
cd <release>
Where <release> is the release number of of the
USB mouse support.
- Edit the configure/RELEASE file and set the paths to
your installation of EPICS base and ASYN.
- Execute make in the top level directory.