Changeset 571ba2a in mainline
- Timestamp:
- 2011-10-14T15:00:05Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- af8c9b54
- Parents:
- 7b54b99
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhid/multimedia/multimedia.c
r7b54b99 r571ba2a 64 64 //int32_t *keys; 65 65 /** Count of stored keys (i.e. number of keys in the report). */ 66 //size_t key_count; 66 //size_t key_count; 67 67 /** IPC session to the console device (for sending key events). */ 68 68 async_sess_t *console_sess; … … 86 86 { 87 87 usb_log_debug(NAME " default_connection_handler()\n"); 88 88 89 89 usb_multimedia_t *multim_dev = (usb_multimedia_t *)fun->driver_data; 90 90 91 91 if (multim_dev == NULL) { 92 92 async_answer_0(icallid, EINVAL); 93 93 return; 94 94 } 95 95 96 96 async_sess_t *sess = 97 97 async_callback_receive_start(EXCHANGE_SERIALIZE, icall); … … 137 137 assert(hid_dev != NULL); 138 138 assert(multim_dev != NULL); 139 139 140 140 kbd_event_t ev; 141 141 142 142 ev.type = type; 143 143 ev.key = key; … … 151 151 return; 152 152 } 153 153 154 154 async_exch_t *exch = async_exchange_begin(multim_dev->console_sess); 155 155 async_msg_4(exch, KBDEV_EVENT, ev.type, ev.key, ev.mods, ev.c); … … 169 169 return ENOMEM; 170 170 } 171 171 172 172 fun->ops = &multimedia_ops; 173 173 fun->driver_data = multim_dev; // TODO: maybe change to hid_dev->data 174 174 175 175 int rc = ddf_fun_bind(fun); 176 176 if (rc != EOK) { 177 177 usb_log_error("Could not bind DDF function: %s.\n", 178 178 str_error(rc)); 179 // TODO: Can / should I destroy the DDF function?180 179 ddf_fun_destroy(fun); 181 180 return rc; 182 181 } 183 182 184 183 usb_log_debug("%s function created (handle: %" PRIun ").\n", 185 184 NAME, fun->handle); 186 185 187 186 rc = ddf_fun_add_to_category(fun, "keyboard"); 188 187 if (rc != EOK) { … … 190 189 "Could not add DDF function to category 'keyboard': %s.\n", 191 190 str_error(rc)); 192 // TODO: Can / should I destroy the DDF function?193 191 ddf_fun_destroy(fun); 194 192 return rc; 195 193 } 196 194 197 195 return EOK; 198 196 } … … 205 203 return EINVAL; /*! @todo Other return code? */ 206 204 } 207 205 208 206 usb_log_debug(NAME " Initializing HID/multimedia structure...\n"); 209 207 210 208 usb_multimedia_t *multim_dev = (usb_multimedia_t *)malloc( 211 209 sizeof(usb_multimedia_t)); … … 213 211 return ENOMEM; 214 212 } 215 213 216 214 multim_dev->console_sess = NULL; 217 215 218 216 /*! @todo Autorepeat */ 219 217 220 218 // save the KBD device structure into the HID device structure 221 219 *data = multim_dev; 222 220 223 221 usb_log_debug(NAME " HID/multimedia device structure initialized.\n"); 224 222 225 223 int rc = usb_multimedia_create_function(hid_dev, multim_dev); 226 224 if (rc != EOK) 227 225 return rc; 228 226 229 227 usb_log_debug(NAME " HID/multimedia structure initialized.\n"); 230 228 231 229 return EOK; 232 230 } … … 239 237 return; 240 238 } 241 239 242 240 if (data != NULL) { 243 241 usb_multimedia_t *multim_dev = (usb_multimedia_t *)data; … … 257 255 258 256 usb_multimedia_t *multim_dev = (usb_multimedia_t *)data; 259 257 260 258 usb_hid_report_path_t *path = usb_hid_report_path(); 261 259 usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_CONSUMER, 0); … … 283 281 key); 284 282 } 285 283 286 284 field = usb_hid_report_get_sibling( 287 285 hid_dev->report, field, path, USB_HID_PATH_COMPARE_END 288 286 | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 289 287 USB_HID_REPORT_TYPE_INPUT); 290 } 288 } 291 289 292 290 usb_hid_report_path_free(path); 293 291 294 292 return true; 295 293 }
Note:
See TracChangeset
for help on using the changeset viewer.