Changeset 7309799 in mainline for uspace/drv/usbhid/kbdrepeat.c
- Timestamp:
- 2011-03-10T14:13:15Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e8c1fb0
- Parents:
- 17ada7a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhid/kbdrepeat.c
r17ada7a r7309799 45 45 #include "kbddev.h" 46 46 47 48 /** Delay between auto-repeat state checks when no key is being repeated. */ 47 49 static unsigned int CHECK_DELAY = 10000; 48 50 49 51 /*----------------------------------------------------------------------------*/ 50 52 /** 53 * Main loop handling the auto-repeat of keys. 54 * 55 * This functions periodically checks if there is some key to be auto-repeated. 56 * 57 * If a new key is to be repeated, it uses the delay before first repeat stored 58 * in the keyboard structure to wait until the key has to start repeating. 59 * 60 * If the same key is still pressed, it uses the delay between repeats stored 61 * in the keyboard structure to wait until the key should be repeated. 62 * 63 * If the currently repeated key is not pressed any more ( 64 * usbhid_kbd_repeat_stop() was called), it stops repeating it and starts 65 * checking again. 66 * 67 * @note For accessing the keyboard device auto-repeat information a fibril 68 * mutex (repeat_mtx) from the @a kbd structure is used. 69 * 70 * @param kbd Keyboard device structure. 71 */ 51 72 static void usbhid_kbd_repeat_loop(usbhid_kbd_t *kbd) 52 73 { … … 86 107 87 108 /*----------------------------------------------------------------------------*/ 88 109 /** 110 * Main routine to be executed by a fibril for handling auto-repeat. 111 * 112 * Starts the loop for checking changes in auto-repeat. 113 * 114 * @param arg User-specified argument. Expects pointer to the keyboard device 115 * structure representing the keyboard. 116 * 117 * @retval EOK if the routine has finished. 118 * @retval EINVAL if no argument is supplied. 119 */ 89 120 int usbhid_kbd_repeat_fibril(void *arg) 90 121 { … … 104 135 105 136 /*----------------------------------------------------------------------------*/ 106 137 /** 138 * Start repeating particular key. 139 * 140 * @note Only one key is repeated at any time, so calling this function 141 * effectively cancels auto-repeat of the current repeated key (if any) 142 * and 'schedules' another key for auto-repeat. 143 * 144 * @param kbd Keyboard device structure. 145 * @param key Key to start repeating. 146 */ 107 147 void usbhid_kbd_repeat_start(usbhid_kbd_t *kbd, unsigned int key) 108 148 { … … 113 153 114 154 /*----------------------------------------------------------------------------*/ 115 155 /** 156 * Stop repeating particular key. 157 * 158 * @note Only one key is repeated at any time, but this function may be called 159 * even with key that is not currently repeated (in that case nothing 160 * happens). 161 * 162 * @param kbd Keyboard device structure. 163 * @param key Key to stop repeating. 164 */ 116 165 void usbhid_kbd_repeat_stop(usbhid_kbd_t *kbd, unsigned int key) 117 166 {
Note:
See TracChangeset
for help on using the changeset viewer.