Lines Matching +full:number +full:- +full:of +full:- +full:wires
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Driver for DEC VSXXX-AA mouse (hockey-puck mouse, ball or two rollers)
4 * DEC VSXXX-GA mouse (rectangular mouse, with ball)
5 * DEC VSXXX-AB tablet (digitizer with hair cross or stylus)
7 * Copyright (C) 2003-2004 by Jan-Benedict Glaw <jbglaw@lug-owl.de>
24 * supply at +5V and -12V.
30 * | 4 --- 3 |
32 * -------
35 * 1 (GND) 5 7 -
36 * 2 (RxD) 2 3 -
37 * 3 (TxD) 3 2 -
38 * 4 (-12V) - - Somewhere from the PSU. At ATX, it's
39 * the thin blue wire at pin 12 of the
41 * VSXXX-AA/-GA mice.
42 * 5 (+5V) - - PSU (red wires of ATX power connector
45 * 6 (+12V) - - HDD power connector, yellow wire. Only
46 * required for VSXXX-AB digitizer.
47 * 7 (dev. avail.) - - The mouse shorts this one to pin 1.
53 * wires to a RS232 port and two or three additional wires for +5V, +12V and
54 * -12V to the PSU.
58 * The mice and tablet are described in "VCB02 Video Subsystem - Technical
59 * Manual", DEC EK-104AA-TM-001. You'll find it at MANX, a search engine
61 * http://www.vt100.net/manx/details?pn=EK-104AA-TM-001;id=21;cp=1
71 #define DRIVER_DESC "Driver for DEC VSXXX-AA and -GA mice and VSXXX-AB tablet"
73 MODULE_AUTHOR("Jan-Benedict Glaw <jbglaw@lug-owl.de>");
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()
123 if (mouse->count == BUFLEN) { in vsxxxaa_queue_byte()
124 printk(KERN_ERR "%s on %s: Dropping a byte of full buffer.\n", in vsxxxaa_queue_byte()
125 mouse->name, mouse->phys); in vsxxxaa_queue_byte()
131 mouse->buf[mouse->count++] = byte; in vsxxxaa_queue_byte()
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()
160 * Returns number of bytes to be dropped, 0 if packet is okay.
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()
176 "Need to drop %d bytes of a broken packet.\n", in vsxxxaa_check_packet()
177 i - 1); in vsxxxaa_check_packet()
179 packet_len, i, mouse->buf[i]); in vsxxxaa_check_packet()
180 return i - 1; in vsxxxaa_check_packet()
190 return mouse->count >= len && MATCH_PACKET_TYPE(mouse->buf[0], type); in vsxxxaa_smells_like_packet()
195 struct input_dev *dev = mouse->dev; in vsxxxaa_handle_REL_packet()
196 unsigned char *buf = mouse->buf; in vsxxxaa_handle_REL_packet()
210 * Low 7 bit of byte 1 are abs(dx), bit 7 is in vsxxxaa_handle_REL_packet()
211 * 0, bit 4 of byte 0 is direction. in vsxxxaa_handle_REL_packet()
214 dx *= ((buf[0] >> 4) & 0x01) ? 1 : -1; in vsxxxaa_handle_REL_packet()
217 * Low 7 bit of byte 2 are abs(dy), bit 7 is in vsxxxaa_handle_REL_packet()
218 * 0, bit 3 of byte 0 is direction. in vsxxxaa_handle_REL_packet()
221 dy *= ((buf[0] >> 3) & 0x01) ? -1 : 1; in vsxxxaa_handle_REL_packet()
225 * (for three buttons) of byte 0. in vsxxxaa_handle_REL_packet()
234 mouse->name, mouse->phys, dx, dy, in vsxxxaa_handle_REL_packet()
251 struct input_dev *dev = mouse->dev; in vsxxxaa_handle_ABS_packet()
252 unsigned char *buf = mouse->buf; in vsxxxaa_handle_ABS_packet()
267 * Get X/Y position. Y axis needs to be inverted since VSXXX-AB in vsxxxaa_handle_ABS_packet()
268 * counts down->top while monitor counts top->bottom. in vsxxxaa_handle_ABS_packet()
272 y = 1023 - y; in vsxxxaa_handle_ABS_packet()
275 * Get button state. It's bits <4..1> of byte 0. in vsxxxaa_handle_ABS_packet()
285 mouse->name, mouse->phys, x, y, in vsxxxaa_handle_ABS_packet()
303 struct input_dev *dev = mouse->dev; in vsxxxaa_handle_POR_packet()
304 unsigned char *buf = mouse->buf; in vsxxxaa_handle_POR_packet()
309 * Check for Power-On-Reset packets. These are sent out in vsxxxaa_handle_POR_packet()
320 * E: Error code. If it's in the range of 0x00..0x1f, only some 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()
333 * (for three buttons) of byte 0. Maybe even the bit <3> 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()
374 unsigned char *buf = mouse->buf; in vsxxxaa_parse_buffer()
382 * Out of sync? Throw away what we don't understand. Each in vsxxxaa_parse_buffer()
385 * data...) will get shifted out of the buffer after some in vsxxxaa_parse_buffer()
388 while (mouse->count > 0 && !IS_HDR_BYTE(buf[0])) { in vsxxxaa_parse_buffer()
391 mouse->name, mouse->phys); in vsxxxaa_parse_buffer()
449 input_unregister_device(mouse->dev); in vsxxxaa_disconnect()
457 int err = -ENOMEM; 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()
472 input_dev->id.bustype = BUS_RS232; in vsxxxaa_connect()
473 input_dev->dev.parent = &serio->dev; in vsxxxaa_connect()
475 __set_bit(EV_KEY, input_dev->evbit); /* We have buttons */ in vsxxxaa_connect()
476 __set_bit(EV_REL, input_dev->evbit); in vsxxxaa_connect()
477 __set_bit(EV_ABS, input_dev->evbit); in vsxxxaa_connect()
478 __set_bit(BTN_LEFT, input_dev->keybit); /* We have 3 buttons */ in vsxxxaa_connect()
479 __set_bit(BTN_MIDDLE, input_dev->keybit); in vsxxxaa_connect()
480 __set_bit(BTN_RIGHT, input_dev->keybit); in vsxxxaa_connect()
481 __set_bit(BTN_TOUCH, input_dev->keybit); /* ...and Tablet */ in vsxxxaa_connect()
482 __set_bit(REL_X, input_dev->relbit); in vsxxxaa_connect()
483 __set_bit(REL_Y, input_dev->relbit); in vsxxxaa_connect()