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