Changes in uspace/drv/usbhid/multimedia/multimedia.c [3e95cd7:65b458c4] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhid/multimedia/multimedia.c
r3e95cd7 r65b458c4 40 40 #include "keymap.h" 41 41 42 #include <usb/ hid/hidparser.h>42 #include <usb/classes/hidparser.h> 43 43 #include <usb/debug.h> 44 #include <usb/hid/usages/core.h> 45 #include <usb/hid/usages/consumer.h> 44 #include <usb/classes/hidut.h> 46 45 47 46 #include <errno.h> … … 59 58 typedef struct usb_multimedia_t { 60 59 /** Previously pressed keys (not translated to key codes). */ 61 //int32_t *keys_old;60 int32_t *keys_old; 62 61 /** Currently pressed keys (not translated to key codes). */ 63 //int32_t *keys;62 int32_t *keys; 64 63 /** Count of stored keys (i.e. number of keys in the report). */ 65 //size_t key_count;64 size_t key_count; 66 65 /** IPC phone to the console device (for sending key events). */ 67 66 int console_phone; … … 175 174 176 175 // free all buffers 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 //}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 } 183 182 184 183 free(*multim_dev); … … 210 209 return rc; 211 210 } 212 213 usb_log_debug("%s function created. Handle: %d\n", NAME, fun->handle);214 211 215 212 rc = ddf_fun_add_to_class(fun, "keyboard"); … … 244 241 multim_dev->console_phone = -1; 245 242 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 //}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 } 277 274 278 275 /*! @todo Autorepeat */ … … 360 357 usb_multimedia_map_usage(field->usage); 361 358 const char *key_str = 362 usb hid_multimedia_usage_to_str(field->usage);359 usb_multimedia_usage_to_str(field->usage); 363 360 usb_log_info("Pressed key: %s\n", key_str); 364 361 usb_multimedia_push_ev(hid_dev, multim_dev, KEY_PRESS,
Note:
See TracChangeset
for help on using the changeset viewer.