Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhid/kbd/kbdrepeat.c

    r2a5b62b r2d1ba51  
    4545#include "kbddev.h"
    4646
    47 
    48 
    49 /*----------------------------------------------------------------------------*/
    5047/**
    5148 * Main loop handling the auto-repeat of keys.
     
    5855 * If the same key is still pressed, it uses the delay between repeats stored
    5956 * in the keyboard structure to wait until the key should be repeated.
    60  * 
     57 *
    6158 * 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
    6360 * checking again.
    6461 *
    6562 * @note For accessing the keyboard device auto-repeat information a fibril
    6663 *       mutex (repeat_mtx) from the @a kbd structure is used.
    67  * 
     64 *
    6865 * @param kbd Keyboard device structure.
    6966 */
     
    7572
    7673        while (true) {
    77                 // check if the kbd structure is usable
     74                /* Check if the kbd structure is usable. */
    7875                if (!usb_kbd_is_initialized(kbd)) {
    7976                        usb_log_warning("kbd not ready, exiting autorepeat.\n");
    8077                        return;
    8178                }
    82                
     79
    8380                fibril_mutex_lock(&kbd->repeat_mtx);
    8481
    8582                if (kbd->repeat.key_new > 0) {
    8683                        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",
    8885                                    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,
    9187                                    kbd->repeat.key_repeated);
    9288                                delay = kbd->repeat.delay_between;
     
    106102                }
    107103                fibril_mutex_unlock(&kbd->repeat_mtx);
    108                
    109104                async_usleep(delay);
    110105        }
    111106}
    112 
    113107/*----------------------------------------------------------------------------*/
    114108/**
     
    116110 *
    117111 * Starts the loop for checking changes in auto-repeat.
    118  * 
     112 *
    119113 * @param arg User-specified argument. Expects pointer to the keyboard device
    120114 *            structure representing the keyboard.
     
    132126        }
    133127
    134         usb_kbd_t *kbd = (usb_kbd_t *)arg;
     128        usb_kbd_t *kbd = arg;
    135129
    136130        usb_kbd_repeat_loop(kbd);
     
    138132        return EOK;
    139133}
    140 
    141134/*----------------------------------------------------------------------------*/
    142135/**
     
    156149        fibril_mutex_unlock(&kbd->repeat_mtx);
    157150}
    158 
    159151/*----------------------------------------------------------------------------*/
    160152/**
     
    162154 *
    163155 * @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
    165157 *       happens).
    166158 *
     
    176168        fibril_mutex_unlock(&kbd->repeat_mtx);
    177169}
    178 
    179170/**
    180171 * @}
Note: See TracChangeset for help on using the changeset viewer.