Changes in uspace/drv/usbhid/kbd/kbddev.c [323b0ec:1b7dc5e9] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhid/kbd/kbddev.c
r323b0ec r1b7dc5e9 255 255 256 256 if (hid_dev == NULL || hid_dev->data == NULL) { 257 usb_log_debug("default_connection_handler: " 258 "Missing parameter.\n"); 257 259 async_answer_0(icallid, EINVAL); 258 260 return; … … 267 269 268 270 if (kbd_dev->console_phone != -1) { 271 usb_log_debug("default_connection_handler: " 272 "console phone already set\n"); 269 273 async_answer_0(icallid, ELIMIT); 270 274 return; … … 272 276 273 277 kbd_dev->console_phone = callback; 278 279 usb_log_debug("default_connection_handler: OK\n"); 274 280 async_answer_0(icallid, EOK); 275 281 return; 276 282 } 277 283 284 usb_log_debug("default_connection_handler: Wrong function.\n"); 278 285 async_answer_0(icallid, EINVAL); 279 286 } … … 555 562 usb_log_debug2("Key pressed: %d (keycode: %d)\n", key, 556 563 kbd_dev->keys[i]); 557 usb_kbd_push_ev(hid_dev, kbd_dev, KEY_PRESS, key);558 564 if (!usb_kbd_is_lock(key)) { 559 565 usb_kbd_repeat_start(kbd_dev, key); 560 566 } 567 usb_kbd_push_ev(hid_dev, kbd_dev, KEY_PRESS, key); 561 568 } else { 562 569 // found, nothing happens … … 766 773 767 774 /*----------------------------------------------------------------------------*/ 775 776 static int usb_kbd_create_function(usb_hid_dev_t *hid_dev) 777 { 778 assert(hid_dev != NULL); 779 assert(hid_dev->usb_dev != NULL); 780 781 /* Create the function exposed under /dev/devices. */ 782 usb_log_debug("Creating DDF function %s...\n", HID_KBD_FUN_NAME); 783 ddf_fun_t *fun = ddf_fun_create(hid_dev->usb_dev->ddf_dev, fun_exposed, 784 HID_KBD_FUN_NAME); 785 if (fun == NULL) { 786 usb_log_error("Could not create DDF function node.\n"); 787 return ENOMEM; 788 } 789 790 /* 791 * Store the initialized HID device and HID ops 792 * to the DDF function. 793 */ 794 fun->ops = &hid_dev->ops; 795 fun->driver_data = hid_dev; // TODO: maybe change to hid_dev->data 796 797 int rc = ddf_fun_bind(fun); 798 if (rc != EOK) { 799 usb_log_error("Could not bind DDF function: %s.\n", 800 str_error(rc)); 801 ddf_fun_destroy(fun); 802 return rc; 803 } 804 805 usb_log_debug("Adding DDF function to class %s...\n", 806 HID_KBD_CLASS_NAME); 807 rc = ddf_fun_add_to_class(fun, HID_KBD_CLASS_NAME); 808 if (rc != EOK) { 809 usb_log_error( 810 "Could not add DDF function to class %s: %s.\n", 811 HID_KBD_CLASS_NAME, str_error(rc)); 812 ddf_fun_destroy(fun); 813 return rc; 814 } 815 816 return EOK; 817 } 818 819 /*----------------------------------------------------------------------------*/ 768 820 /* API functions */ 769 821 /*----------------------------------------------------------------------------*/ … … 930 982 usb_log_debug("HID/KBD device structure initialized.\n"); 931 983 984 usb_log_debug("Creating KBD function...\n"); 985 int rc = usb_kbd_create_function(hid_dev); 986 if (rc != EOK) { 987 usb_kbd_free(&kbd_dev); 988 return rc; 989 } 990 932 991 return EOK; 933 992 } … … 993 1052 if ((*kbd_dev)->led_data != NULL) { 994 1053 free((*kbd_dev)->led_data); 995 }996 if ((*kbd_dev)->output_buffer != NULL) {997 free((*kbd_dev)->output_buffer);998 1054 } 999 1055 if ((*kbd_dev)->led_path != NULL) {
Note:
See TracChangeset
for help on using the changeset viewer.