3

I am writing my own kernel in c. Now I want to code a Console to interact with the Kernel. It should work like the normal Terminal on Linux. How can I get a input over the Keyboard ? Do I have to use Keyboard specific drivers ?

Michael Petch
  • 46,082
  • 8
  • 107
  • 198
Coretool
  • 415
  • 1
  • 5
  • 14
  • Minimal example with PS/2: https://github.com/cirosantilli/x86-bare-metal-examples/blob/5c672f73884a487414b3e21bd9e579c67cd77621/in_keyboard.S and BIOS: https://github.com/cirosantilli/x86-bare-metal-examples/blob/5c672f73884a487414b3e21bd9e579c67cd77621/bios_keyboard.S – Ciro Santilli OurBigBook.com Nov 13 '15 at 09:55
  • The 8042 chip (and hardware that may emulate it) is well documented. The accepted answer has a link to 8042 information – Michael Petch Jan 26 '16 at 22:22
  • 1
    Possible duplicate of [Keyboard IRQ within an x86 kernel](https://stackoverflow.com/questions/37618111/keyboard-irq-within-an-x86-kernel) – Michael Petch Aug 28 '19 at 20:31

1 Answers1

4

You need to write a driver in your kernel for the keyboard. Assuming a standard PC, the 8042 keyboard controller is pretty well documented (see http://wiki.osdev.org/%228042%22_PS/2_Controller for example). You'll also need to write a driver for the display, and again assuming VGA it is pretty well documented (see http://wiki.osdev.org/VGA_Hardware). Then you'll have to write all of the terminal stuff that sits in between to connect the two.

Stewart
  • 3,978
  • 17
  • 20