Changes in / [bda06a3:ec6bee4] in mainline


Ignore:
Files:
5 added
4 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/amd64/Makefile.inc

    rbda06a3 rec6bee4  
    5050        usbhub \
    5151        usbkbd \
     52        usbhid \
    5253        usbmid \
    5354        usbmouse \
  • uspace/Makefile

    rbda06a3 rec6bee4  
    123123                drv/usbflbk \
    124124                drv/usbkbd \
     125                drv/usbhid \
    125126                drv/usbhub \
    126127                drv/usbmid \
     
    143144                drv/usbflbk \
    144145                drv/usbkbd \
     146                drv/usbhid \
    145147                drv/usbhub \
    146148                drv/usbmid \
  • uspace/drv/usbkbd/kbddev.c

    rbda06a3 rec6bee4  
    7070static const unsigned DEFAULT_ACTIVE_MODS = KM_NUM_LOCK;
    7171
    72 /** Boot protocol report size (key part). */
    73 static const size_t BOOTP_REPORT_SIZE = 6;
    74 
    75 /** Boot protocol total report size. */
    76 static const size_t BOOTP_BUFFER_SIZE = 8;
    77 
    78 /** Boot protocol output report size. */
    79 static const size_t BOOTP_BUFFER_OUT_SIZE = 1;
    80 
    81 /** Boot protocol error key code. */
    82 static const uint8_t BOOTP_ERROR_ROLLOVER = 1;
     72///** Boot protocol report size (key part). */
     73//static const size_t BOOTP_REPORT_SIZE = 6;
     74
     75///** Boot protocol total report size. */
     76//static const size_t BOOTP_BUFFER_SIZE = 8;
     77
     78///** Boot protocol output report size. */
     79//static const size_t BOOTP_BUFFER_OUT_SIZE = 1;
     80
     81///** Boot protocol error key code. */
     82//static const uint8_t BOOTP_ERROR_ROLLOVER = 1;
     83static const uint8_t ERROR_ROLLOVER = 1;
    8384
    8485/** Default idle rate for keyboards. */
     
    264265static void usb_kbd_set_led(usb_kbd_t *kbd_dev)
    265266{
    266 //      uint8_t buffer[BOOTP_BUFFER_OUT_SIZE];
    267 //      int rc= 0;
    268        
    269 //      memset(buffer, 0, BOOTP_BUFFER_OUT_SIZE);
    270 //      uint8_t leds = 0;
    271 
    272267        unsigned i = 0;
     268       
     269        /* Reset the LED data. */
     270        memset(kbd_dev->led_data, 0, kbd_dev->led_output_size * sizeof(int32_t));
    273271       
    274272        if ((kbd_dev->mods & KM_NUM_LOCK) && (i < kbd_dev->led_output_size)) {
    275273                kbd_dev->led_data[i++] = USB_HID_LED_NUM_LOCK;
    276 //              leds |= USB_HID_LED_NUM_LOCK;
    277         }
    278         else {
    279             kbd_dev->led_data[i++] = 0;
    280274        }
    281275       
    282276        if ((kbd_dev->mods & KM_CAPS_LOCK) && (i < kbd_dev->led_output_size)) {
    283277                kbd_dev->led_data[i++] = USB_HID_LED_CAPS_LOCK;
    284 //              leds |= USB_HID_LED_CAPS_LOCK;
    285         }
    286         else {
    287             kbd_dev->led_data[i++] = 0;
    288278        }
    289279       
     
    291281            && (i < kbd_dev->led_output_size)) {
    292282                kbd_dev->led_data[i++] = USB_HID_LED_SCROLL_LOCK;
    293 //              leds |= USB_HID_LED_SCROLL_LOCK;
    294         }
    295         else {
    296             kbd_dev->led_data[i++] = 0;
    297         }
    298        
    299         usb_log_debug("Output report data: ");
    300         for (i = 0; i < kbd_dev->led_output_size; ++i) {
    301                 usb_log_debug("%u: %d", i, kbd_dev->led_data[i]);
    302283        }
    303284
     
    315296                return;
    316297        }
    317        
    318 //      if ((rc = usb_hid_boot_keyboard_output_report(
    319 //          leds, buffer, BOOTP_BUFFER_OUT_SIZE)) != EOK) {
    320 //              usb_log_warning("Error composing output report to the keyboard:"
    321 //                  "%s.\n", str_error(rc));
    322 //              return;
    323 //      }
    324298       
    325299        usb_log_debug("Output report buffer: %s\n",
     
    480454         * First of all, check if the kbd have reported phantom state.
    481455         *
    482          *  this must be changed as we don't know which keys are modifiers
    483          *       and which are regular keys.
     456         * As there is no way to distinguish keys from modifiers, we do not have
     457         * a way to check that 'all keys report Error Rollover'. We thus check
     458         * if there is at least one such error and in such case we ignore the
     459         * whole input report.
    484460         */
    485461        i = 0;
    486         // all fields should report Error Rollover
    487         while (i < count &&
    488             key_codes[i] == BOOTP_ERROR_ROLLOVER) {
     462        while (i < count && key_codes[i] != ERROR_ROLLOVER) {
    489463                ++i;
    490464        }
    491         if (i == count) {
     465        if (i != count) {
    492466                usb_log_debug("Phantom state occured.\n");
    493467                // phantom state, do nothing
  • uspace/drv/usbkbd/main.c

    rbda06a3 rec6bee4  
    3333/**
    3434 * @file
    35  * Main routines of USB HID driver.
     35 * Main routines of USB KBD driver.
    3636 */
    3737
     
    7575 * @sa usb_kbd_fibril(), usb_kbd_repeat_fibril()
    7676 */
    77 static int usbhid_try_add_device(usb_device_t *dev)
     77static int usb_kbd_try_add_device(usb_device_t *dev)
    7878{
    7979        /* Create the function exposed under /dev/devices. */
     
    195195 * @retval EREFUSED if the device is not supported.
    196196 */
    197 static int usbhid_add_device(usb_device_t *dev)
     197static int usb_kbd_add_device(usb_device_t *dev)
    198198{
    199         usb_log_debug("usbhid_add_device()\n");
     199        usb_log_debug("usb_kbd_add_device()\n");
    200200       
    201201        if (dev->interface_no < 0) {
    202202                usb_log_warning("Device is not a supported keyboard.\n");
    203                 usb_log_error("Failed to add HID device: endpoint not found."
     203                usb_log_error("Failed to add USB KBD device: endpoint not found."
    204204                    "\n");
    205205                return ENOTSUP;
    206206        }
    207207       
    208         int rc = usbhid_try_add_device(dev);
     208        int rc = usb_kbd_try_add_device(dev);
    209209       
    210210        if (rc != EOK) {
    211211                usb_log_warning("Device is not a supported keyboard.\n");
    212                 usb_log_error("Failed to add HID device: %s.\n",
     212                usb_log_error("Failed to add KBD device: %s.\n",
    213213                    str_error(rc));
    214214                return rc;
     
    224224/* Currently, the framework supports only device adding. Once the framework
    225225 * supports unplug, more callbacks will be added. */
    226 static usb_driver_ops_t usbhid_driver_ops = {
    227         .add_device = usbhid_add_device,
     226static usb_driver_ops_t usb_kbd_driver_ops = {
     227        .add_device = usb_kbd_add_device,
    228228};
    229229
    230230
    231231/* The driver itself. */
    232 static usb_driver_t usbhid_driver = {
     232static usb_driver_t usb_kbd_driver = {
    233233        .name = NAME,
    234         .ops = &usbhid_driver_ops,
     234        .ops = &usb_kbd_driver_ops,
    235235        .endpoints = usb_kbd_endpoints
    236236};
     
    238238/*----------------------------------------------------------------------------*/
    239239
    240 //static driver_ops_t kbd_driver_ops = {
    241 //      .add_device = usbhid_add_device,
    242 //};
    243 
    244 ///*----------------------------------------------------------------------------*/
    245 
    246 //static driver_t kbd_driver = {
    247 //      .name = NAME,
    248 //      .driver_ops = &kbd_driver_ops
    249 //};
    250 
    251 /*----------------------------------------------------------------------------*/
    252 
    253240int main(int argc, char *argv[])
    254241{
    255         printf(NAME ": HelenOS USB HID driver.\n");
     242        printf(NAME ": HelenOS USB KBD driver.\n");
    256243
    257244        usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME);
    258245
    259         return usb_driver_main(&usbhid_driver);
     246        return usb_driver_main(&usb_kbd_driver);
    260247}
    261248
Note: See TracChangeset for help on using the changeset viewer.