Changeset 1ff1ee1 in mainline


Ignore:
Timestamp:
2012-01-03T13:29:09Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ecc6323
Parents:
8bb9540
Message:

xtkbd: Add support for setting LED indicators.

This breaks XT compatibility (XT protocol is unidirectional),
but was requested on ML in order to maintain feature parity with the old
driver.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/char/xtkbd/xtkbd.c

    r8bb9540 r1ff1ee1  
    178178};
    179179
     180#define KBD_CMD_SET_LEDS 0xed
     181enum led_indicators {
     182        LI_SCROLL       = 0x01,
     183        LI_NUM          = 0x02,
     184        LI_CAPS         = 0x04,
     185};
     186
    180187static int polling(void *);
    181188static void default_connection_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *);
     
    310317
    311318        switch (method) {
    312         case KBDEV_SET_IND:
    313                 /* XT keyboards do not support setting mods */
    314                 async_answer_0(icallid, ENOTSUP);
     319        case KBDEV_SET_IND: {
     320                /* XT keyboards do not support setting mods,
     321                 * assume AT keyboard with Scan Code Set 1 */
     322                const unsigned mods = IPC_GET_ARG1(*icall);
     323                const uint8_t status = 0 |
     324                    ((mods & KM_CAPS_LOCK) ? LI_CAPS : 0) |
     325                    ((mods & KM_NUM_LOCK) ? LI_NUM : 0) |
     326                    ((mods & KM_SCROLL_LOCK) ? LI_SCROLL : 0);
     327                uint8_t cmds[] = { KBD_CMD_SET_LEDS, status };
     328                const ssize_t size =
     329                     char_dev_write(kbd->parent_sess, cmds, sizeof(cmds));
     330                async_answer_0(icallid, size < 0 ? size : EOK);
    315331                break;
     332        }
    316333        /* This might be ugly but async_callback_receive_start makes no
    317334         * difference for incorrect call and malloc failure. */
Note: See TracChangeset for help on using the changeset viewer.