Changeset 2d1ba51 in mainline


Ignore:
Timestamp:
2011-11-09T14:55:04Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
747ef72
Parents:
f317490
Message:

usbhid: Comment and whitespace fixes.

Location:
uspace/drv/bus/usb/usbhid
Files:
3 edited

Legend:

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

    rf317490 r2d1ba51  
    103103/*----------------------------------------------------------------------------*/
    104104static const uint8_t USB_KBD_BOOT_REPORT_DESCRIPTOR[] = {
    105         0x05, 0x01,  // Usage Page (Generic Desktop),
    106         0x09, 0x06,  // Usage (Keyboard),
    107         0xA1, 0x01,  // Collection (Application),
    108         0x75, 0x01,  //   Report Size (1),
    109         0x95, 0x08,  //   Report Count (8),
    110         0x05, 0x07,  //   Usage Page (Key Codes);
    111         0x19, 0xE0,  //   Usage Minimum (224),
    112         0x29, 0xE7,  //   Usage Maximum (231),
    113         0x15, 0x00,  //   Logical Minimum (0),
    114         0x25, 0x01,  //   Logical Maximum (1),
    115         0x81, 0x02,  //   Input (Data, Variable, Absolute),   ; Modifier byte
    116         0x95, 0x01,  //   Report Count (1),
    117         0x75, 0x08,  //   Report Size (8),
    118         0x81, 0x01,  //   Input (Constant),                   ; Reserved byte
    119         0x95, 0x05,  //   Report Count (5),
    120         0x75, 0x01,  //   Report Size (1),
    121         0x05, 0x08,  //   Usage Page (Page# for LEDs),
    122         0x19, 0x01,  //   Usage Minimum (1),
    123         0x29, 0x05,  //   Usage Maxmimum (5),
    124         0x91, 0x02,  //   Output (Data, Variable, Absolute),  ; LED report
    125         0x95, 0x01,  //   Report Count (1),
    126         0x75, 0x03,  //   Report Size (3),
    127         0x91, 0x01,  //   Output (Constant),              ; LED report padding
    128         0x95, 0x06,  //   Report Count (6),
    129         0x75, 0x08,  //   Report Size (8),
    130         0x15, 0x00,  //   Logical Minimum (0),
    131         0x25, 0xff,  //   Logical Maximum (255),
    132         0x05, 0x07,  //   Usage Page (Key Codes),
    133         0x19, 0x00,  //   Usage Minimum (0),
    134         0x29, 0xff,  //   Usage Maximum (255),
    135         0x81, 0x00,  //   Input (Data, Array),            ; Key arrays (6 bytes)
    136         0xC0           // End Collection
    137 
     105        0x05, 0x01,  /* Usage Page (Generic Desktop), */
     106        0x09, 0x06,  /* Usage (Keyboard), */
     107        0xA1, 0x01,  /* Collection (Application), */
     108        0x75, 0x01,  /*   Report Size (1), */
     109        0x95, 0x08,  /*   Report Count (8), */
     110        0x05, 0x07,  /*   Usage Page (Key Codes); */
     111        0x19, 0xE0,  /*   Usage Minimum (224), */
     112        0x29, 0xE7,  /*   Usage Maximum (231), */
     113        0x15, 0x00,  /*   Logical Minimum (0), */
     114        0x25, 0x01,  /*   Logical Maximum (1), */
     115        0x81, 0x02,  /*   Input (Data, Variable, Absolute),  ; Modifier byte */
     116        0x95, 0x01,  /*   Report Count (1), */
     117        0x75, 0x08,  /*   Report Size (8), */
     118        0x81, 0x01,  /*   Input (Constant),                  ; Reserved byte */
     119        0x95, 0x05,  /*   Report Count (5), */
     120        0x75, 0x01,  /*   Report Size (1), */
     121        0x05, 0x08,  /*   Usage Page (Page# for LEDs), */
     122        0x19, 0x01,  /*   Usage Minimum (1), */
     123        0x29, 0x05,  /*   Usage Maxmimum (5), */
     124        0x91, 0x02,  /*   Output (Data, Variable, Absolute),  ; LED report */
     125        0x95, 0x01,  /*   Report Count (1), */
     126        0x75, 0x03,  /*   Report Size (3), */
     127        0x91, 0x01,  /*   Output (Constant),            ; LED report padding */
     128        0x95, 0x06,  /*   Report Count (6), */
     129        0x75, 0x08,  /*   Report Size (8), */
     130        0x15, 0x00,  /*   Logical Minimum (0), */
     131        0x25, 0xff,  /*   Logical Maximum (255), */
     132        0x05, 0x07,  /*   Usage Page (Key Codes), */
     133        0x19, 0x00,  /*   Usage Minimum (0), */
     134        0x29, 0xff,  /*   Usage Maximum (255), */
     135        0x81, 0x00,  /*   Input (Data, Array),   ; Key arrays (6 bytes) */
     136        0xC0         /* End Collection */
    138137};
    139138/*----------------------------------------------------------------------------*/
     
    207206
    208207}
    209 
    210208/*----------------------------------------------------------------------------*/
    211209/* Key processing functions                                                   */
     
    448446        usb_hid_report_path_set_report_id(path, hid_dev->report_id);
    449447
    450         // fill in the currently pressed keys
    451 
     448        /* Fill in the currently pressed keys. */
    452449        usb_hid_report_field_t *field = usb_hid_report_get_sibling(
    453450            &hid_dev->report, NULL, path,
     
    462459                assert(i < kbd_dev->key_count);
    463460
    464                 // save the key usage
     461                /* Save the key usage. */
    465462                if (field->value != 0) {
    466463                        kbd_dev->keys[i] = field->usage;
     
    500497        }
    501498
    502         /*
    503          * Store the initialized HID device and HID ops
    504          * to the DDF function.
    505          */
     499        /* Store the initialized HID device and HID ops
     500         * to the DDF function. */
    506501        fun->ops = &kbd_dev->ops;
    507502        fun->driver_data = kbd_dev;
     
    511506                usb_log_error("Could not bind DDF function: %s.\n",
    512507                    str_error(rc));
    513                 fun->driver_data = NULL; /* We need this later */
     508                fun->driver_data = NULL; /* We did not allocate this. */
    514509                ddf_fun_destroy(fun);
    515510                return rc;
     
    527522                    HID_KBD_CLASS_NAME, str_error(rc));
    528523                if (ddf_fun_unbind(fun) == EOK) {
    529                         fun->driver_data = NULL; /* We need this later */
     524                        fun->driver_data = NULL; /* We did not allocate this. */
    530525                        ddf_fun_destroy(fun);
    531526                } else {
     
    674669        }
    675670
    676         /*
    677          * Set LEDs according to initial setup.
    678          * Set Idle rate
    679          */
     671        /* Set LEDs according to initial setup.
     672         * Set Idle rate */
    680673        usb_kbd_set_led(hid_dev, kbd_dev);
    681674
     
    779772                if (usb_kbd_is_initialized(kbd_dev)) {
    780773                        kbd_dev->initialized = USB_KBD_STATUS_TO_DESTROY;
    781                         /* wait for autorepeat */
     774                        /* Wait for autorepeat */
    782775                        async_usleep(CHECK_DELAY);
    783776                }
  • uspace/drv/bus/usb/usbhid/kbd/kbdrepeat.c

    rf317490 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
     
    105102                }
    106103                fibril_mutex_unlock(&kbd->repeat_mtx);
    107                
    108104                async_usleep(delay);
    109105        }
    110106}
    111 
    112107/*----------------------------------------------------------------------------*/
    113108/**
     
    115110 *
    116111 * Starts the loop for checking changes in auto-repeat.
    117  * 
     112 *
    118113 * @param arg User-specified argument. Expects pointer to the keyboard device
    119114 *            structure representing the keyboard.
     
    131126        }
    132127
    133         usb_kbd_t *kbd = (usb_kbd_t *)arg;
     128        usb_kbd_t *kbd = arg;
    134129
    135130        usb_kbd_repeat_loop(kbd);
     
    137132        return EOK;
    138133}
    139 
    140134/*----------------------------------------------------------------------------*/
    141135/**
     
    155149        fibril_mutex_unlock(&kbd->repeat_mtx);
    156150}
    157 
    158151/*----------------------------------------------------------------------------*/
    159152/**
     
    161154 *
    162155 * @note Only one key is repeated at any time, but this function may be called
    163  *       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
    164157 *       happens).
    165158 *
     
    175168        fibril_mutex_unlock(&kbd->repeat_mtx);
    176169}
    177 
    178170/**
    179171 * @}
  • uspace/drv/bus/usb/usbhid/usbhid.c

    rf317490 r2d1ba51  
    249249                        usb_log_debug("Comparing device against usage path.\n");
    250250                        if (usb_hid_path_matches(hid_dev, mapping)) {
    251                                 // does not matter if IDs were matched
     251                                /* Does not matter if IDs were matched. */
    252252                                matched = true;
    253253                        }
Note: See TracChangeset for help on using the changeset viewer.