Lines Matching +full:signed +full:- +full:by
2 * Copyright (c) 1999-2001 Vojtech Pavlik
11 * it under the terms of the GNU General Public License as published by
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 * Should you need to contact me, the author, you can do so either by
25 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
49 signed char buf[8];
62 static void sermouse_process_msc(struct sermouse *sermouse, signed char data) in sermouse_process_msc()
64 struct input_dev *dev = sermouse->dev; in sermouse_process_msc()
65 signed char *buf = sermouse->buf; in sermouse_process_msc()
67 switch (sermouse->count) { in sermouse_process_msc()
80 input_report_rel(dev, REL_Y, -buf[1]); in sermouse_process_msc()
81 buf[0] = data - data / 2; in sermouse_process_msc()
87 input_report_rel(dev, REL_Y, buf[1] - data); in sermouse_process_msc()
94 if (++sermouse->count == 5) in sermouse_process_msc()
95 sermouse->count = 0; in sermouse_process_msc()
101 * standard 3-byte packets and 1200 bps.
104 static void sermouse_process_ms(struct sermouse *sermouse, signed char data) in sermouse_process_ms()
106 struct input_dev *dev = sermouse->dev; in sermouse_process_ms()
107 signed char *buf = sermouse->buf; in sermouse_process_ms()
110 sermouse->count = 0; in sermouse_process_ms()
111 else if (sermouse->count == 0) in sermouse_process_ms()
114 switch (sermouse->count) { in sermouse_process_ms()
124 data = (signed char) (((buf[1] << 6) & 0xc0) | (data & 0x3f)); in sermouse_process_ms()
127 buf[3] = data - data / 2; in sermouse_process_ms()
131 /* Guessing the state of the middle button on 3-button MS-protocol mice - ugly. */ in sermouse_process_ms()
132 if ((sermouse->type == SERIO_MS) && !data && !buf[2] && !((buf[0] & 0xf0) ^ buf[1])) in sermouse_process_ms()
133 input_report_key(dev, BTN_MIDDLE, !test_bit(BTN_MIDDLE, dev->key)); in sermouse_process_ms()
136 data = (signed char) (((buf[1] << 4) & 0xc0) | (data & 0x3f)); in sermouse_process_ms()
138 input_report_rel(dev, REL_Y, data - buf[4]); in sermouse_process_ms()
144 switch (sermouse->type) { in sermouse_process_ms()
147 sermouse->type = SERIO_MP; in sermouse_process_ms()
161 input_report_rel(dev, REL_WHEEL, (data & 8) - (data & 7)); in sermouse_process_ms()
174 if (sermouse->type != SERIO_MZPP) in sermouse_process_ms()
183 input_report_rel(dev, data & 0x80 ? REL_HWHEEL : REL_WHEEL, (data & 7) - (data & 8)); in sermouse_process_ms()
199 sermouse->count++; in sermouse_process_ms()
212 if (time_after(jiffies, sermouse->last + HZ/10)) in sermouse_interrupt()
213 sermouse->count = 0; in sermouse_interrupt()
215 sermouse->last = jiffies; in sermouse_interrupt()
217 if (sermouse->type > SERIO_SUN) in sermouse_interrupt()
236 input_unregister_device(sermouse->dev); in sermouse_disconnect()
249 unsigned char c = serio->id.extra; in sermouse_connect()
250 int err = -ENOMEM; in sermouse_connect()
257 sermouse->dev = input_dev; in sermouse_connect()
258 snprintf(sermouse->phys, sizeof(sermouse->phys), "%s/input0", serio->phys); in sermouse_connect()
259 sermouse->type = serio->id.proto; in sermouse_connect()
261 input_dev->name = sermouse_protocols[sermouse->type]; in sermouse_connect()
262 input_dev->phys = sermouse->phys; in sermouse_connect()
263 input_dev->id.bustype = BUS_RS232; in sermouse_connect()
264 input_dev->id.vendor = sermouse->type; in sermouse_connect()
265 input_dev->id.product = c; in sermouse_connect()
266 input_dev->id.version = 0x0100; in sermouse_connect()
267 input_dev->dev.parent = &serio->dev; in sermouse_connect()
269 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); in sermouse_connect()
270 input_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) | in sermouse_connect()
272 input_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); in sermouse_connect()
274 if (c & 0x01) set_bit(BTN_MIDDLE, input_dev->keybit); in sermouse_connect()
275 if (c & 0x02) set_bit(BTN_SIDE, input_dev->keybit); in sermouse_connect()
276 if (c & 0x04) set_bit(BTN_EXTRA, input_dev->keybit); in sermouse_connect()
277 if (c & 0x10) set_bit(REL_WHEEL, input_dev->relbit); in sermouse_connect()
278 if (c & 0x20) set_bit(REL_HWHEEL, input_dev->relbit); in sermouse_connect()
286 err = input_register_device(sermouse->dev); in sermouse_connect()