joyful/docs/examples/ruletypes.yml

120 lines
No EOL
3.6 KiB
YAML

#
devices:
- name: flightstick
type: physical
device_name: Flightstick Name From evlist
- name: main
type: virtual
num_axes: 8
num_buttons: 80
- name: mouse
type: virtual
relative_axes:
- REL_WHEEL
rules:
# Straightforward axis mapping
- type: axis
input:
device: flightstick
# To find reasonable values for your device's deadzones, use the evtest command
deadzone_start: 28000
deadzone_end: 30000
inverted: false
axis: ABS_X
output:
device: main
axis: ABS_X
- type: axis
input:
device: flightstick
# An alternate way to specify deadzones is to define the deadzone's center and then a
# size value. This will create a deadzone that covers a range of deadzone_size,
# centered on the center value. Note that if your deadzone_center is at the lower or upper end
# of the axis, the total size will still be as given; the deadzone will be "shifted" into bounds.
deadzone_center: 29000
deadzone_size: 2000
inverted: false
axis: Y # The ABS_ prefix is optional
output:
device: main
axis: ABS_Y
- type: axis
input:
device: flightstick
# A final way to specify deadzones is to use a size percentage instead of an absolute size.
# This works exactly like deadzone_size, but calculates a percentage of the axis' total range.
deadzone_center: 29000
deadzone_size_percent: 5
inverted: false
axis: Y # The ABS_ prefix is optional
output:
device: main
axis: ABS_Y
# Straightforward button mapping
- type: button
input:
device: flightstick
button: BTN_BASE2
inverted: false
output:
device: main
button: BTN_BASE2
# A combo rule - BTN_TRIGGER will be active while BTN_THUMB and BTN_THUMB2 are pressed.
- type: button-combo
inputs:
- device: flightstick
button: BTN_THUMB
- device: flightstick
button: BTN_THUMB2
output:
device: main
button: BTN_TRIGGER
# A latched rule - the virtual BTN_BASE3 will toggle each time the physical BTN_BASE3 is pressed.
# This way you can "hold down" the button without having to actually hold it.
- type: button-latched
input:
device: flightstick
button: BTN_BASE3
output:
device: main
button: BTN_BASE3
# The specified axis will output button presses, and repeat them faster the more the axis is engaged.
- type: axis-to-button
# The repeat rates look backwards because they are the time between repeats in milliseconds.
# So this example will produce a button press every second at the axis' minimum value,
# and a button press every 10 milliseconds at the axis' maximum value.
repeat_rate_min: 1000
repeat_rate_max: 10
input:
device: flightstick
axis: ABS_RY # This axis commonly represents thumbsticks
deadzone_start: 0
deadzone_end: 30000
output:
device: main
button: BTN_BASE4
# The specified axis will output "relative" axis events, commonly used in mice. This example
# simulates a mouse scrollwheel, though only in one direction.
- type: axis-to-relaxis
repeat_rate_min: 100
repeat_rate_max: 10
# This is the value to emit for the axis on each repetition. If you wanted to scroll the other
# direction, use a negative value. It is useful to use 2 rules on the same input axis with
# "overlapping" deadzones to scroll a mousewheel in both directions.
increment: 1
input:
device: flightstick
axis: ABS_Z
deadzone_start: 0
deadzone_end: 500
output:
device: mouse
button: REL_WHEEL