How USB devices work

I skimmed through the “what do people want from the firmware” but I failed to see how or what happens when you plug the keyboard into a usb/ps2 etc. port.

And I was only half lazy this time because I googled it, but can’t find any good articles on what actually happens when a peripheral is plugged in.

Please educate me (and any others) on what occurs when I plug in a keyboard. Does the keyboard go through some POST or anything? I think @algernon mentioned something about saving configurations in EEPROM (is EEPROM = NVRAM?), how exactly is this done? Will we have to enter into the keyboard to do something, or will we have a utility? GUI or CLI?

So many questions, thanks in advance.

1 Like


  • You plug a device into a USB port
  • The computer (“host”) notices there’s a new device there.
  • The computer probes the device to find out what its capabilities are
  • The device replies with a description of its capabilities.
  • The two continue to talk, with the host asking the keyboard for an update every so often. (every 8ms)

The canonical book on this process is

On the keyboard side, there’s a tiny program that runs as soon as the microcontroller gets USB power. It takes care of turning on power to the LED subsystem, polling the ATTiny88 keyscanners for key matrix events and talking USB to the host.

EEPROM is, I suppose, more durable than NVRAM. It’s “electronically erasable read only memory.” If NVRAM is a low-power LCD screen with a big battery, EEPROM is an eInk screen.

You can think of EEPROM as the keyboard’s very, very tiny (2.5k?) SSD. The firmware has helper functions for reading and writing from EEPROM.

Does that help get you started?



Yes. Thanks. Good starting point. I have no intentions of ever becoming a developer but I do like knowing the why and how.

1 Like