A few years ago, I spent about 8 hours iterating on reverse-engineering a EEE PC 701 keyboard - trying to bruteforce row and column locations in an online keyboard firmware generator, recompiling and flashing firmware over and over again. 126 painful iterations later, I have mapped every key of an EEE PC 701 keyboard, except for one.
This was obviously not the proper way to do things. For the next keyboard I wanted to reuse, I found two I2C GPIO expanders, hooked them up to a ZeroPhone, and wrote some code to reverse-engineer it in a convenient way. It took only about 2-3 hours, and in the end, I had a tool to tame any keyboard I could find around - which would only take minutes.
Somehow, we aren't doing this more, even though it's way easier than I've expected. There's an instructables project that's done a great deal of the same work I've done, and a lot of people have reused their keyboards with help of that project. I believe that things should be done differently, however - in a more open way.
Why reverse-engineer laptop keyboards?
Laptop keyboards are cheap, well-built for the price, and available in large quantities - and, any hacker has a few spare keyboards laying around. Using a laptop keyboard in your project lets you do a whole bunch of input. You can give any of your projects an easy way to input text, execute a variety of commands. You can get from 80 to 100 keys and only use a few GPIOs on your microcontroller.
KeyboardWhiz hardware aims to let you reverse-engineer any laptop keyboard in 5 minutes' time. You get pinout information, a keyboard, nicely formatted in a PDF datasheet. It also lets you upload this data online, so that everyone else can benefit from it.
What's possible with this project?
For a start, if your microcontroller project has I2C available, you can copy the KeyboardWhiz v1 schematic - which is to say, get two 16-bit I2C expanders and an FPC connector, and reuse any spare laptop keyboard you might have around. So, ideally, reusing any laptop keyboard starts at $5 per keyboard.
Once we have a sizeable database of keyboards, we can go even cheaper. If we figure out similarities between pinouts for an assortment of keyboards, we can create universal boards for FPC keyboards. Since a predetermined group of 8 pins has to be outputs and another group of 16-18 has to be inputs, you should be able to use one 74HC595 and two-three 74HC165 chips. Then, you can get adapters that use cheap shift registers instead of I2C - at most, $1 in ICs and connectors instead of $5 if you want to add support for an already-decoded keyboard to your hardware.
This project's efforts also lets you design larger-scale projects around widely available laptop keyboards - as there's families of cheaply available keyboards that are intercompatible. For instance, you can find myriads of Asus K53 keyboard for 7EUR on Aliexpress, and this project has data for these keyboards already. So, if you'd like to produce ten or even a hundred devices equipped with a decent low-footprint keyboard, you can buy a bunch of Asus K53 keyboards off Aliexpress, get the pinout and key table from this project's efforts and reuse these, again, at most, only spending $1 in extra parts.
If there's a family of cheap keyboards that nobody took a KeyboardWhiz to, you can do that yourself, and it only takes 5 minutes.
What's already available?
The reverse-engineering part of it is already possible with KeyboardWhiz code, and you can already generate a PDF with a pinout table. The RE code is robust and flexible, as well as user-friendly.
The "creating key events in Linux from this data" part isn't yet written, but will be straightforward given the reverse-engineered data.
As for adding KeyboardWhiz to your own hardware, I2C expanders are currently expensive due to chip shortage, so putting a few of these your own board might be non-ideal at the moment. Yet, I'm sure we'll soon get through these tough times.