Fix test_kernel to support keyboard emulation