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