Changeset 7ac73a4 in mainline for uspace/drv/usbhid/kbddev.c


Ignore:
Timestamp:
2011-03-05T11:49:53Z (14 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
00db345a
Parents:
dde8ca4
Message:

Setting idle rate + minor changes.

  • Removed some debug output, added some new.
  • Disabled output from HCD driver.
File:
1 edited

Legend:

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

    rdde8ca4 r7ac73a4  
    3838#include <str_error.h>
    3939#include <fibril.h>
     40#include <stdio.h>
    4041
    4142#include <io/keycode.h>
     
    6263static const size_t BOOTP_BUFFER_SIZE = 8;
    6364static const size_t BOOTP_BUFFER_OUT_SIZE = 1;
     65static const uint8_t IDLE_RATE = 125;
    6466
    6567/** Keyboard polling endpoint description for boot protocol class. */
     
    228230
    229231        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                
    235232                if (type == KEY_PRESS) {
    236                         usb_log_debug2("\nKey pressed.\n");
    237233                        /*
    238234                         * Only change lock state on transition from released
     
    247243                        usbhid_kbd_set_led(kbd_dev);
    248244                } else {
    249                         usb_log_debug2("\nKey released.\n");
    250245                        kbd_dev->lock_keys = kbd_dev->lock_keys & ~mod_mask;
    251246                }
    252247        }
    253248
    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        
    257249        if (key == KC_CAPS_LOCK || key == KC_NUM_LOCK || key == KC_SCROLL_LOCK) {
    258250                // do not send anything to the console, this is our business
     
    281273        ev.key = key;
    282274        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         }
    287275
    288276        ev.c = layout[active_layout]->parse_ev(&ev);
     
    389377                }
    390378        }
     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//      }
    391388       
    392389        memcpy(kbd_dev->keycodes, key_codes, kbd_dev->keycode_count);
    393390       
    394         usb_log_debug2("\nNew stored keycodes: ");
     391        char *kc = (char *)malloc(kbd_dev->keycode_count * 4 + 1);
    395392        for (i = 0; i < kbd_dev->keycode_count; ++i) {
    396                 usb_log_debug2("%d ", kbd_dev->keycodes[i]);
    397         }
     393                snprintf(kc + (i * 4), 5, "%4d", key_codes[i]);
     394        }
     395        usb_log_debug("New stored keycodes: %s\n", kc);
    398396}
    399397
     
    410408                return;
    411409        }
    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");
    419410       
    420411        usbhid_kbd_t *kbd_dev = (usbhid_kbd_t *)arg;
    421412        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);
    422420       
    423421        if (count != kbd_dev->keycode_count) {
     
    446444        //usb_hid_parse_report(kbd_dev->parser, buffer, actual_size, callbacks,
    447445        //    NULL);
    448         /*usb_log_debug2("Calling usb_hid_boot_keyboard_input_report() with size"
     446        /*//usb_log_debug2("Calling usb_hid_boot_keyboard_input_report() with size"
    449447            " %zu\n", actual_size);*/
    450448        //dump_buffer("bufffer: ", buffer, actual_size);
     
    559557         * Set boot protocol.
    560558         * Set LEDs according to initial setup.
     559         * Set Idle rate
    561560         */
    562561        assert(kbd_dev->hid_dev != NULL);
     
    565564       
    566565        usbhid_kbd_set_led(kbd_dev);
     566       
     567        usbhid_req_set_idle(kbd_dev->hid_dev, IDLE_RATE);
    567568       
    568569        kbd_dev->initialized = 1;
Note: See TracChangeset for help on using the changeset viewer.