Skip to contentSkip to conversation

Mac OS X on QEMU

Qemu-devel Alexander Graf 6 participants 17 messages Jul 4, 2013 – Jul 11, 2013 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 7 lines · Programmingkid

We have made a lot of progress in the last month with making Mac OS X run in QEMU. A lot of people are to thank for this milestone. To everyone involved, thank you.

There is one thing that we have to figure out. That is the command key issue. This key is a very important on the Macintosh. It is used to send keyboard shortcuts to applications.

What I propose is adding a menu item to QEMU's menu called "Map Command key to ALT". This would allow a user to be able to send Macintosh applications command key shortcuts from both a PC and Mac keyboard.

I welcome any and all ideas to solve this problem.

This is the wrong mailing list for this. Your proposal would touch non-PPC code in QEMU, so this needs to go to qemu-devel.

Keep in mind that the same thing arises with x86 Mac OS X running in QEMU.

Alex

#2 lore raw
Quoted 7 lines · Alexander Graf
Quoted 4 lines · Programmingkid

We have made a lot of progress in the last month with making Mac OS X run in QEMU. A lot of people are to thank for this milestone. To everyone involved, thank you.

There is one thing that we have to figure out. That is the command key issue. This key is a very important on the Macintosh. It is used to send keyboard shortcuts to applications.

Quoted 7 lines
Quoted 3 lines

What I propose is adding a menu item to QEMU's menu called "Map Command key to ALT". This would allow a user to be able to send Macintosh applications command key shortcuts from both a PC and Mac keyboard.

I welcome any and all ideas to solve this problem.

This is the wrong mailing list for this. Your proposal would touch non-PPC code in QEMU, so this needs to go to qemu-devel.

Keep in mind that the same thing arises with x86 Mac OS X running in QEMU.

When I VNC into a Mac I find that the "Windows key" becomes the Command key. And the same probably happens when you plug a non-Apple USB keyboard into a Mac.

If you are using a keyboard with a "Windows key" then that would be the most natural option. If you don't have that key then you really need to map something else...

Stefan

#3 lore raw
Quoted 12 lines · Stefan Hajnoczi
Quoted 11 lines · Alexander Graf
Quoted 7 lines · Programmingkid

We have made a lot of progress in the last month with making Mac OS X run in QEMU. A lot of people are to thank for this milestone. To everyone involved, thank you.

There is one thing that we have to figure out. That is the command key issue. This key is a very important on the Macintosh. It is used to send keyboard shortcuts to applications.

What I propose is adding a menu item to QEMU's menu called "Map Command key to ALT". This would allow a user to be able to send Macintosh applications command key shortcuts from both a PC and Mac keyboard.

I welcome any and all ideas to solve this problem.

Quoted 7 lines
Quoted 3 lines

This is the wrong mailing list for this. Your proposal would touch non-PPC code in QEMU, so this needs to go to qemu-devel.

Keep in mind that the same thing arises with x86 Mac OS X running in QEMU.

When I VNC into a Mac I find that the "Windows key" becomes the Command key. And the same probably happens when you plug a non-Apple USB keyboard into a Mac.

I was thinking about the Windows key. It would be the perfect substitute - if it was available on all keyboards.

Quoted 6 lines

If you are using a keyboard with a "Windows key" then that would be the most natural option. If you don't have that key then you really need to map something else...

Stefan

Maybe there should be two menu items:
"Map command key to ALT" and "Map command key to Windows key".

They would be mutually exclusive of course.

#4 lore raw
Quoted 37 lines · Programmingkid
Quoted 1 line · Stefan Hajnoczi

On Thu, Jul 4, 2013 at 4:45 PM, Alexander Graf <[email protected]>

Quoted 4 lines · wrote:
Quoted 4 lines · Programmingkid
Quoted 2 lines

We have made a lot of progress in the last month with making Mac

OS X run in QEMU. A lot of people are to thank for this milestone. To everyone involved, thank you.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

There is one thing that we have to figure out. That is the

command key issue. This key is a very important on the Macintosh. It is used to send keyboard shortcuts to applications.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

What I propose is adding a menu item to QEMU's menu called "Map

Command key to ALT". This would allow a user to be able to send Macintosh applications command key shortcuts from both a PC and Mac keyboard.

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

I welcome any and all ideas to solve this problem.

This is the wrong mailing list for this. Your proposal would touch

non-PPC code in QEMU, so this needs to go to qemu-devel.

Quoted 2 lines
Quoted 2 lines

Keep in mind that the same thing arises with x86 Mac OS X running

in QEMU.

Quoted 3 lines

When I VNC into a Mac I find that the "Windows key" becomes the Command key. And the same probably happens when you plug a

non-Apple

Quoted 1 line

USB keyboard into a Mac.

I was thinking about the Windows key. It would be the perfect substitute - if it was available on all keyboards.

Quoted 5 lines

If you are using a keyboard with a "Windows key" then that would be the most natural option. If you don't have that key then you really need to map something else...

Quoted 6 lines
Quoted 1 line

Stefan

Maybe there should be two menu items:
"Map command key to ALT" and "Map command key to Windows key".

They would be mutually exclusive of course.

Isn't the Windows key already the same thing as the Command key, in terms of the actual keycode generated? And you'd still want to have an actual ALT key available... The option should just be whether to swap the Command/Windows and ALT keys for better ergonomics.

-Scott

#5 lore raw
Quoted 27 lines · Scott Wood
Quoted 26 lines · Programmingkid
Quoted 12 lines · Stefan Hajnoczi
Quoted 11 lines · Alexander Graf
Quoted 7 lines · Programmingkid

We have made a lot of progress in the last month with making Mac OS X run in QEMU. A lot of people are to thank for this milestone. To everyone involved, thank you.

There is one thing that we have to figure out. That is the command key issue. This key is a very important on the Macintosh. It is used to send keyboard shortcuts to applications.

What I propose is adding a menu item to QEMU's menu called "Map Command key to ALT". This would allow a user to be able to send Macintosh applications command key shortcuts from both a PC and Mac keyboard.

I welcome any and all ideas to solve this problem.

Quoted 7 lines
Quoted 3 lines

This is the wrong mailing list for this. Your proposal would touch non-PPC code in QEMU, so this needs to go to qemu-devel.

Keep in mind that the same thing arises with x86 Mac OS X running in QEMU.

When I VNC into a Mac I find that the "Windows key" becomes the Command key. And the same probably happens when you plug a non-Apple USB keyboard into a Mac.

I was thinking about the Windows key. It would be the perfect substitute - if it was available on all keyboards.

Quoted 5 lines

If you are using a keyboard with a "Windows key" then that would be the most natural option. If you don't have that key then you really need to map something else...

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Stefan

Maybe there should be two menu items:
"Map command key to ALT" and "Map command key to Windows key". They would be mutually exclusive of course.

Isn't the Windows key already the same thing as the Command key, in terms of the actual keycode generated?

I don't think so. The command key is equal to 0x37. The windows key is equal to 0x5B. This is my source: http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx

Quoted 1 line

And you'd still want to have an actual ALT key available... The option should just be whether to swap the Command/Windows and ALT keys for better ergonomics.

That might not be true. The user might not mind giving up the alt or control keys. The options and control key are not used very much on Mac OS X.

I also want to state that I decided against the adding menu items idea. Instead I am currently planning to use a command line option. You just pass the key value you want to use to act as the command key. Here's an example:

qemu-system-ppc -command-key 0x37.

The user could pick one of the functions keys as the command key if desired.

#6 lore raw
Quoted 1 line · Programmingkid

I don't think so. The command key is equal to 0x37. The windows key is equal to 0x5B. This is my source:http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx

Err, no.

USB keyboards generate standard codes for keypresses, regardless of whether they are labeled "windows" or "command" (or "meta"). It's a major pain in the ass that vendors sell keyboards with completely different markings and absolutely no difference in the codes they generate. Sun keyboards produced a byte saying what markings were on the keyboard so we could set up the right tables, but standard USB keyboards don't. So we have to ask - one of the few conventions is that the numbers 0-9 are fixed, so we can at least ask for a number to be typed.

In any case, about the Command/Windows/Meta key:

http://en.wikipedia.org/wiki/Command_key#On_other_keyboards

"On a keyboard made with MS Windows logo, the Windows key is mapped to act as the Command key"

#7 lore raw
Quoted 5 lines · Tarl Neustaedter
Quoted 1 line · Programmingkid

I don't think so. The command key is equal to 0x37. The windows key is equal to 0x5B. This is my source:http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx

Err, no.

Quoted 7 lines

USB keyboards generate standard codes for keypresses, regardless of whether they are labeled "windows" or "command" (or "meta"). It's a major pain in the ass that vendors sell keyboards with completely different markings and absolutely no difference in the codes they generate. Sun keyboards produced a byte saying what markings were on the keyboard so we could set up the right tables, but standard USB keyboards don't. So we have to ask - one of the few conventions is that the numbers 0-9 are fixed, so we can at least ask for a number to be typed.

In any case, about the Command/Windows/Meta key:

http://en.wikipedia.org/wiki/Command_key#On_other_keyboards

"On a keyboard made with MS Windows logo, the Windows key is mapped to act as the Command key"

This information is good to hear. Those with a Windows key on their keyboard shouldn't have a problem using it as the command key. Those who don't have a Windows key can use the -command-key option to set it to any key they want.

The only problem I have now is how to send more than one key value at a time to the guest OS. Any ideas would be great.

#8 lore raw
In reply to Programmingkid
Quoted 41 lines · Programmingkid
Quoted 3 lines · Scott Wood
Quoted 2 lines · Programmingkid
Quoted 1 line · Stefan Hajnoczi

On Thu, Jul 4, 2013 at 4:45 PM, Alexander Graf <[email protected]>

Quoted 4 lines · wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines · Programmingkid
Quoted 2 lines

We have made a lot of progress in the last month with making

Mac OS X run in QEMU. A lot of people are to thank for this milestone. To everyone involved, thank you.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

There is one thing that we have to figure out. That is the

command key issue. This key is a very important on the Macintosh. It is used to send keyboard shortcuts to applications.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

What I propose is adding a menu item to QEMU's menu called

"Map Command key to ALT". This would allow a user to be able to send Macintosh applications command key shortcuts from both a PC and Mac keyboard.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

I welcome any and all ideas to solve this problem.

This is the wrong mailing list for this. Your proposal would

touch non-PPC code in QEMU, so this needs to go to qemu-devel.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Keep in mind that the same thing arises with x86 Mac OS X

running in QEMU.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

When I VNC into a Mac I find that the "Windows key" becomes the Command key. And the same probably happens when you plug a

non-Apple

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

USB keyboard into a Mac.

I was thinking about the Windows key. It would be the perfect

substitute - if it was available on all keyboards.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

If you are using a keyboard with a "Windows key" then that would

be

Quoted 1 line
Quoted 1 line
Quoted 1 line

the most natural option. If you don't have that key then you

really

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

need to map something else...

Stefan

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Maybe there should be two menu items:
"Map command key to ALT" and "Map command key to Windows key". They would be mutually exclusive of course.

Isn't the Windows key already the same thing as the Command key, in

terms of the actual keycode generated?

I don't think so. The command key is equal to 0x37. The windows key is equal to 0x5B. This is my source: http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx

That says 0x37 is the 7 key. The word "command" does not appear.

It also looks like that table for something that Windows produces, not the raw output of the keyboard.

Quoted 4 lines
Quoted 1 line

And you'd still want to have an actual ALT key available... The

option should just be whether to swap the Command/Windows and ALT keys for better ergonomics.

That might not be true. The user might not mind giving up the alt or control keys. The options and control key are not used very much on Mac OS X.

I assume you mean "The alt and control key are not used very much...".

Maybe the user doesn't mind -- but maybe they do mind and would rather swap the two than end up with both ALT and the OS key being Command. When I used MacOS X I use control and alt quite a bit, in console and X11 apps.

Quoted 5 lines

I also want to state that I decided against the adding menu items idea. Instead I am currently planning to use a command line option. You just pass the key value you want to use to act as the command key. Here's an example:

qemu-system-ppc -command-key 0x37.

The user could pick one of the functions keys as the command key if desired.

If you're going to get into remapping keys, wouldn't it be better to have a generalized mechanism so the user could do whatever remaps they want? Other targets may have their own special keys.

-Scott

#9 lore raw
Quoted 30 lines · Scott Wood
Quoted 29 lines · Programmingkid
Quoted 28 lines · Scott Wood
Quoted 27 lines · Programmingkid
Quoted 12 lines · Stefan Hajnoczi
Quoted 11 lines · Alexander Graf
Quoted 7 lines · Programmingkid

We have made a lot of progress in the last month with making Mac OS X run in QEMU. A lot of people are to thank for this milestone. To everyone involved, thank you.

There is one thing that we have to figure out. That is the command key issue. This key is a very important on the Macintosh. It is used to send keyboard shortcuts to applications.

What I propose is adding a menu item to QEMU's menu called "Map Command key to ALT". This would allow a user to be able to send Macintosh applications command key shortcuts from both a PC and Mac keyboard.

I welcome any and all ideas to solve this problem.

Quoted 7 lines
Quoted 3 lines

This is the wrong mailing list for this. Your proposal would touch non-PPC code in QEMU, so this needs to go to qemu-devel.

Keep in mind that the same thing arises with x86 Mac OS X running in QEMU.

When I VNC into a Mac I find that the "Windows key" becomes the Command key. And the same probably happens when you plug a non-Apple USB keyboard into a Mac.

I was thinking about the Windows key. It would be the perfect substitute - if it was available on all keyboards.

Quoted 6 lines

If you are using a keyboard with a "Windows key" then that would be the most natural option. If you don't have that key then you really need to map something else...

Stefan

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

Maybe there should be two menu items:
"Map command key to ALT" and "Map command key to Windows key". They would be mutually exclusive of course.

Isn't the Windows key already the same thing as the Command key, in terms of the actual keycode generated?

I don't think so. The command key is equal to 0x37. The windows key is equal to 0x5B. This is my source: http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx

That says 0x37 is the 7 key. The word "command" does not appear.

Sorry, but this is my source for a Mac keyboard:
http://boredzo.org/blog/wp-content/uploads/2007/05/imtx-virtual-keycodes.png.

The values you see on the keys are in decimal. 55 in base 10 is equal to 37 in base 16.

Quoted 2 lines

It also looks like that table for something that Windows produces, not the raw output of the keyboard.

That could be the case.

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

And you'd still want to have an actual ALT key available... The option should just be whether to swap the Command/Windows and ALT keys for better ergonomics.

That might not be true. The user might not mind giving up the alt or control keys. The options and control key are not used very much on Mac OS X.

I assume you mean "The alt and control key are not used very much...".

Maybe the user doesn't mind -- but maybe they do mind and would rather swap the two than end up with both ALT and the OS key being Command. When I used MacOS X I use control and alt quite a bit, in console and X11 apps.

That's not a problem. The user would be free to decide which key acts as the command key. A function key could be used. The alt and control key can be left alone.

Quoted 8 lines
Quoted 4 lines

I also want to state that I decided against the adding menu items idea. Instead I am currently planning to use a command line option. You just pass the key value you want to use to act as the command key. Here's an example:
qemu-system-ppc -command-key 0x37.
The user could pick one of the functions keys as the command key if desired.

If you're going to get into remapping keys, wouldn't it be better to have a generalized mechanism so the user could do whatever remaps they want? Other targets may have their own special keys.

-Scott

That does sound like a good idea. There would be a lot of things we would have to consider and agree upon. This is what I think you want, a command line option that specifies a key what it maps to. Example:

qemu-system-ppc -a-key 0x0 -b-key 0x11 ...

Basically you specify a key, then state the raw keyboard value for it. Is that what you mean by generalized mechanism? This way could work, but I think using a file might be better.

Example:

file: keyboard-layout.txt
a 0x0
b 0x11
c 0x8
command 0x37
option 0x3A
control 0x3B
....

qemu-system-ppc -keyboard-layout-file ./keyboard-layout.txt

There is one issue that still bothers me. Should we assume an ascii keyboard is attached to the QEMU emulated machine? We might want to consider unicode in the future. Not every user speaks english. Are there any non-native english users who would like to see unicode support in QEMU?

#10 lore raw
Quoted 51 lines · Programmingkid
Quoted 5 lines · Scott Wood
Quoted 4 lines · Programmingkid
Quoted 3 lines · Scott Wood
Quoted 2 lines · Programmingkid
Quoted 1 line · Stefan Hajnoczi

On Thu, Jul 4, 2013 at 4:45 PM, Alexander Graf

Quoted 4 lines · <[email protected]> wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines · Programmingkid
Quoted 2 lines

We have made a lot of progress in the last month with

making Mac OS X run in QEMU. A lot of people are to thank for this milestone. To everyone involved, thank you.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

There is one thing that we have to figure out. That is the

command key issue. This key is a very important on the Macintosh. It is used to send keyboard shortcuts to applications.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

What I propose is adding a menu item to QEMU's menu called

"Map Command key to ALT". This would allow a user to be able to send Macintosh applications command key shortcuts from both a PC and Mac keyboard.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

I welcome any and all ideas to solve this problem.

This is the wrong mailing list for this. Your proposal would

touch non-PPC code in QEMU, so this needs to go to qemu-devel.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Keep in mind that the same thing arises with x86 Mac OS X

running in QEMU.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

When I VNC into a Mac I find that the "Windows key" becomes

the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Command key. And the same probably happens when you plug a

non-Apple

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line

USB keyboard into a Mac.

I was thinking about the Windows key. It would be the perfect

substitute - if it was available on all keyboards.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

If you are using a keyboard with a "Windows key" then that

would be

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

the most natural option. If you don't have that key then you

really

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

need to map something else...

Stefan

Maybe there should be two menu items:
"Map command key to ALT" and "Map command key to Windows key". They would be mutually exclusive of course.

Isn't the Windows key already the same thing as the Command key,

in terms of the actual keycode generated?

Quoted 1 line
Quoted 1 line

I don't think so. The command key is equal to 0x37. The windows

Quoted 8 lines

key is equal to 0x5B. This is my source: http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx

Quoted 2 lines

That says 0x37 is the 7 key. The word "command" does not appear.

Sorry, but this is my source for a Mac keyboard:
http://boredzo.org/blog/wp-content/uploads/2007/05/imtx-virtual-keycodes.png.

The values you see on the keys are in decimal. 55 in base 10 is equal to 37 in base 16.

You're comparing apples to oranges. Both of those are "virtual keycodes" defined by some OS. Note that all the other keys are different as well between the two.

Quoted 7 lines
Quoted 1 line

I assume you mean "The alt and control key are not used very

much...".

Quoted 2 lines

Maybe the user doesn't mind -- but maybe they do mind and would

rather swap the two than end up with both ALT and the OS key being Command. When I used MacOS X I use control and alt quite a bit, in console and X11 apps.

That's not a problem. The user would be free to decide which key acts as the command key. A function key could be used. The alt and control key can be left alone.

If I want to use the alt key as the command key, then with your proposal, how would I get the OS key to act as the alt key?

Quoted 20 lines
Quoted 1 line
Quoted 1 line

I also want to state that I decided against the adding menu items

idea. Instead I am currently planning to use a command line option. You just pass the key value you want to use to act as the command key. Here's an example:

Quoted 2 lines
Quoted 2 lines

qemu-system-ppc -command-key 0x37.
The user could pick one of the functions keys as the command key

if desired.

Quoted 2 lines

If you're going to get into remapping keys, wouldn't it be better

to have a generalized mechanism so the user could do whatever remaps they want? Other targets may have their own special keys.

Quoted 2 lines

-Scott

That does sound like a good idea. There would be a lot of things we would have to consider and agree upon. This is what I think you want, a command line option that specifies a key what it maps to. Example:

qemu-system-ppc -a-key 0x0 -b-key 0x11 ...

Basically you specify a key, then state the raw keyboard value for it. Is that what you mean by generalized mechanism? This way could work, but I think using a file might be better.

Example:

Quoted 8 lines

file: keyboard-layout.txt
a 0x0
b 0x11
c 0x8
command 0x37
option 0x3A
control 0x3B
....

Yes, something like that. It would be nice if existing infrastructure could be used, such as using X11 keycodes (or whatever else is native to the host) rather than making up a new namespace for keys.

Quoted 3 lines

qemu-system-ppc -keyboard-layout-file ./keyboard-layout.txt

There is one issue that still bothers me. Should we assume an ascii keyboard is attached to the QEMU emulated machine? We might want to consider unicode in the future. Not every user speaks english. Are there any non-native english users who would like to see unicode support in QEMU?

Keyboards don't generally speak ASCII (or Unicode). They produce keycodes, which are generally translated into some sort of event by the host's input layer (e.g. the X server). It's up to the guest software to translate those keycodes into either ASCII or Unicode (or whatever else it wants).

-Scott

#11 lore raw
Quoted 44 lines · Scott Wood
Quoted 35 lines · Programmingkid
Quoted 34 lines · Scott Wood
Quoted 33 lines · Programmingkid
Quoted 32 lines · Scott Wood
Quoted 30 lines · Programmingkid
Quoted 12 lines · Stefan Hajnoczi
Quoted 11 lines · Alexander Graf
Quoted 7 lines · Programmingkid

We have made a lot of progress in the last month with making Mac OS X run in QEMU. A lot of people are to thank for this milestone. To everyone involved, thank you.

There is one thing that we have to figure out. That is the command key issue. This key is a very important on the Macintosh. It is used to send keyboard shortcuts to applications.

What I propose is adding a menu item to QEMU's menu called "Map Command key to ALT". This would allow a user to be able to send Macintosh applications command key shortcuts from both a PC and Mac keyboard.

I welcome any and all ideas to solve this problem.

Quoted 7 lines
Quoted 3 lines

This is the wrong mailing list for this. Your proposal would touch non-PPC code in QEMU, so this needs to go to qemu-devel.

Keep in mind that the same thing arises with x86 Mac OS X running in QEMU.

When I VNC into a Mac I find that the "Windows key" becomes the Command key. And the same probably happens when you plug a non-Apple USB keyboard into a Mac.

I was thinking about the Windows key. It would be the perfect substitute - if it was available on all keyboards.

Quoted 6 lines

If you are using a keyboard with a "Windows key" then that would be the most natural option. If you don't have that key then you really need to map something else...

Stefan

Maybe there should be two menu items:
"Map command key to ALT" and "Map command key to Windows key". They would be mutually exclusive of course.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Quoted 1 line

Isn't the Windows key already the same thing as the Command key, in terms of the actual keycode generated?

I don't think so. The command key is equal to 0x37. The windows key is equal to 0x5B. This is my source: http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx

That says 0x37 is the 7 key. The word "command" does not appear.

Sorry, but this is my source for a Mac keyboard:
http://boredzo.org/blog/wp-content/uploads/2007/05/imtx-virtual-keycodes.png.
The values you see on the keys are in decimal. 55 in base 10 is equal to 37 in base 16.

Quoted 8 lines

You're comparing apples to oranges. Both of those are "virtual keycodes" defined by some OS. Note that all the other keys are different as well between the two.

Quoted 4 lines
Quoted 3 lines

I assume you mean "The alt and control key are not used very much...".

Maybe the user doesn't mind -- but maybe they do mind and would rather swap the two than end up with both ALT and the OS key being Command. When I used MacOS X I use control and alt quite a bit, in console and X11 apps.

That's not a problem. The user would be free to decide which key acts as the command key. A function key could be used. The alt and control key can be left alone.

If I want to use the alt key as the command key, then with your proposal, how would I get the OS key to act as the alt key?

That would involve detecting the key, then looking up what the user wants the key to act as. Then sending that translation to the guest OS. Since most keyboards have duplicate alt, control and command/windows keys, giving up one of them should be ok.

Quoted 22 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

I also want to state that I decided against the adding menu items idea. Instead I am currently planning to use a command line option. You just pass the key value you want to use to act as the command key. Here's an example:
qemu-system-ppc -command-key 0x37.
The user could pick one of the functions keys as the command key if desired.

If you're going to get into remapping keys, wouldn't it be better to have a generalized mechanism so the user could do whatever remaps they want? Other targets may have their own special keys.

-Scott

Quoted 13 lines

That does sound like a good idea. There would be a lot of things we would have to consider and agree upon. This is what I think you want, a command line option that specifies a key what it maps to. Example:
qemu-system-ppc -a-key 0x0 -b-key 0x11 ...
Basically you specify a key, then state the raw keyboard value for it. Is that what you mean by generalized mechanism? This way could work, but I think using a file might be better. Example:
file: keyboard-layout.txt
a 0x0
b 0x11
c 0x8
command 0x37
option 0x3A
control 0x3B
....

Quoted 1 line

Yes, something like that. It would be nice if existing infrastructure could be used, such as using X11 keycodes (or whatever else is native to the host) rather than making up a new namespace for keys.

Do you have any documentation that should be used as a reference?

Quoted 5 lines
Quoted 3 lines

qemu-system-ppc -keyboard-layout-file ./keyboard-layout.txt
There is one issue that still bothers me. Should we assume an ascii keyboard is attached to the QEMU emulated machine? We might want to consider unicode in the future. Not every user speaks english. Are there any non-native english users who would like to see unicode support in QEMU?

Keyboards don't generally speak ASCII (or Unicode). They produce keycodes, which are generally translated into some sort of event by the host's input layer (e.g. the X server). It's up to the guest software to translate those keycodes into either ASCII or Unicode (or whatever else it wants).

Thanks for this info. The ascii system does work on a PC environment. The Mac adds a command key that isn't a part of the ascii standard. We can't just add an offset to a letter character and send it to the guest OS like the alt or control keys. Since QEMU appears to use a serial console as its input, trying to tell the guest OS that the command key is down is going to be challenging. I'm hoping it won't require a rewrite of QEMU's input system. Anybody have any ideas on how to send the guest OS the command key and another letter key at the same time?

#12 lore raw
Quoted 6 lines · Programmingkid
Quoted 3 lines · Scott Wood
Quoted 2 lines · Programmingkid
Quoted 1 line · Scott Wood

Maybe the user doesn't mind -- but maybe they do mind and would

Quoted 8 lines

rather swap the two than end up with both ALT and the OS key being Command. When I used MacOS X I use control and alt quite a bit, in console and X11 apps.

Quoted 1 line
Quoted 1 line

That's not a problem. The user would be free to decide which key

acts as the command key. A function key could be used. The alt and control key can be left alone.

Quoted 2 lines

If I want to use the alt key as the command key, then with your

proposal, how would I get the OS key to act as the alt key?

That would involve detecting the key, then looking up what the user wants the key to act as. Then sending that translation to the guest OS. Since most keyboards have duplicate alt, control and command/windows keys, giving up one of them should be ok.

Just because you'd be happy with it doesn't mean others would.

Quoted 4 lines
Quoted 1 line

Yes, something like that. It would be nice if existing

infrastructure could be used, such as using X11 keycodes (or whatever else is native to the host) rather than making up a new namespace for keys.

Do you have any documentation that should be used as a reference?

No, sorry.

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

qemu-system-ppc -keyboard-layout-file ./keyboard-layout.txt There is one issue that still bothers me. Should we assume an

ascii keyboard is attached to the QEMU emulated machine? We might want to consider unicode in the future. Not every user speaks english. Are there any non-native english users who would like to see unicode support in QEMU?

Quoted 2 lines

Keyboards don't generally speak ASCII (or Unicode). They produce

keycodes, which are generally translated into some sort of event by the host's input layer (e.g. the X server). It's up to the guest software to translate those keycodes into either ASCII or Unicode (or whatever else it wants).

Thanks for this info. The ascii system does work on a PC environment. The Mac adds a command key that isn't a part of the ascii standard.

No, it's the same on PCs. There's no ASCII code for Shift (except in combination with certain keys), Control (except in combination with certain keys), Alt, Windows, Menu, Arrows, NumLock, PrintScreen, Insert, volume keys, etc. Some of those things may have escape sequences that are encodable in ASCII (not actually part of the ASCII standard), but those are generated by the OS, not the hardware.

Quoted 1 line

We can't just add an offset to a letter character and send it to the guest OS like the alt or control keys.

Again, it's the guest that does that.

Quoted 1 line

Since QEMU appears to use a serial console as its input,

Hmm? You *can* do that, but you don't have to.

Quoted 1 line

trying to tell the guest OS that the command key is down is going to be challenging.

No different than connecting to a real Mac via a USB serial port, or via ssh. Command line programs don't use the command key.

If you're using graphics in the guest, then QEMU should be emulating a real keyboard as well.

Quoted 1 line

I'm hoping it won't require a rewrite of QEMU's input system. Anybody have any ideas on how to send the guest OS the command key and another letter key at the same time?

It never happens at the same exact time, at least as reported by the keyboard. Whichever one happens first gets sent first, and there's a separate notification when a key is released.

-Scott

#13 lore raw
In reply to Programmingkid
Quoted 5 lines · Programmingkid
Quoted 1 line · Scott Wood

Keyboards don't generally speak ASCII (or Unicode). They produce keycodes, which are generally translated into some sort of event by the host's input layer (e.g. the X server). It's up to the guest software to translate those keycodes into either ASCII or Unicode (or whatever else it wants).

Thanks for this info. The ascii system does work on a PC environment.

This thread is confusing presumably because people are mixing up topics.

The Windows key is the same thing as the Command key. As Scott already mentioned, there is no physical difference between an Apple and PC keyboard except for stickers on the keys. On a PC keyboard, the sticker is a Windows logo. On an Apple keyboard, it's the Command logo.

If the Windows key is not injecting a Command key, it's a bug. This should work just fine with the GTK UI. I have no idea about Cocoa if that's what you're using.

ASCII has nothing to do with keyboards. It's a character encoding.

Regards,

Anthony Liguori

#14 lore raw
Quoted 19 lines · Anthony Liguori
Quoted 5 lines · Programmingkid
Quoted 1 line · Scott Wood

Keyboards don't generally speak ASCII (or Unicode). They produce keycodes, which are generally translated into some sort of event by the host's input layer (e.g. the X server). It's up to the guest software to translate those keycodes into either ASCII or Unicode (or whatever else it wants).

Thanks for this info. The ascii system does work on a PC environment.

This thread is confusing presumably because people are mixing up topics.

The Windows key is the same thing as the Command key. As Scott already mentioned, there is no physical difference between an Apple and PC keyboard except for stickers on the keys. On a PC keyboard, the sticker is a Windows logo. On an Apple keyboard, it's the Command logo.

If the Windows key is not injecting a Command key, it's a bug. This should work just fine with the GTK UI. I have no idea about Cocoa if that's what you're using.

Quoted 5 lines

ASCII has nothing to do with keyboards. It's a character encoding.

Regards,

Anthony Liguori

Thank you very much for the insight. Yes, I am using the --enable-cocoa option. It does not send the guest OS the command key. It needs a lot of work.

#15 lore raw
In reply to Programmingkid

Am 10.07.2013 um 21:54 schrieb Programmingkid <[email protected]>:

Quoted 84 lines · Scott Wood
Quoted 31 lines · Programmingkid
Quoted 29 lines · Scott Wood
Quoted 28 lines · Programmingkid
Quoted 27 lines · Stefan Hajnoczi
Quoted 12 lines · Alexander Graf
Quoted 11 lines · Programmingkid
Quoted 8 lines

We have made a lot of progress in the last month with making Mac OS X run in QEMU. A lot of people are to thank for this milestone. To everyone involved, thank you.

There is one thing that we have to figure out. That is the command key issue. This key is a very important on the Macintosh. It is used to send keyboard shortcuts to applications.

What I propose is adding a menu item to QEMU's menu called "Map Command key to ALT". This would allow a user to be able to send Macintosh applications command key shortcuts from both a PC and Mac keyboard.

I welcome any and all ideas to solve this problem.

Quoted 7 lines
Quoted 3 lines

This is the wrong mailing list for this. Your proposal would touch non-PPC code in QEMU, so this needs to go to qemu-devel.

Keep in mind that the same thing arises with x86 Mac OS X running in QEMU.

When I VNC into a Mac I find that the "Windows key" becomes the Command key. And the same probably happens when you plug a non-Apple USB keyboard into a Mac.

I was thinking about the Windows key. It would be the perfect substitute - if it was available on all keyboards.

Quoted 6 lines

If you are using a keyboard with a "Windows key" then that would be the most natural option. If you don't have that key then you really need to map something else...

Stefan

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

Maybe there should be two menu items:
"Map command key to ALT" and "Map command key to Windows key". They would be mutually exclusive of course.

Isn't the Windows key already the same thing as the Command key, in terms of the actual keycode generated?

I don't think so. The command key is equal to 0x37. The windows key is equal to 0x5B. This is my source: http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx

That says 0x37 is the 7 key. The word "command" does not appear.

Sorry, but this is my source for a Mac keyboard:
http://boredzo.org/blog/wp-content/uploads/2007/05/imtx-virtual-keycodes.png.

The values you see on the keys are in decimal. 55 in base 10 is equal to 37 in base 16.

Quoted 2 lines

It also looks like that table for something that Windows produces, not the raw output of the keyboard.

That could be the case.

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

And you'd still want to have an actual ALT key available... The option should just be whether to swap the Command/Windows and ALT keys for better ergonomics.

That might not be true. The user might not mind giving up the alt or control keys. The options and control key are not used very much on Mac OS X.

I assume you mean "The alt and control key are not used very much...".

Maybe the user doesn't mind -- but maybe they do mind and would rather swap the two than end up with both ALT and the OS key being Command. When I used MacOS X I use control and alt quite a bit, in console and X11 apps.

That's not a problem. The user would be free to decide which key acts as the command key. A function key could be used. The alt and control key can be left alone.

Quoted 8 lines
Quoted 4 lines

I also want to state that I decided against the adding menu items idea. Instead I am currently planning to use a command line option. You just pass the key value you want to use to act as the command key. Here's an example:
qemu-system-ppc -command-key 0x37.
The user could pick one of the functions keys as the command key if desired.

If you're going to get into remapping keys, wouldn't it be better to have a generalized mechanism so the user could do whatever remaps they want? Other targets may have their own special keys.

-Scott

That does sound like a good idea. There would be a lot of things we would have to consider and agree upon. This is what I think you want, a command line option that specifies a key what it maps to. Example:

qemu-system-ppc -a-key 0x0 -b-key 0x11 ...

Basically you specify a key, then state the raw keyboard value for it. Is that what you mean by generalized mechanism? This way could work, but I think using a file might be better.

Example:

file: keyboard-layout.txt

a            0x0
b            0x11
c            0x8
Quoted 6 lines

command 0x37
option 0x3A
control 0x3B
....

qemu-system-ppc -keyboard-layout-file ./keyboard-layout.txt

That's exactly what -k does today already, no?

Alex

Quoted 4 lines

There is one issue that still bothers me. Should we assume an ascii keyboard is attached to the QEMU emulated machine? We might want to consider unicode in the future. Not every user speaks english. Are there any non-native english users who would like to see unicode support in QEMU?

#16 lore raw
Quoted 5 lines · Alexander Graf

Am 10.07.2013 um 21:54 schrieb Programmingkid <[email protected]>:

Quoted 1 line

qemu-system-ppc -keyboard-layout-file ./keyboard-layout.txt

That's exactly what -k does today already, no?

No. What we send to the guest is a scancode. This literally corresponds to "row 4, column 5". With a good VNC client (like gtk-vnc), the native GTK UI, or SDL, we're able to read these scan codes directly from the keyboard and pass them to the guest.

So as long as you're using one of the above, you never have to think about "-k".

However, a crappy VNC client (like realvnc) can only send symbolic key symbols. Literally "the D key". However, QEMU has no idea what the stickers are your physical keyboard. So you have to tell it what the symbolic key => scancode mapping is via the "-k" option.

Of course, we default to en-us which covers a lot of people.

Now, if for some goofy reason, you wanted to have rules that did:

map "row 4, column 5" => "row 6, column 9"

We would need a new interface for that. But that's not something QEMU should do IMHO. I suspect this thread started because the OP is using a crappy VNC client or a builtin UI that cannot pass through scan codes.

Regards,

Anthony Liguori

Quoted 2 lines

Alex

#17 lore raw
In reply to Alexander Graf
Quoted 9 lines · Alexander Graf
Quoted 6 lines · Programmingkid

We have made a lot of progress in the last month with making Mac OS X run in QEMU. A lot of people are to thank for this milestone. To everyone involved, thank you.

There is one thing that we have to figure out. That is the command key issue. This key is a very important on the Macintosh. It is used to send keyboard shortcuts to applications.

What I propose is adding a menu item to QEMU's menu called "Map Command key to ALT". This would allow a user to be able to send Macintosh applications command key shortcuts from both a PC and Mac keyboard.

Quoted 8 lines
Quoted 1 line

I welcome any and all ideas to solve this problem.

This is the wrong mailing list for this. Your proposal would touch non-PPC code in QEMU, so this needs to go to qemu-devel.

Keep in mind that the same thing arises with x86 Mac OS X running in QEMU.

Alex

I completely forgot about x86 Mac OS X running in QEMU. I didn't know it even worked. We definitely have a lot of consider.