I had this problem as well - including the device not supported message.
In my case deleting a keyboard extension then restarting (hold down power and home buttons) the iPad resolved the problem.
In my case I had the Stylus keyboard installed - to allow me to use the Apple pencil to enter text in any application.
I don't know if it was the Stylus extension specifically or a generic iOS problem that will appear when any third-party extension is installed.
I have a busy day so I haven't taken it any further - trying other extensions, reinstalling Stylus to see if it was transitory, etc.
There also seem to be others on this thread with hardware problems (working after a clean, on an incline, on a flat surface etc...) so this fix may not work for everyone.
But if you are having the problem I think it is worth deleting any keyboard extensions and doing a hard restart before worrying about the keyboard itself.