Changes in / [948911d:2df6f6fe] in mainline
- Location:
- uspace
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhid/kbd/kbddev.c
r948911d r2df6f6fe 71 71 #include "../usbhid.h" 72 72 73 static void default_connection_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *);74 static ddf_dev_ops_t kbdops = { .default_handler = default_connection_handler };75 73 /*----------------------------------------------------------------------------*/ 76 74 … … 189 187 break; 190 188 } 191 if (kbd_dev->c lient_sess == NULL) {192 kbd_dev->c lient_sess = sess;189 if (kbd_dev->console_sess == NULL) { 190 kbd_dev->console_sess = sess; 193 191 usb_log_debug("%s: OK\n", __FUNCTION__); 194 192 async_answer_0(icallid, EOK); … … 294 292 { 295 293 usb_log_debug2("Sending kbdev event %d/%d to the console\n", type, key); 296 if (kbd_dev->c lient_sess == NULL) {294 if (kbd_dev->console_sess == NULL) { 297 295 usb_log_warning( 298 296 "Connection to console not ready, key discarded.\n"); … … 300 298 } 301 299 302 async_exch_t *exch = async_exchange_begin(kbd_dev->c lient_sess);300 async_exch_t *exch = async_exchange_begin(kbd_dev->console_sess); 303 301 if (exch != NULL) { 304 302 async_msg_2(exch, KBDEV_EVENT, type, key); … … 501 499 /* Store the initialized HID device and HID ops 502 500 * to the DDF function. */ 503 fun->ops = &kbd ops;501 fun->ops = &kbd_dev->ops; 504 502 fun->driver_data = kbd_dev; 505 503 … … 578 576 fibril_mutex_initialize(&kbd_dev->repeat_mtx); 579 577 kbd_dev->initialized = USB_KBD_STATUS_UNINITIALIZED; 578 kbd_dev->ops.default_handler = default_connection_handler; 580 579 581 580 /* Store link to HID device */ … … 738 737 739 738 /* Hangup session to the console. */ 740 if (kbd_dev->c lient_sess)741 async_hangup(kbd_dev->c lient_sess);739 if (kbd_dev->console_sess) 740 async_hangup(kbd_dev->console_sess); 742 741 743 742 //assert(!fibril_mutex_is_locked((*kbd_dev)->repeat_mtx)); -
uspace/drv/bus/usb/usbhid/kbd/kbddev.h
r948911d r2df6f6fe 82 82 unsigned lock_keys; 83 83 84 /** IPC session to client (for sending key events). */ 85 async_sess_t *client_sess; 84 /** IPC session to the console device (for sending key events). */ 85 async_sess_t *console_sess; 86 87 /** @todo What is this actually? */ 88 ddf_dev_ops_t ops; 86 89 87 90 /** Information for auto-repeat of keys. */ -
uspace/drv/bus/usb/usbhid/mouse/mousedev.c
r948911d r2df6f6fe 54 54 #define NAME "mouse" 55 55 56 static void default_connection_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *); 57 58 static ddf_dev_ops_t ops = { .default_handler = default_connection_handler }; 59 60 /*----------------------------------------------------------------------------*/ 56 /*----------------------------------------------------------------------------*/ 57 61 58 const usb_endpoint_description_t usb_hid_mouse_poll_endpoint_description = { 62 59 .transfer_type = USB_TRANSFER_INTERRUPT, … … 224 221 assert(index < mouse_dev->buttons_count); 225 222 226 if (mouse_dev->buttons[index] != field->value) {223 if (mouse_dev->buttons[index] == 0 && field->value != 0) { 227 224 async_exch_t *exch = 228 225 async_exchange_begin(mouse_dev->mouse_sess); 229 226 if (exch != NULL) { 230 227 async_req_2_0(exch, MOUSEEV_BUTTON_EVENT, 231 field->usage, (field->value != 0) ? 1 : 0); 228 field->usage, 1); 229 async_exchange_end(exch); 230 mouse_dev->buttons[index] = field->value; 231 } 232 233 } else if (mouse_dev->buttons[index] != 0 && field->value == 0) { 234 async_exch_t *exch = 235 async_exchange_begin(mouse_dev->mouse_sess); 236 if (exch != NULL) { 237 async_req_2_0(exch, MOUSEEV_BUTTON_EVENT, 238 field->usage, 0); 232 239 async_exchange_end(exch); 233 240 mouse_dev->buttons[index] = field->value; … … 272 279 } 273 280 274 fun->ops = & ops;281 fun->ops = &mouse->ops; 275 282 fun->driver_data = mouse; 276 283 … … 295 302 } 296 303 mouse->mouse_fun = fun; 304 297 305 return EOK; 298 306 } … … 371 379 } 372 380 381 // set handler for incoming calls 382 mouse_dev->ops.default_handler = default_connection_handler; 383 373 384 // TODO: how to know if the device supports the request??? 374 385 usbhid_req_set_idle(&hid_dev->usb_dev->ctrl_pipe, -
uspace/drv/bus/usb/usbhid/mouse/mousedev.h
r948911d r2df6f6fe 46 46 /** Container for USB mouse device. */ 47 47 typedef struct { 48 /** IPC session to cons umer. */48 /** IPC session to console (consumer). */ 49 49 async_sess_t *mouse_sess; 50 50 … … 53 53 size_t buttons_count; 54 54 55 ddf_dev_ops_t ops; 55 56 /* DDF mouse function */ 56 57 ddf_fun_t *mouse_fun; -
uspace/lib/drv/generic/remote_usb.c
r948911d r2df6f6fe 56 56 { 57 57 if (!exch) 58 return E BADMEM;58 return EINVAL; 59 59 sysarg_t addr; 60 60 const int ret = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE), … … 75 75 { 76 76 if (!exch) 77 return E BADMEM;77 return EINVAL; 78 78 sysarg_t iface_no; 79 79 const int ret = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE), … … 92 92 { 93 93 if (!exch) 94 return E BADMEM;94 return EINVAL; 95 95 devman_handle_t h; 96 96 const int ret = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE), -
uspace/lib/drv/generic/remote_usbhc.c
r948911d r2df6f6fe 165 165 { 166 166 if (!exch || !address) 167 return E BADMEM;167 return EINVAL; 168 168 sysarg_t new_address; 169 169 const int ret = async_req_4_1(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), … … 178 178 { 179 179 if (!exch) 180 return E BADMEM;180 return EINVAL; 181 181 return async_req_3_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), 182 182 IPC_M_USBHC_BIND_ADDRESS, address, handle); … … 187 187 { 188 188 if (!exch) 189 return E BADMEM;189 return EINVAL; 190 190 sysarg_t h; 191 191 const int ret = async_req_2_1(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), … … 199 199 { 200 200 if (!exch) 201 return E BADMEM;201 return EINVAL; 202 202 return async_req_2_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), 203 203 IPC_M_USBHC_RELEASE_ADDRESS, address); … … 209 209 { 210 210 if (!exch) 211 return E BADMEM;211 return EINVAL; 212 212 const usb_target_t target = 213 213 {{ .address = address, .endpoint = endpoint }}; … … 225 225 { 226 226 if (!exch) 227 return E BADMEM;227 return EINVAL; 228 228 return async_req_4_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), 229 229 IPC_M_USBHC_UNREGISTER_ENDPOINT, address, endpoint, direction); … … 234 234 size_t *rec_size) 235 235 { 236 if (!exch)237 return EBADMEM;238 239 236 if (size == 0 && setup == 0) 240 237 return EOK; 241 238 239 if (!exch) 240 return EINVAL; 242 241 const usb_target_t target = 243 242 {{ .address = address, .endpoint = endpoint }}; … … 289 288 usb_endpoint_t endpoint, uint64_t setup, const void *data, size_t size) 290 289 { 291 if (!exch)292 return EBADMEM;293 294 290 if (size == 0 && setup == 0) 295 291 return EOK; 296 292 293 if (!exch) 294 return EINVAL; 297 295 const usb_target_t target = 298 296 {{ .address = address, .endpoint = endpoint }};
Note:
See TracChangeset
for help on using the changeset viewer.