admin管理员组文章数量:1278789
I'm developing an OS and encountering an issue with my PS/2 keyboard driver: despite attempting to set the keyboard to scancode set 2, it continues to send scancode set 1 codes.
Below is the function used to set the scancode set:
static void set_default_scancode_set(void) {
uint8_t resp;
int i = 0;
do {
if (i++ == MAX_RETRY_COUNT) {
stop();
}
outb(PS2_KEYBOARD_DATA, COMMAND_SET_SCANCODE_SET);
io_wait();
resp = inb(PS2_KEYBOARD_DATA);
} while (resp == RESP_RESEND);
if (resp != RESP_ACK) {
stop();
}
i = 0;
do {
if (i++ == MAX_RETRY_COUNT) {
stop();
}
outb(PS2_KEYBOARD_DATA, DEFAULT_SCANCODE_SET);
io_wait();
resp = inb(PS2_KEYBOARD_DATA);
} while (resp == RESP_RESEND);
if (resp != RESP_ACK) {
stop();
}
}
The keyboard is initialized with the following function:
void init_keyboard(void) {
set_default_scancode_set();
enable_scanning();
install_irq_driver(1, ps2_keyboard_callback);
}
Additional Information
DEFAULT_SCANCODE_SET
is defined as2
.- Other constants used (
COMMAND_SET_SCANCODE_SET
,PS2_KEYBOARD_DATA
, etc.) are correctly defined. - The keyboard continues to send scancode set 1 codes.
A complete example can be found in the following GitHub repository: GitHub Repo
Edit
This issue was fixed by setting the PS/2 controller command byte (disabling the scancode translation feature).
本文标签: cKeyboard Driver Not Switching to Scancode Set 2 (custom OS)Stack Overflow
版权声明:本文标题:c - Keyboard Driver Not Switching to Scancode Set 2 (custom OS) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741211215a2359160.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论