Firmware code for serial interface keyboards