Changeset cddd151 in mainline
- Timestamp:
- 2011-10-14T14:37:32Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7b54b99
- Parents:
- e5024111
- Location:
- uspace/drv/bus/usb/usbhid
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhid/kbd/kbddev.c
re5024111 rcddd151 540 540 usb_log_error("Could not bind DDF function: %s.\n", 541 541 str_error(rc)); 542 fun->driver_data = NULL; /* We need this later */ 542 543 ddf_fun_destroy(fun); 543 544 return rc; … … 554 555 "Could not add DDF function to category %s: %s.\n", 555 556 HID_KBD_CLASS_NAME, str_error(rc)); 557 fun->driver_data = NULL; /* We need this later */ 556 558 ddf_fun_destroy(fun); 557 559 return rc; 558 560 } 561 kbd_dev->fun = fun; 559 562 560 563 return EOK; … … 687 690 kbd_dev->repeat.delay_between = DEFAULT_REPEAT_DELAY; 688 691 689 kbd_dev->repeat_mtx = (fibril_mutex_t *)( 690 malloc(sizeof(fibril_mutex_t))); 691 if (kbd_dev->repeat_mtx == NULL) { 692 usb_log_fatal("No memory!\n"); 693 free(kbd_dev->keys); 694 usb_hid_report_output_free(kbd_dev->output_buffer); 695 free(kbd_dev); 696 return ENOMEM; 697 } 698 699 fibril_mutex_initialize(kbd_dev->repeat_mtx); 692 fibril_mutex_initialize(&kbd_dev->repeat_mtx); 700 693 701 694 // save the KBD device structure into the HID device structure … … 784 777 async_hangup(kbd_dev->console_sess); 785 778 786 if (kbd_dev->repeat_mtx != NULL) { 787 //assert(!fibril_mutex_is_locked((*kbd_dev)->repeat_mtx)); 788 // FIXME - the fibril_mutex_is_locked may not cause 789 // fibril scheduling 790 while (fibril_mutex_is_locked(kbd_dev->repeat_mtx)) {} 791 free(kbd_dev->repeat_mtx); 792 } 779 //assert(!fibril_mutex_is_locked((*kbd_dev)->repeat_mtx)); 780 // FIXME - the fibril_mutex_is_locked may not cause 781 // fibril scheduling 782 while (fibril_mutex_is_locked(&kbd_dev->repeat_mtx)) {} 793 783 794 784 // free all buffers 795 if (kbd_dev->keys != NULL) { 796 free(kbd_dev->keys); 797 } 798 if (kbd_dev->keys_old != NULL) { 799 free(kbd_dev->keys_old); 800 } 801 if (kbd_dev->led_data != NULL) { 802 free(kbd_dev->led_data); 803 } 785 free(kbd_dev->keys); 786 free(kbd_dev->keys_old); 787 free(kbd_dev->led_data); 804 788 if (kbd_dev->led_path != NULL) { 805 789 usb_hid_report_path_free(kbd_dev->led_path); -
uspace/drv/bus/usb/usbhid/kbd/kbddev.h
re5024111 rcddd151 92 92 93 93 /** Mutex for accessing the information about auto-repeat. */ 94 fibril_mutex_t *repeat_mtx;94 fibril_mutex_t repeat_mtx; 95 95 96 96 uint8_t *output_buffer; … … 111 111 */ 112 112 int initialized; 113 114 /** DDF function */ 115 ddf_fun_t *fun; 113 116 } usb_kbd_t; 114 117 -
uspace/drv/bus/usb/usbhid/kbd/kbdrepeat.c
re5024111 rcddd151 85 85 } 86 86 87 fibril_mutex_lock( kbd->repeat_mtx);87 fibril_mutex_lock(&kbd->repeat_mtx); 88 88 89 89 if (kbd->repeat.key_new > 0) { … … 109 109 delay = CHECK_DELAY; 110 110 } 111 fibril_mutex_unlock( kbd->repeat_mtx);111 fibril_mutex_unlock(&kbd->repeat_mtx); 112 112 113 113 async_usleep(delay); … … 156 156 void usb_kbd_repeat_start(usb_kbd_t *kbd, unsigned int key) 157 157 { 158 fibril_mutex_lock( kbd->repeat_mtx);158 fibril_mutex_lock(&kbd->repeat_mtx); 159 159 kbd->repeat.key_new = key; 160 fibril_mutex_unlock( kbd->repeat_mtx);160 fibril_mutex_unlock(&kbd->repeat_mtx); 161 161 } 162 162 … … 174 174 void usb_kbd_repeat_stop(usb_kbd_t *kbd, unsigned int key) 175 175 { 176 fibril_mutex_lock( kbd->repeat_mtx);176 fibril_mutex_lock(&kbd->repeat_mtx); 177 177 if (key == kbd->repeat.key_new) { 178 178 kbd->repeat.key_new = 0; 179 179 } 180 fibril_mutex_unlock( kbd->repeat_mtx);180 fibril_mutex_unlock(&kbd->repeat_mtx); 181 181 } 182 182 -
uspace/drv/bus/usb/usbhid/usbhid.c
re5024111 rcddd151 669 669 } 670 670 671 // free the subdrivers info 672 if (hid_dev->subdrivers != NULL) { 673 free(hid_dev->subdrivers); 674 } 675 676 // destroy the parser 671 /* Free allocated structures */ 672 free(hid_dev->subdrivers); 673 free(hid_dev->report_desc); 674 675 /* Destroy the parser */ 677 676 if (hid_dev->report != NULL) { 678 677 usb_hid_free_report(hid_dev->report); 679 678 } 680 679 681 if (hid_dev->report_desc != NULL) {682 free(hid_dev->report_desc);683 }684 680 } 685 681
Note:
See TracChangeset
for help on using the changeset viewer.