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

Programmingkid programmingkidx at gmail.com
Mon Dec 3 21:51:30 CET 2012


On Dec 3, 2012, at 3:32 PM, Mark Cave-Ayland wrote:

> On 30/11/12 21:57, Programmingkid wrote:
> 
>>> Again - please take the get-key-map routine in arch/ppc/mol/methods.c as a starting point and make the *minimum* alterations for it to work under QEMU, and repost the patch. It should be just a case of changing the key detection functions, and so in that case I'd be happy to accept it as a patch.
>> 
>> What advantage would this code have over mine?
> 
> It's not an advantage per se, it's to do with maintainability. If the codebases are similar then any bugfixes to your code can be applied to the MOL code with relative ease (and while I'm not convinced people are still using it, I'd like to not break it if possible).
> 
>> A problem with this code is it was made for virtualization in mind. Qemu will be "emulating" a PowerMac. What this means is detecting the command key isn't possible with this code as is. My code already handles this situation.
> 
> Are you sure about this? I'd be surprised if there wasn't already some kind of workaround in place. As mentioned before, OpenBIOS is designed to be able to run on real hardware with minimal modifications and so I'm not greatly keen to do this.

On real hardware? I'm not too sure about that. This page seems to disagree as well: 
http://www.openfirmware.info/OpenBIOS

"Do not try to put OpenBIOS in a real boot ROM, it will not work and may damage your hardware!"

> Have you asked the developers on the qemu/qemu-ppc mailing lists how to emulate the command key on a non-Mac?

No I haven't. All the PowerPC developers are busy making some target called P series. I really doubt they have the time or interest in emulating the command key. 

I have looked at the code QEMU uses to handle key strokes and see no code that sends the command key to the emulated environment. The file itself is called cocoa.m.

Here is the code from cocoa.m that handles the keyboard:

 case NSKeyDown:

            // forward command Key Combos
            if ([event modifierFlags] & NSCommandKeyMask) {
                [NSApp sendEvent:event];
                return;
            }

            // default
            keycode = cocoa_keycode_to_qemu([event keyCode]);

            // handle control + alt Key Combos (ctrl+alt is reserved for QEMU)
            if (([event modifierFlags] & NSControlKeyMask) && ([event modifierFlags] & NSAlternateKeyMask)) {
                switch (keycode) {

                    // enable graphic console
                    case 0x02 ... 0x0a: // '1' to '9' keys
                        console_select(keycode - 0x02);
                        break;
                }

The line below "// forward command key combos" is what filters out the command key. I see no code to emulate the command key. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openbios.org/pipermail/openbios/attachments/20121203/8da09499/attachment-0001.html>


More information about the OpenBIOS mailing list