Lines Matching defs:mouse
3 * Driver for DEC VSXXX-AA mouse (hockey-puck mouse, ball or two rollers)
4 * DEC VSXXX-GA mouse (rectangular mouse, with ball)
23 * anything if you break your mouse, your computer or whatever!
25 * In theory, this mouse is a simple RS232 device. In practice, it has got
50 * 7 (dev. avail.) - - The mouse shorts this one to pin 1.
52 * the mouse. To use it with the adaptor,
55 * So to get a working adaptor, you need to connect the mouse with three
114 static void vsxxxaa_drop_bytes(struct vsxxxaa *mouse, int num)
116 if (num >= mouse->count) {
117 mouse->count = 0;
119 memmove(mouse->buf, mouse->buf + num, BUFLEN - num);
120 mouse->count -= num;
124 static void vsxxxaa_queue_byte(struct vsxxxaa *mouse, unsigned char byte)
126 if (mouse->count == BUFLEN) {
128 mouse->name, mouse->phys);
129 vsxxxaa_drop_bytes(mouse, 1);
134 mouse->buf[mouse->count++] = byte;
137 static void vsxxxaa_detection_done(struct vsxxxaa *mouse)
139 switch (mouse->type) {
141 strlcpy(mouse->name, "DEC VSXXX-AA/-GA mouse",
142 sizeof(mouse->name));
146 strlcpy(mouse->name, "DEC VSXXX-AB digitizer",
147 sizeof(mouse->name));
151 snprintf(mouse->name, sizeof(mouse->name),
153 mouse->type);
159 mouse->name, mouse->version, mouse->country, mouse->phys);
165 static int vsxxxaa_check_packet(struct vsxxxaa *mouse, int packet_len)
170 if (!IS_HDR_BYTE(mouse->buf[0])) {
171 DBG("vsck: len=%d, 1st=0x%02x\n", packet_len, mouse->buf[0]);
177 if (IS_HDR_BYTE(mouse->buf[i])) {
182 packet_len, i, mouse->buf[i]);
190 static inline int vsxxxaa_smells_like_packet(struct vsxxxaa *mouse,
193 return mouse->count >= len && MATCH_PACKET_TYPE(mouse->buf[0], type);
196 static void vsxxxaa_handle_REL_packet(struct vsxxxaa *mouse)
198 struct input_dev *dev = mouse->dev;
199 unsigned char *buf = mouse->buf;
234 vsxxxaa_drop_bytes(mouse, 3);
237 mouse->name, mouse->phys, dx, dy,
252 static void vsxxxaa_handle_ABS_packet(struct vsxxxaa *mouse)
254 struct input_dev *dev = mouse->dev;
255 unsigned char *buf = mouse->buf;
285 vsxxxaa_drop_bytes(mouse, 5);
288 mouse->name, mouse->phys, x, y,
304 static void vsxxxaa_handle_POR_packet(struct vsxxxaa *mouse)
306 struct input_dev *dev = mouse->dev;
307 unsigned char *buf = mouse->buf;
313 * after plugging the mouse in, or when explicitly
326 * D: <0010> == mouse, <0100> == tablet
329 mouse->version = buf[0] & 0x0f;
330 mouse->country = (buf[1] >> 4) & 0x07;
331 mouse->type = buf[1] & 0x0f;
343 vsxxxaa_drop_bytes(mouse, 4);
344 vsxxxaa_detection_done(mouse);
356 mouse->name, mouse->phys, error);
361 * If the mouse was hot-plugged, we need to force differential mode
367 mouse->name, mouse->phys);
368 serio_write(mouse->serio, 'S'); /* Standard format */
370 serio_write(mouse->serio, 'R'); /* Incremental */
372 serio_write(mouse->serio, 'L'); /* 72 samples/sec */
375 static void vsxxxaa_parse_buffer(struct vsxxxaa *mouse)
377 unsigned char *buf = mouse->buf;
389 * activity on the mouse.
391 while (mouse->count > 0 && !IS_HDR_BYTE(buf[0])) {
393 "sync with mouse data stream...\n",
394 mouse->name, mouse->phys);
395 vsxxxaa_drop_bytes(mouse, 1);
402 if (vsxxxaa_smells_like_packet(mouse, VSXXXAA_PACKET_REL, 3)) {
404 stray_bytes = vsxxxaa_check_packet(mouse, 3);
406 vsxxxaa_handle_REL_packet(mouse);
408 } else if (vsxxxaa_smells_like_packet(mouse,
411 stray_bytes = vsxxxaa_check_packet(mouse, 5);
413 vsxxxaa_handle_ABS_packet(mouse);
415 } else if (vsxxxaa_smells_like_packet(mouse,
418 stray_bytes = vsxxxaa_check_packet(mouse, 4);
420 vsxxxaa_handle_POR_packet(mouse);
429 vsxxxaa_drop_bytes(mouse, stray_bytes);
438 struct vsxxxaa *mouse = serio_get_drvdata(serio);
440 vsxxxaa_queue_byte(mouse, data);
441 vsxxxaa_parse_buffer(mouse);
448 struct vsxxxaa *mouse = serio_get_drvdata(serio);
452 input_unregister_device(mouse->dev);
453 kfree(mouse);
458 struct vsxxxaa *mouse;
462 mouse = kzalloc(sizeof(struct vsxxxaa), GFP_KERNEL);
464 if (!mouse || !input_dev)
467 mouse->dev = input_dev;
468 mouse->serio = serio;
469 strlcat(mouse->name, "DEC VSXXX-AA/-GA mouse or VSXXX-AB digitizer",
470 sizeof(mouse->name));
471 snprintf(mouse->phys, sizeof(mouse->phys), "%s/input0", serio->phys);
473 input_dev->name = mouse->name;
474 input_dev->phys = mouse->phys;
490 serio_set_drvdata(serio, mouse);
511 kfree(mouse);