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
13 #include <linux/delay.h>
47 struct input_dev *dev = sermouse->dev; in sermouse_process_msc()
48 signed char *buf = sermouse->buf; in sermouse_process_msc()
50 switch (sermouse->count) { in sermouse_process_msc()
63 input_report_rel(dev, REL_Y, -buf[1]); in sermouse_process_msc()
64 buf[0] = data - data / 2; in sermouse_process_msc()
70 input_report_rel(dev, REL_Y, buf[1] - data); in sermouse_process_msc()
77 if (++sermouse->count == 5) in sermouse_process_msc()
78 sermouse->count = 0; in sermouse_process_msc()
84 * standard 3-byte packets and 1200 bps.
89 struct input_dev *dev = sermouse->dev; in sermouse_process_ms()
90 signed char *buf = sermouse->buf; in sermouse_process_ms()
93 sermouse->count = 0; in sermouse_process_ms()
94 else if (sermouse->count == 0) in sermouse_process_ms()
97 switch (sermouse->count) { in sermouse_process_ms()
110 buf[3] = data - data / 2; in sermouse_process_ms()
114 /* Guessing the state of the middle button on 3-button MS-protocol mice - ugly. */ in sermouse_process_ms()
115 if ((sermouse->type == SERIO_MS) && !data && !buf[2] && !((buf[0] & 0xf0) ^ buf[1])) in sermouse_process_ms()
116 input_report_key(dev, BTN_MIDDLE, !test_bit(BTN_MIDDLE, dev->key)); in sermouse_process_ms()
121 input_report_rel(dev, REL_Y, data - buf[4]); in sermouse_process_ms()
127 switch (sermouse->type) { in sermouse_process_ms()
130 sermouse->type = SERIO_MP; in sermouse_process_ms()
146 input_report_rel(dev, REL_WHEEL, (data & 8) - (data & 7)); in sermouse_process_ms()
153 case 6: /* MZ++ packet type. We can get these bytes for M++ too but we ignore them later. */ in sermouse_process_ms()
159 if (sermouse->type != SERIO_MZPP) in sermouse_process_ms()
164 case 1: /* Extra mouse info */ in sermouse_process_ms()
168 input_report_rel(dev, data & 0x80 ? REL_HWHEEL : REL_WHEEL, (data & 7) - (data & 8)); in sermouse_process_ms()
172 default: /* We don't decode anything else yet. */ in sermouse_process_ms()
184 sermouse->count++; in sermouse_process_ms()
197 if (time_after(jiffies, sermouse->last + HZ/10)) in sermouse_interrupt()
198 sermouse->count = 0; in sermouse_interrupt()
200 sermouse->last = jiffies; in sermouse_interrupt()
202 if (sermouse->type > SERIO_SUN) in sermouse_interrupt()
211 * sermouse_disconnect() cleans up after we don't want talk
221 input_unregister_device(sermouse->dev); in sermouse_disconnect()
234 unsigned char c = serio->id.extra; in sermouse_connect()
235 int err = -ENOMEM; in sermouse_connect()
242 sermouse->dev = input_dev; in sermouse_connect()
243 snprintf(sermouse->phys, sizeof(sermouse->phys), "%s/input0", serio->phys); in sermouse_connect()
244 sermouse->type = serio->id.proto; in sermouse_connect()
246 input_dev->name = sermouse_protocols[sermouse->type]; in sermouse_connect()
247 input_dev->phys = sermouse->phys; in sermouse_connect()
248 input_dev->id.bustype = BUS_RS232; in sermouse_connect()
249 input_dev->id.vendor = sermouse->type; in sermouse_connect()
250 input_dev->id.product = c; in sermouse_connect()
251 input_dev->id.version = 0x0100; in sermouse_connect()
252 input_dev->dev.parent = &serio->dev; in sermouse_connect()
254 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); in sermouse_connect()
255 input_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) | in sermouse_connect()
257 input_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); in sermouse_connect()
259 if (c & 0x01) set_bit(BTN_MIDDLE, input_dev->keybit); in sermouse_connect()
260 if (c & 0x02) set_bit(BTN_SIDE, input_dev->keybit); in sermouse_connect()
261 if (c & 0x04) set_bit(BTN_EXTRA, input_dev->keybit); in sermouse_connect()
262 if (c & 0x10) set_bit(REL_WHEEL, input_dev->relbit); in sermouse_connect()
263 if (c & 0x20) set_bit(REL_HWHEEL, input_dev->relbit); in sermouse_connect()
271 err = input_register_device(sermouse->dev); in sermouse_connect()
289 .extra = SERIO_ANY,
295 .extra = SERIO_ANY,
301 .extra = SERIO_ANY,
307 .extra = SERIO_ANY,
313 .extra = SERIO_ANY,
319 .extra = SERIO_ANY,
325 .extra = SERIO_ANY,