48#include "debug/PS2.hh"
50#include "params/PS2Keyboard.hh"
64 p.vnc->setKeyboard(
this);
88 DPRINTF(PS2,
"Got keyboard read ID command.\n");
93 DPRINTF(PS2,
"Enabling the keyboard.\n");
98 DPRINTF(PS2,
"Disabling the keyboard.\n");
103 DPRINTF(PS2,
"Disabling and resetting the keyboard.\n");
108 DPRINTF(PS2,
"Resetting keyboard.\n");
114 panic(
"Keyboard resend unimplemented.\n");
117 if (
data.size() == 1) {
118 DPRINTF(PS2,
"Got LED write command.\n");
123 "caps lock %s, num lock %s, scroll lock %s\n",
134 if (
data.size() == 1) {
135 DPRINTF(PS2,
"Got scan code set command.\n");
140 uint8_t scan_code =
data[1];
141 if (scan_code == 0) {
142 DPRINTF(PS2,
"Sending hard coded current scan code set 2.\n");
145 DPRINTF(PS2,
"Setting scan code set to %d.\n", scan_code);
147 "PS/2 scan code set %d not supported.", scan_code);
152 if (
data.size() == 1) {
153 DPRINTF(PS2,
"Setting typematic info.\n");
157 DPRINTF(PS2,
"Setting typematic info to %#02x.\n",
data[1]);
162 panic(
"Setting all keys to typemantic unimplemented.\n");
164 panic(
"Setting all keys to make/release unimplemented.\n");
166 panic(
"Setting all keys to make unimplemented.\n");
168 panic(
"Setting all keys to "
169 "typematic/make/release unimplemented.\n");
171 panic(
"Setting a key to typematic unimplemented.\n");
173 panic(
"Setting a key to make/release unimplemented.\n");
175 panic(
"Setting key to make only unimplemented.\n");
177 panic(
"Unknown keyboard command %#02x.\n",
data[0]);
197 for (uint8_t
c :
keys)
void serialize(CheckpointOut &cp) const override
Serialize an object.
void send(const uint8_t *data, size_t size)
Send data from a PS/2 device to a host.
void sendAck()
Send an ACK byte to the host.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
PS2Keyboard(const PS2KeyboardParams &p)
void serialize(CheckpointOut &cp) const override
Serialize an object.
void keyPress(uint32_t key, bool down) override
Called when the vnc server receives a key press event from the client.
bool enabled
Is the device enabled?
bool recv(const std::vector< uint8_t > &data) override
Data received from host.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
bool shiftDown
is the shift key currently down
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
#define panic(...)
This implements a cprintf based panic() function.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
const std::vector< uint8_t > ID
@ AllKeysToTypematicMakeRelease
bool bool std::list< uint8_t > & keys
void keySymToPs2(uint32_t key, bool down, bool &cur_shift, std::list< uint8_t > &keys)
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
std::ostream CheckpointOut
#define UNSERIALIZE_SCALAR(scalar)
#define SERIALIZE_SCALAR(scalar)