...
 
Commits (25)
......@@ -2,7 +2,7 @@ AC_PREREQ([2.64])
m4_define([libinput_major_version], [1])
m4_define([libinput_minor_version], [1])
m4_define([libinput_micro_version], [4])
m4_define([libinput_micro_version], [8])
m4_define([libinput_version],
[libinput_major_version.libinput_minor_version.libinput_micro_version])
......@@ -31,7 +31,7 @@ AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
# b) If interfaces have been changed or added, but binary compatibility has
# been preserved, change to C+1:0:A+1
# c) If the interface is the same as the previous version, change to C:R+1:A
LIBINPUT_LT_VERSION=16:4:6
LIBINPUT_LT_VERSION=16:8:6
AC_SUBST(LIBINPUT_LT_VERSION)
AM_SILENT_RULES([yes])
......
......@@ -28,7 +28,7 @@ This normalization only applies to accelerated coordinates, unaccelerated
coordinates are left in device-units. It is up to the caller to interpret
those coordinates correctly.
@section Normalization of touchpad coordinates
@section motion_normalization_touchpad Normalization of touchpad coordinates
Touchpads may have a different resolution for the horizontal and vertical
axis. Interpreting coordinates from the touchpad without taking resolution
......@@ -38,7 +38,7 @@ libinput scales unaccelerated touchpad motion to the resolution of the
touchpad's x axis, i.e. the unaccelerated value for the y axis is:
y = (x / resolution_x) * resolution_y
@section Setting custom DPI settings
@section motion_normalization_customization Setting custom DPI settings
Devices usually do not advertise their resolution and libinput relies on
the udev property <b>MOUSE_DPI</b> for this information. This property is usually
......
......@@ -48,15 +48,19 @@ static struct normalized_coords
tp_get_touches_delta(struct tp_dispatch *tp, bool average)
{
struct tp_touch *t;
unsigned int i, nchanged = 0;
unsigned int i, nactive = 0;
struct normalized_coords normalized;
struct normalized_coords delta = {0.0, 0.0};
for (i = 0; i < tp->num_slots; i++) {
t = &tp->touches[i];
if (tp_touch_active(tp, t) && t->dirty) {
nchanged++;
if (!tp_touch_active(tp, t))
continue;
nactive++;
if (t->dirty) {
normalized = tp_get_delta(t);
delta.x += normalized.x;
......@@ -64,11 +68,11 @@ tp_get_touches_delta(struct tp_dispatch *tp, bool average)
}
}
if (!average || nchanged == 0)
if (!average || nactive == 0)
return delta;
delta.x /= nchanged;
delta.y /= nchanged;
delta.x /= nactive;
delta.y /= nactive;
return delta;
}
......@@ -184,18 +188,7 @@ tp_gesture_get_direction(struct tp_dispatch *tp, struct tp_touch *touch)
{
struct normalized_coords normalized;
struct device_float_coords delta;
double move_threshold;
/*
* Semi-mt touchpads have somewhat inaccurate coordinates when
* 2 fingers are down, so use a slightly larger threshold.
* Elantech semi-mt touchpads are accurate enough though.
*/
if (tp->semi_mt &&
(tp->device->model_flags & EVDEV_MODEL_ELANTECH_TOUCHPAD) == 0)
move_threshold = TP_MM_TO_DPI_NORMALIZED(4);
else
move_threshold = TP_MM_TO_DPI_NORMALIZED(1);
double move_threshold = TP_MM_TO_DPI_NORMALIZED(1);
delta = device_delta(touch->point, touch->gesture.initial);
......@@ -221,11 +214,7 @@ tp_gesture_get_pinch_info(struct tp_dispatch *tp,
delta = device_delta(first->point, second->point);
normalized = tp_normalize_delta(tp, delta);
*distance = normalized_length(normalized);
if (!tp->semi_mt)
*angle = atan2(normalized.y, normalized.x) * 180.0 / M_PI;
else
*angle = 0.0;
*angle = atan2(normalized.y, normalized.x) * 180.0 / M_PI;
*center = device_average(first->point, second->point);
}
......@@ -260,6 +249,9 @@ tp_gesture_twofinger_handle_state_none(struct tp_dispatch *tp, uint64_t time)
first->gesture.initial = first->point;
second->gesture.initial = second->point;
if (!tp->gesture.enabled)
return GESTURE_2FG_STATE_SCROLL;
return GESTURE_2FG_STATE_UNKNOWN;
}
......@@ -297,7 +289,7 @@ tp_gesture_twofinger_handle_state_unknown(struct tp_dispatch *tp, uint64_t time)
((dir2 & 0x80) && (dir1 & 0x01))) {
tp_gesture_set_scroll_buildup(tp);
return GESTURE_2FG_STATE_SCROLL;
} else if (tp->gesture.enabled) {
} else {
tp_gesture_get_pinch_info(tp,
&tp->gesture.initial_distance,
&tp->gesture.angle,
......@@ -317,16 +309,7 @@ tp_gesture_twofinger_handle_state_scroll(struct tp_dispatch *tp, uint64_t time)
if (tp->scroll.method != LIBINPUT_CONFIG_SCROLL_2FG)
return GESTURE_2FG_STATE_SCROLL;
/* On some semi-mt models slot 0 is more accurate, so for semi-mt
* we only use slot 0. */
if (tp->semi_mt) {
if (!tp->touches[0].dirty)
return GESTURE_2FG_STATE_SCROLL;
delta = tp_get_delta(&tp->touches[0]);
} else {
delta = tp_get_average_touches_delta(tp);
}
delta = tp_get_average_touches_delta(tp);
/* scroll is not accelerated */
delta = tp_filter_motion_unaccelerated(tp, &delta, time);
......@@ -568,10 +551,10 @@ tp_gesture_handle_state(struct tp_dispatch *tp, uint64_t time)
int
tp_init_gesture(struct tp_dispatch *tp)
{
if (tp->device->model_flags & EVDEV_MODEL_JUMPING_SEMI_MT)
tp->gesture.enabled = false;
else
tp->gesture.enabled = true;
/* two-finger scrolling is always enabled, this flag just
* decides whether we detect pinch. semi-mt devices are too
* unreliable to do pinch gestures. */
tp->gesture.enabled = !tp->semi_mt && tp->num_slots > 1;
tp->gesture.twofinger_state = GESTURE_2FG_STATE_NONE;
......
......@@ -530,9 +530,9 @@ tp_palm_tap_is_palm(struct tp_dispatch *tp, struct tp_touch *t)
t->point.x < tp->palm.right_edge)
return false;
/* We're inside the left/right palm edge and in the northern half of
* the touchpad - this tap is a palm */
if (t->point.y < tp->palm.vert_center) {
/* We're inside the left/right palm edge and not in one of the
* software button areas */
if (t->point.y < tp->buttons.bottom_area.top_edge) {
log_debug(tp_libinput_context(tp),
"palm: palm-tap detected\n");
return true;
......@@ -1185,6 +1185,16 @@ tp_keyboard_timeout(uint64_t now, void *data)
{
struct tp_dispatch *tp = data;
if (tp->dwt.dwt_enabled &&
long_any_bit_set(tp->dwt.key_mask,
ARRAY_LENGTH(tp->dwt.key_mask))) {
libinput_timer_set(&tp->dwt.keyboard_timer,
now + DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT_2);
tp->dwt.keyboard_last_press_time = now;
log_debug(tp_libinput_context(tp), "palm: keyboard timeout refresh\n");
return;
}
tp_tap_resume(tp, now);
tp->dwt.keyboard_active = false;
......@@ -1229,23 +1239,27 @@ tp_keyboard_event(uint64_t time, struct libinput_event *event, void *data)
struct tp_dispatch *tp = data;
struct libinput_event_keyboard *kbdev;
unsigned int timeout;
if (!tp->dwt.dwt_enabled)
return;
unsigned int key;
if (event->type != LIBINPUT_EVENT_KEYBOARD_KEY)
return;
kbdev = libinput_event_get_keyboard_event(event);
key = libinput_event_keyboard_get_key(kbdev);
/* Only trigger the timer on key down. */
if (libinput_event_keyboard_get_key_state(kbdev) !=
LIBINPUT_KEY_STATE_PRESSED)
LIBINPUT_KEY_STATE_PRESSED) {
long_clear_bit(tp->dwt.key_mask, key);
return;
}
if (!tp->dwt.dwt_enabled)
return;
/* modifier keys don't trigger disable-while-typing so things like
* ctrl+zoom or ctrl+click are possible */
if (tp_key_ignore_for_dwt(libinput_event_keyboard_get_key(kbdev)))
if (tp_key_ignore_for_dwt(key))
return;
if (!tp->dwt.keyboard_active) {
......@@ -1259,6 +1273,7 @@ tp_keyboard_event(uint64_t time, struct libinput_event *event, void *data)
}
tp->dwt.keyboard_last_press_time = time;
long_set_bit(tp->dwt.key_mask, key);
libinput_timer_set(&tp->dwt.keyboard_timer,
time + timeout);
}
......@@ -1285,6 +1300,8 @@ tp_want_dwt(struct evdev_device *touchpad,
{
unsigned int bus_tp = libevdev_get_id_bustype(touchpad->evdev),
bus_kbd = libevdev_get_id_bustype(keyboard->evdev);
unsigned int vendor_tp = evdev_device_get_id_vendor(touchpad);
unsigned int vendor_kbd = evdev_device_get_id_vendor(keyboard);
if (tp_dwt_device_is_blacklisted(touchpad) ||
tp_dwt_device_is_blacklisted(keyboard))
......@@ -1295,12 +1312,51 @@ tp_want_dwt(struct evdev_device *touchpad,
if (bus_tp == BUS_I8042 && bus_kbd != bus_tp)
return false;
/* For Apple touchpads, always use its internal keyboard */
if (vendor_tp == VENDOR_ID_APPLE) {
return vendor_kbd == vendor_tp &&
keyboard->model_flags &
EVDEV_MODEL_APPLE_INTERNAL_KEYBOARD;
}
/* everything else we don't really know, so we have to assume
they go together */
return true;
}
static void
tp_dwt_pair_keyboard(struct evdev_device *touchpad,
struct evdev_device *keyboard)
{
struct tp_dispatch *tp = (struct tp_dispatch*)touchpad->dispatch;
unsigned int bus_kbd = libevdev_get_id_bustype(keyboard->evdev);
if (!tp_want_dwt(touchpad, keyboard))
return;
/* If we already have a keyboard paired, override it if the new one
* is a serio device. Otherwise keep the current one */
if (tp->dwt.keyboard) {
if (bus_kbd != BUS_I8042)
return;
memset(tp->dwt.key_mask, 0, sizeof(tp->dwt.key_mask));
libinput_device_remove_event_listener(&tp->dwt.keyboard_listener);
}
libinput_device_add_event_listener(&keyboard->base,
&tp->dwt.keyboard_listener,
tp_keyboard_event, tp);
tp->dwt.keyboard = keyboard;
tp->dwt.keyboard_active = false;
log_debug(touchpad->base.seat->libinput,
"palm: dwt activated with %s<->%s\n",
touchpad->devname,
keyboard->devname);
}
static void
tp_interface_device_added(struct evdev_device *device,
struct evdev_device *added_device)
......@@ -1325,20 +1381,8 @@ tp_interface_device_added(struct evdev_device *device,
tp_trackpoint_event, tp);
}
if (added_device->tags & EVDEV_TAG_KEYBOARD &&
tp->dwt.keyboard == NULL &&
tp_want_dwt(device, added_device)) {
log_debug(tp_libinput_context(tp),
"palm: dwt activated with %s<->%s\n",
device->devname,
added_device->devname);
libinput_device_add_event_listener(&added_device->base,
&tp->dwt.keyboard_listener,
tp_keyboard_event, tp);
tp->dwt.keyboard = added_device;
tp->dwt.keyboard_active = false;
}
if (added_device->tags & EVDEV_TAG_KEYBOARD)
tp_dwt_pair_keyboard(device, added_device);
if (tp->sendevents.current_mode !=
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE)
......@@ -1478,16 +1522,22 @@ tp_init_slots(struct tp_dispatch *tp,
tp->semi_mt = libevdev_has_property(device->evdev, INPUT_PROP_SEMI_MT);
/* This device has a terrible resolution when two fingers are down,
/* Semi-mt devices are not reliable for true multitouch data, so we
* simply pretend they're single touch touchpads with BTN_TOOL bits.
* Synaptics:
* Terrible resolution when two fingers are down,
* causing scroll jumps. The single-touch emulation ABS_X/Y is
* accurate but the ABS_MT_POSITION touchpoints report the bounding
* box and that causes jumps. So we simply pretend it's a single
* touch touchpad with the BTN_TOOL bits.
* See https://bugzilla.redhat.com/show_bug.cgi?id=1235175 for an
* explanation.
* box and that causes jumps. See https://bugzilla.redhat.com/1235175
* Elantech:
* On three-finger taps/clicks, one slot doesn't get a coordinate
* assigned. See https://bugs.freedesktop.org/show_bug.cgi?id=93583
* Alps:
* If three fingers are set down in the same frame, one slot has the
* coordinates 0/0 and may not get updated for several frames.
* See https://bugzilla.redhat.com/show_bug.cgi?id=1295073
*/
if (tp->semi_mt &&
(device->model_flags & EVDEV_MODEL_JUMPING_SEMI_MT)) {
if (tp->semi_mt) {
tp->num_slots = 1;
tp->slot = 0;
tp->has_mt = false;
......@@ -1762,14 +1812,12 @@ static int
tp_init_palmdetect(struct tp_dispatch *tp,
struct evdev_device *device)
{
int width, height;
int width;
tp->palm.right_edge = INT_MAX;
tp->palm.left_edge = INT_MIN;
tp->palm.vert_center = INT_MIN;
width = device->abs.dimensions.x;
height = device->abs.dimensions.y;
/* Wacom doesn't have internal touchpads,
* Apple touchpads are always big enough to warrant palm detection */
......@@ -1784,7 +1832,6 @@ tp_init_palmdetect(struct tp_dispatch *tp,
/* palm edges are 5% of the width on each side */
tp->palm.right_edge = device->abs.absinfo_x->maximum - width * 0.05;
tp->palm.left_edge = device->abs.absinfo_x->minimum + width * 0.05;
tp->palm.vert_center = device->abs.absinfo_y->minimum + height/2;
tp->palm.monitor_trackpoint = true;
......@@ -1925,13 +1972,41 @@ tp_init_default_resolution(struct tp_dispatch *tp,
return 0;
}
static inline void
tp_init_hysteresis(struct tp_dispatch *tp)
{
int res_x, res_y;
if (tp->device->model_flags & EVDEV_MODEL_CYAPA)
goto want_hysteresis;
if (tp->device->model_flags & EVDEV_MODEL_ALPS_RUSHMORE)
goto want_hysteresis;
if (tp->semi_mt &&
(tp->device->model_flags & EVDEV_MODEL_SYNAPTICS_SERIAL_TOUCHPAD))
goto want_hysteresis;
tp->hysteresis_margin.x = 0;
tp->hysteresis_margin.y = 0;
return;
want_hysteresis:
res_x = tp->device->abs.absinfo_x->resolution;
res_y = tp->device->abs.absinfo_y->resolution;
tp->hysteresis_margin.x = res_x/2;
tp->hysteresis_margin.y = res_y/2;
return;
}
static int
tp_init(struct tp_dispatch *tp,
struct evdev_device *device)
{
int width, height;
double diagonal;
int res_x, res_y;
tp->base.interface = &tp_interface;
tp->device = device;
......@@ -1945,8 +2020,6 @@ tp_init(struct tp_dispatch *tp,
if (tp_init_slots(tp, device) != 0)
return -1;
res_x = tp->device->abs.absinfo_x->resolution;
res_y = tp->device->abs.absinfo_y->resolution;
width = device->abs.dimensions.x;
height = device->abs.dimensions.y;
diagonal = sqrt(width*width + height*height);
......@@ -1955,8 +2028,7 @@ tp_init(struct tp_dispatch *tp,
EV_ABS,
ABS_MT_DISTANCE);
tp->hysteresis_margin.x = res_x/2;
tp->hysteresis_margin.y = res_y/2;
tp_init_hysteresis(tp);
if (tp_init_accel(tp, diagonal) != 0)
return -1;
......
......@@ -320,7 +320,6 @@ struct tp_dispatch {
struct {
int32_t right_edge; /* in device coordinates */
int32_t left_edge; /* in device coordinates */
int32_t vert_center; /* in device coordinates */
bool trackpoint_active;
struct libinput_event_listener trackpoint_listener;
......@@ -342,6 +341,7 @@ struct tp_dispatch {
struct libinput_event_listener keyboard_listener;
struct libinput_timer keyboard_timer;
struct evdev_device *keyboard;
unsigned long key_mask[NLONGS(KEY_CNT)];
uint64_t keyboard_last_press_time;
} dwt;
......
......@@ -1662,6 +1662,10 @@ evdev_read_model_flags(struct evdev_device *device)
{ "LIBINPUT_MODEL_SYNAPTICS_SERIAL_TOUCHPAD", EVDEV_MODEL_SYNAPTICS_SERIAL_TOUCHPAD },
{ "LIBINPUT_MODEL_JUMPING_SEMI_MT", EVDEV_MODEL_JUMPING_SEMI_MT },
{ "LIBINPUT_MODEL_ELANTECH_TOUCHPAD", EVDEV_MODEL_ELANTECH_TOUCHPAD },
{ "LIBINPUT_MODEL_APPLE_INTERNAL_KEYBOARD", EVDEV_MODEL_APPLE_INTERNAL_KEYBOARD },
{ "LIBINPUT_MODEL_CYBORG_RAT", EVDEV_MODEL_CYBORG_RAT },
{ "LIBINPUT_MODEL_CYAPA", EVDEV_MODEL_CYAPA },
{ "LIBINPUT_MODEL_ALPS_RUSHMORE", EVDEV_MODEL_ALPS_RUSHMORE },
{ NULL, EVDEV_MODEL_DEFAULT },
};
const struct model_map *m = model_map;
......@@ -1868,7 +1872,8 @@ evdev_reject_device(struct evdev_device *device)
libevdev_has_event_code(evdev, EV_REL, REL_Y))
return -1;
if (libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_X) ^
if (!evdev_is_fake_mt_device(device) &&
libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_X) ^
libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_Y))
return -1;
......@@ -2213,6 +2218,39 @@ evdev_drain_fd(int fd)
}
}
static inline void
evdev_pre_configure_model_quirks(struct evdev_device *device)
{
/* The Cyborg RAT has a mode button that cycles through event codes.
* On press, we get a release for the current mode and a press for the
* next mode:
* E: 0.000001 0004 0004 589833 # EV_MSC / MSC_SCAN 589833
* E: 0.000001 0001 0118 0000 # EV_KEY / (null) 0
* E: 0.000001 0004 0004 589834 # EV_MSC / MSC_SCAN 589834
* E: 0.000001 0001 0119 0001 # EV_KEY / (null) 1
* E: 0.000001 0000 0000 0000 # ------------ SYN_REPORT (0) ---------- +0ms
* E: 0.705000 0004 0004 589834 # EV_MSC / MSC_SCAN 589834
* E: 0.705000 0001 0119 0000 # EV_KEY / (null) 0
* E: 0.705000 0004 0004 589835 # EV_MSC / MSC_SCAN 589835
* E: 0.705000 0001 011a 0001 # EV_KEY / (null) 1
* E: 0.705000 0000 0000 0000 # ------------ SYN_REPORT (0) ---------- +705ms
* E: 1.496995 0004 0004 589833 # EV_MSC / MSC_SCAN 589833
* E: 1.496995 0001 0118 0001 # EV_KEY / (null) 1
* E: 1.496995 0004 0004 589835 # EV_MSC / MSC_SCAN 589835
* E: 1.496995 0001 011a 0000 # EV_KEY / (null) 0
* E: 1.496995 0000 0000 0000 # ------------ SYN_REPORT (0) ---------- +791ms
*
* https://bugs.freedesktop.org/show_bug.cgi?id=92127
*
* Disable the event codes to avoid stuck buttons.
*/
if(device->model_flags & EVDEV_MODEL_CYBORG_RAT) {
libevdev_disable_event_code(device->evdev, EV_KEY, 0x118);
libevdev_disable_event_code(device->evdev, EV_KEY, 0x119);
libevdev_disable_event_code(device->evdev, EV_KEY, 0x11a);
}
}
struct evdev_device *
evdev_device_create(struct libinput_seat *seat,
struct udev_device *udev_device)
......@@ -2282,6 +2320,8 @@ evdev_device_create(struct libinput_seat *seat,
matrix_init_identity(&device->abs.usermatrix);
matrix_init_identity(&device->abs.default_calibration);
evdev_pre_configure_model_quirks(device);
if (evdev_configure_device(device) == -1)
goto err;
......
......@@ -108,6 +108,10 @@ enum evdev_device_model {
EVDEV_MODEL_JUMPING_SEMI_MT = (1 << 10),
EVDEV_MODEL_ELANTECH_TOUCHPAD = (1 << 11),
EVDEV_MODEL_LENOVO_X220_TOUCHPAD_FW81 = (1 << 12),
EVDEV_MODEL_APPLE_INTERNAL_KEYBOARD = (1 << 13),
EVDEV_MODEL_CYBORG_RAT = (1 << 14),
EVDEV_MODEL_CYAPA = (1 << 15),
EVDEV_MODEL_ALPS_RUSHMORE = (1 << 16),
};
struct mt_slot {
......
......@@ -25,6 +25,7 @@
#ifndef LIBINPUT_UTIL_H
#define LIBINPUT_UTIL_H
#include <assert.h>
#include <unistd.h>
#include <math.h>
#include <stdarg.h>
......@@ -38,6 +39,7 @@
#define VENDOR_ID_APPLE 0x5ac
#define VENDOR_ID_WACOM 0x56a
#define VENDOR_ID_SYNAPTICS_SERIAL 0x002
#define PRODUCT_ID_APPLE_KBD_TOUCHPAD 0x273
#define PRODUCT_ID_SYNAPTICS_SERIAL 0x007
/* The HW DPI rate we normalize to before calculating pointer acceleration */
......@@ -145,6 +147,19 @@ long_set_bit_state(unsigned long *array, int bit, int state)
long_clear_bit(array, bit);
}
static inline int
long_any_bit_set(unsigned long *array, size_t size)
{
unsigned long i;
assert(size > 0);
for (i = 0; i < size; i++)
if (array[i] != 0)
return 1;
return 0;
}
struct matrix {
float val[3][3]; /* [row][col] */
};
......
......@@ -15,9 +15,12 @@ liblitest_la_SOURCES = \
litest-int.h \
litest-device-alps-semi-mt.c \
litest-device-alps-dualpoint.c \
litest-device-anker-mouse-kbd.c \
litest-device-apple-internal-keyboard.c \
litest-device-asus-rog-gladius.c \
litest-device-atmel-hover.c \
litest-device-bcm5974.c \
litest-device-cyborg-rat-5.c \
litest-device-elantech-touchpad.c \
litest-device-generic-singletouch.c \
litest-device-keyboard.c \
......@@ -34,6 +37,7 @@ liblitest_la_SOURCES = \
litest-device-qemu-usb-tablet.c \
litest-device-synaptics.c \
litest-device-synaptics-hover.c \
litest-device-synaptics-i2c.c \
litest-device-synaptics-st.c \
litest-device-synaptics-t440.c \
litest-device-synaptics-x1-carbon-3rd.c \
......@@ -44,6 +48,7 @@ liblitest_la_SOURCES = \
litest-device-wheel-only.c \
litest-device-xen-virtual-pointer.c \
litest-device-vmware-virtual-usb-mouse.c \
litest-device-yubikey.c \
litest.c
liblitest_la_LIBADD = $(top_builddir)/src/libinput-util.la
liblitest_la_CFLAGS = $(AM_CFLAGS) \
......
......@@ -1254,6 +1254,67 @@ START_TEST(device_abs_rel)
}
END_TEST
START_TEST(device_quirks_no_abs_mt_y)
{
struct litest_device *dev = litest_current_device();
struct libinput *li = dev->libinput;
struct libinput_event *event;
struct libinput_event_pointer *pev;
int code;
litest_drain_events(li);
litest_event(dev, EV_REL, REL_HWHEEL, 1);
litest_event(dev, EV_SYN, SYN_REPORT, 0);
libinput_dispatch(li);
event = libinput_get_event(li);
pev = litest_is_axis_event(event,
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL,
LIBINPUT_POINTER_AXIS_SOURCE_WHEEL);
libinput_event_destroy(libinput_event_pointer_get_base_event(pev));
for (code = ABS_MISC + 1; code < ABS_MAX; code++) {
litest_event(dev, EV_ABS, code, 1);
litest_event(dev, EV_SYN, SYN_REPORT, 0);
litest_assert_empty_queue(li);
}
}
END_TEST
START_TEST(device_quirks_cyborg_rat_mode_button)
{
struct litest_device *dev = litest_current_device();
struct libinput_device *device = dev->libinput_device;
struct libinput *li = dev->libinput;
ck_assert(!libinput_device_pointer_has_button(device, 0x118));
ck_assert(!libinput_device_pointer_has_button(device, 0x119));
ck_assert(!libinput_device_pointer_has_button(device, 0x11a));
litest_drain_events(li);
litest_event(dev, EV_KEY, 0x118, 0);
litest_event(dev, EV_KEY, 0x119, 1);
litest_event(dev, EV_SYN, SYN_REPORT, 0);
litest_assert_empty_queue(li);
litest_event(dev, EV_KEY, 0x119, 0);
litest_event(dev, EV_KEY, 0x11a, 1);
litest_event(dev, EV_SYN, SYN_REPORT, 0);
litest_assert_empty_queue(li);
litest_event(dev, EV_KEY, 0x11a, 0);
litest_event(dev, EV_KEY, 0x118, 1);
litest_event(dev, EV_SYN, SYN_REPORT, 0);
litest_assert_empty_queue(li);
}
END_TEST
void
litest_setup_tests(void)
{
......@@ -1308,4 +1369,7 @@ litest_setup_tests(void)
litest_add_no_device("device:invalid rel events", device_touchpad_rel);
litest_add_no_device("device:invalid rel events", device_touch_rel);
litest_add_no_device("device:invalid rel events", device_abs_rel);
litest_add_for_device("device:quirks", device_quirks_no_abs_mt_y, LITEST_ANKER_MOUSE_KBD);
litest_add_for_device("device:quirks", device_quirks_cyborg_rat_mode_button, LITEST_CYBORG_RAT);
}
......@@ -34,7 +34,7 @@ START_TEST(gestures_cap)
struct litest_device *dev = litest_current_device();
struct libinput_device *device = dev->libinput_device;
if (litest_is_synaptics_semi_mt(dev))
if (libevdev_has_property(dev->evdev, INPUT_PROP_SEMI_MT))
ck_assert(!libinput_device_has_capability(device,
LIBINPUT_DEVICE_CAP_GESTURE));
else
......@@ -180,7 +180,9 @@ START_TEST(gestures_pinch)
{ -30, 30 },
};
if (libevdev_get_num_slots(dev->evdev) < 3)
if (libevdev_get_num_slots(dev->evdev) < 2 ||
!libinput_device_has_capability(dev->libinput_device,
LIBINPUT_DEVICE_CAP_GESTURE))
return;
dir_x = cardinals[cardinal][0];
......@@ -195,13 +197,13 @@ START_TEST(gestures_pinch)
for (i = 0; i < 8; i++) {
litest_push_event_frame(dev);
if (dir_x > 0.0)
dir_x -= 3;
dir_x -= 2;
else if (dir_x < 0.0)
dir_x += 3;
dir_x += 2;
if (dir_y > 0.0)
dir_y -= 3;
dir_y -= 2;
else if (dir_y < 0.0)
dir_y += 3;
dir_y += 2;
litest_touch_move(dev,
0,
50 + dir_x,
......@@ -269,17 +271,19 @@ START_TEST(gestures_spread)
double scale, oldscale;
double angle;
int cardinals[8][2] = {
{ 0, 1 },
{ 1, 1 },
{ 1, 0 },
{ 1, -1 },
{ 0, -1 },
{ -1, -1 },
{ -1, 0 },
{ -1, 1 },
{ 0, 30 },
{ 30, 30 },
{ 30, 0 },
{ 30, -30 },
{ 0, -30 },
{ -30, -30 },
{ -30, 0 },
{ -30, 30 },
};
if (libevdev_get_num_slots(dev->evdev) < 3)
if (libevdev_get_num_slots(dev->evdev) < 2 ||
!libinput_device_has_capability(dev->libinput_device,
LIBINPUT_DEVICE_CAP_GESTURE))
return;
dir_x = cardinals[cardinal][0];
......
/*
* Copyright © 2015 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include "litest.h"
#include "litest-int.h"
/* Recording from https://bugs.freedesktop.org/show_bug.cgi?id=93474
* This is the keyboard device for this mouse.
*/
static void litest_anker_mouse_kbd_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_ANKER_MOUSE_KBD);
litest_set_current_device(d);
}
static struct input_id input_id = {
.bustype = 0x3,
.vendor = 0x4d9,
.product = 0xfa50,
};
static int events[] = {
EV_REL, REL_HWHEEL,
EV_KEY, KEY_ESC,
EV_KEY, KEY_KPMINUS,
EV_KEY, KEY_KPPLUS,
EV_KEY, KEY_UP,
EV_KEY, KEY_PAGEUP,
EV_KEY, KEY_LEFT,
EV_KEY, KEY_RIGHT,
EV_KEY, KEY_END,
EV_KEY, KEY_DOWN,
EV_KEY, KEY_PAGEDOWN,
EV_KEY, KEY_INSERT,
EV_KEY, KEY_DELETE,
EV_KEY, KEY_MUTE,
EV_KEY, KEY_VOLUMEDOWN,
EV_KEY, KEY_VOLUMEUP,
EV_KEY, KEY_POWER,
EV_KEY, KEY_PAUSE,
EV_KEY, KEY_STOP,
EV_KEY, KEY_PROPS,
EV_KEY, KEY_UNDO,
EV_KEY, KEY_COPY,
EV_KEY, KEY_OPEN,
EV_KEY, KEY_PASTE,
EV_KEY, KEY_FIND,
EV_KEY, KEY_CUT,
EV_KEY, KEY_HELP,
EV_KEY, KEY_MENU,
EV_KEY, KE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Y, KEY_TV2,
EV_KEY, KEY_VCR,
EV_KEY, KEY_VCR2,
EV_KEY, KEY_SAT,
EV_KEY, KEY_CD,
EV_KEY, KEY_TAPE,
EV_KEY, KEY_TUNER,
EV_KEY, KEY_PLAYER,
EV_KEY, KEY_DVD,
EV_KEY, KEY_AUDIO,
EV_KEY, KEY_VIDEO,
EV_KEY, KEY_MEMO,
EV_KEY, KEY_CALENDAR,
EV_KEY, KEY_RED,
EV_KEY, KEY_GREEN,
EV_KEY, KEY_YELLOW,
EV_KEY, KEY_BLUE,
EV_KEY, KEY_CHANNELUP,
EV_KEY, KEY_CHANNELDOWN,
EV_KEY, KEY_LAST,
EV_KEY, KEY_NEXT,
EV_KEY, KEY_RESTART,
EV_KEY, KEY_SLOW,
EV_KEY, KEY_SHUFFLE,
EV_KEY, KEY_PREVIOUS,
EV_KEY, KEY_VIDEOPHONE,
EV_KEY, KEY_GAMES,
EV_KEY, KEY_ZOOMIN,
EV_KEY, KEY_ZOOMOUT,
EV_KEY, KEY_ZOOMRESET,
EV_KEY, KEY_WORDPROCESSOR,
EV_KEY, KEY_EDITOR,
EV_KEY, KEY_SPREADSHEET,
EV_KEY, KEY_GRAPHICSEDITOR,
EV_KEY, KEY_PRESENTATION,
EV_KEY, KEY_DATABASE,
EV_KEY, KEY_NEWS,
EV_KEY, KEY_VOICEMAIL,
EV_KEY, KEY_ADDRESSBOOK,
EV_KEY, KEY_MESSENGER,
EV_KEY, KEY_DISPLAYTOGGLE,
EV_KEY, KEY_SPELLCHECK,
EV_KEY, KEY_LOGOFF,
EV_KEY, KEY_MEDIA_REPEAT,
EV_KEY, KEY_IMAGES,
EV_KEY, KEY_BUTTONCONFIG,
EV_KEY, KEY_TASKMANAGER,
EV_KEY, KEY_JOURNAL,
EV_KEY, KEY_CONTROLPANEL,
EV_KEY, KEY_APPSELECT,
EV_KEY, KEY_SCREENSAVER,
EV_KEY, KEY_VOICECOMMAND,
EV_KEY, KEY_BRIGHTNESS_MIN,
EV_KEY, KEY_BRIGHTNESS_MAX,
EV_KEY, KEY_KBDINPUTASSIST_PREV,
EV_KEY, KEY_KBDINPUTASSIST_NEXT,
EV_KEY, KEY_KBDINPUTASSIST_PREVGROUP,
EV_KEY, KEY_KBDINPUTASSIST_NEXTGROUP,
EV_KEY, KEY_KBDINPUTASSIST_ACCEPT,
EV_KEY, KEY_KBDINPUTASSIST_CANCEL,
EV_MSC, MSC_SCAN,
-1 , -1,
};
static struct input_absinfo absinfo[] = {
{ ABS_VOLUME, 0, 4096, 0, 0, 0 },
{ ABS_MISC, 0, 255, 0, 0, 0 },
{ 0x29, 0, 255, 0, 0, 0 },
{ 0x2a, 0, 255, 0, 0, 0 },
{ 0x2b, 0, 255, 0, 0, 0 },
{ 0x2c, 0, 255, 0, 0, 0 },
{ 0x2d, 0, 255, 0, 0, 0 },
{ 0x2e, 0, 255, 0, 0, 0 },
{ ABS_MT_SLOT, 0, 255, 0, 0, 0 },
{ ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0, 0 },
{ ABS_MT_TOUCH_MINOR, 0, 255, 0, 0, 0 },
{ ABS_MT_WIDTH_MINOR, 0, 255, 0, 0, 0 },
{ ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0, 0 },
{ ABS_MT_ORIENTATION, 0, 255, 0, 0, 0 },
{ ABS_MT_POSITION_X, 0, 255, 0, 0, 0 },
{ .value = -1 },
};
struct litest_test_device litest_anker_mouse_kbd_device = {
.type = LITEST_ANKER_MOUSE_KBD,
.features = LITEST_KEYS | LITEST_WHEEL,
.shortname = "anker_kbd",
.setup = litest_anker_mouse_kbd_setup,
.interface = NULL,
.name = "USB Laser Game Mouse",
.id = &input_id,
.absinfo = absinfo,
.events = events,
};
/*
* Copyright © 2015 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include "litest.h"
#include "litest-int.h"
static void litest_apple_keyboard_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_APPLE_KEYBOARD);
litest_set_current_device(d);
}
static struct input_id input_id = {
.bustype = 0x3,
.vendor = 0x5ac,
.product = 0x273,
};
static int events[] = {
EV_KEY, KEY_ESC,
EV_KEY, KEY_1,
EV_KEY, KEY_2,
EV_KEY, KEY_3,
EV_KEY, KEY_4,
EV_KEY, KEY_5,
EV_KEY, KEY_6,
EV_KEY, KEY_7,
EV_KEY, KEY_8,
EV_KEY, KEY_9,
EV_KEY, KEY_0,
EV_KEY, KEY_MINUS,
EV_KEY, KEY_EQUAL,
EV_KEY, KEY_BACKSPACE,
EV_KEY, KEY_TAB,
EV_KEY, KEY_Q,
EV_KEY, KEY_W,
EV_KEY, KEY_E,
EV_KEY, KEY_R,
EV_KEY, KEY_T,
EV_KEY, KEY_Y,
EV_KEY, KEY_U,
EV_KEY, KEY_I,
EV_KEY, KEY_O,
EV_KEY, KEY_P,
EV_KEY, KEY_LEFTBRACE,
EV_KEY, KEY_RIGHTBRACE,
EV_KEY, KEY_ENTER,
EV_KEY, KEY_LEFTCTRL,
EV_K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V_KEY, KEY_EDIT,
EV_KEY, KEY_SCROLLUP,
EV_KEY, KEY_SCROLLDOWN,
EV_KEY, KEY_KPLEFTPAREN,
EV_KEY, KEY_KPRIGHTPAREN,
EV_KEY, KEY_F13,
EV_KEY, KEY_F14,
EV_KEY, KEY_F15,
EV_KEY, KEY_F16,
EV_KEY, KEY_F17,
EV_KEY, KEY_F18,
EV_KEY, KEY_F19,
EV_KEY, KEY_F20,
EV_KEY, KEY_F21,
EV_KEY, KEY_F22,
EV_KEY, KEY_F23,
EV_KEY, KEY_F24,
EV_KEY, KEY_DASHBOARD,
EV_KEY, KEY_FASTFORWARD,
EV_KEY, KEY_BRIGHTNESSDOWN,
EV_KEY, KEY_BRIGHTNESSUP,
EV_KEY, KEY_SWITCHVIDEOMODE,
EV_KEY, KEY_KBDILLUMTOGGLE,
EV_KEY, KEY_KBDILLUMDOWN,
EV_KEY, KEY_KBDILLUMUP,
EV_KEY, KEY_UNKNOWN,
EV_KEY, KEY_FN,
EV_MSC, MSC_SCAN,
EV_LED, LED_NUML,
EV_LED, LED_CAPSL,
EV_LED, LED_SCROLLL,
EV_LED, LED_COMPOSE,
EV_LED, LED_KANA,
-1, -1
};
struct litest_test_device litest_apple_keyboard_device = {
.type = LITEST_APPLE_KEYBOARD,
.features = LITEST_KEYS,
.shortname = "apple_keyboard",
.setup = litest_apple_keyboard_setup,
.interface = NULL,
.name = "Apple Inc. Apple Internal Keyboard / Trackpad",
.id = &input_id,
.events = events,
.absinfo = NULL,
};
/*
* Copyright © 2013 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include "litest.h"
#include "litest-int.h"
static void litest_cyborg_rat_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_CYBORG_RAT);
litest_set_current_device(d);
}
static struct input_id input_id = {
.bustype = 0x3,
.vendor = 0x6a3,
.product = 0xcd5,
};
static int events[] = {
EV_KEY, BTN_LEFT,
EV_KEY, BTN_RIGHT,
EV_KEY, BTN_MIDDLE,
EV_KEY, BTN_SIDE,
EV_KEY, BTN_EXTRA,
EV_KEY, BTN_FORWARD,
EV_KEY, BTN_TASK,
EV_KEY, 0x118,
EV_KEY, 0x119,
EV_KEY, 0x11a,
EV_REL, REL_X,
EV_REL, REL_Y,
EV_REL, REL_WHEEL,
-1 , -1,
};
struct litest_test_device litest_cyborg_rat_device = {
.type = LITEST_CYBORG_RAT,
.features = LITEST_RELATIVE | LITEST_BUTTON | LITEST_WHEEL,
.shortname = "cyborg_rat",
.setup = litest_cyborg_rat_setup,
.interface = NULL,
.name = "Saitek Cyborg R.A.T.5 Mouse",
.id = &input_id,
.absinfo = NULL,
.events = events,
};
/*
* Copyright © 2015 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include "litest.h"
#include "litest-int.h"
static void
litest_synaptics_i2c_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_SYNAPTICS_I2C);
litest_set_current_device(d);
}
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_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 },
};
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_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_events = down,
.touch_move_events = move,
};
static struct input_id input_id = {
.bustype = 0x18,
.vendor = 0x6cb,
.product = 0x76ad,
};
static int events[] = {
EV_KEY, BTN_LEFT,
EV_KEY, BTN_TOOL_FINGER,
EV_KEY, BTN_TOUCH,
EV_KEY, BTN_TOOL_DOUBLETAP,
EV_KEY, BTN_TOOL_TRIPLETAP,
INPUT_PROP_MAX, INPUT_PROP_POINTER,
INPUT_PROP_MAX, INPUT_PROP_BUTTONPAD,
-1, -1,
};
static struct input_absinfo absinfo[] = {
{ ABS_X, 0, 1216, 0, 0, 12 },
{ ABS_Y, 0, 680, 0, 0, 12 },
{ ABS_MT_SLOT, 0, 1, 0, 0, 0 },
{ ABS_MT_POSITION_X, 0, 1216, 0, 0, 12 },
{ ABS_MT_POSITION_Y, 0, 680, 0, 0, 12 },
{ ABS_MT_TRACKING_ID, 0, 65535, 0, 0, 0 },
{ .value = -1 }
};
struct litest_test_device litest_synaptics_i2c_device = {
.type = LITEST_SYNAPTICS_I2C,
.features = LITEST_TOUCHPAD | LITEST_CLICKPAD | LITEST_BUTTON,
.shortname = "synaptics-i2c",
.setup = litest_synaptics_i2c_setup,
.interface = &interface,
.name = "DLL0704:01 06CB:76AD Touchpad",
.id = &input_id,
.events = events,
.absinfo = absinfo,
};
/*
* Copyright © 2014 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include "litest.h"
#include "litest-int.h"
static void litest_yubikey_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_YUBIKEY);
litest_set_current_device(d);
}
static struct input_id input_id = {
.bustype = 0x3,
.vendor = 0x1050,
.product = 0x10,
};
static int events[] = {
EV_KEY, KEY_ESC,
EV_KEY, KEY_1,
EV_KEY, KEY_2,
EV_KEY, KEY_3,
EV_KEY, KEY_4,
EV_KEY, KEY_5,
EV_KEY, KEY_6,
EV_KEY, KEY_7,
EV_KEY, KEY_8,
EV_KEY, KEY_9,
EV_KEY, KEY_0,
EV_KEY, KEY_MINUS,
EV_KEY, KEY_EQUAL,
EV_KEY, KEY_BACKSPACE,
EV_KEY, KEY_TAB,
EV_KEY, KEY_Q,
EV_KEY, KEY_W,
EV_KEY, KEY_E,
EV_KEY, KEY_R,
EV_KEY, KEY_T,
EV_KEY, KEY_Y,
EV_KEY, KEY_U,
EV_KEY, KEY_I,
EV_KEY, KEY_O,
EV_KEY, KEY_P,
EV_KEY, KEY_LEFTBRACE,
EV_KEY, KEY_RIGHTBRACE,
EV_KEY, KEY_ENTER,
EV_KEY, KEY_LEFTCTRL,
EV_KEY, KEY_A,
EV_KEY, KEY_S,
EV_KEY, KEY_D,
EV_KEY, KEY_F,
EV_KEY, KEY_G,
EV_KEY, KEY_H,
EV_KEY, KEY_J,
EV_KEY, KEY_K,
EV_KEY, KEY_L,
EV_KEY, KEY_SEMICOLON,