| summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/device')
| -rw-r--r-- | src/device/axis/axis.c | 9 | ||||
| -rw-r--r-- | src/device/axis/axis_filter.c | 5 | ||||
| -rw-r--r-- | src/device/axis/axis_option.c | 4 | ||||
| -rw-r--r-- | src/device/virtual/virtual_device.c | 48 |
4 files changed, 52 insertions, 14 deletions
diff --git a/src/device/axis/axis.c b/src/device/axis/axis.c index 1cdb856..ada6fa3 100644 --- a/src/device/axis/axis.c +++ b/src/device/axis/axis.c @@ -46,6 +46,15 @@ void relabsd_axis_enable axis->is_enabled = 1; } +int relabsd_axis_has_flag +( + const struct relabsd_axis axis [const restrict static 1], + const enum relabsd_axis_flag flag +) +{ + return axis->flags[flag]; +} + int relabsd_axis_is_enabled ( const struct relabsd_axis axis [const restrict static 1] diff --git a/src/device/axis/axis_filter.c b/src/device/axis/axis_filter.c index 04dfdb7..6258ad9 100644 --- a/src/device/axis/axis_filter.c +++ b/src/device/axis/axis_filter.c @@ -122,6 +122,11 @@ int relabsd_axis_filter_new_value return 0; } + if (axis->flags[RELABSD_NOT_ABS]) + { + return 1; + } + if (axis->flags[RELABSD_DIRECT]) { return direct_filter(axis, value); diff --git a/src/device/axis/axis_option.c b/src/device/axis/axis_option.c index 8e52fe1..7796eb7 100644 --- a/src/device/axis/axis_option.c +++ b/src/device/axis/axis_option.c @@ -57,6 +57,10 @@ int relabsd_axis_enable_option_from_name ); } } + else if (RELABSD_IS_PREFIX("notabs", option_name)) + { + axis->flags[RELABSD_NOT_ABS] = 1; + } else if (RELABSD_IS_PREFIX("convert_to=", option_name)) { axis->convert_to = diff --git a/src/device/virtual/virtual_device.c b/src/device/virtual/virtual_device.c index 5ec06f5..0b92804 100644 --- a/src/device/virtual/virtual_device.c +++ b/src/device/virtual/virtual_device.c @@ -29,6 +29,7 @@ static void replace_rel_axes ) { int i; + for (i = 0; i < RELABSD_AXIS_VALID_AXES_COUNT; i++) { enum relabsd_axis_name axis_name; @@ -37,7 +38,18 @@ static void replace_rel_axes axis_name = ((enum relabsd_axis_name) i); axis = relabsd_parameters_get_axis(axis_name, parameters); - if (relabsd_axis_is_enabled(axis)) + axis_name = relabsd_axis_get_convert_to(axis); + + if (axis_name == RELABSD_UNKNOWN) + { + axis_name = ((enum relabsd_axis_name) i); + } + + if + ( + relabsd_axis_is_enabled(axis) + && !relabsd_axis_has_flag(axis, RELABSD_NOT_ABS) + ) { (void) relabsd_virtual_device_update_axis_absinfo ( @@ -160,20 +172,23 @@ int relabsd_virtual_device_update_axis_absinfo * Might want to add an option to see if people want to use the tool to * alter existing EV_ABS axes instead of converting from EV_REL to EV_ABS. */ - (void) libevdev_disable_event_code - ( - device->libevdev, - EV_REL, - relabsd_axis_name_to_evdev_rel(axis_name) - ); + if (!relabsd_axis_has_flag(axis, RELABSD_NOT_ABS)) + { + (void) libevdev_disable_event_code + ( + device->libevdev, + EV_REL, + relabsd_axis_name_to_evdev_rel(axis_name) + ); - (void) libevdev_enable_event_code - ( - device->libevdev, - EV_ABS, - relabsd_axis_name_to_evdev_abs(target_axis_name), - &absinfo - ); + (void) libevdev_enable_event_code + ( + device->libevdev, + EV_ABS, + relabsd_axis_name_to_evdev_abs(target_axis_name), + &absinfo + ); + } return 0; } @@ -392,6 +407,11 @@ void relabsd_virtual_device_set_axes_to_zero axis = relabsd_parameters_get_axis((enum relabsd_axis_name) i, parameters); + if (relabsd_axis_has_flag(axis, RELABSD_NOT_ABS)) + { + continue; + } + if (relabsd_axis_is_enabled(axis)) { relabsd_virtual_device_write_evdev_event |


