Changes in uspace/drv/usbhid/multimedia/multimedia.c [65b458c4:3e95cd7] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhid/multimedia/multimedia.c
r65b458c4 r3e95cd7 40 40 #include "keymap.h" 41 41 42 #include <usb/ classes/hidparser.h>42 #include <usb/hid/hidparser.h> 43 43 #include <usb/debug.h> 44 #include <usb/classes/hidut.h> 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. Handle: %d\n", NAME, fun->handle); 211 214 212 215 rc = ddf_fun_add_to_class(fun, "keyboard"); … … 241 244 multim_dev->console_phone = -1; 242 245 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 }246 // usb_hid_report_path_t *path = usb_hid_report_path(); 247 // usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_CONSUMER, 0); 248 249 // usb_hid_report_path_set_report_id(path, 1); 250 251 // multim_dev->key_count = usb_hid_report_size( 252 // hid_dev->report, 1, USB_HID_REPORT_TYPE_INPUT); 253 254 // usb_hid_report_path_free(path); 255 256 // usb_log_debug(NAME " Size of the input report: %zu\n", 257 // multim_dev->key_count); 258 259 // multim_dev->keys = (int32_t *)calloc(multim_dev->key_count, 260 // sizeof(int32_t)); 261 262 // if (multim_dev->keys == NULL) { 263 // usb_log_fatal("No memory!\n"); 264 // free(multim_dev); 265 // return ENOMEM; 266 // } 267 268 // multim_dev->keys_old = 269 // (int32_t *)calloc(multim_dev->key_count, sizeof(int32_t)); 270 271 // if (multim_dev->keys_old == NULL) { 272 // usb_log_fatal("No memory!\n"); 273 // free(multim_dev->keys); 274 // free(multim_dev); 275 // return ENOMEM; 276 // } 274 277 275 278 /*! @todo Autorepeat */ … … 357 360 usb_multimedia_map_usage(field->usage); 358 361 const char *key_str = 359 usb _multimedia_usage_to_str(field->usage);362 usbhid_multimedia_usage_to_str(field->usage); 360 363 usb_log_info("Pressed key: %s\n", key_str); 361 364 usb_multimedia_push_ev(hid_dev, multim_dev, KEY_PRESS,
Note:
See TracChangeset
for help on using the changeset viewer.