Earlier quoted context omitted.
If there's a monitor, you don't need to trust the first keyboard—just display a message with "type this [random] code to allow this keyboard."
I like this, but how do you know the keyboard layout?
For this case, I am assuming that the keyboard and os language are fairly compatible, at least translatable.