Skip to content

Lab 3 Tasks

Requested Functions

  • int kbc_read_status(uint8_t *status)
  • int kbc_read_output(uint8_t *byte)
  • int kbc_write_command(uint8_t command)
  • int kbd_process_byte(uint8_t byte)
  • int kbd_get_scancode(uint8_t bytes[2], uint8_t *size, int *make)

Guided Gaps

  • Check output pointer arguments.
  • Ignore reads when no byte is available.
  • Detect controller error bits.
  • Store a pending 0xE0 prefix.
  • Report make and break without losing original bytes.

IMPORTANT

Do not treat every byte as a complete scancode. Extended scancodes must be assembled before the API reports an event.

Common Mistakes

  • Clearing parser state too early.
  • Reporting a scancode before all bytes arrived.
  • Treating break codes as normal key presses.
  • Reading output without checking status.

Next: checks and references.

Course/docs licensed CC BY 4.0. Code licensed MIT.