Status: ✅ COMPLETE
Scope: How a key press or a mouse movement becomes something on screen: switches and matrices, scan codes, USB HID and PS/2, the Windows driver and input chain, keyboard layouts, mouse sensors, pointer acceleration and click hit-testing
Time to complete: 60–90 minutes of reading + lab
Prerequisites: Chapter 4 (Motherboard and Hardware Communication, especially interrupts), Chapter 13 (Device Drivers), Chapter 30 (Windows Desktop Internals)
What you'll know after: What happens inside a keyboard and a mouse, how their messages reach Windows, and how Windows turns them into letters, cursor movement and clicks
INTRODUCTION
You use the keyboard and mouse all day, and you probably never wonder how they work. Yet a single key press goes through a surprising number of steps: a tiny switch, a small chip, a wire or radio, a polling controller, a stack of drivers, a layout table, a message queue, and finally the program that draws the letter.
This chapter uses real photos (a key switch taken apart, the underside of an optical mouse, the back of a PC with its round PS/2 sockets) and plain words. Every technical term is explained the first time it appears.
This chapter explains:
- How keys are wired in a matrix, scanned, debounced, and turned into scan codes
- What rollover and ghosting are, and how membrane, scissor and mechanical switches differ
- How a keyboard or mouse reaches the PC: USB HID polling, Bluetooth and 2.4 GHz, and old PS/2 with IRQ 1 and IRQ 12
- The whole keyboard chain in Windows, from HID report to WM_CHAR and the letter on screen
- How an optical mouse sensor finds movement, and how Windows applies speed and acceleration
- How a click finds the window under the pointer
CHAPTER OUTLINE
- Section 1: Keyboard Hardware
- Section 2: Connection Path
- Section 3: The Complete Keyboard Chain
- Section 4: Mouse Movement and Clicks
- Practical Lab: Input Exploration
- Knowledge Check
Chapter Status: Complete
Estimated reading time: 70 minutes
Practical time: 30 minutes
Knowledge check time: 30 minutes