Patently Unpatentable: Selecting Keyboard Layouts

4. August, 2011

Attaching USB keyboards to a computer is still a nasty business because you have to select the correct layout for it.

My solution: Add a special command to the keyboard which allows to download the layout (you get the key code and a symbol per key).

Since that is probably too simple (proof: the PC industry didn’t implement it years ago), here is a better solution: If the computer has a webcam, the user plugs the keyboard into a free USB port. This makes the driver activate the camera. The user can then show the keyboard to the PC. A simple OCR software will determine which key is where and load the appropriate layout. The quality of the OCR can be improved by analyzing the layout files and comparing them to the image.

If no layout can be found, the OCR can be used to find a very similar layout and then the few remaining keys can be assigned.

If there is no webcam, users can make a photo with their mobile phone or digital camera and use that.

Cool, eh? And best of all: This can’t be patented anymore.

Worst of all: Someone might already have a patent on this.

Testing the Impossible: Hardware

5. February, 2009

Victor Lin asked on I write unit test for everything?

In his case, he wanted to know how to test an application which processes audio: Reads the sound from a microphone, does something with the audio stream, plays the result on the speaker. How can you possibly test a class which reads audio from a microphone? How can you test playing sound on a speaker?

As Steve Rowe pointed out: Use a loopback cable. Play a well defined sound on the speaker and check what the microphone receives.

I suggest to move this test case into a separate test suite so you can run it individually. Print a message to plug in the loopback cable before the test and wait for the user to click “OK”. This is a unit test but not an automated one. It covers the setup steps of the hardware.

The next thing you will want to do is to check the code between the mic and speaker parts. These are now no longer dependent on the hardware and therefore simple to test.

%d bloggers like this: