2 * Copyright © 2013 Red Hat, Inc.
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32 /* Use as designater for litest to change the value */
33 #define LITEST_AUTO_ASSIGN INT_MIN
35 struct litest_test_device {
36 enum litest_device_type type;
37 enum litest_device_feature features;
38 const char *shortname;
39 void (*setup)(void); /* test fixture, used by check */
40 void (*teardown)(void); /* test fixture, used by check */
42 * If create is non-NULL it will be called to initialize the device.
43 * For such devices, no overrides are possible. If create is NULL,
44 * the information in name, id, events, absinfo is used to
45 * create the device instead.
47 void (*create)(struct litest_device *d);
50 * The device name. Only used when create is NULL.
54 * The device id. Only used when create is NULL.
56 const struct input_id *id;
58 * List of event type/code tuples, terminated with -1, e.g.
59 * EV_REL, REL_X, EV_KEY, BTN_LEFT, -1
60 * Special tuple is INPUT_PROP_MAX, <actual property> to set.
62 * Any EV_ABS codes in this list will be initialized with a default
67 * List of abs codes to enable, with absinfo.value determining the
68 * code to set. List must be terminated with absinfo.value -1
70 struct input_absinfo *absinfo;
71 struct litest_device_interface *interface;
74 struct litest_device_interface {
75 void (*touch_down)(struct litest_device *d, unsigned int slot, int x, int y);
76 void (*touch_move)(struct litest_device *d, unsigned int slot, int x, int y);
77 void (*touch_up)(struct litest_device *d, unsigned int slot);
80 * Set of of events to execute on touch down, terminated by a .type
81 * and .code value of -1. If the event value is LITEST_AUTO_ASSIGN,
82 * it will be automatically assigned by the framework (valid for x,
83 * y, tracking id and slot).
85 * These events are only used if touch_down is NULL.
87 struct input_event *touch_down_events;
88 struct input_event *touch_move_events;
89 struct input_event *touch_up_events;
95 void litest_set_current_device(struct litest_device *device);
96 int litest_scale(const struct litest_device *d, unsigned int axis, int val);
97 void litest_generic_device_teardown(void);