adb-keys.h: initial commit
PATCH v3 1/4 adb-keys.h: initial commit
This commit implements the adb-keys.h file. It holds information on adb keycode values.
---
Changed name of file from MacKeys.h to adb-keys.h. Changed name of constants from MAC_KEYS_ to ADB_KEYS_.
include/hw/input/adb-keys.h | 160 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 include/hw/input/adb-keys.h
include/hw/input/adb-keys.h new file +160 -0
@@ -0,0 +1,160 @@ +/* +* QEMU System Emulator +* +* Copyright (c) 2003-2008 Fabrice Bellard +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +* THE SOFTWARE. +*/ + +/* +* adb-keys.h +* +* Provides a enum of all the Macintosh keycodes. +* Note: keys like Power, volume related, and eject are handled at a lower +* level and are not available to QEMU. That doesn't mean we can't +* substitute one key for another. The function keys like F1 make a good +* substitute for these keys. This can be done in the GTK, SDL, or Cocoa +* code. +*/ + +#ifndef __ADBKEYS__ +#define __ADBKEYS__ + +enum { +ADB_KEY_A =0 , +ADB_KEY_B =11 , +ADB_KEY_C =8 , +ADB_KEY_D =2 , +ADB_KEY_E =14 , +ADB_KEY_F =3 , +ADB_KEY_G =5 , +ADB_KEY_H =4 , +ADB_KEY_I =34 , +ADB_KEY_J =38 , +ADB_KEY_K =40 , +ADB_KEY_L =37 , +ADB_KEY_M =46 , +ADB_KEY_N =45 , +ADB_KEY_O =31 , +ADB_KEY_P =35 , +ADB_KEY_Q =12 , +ADB_KEY_R =15 , +ADB_KEY_S =1 , +ADB_KEY_T =17 , +ADB_KEY_U =32 , +ADB_KEY_V =9 , +ADB_KEY_W =13 , +ADB_KEY_X =7 , +ADB_KEY_Y =16 , +ADB_KEY_Z =6 , + +ADB_KEY_0 =29 , +ADB_KEY_1 =18 , +ADB_KEY_2 =19 , +ADB_KEY_3 =20 , +ADB_KEY_4 =21 , +ADB_KEY_5 =23 , +ADB_KEY_6 =22 , +ADB_KEY_7 =26 , +ADB_KEY_8 =28 , +ADB_KEY_9 =25 , + +ADB_KEY_GRAVE_ACCENT =50 , +ADB_KEY_MINUS =27 , +ADB_KEY_EQUAL =24 , +ADB_KEY_DELETE =51 , +ADB_KEY_CAPS_LOCK =57 , +ADB_KEY_TAB =48 , +ADB_KEY_RETURN =36 , +ADB_KEY_LEFT_BRACKET =33 , +ADB_KEY_RIGHT_BRACKET =30 , +ADB_KEY_BACKSLASH =42 , +ADB_KEY_SEMICOLON =41 , +ADB_KEY_APOSTROPHE =39 , +ADB_KEY_COMMA =43 , +ADB_KEY_PERIOD =47 , +ADB_KEY_FORWARD_SLASH =44 , +ADB_KEY_LEFT_SHIFT =56 , +ADB_KEY_RIGHT_SHIFT =60 , +ADB_KEY_SPACEBAR =49 , +ADB_KEY_LEFT_CONTROL =59 , +ADB_KEY_RIGHT_CONTROL =62 , +ADB_KEY_LEFT_OPTION =58 , +ADB_KEY_RIGHT_OPTION =61 , +ADB_KEY_LEFT_COMMAND =55 , +ADB_KEY_RIGHT_COMMAND =54 , + +ADB_KEY_KP_0 =82 , +ADB_KEY_KP_1 =83 , +ADB_KEY_KP_2 =84 , +ADB_KEY_KP_3 =85 , +ADB_KEY_KP_4 =86 , +ADB_KEY_KP_5 =87 , +ADB_KEY_KP_6 =88 , +ADB_KEY_KP_7 =89 , +ADB_KEY_KP_8 =91 , +ADB_KEY_KP_9 =92 , +ADB_KEY_KP_PERIOD =65 , +ADB_KEY_KP_ENTER =76 , +ADB_KEY_KP_PLUS =69 , +ADB_KEY_KP_SUBTRACT =78 , +ADB_KEY_KP_MULTIPLY =67 , +ADB_KEY_KP_DIVIDE =75 , +ADB_KEY_KP_EQUAL =81 , +ADB_KEY_KP_CLEAR =71 , + +ADB_KEY_UP =126 , +ADB_KEY_DOWN =125 , +ADB_KEY_LEFT =123 , +ADB_KEY_RIGHT =124 , + +ADB_KEY_HELP =114 , +ADB_KEY_HOME =115 , +ADB_KEY_PAGE_UP =116 , +ADB_KEY_PAGE_DOWN =121 , +ADB_KEY_END =119 , +ADB_KEY_FORWARD_DELETE =117 , + +ADB_KEY_ESC =53 , +ADB_KEY_F1 =122 , +ADB_KEY_F2 =120 , +ADB_KEY_F3 =99 , +ADB_KEY_F4 =118 , +ADB_KEY_F5 =96 , +ADB_KEY_F6 =97 , +ADB_KEY_F7 =98 , +ADB_KEY_F8 =100 , +ADB_KEY_F9 =101 , +ADB_KEY_F10 =109 , +ADB_KEY_F11 =103 , +ADB_KEY_F12 =111 , +ADB_KEY_F13 =105 , +ADB_KEY_F14 =107 , +ADB_KEY_F15 =113 , + +ADB_KEY_VOLUME_UP =72 , +ADB_KEY_VOLUME_DOWN =73 , +ADB_KEY_VOLUME_MUTE =74 , +ADB_KEY_POWER =32639 , +}; + +/* Could not find the value for this key. */ +/* #define ADB_KEY_EJECT */ + +#endif /* __ADBKEYS__ */
Signature · 1 line
2.7.2
Quoted 11 lines · Programmingkid
This commit implements the
adb-keys.hfile. It holds information on adb keycode values.Signed-off-by John Arbuckle <[email protected]>---
Changed name of file fromMacKeys.htoadb-keys.h. Changed name of constants fromMAC_KEYS_toADB_KEYS_.include/hw/input/adb-keys.h | 160 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 include/hw/input/adb-keys.h
Thanks; you're getting closer at decent submission style. Your threading is still broken, though (the mail is missing an 'In-Reply-To:' header that refers to <[email protected]> from the 0/4 cover letter); you can see this in the list archives:
https://lists.gnu.org/archive/html/qemu-devel/2016-03/threads.html#01180
Note how your messages each appear as top-level threads, while most other series are properly threaded.
include/hw/input/adb-keys.h line 4
Quoted 11 lines
include/hw/input/adb-keys.h new file +4
-0@@ -0,0 +1,160 @@ +/* +* QEMU System Emulator +* +* Copyright (c) 2003-2008 Fabrice Bellard
Fabrice did not write this file. You're probably better off replacing this line wholesale with a Copyright 2016 and claiming copyright yourself, since it is new material from you that is not substantially copied from some existing file.
include/hw/input/adb-keys.h line 11
Quoted 7 lines
include/hw/input/adb-keys.h new file +7
-0+* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions:
Any reason you chose the weaker BSD license instead of the project-default of GPLv2+?
include/hw/input/adb-keys.h line 28
Quoted 4 lines
include/hw/input/adb-keys.h new file +4
-0+/* +* adb-keys.h +* +* Provides a enum of all the Macintosh keycodes.
s/a enum/an enum/
Can you provide a URL to the source document that you used for coming up with this list, so that we can better double-check your work? (Do it as a comment in this file, if you have one)
include/hw/input/adb-keys.h line 37
Quoted 9 lines
include/hw/input/adb-keys.h new file +9
-0+* Note: keys like Power, volume related, and eject are handled at a lower +* level and are not available to QEMU. That doesn't mean we can't +* substitute one key for another. The function keys like F1 make a good +* substitute for these keys. This can be done in the GTK, SDL, or Cocoa +* code. +*/ + +#ifndef __ADBKEYS__ +#define __ADBKEYS__
The name '__ADBKEYS__' is reserved for the compiler's use; you risk a future collision for no good reason. It's fine to use 'ADB_KEYS_H' as your witness, better matching your filename and staying out of reserved namespace.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 13 lines · Eric Blake
Quoted 11 lines · Programmingkid
This commit implements the
adb-keys.hfile. It holds information on adb keycode values.Signed-off-by John Arbuckle <[email protected]>---
Changed name of file fromMacKeys.htoadb-keys.h. Changed name of constants fromMAC_KEYS_toADB_KEYS_.
include/hw/input/adb-keys.h| 160 ++++++++++++++++++++++++++++++++++++++++++++1 file changed, 160 insertions(+)create mode 100644
include/hw/input/adb-keys.h
Quoted 8 lines
Thanks; you're getting closer at decent submission style. Your threading is still broken, though (the mail is missing an 'In-Reply-To:' header that refers to <[email protected]> from the 0/4 cover letter); you can see this in the list archives:
https://lists.gnu.org/archive/html/qemu-devel/2016-03/threads.html#01180Note how your messages each appear as top-level threads, while most other series are properly threaded.
I guess there is still room for improvement. :)
Quoted 17 lines
include/hw/input/adb-keys.h line 4
Quoted 12 lines
include/hw/input/adb-keys.h new file +4
-0@@ -0,0 +1,160 @@ +/* +* QEMU System Emulator +* +* Copyright (c) 2003-2008 Fabrice Bellard Fabrice did not write this file. You're probably better off replacing this line wholesale with a Copyright 2016 and claiming copyright yourself, since it is new material from you that is not substantially copied from some existing file.
Ok.
Quoted 11 lines
include/hw/input/adb-keys.h line 11
Quoted 8 lines
include/hw/input/adb-keys.h new file +7
-0+* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: Any reason you chose the weaker BSD license instead of the project-default of GPLv2+?
I just used the text that was in vl.c. I thought all files in QEMU were using GPLv2.
Quoted 7 lines
include/hw/input/adb-keys.h line 28
Quoted 5 lines
include/hw/input/adb-keys.h new file +4
-0+/* +* adb-keys.h +* +* Provides a enum of all the Macintosh keycodes. s/a enum/an enum/
Good catch.
Quoted 4 lines
Can you provide a URL to the source document that you used for coming up with this list, so that we can better double-check your work? (Do it as a comment in this file, if you have one)
http://stackoverflow.com/questions/3202629/where-can-i-find-a-list-of-mac-virtual-key-codes
Quoted 15 lines
include/hw/input/adb-keys.h line 37
Quoted 10 lines
include/hw/input/adb-keys.h new file +9
-0+* Note: keys like Power, volume related, and eject are handled at a lower +* level and are not available to QEMU. That doesn't mean we can't +* substitute one key for another. The function keys like F1 make a good +* substitute for these keys. This can be done in the GTK, SDL, or Cocoa +* code. +*/ + +#ifndef __ADBKEYS__ +#define __ADBKEYS__The name '
__ADBKEYS__' is reserved for the compiler's use; you risk a future collision for no good reason. It's fine to use 'ADB_KEYS_H' as your witness, better matching your filename and staying out of reserved namespace.
Ok.
Quoted 11 lines · Eric Blake
Quoted 9 lines · Programmingkid
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
Quoted 2 lines
Any reason you chose the weaker BSD license instead of the project-default of GPLv2+?
Could you provide a file name or a link that has the exact text you wish to see in the file?
Quoted 3 lines
Can you provide a URL to the source document that you used for coming up with this list, so that we can better double-check your work? (Do it as a comment in this file, if you have one)
Does this look good:
/*
* adb-keys.h
*
* Provides an enum of all the Macintosh keycodes.
* Note: keys like Power, volume related, and eject are handled at a lower
* level and are not available to QEMU. That doesn't mean we can't * substitute one key for another. The function keys like F1 make a good * substitute for these keys. This can be done in the GTK, SDL, or Cocoa * code.
* Additional information: http://stackoverflow.com/questions/3202629/where-can
* -i-find-a-list-of-mac-virtual-key-codes
*/
Quoted 14 lines · Programmingkid
Quoted 11 lines · Eric Blake
Quoted 9 lines · Programmingkid
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
Quoted 4 lines
Quoted 2 lines
Any reason you chose the weaker BSD license instead of the project-default of GPLv2+?
Could you provide a file name or a link that has the exact text you wish to see in the file?
BSD is just fine, if you have a strong reason for preferring it (it is a weaker license than GPLv2+, which means GPL code can import BSD code, but BSD code can't import GPL code. Personally, I try to avoid the BSD license on my code, because I don't like the fact that it allows companies to make a proprietary fork of my code, while the GPL guarantees that anyone using my code will keep it free. But other people don't like the GPL and intentionally favor BSD for things they write for maximum uptake of their code.)
If you don't have a strong license preference, then there are plenty of GPLv2+ files you can copy from:
$ git grep -l 'GPL, version 2 or' | wc -l 482
Quoted 12 lines
Quoted 4 lines
Can you provide a URL to the source document that you used for coming up with this list, so that we can better double-check your work? (Do it as a comment in this file, if you have one)
Does this look good:
/*
*adb-keys.h
*
* Provides an enum of all the Macintosh keycodes.
* Note: keys like Power, volume related, and eject are handled at a lower
Quoted 6 lines
* level and are not available to QEMU. That doesn't mean we can't * substitute one key for another. The function keys like F1 make a good * substitute for these keys. This can be done in the GTK, SDL, or Cocoa * code.* Additional information: http://stackoverflow.com/questions/3202629/where-can
* -i-find-a-list-of-mac-virtual-key-codes
The URL is line-broken; but still works (since stackoverflow only cares about the 3202629/ prefix). But yes, that sort of information source is useful as a code comment.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 29 lines · Eric Blake
Quoted 14 lines · Programmingkid
Quoted 11 lines · Eric Blake
Quoted 9 lines · Programmingkid
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:Quoted 4 lines
Quoted 2 lines
Any reason you chose the weaker BSD license instead of the project-default of GPLv2+?
Could you provide a file name or a link that has the exact text you wish to see in the file?
BSD is just fine, if you have a strong reason for preferring it (it is a weaker license than GPLv2+, which means GPL code can import BSD code, but BSD code can't import GPL code. Personally, I try to avoid the BSD license on my code, because I don't like the fact that it allows companies to make a proprietary fork of my code, while the GPL guarantees that anyone using my code will keep it free. But other people don't like the GPL and intentionally favor BSD for things they write for maximum uptake of their code.)
Quoted 5 lines
If you don't have a strong license preference, then there are plenty of GPLv2+ files you can copy from:
$ git grep -l 'GPL, version 2 or' | wc -l 482
Rather than place the whole license agreement in the file, could I just say this:
This code is licensed under the GNU GPL v2.
Quoted 18 lines
Quoted 11 lines
Quoted 3 lines
Can you provide a URL to the source document that you used for coming up with this list, so that we can better double-check your work? (Do it as a comment in this file, if you have one)
Does this look good:
/*
*adb-keys.h
*
* Provides an enum of all the Macintosh keycodes.
* Note: keys like Power, volume related, and eject are handled at a lowerQuoted 6 lines
* level and are not available to QEMU. That doesn't mean we can't * substitute one key for another. The function keys like F1 make a good * substitute for these keys. This can be done in the GTK, SDL, or Cocoa * code.* Additional information: http://stackoverflow.com/questions/3202629/where-can
* -i-find-a-list-of-mac-virtual-key-codes
Quoted 3 lines
The URL is line-broken; but still works (since stackoverflow only cares about the 3202629/ prefix). But yes, that sort of information source is useful as a code comment.
I didn't know I could shorten the url like that. I will definitely change the text to this:
*
* Additional information: http://stackoverflow.com/questions/3202629
*
Thanks for this tip.
Quoted 9 lines · Programmingkid
Quoted 5 lines
If you don't have a strong license preference, then there are plenty of GPLv2+ files you can copy from:
$ git grep -l 'GPL, version 2 or' | wc -l 482Rather than place the whole license agreement in the file, could I just say this:
This code is licensed under the GNU GPL v2.
No, because that is GPLv2-only, not GPLv2+. The "or later" clause is an important distinction (it determines whether your code can be copied into a GPLv3+ project), and we've declared that no new files should be GPLv2-only unless they are copied from a pre-existing project (such as the Linux kernel) under that restriction, so that at least the rest of qemu is usable in GPLv3 (even while qemu itself must remain GPLv2).
But if you're asking if you can use the two-liner present in block/null.c (among other places), sure:
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org