Changeset e4153ea in mainline


Ignore:
Timestamp:
2011-04-01T14:34:18Z (13 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1b9c0e2, 966acede
Parents:
7787dd81
Message:

Output report using HID parser API finished + fix in phantom state detection.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbkbd/kbddev.c

    r7787dd81 re4153ea  
    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;
    273268       
     
    277272        if ((kbd_dev->mods & KM_NUM_LOCK) && (i < kbd_dev->led_output_size)) {
    278273                kbd_dev->led_data[i++] = USB_HID_LED_NUM_LOCK;
    279 //              leds |= USB_HID_LED_NUM_LOCK;
    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;
    285278        }
    286279       
     
    288281            && (i < kbd_dev->led_output_size)) {
    289282                kbd_dev->led_data[i++] = USB_HID_LED_SCROLL_LOCK;
    290 //              leds |= USB_HID_LED_SCROLL_LOCK;
    291         }
    292        
    293         usb_log_debug("Output report data: ");
    294         for (i = 0; i < kbd_dev->led_output_size; ++i) {
    295                 usb_log_debug("%u: %d", i, kbd_dev->led_data[i]);
    296283        }
    297284
     
    309296                return;
    310297        }
    311        
    312 //      if ((rc = usb_hid_boot_keyboard_output_report(
    313 //          leds, buffer, BOOTP_BUFFER_OUT_SIZE)) != EOK) {
    314 //              usb_log_warning("Error composing output report to the keyboard:"
    315 //                  "%s.\n", str_error(rc));
    316 //              return;
    317 //      }
    318298       
    319299        usb_log_debug("Output report buffer: %s\n",
     
    474454         * First of all, check if the kbd have reported phantom state.
    475455         *
    476          *  this must be changed as we don't know which keys are modifiers
    477          *       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.
    478460         */
    479461        i = 0;
    480         // all fields should report Error Rollover
    481         while (i < count &&
    482             key_codes[i] == BOOTP_ERROR_ROLLOVER) {
     462        while (i < count && key_codes[i] != ERROR_ROLLOVER) {
    483463                ++i;
    484464        }
    485         if (i == count) {
     465        if (i != count) {
    486466                usb_log_debug("Phantom state occured.\n");
    487467                // phantom state, do nothing
Note: See TracChangeset for help on using the changeset viewer.