Evidlo/remarkable_mouse

Tilt scaling to [-90, 90]

Closed this issue · 3 comments

First of all, thank you for this wonderful software. I've tried using it in --evdev mode with krita editor. It works great apart from tilt detection.

evdev.py lists limits for ABS_TILT_X/ABS_TILT_Y as [-9000, 9000]. On remarkable 2 the seem to be [-6400, 6400] where 64k correspond to a 90 degree angle. Actual detectable range is around [-6300, 6300] for X axis and [-4000, 4000] for Y axis. But it looks like graphic editor ignores these ranges altogether and requires values in degrees: [-90, 90] range. I suspect that it is the range that wacom tablets have, though I can't test it as I don't own one.

I was able to get appropriate behaviour by scaling tilt events with this crude hack:

        if event.code in [libevdev.EV_ABS.ABS_TILT_X, libevdev.EV_ABS.ABS_TILT_Y]:
            event.value = int(90 * float(event.value) / 6400)

Though it could be the case that the bug is actually in the graphic editor, it still would be nice to have support for this scaling in the mainline version of remarkable_mouse.

On remarkable 2 the seem to be [-6400, 6400] where 64k correspond to a 90 degree angle.

There's a separate issue for rM2 support, but it's good to know the ranges are different.

But it looks like graphic editor ignores these ranges altogether and requires values in degrees: [-90, 90] range.

I'm surprised Krita doesn't automatically scale the tilt range or that evdev doesn't handle this automatically, as one of the steps in evdev.py is registering the min/max values. We would definitely need to dig deeper to verify that this is the case before adding an option for scaling.

Mystery solved. In addition to minimum and maximum we also should specify resolution:

    device.enable(
        libevdev.EV_ABS.ABS_TILT_X,
        libevdev.InputAbsInfo(
            minimum=-6400,
            maximum=6400,
            resolution=6400,
        )
    )
    device.enable(
        libevdev.EV_ABS.ABS_TILT_Y,
        libevdev.InputAbsInfo(
            minimum=-6400,
            maximum=6400,
            resolution=6400,
        )
    )

After that no dirty hack with rescaling are needed.

This should be fixed in 7.1.0