test: switch the semi-mt devices to use the litest semi-mt handling

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2017-01-19 17:35:04 +10:00
parent cef3a8705e
commit 8dfdf6b76f
3 changed files with 69 additions and 131 deletions

View file

@ -30,8 +30,6 @@
#include "litest.h"
#include "litest-int.h"
static void alps_dualpoint_create(struct litest_device *d);
static void
litest_alps_dualpoint_setup(void)
{
@ -39,34 +37,32 @@ litest_alps_dualpoint_setup(void)
litest_set_current_device(d);
}
static void
alps_dualpoint_touch_down(struct litest_device *d, unsigned int slot, double x, double y)
{
struct litest_semi_mt *semi_mt = d->private;
static struct input_event down[] = {
{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
{ .type = -1, .code = -1 },
};
litest_semi_mt_touch_down(d, semi_mt, slot, x, y);
}
static void
alps_dualpoint_touch_move(struct litest_device *d, unsigned int slot, double x, double y)
{
struct litest_semi_mt *semi_mt = d->private;
litest_semi_mt_touch_move(d, semi_mt, slot, x, y);
}
static void
alps_dualpoint_touch_up(struct litest_device *d, unsigned int slot)
{
struct litest_semi_mt *semi_mt = d->private;
litest_semi_mt_touch_up(d, semi_mt, slot);
}
static struct input_event move[] = {
{ .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
{ .type = -1, .code = -1 },
};
static struct litest_device_interface interface = {
.touch_down = alps_dualpoint_touch_down,
.touch_move = alps_dualpoint_touch_move,
.touch_up = alps_dualpoint_touch_up,
.touch_down_events = down,
.touch_move_events = move,
};
static struct input_id input_id = {
@ -116,7 +112,6 @@ struct litest_test_device litest_alps_dualpoint_device = {
.shortname = "alps dualpoint",
.setup = litest_alps_dualpoint_setup,
.interface = &interface,
.create = alps_dualpoint_create,
.name = "AlpsPS/2 ALPS DualPoint TouchPad",
.id = &input_id,
@ -124,18 +119,3 @@ struct litest_test_device litest_alps_dualpoint_device = {
.absinfo = absinfo,
.udev_rule = udev_rule,
};
static void
alps_dualpoint_create(struct litest_device *d)
{
struct litest_semi_mt *semi_mt = zalloc(sizeof(*semi_mt));
assert(semi_mt);
d->private = semi_mt;
d->uinput = litest_create_uinput_device_from_description(litest_alps_dualpoint_device.name,
litest_alps_dualpoint_device.id,
absinfo,
events);
d->interface = &interface;
}

View file

@ -30,8 +30,6 @@
#include "litest.h"
#include "litest-int.h"
static void alps_create(struct litest_device *d);
static void
litest_alps_setup(void)
{
@ -39,34 +37,32 @@ litest_alps_setup(void)
litest_set_current_device(d);
}
static void
alps_touch_down(struct litest_device *d, unsigned int slot, double x, double y)
{
struct litest_semi_mt *semi_mt = d->private;
static struct input_event down[] = {
{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
{ .type = -1, .code = -1 },
};
litest_semi_mt_touch_down(d, semi_mt, slot, x, y);
}
static void
alps_touch_move(struct litest_device *d, unsigned int slot, double x, double y)
{
struct litest_semi_mt *semi_mt = d->private;
litest_semi_mt_touch_move(d, semi_mt, slot, x, y);
}
static void
alps_touch_up(struct litest_device *d, unsigned int slot)
{
struct litest_semi_mt *semi_mt = d->private;
litest_semi_mt_touch_up(d, semi_mt, slot);
}
static struct input_event move[] = {
{ .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
{ .type = -1, .code = -1 },
};
static struct litest_device_interface interface = {
.touch_down = alps_touch_down,
.touch_move = alps_touch_move,
.touch_up = alps_touch_up,
.touch_down_events = down,
.touch_move_events = move,
};
static struct input_id input_id = {
@ -106,25 +102,9 @@ struct litest_test_device litest_alps_device = {
.shortname = "alps semi-mt",
.setup = litest_alps_setup,
.interface = &interface,
.create = alps_create,
.name = "AlpsPS/2 ALPS GlidePoint",
.id = &input_id,
.events = events,
.absinfo = absinfo,
};
static void
alps_create(struct litest_device *d)
{
struct litest_semi_mt *semi_mt = zalloc(sizeof(*semi_mt));
assert(semi_mt);
d->private = semi_mt;
d->uinput = litest_create_uinput_device_from_description(litest_alps_device.name,
litest_alps_device.id,
absinfo,
events);
d->interface = &interface;
}

View file

@ -30,9 +30,6 @@
#include "litest.h"
#include "litest-int.h"
static void
synaptics_hover_create(struct litest_device *d);
static void
litest_synaptics_hover_setup(void)
{
@ -40,34 +37,32 @@ litest_synaptics_hover_setup(void)
litest_set_current_device(d);
}
static void
synaptics_hover_touch_down(struct litest_device *d, unsigned int slot, double x, double y)
{
struct litest_semi_mt *semi_mt = d->private;
static struct input_event down[] = {
{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
{ .type = -1, .code = -1 },
};
litest_semi_mt_touch_down(d, semi_mt, slot, x, y);
}
static void
synaptics_hover_touch_move(struct litest_device *d, unsigned int slot, double x, double y)
{
struct litest_semi_mt *semi_mt = d->private;
litest_semi_mt_touch_move(d, semi_mt, slot, x, y);
}
static void
synaptics_hover_touch_up(struct litest_device *d, unsigned int slot)
{
struct litest_semi_mt *semi_mt = d->private;
litest_semi_mt_touch_up(d, semi_mt, slot);
}
static struct input_event move[] = {
{ .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
{ .type = -1, .code = -1 },
};
static struct litest_device_interface interface = {
.touch_down = synaptics_hover_touch_down,
.touch_move = synaptics_hover_touch_move,
.touch_up = synaptics_hover_touch_up,
.touch_down_events = down,
.touch_move_events = move,
};
static struct input_id input_id = {
@ -115,7 +110,6 @@ struct litest_test_device litest_synaptics_hover_device = {
.shortname = "synaptics hover",
.setup = litest_synaptics_hover_setup,
.interface = &interface,
.create = synaptics_hover_create,
.name = "SynPS/2 Synaptics TouchPad",
.id = &input_id,
@ -123,19 +117,3 @@ struct litest_test_device litest_synaptics_hover_device = {
.absinfo = absinfo,
.udev_rule = udev_rule,
};
static void
synaptics_hover_create(struct litest_device *d)
{
struct litest_semi_mt *semi_mt = zalloc(sizeof(*semi_mt));
assert(semi_mt);
d->private = semi_mt;
d->uinput = litest_create_uinput_device_from_description(
litest_synaptics_hover_device.name,
litest_synaptics_hover_device.id,
absinfo,
events);
d->interface = &interface;
}