tools: use NULL, not 0 for a NULL const char*

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Warn about replaying incompatible events

Shout a warning if an event is about to be replayed that's not actually
supported by the device the fd points to. since evemu_play() only has a FILE
and fd API we need to create a device on-the-fly. If that fails, we pretend
everything is ok and we just won't be able to warn.

Evemu Bug 63061 <http://bugs.freedesktop.org/show_bug.cgi?id=63061>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Drop bzrignore, we're a git shop now

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Init absinfo with 0 to avoid spurious resolutions

Since we don't set the resolution, this ends up being garbage.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
add *.pyc to gitignore

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
data: remove empty event file

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
data: update recordings to new format

new *.prop files are given by evemu-play/record.
new *.event files are parsed and re-output to the new format to avoid
changes introduced by the kernel while re-reading them back.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
If no device file is given, display the list

Code taken from evtest, but since I wrote that code I'm happy for the
relicensing. License picked for that code is MIT so we won't have to worry
about copying that code in the future.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
python: make test robust to comment differences

Strip out comments and empty lines, but also strip the device description
from the recordings file before comparing events.

EVEMU 1.1 event format includes the device description as well as the
events. The test suite calls evemu_record() directly though which does not
write the description. Thus filter it from the input file to avoid
comparison failures.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

Benjamin Tissoires:
* rename strip_description() to extract_events() to reflect the code.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
python: fix file type detection to cater for new format

First line may not be N:, it could be either.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Don't check for SYN_MT_REPORT bits while replaying events

This bit may not be set on the device but the kernel still allows the
events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Interrupt "make check" if errors occurs during python tests

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Release version 1.1.0

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
gitignore: add tar.xz to the list

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Don't generate gz, xz is enough

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Introduce a script to convert old dumps into evemu file format 1.1

Evemu file format 1.1 adds human readable description to the dumps,
making them easily readable. This script converts the old dumps into
the new file format.

The conversion is done in two steps:
- use the python evemu API to retrieve the description by creating and
  reading back the device
- parse and output the events not using evemu play/record due to the
  kernel modifying events for devices having fuzz.

NOTE: device presenting resolution will get it stripped by the script

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Squashed with: Use argparse for output control

Bit overkill for a single argument but more flexible in the future.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Don't define INPUT_PROP_*

INPUT_PROP_MAX is used to check if input_prop bits are actually present. If
the define is present when the system lacks it, we get inconsistencies.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Don't try to print bits we don't have

INPUT_PROP bits are missing on RHEL6.x and the script would fail with:

  File "./make-event-names.py", line 38, in print_bits
      for val, name in getattr(bits, prefix).items():
      AttributeError: 'Bits' object has no attribute 'input_prop'

Simply bail out if attribute we're looking at isn't defined.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Add usage hint if not enough args are given

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Use versionsort instead of alphasort

Sort the event devices in a natural order (i.e. event9 is before event10)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>