[OpenBIOS] [PATCH] Adds get-key-map to keyboard node

Programmingkid programmingkidx at gmail.com
Thu Nov 15 22:16:13 CET 2012

On Nov 15, 2012, at 3:40 PM, Mark Cave-Ayland wrote:

> On 15/11/12 02:03, Programmingkid wrote:
>> This patch adds the get-key-map word to the keyboard node. This patch is
>> an improvement on the last get-key-map patch. It adds a keyboard node to
>> /aliases and fixes a bug with the getKeyMap() function. If you wish to
>> test out this patch, the program below will show you what key you
>> pushed. The output will display hex values and text. The hex values in
>> the middle tells you which key is being pushed.
> (cut)
> I think you may have misunderstood what the get-key-map word does - my guess from browsing the source code is that it's related to locale, and even better there is already a version of it included in OpenBIOS (MOL section).

How did you come to this conclusion that I don't know what get-key-map does? The program I made to test get-key-map on OpenBIOS is the same program I used to test on actual hardware. The results show my patch works.

Test results:

Holding down Command-v in Apple's Open Firmware:

ff8f2460: 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 |... at ............|
ff8f2470: 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00 |................|

Holding down Control-v (simulated Command-v) in OpenBIOS:

1fc9c9e8  00 00 00 40 00 00 00 00  00 00 00 00 00 00 00 00    ... at ............
1fc9c9f8  00 00 00 00 00 00 00 00  00 00 00 00 10 00 00 00    ................

The 40 you see in the top row indicates the v key is being held down. The 10 you see in the second row indicates the Command key is being held down. Both sets of data show this. This data shows the patch works. 

The only key combinations that Bootx looks for is Command-v (verbose mode) and Command-s (single user mode). This is all the get-key-map word is used for. I'm not sure what more you want.

> Take a look at arch/ppc/mol/methods.c to see how it's done there. It should be fairly easy to port this to the qemu under arch/ppc/qemu.
> Similarly you can see how MOL sets up the keyboard alias by looking at arch/ppc/mol/mol.fs - you'll need to point it towards adb-keyboard but otherwise it looks correct. With both of these in place you should hopefully find that the keyboard becomes responsive and boot progresses further.

This problem has already been solved by this line of code: 
set_property(aliases, "keyboard", buf, strlen(buf) + 1);

It adds keyboard to the /aliases node. After applying my patch, I was able to see that Bootx was able to obtain the keyboard instance handle successfully.

Thank you.

More information about the OpenBIOS mailing list