Ignore:
Timestamp:
2011-11-10T11:29:10Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
54464f6a, c2245a3, c6f189f7
Parents:
2e1b9dc (diff), 2d1ba51 (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.
Message:

Merge USB changes.

Interface changes:

  • GET_ADDRESS has been renamed to GET_MY_ADDRESS and the handle parameter was dropped. Tis call no longer cascades up to the root hub, but it is answered in the first place the information is available (nearest hub)
  • Reintroduced address reservation for USB_DEFAULT_ADDRESS. The interface now enables device drivers to request specific address on initialization and either insists on that address or accept any other if the address is not available. Note that it is not possible to get the default address if the driver does not insist.
  • Any endpoint registered is removed when address is released and a warning is produced if there were any such endpoints.
  • It is no longer necessary or possible to pass device speed information when registering endpoints.

Driver fixes: memory leaks and crashes (not only) in error paths.
Fixes or removes flaky device_remove implementation in device drivers.

File:
1 edited

Legend:

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

    r2e1b9dc r747ef72  
    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.