Changeset 26f6094 in mainline for uspace/drv/usbhid/kbd/kbddev.c
- Timestamp:
- 2011-05-06T09:25:44Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d0c060b
- Parents:
- 9e929a0 (diff), 310c4df (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/kbd/kbddev.c
r9e929a0 r26f6094 766 766 767 767 /*----------------------------------------------------------------------------*/ 768 769 static int usb_kbd_create_function(usb_hid_dev_t *hid_dev) 770 { 771 assert(hid_dev != NULL); 772 assert(hid_dev->usb_dev != NULL); 773 774 /* Create the function exposed under /dev/devices. */ 775 usb_log_debug("Creating DDF function %s...\n", HID_KBD_FUN_NAME); 776 ddf_fun_t *fun = ddf_fun_create(hid_dev->usb_dev->ddf_dev, fun_exposed, 777 HID_KBD_FUN_NAME); 778 if (fun == NULL) { 779 usb_log_error("Could not create DDF function node.\n"); 780 return ENOMEM; 781 } 782 783 /* 784 * Store the initialized HID device and HID ops 785 * to the DDF function. 786 */ 787 fun->ops = &hid_dev->ops; 788 fun->driver_data = hid_dev; // TODO: maybe change to hid_dev->data 789 790 int rc = ddf_fun_bind(fun); 791 if (rc != EOK) { 792 usb_log_error("Could not bind DDF function: %s.\n", 793 str_error(rc)); 794 ddf_fun_destroy(fun); 795 return rc; 796 } 797 798 usb_log_debug("Adding DDF function to class %s...\n", 799 HID_KBD_CLASS_NAME); 800 rc = ddf_fun_add_to_class(fun, HID_KBD_CLASS_NAME); 801 if (rc != EOK) { 802 usb_log_error( 803 "Could not add DDF function to class %s: %s.\n", 804 HID_KBD_CLASS_NAME, str_error(rc)); 805 ddf_fun_destroy(fun); 806 return rc; 807 } 808 809 return EOK; 810 } 811 812 /*----------------------------------------------------------------------------*/ 768 813 /* API functions */ 769 814 /*----------------------------------------------------------------------------*/ … … 930 975 usb_log_debug("HID/KBD device structure initialized.\n"); 931 976 977 usb_log_debug("Creating KBD function...\n"); 978 int rc = usb_kbd_create_function(hid_dev); 979 if (rc != EOK) { 980 usb_kbd_free(&kbd_dev); 981 return rc; 982 } 983 932 984 return EOK; 933 985 } … … 993 1045 if ((*kbd_dev)->led_data != NULL) { 994 1046 free((*kbd_dev)->led_data); 995 }996 if ((*kbd_dev)->output_buffer != NULL) {997 free((*kbd_dev)->output_buffer);998 1047 } 999 1048 if ((*kbd_dev)->led_path != NULL) {
Note:
See TracChangeset
for help on using the changeset viewer.