Changeset 12b6796 in mainline


Ignore:
Timestamp:
2009-02-20T22:47:08Z (15 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5ad8661
Parents:
90e3d6a
Message:

Tackle scroll lock and cope with lock-key hardware auto-repeat.

Location:
uspace/srv/kbd
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/kbd/ctl/pc.c

    r90e3d6a r12b6796  
    136136        [0x58] = KC_F12,
    137137
     138        [0x46] = KC_SCROLL_LOCK,
     139
    138140        [0x1c] = KC_ENTER,
    139141
     
    160162
    161163        [0x37] = KC_PRTSCR,
     164
    162165        [0x52] = KC_INSERT,
     166        [0x47] = KC_HOME,
    163167        [0x49] = KC_PAGE_UP,
    164168
  • uspace/srv/kbd/generic/kbd.c

    r90e3d6a r12b6796  
    6464static unsigned mods = KM_NUM_LOCK;
    6565
     66/** Currently pressed lock keys. We track these to tackle autorepeat. */
     67static unsigned lock_keys;
     68
    6669void kbd_push_scancode(int scancode)
    6770{
     
    99102        }
    100103
    101         if (mod_mask != 0 && type == KE_PRESS)
    102                 mods = mods ^ mod_mask;
     104        if (mod_mask != 0) {
     105                if (type == KE_PRESS) {
     106                        /*
     107                         * Only change lock state on transition from released
     108                         * to pressed. This prevents autorepeat from messing
     109                         * up the lock state.
     110                         */
     111                        mods = mods ^ (mod_mask & ~lock_keys);
     112                        lock_keys = lock_keys | mod_mask;
     113                } else {
     114                        lock_keys = lock_keys & ~mod_mask;
     115                }
     116        }
    103117
    104118        printf("type: %d\n", type);
Note: See TracChangeset for help on using the changeset viewer.