Ignore:
File:
1 edited

Legend:

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

    re4153ea r70a71e5  
    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;
    83 static const uint8_t ERROR_ROLLOVER = 1;
     72/** Boot protocol report size (key part). */
     73static const size_t BOOTP_REPORT_SIZE = 6;
     74
     75/** Boot protocol total report size. */
     76static const size_t BOOTP_BUFFER_SIZE = 8;
     77
     78/** Boot protocol output report size. */
     79static const size_t BOOTP_BUFFER_OUT_SIZE = 1;
     80
     81/** Boot protocol error key code. */
     82static const uint8_t BOOTP_ERROR_ROLLOVER = 1;
    8483
    8584/** Default idle rate for keyboards. */
     
    265264static void usb_kbd_set_led(usb_kbd_t *kbd_dev)
    266265{
     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
    267272        unsigned i = 0;
    268        
    269         /* Reset the LED data. */
    270         memset(kbd_dev->led_data, 0, kbd_dev->led_output_size * sizeof(int32_t));
    271273       
    272274        if ((kbd_dev->mods & KM_NUM_LOCK) && (i < kbd_dev->led_output_size)) {
    273275                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;
    274280        }
    275281       
    276282        if ((kbd_dev->mods & KM_CAPS_LOCK) && (i < kbd_dev->led_output_size)) {
    277283                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;
    278288        }
    279289       
     
    281291            && (i < kbd_dev->led_output_size)) {
    282292                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]);
    283302        }
    284303
     
    296315                return;
    297316        }
     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//      }
    298324       
    299325        usb_log_debug("Output report buffer: %s\n",
     
    454480         * First of all, check if the kbd have reported phantom state.
    455481         *
    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.
     482         *  this must be changed as we don't know which keys are modifiers
     483         *       and which are regular keys.
    460484         */
    461485        i = 0;
    462         while (i < count && key_codes[i] != ERROR_ROLLOVER) {
     486        // all fields should report Error Rollover
     487        while (i < count &&
     488            key_codes[i] == BOOTP_ERROR_ROLLOVER) {
    463489                ++i;
    464490        }
    465         if (i != count) {
     491        if (i == count) {
    466492                usb_log_debug("Phantom state occured.\n");
    467493                // phantom state, do nothing
Note: See TracChangeset for help on using the changeset viewer.