Changes in uspace/drv/bus/usb/usbhid/kbd/kbdrepeat.c [9d58539:2a5b62b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhid/kbd/kbdrepeat.c
r9d58539 r2a5b62b 45 45 #include "kbddev.h" 46 46 47 48 49 /*----------------------------------------------------------------------------*/ 47 50 /** 48 51 * Main loop handling the auto-repeat of keys. … … 55 58 * If the same key is still pressed, it uses the delay between repeats stored 56 59 * in the keyboard structure to wait until the key should be repeated. 57 * 60 * 58 61 * If the currently repeated key is not pressed any more ( 59 * usb_kbd_repeat_stop() was called), it stops repeating it and starts 62 * usb_kbd_repeat_stop() was called), it stops repeating it and starts 60 63 * checking again. 61 64 * 62 65 * @note For accessing the keyboard device auto-repeat information a fibril 63 66 * mutex (repeat_mtx) from the @a kbd structure is used. 64 * 67 * 65 68 * @param kbd Keyboard device structure. 66 69 */ … … 72 75 73 76 while (true) { 74 / * Check if the kbd structure is usable. */77 // check if the kbd structure is usable 75 78 if (!usb_kbd_is_initialized(kbd)) { 76 79 usb_log_warning("kbd not ready, exiting autorepeat.\n"); 77 80 return; 78 81 } 79 82 80 83 fibril_mutex_lock(&kbd->repeat_mtx); 81 84 82 85 if (kbd->repeat.key_new > 0) { 83 86 if (kbd->repeat.key_new == kbd->repeat.key_repeated) { 84 usb_log_debug2("Repeating key: %u.\n", 87 usb_log_debug2("Repeating key: %u.\n", 85 88 kbd->repeat.key_repeated); 86 usb_kbd_push_ev(kbd, KEY_PRESS, 89 // ugly hack with the NULL 90 usb_kbd_push_ev(NULL, kbd, KEY_PRESS, 87 91 kbd->repeat.key_repeated); 88 92 delay = kbd->repeat.delay_between; … … 102 106 } 103 107 fibril_mutex_unlock(&kbd->repeat_mtx); 108 104 109 async_usleep(delay); 105 110 } 106 111 } 112 107 113 /*----------------------------------------------------------------------------*/ 108 114 /** … … 110 116 * 111 117 * Starts the loop for checking changes in auto-repeat. 112 * 118 * 113 119 * @param arg User-specified argument. Expects pointer to the keyboard device 114 120 * structure representing the keyboard. … … 126 132 } 127 133 128 usb_kbd_t *kbd = arg;134 usb_kbd_t *kbd = (usb_kbd_t *)arg; 129 135 130 136 usb_kbd_repeat_loop(kbd); … … 132 138 return EOK; 133 139 } 140 134 141 /*----------------------------------------------------------------------------*/ 135 142 /** … … 149 156 fibril_mutex_unlock(&kbd->repeat_mtx); 150 157 } 158 151 159 /*----------------------------------------------------------------------------*/ 152 160 /** … … 154 162 * 155 163 * @note Only one key is repeated at any time, but this function may be called 156 * even with key that is not currently repeated (in that case nothing 164 * even with key that is not currently repeated (in that case nothing 157 165 * happens). 158 166 * … … 168 176 fibril_mutex_unlock(&kbd->repeat_mtx); 169 177 } 178 170 179 /** 171 180 * @}
Note:
See TracChangeset
for help on using the changeset viewer.