Changes in uspace/drv/bus/usb/usbhid/kbd/kbddev.c [5da7199:5f6e25e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhid/kbd/kbddev.c
r5da7199 r5f6e25e 43 43 #include <ipc/kbdev.h> 44 44 #include <async.h> 45 #include <async_obsolete.h> 45 46 #include <fibril.h> 46 47 #include <fibril_synch.h> … … 69 70 70 71 #include "../usbhid.h" 72 73 // FIXME: remove this header 74 #include <abi/ipc/methods.h> 71 75 72 76 /*----------------------------------------------------------------------------*/ … … 163 167 * 164 168 * Currently recognizes only one method (IPC_M_CONNECT_TO_ME), in which case it 165 * assumes the caller is the console and thus it stores IPC session to it for169 * assumes the caller is the console and thus it stores IPC phone to it for 166 170 * later use by the driver to notify about key events. 167 171 * … … 174 178 { 175 179 sysarg_t method = IPC_GET_IMETHOD(*icall); 176 177 usb_kbd_t *kbd_dev = (usb_kbd_t *) fun->driver_data; 180 int callback; 181 182 usb_kbd_t *kbd_dev = (usb_kbd_t *)fun->driver_data; 178 183 if (kbd_dev == NULL) { 179 184 usb_log_debug("default_connection_handler: " … … 182 187 return; 183 188 } 184 185 async_sess_t *sess = 186 async_callback_receive_start(EXCHANGE_SERIALIZE, icall); 187 if (sess != NULL) { 188 if (kbd_dev->console_sess == NULL) { 189 kbd_dev->console_sess = sess; 190 usb_log_debug("default_connection_handler: OK\n"); 191 async_answer_0(icallid, EOK); 192 } else { 189 190 switch (method) { 191 case IPC_M_CONNECT_TO_ME: 192 callback = IPC_GET_ARG5(*icall); 193 194 if (kbd_dev->console_phone != -1) { 193 195 usb_log_debug("default_connection_handler: " 194 "console sessionalready set\n");196 "console phone already set\n"); 195 197 async_answer_0(icallid, ELIMIT); 196 } 197 } else { 198 switch (method) { 199 case KBDEV_SET_IND: 200 kbd_dev->mods = IPC_GET_ARG1(*icall); 201 usb_kbd_set_led(kbd_dev->hid_dev, kbd_dev); 202 async_answer_0(icallid, EOK); 203 break; 204 default: 205 usb_log_debug("default_connection_handler: Wrong function.\n"); 206 async_answer_0(icallid, EINVAL); 207 break; 208 } 198 return; 199 } 200 201 kbd_dev->console_phone = callback; 202 203 usb_log_debug("default_connection_handler: OK\n"); 204 async_answer_0(icallid, EOK); 205 break; 206 case KBDEV_SET_IND: 207 kbd_dev->mods = IPC_GET_ARG1(*icall); 208 usb_kbd_set_led(kbd_dev->hid_dev, kbd_dev); 209 async_answer_0(icallid, EOK); 210 break; 211 default: 212 usb_log_debug("default_connection_handler: Wrong function.\n"); 213 async_answer_0(icallid, EINVAL); 214 break; 209 215 } 210 216 } … … 295 301 { 296 302 usb_log_debug2("Sending kbdev event %d/%d to the console\n", type, key); 297 if (kbd_dev->console_ sess == NULL) {303 if (kbd_dev->console_phone < 0) { 298 304 usb_log_warning( 299 305 "Connection to console not ready, key discarded.\n"); … … 301 307 } 302 308 303 async_exch_t *exch = async_exchange_begin(kbd_dev->console_sess); 304 async_msg_2(exch, KBDEV_EVENT, type, key); 305 async_exchange_end(exch); 309 async_obsolete_msg_2(kbd_dev->console_phone, KBDEV_EVENT, type, key); 306 310 } 307 311 … … 506 510 } 507 511 508 kbd_dev->console_ sess = NULL;512 kbd_dev->console_phone = -1; 509 513 kbd_dev->initialized = USB_KBD_STATUS_UNINITIALIZED; 510 514 … … 781 785 } 782 786 783 // hangup sessionto the console784 async_ hangup(kbd_dev->console_sess);787 // hangup phone to the console 788 async_obsolete_hangup(kbd_dev->console_phone); 785 789 786 790 if (kbd_dev->repeat_mtx != NULL) {
Note:
See TracChangeset
for help on using the changeset viewer.