Lines Matching full:mouse

3  * Driver for	DEC VSXXX-AA mouse (hockey-puck mouse, ball or two rollers)
4 * DEC VSXXX-GA mouse (rectangular mouse, with ball)
20 * anything if you break your mouse, your computer or whatever!
22 * In theory, this mouse is a simple RS232 device. In practice, it has got
47 * 7 (dev. avail.) - - The mouse shorts this one to pin 1.
49 * the mouse. To use it with the adaptor,
52 * So to get a working adaptor, you need to connect the mouse with three
111 static void vsxxxaa_drop_bytes(struct vsxxxaa *mouse, int num) in vsxxxaa_drop_bytes() argument
113 if (num >= mouse->count) { in vsxxxaa_drop_bytes()
114 mouse->count = 0; in vsxxxaa_drop_bytes()
116 memmove(mouse->buf, mouse->buf + num, BUFLEN - num); in vsxxxaa_drop_bytes()
117 mouse->count -= num; in vsxxxaa_drop_bytes()
121 static void vsxxxaa_queue_byte(struct vsxxxaa *mouse, unsigned char byte) in vsxxxaa_queue_byte() argument
123 if (mouse->count == BUFLEN) { in vsxxxaa_queue_byte()
125 mouse->name, mouse->phys); in vsxxxaa_queue_byte()
126 vsxxxaa_drop_bytes(mouse, 1); in vsxxxaa_queue_byte()
131 mouse->buf[mouse->count++] = byte; in vsxxxaa_queue_byte()
134 static void vsxxxaa_detection_done(struct vsxxxaa *mouse) in vsxxxaa_detection_done() argument
136 switch (mouse->type) { in vsxxxaa_detection_done()
138 strscpy(mouse->name, "DEC VSXXX-AA/-GA mouse", in vsxxxaa_detection_done()
139 sizeof(mouse->name)); in vsxxxaa_detection_done()
143 strscpy(mouse->name, "DEC VSXXX-AB digitizer", in vsxxxaa_detection_done()
144 sizeof(mouse->name)); in vsxxxaa_detection_done()
148 snprintf(mouse->name, sizeof(mouse->name), in vsxxxaa_detection_done()
150 mouse->type); in vsxxxaa_detection_done()
156 mouse->name, mouse->version, mouse->country, mouse->phys); in vsxxxaa_detection_done()
162 static int vsxxxaa_check_packet(struct vsxxxaa *mouse, int packet_len) in vsxxxaa_check_packet() argument
167 if (!IS_HDR_BYTE(mouse->buf[0])) { in vsxxxaa_check_packet()
168 DBG("vsck: len=%d, 1st=0x%02x\n", packet_len, mouse->buf[0]); in vsxxxaa_check_packet()
174 if (IS_HDR_BYTE(mouse->buf[i])) { in vsxxxaa_check_packet()
179 packet_len, i, mouse->buf[i]); in vsxxxaa_check_packet()
187 static inline int vsxxxaa_smells_like_packet(struct vsxxxaa *mouse, in vsxxxaa_smells_like_packet() argument
190 return mouse->count >= len && MATCH_PACKET_TYPE(mouse->buf[0], type); in vsxxxaa_smells_like_packet()
193 static void vsxxxaa_handle_REL_packet(struct vsxxxaa *mouse) in vsxxxaa_handle_REL_packet() argument
195 struct input_dev *dev = mouse->dev; in vsxxxaa_handle_REL_packet()
196 unsigned char *buf = mouse->buf; in vsxxxaa_handle_REL_packet()
231 vsxxxaa_drop_bytes(mouse, 3); in vsxxxaa_handle_REL_packet()
234 mouse->name, mouse->phys, dx, dy, in vsxxxaa_handle_REL_packet()
249 static void vsxxxaa_handle_ABS_packet(struct vsxxxaa *mouse) in vsxxxaa_handle_ABS_packet() argument
251 struct input_dev *dev = mouse->dev; in vsxxxaa_handle_ABS_packet()
252 unsigned char *buf = mouse->buf; in vsxxxaa_handle_ABS_packet()
282 vsxxxaa_drop_bytes(mouse, 5); in vsxxxaa_handle_ABS_packet()
285 mouse->name, mouse->phys, x, y, in vsxxxaa_handle_ABS_packet()
301 static void vsxxxaa_handle_POR_packet(struct vsxxxaa *mouse) in vsxxxaa_handle_POR_packet() argument
303 struct input_dev *dev = mouse->dev; in vsxxxaa_handle_POR_packet()
304 unsigned char *buf = mouse->buf; in vsxxxaa_handle_POR_packet()
310 * after plugging the mouse in, or when explicitly in vsxxxaa_handle_POR_packet()
323 * D: <0010> == mouse, <0100> == tablet in vsxxxaa_handle_POR_packet()
326 mouse->version = buf[0] & 0x0f; in vsxxxaa_handle_POR_packet()
327 mouse->country = (buf[1] >> 4) & 0x07; in vsxxxaa_handle_POR_packet()
328 mouse->type = buf[1] & 0x0f; in vsxxxaa_handle_POR_packet()
340 vsxxxaa_drop_bytes(mouse, 4); in vsxxxaa_handle_POR_packet()
341 vsxxxaa_detection_done(mouse); in vsxxxaa_handle_POR_packet()
353 mouse->name, mouse->phys, error); in vsxxxaa_handle_POR_packet()
358 * If the mouse was hot-plugged, we need to force differential mode in vsxxxaa_handle_POR_packet()
364 mouse->name, mouse->phys); in vsxxxaa_handle_POR_packet()
365 serio_write(mouse->serio, 'S'); /* Standard format */ in vsxxxaa_handle_POR_packet()
367 serio_write(mouse->serio, 'R'); /* Incremental */ in vsxxxaa_handle_POR_packet()
369 serio_write(mouse->serio, 'L'); /* 72 samples/sec */ in vsxxxaa_handle_POR_packet()
372 static void vsxxxaa_parse_buffer(struct vsxxxaa *mouse) in vsxxxaa_parse_buffer() argument
374 unsigned char *buf = mouse->buf; in vsxxxaa_parse_buffer()
386 * activity on the mouse. in vsxxxaa_parse_buffer()
388 while (mouse->count > 0 && !IS_HDR_BYTE(buf[0])) { in vsxxxaa_parse_buffer()
390 "sync with mouse data stream...\n", in vsxxxaa_parse_buffer()
391 mouse->name, mouse->phys); in vsxxxaa_parse_buffer()
392 vsxxxaa_drop_bytes(mouse, 1); in vsxxxaa_parse_buffer()
399 if (vsxxxaa_smells_like_packet(mouse, VSXXXAA_PACKET_REL, 3)) { in vsxxxaa_parse_buffer()
401 stray_bytes = vsxxxaa_check_packet(mouse, 3); in vsxxxaa_parse_buffer()
403 vsxxxaa_handle_REL_packet(mouse); in vsxxxaa_parse_buffer()
405 } else if (vsxxxaa_smells_like_packet(mouse, in vsxxxaa_parse_buffer()
408 stray_bytes = vsxxxaa_check_packet(mouse, 5); in vsxxxaa_parse_buffer()
410 vsxxxaa_handle_ABS_packet(mouse); in vsxxxaa_parse_buffer()
412 } else if (vsxxxaa_smells_like_packet(mouse, in vsxxxaa_parse_buffer()
415 stray_bytes = vsxxxaa_check_packet(mouse, 4); in vsxxxaa_parse_buffer()
417 vsxxxaa_handle_POR_packet(mouse); in vsxxxaa_parse_buffer()
426 vsxxxaa_drop_bytes(mouse, stray_bytes); in vsxxxaa_parse_buffer()
435 struct vsxxxaa *mouse = serio_get_drvdata(serio); in vsxxxaa_interrupt() local
437 vsxxxaa_queue_byte(mouse, data); in vsxxxaa_interrupt()
438 vsxxxaa_parse_buffer(mouse); in vsxxxaa_interrupt()
445 struct vsxxxaa *mouse = serio_get_drvdata(serio); in vsxxxaa_disconnect() local
449 input_unregister_device(mouse->dev); in vsxxxaa_disconnect()
450 kfree(mouse); in vsxxxaa_disconnect()
455 struct vsxxxaa *mouse; in vsxxxaa_connect() local
459 mouse = kzalloc(sizeof(*mouse), GFP_KERNEL); in vsxxxaa_connect()
461 if (!mouse || !input_dev) in vsxxxaa_connect()
464 mouse->dev = input_dev; in vsxxxaa_connect()
465 mouse->serio = serio; in vsxxxaa_connect()
466 strlcat(mouse->name, "DEC VSXXX-AA/-GA mouse or VSXXX-AB digitizer", in vsxxxaa_connect()
467 sizeof(mouse->name)); in vsxxxaa_connect()
468 snprintf(mouse->phys, sizeof(mouse->phys), "%s/input0", serio->phys); in vsxxxaa_connect()
470 input_dev->name = mouse->name; in vsxxxaa_connect()
471 input_dev->phys = mouse->phys; in vsxxxaa_connect()
487 serio_set_drvdata(serio, mouse); in vsxxxaa_connect()
508 kfree(mouse); in vsxxxaa_connect()