Changeset e3f7418 in mainline for uspace/drv/bus/usb/usbhid/kbd/kbdrepeat.c
- Timestamp:
- 2011-10-15T13:06:28Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a044f71
- Parents:
- 3958e315 (diff), 065064e6 (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/bus/usb/usbhid/kbd/kbdrepeat.c
r3958e315 re3f7418 46 46 47 47 48 /** Delay between auto-repeat state checks when no key is being repeated. */49 static unsigned int CHECK_DELAY = 10000;50 48 51 49 /*----------------------------------------------------------------------------*/ … … 73 71 { 74 72 unsigned int delay = 0; 75 73 76 74 usb_log_debug("Starting autorepeat loop.\n"); 77 75 … … 79 77 // check if the kbd structure is usable 80 78 if (!usb_kbd_is_initialized(kbd)) { 81 if (usb_kbd_is_ready_to_destroy(kbd)) { 82 usb_kbd_destroy(kbd); 83 } 79 usb_log_warning("kbd not ready, exiting autorepeat.\n"); 84 80 return; 85 81 } 86 82 87 fibril_mutex_lock( kbd->repeat_mtx);83 fibril_mutex_lock(&kbd->repeat_mtx); 88 84 89 85 if (kbd->repeat.key_new > 0) { … … 109 105 delay = CHECK_DELAY; 110 106 } 111 fibril_mutex_unlock( kbd->repeat_mtx);107 fibril_mutex_unlock(&kbd->repeat_mtx); 112 108 113 109 async_usleep(delay); … … 130 126 { 131 127 usb_log_debug("Autorepeat fibril spawned.\n"); 132 128 133 129 if (arg == NULL) { 134 130 usb_log_error("No device!\n"); 135 131 return EINVAL; 136 132 } 137 133 138 134 usb_kbd_t *kbd = (usb_kbd_t *)arg; 139 135 140 136 usb_kbd_repeat_loop(kbd); 141 137 142 138 return EOK; 143 139 } … … 156 152 void usb_kbd_repeat_start(usb_kbd_t *kbd, unsigned int key) 157 153 { 158 fibril_mutex_lock( kbd->repeat_mtx);154 fibril_mutex_lock(&kbd->repeat_mtx); 159 155 kbd->repeat.key_new = key; 160 fibril_mutex_unlock( kbd->repeat_mtx);156 fibril_mutex_unlock(&kbd->repeat_mtx); 161 157 } 162 158 … … 174 170 void usb_kbd_repeat_stop(usb_kbd_t *kbd, unsigned int key) 175 171 { 176 fibril_mutex_lock( kbd->repeat_mtx);172 fibril_mutex_lock(&kbd->repeat_mtx); 177 173 if (key == kbd->repeat.key_new) { 178 174 kbd->repeat.key_new = 0; 179 175 } 180 fibril_mutex_unlock( kbd->repeat_mtx);176 fibril_mutex_unlock(&kbd->repeat_mtx); 181 177 } 182 178
Note:
See TracChangeset
for help on using the changeset viewer.