lib: use udev instead of sfs helpers

We now use udev_device + udev_enumerate to handle sysfs devices. This
allows us to remove the old sfs handlers.

This also reworks the IF handling so we don't duplicate so much code.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
lib: remove unused sfs helpers

These are no longer used so we can remove them.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
xwiishow: fix comments/help

Adjust the comments so they reflect how xwiishow really works today.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
xwiishow: print error in error-corner

We have a separate place to print errors. Use it!

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
xwiishow: move IR/accel data closer together

We have only limited space so move them closer together. This will give
more room for visualizations and extension data.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
xwiishow: add function prefixes and clean up

Clean up function names and add some section so it is easier to review.
Also handle KEY_RESIZE now so we can print errors correctly.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
xwiishow: don't add \n to errors

We don't need implicit flushes by \n as we call refresh() on every loop
iteration.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
xwiishow: print visual accelerometer data

We now print 3D coordinate axes to visualize the accelerometer data. It
makes it a lot easier to see what the data represents.

We use pow(val, 1/4) to get smoother values around the origin. It is
quite impossible to reach the maximum accelerometer values for a longer
time so we concentrate more on the origin.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
xwiishow: don't print data in error mode

While MODE_ERROR is active, we shouldn't print any data. Otherwise, we
don't have the window-setup and will get bogus results.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
xwiishow: show visual IR representation

We now print a rectangular screen to show a visual representation of the
IR tracking points. This makes it much easier to see what they represent
and how point-tracking is actually done.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
lib: add xwii_event_ir_is_valid() helper

This helper checks whether a given IR value is valid or whether it is
disabled and not tracked.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
xwiishow: print N/A for invalid IR values

Use new xwii_event_ir_is_valid() to check whether IR values are valid and
mark them as N/A if they are not.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
xwiishow: print verbose screen-setup info

Print info how big the screen has to be for limited and extended views.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
xwiishow: clear extended accel view correctly

When disabling the accelerometer, we need to correctly reset the extended
view.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
xwiishow: freeze screen with 'f' hotkey

We freeze the screen when the user presses 'f'. If it is pressed again, we
continue as normal. This is useful to get snapshots for debugging.

Note that this breaks key events as we do not refresh them after unfreeze,
so they may be marked as "pressed" if you released them during the freeze.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
xwiishow: clear error line correctly

We need to erase previous error messages before writing a new one to avoid
left-overs if the new message is shorter than the old one.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
xwiishow: print info message on toggle_{ir,accel}

These help debugging problems where accelerometer or IR data are not
reported and it is unclear whether they were enabled correctly.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>