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