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