Changeset 400735e in mainline for uspace/drv/usbhid/multimedia/multimedia.c
- Timestamp:
- 2011-05-28T14:30:58Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3fb5a3e
- Parents:
- e8f826b (diff), 48141f0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhid/multimedia/multimedia.c
re8f826b r400735e 43 43 #include <usb/debug.h> 44 44 #include <usb/hid/usages/core.h> 45 #include <usb/hid/usages/consumer.h> 45 46 46 47 #include <errno.h> … … 58 59 typedef struct usb_multimedia_t { 59 60 /** Previously pressed keys (not translated to key codes). */ 60 int32_t *keys_old;61 //int32_t *keys_old; 61 62 /** Currently pressed keys (not translated to key codes). */ 62 int32_t *keys;63 //int32_t *keys; 63 64 /** Count of stored keys (i.e. number of keys in the report). */ 64 size_t key_count;65 //size_t key_count; 65 66 /** IPC phone to the console device (for sending key events). */ 66 67 int console_phone; … … 174 175 175 176 // free all buffers 176 if ((*multim_dev)->keys != NULL) {177 free((*multim_dev)->keys);178 }179 if ((*multim_dev)->keys_old != NULL) {180 free((*multim_dev)->keys_old);181 }177 // if ((*multim_dev)->keys != NULL) { 178 // free((*multim_dev)->keys); 179 // } 180 // if ((*multim_dev)->keys_old != NULL) { 181 // free((*multim_dev)->keys_old); 182 // } 182 183 183 184 free(*multim_dev); … … 209 210 return rc; 210 211 } 212 213 usb_log_debug("%s function created (jandle: %" PRIun ").\n", 214 NAME, fun->handle); 211 215 212 216 rc = ddf_fun_add_to_class(fun, "keyboard"); … … 241 245 multim_dev->console_phone = -1; 242 246 243 usb_hid_report_path_t *path = usb_hid_report_path();244 usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_CONSUMER, 0);245 246 usb_hid_report_path_set_report_id(path, 1);247 248 multim_dev->key_count = usb_hid_report_size(249 hid_dev->report, 0, USB_HID_REPORT_TYPE_INPUT);250 251 usb_hid_report_path_free(path);252 253 usb_log_debug(NAME " Size of the input report: %zu\n",254 multim_dev->key_count);255 256 multim_dev->keys = (int32_t *)calloc(multim_dev->key_count,257 sizeof(int32_t));258 259 if (multim_dev->keys == NULL) {260 usb_log_fatal("No memory!\n");261 free(multim_dev);262 return ENOMEM;263 }264 265 multim_dev->keys_old =266 (int32_t *)calloc(multim_dev->key_count, sizeof(int32_t));267 268 if (multim_dev->keys_old == NULL) {269 usb_log_fatal("No memory!\n");270 free(multim_dev->keys);271 free(multim_dev);272 return ENOMEM;273 }247 // usb_hid_report_path_t *path = usb_hid_report_path(); 248 // usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_CONSUMER, 0); 249 250 // usb_hid_report_path_set_report_id(path, 1); 251 252 // multim_dev->key_count = usb_hid_report_size( 253 // hid_dev->report, 1, USB_HID_REPORT_TYPE_INPUT); 254 255 // usb_hid_report_path_free(path); 256 257 // usb_log_debug(NAME " Size of the input report: %zu\n", 258 // multim_dev->key_count); 259 260 // multim_dev->keys = (int32_t *)calloc(multim_dev->key_count, 261 // sizeof(int32_t)); 262 263 // if (multim_dev->keys == NULL) { 264 // usb_log_fatal("No memory!\n"); 265 // free(multim_dev); 266 // return ENOMEM; 267 // } 268 269 // multim_dev->keys_old = 270 // (int32_t *)calloc(multim_dev->key_count, sizeof(int32_t)); 271 272 // if (multim_dev->keys_old == NULL) { 273 // usb_log_fatal("No memory!\n"); 274 // free(multim_dev->keys); 275 // free(multim_dev); 276 // return ENOMEM; 277 // } 274 278 275 279 /*! @todo Autorepeat */ … … 357 361 usb_multimedia_map_usage(field->usage); 358 362 const char *key_str = 359 usb _multimedia_usage_to_str(field->usage);363 usbhid_multimedia_usage_to_str(field->usage); 360 364 usb_log_info("Pressed key: %s\n", key_str); 361 365 usb_multimedia_push_ev(hid_dev, multim_dev, KEY_PRESS,
Note:
See TracChangeset
for help on using the changeset viewer.