[SLOF] [PATCH v2 1/2] Fix function keys on USB
Thomas Huth
thuth at redhat.com
Fri Sep 11 20:27:54 AEST 2015
On 10/09/15 12:55, Dinar valeev wrote:
> From: Dinar Valeev <dvaleev at suse.com>
>
> This is fixing F1-F12 keys in grub2.
>
> Sequence was grabbed by running cat in xterm and pressing relative
> function key.
>
> Signed-off-by: Dinar Valeev <dvaleev at suse.com>
> ---
> lib/libusb/usb-hid.c | 28 ++++++++++++----------------
> 1 file changed, 12 insertions(+), 16 deletions(-)
>
> diff --git a/lib/libusb/usb-hid.c b/lib/libusb/usb-hid.c
> index 9d90006..5d1a4d4 100644
> --- a/lib/libusb/usb-hid.c
> +++ b/lib/libusb/usb-hid.c
> @@ -214,33 +214,29 @@ static void check_key_code(uint8_t *buf)
> case 0x3a: /* F1 */
> write_key(0x1b);
> write_key(0x5b);
> - write_key(0x31);
> - write_key(0x31);
> - write_key(0x7e);
> + write_key(0x4f);
> + write_key(0x50);
> break;
>
> case 0x3b: /* F2 */
> write_key(0x1b);
> write_key(0x5b);
> - write_key(0x31);
> - write_key(0x32);
> - write_key(0x7e);
> + write_key(0x4f);
> + write_key(0x51);
> break;
>
> case 0x3c:
> write_key(0x1b); /* F3 */
> write_key(0x5b);
> - write_key(0x31);
> - write_key(0x33);
> - write_key(0x7e);
> + write_key(0x4f);
> + write_key(0x52);
> break;
>
> case 0x3d:
> write_key(0x1b); /* F4 */
> write_key(0x5b);
> - write_key(0x31);
> - write_key(0x34);
> - write_key(0x7e);
> + write_key(0x4f);
> + write_key(0x53);
> break;
Ok, according to
http://aperiodic.net/phil/archives/Geekery/term-function-keys.html
you now switched from "vt100"-style function keys to "xterm"-style
function keys
... I guess this is ok nowadays, especially considering that grub seems
to expect this variant.
> case 0x3e:
> @@ -278,7 +274,7 @@ static void check_key_code(uint8_t *buf)
> case 0x42:
> write_key(0x1b); /* F9 */
> write_key(0x5b);
> - write_key(0x31);
> + write_key(0x32);
> write_key(0x30);
> write_key(0x7e);
> break;
Ah, now I've also finally understood where this 0x31 came from - it's
simply a copy-n-paste bug from F8 !
> @@ -286,7 +282,7 @@ static void check_key_code(uint8_t *buf)
> case 0x43:
> write_key(0x1b); /* F10 */
> write_key(0x5b);
> - write_key(0x31);
> + write_key(0x32);
> write_key(0x31);
> write_key(0x7e);
> break;
> @@ -294,7 +290,7 @@ static void check_key_code(uint8_t *buf)
> case 0x44:
> write_key(0x1b); /* F11 */
> write_key(0x5b);
> - write_key(0x31);
> + write_key(0x32);
> write_key(0x33);
> write_key(0x7e);
> break;
> @@ -302,7 +298,7 @@ static void check_key_code(uint8_t *buf)
> case 0x45:
> write_key(0x1b); /* F12 */
> write_key(0x5b);
> - write_key(0x31);
> + write_key(0x32);
> write_key(0x34);
> write_key(0x7e);
> break;
Reviewed-by: Thomas Huth <thuth at redhat.com>
More information about the SLOF
mailing list