test: set default axis values for all tablet devices

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2015-12-11 17:39:57 +10:00
parent 727d184230
commit 1a34401137
7 changed files with 102 additions and 1 deletions

View file

@ -56,10 +56,24 @@ static struct input_event motion[] = {
{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
{ .type = -1, .code = -1 },
};
static int
get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value)
{
switch (evcode) {
case ABS_PRESSURE:
*value = 100;
return 0;
}
return 1;
}
static struct litest_device_interface interface = {
.tablet_proximity_in_events = proximity_in,
.tablet_proximity_out_events = proximity_out,
.tablet_motion_events = motion,
.get_axis_default = get_axis_default,
};
static struct input_absinfo absinfo[] = {

View file

@ -60,10 +60,23 @@ static struct input_event motion[] = {
{ .type = -1, .code = -1 },
};
static int
get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value)
{
switch (evcode) {
case ABS_PRESSURE:
*value = 100;
return 0;
}
return 1;
}
static struct litest_device_interface interface = {
.tablet_proximity_in_events = proximity_in,
.tablet_proximity_out_events = proximity_out,
.tablet_motion_events = motion,
.get_axis_default = get_axis_default,
};
static struct input_absinfo absinfo[] = {

View file

@ -71,10 +71,30 @@ static struct input_event motion[] = {
{ .type = -1, .code = -1 },
};
static int
get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value)
{
switch (evcode) {
case ABS_TILT_X:
case ABS_TILT_Y:
*value = 0;
return 0;
case ABS_PRESSURE:
*value = 100;
return 0;
case ABS_DISTANCE:
*value = 0;
return 0;
}
return 1;
}
static struct litest_device_interface interface = {
.tablet_proximity_in_events = proximity_in,
.tablet_proximity_out_events = proximity_out,
.tablet_motion_events = motion,
.get_axis_default = get_axis_default,
};
static struct input_absinfo absinfo[] = {

View file

@ -70,10 +70,31 @@ static struct input_event motion[] = {
{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
{ .type = -1, .code = -1 },
};
static int
get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value)
{
switch (evcode) {
case ABS_TILT_X:
case ABS_TILT_Y:
*value = 0;
return 0;
case ABS_PRESSURE:
*value = 100;
return 0;
case ABS_DISTANCE:
*value = 0;
return 0;
}
return 1;
}
static struct litest_device_interface interface = {
.tablet_proximity_in_events = proximity_in,
.tablet_proximity_out_events = proximity_out,
.tablet_motion_events = motion,
.get_axis_default = get_axis_default,
};
static struct input_absinfo absinfo[] = {

View file

@ -55,10 +55,23 @@ static struct input_event motion[] = {
{ .type = -1, .code = -1 },
};
static int
get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value)
{
switch (evcode) {
case ABS_PRESSURE:
*value = 100;
return 0;
}
return 1;
}
static struct litest_device_interface interface = {
.tablet_proximity_in_events = proximity_in,
.tablet_proximity_out_events = proximity_out,
.tablet_motion_events = motion,
.get_axis_default = get_axis_default,
};
static struct input_absinfo absinfo[] = {

View file

@ -62,10 +62,28 @@ static struct input_event motion[] = {
{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
{ .type = -1, .code = -1 },
};
static int
get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value)
{
switch (evcode) {
case ABS_TILT_X:
case ABS_TILT_Y:
*value = 0;
return 0;
case ABS_PRESSURE:
*value = 100;
return 0;
}
return 1;
}
static struct litest_device_interface interface = {
.tablet_proximity_in_events = proximity_in,
.tablet_proximity_out_events = proximity_out,
.tablet_motion_events = motion,
.get_axis_default = get_axis_default,
};
static struct input_absinfo absinfo[] = {

View file

@ -1519,7 +1519,9 @@ auto_assign_tablet_value(struct litest_device *d,
value = litest_scale(d, ABS_Y, y);
break;
default:
axis_replacement_value(d, axes, ev->code, &value);
if (!axis_replacement_value(d, axes, ev->code, &value) &&
d->interface->get_axis_default)
d->interface->get_axis_default(d, ev->code, &value);
break;
}