Lines Matching full:mouse
2 * QEMU Microsoft serial mouse emulation
43 /* Mouse ID: Send "M3" cause we behave like a 3 button logitech mouse. */
75 MouseChardev *mouse = MOUSE_CHARDEV(chr); in DECLARE_INSTANCE_CHECKER() local
79 avail = fifo8_num_used(&mouse->outbuf); in DECLARE_INSTANCE_CHECKER()
84 buf = fifo8_pop_bufptr(&mouse->outbuf, MIN(len, avail), &size); in DECLARE_INSTANCE_CHECKER()
91 static void msmouse_queue_event(MouseChardev *mouse) in msmouse_queue_event() argument
96 dx = mouse->axis[INPUT_AXIS_X]; in msmouse_queue_event()
97 mouse->axis[INPUT_AXIS_X] = 0; in msmouse_queue_event()
99 dy = mouse->axis[INPUT_AXIS_Y]; in msmouse_queue_event()
100 mouse->axis[INPUT_AXIS_Y] = 0; in msmouse_queue_event()
108 bytes[0] |= (mouse->btns[INPUT_BUTTON_LEFT] ? 0x20 : 0x00); in msmouse_queue_event()
109 bytes[0] |= (mouse->btns[INPUT_BUTTON_RIGHT] ? 0x10 : 0x00); in msmouse_queue_event()
110 if (mouse->btns[INPUT_BUTTON_MIDDLE] || in msmouse_queue_event()
111 mouse->btnc[INPUT_BUTTON_MIDDLE]) { in msmouse_queue_event()
112 bytes[3] |= (mouse->btns[INPUT_BUTTON_MIDDLE] ? 0x20 : 0x00); in msmouse_queue_event()
113 mouse->btnc[INPUT_BUTTON_MIDDLE] = false; in msmouse_queue_event()
117 if (fifo8_num_free(&mouse->outbuf) >= count) { in msmouse_queue_event()
118 fifo8_push_all(&mouse->outbuf, bytes, count); in msmouse_queue_event()
127 MouseChardev *mouse = MOUSE_CHARDEV(dev); in msmouse_input_event() local
131 /* Ignore events if serial mouse powered down. */ in msmouse_input_event()
132 if (!MSMOUSE_PWR(mouse->tiocm)) { in msmouse_input_event()
139 mouse->axis[move->axis] += move->value; in msmouse_input_event()
144 mouse->btns[btn->button] = btn->down; in msmouse_input_event()
145 mouse->btnc[btn->button] = true; in msmouse_input_event()
156 MouseChardev *mouse = MOUSE_CHARDEV(dev); in msmouse_input_sync() local
159 /* Ignore events if serial mouse powered down. */ in msmouse_input_sync()
160 if (!MSMOUSE_PWR(mouse->tiocm)) { in msmouse_input_sync()
164 msmouse_queue_event(mouse); in msmouse_input_sync()
170 /* Ignore writes to mouse port */ in msmouse_chr_write()
175 .name = "QEMU Microsoft Mouse",
183 MouseChardev *mouse = MOUSE_CHARDEV(chr); in msmouse_ioctl() local
193 c = mouse->tiocm; in msmouse_ioctl()
194 mouse->tiocm = *(int *)arg; in msmouse_ioctl()
195 if (MSMOUSE_PWR(mouse->tiocm)) { in msmouse_ioctl()
201 fifo8_push_all(&mouse->outbuf, mouse_id, sizeof(mouse_id)); in msmouse_ioctl()
203 fifo8_push_all(&mouse->outbuf, pnp_data, sizeof(pnp_data)); in msmouse_ioctl()
221 fifo8_push_all(&mouse->outbuf, bytes, i); in msmouse_ioctl()
228 * Reset mouse buffers on power down. in msmouse_ioctl()
229 * Mouse won't send anything without power. in msmouse_ioctl()
231 fifo8_reset(&mouse->outbuf); in msmouse_ioctl()
232 memset(mouse->axis, 0, sizeof(mouse->axis)); in msmouse_ioctl()
233 memset(mouse->btns, false, sizeof(mouse->btns)); in msmouse_ioctl()
234 memset(mouse->btnc, false, sizeof(mouse->btns)); in msmouse_ioctl()
238 *targ = mouse->tiocm; in msmouse_ioctl()
248 MouseChardev *mouse = MOUSE_CHARDEV(obj); in char_msmouse_finalize() local
250 if (mouse->hs) { in char_msmouse_finalize()
251 qemu_input_handler_unregister(mouse->hs); in char_msmouse_finalize()
253 fifo8_destroy(&mouse->outbuf); in char_msmouse_finalize()
261 MouseChardev *mouse = MOUSE_CHARDEV(chr); in msmouse_chr_open() local
264 mouse->hs = qemu_input_handler_register((DeviceState *)mouse, in msmouse_chr_open()
266 mouse->tiocm = 0; in msmouse_chr_open()
267 fifo8_create(&mouse->outbuf, MSMOUSE_BUF_SZ); in msmouse_chr_open()