Changes in uspace/drv/bus/usb/usbhid/kbd/kbdrepeat.c [2a5b62b:5f6e25e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhid/kbd/kbdrepeat.c
r2a5b62b r5f6e25e 46 46 47 47 48 /** Delay between auto-repeat state checks when no key is being repeated. */ 49 static unsigned int CHECK_DELAY = 10000; 48 50 49 51 /*----------------------------------------------------------------------------*/ … … 71 73 { 72 74 unsigned int delay = 0; 73 75 74 76 usb_log_debug("Starting autorepeat loop.\n"); 75 77 … … 77 79 // check if the kbd structure is usable 78 80 if (!usb_kbd_is_initialized(kbd)) { 79 usb_log_warning("kbd not ready, exiting autorepeat.\n"); 81 if (usb_kbd_is_ready_to_destroy(kbd)) { 82 usb_kbd_destroy(kbd); 83 } 80 84 return; 81 85 } 82 86 83 fibril_mutex_lock( &kbd->repeat_mtx);87 fibril_mutex_lock(kbd->repeat_mtx); 84 88 85 89 if (kbd->repeat.key_new > 0) { … … 105 109 delay = CHECK_DELAY; 106 110 } 107 fibril_mutex_unlock( &kbd->repeat_mtx);111 fibril_mutex_unlock(kbd->repeat_mtx); 108 112 109 113 async_usleep(delay); … … 126 130 { 127 131 usb_log_debug("Autorepeat fibril spawned.\n"); 128 132 129 133 if (arg == NULL) { 130 134 usb_log_error("No device!\n"); 131 135 return EINVAL; 132 136 } 133 137 134 138 usb_kbd_t *kbd = (usb_kbd_t *)arg; 135 139 136 140 usb_kbd_repeat_loop(kbd); 137 141 138 142 return EOK; 139 143 } … … 152 156 void usb_kbd_repeat_start(usb_kbd_t *kbd, unsigned int key) 153 157 { 154 fibril_mutex_lock( &kbd->repeat_mtx);158 fibril_mutex_lock(kbd->repeat_mtx); 155 159 kbd->repeat.key_new = key; 156 fibril_mutex_unlock( &kbd->repeat_mtx);160 fibril_mutex_unlock(kbd->repeat_mtx); 157 161 } 158 162 … … 170 174 void usb_kbd_repeat_stop(usb_kbd_t *kbd, unsigned int key) 171 175 { 172 fibril_mutex_lock( &kbd->repeat_mtx);176 fibril_mutex_lock(kbd->repeat_mtx); 173 177 if (key == kbd->repeat.key_new) { 174 178 kbd->repeat.key_new = 0; 175 179 } 176 fibril_mutex_unlock( &kbd->repeat_mtx);180 fibril_mutex_unlock(kbd->repeat_mtx); 177 181 } 178 182
Note:
See TracChangeset
for help on using the changeset viewer.