Changeset 21a0d8a in mainline


Ignore:
Timestamp:
2018-08-09T18:30:45Z (6 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b13d80b
Parents:
3cdd876
Message:

atkbd: Explicitly enable the keyboard

Do not rely on the keyboard being enabled by the firmware and always
enable it explicitly. This will become necessary starting with QEMU
3.0.0 on the Integrator/CP machine. QEMU's ps2 keyboard will ignore
keyboard events unless in enabled state.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/hid/atkbd/atkbd.c

    r3cdd876 r21a0d8a  
    4848#define AT_NUM_SCAN_CODE 0x77
    4949#define AT_SCROLL_SCAN_CODE 0x7E
     50
     51#define AT_KBD_ENABLE 0xF4
     52#define AT_KBD_ACK 0xFA
    5053
    5154/* Set 2 scan codes (AT keyboard) */
     
    405408        }
    406409
     410        uint8_t code = AT_KBD_ENABLE;
     411        size_t bytes;
     412        rc = chardev_write(kbd->chardev, &code, 1, &bytes);
     413        if (rc != EOK) {
     414                ddf_msg(LVL_ERROR, "Failed to enable keyboard.");
     415                fibril_destroy(kbd->polling_fibril);
     416                ddf_fun_unbind(kbd->kbd_fun);
     417                ddf_fun_destroy(kbd->kbd_fun);
     418                return EIO;
     419        }
     420        rc = chardev_read(kbd->chardev, &code, 1, &bytes);
     421        if (rc != EOK || code != AT_KBD_ACK) {
     422                ddf_msg(LVL_ERROR, "Failed to confirm keyboard enable: %hhx.",
     423                    code);
     424                fibril_destroy(kbd->polling_fibril);
     425                ddf_fun_unbind(kbd->kbd_fun);
     426                ddf_fun_destroy(kbd->kbd_fun);
     427                return EIO;
     428        }
     429
    407430        fibril_add_ready(kbd->polling_fibril);
    408431        return EOK;
Note: See TracChangeset for help on using the changeset viewer.