Full keyboard input support has been added to CubeCactusOS!
You can now type commands directly into the shell and interact with the OS in real-time.
os/drivers/keyboard.c - Complete keyboard driver
os/userland/shell.c - Enhanced shell
os/kernel/main.c - Keyboard initialization
Makefile.os - Build system update
./run-os.sh
This opens a QEMU window where you can type directly.
make -f Makefile.os os-run
qemu-system-i386 -cdrom os/build/cubecactusos.iso -m 512M
./run-os-serial.sh
cubecactusos#help - Show all commands about - Display OS information mem - Show memory information echo - Echo text (e.g., "echo hello world") clear - Clear screen (placeholder) uptime - System uptime (placeholder) reboot - Reboot system (placeholder) shutdown - Halt the system cleanly
CubeCactusOS is now running! Entering scheduler... - Scheduler initialized ======================================== Welcome to CubeCactusOS Shell! ======================================== Type 'help' for available commands. Type 'shutdown' to halt the system. cubecactusos# help CubeCactusOS Shell Commands: help - Show this help message about - Display OS information clear - Clear the screen (not implemented) echo - Echo text to screen mem - Display memory information uptime - Show system uptime (not implemented) reboot - Reboot the system (not implemented) shutdown - Shutdown the system (not implemented) cubecactusos# echo Hello from CubeCactusOS! Hello from CubeCactusOS! cubecactusos# about CubeCactusOS v0.1.0 A microkernel-based operating system Based on MINIX3 architecture Built with: x86_64-elf-gcc Components: - Microkernel (IPC, scheduling) - Process Manager (PM) - Virtual File System (VFS) - TTY Driver cubecactusos# mem Memory Information: Total RAM: 512 MB (configured) Kernel Memory: ~10 KB Available: ~512 MB (Note: Memory management not fully implemented) cubecactusos# shutdown Shutting down... System halted. You can close QEMU now.
// Scancode Translation
scancode (0x1E) → 'a'
scancode + shift (0x1E + Shift) → 'A'
// Input Buffer (Circular)
[..........HEAD........TAIL.........]
^ ^
Write Read
// Interrupt Flow
Hardware Keyboard
↓
Port 0x60 (scancode)
↓
keyboard_interrupt_handler()
↓
Translate scancode → char
↓
Add to circular buffer
↓
Shell reads via keyboard_getchar_blocking()
Scancode Maps (scancode_to_char[])
Circular Buffer (256 bytes)
State Tracking
Character Processing
Try these test commands:
# Start the OS ./run-os.sh # In the QEMU window, type: help about echo Testing keyboard input! echo THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG echo 1234567890 !@#$%^&*() mem
Solution: Make sure you clicked in the QEMU window to focus it.
Solution: Ensure you're using ./run-os.sh (not serial mode)
Check:
make -f Makefile.os os-clean make -f Makefile.os os-image ./run-os.sh
os/
├── drivers/
│ ├── keyboard.c ✅ NEW! Keyboard driver
│ └── tty.c VGA text mode output
├── userland/
│ └── shell.c ✅ UPDATED! Interactive input
├── kernel/
│ └── main.c ✅ UPDATED! Keyboard init
└── lib/
└── klib.c Printf, memcpy, etc.
✅ Keyboard driver implemented
✅ Scancode translation working
✅ Shift key support
✅ Backspace functionality
✅ Real-time character echo
✅ Interactive shell loop
✅ Command execution
✅ All printable ASCII chars
✅ Input buffering
✅ Clean shutdown command
./run-os.sh
Type away and enjoy your fully interactive operating system! 🎉
Note: The keyboard input works in the QEMU graphical window. Make sure to click on the window to give it focus before typing.