150 likes | 177 Views
Human Interface Devices EPICS Support. Mice Keyboards Presentation Remotes Joysticks Game Controllers Barcode Scanners Card Readers Variety of other devices. What are Human Interface Devices?. Human Interface Devices. Set of interfaces to communicate with a given device
E N D
Human Interface Devices EPICS Support
Mice Keyboards Presentation Remotes Joysticks Game Controllers Barcode Scanners Card Readers Variety of other devices What are Human Interface Devices?
Human Interface Devices • Set of interfaces to communicate with a given device • Generally, one interface per capability (Mouse + Keyboard = 2 interfaces) • Interfaces are described by a USB descriptor • You can find this information with the ‘lsusb’ command
HID EPICS Support https://github.com/keenanlang/epics-usb
HID EPICS Support • Based on asynPortDriver from asyn EPICS module from Mark Rivers https://github.com/epics-modules/asyn • Descriptor file → asyn parameters • Handles communications with the device in the background. Updates parameters as data changes.
Current Uses • APS Open House Demonstration • Beamline Motor Control with Wireless Controller
HID Driver • Every device will send data over their interfaces on a periodic basis • Just a set of raw bytes • Descriptor file defines how to interpret that data into asyn parameters • Compares new data to old data and only updates changed data
Descriptor File • One definition per line Parameter_Name [Indicies] -> Parameter_Type • Example X_AXIS_VALUE [0,1] -> UInt16
Descriptor File • Optionally, there are bit shifts and bit masks available for data that doesn’t align to specific bytes. • Name [Index] >> Shift -> Type /0xMask • TEN_BIT_DATA [0,1] -> UInt16 /0x03FF • OFFSET_DATA [1,2] >> 2 -> UInt16 /0x03FF
usbCreateDriver (portName, definitionFile) Loads the definitions file to create the driver usbConnectDevice (portName, interface, vendorID, productID, serial) Connects the driver to a given device, serial is optional, interface=0 connects to the first available interface usbShowIO (portName, on_off) Displays the bytes the device sends every period Driver Functions
Driver Functions • usbSetFrequency (portName, pollFreq) Sets the polling frequency of the device for devices that have a constant connection. Many devices will only send information when an event happens. For those, leave this at 0.0 • usbSetTimeout (portName, timeout) Sets the number of seconds before the device is considered to have timed out. Useful for devices that only send out event data. • UsbSetDelay (portName, delay) Sets the amount of time between attempting to reconnect to a disconnected device.