hal_input − control HAL pins with any Linux input device, including USB HID devices |
loadusr hal_input [-KRAL] inputspec ... |
hal_input is an interface between HAL and any Linux input device, including USB HID devices. For each device named, hal_input creates pins corresponding to its keys, absolute axes, and LEDs. At a fixed rate of approximately 10ms, it synchronizes the device and the HAL pins. |
The inputspec may be in one of several forms: |
A string S |
A substring or shell-style pattern match will be tested against the "name" of the device, the "phys" (which gives information about how it is connected), and the "id", which is a string of the form "Bus=... Vendor=... Product=... Version=...". You can view the name, phys, and id of attached devices by executing less /proc/bus/input/devices. Examples: |
SpaceBall |
A number N |
This opens /dev/input/eventN. Except for devices that are always attached to the system, this number may change over reboots or when the device is removed. For this reason, using an integer is not recommended. |
If the first character of the inputspec is a "+", then hal_input requests exclusive access to the device. The first device matching an inputspec is used. Any number of inputspecs may be used. A subset option may preceed each inputspec. The subset option begins with a dash. Each letter in the subset option specifies a device feature to include. Features that are not specified are excluded. For instance, to export keyboard LEDs to HAL without exporting keys, use |
hal_input -L keyboard ... |
• |
EV_KEY (buttons and keys). Subset -K |
|||
• |
EV_ABS (absolute analog inputs). Subset -A |
|||
• |
EV_REL (relative analog inputs). Subset -R |
|||
• |
EV_LED (LED outputs). Subset -L |
For buttons |
input.N.btn-name bit out |
input.N.btn-name-not bit out |
Created for each button on the device. |
For keys |
input.N.key-name |
input.N.key-name-not |
Created for each key on the device. |
For absolute axes |
input.N.abs-name-counts s32 out |
input.N.abs-name-position float out |
input.N.abs-name-scale parameter float rw |
input.N.abs-name-offset parameter float rw |
input.N.abs-name-fuzz parameter s32 rw |
input.N.abs-name-flat parameter s32 rw |
input.N.abs-name-min parameter s32 r |
input.N.abs-name-max parameter s32 r |
Created for each absolute axis on the device. Device positions closer than flat to offset are reported as offset in counts, and counts does not change until the device position changes by at least fuzz. The position is computed as position = (counts - offset) / scale. The default value of scale and offset map the range of the axis reported by the operating system to [-1,1]. The default values of fuzz and flat are those reported by the operating system. The values of min and max are those reported by the operating system. |
For relative axes |
input.N.rel-name-counts s32 out |
input.N.rel-name-position float out |
input.N.rel-name-reset bit in |
input.N.rel-name-scale parameter float rw |
Created for each relative axis on the device. As long as reset is true, counts is reset to zero regardless of any past or current axis movement. Otherwise, counts increases or decreases according to the motion of the axis. counts is divided by position-scale to give position. The default value of position is 1. |
For LEDs |
input.N.led-name bit out |
input.N.led-name-invert parameter bit rw |
Created for each LED on the device. |
By default, the input devices may not be accessible to regular users. To change the default permission of a device, add a new file to /etc/udev/rules.d to set the device’s GROUP to "plugdev". You can do this for all input devices with this rule: |
SUBSYSTEM="input", mode="0660", group="plugdev" |
You can also make more specific rules for particular devices. For instance, a SpaceBall input device uses the ’spaceball’ kernel module, so a udev entry for it would read: |
DRIVER="spaceball", MODE="0660", GROUP="plugdev" |
the next time the device is attached to the system, it will be accessible to the "plugdev" group. For USB devices, the udev line would refer to the device’s Vendor and Product values, such as |
SYSFS{idProduct}=="c00e", SYSFS{idVendor}=="046d", MODE="0660", GROUP="plugdev" |
for a particular logictech-brand mouse. For more information on writing udev rules, see udev(8). |
The initial state of keys, buttons, and absolute axes are erroneously reported as FALSE or 0 until an event is received for that key, button, or axis. |
hal_joystick(1), udev(8) |