Fix function keys sequence on USB
PATCH 1/1 Fix function keys sequence on USB
From: Dinar Valeev <[email protected]>
Original issue is home and end keys are not functional in grub2. Later I've found other inconsistencies in f1-f12 keys.
"Correct sequence" was crabbed by pressing key on cat running in xterm.
Tested with Home, End, F2, Del and F10 keys in grub2
--- lib/libusb/usb-hid.c | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-)
lib/libusb/usb-hid.c +17 -23
@@ -190,33 +190,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 ;case 0x3e :
@@ -254,7 +250,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 ;
@@ -262,7 +258,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 ;
@@ -270,7 +266,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 ;
@@ -278,7 +274,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 ;
@@ -290,36 +286,34 @@ static void check_key_code(uint8_t *buf)case 0x49 :write_key (0x1b );/* INS */ write_key (0x5b ); -write_key (0x31 ); +write_key (0x32 );write_key (0x7e );break ;case 0x4a :write_key (0x1b );/* HOME */ write_key (0x5b ); -write_key (0x32 ); -write_key (0x7e ); +write_key (0x48 );break ;case 0x4b :write_key (0x1b );/* PgUp */ write_key (0x5b ); -write_key (0x33 ); +write_key (0x35 );write_key (0x7e );break ;case 0x4c :write_key (0x1b );/* DEL */ write_key (0x5b ); -write_key (0x34 ); +write_key (0x33 );write_key (0x7e );break ;case 0x4d :write_key (0x1b );/* END */ write_key (0x5b ); -write_key (0x35 ); -write_key (0x7e ); +write_key (0x46 );break ;case 0x4e :
Signature · 1 line
2.1.4
Quoted 3 lines · Dinar valeev
From: Dinar Valeev <[email protected]>
Original issue is home and end keys are not functional in grub2.
"home" works for in grub/ubuntu14 and grub2/fedora21. "end" does not but I am not sure that your patch will fix it,
Quoted 1 line
Later I've found other inconsistencies in f1-f12 keys.
The keys did not work in VGA or in stdio too?
By "stdio" I mean running QEMU like this:
-nographic -vga none -nodefaults \
-chardev stdio,id=id0,signal=off,mux=on \
-device spapr-vty,id=id1,chardev=id0,reg=0x71000100 \
-mon id=id2,chardev=id0,mode=readline
This is how I tried grub and keys, terminal type is "xterm". What do I miss?
Quoted 2 lines
"Correct sequence" was crabbed by pressing key on cat running in xterm.
And the existing codes are for what type of term
Quoted 1 line
Tested with Home, End, F2, Del and F10 keys in grub2
Please add "slof" in the subject so everybody could know what this is about; and module/file name to tell what part it is touching. I did not notice the patch till I saw it on google+ ;) Like:
[PATCH slof] usb-hid: Fix function keys sequence on USB
Or/and put me or Nikunj in cc:
Quoted 130 lines
Signed-off-by Dinar Valeev <[email protected]>--- lib/libusb/usb-hid.c | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-)lib/libusb/usb-hid.c +17
-23@@ -190,33 +190,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 ;case 0x3e :@@ -254,7 +250,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 ;@@ -262,7 +258,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 ;@@ -270,7 +266,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 ;@@ -278,7 +274,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 ;@@ -290,36 +286,34 @@ static void check_key_code(uint8_t *buf)case 0x49 :write_key (0x1b );/* INS */ write_key (0x5b ); -write_key (0x31 ); +write_key (0x32 );write_key (0x7e );break ;case 0x4a :write_key (0x1b );/* HOME */ write_key (0x5b ); -write_key (0x32 ); -write_key (0x7e ); +write_key (0x48 );break ;case 0x4b :write_key (0x1b );/* PgUp */ write_key (0x5b ); -write_key (0x33 ); +write_key (0x35 );write_key (0x7e );break ;case 0x4c :write_key (0x1b );/* DEL */ write_key (0x5b ); -write_key (0x34 ); +write_key (0x33 );write_key (0x7e );break ;case 0x4d :write_key (0x1b );/* END */ write_key (0x5b ); -write_key (0x35 ); -write_key (0x7e ); +write_key (0x46 );break ;case 0x4e :
Signature · 1 line
Alexey
Quoted 6 lines · Alexey Kardashevskiy
Quoted 3 lines · Dinar valeev
From: Dinar Valeev <[email protected]>
Original issue is home and end keys are not functional in grub2.
"home" works for in grub/ubuntu14 and grub2/fedora21. "end" does not but I am not sure that your patch will fix it,
It is easy to test :)
Not sure about 'home'. It's behaviour was acting as ESC in grub menu edit. My intention was to fix 'end' sequence, so the rest was just adjusted.
Quoted 4 lines
Quoted 2 lines
Later I've found other inconsistencies in f1-f12 keys.
The keys did not work in VGA or in stdio too?
In my understanding this happens only on VGA.
Quoted 8 lines
By "stdio" I mean running QEMU like this:
(quoted diff) +0
-4-nographic -vga none -nodefaults \ -chardev stdio,id=id0,signal=off,mux=on \ -device spapr-vty,id=id1,chardev=id0,reg=0x71000100 \ -mon id=id2,chardev=id0,mode=readlineThis is how I tried grub and keys, terminal type is "xterm". What do I miss?
-vga std -vnc :1
Quoted 5 lines
Quoted 3 lines
"Correct sequence" was crabbed by pressing key on cat running in xterm.
And the existing codes are for what type of term
I have no idea what previous sequence was based on.
Quoted 5 lines
Quoted 3 lines
Tested with Home, End, F2, Del and F10 keys in grub2
Please add "slof" in the subject so everybody could know what this is about; and module/file name to tell what part it is touching. I did not notice the patch till I saw it on google+ ;) Like:
Next time I will, thanks for information.
It would be cool to have an information for contributors, describing a procedure.
Quoted 138 lines
[PATCH slof] usb-hid: Fix function keys sequence on USB
Or/and put me or Nikunj in cc:
Quoted 130 lines
Signed-off-by Dinar Valeev <[email protected]>--- lib/libusb/usb-hid.c | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-)lib/libusb/usb-hid.c +17
-23@@ -190,33 +190,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 ;case 0x3e :@@ -254,7 +250,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 ;@@ -262,7 +258,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 ;@@ -270,7 +266,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 ;@@ -278,7 +274,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 ;@@ -290,36 +286,34 @@ static void check_key_code(uint8_t *buf)case 0x49 :write_key (0x1b );/* INS */ write_key (0x5b ); -write_key (0x31 ); +write_key (0x32 );write_key (0x7e );break ;case 0x4a :write_key (0x1b );/* HOME */ write_key (0x5b ); -write_key (0x32 ); -write_key (0x7e ); +write_key (0x48 );break ;case 0x4b :write_key (0x1b );/* PgUp */ write_key (0x5b ); -write_key (0x33 ); +write_key (0x35 );write_key (0x7e );break ;case 0x4c :write_key (0x1b );/* DEL */ write_key (0x5b ); -write_key (0x34 ); +write_key (0x33 );write_key (0x7e );break ;case 0x4d :write_key (0x1b );/* END */ write_key (0x5b ); -write_key (0x35 ); -write_key (0x7e ); +write_key (0x46 );break ;case 0x4e :
Quoted 29 lines · Dinar valeev
From: Dinar Valeev <[email protected]>
Original issue is home and end keys are not functional in grub2. Later I've found other inconsistencies in f1-f12 keys.
"Correct sequence" was crabbed by pressing key on cat running in xterm.
Tested with Home, End, F2, Del and F10 keys in grub2
Signed-off-by Dinar Valeev <[email protected]>--- lib/libusb/usb-hid.c | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-)lib/libusb/usb-hid.c +2
-3@@ -190,33 +190,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 ;
lib/libusb/usb-hid.c static void check_key_code(uint8_t *buf) · line 202
Quoted 10 lines
lib/libusb/usb-hid.c +2
-3case 0x3b :/* F2 */ write_key (0x1b );write_key (0x5b ); -write_key (0x31 ); -write_key (0x32 ); -write_key (0x7e ); +write_key (0x4f ); +write_key (0x51 );break ;
Tested fine.
Quoted 32 lines
lib/libusb/usb-hid.c +5
-7case 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 ;case 0x3e :@@ -254,7 +250,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 ;
lib/libusb/usb-hid.c static void check_key_code(uint8_t *buf) · line 264
Quoted 8 lines
lib/libusb/usb-hid.c +1
-1@@ -262,7 +258,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 ;
Does F10 work for you? doesn't work for me ?
Quoted 23 lines
lib/libusb/usb-hid.c +2
-3@@ -270,7 +266,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 ;@@ -278,7 +274,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 ;@@ -290,36 +286,34 @@ static void check_key_code(uint8_t *buf)case 0x49 :write_key (0x1b );/* INS */ write_key (0x5b ); -write_key (0x31 );
lib/libusb/usb-hid.c static void check_key_code(uint8_t *buf) · line 296
Quoted 10 lines
lib/libusb/usb-hid.c +2
-2+write_key (0x32 );write_key (0x7e );break ;case 0x4a :write_key (0x1b );/* HOME */ write_key (0x5b ); -write_key (0x32 ); -write_key (0x7e ); +write_key (0x48 );
Looking at accept.fs - handle-ESC-5b ...
: handle-ESC-5b
key
dup 31 = IF \ HOME
key drop ( drops closing 7e ) handle-^A
ELSE
dup 33 = IF \ DEL
key drop handle-^D
ELSE
dup 34 = IF \ END
key drop handle-^E
ELSE
dup 1f and handle-CSI
THEN
THEN
THEN drop
;
... following change is sufficient:
- write_key(0x32);
+ write_key(0x31);
Quoted 5 lines
lib/libusb/usb-hid.c +0
-0break ;case 0x4b :write_key (0x1b );/* PgUp */ write_key (0x5b );
lib/libusb/usb-hid.c static void check_key_code(uint8_t *buf) · line 309
Quoted 10 lines
lib/libusb/usb-hid.c +2
-2-write_key (0x33 ); +write_key (0x35 );write_key (0x7e );break ;case 0x4c :write_key (0x1b );/* DEL */ write_key (0x5b ); -write_key (0x34 ); +write_key (0x33 );
Right.
lib/libusb/usb-hid.c static void check_key_code(uint8_t *buf) · line 316
Quoted 9 lines
lib/libusb/usb-hid.c +1
-2write_key (0x7e );break ;case 0x4d :write_key (0x1b );/* END */ write_key (0x5b ); -write_key (0x35 ); -write_key (0x7e ); +write_key (0x46 );
I tried using: 0x34, but somehow it does not work.
Regards
Nikunj
Quoted 78 lines · Nikunj A Dadhania
Quoted 29 lines · Dinar valeev
From: Dinar Valeev <[email protected]>
Original issue is home and end keys are not functional in grub2. Later I've found other inconsistencies in f1-f12 keys.
"Correct sequence" was crabbed by pressing key on cat running in xterm.
Tested with Home, End, F2, Del and F10 keys in grub2
Signed-off-by Dinar Valeev <[email protected]>--- lib/libusb/usb-hid.c | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-)lib/libusb/usb-hid.c +2
-3@@ -190,33 +190,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 ;lib/libusb/usb-hid.c static void check_key_code(uint8_t *buf) · line 202
Quoted 10 lines
lib/libusb/usb-hid.c +2
-3case 0x3b :/* F2 */ write_key (0x1b );write_key (0x5b ); -write_key (0x31 ); -write_key (0x32 ); -write_key (0x7e ); +write_key (0x4f ); +write_key (0x51 );break ;Tested fine.
Quoted 34 lines
lib/libusb/usb-hid.c +5
-7case 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 ;case 0x3e :@@ -254,7 +250,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 ;@@ -262,7 +258,7 @@ static void check_key_code(uint8_t *buf)case 0x43 :write_key (0x1b );/* F10 */
Quoted 8 lines
lib/libusb/usb-hid.c static void check_key_code(uint8_t *buf) · line 264
Quoted 6 lines
lib/libusb/usb-hid.c +1
-1write_key (0x5b ); -write_key (0x31 ); +write_key (0x32 );write_key (0x31 );write_key (0x7e );break ;Does F10 work for you? doesn't work for me ?
It does. But then menu entry is expanded to openSUSE, with Linux 4.0.1-1-default entering edit mode and pressing f10 finally boots it.
xterm sequence is ^[[21~
Quoted 57 lines
Quoted 24 lines
lib/libusb/usb-hid.c +2
-3@@ -270,7 +266,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 ;@@ -278,7 +274,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 ;@@ -290,36 +286,34 @@ static void check_key_code(uint8_t *buf)case 0x49 :write_key (0x1b );/* INS */ write_key (0x5b ); -write_key (0x31 );lib/libusb/usb-hid.c static void check_key_code(uint8_t *buf) · line 296
Quoted 10 lines
lib/libusb/usb-hid.c +2
-2+write_key (0x32 );write_key (0x7e );break ;case 0x4a :write_key (0x1b );/* HOME */ write_key (0x5b ); -write_key (0x32 ); -write_key (0x7e ); +write_key (0x48 );Looking at accept.fs - handle-ESC-5b ...
: handle-ESC-5b
key
dup 31 = IF \ HOME
key drop ( drops closing 7e ) handle-^A
ELSE
dup 33 = IF \ DEL
key drop handle-^D
ELSE
dup 34 = IF \ END
key drop handle-^E
ELSE
dup 1f and handle-CSI
THEN
THEN
THEN drop
;... following change is sufficient:
Review
Quoted 2 lines
(quoted diff) +1
-1- write_key(0x32); + write_key(0x31);
Home sequence for me is: ^[[H
Quoted 22 lines
Quoted 6 lines
lib/libusb/usb-hid.c +0
-0break ;case 0x4b :write_key (0x1b );/* PgUp */ write_key (0x5b );lib/libusb/usb-hid.c static void check_key_code(uint8_t *buf) · line 309
Quoted 10 lines
lib/libusb/usb-hid.c +2
-2-write_key (0x33 ); +write_key (0x35 );write_key (0x7e );break ;case 0x4c :write_key (0x1b );/* DEL */ write_key (0x5b ); -write_key (0x34 ); +write_key (0x33 );Right.
Quoted 3 lines
lib/libusb/usb-hid.c +0
-0write_key (0x7e );break ;
Quoted 8 lines
lib/libusb/usb-hid.c static void check_key_code(uint8_t *buf) · line 316
Quoted 6 lines
lib/libusb/usb-hid.c +1
-2case 0x4d :write_key (0x1b );/* END */ write_key (0x5b ); -write_key (0x35 ); -write_key (0x7e ); +write_key (0x46 );I tried using:
0x34, but somehow it does not work.
^[[F works for me.
All changes are tested in openSUSE's grub2 with -vga std. Note we don't have any special patches here..
Tested with -vga none -nographic. Home, End works with patched SLOF
Quoted 8 lines
Regards
Nikunj_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev
Quoted 14 lines · Dinar Valeev
Quoted 12 lines · Nikunj A Dadhania
lib/libusb/usb-hid.c static void check_key_code(uint8_t *buf) · line 264
Quoted 9 lines · Dinar valeev
lib/libusb/usb-hid.c +1
-1@@ -262,7 +258,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 ;Does F10 work for you? doesn't work for me ?
Quoted 4 lines
It does. But then menu entry is expanded to openSUSE, with Linux 4.0.1-1-default entering edit mode and pressing f10 finally boots it.
xterm sequence is ^[[21~
I had used following in TCG:
qemu-system-ppc64 -machine pseries -m 2G -serial stdio -cdrom distro.iso \
-vnc :1
Quoted 57 lines
Quoted 57 lines
Quoted 26 lines
lib/libusb/usb-hid.c +2
-3@@ -270,7 +266,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 ;@@ -278,7 +274,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 ;@@ -290,36 +286,34 @@ static void check_key_code(uint8_t *buf)case 0x49 :write_key (0x1b );/* INS */ write_key (0x5b ); -write_key (0x31 );lib/libusb/usb-hid.c static void check_key_code(uint8_t *buf) · line 296
Quoted 10 lines
lib/libusb/usb-hid.c +2
-2+write_key (0x32 );write_key (0x7e );break ;case 0x4a :write_key (0x1b );/* HOME */ write_key (0x5b ); -write_key (0x32 ); -write_key (0x7e ); +write_key (0x48 );Looking at accept.fs - handle-ESC-5b ...
: handle-ESC-5b
key
dup 31 = IF \ HOME
key drop ( drops closing 7e ) handle-^A
ELSE
dup 33 = IF \ DEL
key drop handle-^D
ELSE
dup 34 = IF \ END
key drop handle-^E
ELSE
dup 1f and handle-CSI
THEN
THEN
THEN drop
;
Quoted 5 lines
Review
Quoted 4 lines
... following change is sufficient:
(quoted diff) +1
-1- write_key(0x32); + write_key(0x31);Home sequence for me is: ^[[H
Can you check the above change in your setup ?
Quoted 29 lines
Quoted 29 lines
Quoted 6 lines
lib/libusb/usb-hid.c +0
-0break ;case 0x4b :write_key (0x1b );/* PgUp */ write_key (0x5b );lib/libusb/usb-hid.c static void check_key_code(uint8_t *buf) · line 309
Quoted 10 lines
lib/libusb/usb-hid.c +2
-2-write_key (0x33 ); +write_key (0x35 );write_key (0x7e );break ;case 0x4c :write_key (0x1b );/* DEL */ write_key (0x5b ); -write_key (0x34 ); +write_key (0x33 );Right.
Quoted 9 lines
lib/libusb/usb-hid.c +1
-2write_key (0x7e );break ;case 0x4d :write_key (0x1b );/* END */ write_key (0x5b ); -write_key (0x35 ); -write_key (0x7e ); +write_key (0x46 );
Quoted 7 lines
Quoted 1 line
I tried using:
0x34, but somehow it does not work.^[[F works for me.
All changes are tested in openSUSE's grub2 with -vga std. Note we don't have any special patches here..
Tested with -vga none -nographic. Home, End works with patched SLOF
Ok.
Regards
Nikunj
Quoted 83 lines · Nikunj A Dadhania
Quoted 14 lines · Dinar Valeev
Quoted 12 lines · Nikunj A Dadhania
lib/libusb/usb-hid.c static void check_key_code(uint8_t *buf) · line 264
Quoted 9 lines · Dinar valeev
lib/libusb/usb-hid.c +1
-1@@ -262,7 +258,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 ;Does F10 work for you? doesn't work for me ?
Quoted 4 lines
It does. But then menu entry is expanded to openSUSE, with Linux 4.0.1-1-default entering edit mode and pressing f10 finally boots it.
xterm sequence is ^[[21~
I had used following in TCG:
qemu-system-ppc64 -machine pseries -m 2G -serial stdio -cdrom distro.iso \
-vnc :1Quoted 57 lines
Quoted 57 lines
Quoted 26 lines
lib/libusb/usb-hid.c +2
-3@@ -270,7 +266,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 ;@@ -278,7 +274,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 ;@@ -290,36 +286,34 @@ static void check_key_code(uint8_t *buf)case 0x49 :write_key (0x1b );/* INS */ write_key (0x5b ); -write_key (0x31 );lib/libusb/usb-hid.c static void check_key_code(uint8_t *buf) · line 296
Quoted 10 lines
lib/libusb/usb-hid.c +2
-2+write_key (0x32 );write_key (0x7e );break ;case 0x4a :write_key (0x1b );/* HOME */ write_key (0x5b ); -write_key (0x32 ); -write_key (0x7e ); +write_key (0x48 );Looking at accept.fs - handle-ESC-5b ...
: handle-ESC-5b
key
dup 31 = IF \ HOME
key drop ( drops closing 7e ) handle-^A
ELSE
dup 33 = IF \ DEL
key drop handle-^D
ELSE
dup 34 = IF \ END
key drop handle-^E
ELSE
dup 1f and handle-CSI
THEN
THEN
THEN drop
;
Quoted 7 lines
Quoted 5 lines
Review
Quoted 4 lines
... following change is sufficient:
(quoted diff) +1
-1- write_key(0x32); + write_key(0x31);Home sequence for me is: ^[[H
Can you check the above change in your setup ?
That works as well.
Quoted 47 lines
Quoted 30 lines
Quoted 30 lines
Quoted 7 lines
lib/libusb/usb-hid.c +0
-0break ;case 0x4b :write_key (0x1b );/* PgUp */ write_key (0x5b );lib/libusb/usb-hid.c static void check_key_code(uint8_t *buf) · line 309
Quoted 10 lines
lib/libusb/usb-hid.c +2
-2-write_key (0x33 ); +write_key (0x35 );write_key (0x7e );break ;case 0x4c :write_key (0x1b );/* DEL */ write_key (0x5b ); -write_key (0x34 ); +write_key (0x33 );Right.
Quoted 9 lines
lib/libusb/usb-hid.c +1
-2write_key (0x7e );break ;case 0x4d :write_key (0x1b );/* END */ write_key (0x5b ); -write_key (0x35 ); -write_key (0x7e ); +write_key (0x46 );Quoted 7 lines
Quoted 1 line
I tried using:
0x34, but somehow it does not work.^[[F works for me.
All changes are tested in openSUSE's grub2 with -vga std. Note we don't have any special patches here..
Tested with -vga none -nographic. Home, End works with patched SLOF
Ok.
Regards
Nikunj_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev
Quoted 7 lines · On Tue, 2 Jun 2015 12:43:16 +0200 Dinar Valeev <[email protected]> wrote:
Quoted 5 lines · Nikunj A Dadhania
Quoted 3 lines · Dinar Valeev
Quoted 1 line · Nikunj A Dadhania
Dinar valeev <[email protected]> writes:
...
Quoted 36 lines
Quoted 36 lines
Quoted 36 lines
Quoted 36 lines
Quoted 5 lines
lib/libusb/usb-hid.c +0
-1@@ -290,36 +286,34 @@ static void check_key_code(uint8_t *buf)case 0x49 :write_key (0x1b );/* INS */ write_key (0x5b ); -write_key (0x31 );lib/libusb/usb-hid.c static void check_key_code(uint8_t *buf) · line 296
Quoted 10 lines
lib/libusb/usb-hid.c +2
-2+write_key (0x32 );write_key (0x7e );break ;case 0x4a :write_key (0x1b );/* HOME */ write_key (0x5b ); -write_key (0x32 ); -write_key (0x7e ); +write_key (0x48 );Looking at accept.fs - handle-ESC-5b ...
: handle-ESC-5b
key
dup 31 = IF \ HOME
key drop ( drops closing 7e ) handle-^A
ELSE
dup 33 = IF \ DEL
key drop handle-^D
ELSE
dup 34 = IF \ END
key drop handle-^E
ELSE
dup 1f and handle-CSI
THEN
THEN
THEN drop
;
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Review
Quoted 4 lines
... following change is sufficient:
(quoted diff) +1
-1- write_key(0x32); + write_key(0x31);Home sequence for me is: ^[[H
Can you check the above change in your setup ?
That works as well.
Not sure, but IIRC some of these key codes depend on the keyboard layout that you are using. What keyboard layout (i.e. language) do you use?
Thomas
Quoted 51 lines · Thomas Huth
Quoted 7 lines · On Tue, 2 Jun 2015 12:43:16 +0200 Dinar Valeev <[email protected]> wrote:
Quoted 5 lines · Nikunj A Dadhania
Quoted 3 lines · Dinar Valeev
Quoted 1 line · Nikunj A Dadhania
Dinar valeev <[email protected]> writes:
...
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 5 lines
lib/libusb/usb-hid.c +0
-1@@ -290,36 +286,34 @@ static void check_key_code(uint8_t *buf)case 0x49 :write_key (0x1b );/* INS */ write_key (0x5b ); -write_key (0x31 );lib/libusb/usb-hid.c static void check_key_code(uint8_t *buf) · line 296
Quoted 10 lines
lib/libusb/usb-hid.c +2
-2+write_key (0x32 );write_key (0x7e );break ;case 0x4a :write_key (0x1b );/* HOME */ write_key (0x5b ); -write_key (0x32 ); -write_key (0x7e ); +write_key (0x48 );Looking at accept.fs - handle-ESC-5b ...
: handle-ESC-5b
key
dup 31 = IF \ HOME
key drop ( drops closing 7e ) handle-^A
ELSE
dup 33 = IF \ DEL
key drop handle-^D
ELSE
dup 34 = IF \ END
key drop handle-^E
ELSE
dup 1f and handle-CSI
THEN
THEN
THEN drop
;... following change is sufficient:
(quoted diff) +1
-1- write_key(0x32); + write_key(0x31);
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line
Home sequence for me is: ^[[H
Can you check the above change in your setup ?
That works as well.
Not sure, but IIRC some of these key codes depend on the keyboard layout that you are using. What keyboard layout (i.e. language) do you use?
en_us, but note that "End" issue was found by running qemu as part of openQA (plain qemu). This is how we test distribution. We're sending keyboard,mouse commands over ui/vnc.
Quoted 2 lines
Thomas
Quoted 9 lines · Dinar valeev
From: Dinar Valeev <[email protected]>
Original issue is home and end keys are not functional in grub2. Later I've found other inconsistencies in f1-f12 keys.
"Correct sequence" was crabbed by pressing key on cat running in xterm.
Tested with Home, End, F2, Del and F10 keys in grub2
Few observations with more testing:
* In console mode F2 and F10 both are interpreted as ESC.
* In VNC F2 works fine F10 does not.
I would suggest to drop the "Fn" related changes and resend this patch with END/HOME. As Ctrl-c and Ctrl-x both works as expected in the grub edit mode.
Quoted 137 lines
Signed-off-by Dinar Valeev <[email protected]>--- lib/libusb/usb-hid.c | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-)lib/libusb/usb-hid.c +17
-23@@ -190,33 +190,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 ;case 0x3e :@@ -254,7 +250,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 ;@@ -262,7 +258,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 ;@@ -270,7 +266,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 ;@@ -278,7 +274,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 ;@@ -290,36 +286,34 @@ static void check_key_code(uint8_t *buf)case 0x49 :write_key (0x1b );/* INS */ write_key (0x5b ); -write_key (0x31 ); +write_key (0x32 );write_key (0x7e );break ;case 0x4a :write_key (0x1b );/* HOME */ write_key (0x5b ); -write_key (0x32 ); -write_key (0x7e ); +write_key (0x48 );break ;case 0x4b :write_key (0x1b );/* PgUp */ write_key (0x5b ); -write_key (0x33 ); +write_key (0x35 );write_key (0x7e );break ;case 0x4c :write_key (0x1b );/* DEL */ write_key (0x5b ); -write_key (0x34 ); +write_key (0x33 );write_key (0x7e );break ;case 0x4d :write_key (0x1b );/* END */ write_key (0x5b ); -write_key (0x35 ); -write_key (0x7e ); +write_key (0x46 );break ;case 0x4e :Signature · 6 lines
2.1.4 _______________________________________________ Linuxppc-dev mailing list [email protected] https://lists.ozlabs.org/listinfo/linuxppc-dev
Hi!
May I ask what's the status of this patch? As far as I can see, it has not been included in the repository yet?
Quoted 19 lines · Dinar valeev
From: Dinar Valeev <[email protected]>
Original issue is home and end keys are not functional in grub2. Later I've found other inconsistencies in f1-f12 keys.
"Correct sequence" was crabbed by pressing key on cat running in xterm.
Tested with Home, End, F2, Del and F10 keys in grub2
Signed-off-by Dinar Valeev <[email protected]>--- lib/libusb/usb-hid.c | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-)lib/libusb/usb-hid.c +0
-0
...
lib/libusb/usb-hid.c static void check_key_code(uint8_t *buf) · line 280
Quoted 9 lines
lib/libusb/usb-hid.c +1
-1@@ -278,7 +274,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 ;
... I'm especially interested in this hunk here. One of our testers ran into the problem that you can not enter the boot menu when using USB keyboard (and starting QEMU with "-boot menu=on"), and I think this is related to this hunk.
Looking at "f12-pressed?" in slof/fs/start-up.fs you can also easily see that the menu code expects a "32" instead of "31" here, and Dinar's patch fixes this issue!
Thomas
Quoted 5 lines · Thomas Huth
Hi!
May I ask what's the status of this patch? As far as I can see, it has not been included in the repository yet?
Hi,
Uhh.. I forgot about this patch, since I run local copy.
No the patch is not included. For me it is unclear why keys don't work for me, but they do for
Alexey and Nikunj.
Quoted 43 lines · Dinar valeev
Quoted 19 lines
From: Dinar Valeev <[email protected]>
Original issue is home and end keys are not functional in grub2. Later I've found other inconsistencies in f1-f12 keys.
"Correct sequence" was crabbed by pressing key on cat running in xterm.
Tested with Home, End, F2, Del and F10 keys in grub2
Signed-off-by Dinar Valeev <[email protected]>--- lib/libusb/usb-hid.c | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-)lib/libusb/usb-hid.c +0
-0...
lib/libusb/usb-hid.c static void check_key_code(uint8_t *buf) · line 280
Quoted 9 lines
lib/libusb/usb-hid.c +1
-1@@ -278,7 +274,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 ;... I'm especially interested in this hunk here. One of our testers ran into the problem that you can not enter the boot menu when using USB keyboard (and starting QEMU with "-boot menu=on"), and I think this is related to this hunk.
Looking at "f12-pressed?" in slof/fs/start-up.fs you can also easily see that the menu code expects a "32" instead of "31" here, and Dinar's patch fixes this issue!
Thomas
Quoted 11 lines · Dinar Valeev
Quoted 5 lines · Thomas Huth
Hi!
May I ask what's the status of this patch? As far as I can see, it has not been included in the repository yet?
Hi,
Uhh.. I forgot about this patch, since I run local copy.No the patch is not included. For me it is unclear why keys don't work for me, but they do for Alexey and Nikunj.
At least F12 for the boot menu is currently definitely broken - as the code in "f12-pressed?" in slof/fs/start-up.fs expects other values than the libusb code currently generates.
Alexey, Nikunj, could you please check whether the boot menu is working for you when you run QEMU in graphical mode with "-boot menu=on"?
Thanks,
Thomas