Lines Matching +full:we +full:- +full:extra +full:- +full:delay

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (c) 1999-2001 Vojtech Pavlik
10 #include <linux/delay.h>
44 struct input_dev *dev = sermouse->dev; in sermouse_process_msc()
45 signed char *buf = sermouse->buf; in sermouse_process_msc()
47 switch (sermouse->count) { in sermouse_process_msc()
60 input_report_rel(dev, REL_Y, -buf[1]); in sermouse_process_msc()
61 buf[0] = data - data / 2; in sermouse_process_msc()
67 input_report_rel(dev, REL_Y, buf[1] - data); in sermouse_process_msc()
74 if (++sermouse->count == 5) in sermouse_process_msc()
75 sermouse->count = 0; in sermouse_process_msc()
81 * standard 3-byte packets and 1200 bps.
86 struct input_dev *dev = sermouse->dev; in sermouse_process_ms()
87 signed char *buf = sermouse->buf; in sermouse_process_ms()
90 sermouse->count = 0; in sermouse_process_ms()
91 else if (sermouse->count == 0) in sermouse_process_ms()
94 switch (sermouse->count) { in sermouse_process_ms()
107 buf[3] = data - data / 2; in sermouse_process_ms()
111 /* Guessing the state of the middle button on 3-button MS-protocol mice - ugly. */ in sermouse_process_ms()
112 if ((sermouse->type == SERIO_MS) && !data && !buf[2] && !((buf[0] & 0xf0) ^ buf[1])) in sermouse_process_ms()
113 input_report_key(dev, BTN_MIDDLE, !test_bit(BTN_MIDDLE, dev->key)); in sermouse_process_ms()
118 input_report_rel(dev, REL_Y, data - buf[4]); in sermouse_process_ms()
124 switch (sermouse->type) { in sermouse_process_ms()
127 sermouse->type = SERIO_MP; in sermouse_process_ms()
143 input_report_rel(dev, REL_WHEEL, (data & 8) - (data & 7)); in sermouse_process_ms()
150 case 6: /* MZ++ packet type. We can get these bytes for M++ too but we ignore them later. */ in sermouse_process_ms()
156 if (sermouse->type != SERIO_MZPP) in sermouse_process_ms()
161 case 1: /* Extra mouse info */ in sermouse_process_ms()
165 input_report_rel(dev, data & 0x80 ? REL_HWHEEL : REL_WHEEL, (data & 7) - (data & 8)); in sermouse_process_ms()
169 default: /* We don't decode anything else yet. */ in sermouse_process_ms()
181 sermouse->count++; in sermouse_process_ms()
194 if (time_after(jiffies, sermouse->last + HZ/10)) in sermouse_interrupt()
195 sermouse->count = 0; in sermouse_interrupt()
197 sermouse->last = jiffies; in sermouse_interrupt()
199 if (sermouse->type > SERIO_SUN) in sermouse_interrupt()
208 * sermouse_disconnect() cleans up after we don't want talk
218 input_unregister_device(sermouse->dev); in sermouse_disconnect()
231 unsigned char c = serio->id.extra; in sermouse_connect()
232 int err = -ENOMEM; in sermouse_connect()
239 sermouse->dev = input_dev; in sermouse_connect()
240 snprintf(sermouse->phys, sizeof(sermouse->phys), "%s/input0", serio->phys); in sermouse_connect()
241 sermouse->type = serio->id.proto; in sermouse_connect()
243 input_dev->name = sermouse_protocols[sermouse->type]; in sermouse_connect()
244 input_dev->phys = sermouse->phys; in sermouse_connect()
245 input_dev->id.bustype = BUS_RS232; in sermouse_connect()
246 input_dev->id.vendor = sermouse->type; in sermouse_connect()
247 input_dev->id.product = c; in sermouse_connect()
248 input_dev->id.version = 0x0100; in sermouse_connect()
249 input_dev->dev.parent = &serio->dev; in sermouse_connect()
251 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); in sermouse_connect()
252 input_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) | in sermouse_connect()
254 input_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); in sermouse_connect()
256 if (c & 0x01) set_bit(BTN_MIDDLE, input_dev->keybit); in sermouse_connect()
257 if (c & 0x02) set_bit(BTN_SIDE, input_dev->keybit); in sermouse_connect()
258 if (c & 0x04) set_bit(BTN_EXTRA, input_dev->keybit); in sermouse_connect()
259 if (c & 0x10) set_bit(REL_WHEEL, input_dev->relbit); in sermouse_connect()
260 if (c & 0x20) set_bit(REL_HWHEEL, input_dev->relbit); in sermouse_connect()
268 err = input_register_device(sermouse->dev); in sermouse_connect()
286 .extra = SERIO_ANY,
292 .extra = SERIO_ANY,
298 .extra = SERIO_ANY,
304 .extra = SERIO_ANY,
310 .extra = SERIO_ANY,
316 .extra = SERIO_ANY,
322 .extra = SERIO_ANY,