Changes in uspace/drv/bus/usb/usbhid/multimedia/multimedia.c [5f6e25e:5da7199] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhid/multimedia/multimedia.c
r5f6e25e r5da7199 47 47 #include <errno.h> 48 48 #include <async.h> 49 #include <async_obsolete.h>50 49 #include <str_error.h> 51 50 … … 53 52 #include <io/console.h> 54 53 55 // FIXME: remove this header 56 #include <abi/ipc/methods.h> 57 58 #define NAME "multimedia-keys" 54 #define NAME "multimedia-keys" 59 55 60 56 /*----------------------------------------------------------------------------*/ … … 69 65 /** Count of stored keys (i.e. number of keys in the report). */ 70 66 //size_t key_count; 71 /** IPC phoneto the console device (for sending key events). */72 int console_phone;67 /** IPC session to the console device (for sending key events). */ 68 async_sess_t *console_sess; 73 69 } usb_multimedia_t; 74 70 … … 79 75 * 80 76 * Currently recognizes only one method (IPC_M_CONNECT_TO_ME), in which case it 81 * assumes the caller is the console and thus it stores IPC phone to it for77 * assumes the caller is the console and thus it stores IPC session to it for 82 78 * later use by the driver to notify about key events. 83 79 * … … 91 87 usb_log_debug(NAME " default_connection_handler()\n"); 92 88 93 sysarg_t method = IPC_GET_IMETHOD(*icall);94 95 89 usb_multimedia_t *multim_dev = (usb_multimedia_t *)fun->driver_data; 96 90 … … 99 93 return; 100 94 } 101 102 if (method == IPC_M_CONNECT_TO_ME) { 103 int callback = IPC_GET_ARG5(*icall); 104 105 if (multim_dev->console_phone != -1) { 95 96 async_sess_t *sess = 97 async_callback_receive_start(EXCHANGE_SERIALIZE, icall); 98 if (sess != NULL) { 99 if (multim_dev->console_sess == NULL) { 100 multim_dev->console_sess = sess; 101 usb_log_debug(NAME " Saved session to console: %p\n", 102 sess); 103 async_answer_0(icallid, EOK); 104 } else 106 105 async_answer_0(icallid, ELIMIT); 107 return; 108 } 109 110 multim_dev->console_phone = callback; 111 usb_log_debug(NAME " Saved phone to console: %d\n", callback); 112 async_answer_0(icallid, EOK); 113 return; 114 } 115 116 async_answer_0(icallid, EINVAL); 106 } else 107 async_answer_0(icallid, EINVAL); 117 108 } 118 109 … … 155 146 156 147 usb_log_debug2(NAME " Sending key %d to the console\n", ev.key); 157 if (multim_dev->console_ phone < 0) {148 if (multim_dev->console_sess == NULL) { 158 149 usb_log_warning( 159 150 "Connection to console not ready, key discarded.\n"); … … 161 152 } 162 153 163 async_obsolete_msg_4(multim_dev->console_phone, KBDEV_EVENT, ev.type, ev.key, 164 ev.mods, ev.c); 154 async_exch_t *exch = async_exchange_begin(multim_dev->console_sess); 155 async_msg_4(exch, KBDEV_EVENT, ev.type, ev.key, ev.mods, ev.c); 156 async_exchange_end(exch); 165 157 } 166 158 … … 222 214 } 223 215 224 multim_dev->console_ phone = -1;216 multim_dev->console_sess = NULL; 225 217 226 218 /*! @todo Autorepeat */ … … 250 242 if (data != NULL) { 251 243 usb_multimedia_t *multim_dev = (usb_multimedia_t *)data; 252 // hangup phoneto the console253 async_ obsolete_hangup(multim_dev->console_phone);244 // hangup session to the console 245 async_hangup(multim_dev->console_sess); 254 246 } 255 247 }
Note:
See TracChangeset
for help on using the changeset viewer.