Ticket #4260 (reopened defect)

Opened 7 years ago

Last modified 6 years ago

evdev_drv does not work with GS in absolute mode

Reported by: bernie Owned by: dilinger
Priority: blocker Milestone: 8.2.0 (was Update.2)
Component: distro Version:
Keywords: Cc: jg, cjb, dilinger, warp
Action Needed: Verified: no
Deployments affected: Blocked By:
Blocking:

Description

The evdev X driver does not work when used with the APLS GlideSensor in absolute mode. The cursor moves only vertically, and remains stuck all the way to the left of the screen.

With X 1.3, we forced relative mode by setting an option in the driver section in xorg.conf.

This is no longer possible with X 1.4 and its input autoconfiguration, so we need a kernel patch to hint hal, and thus evdev, into thinking the device is relative (i.e.: mouse-like).

Attachments

evdev-make-gs-relative.patch (0.6 kB) - added by bernie 7 years ago.
temporary kernel patch

Change History

Changed 7 years ago by bernie

  • milestone changed from Never Assigned to First Deployment, V1.0

Changed 7 years ago by bernie

temporary kernel patch

Changed 7 years ago by bernie

After a quick exchange on IRC with Mercury, I now totally understand this issue.

What really fixed the described bug was making relative mode the default in evde, with a separate patch I didn't mention.

We need the kernel patch only to convince hal into flagging the device as a mouse.

This is what hal does to detect a mouse:

static void
input_test_rel (HalDevice *d, const char *sysfs_path)
{
    char *s;
    long bitmask[NBITS(REL_MAX)];
    int num_bits;

    s = hal_util_get_string_from_file (sysfs_path, "capabilities/rel");
    if (s == NULL)
        goto out;

    num_bits = input_str_to_bitmask (s, bitmask, sizeof (bitmask));

    /* TODO: this test can be improved */
    if (test_bit (REL_X, bitmask) && test_bit (REL_Y, bitmask)) {
        hal_device_add_capability (d, "input.mouse");
    }
out:
    ;
}

and this is what hal wants for a touchpad:

static void
input_test_abs (HalDevice *d, const char *sysfs_path)
{
    char *s;
    long bitmask[NBITS(ABS_MAX)];
    int num_bits;

    s = hal_util_get_string_from_file (sysfs_path, "capabilities/abs");
    if (s == NULL)
        goto out;
    num_bits = input_str_to_bitmask (s, bitmask, sizeof (bitmask));

    if (test_bit (ABS_X, bitmask) && test_bit (ABS_Y, bitmask) && test_bit (ABS_PRESSURE, bitmask)) {
        hal_device_add_capability (d, "input.touchpad");
                goto out;
        }

        /* TODO: Hmm; this code looks sketchy... why do we do !test_bit on the Y axis ?? */
    if (test_bit(ABS_X, bitmask) && !test_bit(ABS_Y, bitmask)) {
        long bitmask_touch[NBITS(KEY_MAX)];

        hal_device_add_capability (d, "input.joystick");

        s = hal_util_get_string_from_file (sysfs_path, "capabilities/key");
        if (s == NULL)
            goto out;
        input_str_to_bitmask (s, bitmask_touch, sizeof (bitmask_touch));

        if (test_bit(BTN_TOUCH, bitmask_touch)) {
            hal_device_add_capability (d, "input.tablet");
                }
    }
out:
    ;
}

Note how it also tests for pressure, which the PT does not provide. Removing the extra check for pressure will make touchpads and joysticks look alike. So to tell them apart we need to find out what extra buttons joysticks usually provide that touchpads don't.

Changed 6 years ago by bernie

  • owner changed from bernie to dilinger
  • priority changed from normal to blocker

Changed 6 years ago by bernie

As discussed on #olpc-meeting, we may want to fool hal into thinking the GS is a mouse so evdev_drv works for now.

Pending a better fix, of course...

Changed 6 years ago by dilinger

  • status changed from new to closed
  • resolution set to fixed

Ok, rather than a hack, the following should fix it:

http://dev.laptop.org/git?p=olpc-2.6;a=commitdiff;h=a9035d57001f4f97c00c7362fbd2e9a49e15be99

Hal should now see us as input.touchpad (and xorg1.4 works properly in joyride).

Changed 6 years ago by bernie

  • status changed from closed to reopened
  • resolution deleted

This is still broken as of today. We had to pull the above patch because it would make the cursor stuck to a corner of the screen.

Note: See TracTickets for help on using tickets.