Ignore:
File:
1 edited

Legend:

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

    r2d1ba51 r2a5b62b  
    4545#include "kbddev.h"
    4646
     47
     48
     49/*----------------------------------------------------------------------------*/
    4750/**
    4851 * Main loop handling the auto-repeat of keys.
     
    5558 * If the same key is still pressed, it uses the delay between repeats stored
    5659 * in the keyboard structure to wait until the key should be repeated.
    57  *
     60 * 
    5861 * 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 
    6063 * checking again.
    6164 *
    6265 * @note For accessing the keyboard device auto-repeat information a fibril
    6366 *       mutex (repeat_mtx) from the @a kbd structure is used.
    64  *
     67 * 
    6568 * @param kbd Keyboard device structure.
    6669 */
     
    7275
    7376        while (true) {
    74                 /* Check if the kbd structure is usable. */
     77                // check if the kbd structure is usable
    7578                if (!usb_kbd_is_initialized(kbd)) {
    7679                        usb_log_warning("kbd not ready, exiting autorepeat.\n");
    7780                        return;
    7881                }
    79 
     82               
    8083                fibril_mutex_lock(&kbd->repeat_mtx);
    8184
    8285                if (kbd->repeat.key_new > 0) {
    8386                        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", 
    8588                                    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,
    8791                                    kbd->repeat.key_repeated);
    8892                                delay = kbd->repeat.delay_between;
     
    102106                }
    103107                fibril_mutex_unlock(&kbd->repeat_mtx);
     108               
    104109                async_usleep(delay);
    105110        }
    106111}
     112
    107113/*----------------------------------------------------------------------------*/
    108114/**
     
    110116 *
    111117 * Starts the loop for checking changes in auto-repeat.
    112  *
     118 * 
    113119 * @param arg User-specified argument. Expects pointer to the keyboard device
    114120 *            structure representing the keyboard.
     
    126132        }
    127133
    128         usb_kbd_t *kbd = arg;
     134        usb_kbd_t *kbd = (usb_kbd_t *)arg;
    129135
    130136        usb_kbd_repeat_loop(kbd);
     
    132138        return EOK;
    133139}
     140
    134141/*----------------------------------------------------------------------------*/
    135142/**
     
    149156        fibril_mutex_unlock(&kbd->repeat_mtx);
    150157}
     158
    151159/*----------------------------------------------------------------------------*/
    152160/**
     
    154162 *
    155163 * @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 
    157165 *       happens).
    158166 *
     
    168176        fibril_mutex_unlock(&kbd->repeat_mtx);
    169177}
     178
    170179/**
    171180 * @}
Note: See TracChangeset for help on using the changeset viewer.