| summaryrefslogtreecommitdiff |
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2015-09-02 15:55:11 +0200 |
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2015-09-02 15:55:11 +0200 |
| commit | 26b95c0953b8024d487897bf2aaaf1a8836f23a7 (patch) | |
| tree | b6370c9eb56ab664f3ab1680dcca586b922f1ea6 /src/main.c | |
| parent | 60b7a25bf38dce957c937ff602c1c812faff8b0f (diff) | |
relabsd is no longer limited to 6DOF devices.
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 46 |
1 files changed, 17 insertions, 29 deletions
@@ -25,7 +25,7 @@ static void handle_relative_axis_event const struct relabsd_device * const dev, unsigned int const input_type, unsigned int const input_code, - int const value + int value ) { unsigned int abs_code; @@ -33,27 +33,21 @@ static void handle_relative_axis_event rad_code = relabsd_axis_convert_evdev_rel(input_code, &abs_code); - if (rad_code == RELABSD_UNKNOWN) + switch (relabsd_config_filter(conf, rad_code, &value)) { - /* - * EV_REL events that do not concern an axis that was explicitly - * configured are retransmitted as is. - */ - relabsd_device_write_evdev_event - ( - dev, - input_type, - input_code, - value - ); - } - else if (relabsd_config_allows(conf, rad_code, value)) - { - /* - * This filters out events which are inconsistent with 'conf', such as - * values higher than the axis' configured maximum. - */ - relabsd_device_write_evdev_event(dev, EV_ABS, abs_code, value); + case -1: + /* 'conf' doesn't want the event to be transmitted. */ + break; + + case 0: + /* 'conf' wants the event to be transmitted as is. */ + relabsd_device_write_evdev_event(dev, input_type, input_code, value); + break; + + case 1: + /* 'conf' allows the value to be emitted */ + relabsd_device_write_evdev_event(dev, EV_ABS, abs_code, value); + break; } } @@ -87,13 +81,7 @@ static void convert_input else { /* Any other event is retransmitted as is. */ - relabsd_device_write_evdev_event - ( - dev, - input_type, - input_code, - value - ); + relabsd_device_write_evdev_event(dev, input_type, input_code, value); } } } @@ -126,7 +114,7 @@ int main (int argc, char ** argv) return -2; } - if (relabsd_input_open(&input, conf.input_file) < 0) + if (relabsd_input_open(&input, &conf) < 0) { return -3; } |


