Changeset 21bb58d in mainline
- Timestamp:
- 2011-03-02T20:20:42Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 24aa62c, 5dd9209
- Parents:
- 103ae7f8
- Location:
- uspace/drv/usbmouse
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbmouse/init.c
r103ae7f8 r21bb58d 100 100 } 101 101 102 static void default_connection_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *); 103 static ddf_dev_ops_t mouse_ops = { 104 .default_handler = default_connection_handler 105 }; 106 107 /** Default handler for IPC methods not handled by DDF. 108 * 109 * @param dev Device handling the call. 110 * @param icallid Call id. 111 * @param icall Call data. 112 */ 113 void default_connection_handler(ddf_fun_t *fun, 114 ipc_callid_t icallid, ipc_call_t *icall) 115 { 116 sysarg_t method = IPC_GET_IMETHOD(*icall); 117 118 usb_mouse_t *mouse = (usb_mouse_t *) fun->driver_data; 119 assert(mouse != NULL); 120 121 if (method == IPC_M_CONNECT_TO_ME) { 122 int callback = IPC_GET_ARG5(*icall); 123 124 if (mouse->console_phone != -1) { 125 async_answer_0(icallid, ELIMIT); 126 return; 127 } 128 129 mouse->console_phone = callback; 130 async_answer_0(icallid, EOK); 131 return; 132 } 133 134 async_answer_0(icallid, EINVAL); 135 } 136 102 137 103 138 int usb_mouse_create(ddf_dev_t *dev) … … 108 143 } 109 144 mouse->device = dev; 145 mouse->console_phone = -1; 110 146 111 147 int rc; … … 144 180 goto leave; 145 181 } 182 183 mouse->mouse_fun->ops = &mouse_ops; 184 146 185 rc = ddf_fun_bind(mouse->mouse_fun); 147 186 if (rc != EOK) { … … 157 196 /* Everything allright. */ 158 197 dev->driver_data = mouse; 198 mouse->mouse_fun->driver_data = mouse; 159 199 160 200 return EOK; -
uspace/drv/usbmouse/mouse.c
r103ae7f8 r21bb58d 37 37 #include <usb/debug.h> 38 38 #include <errno.h> 39 #include <ipc/mouse.h> 39 40 40 41 int usb_mouse_polling_fibril(void *arg) … … 94 95 } 95 96 97 if (mouse->console_phone >= 0) { 98 if ((shift_x != 0) || (shift_y != 0)) { 99 /* FIXME: guessed for QEMU */ 100 async_req_2_0(mouse->console_phone, 101 MEVENT_MOVE, 102 - shift_x / 10, - shift_y / 10); 103 } 104 if (butt) { 105 /* FIXME: proper button clicking. */ 106 async_req_2_0(mouse->console_phone, 107 MEVENT_BUTTON, 1, 1); 108 async_req_2_0(mouse->console_phone, 109 MEVENT_BUTTON, 1, 0); 110 } 111 } 112 96 113 usb_log_debug("buttons=%s dX=%+3d dY=%+3d wheel=%+3d\n", 97 114 str_buttons, shift_x, shift_y, wheel); -
uspace/drv/usbmouse/mouse.h
r103ae7f8 r21bb58d 50 50 usb_endpoint_pipe_t poll_pipe; 51 51 suseconds_t poll_interval_us; 52 int console_phone; 52 53 } usb_mouse_t; 53 54
Note:
See TracChangeset
for help on using the changeset viewer.