In debug mode, select which device to use
Correctly handle events in debug mode