Add more function keys to QEMU
PATCH v2 1/2 Add more function keys to QEMU
There are now keyboards that have 19 function keys. This patch extends QEMU so these function keys can be used.
--- qapi-schema.json | 12 +++++++++++- ui/input-keymap.c | 9 +++++++++ 2 files changed, 20 insertions(+), 1 deletion(-)
qapi-schema.json +11 -1
@@ -4862,6 +4862,15 @@ # @ac_refresh: since 2.10 # @ac_bookmarks: since 2.10 # altgr, altgr_r: dropped in 2.10 +# @f16: since 2.11 +# @f17: since 2.11 +# @f18: since 2.11 +# @f19: since 2.11 +# @f20: since 2.11 +# @f21: since 2.11 +# @f22: since 2.11 +# @f23: since 2.11 +# @f24: since 2.11 # # Since: 1.3.0 #
@@ -4888,7 +4897,8 @@ 'audionext', 'audioprev', 'audiostop', 'audioplay', 'audiomute', 'volumeup', 'volumedown', 'mediaselect', 'mail', 'calculator', 'computer', - 'ac_home', 'ac_back', 'ac_forward', 'ac_refresh', 'ac_bookmarks' ] } + 'ac_home', 'ac_back', 'ac_forward', 'ac_refresh', 'ac_bookmarks', + 'f16', 'f17', 'f18', 'f19', 'f20', 'f21', 'f22', 'f23', 'f24'] } ## # @KeyValue:
ui/input-keymap.c +9 -0
@@ -251,6 +251,15 @@ static const int qcode_to_number[] = { [Q_KEY_CODE_F11] = 0x57, [Q_KEY_CODE_F12] = 0x58, + [Q_KEY_CODE_F16] = 0x59, + [Q_KEY_CODE_F17] = 0x5a, + [Q_KEY_CODE_F18] = 0x5b, + [Q_KEY_CODE_F19] = 0x5c, + [Q_KEY_CODE_F20] = 0x5d, + [Q_KEY_CODE_F21] = 0x5e, + [Q_KEY_CODE_F22] = 0x5f, + [Q_KEY_CODE_F23] = 0x60, + [Q_KEY_CODE_F24] = 0x61, [Q_KEY_CODE_PRINT] = 0xb7,
Signature · 1 line
2.7.2
Quoted 29 lines · Programmingkid
There are now keyboards that have 19 function keys. This patch extends QEMU so these function keys can be used.
Signed-off-by John Arbuckle <[email protected]>--- qapi-schema.json | 12 +++++++++++- ui/input-keymap.c | 9 +++++++++ 2 files changed, 20 insertions(+), 1 deletion(-)qapi-schema.json +9
-0@@ -4862,6 +4862,15 @@ # @ac_refresh: since 2.10 # @ac_bookmarks: since 2.10 # altgr, altgr_r: dropped in 2.10 +# @f16: since 2.11 +# @f17: since 2.11 +# @f18: since 2.11 +# @f19: since 2.11 +# @f20: since 2.11 +# @f21: since 2.11 +# @f22: since 2.11 +# @f23: since 2.11 +# @f24: since 2.11 # # Since: 1.3.0 #
qapi-schema.json line 4904
Quoted 9 lines
qapi-schema.json +2
-1@@ -4888,7 +4897,8 @@ 'audionext', 'audioprev', 'audiostop', 'audioplay', 'audiomute', 'volumeup', 'volumedown', 'mediaselect', 'mail', 'calculator', 'computer', - 'ac_home', 'ac_back', 'ac_forward', 'ac_refresh', 'ac_bookmarks' ] } + 'ac_home', 'ac_back', 'ac_forward', 'ac_refresh', 'ac_bookmarks', + 'f16', 'f17', 'f18', 'f19', 'f20', 'f21', 'f22', 'f23', 'f24'] } ## # @KeyValue:
This bit looks fine.
Quoted 7 lines
ui/input-keymap.c +0
-0@@ -251,6 +251,15 @@ static const int qcode_to_number[] = { [Q_KEY_CODE_F11] = 0x57,
ui/input-keymap.c static const int qcode_to_number[] = { · line 262
Quoted 10 lines
ui/input-keymap.c +9
-0[Q_KEY_CODE_F12] = 0x58, + [Q_KEY_CODE_F16] = 0x59, + [Q_KEY_CODE_F17] = 0x5a, + [Q_KEY_CODE_F18] = 0x5b, + [Q_KEY_CODE_F19] = 0x5c, + [Q_KEY_CODE_F20] = 0x5d, + [Q_KEY_CODE_F21] = 0x5e, + [Q_KEY_CODE_F22] = 0x5f, + [Q_KEY_CODE_F23] = 0x60, + [Q_KEY_CODE_F24] = 0x61,
You've got a gap there F13, F14, F15 were all missing (pre-existing bug in QEMU), so you can't carry on just incrementing after F12.
Even if that were not the case, AT set1 scancodes are insane with no logical numbering scheme. So what we actually end up needing is
F13 == 0x5d
F14 == 0x5e
F15 == 0x5f
F16 == 0x55
F17 == 0x83
F18 == 0xf7
F19 == 0x84
F20 == 0x5a
F21 == 0x74
F22 == 0xf9
F23 == 0x6d
F24 == 0x6fRegards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 51 lines · Daniel P. Berrange
Quoted 29 lines · Programmingkid
There are now keyboards that have 19 function keys. This patch extends QEMU so these function keys can be used.
Signed-off-by John Arbuckle <[email protected]>---
qapi-schema.json | 12 +++++++++++-ui/input-keymap.c| 9 +++++++++2 files changed, 20 insertions(+), 1 deletion(-)qapi-schema.json +9
-0@@ -4862,6 +4862,15 @@ # @ac_refresh: since 2.10 # @ac_bookmarks: since 2.10 # altgr, altgr_r: dropped in 2.10 +# @f16: since 2.11 +# @f17: since 2.11 +# @f18: since 2.11 +# @f19: since 2.11 +# @f20: since 2.11 +# @f21: since 2.11 +# @f22: since 2.11 +# @f23: since 2.11 +# @f24: since 2.11 # # Since: 1.3.0 #qapi-schema.json line 4904
Quoted 9 lines
qapi-schema.json +2
-1@@ -4888,7 +4897,8 @@ 'audionext', 'audioprev', 'audiostop', 'audioplay', 'audiomute', 'volumeup', 'volumedown', 'mediaselect', 'mail', 'calculator', 'computer', - 'ac_home', 'ac_back', 'ac_forward', 'ac_refresh', 'ac_bookmarks' ] } + 'ac_home', 'ac_back', 'ac_forward', 'ac_refresh', 'ac_bookmarks', + 'f16', 'f17', 'f18', 'f19', 'f20', 'f21', 'f22', 'f23', 'f24'] } ## # @KeyValue:This bit looks fine.
Quoted 6 lines
ui/input-keymap.c +0
-0@@ -251,6 +251,15 @@ static const int qcode_to_number[] = {
Quoted 14 lines
ui/input-keymap.c static const int qcode_to_number[] = { · line 262
Quoted 11 lines
ui/input-keymap.c +9
-0[Q_KEY_CODE_F11] = 0x57, [Q_KEY_CODE_F12] = 0x58, + [Q_KEY_CODE_F16] = 0x59, + [Q_KEY_CODE_F17] = 0x5a, + [Q_KEY_CODE_F18] = 0x5b, + [Q_KEY_CODE_F19] = 0x5c, + [Q_KEY_CODE_F20] = 0x5d, + [Q_KEY_CODE_F21] = 0x5e, + [Q_KEY_CODE_F22] = 0x5f, + [Q_KEY_CODE_F23] = 0x60, + [Q_KEY_CODE_F24] = 0x61,You've got a gap there F13, F14, F15 were all missing (pre-existing bug in QEMU), so you can't carry on just incrementing after F12.
Actually F13, F14,and F15 are called Q_KEY_CODE_PRINT, Q_KEY_CODE_SCROLL_LOCK, and Q_KEY_CODE_PAUSE respectively.
Quoted 15 lines
Even if that were not the case, AT set1 scancodes are insane with no logical numbering scheme. So what we actually end up needing is
F13 == 0x5d F14 == 0x5e F15 == 0x5f F16 == 0x55 F17 == 0x83 F18 == 0xf7 F19 == 0x84 F20 == 0x5a F21 == 0x74 F22 == 0xf9 F23 == 0x6d F24 == 0x6f
Ok. I can adapt this numbering scheme in my next patch. Thank you for reviewing this patch set.
Quoted 66 lines · Programmingkid
Quoted 51 lines · Daniel P. Berrange
Quoted 29 lines · Programmingkid
There are now keyboards that have 19 function keys. This patch extends QEMU so these function keys can be used.
Signed-off-by John Arbuckle <[email protected]>---
qapi-schema.json | 12 +++++++++++-ui/input-keymap.c| 9 +++++++++2 files changed, 20 insertions(+), 1 deletion(-)qapi-schema.json +9
-0@@ -4862,6 +4862,15 @@ # @ac_refresh: since 2.10 # @ac_bookmarks: since 2.10 # altgr, altgr_r: dropped in 2.10 +# @f16: since 2.11 +# @f17: since 2.11 +# @f18: since 2.11 +# @f19: since 2.11 +# @f20: since 2.11 +# @f21: since 2.11 +# @f22: since 2.11 +# @f23: since 2.11 +# @f24: since 2.11 # # Since: 1.3.0 #qapi-schema.json line 4904
Quoted 9 lines
qapi-schema.json +2
-1@@ -4888,7 +4897,8 @@ 'audionext', 'audioprev', 'audiostop', 'audioplay', 'audiomute', 'volumeup', 'volumedown', 'mediaselect', 'mail', 'calculator', 'computer', - 'ac_home', 'ac_back', 'ac_forward', 'ac_refresh', 'ac_bookmarks' ] } + 'ac_home', 'ac_back', 'ac_forward', 'ac_refresh', 'ac_bookmarks', + 'f16', 'f17', 'f18', 'f19', 'f20', 'f21', 'f22', 'f23', 'f24'] } ## # @KeyValue:This bit looks fine.
Quoted 6 lines
ui/input-keymap.c +0
-0@@ -251,6 +251,15 @@ static const int qcode_to_number[] = {Quoted 14 lines
ui/input-keymap.c static const int qcode_to_number[] = { · line 262
Quoted 11 lines
ui/input-keymap.c +9
-0[Q_KEY_CODE_F11] = 0x57, [Q_KEY_CODE_F12] = 0x58, + [Q_KEY_CODE_F16] = 0x59, + [Q_KEY_CODE_F17] = 0x5a, + [Q_KEY_CODE_F18] = 0x5b, + [Q_KEY_CODE_F19] = 0x5c, + [Q_KEY_CODE_F20] = 0x5d, + [Q_KEY_CODE_F21] = 0x5e, + [Q_KEY_CODE_F22] = 0x5f, + [Q_KEY_CODE_F23] = 0x60, + [Q_KEY_CODE_F24] = 0x61,You've got a gap there F13, F14, F15 were all missing (pre-existing bug in QEMU), so you can't carry on just incrementing after F12.
Quoted 2 lines
Actually F13, F14,and F15 are called
Q_KEY_CODE_PRINT,Q_KEY_CODE_SCROLL_LOCK, andQ_KEY_CODE_PAUSErespectively.
Huh. That's not right. Print/Scroll/Pause are completely separate to F13/14/15
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 70 lines · Daniel P. Berrange
Quoted 66 lines · Programmingkid
Quoted 65 lines · Daniel P. Berrange
Quoted 29 lines · Programmingkid
There are now keyboards that have 19 function keys. This patch extends QEMU so these function keys can be used.
Signed-off-by John Arbuckle <[email protected]>---
qapi-schema.json | 12 +++++++++++-ui/input-keymap.c| 9 +++++++++2 files changed, 20 insertions(+), 1 deletion(-)qapi-schema.json +9
-0@@ -4862,6 +4862,15 @@ # @ac_refresh: since 2.10 # @ac_bookmarks: since 2.10 # altgr, altgr_r: dropped in 2.10 +# @f16: since 2.11 +# @f17: since 2.11 +# @f18: since 2.11 +# @f19: since 2.11 +# @f20: since 2.11 +# @f21: since 2.11 +# @f22: since 2.11 +# @f23: since 2.11 +# @f24: since 2.11 # # Since: 1.3.0 #qapi-schema.json line 4904
Quoted 9 lines
qapi-schema.json +2
-1@@ -4888,7 +4897,8 @@ 'audionext', 'audioprev', 'audiostop', 'audioplay', 'audiomute', 'volumeup', 'volumedown', 'mediaselect', 'mail', 'calculator', 'computer', - 'ac_home', 'ac_back', 'ac_forward', 'ac_refresh', 'ac_bookmarks' ] } + 'ac_home', 'ac_back', 'ac_forward', 'ac_refresh', 'ac_bookmarks', + 'f16', 'f17', 'f18', 'f19', 'f20', 'f21', 'f22', 'f23', 'f24'] } ## # @KeyValue:This bit looks fine.
Quoted 7 lines
ui/input-keymap.c +0
-0@@ -251,6 +251,15 @@ static const int qcode_to_number[] = { [Q_KEY_CODE_F11] = 0x57,ui/input-keymap.c static const int qcode_to_number[] = { · line 262
Quoted 10 lines
ui/input-keymap.c +9
-0[Q_KEY_CODE_F12] = 0x58, + [Q_KEY_CODE_F16] = 0x59, + [Q_KEY_CODE_F17] = 0x5a, + [Q_KEY_CODE_F18] = 0x5b, + [Q_KEY_CODE_F19] = 0x5c, + [Q_KEY_CODE_F20] = 0x5d, + [Q_KEY_CODE_F21] = 0x5e, + [Q_KEY_CODE_F22] = 0x5f, + [Q_KEY_CODE_F23] = 0x60, + [Q_KEY_CODE_F24] = 0x61,You've got a gap there F13, F14, F15 were all missing (pre-existing bug in QEMU), so you can't carry on just incrementing after F12.
Quoted 4 lines
Quoted 2 lines
Actually F13, F14,and F15 are called
Q_KEY_CODE_PRINT,Q_KEY_CODE_SCROLL_LOCK, andQ_KEY_CODE_PAUSErespectively.Huh. That's not right. Print/Scroll/Pause are completely separate to F13/14/15
Actually it is how PC keyboards function keys F13 to F15 are labelled. This picture should help.
The Print Screen, Scroll Lock, and Pause/Break keys correspond to F13, F14, and F15 on this keyboard. It is the same way on older Macintosh keyboards. As for keyboards of other systems there could be a difference. I'm aware of a specific example but I suppose it is possible. I do know with the current mapping of the Print Screen, Scroll Lock, and Pause/Break keys to the F13 to F15 keys Windows, Linux, and Mac OS guests seem to like it.
Did you want separate Q_KEY_CODE_F13, Q_KEY_CODE_F14, and Q_KEY_CODE_F15 constants added to QEMU?
Quoted 77 lines · Programmingkid
Quoted 70 lines · Daniel P. Berrange
Quoted 66 lines · Programmingkid
Quoted 65 lines · Daniel P. Berrange
Quoted 29 lines · Programmingkid
There are now keyboards that have 19 function keys. This patch extends QEMU so these function keys can be used.
Signed-off-by John Arbuckle <[email protected]>---
qapi-schema.json | 12 +++++++++++-ui/input-keymap.c| 9 +++++++++2 files changed, 20 insertions(+), 1 deletion(-)qapi-schema.json +9
-0@@ -4862,6 +4862,15 @@ # @ac_refresh: since 2.10 # @ac_bookmarks: since 2.10 # altgr, altgr_r: dropped in 2.10 +# @f16: since 2.11 +# @f17: since 2.11 +# @f18: since 2.11 +# @f19: since 2.11 +# @f20: since 2.11 +# @f21: since 2.11 +# @f22: since 2.11 +# @f23: since 2.11 +# @f24: since 2.11 # # Since: 1.3.0 #qapi-schema.json line 4904
Quoted 9 lines
qapi-schema.json +2
-1@@ -4888,7 +4897,8 @@ 'audionext', 'audioprev', 'audiostop', 'audioplay', 'audiomute', 'volumeup', 'volumedown', 'mediaselect', 'mail', 'calculator', 'computer', - 'ac_home', 'ac_back', 'ac_forward', 'ac_refresh', 'ac_bookmarks' ] } + 'ac_home', 'ac_back', 'ac_forward', 'ac_refresh', 'ac_bookmarks', + 'f16', 'f17', 'f18', 'f19', 'f20', 'f21', 'f22', 'f23', 'f24'] } ## # @KeyValue:This bit looks fine.
Quoted 7 lines
ui/input-keymap.c +0
-0@@ -251,6 +251,15 @@ static const int qcode_to_number[] = { [Q_KEY_CODE_F11] = 0x57,ui/input-keymap.c static const int qcode_to_number[] = { · line 262
Quoted 10 lines
ui/input-keymap.c +9
-0[Q_KEY_CODE_F12] = 0x58, + [Q_KEY_CODE_F16] = 0x59, + [Q_KEY_CODE_F17] = 0x5a, + [Q_KEY_CODE_F18] = 0x5b, + [Q_KEY_CODE_F19] = 0x5c, + [Q_KEY_CODE_F20] = 0x5d, + [Q_KEY_CODE_F21] = 0x5e, + [Q_KEY_CODE_F22] = 0x5f, + [Q_KEY_CODE_F23] = 0x60, + [Q_KEY_CODE_F24] = 0x61,You've got a gap there F13, F14, F15 were all missing (pre-existing bug in QEMU), so you can't carry on just incrementing after F12.
Quoted 4 lines
Quoted 2 lines
Actually F13, F14,and F15 are called
Q_KEY_CODE_PRINT,Q_KEY_CODE_SCROLL_LOCK, andQ_KEY_CODE_PAUSErespectively.Huh. That's not right. Print/Scroll/Pause are completely separate to F13/14/15
Actually it is how PC keyboards function keys F13 to F15 are labelled. This picture should help.
[snip]
Quoted 6 lines
The Print Screen, Scroll Lock, and Pause/Break keys correspond to F13, F14, and F15 on this keyboard. It is the same way on older Macintosh keyboards. As for keyboards of other systems there could be a difference. I'm aware of a specific example but I suppose it is possible. I do know with the current mapping of the Print Screen, Scroll Lock, and Pause/Break keys to the F13 to F15 keys Windows, Linux, and Mac OS guests seem to like it.
If those keyboards are generating Print/ScrollLock/Pause scancodes when F13/F14/F15 are pressed, then that's simply a case of the key labels diverging from the scancodes, which is not entirely unusual. The key point is that the various key code sets we use, define separate scancodes for F13/F14/F15 vs Print/ScrollLock/Break, so we must match that. It just means that the keyboards you show happen to not generate these particular scan codes, but others will.
Quoted 2 lines
Did you want separate
Q_KEY_CODE_F13,Q_KEY_CODE_F14, andQ_KEY_CODE_F15constants added to QEMU?
Yes.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 99 lines · Daniel P. Berrange
Quoted 77 lines · Programmingkid
Quoted 70 lines · Daniel P. Berrange
Quoted 66 lines · Programmingkid
Quoted 65 lines · Daniel P. Berrange
Quoted 29 lines · Programmingkid
There are now keyboards that have 19 function keys. This patch extends QEMU so these function keys can be used.
Signed-off-by John Arbuckle <[email protected]>---
qapi-schema.json | 12 +++++++++++-ui/input-keymap.c| 9 +++++++++2 files changed, 20 insertions(+), 1 deletion(-)qapi-schema.json +9
-0@@ -4862,6 +4862,15 @@ # @ac_refresh: since 2.10 # @ac_bookmarks: since 2.10 # altgr, altgr_r: dropped in 2.10 +# @f16: since 2.11 +# @f17: since 2.11 +# @f18: since 2.11 +# @f19: since 2.11 +# @f20: since 2.11 +# @f21: since 2.11 +# @f22: since 2.11 +# @f23: since 2.11 +# @f24: since 2.11 # # Since: 1.3.0 #qapi-schema.json line 4904
Quoted 9 lines
qapi-schema.json +2
-1@@ -4888,7 +4897,8 @@ 'audionext', 'audioprev', 'audiostop', 'audioplay', 'audiomute', 'volumeup', 'volumedown', 'mediaselect', 'mail', 'calculator', 'computer', - 'ac_home', 'ac_back', 'ac_forward', 'ac_refresh', 'ac_bookmarks' ] } + 'ac_home', 'ac_back', 'ac_forward', 'ac_refresh', 'ac_bookmarks', + 'f16', 'f17', 'f18', 'f19', 'f20', 'f21', 'f22', 'f23', 'f24'] } ## # @KeyValue:This bit looks fine.
Quoted 7 lines
ui/input-keymap.c +0
-0@@ -251,6 +251,15 @@ static const int qcode_to_number[] = { [Q_KEY_CODE_F11] = 0x57,ui/input-keymap.c static const int qcode_to_number[] = { · line 262
Quoted 10 lines
ui/input-keymap.c +9
-0[Q_KEY_CODE_F12] = 0x58, + [Q_KEY_CODE_F16] = 0x59, + [Q_KEY_CODE_F17] = 0x5a, + [Q_KEY_CODE_F18] = 0x5b, + [Q_KEY_CODE_F19] = 0x5c, + [Q_KEY_CODE_F20] = 0x5d, + [Q_KEY_CODE_F21] = 0x5e, + [Q_KEY_CODE_F22] = 0x5f, + [Q_KEY_CODE_F23] = 0x60, + [Q_KEY_CODE_F24] = 0x61,You've got a gap there F13, F14, F15 were all missing (pre-existing bug in QEMU), so you can't carry on just incrementing after F12.
Quoted 4 lines
Quoted 2 lines
Actually F13, F14,and F15 are called
Q_KEY_CODE_PRINT,Q_KEY_CODE_SCROLL_LOCK, andQ_KEY_CODE_PAUSErespectively.Huh. That's not right. Print/Scroll/Pause are completely separate to F13/14/15
Actually it is how PC keyboards function keys F13 to F15 are labelled. This picture should help.
[snip]
Quoted 6 lines
The Print Screen, Scroll Lock, and Pause/Break keys correspond to F13, F14, and F15 on this keyboard. It is the same way on older Macintosh keyboards. As for keyboards of other systems there could be a difference. I'm aware of a specific example but I suppose it is possible. I do know with the current mapping of the Print Screen, Scroll Lock, and Pause/Break keys to the F13 to F15 keys Windows, Linux, and Mac OS guests seem to like it.
If those keyboards are generating Print/ScrollLock/Pause scancodes when F13/F14/F15 are pressed, then that's simply a case of the key labels diverging from the scancodes, which is not entirely unusual. The key point is that the various key code sets we use, define separate scancodes for F13/F14/F15 vs Print/ScrollLock/Break, so we must match that. It just means that the keyboards you show happen to not generate these particular scan codes, but others will.
Quoted 4 lines
Quoted 2 lines
Did you want separate
Q_KEY_CODE_F13,Q_KEY_CODE_F14, andQ_KEY_CODE_F15constants added to QEMU?Yes.
Ok I will implement this change in its own patch.