When Kodi starts up, the peripherals subsystem does a scan for peripherals. Kodi supports several busses including USB. Two new virtual busses have been added:
This chart shows joysticks being scanned through the peripheral API. The keyboard is always assumed to be attached.