| summaryrefslogtreecommitdiff | 
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2015-09-04 12:48:01 +0200 | 
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2015-09-04 12:48:01 +0200 | 
| commit | dc75c584513dfd746f9819891c2eb6e77bfdf1ad (patch) | |
| tree | 577d5f9ef7fbc43a5873492d386808518d845d94 /src/relabsd_device.c | |
| parent | 385a3d17995dafde4f2b57f8d3a42d4d4782119d (diff) | |
Better debug options, better string comparisons.
Diffstat (limited to 'src/relabsd_device.c')
| -rw-r--r-- | src/relabsd_device.c | 24 | 
1 files changed, 19 insertions, 5 deletions
| diff --git a/src/relabsd_device.c b/src/relabsd_device.c index e807ec6..b093203 100644 --- a/src/relabsd_device.c +++ b/src/relabsd_device.c @@ -140,6 +140,8 @@ int relabsd_device_create  {     int fd; +   RELABSD_S_DEBUG(RELABSD_DEBUG_PROGRAM_FLOW, "Creating virtual device..."); +     fd = open(config->input_file, O_RDONLY);     if (fd < 0) @@ -208,6 +210,8 @@ int relabsd_device_create  void relabsd_device_destroy (const struct relabsd_device * const dev)  { +   RELABSD_S_DEBUG(RELABSD_DEBUG_PROGRAM_FLOW, "Destroying virtual device..."); +     libevdev_uinput_destroy(dev->uidev);     libevdev_free(dev->dev);  } @@ -220,12 +224,22 @@ int relabsd_device_write_evdev_event     int const value  )  { -   /* OPTIMIZE: Should we really send 'EV_SYN' after every event? */ -   if +   RELABSD_DEBUG     ( -      (libevdev_uinput_write_event(dev->uidev, type, code, value) == 0) -      && (libevdev_uinput_write_event(dev->uidev, EV_SYN, SYN_REPORT, 0) == 0) -   ) +      RELABSD_DEBUG_VIRTUAL_EVENTS, +      "Sending event: {type = %s; code = %s; value = %d}.", +       libevdev_event_type_get_name(type), +       libevdev_event_code_get_name(type, code), +       value +   ); + +   /* +    * We'll also send the 'EV_SYN' events when we receive them from the input +    * device. +    * OPTIMIZE: prevent 'EV_SYN' from being sent if we haven't sent any new +    *           values. (It might not be worth it though) +    */ +   if (libevdev_uinput_write_event(dev->uidev, type, code, value) == 0)     {        return 0;     } | 


