1a46c0ec8Sopenharmony_ci/* 2a46c0ec8Sopenharmony_ci * Copyright © 2016 Red Hat, Inc. 3a46c0ec8Sopenharmony_ci * 4a46c0ec8Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 5a46c0ec8Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 6a46c0ec8Sopenharmony_ci * to deal in the Software without restriction, including without limitation 7a46c0ec8Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8a46c0ec8Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 9a46c0ec8Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 10a46c0ec8Sopenharmony_ci * 11a46c0ec8Sopenharmony_ci * The above copyright notice and this permission notice (including the next 12a46c0ec8Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 13a46c0ec8Sopenharmony_ci * Software. 14a46c0ec8Sopenharmony_ci * 15a46c0ec8Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16a46c0ec8Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17a46c0ec8Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18a46c0ec8Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19a46c0ec8Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20a46c0ec8Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21a46c0ec8Sopenharmony_ci * DEALINGS IN THE SOFTWARE. 22a46c0ec8Sopenharmony_ci */ 23a46c0ec8Sopenharmony_ci 24a46c0ec8Sopenharmony_ci#include "config.h" 25a46c0ec8Sopenharmony_ci 26a46c0ec8Sopenharmony_ci#include "litest.h" 27a46c0ec8Sopenharmony_ci#include "litest-int.h" 28a46c0ec8Sopenharmony_ci 29a46c0ec8Sopenharmony_cistatic struct input_event down[] = { 30a46c0ec8Sopenharmony_ci { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, 31a46c0ec8Sopenharmony_ci { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, 32a46c0ec8Sopenharmony_ci { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, 33a46c0ec8Sopenharmony_ci { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, 34a46c0ec8Sopenharmony_ci { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN }, 35a46c0ec8Sopenharmony_ci { .type = EV_ABS, .code = ABS_MT_ORIENTATION, .value = 0 }, 36a46c0ec8Sopenharmony_ci { .type = EV_ABS, .code = ABS_MT_TOUCH_MAJOR, .value = 2 }, 37a46c0ec8Sopenharmony_ci { .type = EV_ABS, .code = ABS_MT_TOUCH_MINOR, .value = 2 }, 38a46c0ec8Sopenharmony_ci { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, 39a46c0ec8Sopenharmony_ci { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, 40a46c0ec8Sopenharmony_ci { .type = EV_ABS, .code = ABS_MT_PRESSURE, .value = LITEST_AUTO_ASSIGN }, 41a46c0ec8Sopenharmony_ci { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, 42a46c0ec8Sopenharmony_ci { .type = -1, .code = -1 }, 43a46c0ec8Sopenharmony_ci}; 44a46c0ec8Sopenharmony_ci 45a46c0ec8Sopenharmony_cistatic struct input_event move[] = { 46a46c0ec8Sopenharmony_ci { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, 47a46c0ec8Sopenharmony_ci { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, 48a46c0ec8Sopenharmony_ci { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, 49a46c0ec8Sopenharmony_ci { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, 50a46c0ec8Sopenharmony_ci { .type = EV_ABS, .code = ABS_MT_ORIENTATION, .value = 0 }, 51a46c0ec8Sopenharmony_ci { .type = EV_ABS, .code = ABS_MT_TOUCH_MAJOR, .value = 2 }, 52a46c0ec8Sopenharmony_ci { .type = EV_ABS, .code = ABS_MT_TOUCH_MINOR, .value = 2 }, 53a46c0ec8Sopenharmony_ci { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, 54a46c0ec8Sopenharmony_ci { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, 55a46c0ec8Sopenharmony_ci { .type = EV_ABS, .code = ABS_MT_PRESSURE, .value = LITEST_AUTO_ASSIGN }, 56a46c0ec8Sopenharmony_ci { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, 57a46c0ec8Sopenharmony_ci { .type = -1, .code = -1 }, 58a46c0ec8Sopenharmony_ci}; 59a46c0ec8Sopenharmony_ci 60a46c0ec8Sopenharmony_cistatic int 61a46c0ec8Sopenharmony_ciget_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value) 62a46c0ec8Sopenharmony_ci{ 63a46c0ec8Sopenharmony_ci switch (evcode) { 64a46c0ec8Sopenharmony_ci case ABS_PRESSURE: 65a46c0ec8Sopenharmony_ci case ABS_MT_PRESSURE: 66a46c0ec8Sopenharmony_ci *value = 30; 67a46c0ec8Sopenharmony_ci return 0; 68a46c0ec8Sopenharmony_ci } 69a46c0ec8Sopenharmony_ci return 1; 70a46c0ec8Sopenharmony_ci} 71a46c0ec8Sopenharmony_ci 72a46c0ec8Sopenharmony_cistatic struct litest_device_interface interface = { 73a46c0ec8Sopenharmony_ci .touch_down_events = down, 74a46c0ec8Sopenharmony_ci .touch_move_events = move, 75a46c0ec8Sopenharmony_ci 76a46c0ec8Sopenharmony_ci .get_axis_default = get_axis_default, 77a46c0ec8Sopenharmony_ci}; 78a46c0ec8Sopenharmony_ci 79a46c0ec8Sopenharmony_cistatic struct input_id input_id = { 80a46c0ec8Sopenharmony_ci .bustype = 0x1d, 81a46c0ec8Sopenharmony_ci .vendor = 0x6cb, 82a46c0ec8Sopenharmony_ci .product = 0x0, 83a46c0ec8Sopenharmony_ci}; 84a46c0ec8Sopenharmony_ci 85a46c0ec8Sopenharmony_cistatic int events[] = { 86a46c0ec8Sopenharmony_ci EV_KEY, BTN_LEFT, 87a46c0ec8Sopenharmony_ci EV_KEY, BTN_TOOL_FINGER, 88a46c0ec8Sopenharmony_ci EV_KEY, BTN_TOOL_QUINTTAP, 89a46c0ec8Sopenharmony_ci EV_KEY, BTN_TOUCH, 90a46c0ec8Sopenharmony_ci EV_KEY, BTN_TOOL_DOUBLETAP, 91a46c0ec8Sopenharmony_ci EV_KEY, BTN_TOOL_TRIPLETAP, 92a46c0ec8Sopenharmony_ci EV_KEY, BTN_TOOL_QUADTAP, 93a46c0ec8Sopenharmony_ci INPUT_PROP_MAX, INPUT_PROP_POINTER, 94a46c0ec8Sopenharmony_ci INPUT_PROP_MAX, INPUT_PROP_BUTTONPAD, 95a46c0ec8Sopenharmony_ci -1, -1, 96a46c0ec8Sopenharmony_ci}; 97a46c0ec8Sopenharmony_ci 98a46c0ec8Sopenharmony_cistatic struct input_absinfo absinfo[] = { 99a46c0ec8Sopenharmony_ci { ABS_X, 0, 1940, 0, 0, 20 }, 100a46c0ec8Sopenharmony_ci { ABS_Y, 0, 1062, 0, 0, 20 }, 101a46c0ec8Sopenharmony_ci { ABS_PRESSURE, 0, 255, 0, 0, 0 }, 102a46c0ec8Sopenharmony_ci { ABS_MT_SLOT, 0, 4, 0, 0, 0 }, 103a46c0ec8Sopenharmony_ci { ABS_MT_TOUCH_MAJOR, 0, 15, 0, 0, 0 }, 104a46c0ec8Sopenharmony_ci { ABS_MT_TOUCH_MINOR, 0, 15, 0, 0, 0 }, 105a46c0ec8Sopenharmony_ci { ABS_MT_ORIENTATION, 0, 1, 0, 0, 0 }, 106a46c0ec8Sopenharmony_ci { ABS_MT_POSITION_X, 0, 1940, 0, 0, 20 }, 107a46c0ec8Sopenharmony_ci { ABS_MT_POSITION_Y, 0, 1062, 0, 0, 20 }, 108a46c0ec8Sopenharmony_ci { ABS_MT_TOOL_TYPE, 0, 2, 0, 0, 0 }, 109a46c0ec8Sopenharmony_ci { ABS_MT_TRACKING_ID, 0, 65535, 0, 0, 0 }, 110a46c0ec8Sopenharmony_ci { ABS_MT_PRESSURE, 0, 255, 0, 0, 0 }, 111a46c0ec8Sopenharmony_ci { .value = -1 } 112a46c0ec8Sopenharmony_ci}; 113a46c0ec8Sopenharmony_ci 114a46c0ec8Sopenharmony_ciTEST_DEVICE("synaptics-rmi4", 115a46c0ec8Sopenharmony_ci .type = LITEST_SYNAPTICS_RMI4, 116a46c0ec8Sopenharmony_ci .features = LITEST_TOUCHPAD | LITEST_CLICKPAD | LITEST_BUTTON, 117a46c0ec8Sopenharmony_ci .interface = &interface, 118a46c0ec8Sopenharmony_ci 119a46c0ec8Sopenharmony_ci .name = "Synaptics TM3053-004", 120a46c0ec8Sopenharmony_ci .id = &input_id, 121a46c0ec8Sopenharmony_ci .events = events, 122a46c0ec8Sopenharmony_ci .absinfo = absinfo, 123a46c0ec8Sopenharmony_ci) 124