Changeset c145bc2 in mainline for uspace/srv/kbd/ctl/pc.c


Ignore:
Timestamp:
2009-08-09T15:19:54Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e795203
Parents:
330965c
Message:

Updating keyboard LEDs.

File:
1 edited

Legend:

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

    r330965c rc145bc2  
    4040#include <io/keycode.h>
    4141#include <kbd_ctl.h>
     42#include <kbd_port.h>
    4243#include <gsp.h>
    4344
     
    4546        ds_s,
    4647        ds_e
     48};
     49
     50enum special_code {
     51        SC_ACK = 0xfa,
     52        SC_NAK = 0xfe
     53};
     54
     55enum lock_ind_bits {
     56        LI_SCROLL       = 0x01,
     57        LI_NUM          = 0x02,
     58        LI_CAPS         = 0x04
     59};
     60
     61enum kbd_command {
     62        KBD_CMD_SET_LEDS = 0xed
    4763};
    4864
     
    194210        size_t map_length;
    195211
     212        /*
     213         * ACK/NAK are returned as response to us sending a command.
     214         * We are not interested in them.
     215         */
     216        if (scancode == SC_ACK || scancode == SC_NAK)
     217                return;
     218
    196219        if (scancode == 0xe0) {
    197220                ds = ds_e;
     
    230253}
    231254
     255void kbd_ctl_set_ind(unsigned mods)
     256{
     257        uint8_t b;
     258
     259        b = 0;
     260        if ((mods & KM_CAPS_LOCK) != 0)
     261                b = b | LI_CAPS;
     262        if ((mods & KM_NUM_LOCK) != 0)
     263                b = b | LI_NUM;
     264        if ((mods & KM_SCROLL_LOCK) != 0)
     265                b = b | LI_SCROLL;
     266
     267        kbd_port_write(KBD_CMD_SET_LEDS);
     268        kbd_port_write(b);
     269}
     270
    232271/**
    233272 * @}
Note: See TracChangeset for help on using the changeset viewer.