Ignore:
File:
1 edited

Legend:

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

    r7ac73a4 r24d943f  
    3838#include <str_error.h>
    3939#include <fibril.h>
    40 #include <stdio.h>
    4140
    4241#include <io/keycode.h>
     
    6362static const size_t BOOTP_BUFFER_SIZE = 8;
    6463static const size_t BOOTP_BUFFER_OUT_SIZE = 1;
    65 static const uint8_t IDLE_RATE = 125;
    6664
    6765/** Keyboard polling endpoint description for boot protocol class. */
     
    230228
    231229        if (mod_mask != 0) {
     230                usb_log_debug2("\n\nChanging mods and lock keys\n");
     231                usb_log_debug2("\nmods before: 0x%x\n", kbd_dev->mods);
     232                usb_log_debug2("\nLock keys before:0x%x\n\n",
     233                    kbd_dev->lock_keys);
     234               
    232235                if (type == KEY_PRESS) {
     236                        usb_log_debug2("\nKey pressed.\n");
    233237                        /*
    234238                         * Only change lock state on transition from released
     
    243247                        usbhid_kbd_set_led(kbd_dev);
    244248                } else {
     249                        usb_log_debug2("\nKey released.\n");
    245250                        kbd_dev->lock_keys = kbd_dev->lock_keys & ~mod_mask;
    246251                }
    247252        }
    248253
     254        usb_log_debug2("\n\nmods after: 0x%x\n", kbd_dev->mods);
     255        usb_log_debug2("\nLock keys after: 0x%x\n\n", kbd_dev->lock_keys);
     256       
    249257        if (key == KC_CAPS_LOCK || key == KC_NUM_LOCK || key == KC_SCROLL_LOCK) {
    250258                // do not send anything to the console, this is our business
     
    273281        ev.key = key;
    274282        ev.mods = kbd_dev->mods;
     283       
     284        if (ev.mods & KM_NUM_LOCK) {
     285                usb_log_debug("\n\nNum Lock turned on.\n\n");
     286        }
    275287
    276288        ev.c = layout[active_layout]->parse_ev(&ev);
     
    377389                }
    378390        }
    379 //      // report all currently pressed keys
    380 //      for (i = 0; i < kbd_dev->keycode_count; ++i) {
    381 //              if (key_codes[i] != 0) {
    382 //                      key = usbhid_parse_scancode(key_codes[i]);
    383 //                      usb_log_debug2("\nKey pressed: %d (keycode: %d)\n", key,
    384 //                          key_codes[i]);
    385 //                      usbhid_kbd_push_ev(kbd_dev, KEY_PRESS, key);
    386 //              }
    387 //      }
    388391       
    389392        memcpy(kbd_dev->keycodes, key_codes, kbd_dev->keycode_count);
    390393       
    391         char *kc = (char *)malloc(kbd_dev->keycode_count * 4 + 1);
     394        usb_log_debug2("\nNew stored keycodes: ");
    392395        for (i = 0; i < kbd_dev->keycode_count; ++i) {
    393                 snprintf(kc + (i * 4), 5, "%4d", key_codes[i]);
    394         }
    395         usb_log_debug("New stored keycodes: %s\n", kc);
     396                usb_log_debug2("%d ", kbd_dev->keycodes[i]);
     397        }
    396398}
    397399
     
    408410                return;
    409411        }
     412
     413        usb_log_debug2("Got keys from parser: ");
     414        unsigned i;
     415        for (i = 0; i < count; ++i) {
     416                usb_log_debug2("%d ", key_codes[i]);
     417        }
     418        usb_log_debug2("\n");
    410419       
    411420        usbhid_kbd_t *kbd_dev = (usbhid_kbd_t *)arg;
    412421        assert(kbd_dev != NULL);
    413 
    414         unsigned i;
    415         char *kc = (char *)malloc(kbd_dev->keycode_count * 4 + 1);
    416         for (i = 0; i < kbd_dev->keycode_count; ++i) {
    417                 snprintf(kc + (i * 4), 5, "%4d", key_codes[i]);
    418         }
    419         usb_log_debug("Got keys from parser: %s\n", kc);
    420422       
    421423        if (count != kbd_dev->keycode_count) {
     
    444446        //usb_hid_parse_report(kbd_dev->parser, buffer, actual_size, callbacks,
    445447        //    NULL);
    446         /*//usb_log_debug2("Calling usb_hid_boot_keyboard_input_report() with size"
     448        /*usb_log_debug2("Calling usb_hid_boot_keyboard_input_report() with size"
    447449            " %zu\n", actual_size);*/
    448450        //dump_buffer("bufffer: ", buffer, actual_size);
     
    557559         * Set boot protocol.
    558560         * Set LEDs according to initial setup.
    559          * Set Idle rate
    560561         */
    561562        assert(kbd_dev->hid_dev != NULL);
     
    564565       
    565566        usbhid_kbd_set_led(kbd_dev);
    566        
    567         usbhid_req_set_idle(kbd_dev->hid_dev, IDLE_RATE);
    568567       
    569568        kbd_dev->initialized = 1;
Note: See TracChangeset for help on using the changeset viewer.