Fix long-standing issues in qemu/bochs
and possibly other environments - fixes the long-standing issue with keyboard/mouse getting disabled sometimes on bootup, especially if you tried to interact with the qemu window during the boot process
This commit is contained in:
parent
193158079d
commit
c9448437dc
@ -49,7 +49,6 @@ keyboard_handler(
|
||||
scancode = inportb(KEY_DEVICE);
|
||||
irq_ack(KEYBOARD_IRQ);
|
||||
|
||||
|
||||
putch(scancode);
|
||||
|
||||
}
|
||||
@ -73,6 +72,13 @@ keyboard_install() {
|
||||
bfinish(0);
|
||||
}
|
||||
|
||||
void keyboard_reset_ps2() {
|
||||
uint8_t tmp = inportb(0x61);
|
||||
outportb(0x61, tmp | 0x80);
|
||||
outportb(0x61, tmp & 0x7F);
|
||||
inportb(KEY_DEVICE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait on the keyboard.
|
||||
*/
|
||||
|
@ -20,6 +20,7 @@ int8_t mouse_byte[3];
|
||||
#define MOUSE_BBIT 0x01
|
||||
#define MOUSE_WRITE 0xD4
|
||||
#define MOUSE_F_BIT 0x20
|
||||
#define MOUSE_V_BIT 0x08
|
||||
|
||||
fs_node_t * mouse_pipe;
|
||||
|
||||
@ -66,6 +67,7 @@ void mouse_handler(struct regs *r) {
|
||||
switch (mouse_cycle) {
|
||||
case 0:
|
||||
mouse_byte[0] = mouse_in;
|
||||
if (!(mouse_in & MOUSE_V_BIT)) return;
|
||||
++mouse_cycle;
|
||||
break;
|
||||
case 1:
|
||||
|
@ -146,6 +146,7 @@ extern void timer_wait(int ticks);
|
||||
|
||||
/* Keyboard */
|
||||
extern void keyboard_install();
|
||||
extern void keyboard_reset_ps2();
|
||||
extern void keyboard_wait();
|
||||
extern void putch(unsigned char c);
|
||||
|
||||
|
@ -134,8 +134,8 @@ int main(struct multiboot *mboot, uint32_t mboot_mag, uintptr_t esp) {
|
||||
shm_install(); /* Install shared memory */
|
||||
|
||||
keyboard_install(); /* Keyboard interrupt handler */
|
||||
|
||||
mouse_install(); /* Mouse driver */
|
||||
keyboard_reset_ps2();
|
||||
|
||||
if (cmdline) {
|
||||
parse_args(cmdline);
|
||||
|
Loading…
Reference in New Issue
Block a user