Lines Matching +full:6 +full:- +full:axis

29 #include "chardev/char-serial.h"
35 #define MSMOUSE_HI2(n) (((n) & 0xc0) >> 6)
38 /* Serial PnP for 6 bit devices/mice sends all ASCII chars - 0x20 */
39 #define M(c) (c - 0x20)
62 int axis[INPUT_AXIS__MAX]; member
69 #define TYPE_CHARDEV_MSMOUSE "chardev-msmouse"
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()
87 avail -= size; in DECLARE_INSTANCE_CHECKER()
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()
120 /* queue full -> drop event */ in msmouse_queue_event()
132 if (!MSMOUSE_PWR(mouse->tiocm)) { in msmouse_input_event()
136 switch (evt->type) { in msmouse_input_event()
138 move = evt->u.rel.data; in msmouse_input_event()
139 mouse->axis[move->axis] += move->value; in msmouse_input_event()
143 btn = evt->u.btn.data; 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()
160 if (!MSMOUSE_PWR(mouse->tiocm)) { in msmouse_input_sync()
188 M('6'), M('7'), M('8'), M('9'), M('A'), M('B'), in msmouse_ioctl()
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()
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()
241 return -ENOTSUP; in msmouse_ioctl()
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()
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()
274 cc->open = msmouse_chr_open; in char_msmouse_class_init()
275 cc->chr_write = msmouse_chr_write; in char_msmouse_class_init()
276 cc->chr_accept_input = msmouse_chr_accept_input; in char_msmouse_class_init()
277 cc->chr_ioctl = msmouse_ioctl; in char_msmouse_class_init()