Re: build regression from c153693: Simplify module TOC handling

2016-02-09 Thread Dinar Valeev
On Tue, Feb 9, 2016 at 5:28 PM, Peter Robinson  wrote:
> Hi Alan,
>
> Your patch for "powerpc: Simplify module TOC handling" is causing the
> Fedora ppc64le to fail to build with depmod failures. Reverting the
> commit fixes it for us on rawhide.
Anton's patch [1] fixes it.

[1] 
https://build.opensuse.org/package/view_file/Base:System/kmod/depmod-Ignore_PowerPC64_ABIv2_.TOC.symbol.patch
>
> We're getting the out put below, full logs at [1]. Let me know if you
> have any other queries.
>
> Regards,
> Peter
>
> [1] 
> http://ppc.koji.fedoraproject.org/kojifiles/work/tasks/5115/3125115/build.log
>
> + depmod -b . -aeF ./System.map 4.5.0-0.rc2.git0.1.fc24.ppc64le
> Depmod failure
> + '[' -s depmod.out ']'
> + echo 'Depmod failure'
> + cat depmod.out
> depmod: WARNING:
> /builddir/build/BUILDROOT/kernel-4.5.0-0.rc2.git0.1.fc24.ppc64le/./lib/modules/4.5.0-0.rc2.git0.1.fc24.ppc64le/kernel/arch/powerpc/platforms/powernv/opal-prd.ko
> needs unknown symbol .TOC.
> depmod: WARNING:
> /builddir/build/BUILDROOT/kernel-4.5.0-0.rc2.git0.1.fc24.ppc64le/./lib/modules/4.5.0-0.rc2.git0.1.fc24.ppc64le/kernel/arch/powerpc/platforms/pseries/pseries_energy.ko
> needs unknown symbol .TOC.
> depmod: WARNING:
> /builddir/build/BUILDROOT/kernel-4.5.0-0.rc2.git0.1.fc24.ppc64le/./lib/modules/4.5.0-0.rc2.git0.1.fc24.ppc64le/kernel/arch/powerpc/platforms/pseries/hvcserver.ko
> needs unknown symbol .TOC.
> depmod: WARNING:
> /builddir/build/BUILDROOT/kernel-4.5.0-0.rc2.git0.1.fc24.ppc64le/./lib/modules/4.5.0-0.rc2.git0.1.fc24.ppc64le/kernel/arch/powerpc/kvm/kvm.ko
> needs unknown symbol .TOC.
> depmod: WARNING:
> /builddir/build/BUILDROOT/kernel-4.5.0-0.rc2.git0.1.fc24.ppc64le/./lib/modules/4.5.0-0.rc2.git0.1.fc24.ppc64le/kernel/arch/powerpc/kvm/kvm-pr.ko
> needs unknown symbol .TOC.
> depmod: WARNING:
> /builddir/build/BUILDROOT/kernel-4.5.0-0.rc2.git0.1.fc24.ppc64le/./lib/modules/4.5.0-0.rc2.git0.1.fc24.ppc64le/kernel/arch/powerpc/kvm/kvm-hv.ko
> needs unknown symbol .TOC.
> depmod: WARNING:
> /builddir/build/BUILDROOT/kernel-4.5.0-0.rc2.git0.1.fc24.ppc64le/./lib/modules/4.5.0-0.rc2.git0.1.fc24.ppc64le/kernel/kernel/rcu/rcutorture.ko
> needs unknown symbol .TOC.
> depmod: WARNING:
> /builddir/build/BUILDROOT/kernel-4.5.0-0.rc2.git0.1.fc24.ppc64le/./lib/modules/4.5.0-0.rc2.git0.1.fc24.ppc64le/kernel/kernel/trace/ring_buffer_benchmark.ko
> needs unknown symbol .TOC.
> depmod: WARNING:
> /builddir/build/BUILDROOT/kernel-4.5.0-0.rc2.git0.1.fc24.ppc64le/./lib/modules/4.5.0-0.rc2.git0.1.fc24.ppc64le/kernel/kernel/torture.ko
> needs unknown symbol .TOC.
> depmod: WARNING:
> /builddir/build/BUILDROOT/kernel-4.5.0-0.rc2.git0.1.fc24.ppc64le/./lib/modules/4.5.0-0.rc2.git0.1.fc24.ppc64le/kernel/fs/nfs_common/nfs_acl.ko
> needs unknown symbol .TOC.
> depmod: WARNING:
> /builddir/build/BUILDROOT/kernel-4.5.0-0.rc2.git0.1.fc24.ppc64le/./lib/modules/4.5.0-0.rc2.git0.1.fc24.ppc64le/kernel/fs/nfs_common/grace.ko
> needs unknown symbol .TOC.
> ___
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH] Fix function keys sequence on USB

2015-09-01 Thread Dinar Valeev
On Tue, Sep 1, 2015 at 4:13 PM, Thomas Huth <th...@redhat.com> wrote:
>
>  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.
>
> On 29/05/15 15:30, Dinar valeev wrote:
>> From: Dinar Valeev <dval...@suse.com>
>>
>> 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 <dval...@suse.com>
>> ---
>>  lib/libusb/usb-hid.c | 40 +---
>>  1 file changed, 17 insertions(+), 23 deletions(-)
>>
>> diff --git a/lib/libusb/usb-hid.c b/lib/libusb/usb-hid.c
>> index f0cab8a..ccd5ba9 100644
>> --- a/lib/libusb/usb-hid.c
>> +++ b/lib/libusb/usb-hid.c
> ...
>> @@ -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
>
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH v2] Caps in not always shift

2015-07-13 Thread Dinar Valeev
On Fri, Jul 10, 2015 at 8:42 AM, Paul Mackerras pau...@samba.org wrote:
 On Wed, Jul 08, 2015 at 06:47:44PM +0200, Dinar valeev wrote:
 From: Dinar Valeev dval...@suse.com

 Caps behaves like shift only for latin characters.
 In case we're typing - for example with caps enabled, SLOF picks _ char
 from shifted table.

 Threat caps as shift only for letters.

 Treat not Threat.

 And I suggest you make the subject Caps is ... rather than
 Caps in 

 Paul.
Thanks, I've sent v3
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH v2] Caps in not always shift

2015-07-08 Thread Dinar valeev
From: Dinar Valeev dval...@suse.com

Caps behaves like shift only for latin characters.
In case we're typing - for example with caps enabled, SLOF picks _ char
from shifted table.

Threat caps as shift only for letters.

Signed-off-by: Dinar Valeev dval...@suse.com
---
 lib/libusb/usb-hid.c | 32 +---
 1 file changed, 29 insertions(+), 3 deletions(-)

diff --git a/lib/libusb/usb-hid.c b/lib/libusb/usb-hid.c
index f0cab8a..18210ae 100644
--- a/lib/libusb/usb-hid.c
+++ b/lib/libusb/usb-hid.c
@@ -28,6 +28,10 @@
 #define HID_REQ_SET_IDLE0x0A
 #define HID_REQ_SET_PROTOCOL0x0B
 
+//key position for latin letters
+#define KEYP_LATIN_A 4
+#define KEYP_LATIN_Z 29
+
 //#define KEY_DEBUG
 
 /* HID SPEC - 7.2.6 Set_Protocol Request */
@@ -83,6 +87,8 @@ uint8_t set_leds;
 const uint8_t *key_std   = NULL;
 const uint8_t *key_std_shift = NULL;
 
+uint8_t ctrl; /* modifiers */
+
 /**
  * read character from Keyboard-Buffer
  *
@@ -111,6 +117,18 @@ static void write_key(uint8_t key)
 }
 
 /**
+ * Checks if keypos is a latin key
+ * @param  keypos
+ * @return -
+ */
+void check_latin(uint8_t keypos)
+   if (keypos  KEYP_LATIN_A || keypos  KEYP_LATIN_Z) {
+   return true;
+   } else {
+   return false;
+   }
+
+/**
  * Convert keyboard usage-ID to ANSI-Code
  *
  * @param   Ctrl=Modifier Byte
@@ -120,22 +138,24 @@ static void write_key(uint8_t key)
 static void get_char(uint8_t ctrl, uint8_t keypos)
 {
uint8_t ch;
+   bool caps = false;
 
 #ifdef KEY_DEBUG
printf(pos %02X\n, keypos);
 #endif
 
if (set_leds  LED_CAPS_LOCK)   /* is CAPS Lock set ? */
-   ctrl |= MODIFIER_SHIFT; /* simulate shift */
+   caps = true;
 
-   if (ctrl == 0) {
+   /* caps is a shift only for latin chars */
+   if ((!caps  ctrl == 0) || (caps  !check_latin(keypos))) {
ch = key_std[keypos];
if (ch != 0)
write_key(ch);
return;
}
 
-   if (ctrl  MODIFIER_SHIFT) {
+   if ((ctrl  MODIFIER_SHIFT) || caps) {
ch = key_std_shift[keypos];
if (ch != 0)
write_key(ch);
@@ -187,6 +207,12 @@ static void check_key_code(uint8_t *buf)
set_leds ^= LED_CAPS_LOCK;
break;
 
+   case 0x36:  /*Shift 
pressed*/
+   ctrl |= MODIFIER_SHIFT;
+   break;
+   case 0xb6:  /*Shift 
unpressed*/
+   ctrl = ~MODIFIER_SHIFT;
+   break;
case 0x3a:  /* F1 */
write_key(0x1b);
write_key(0x5b);
-- 
2.1.4

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH] Fix function keys sequence on USB

2015-06-02 Thread Dinar Valeev
On Tue, Jun 2, 2015 at 1:12 PM, Thomas Huth th...@redhat.com wrote:
 On Tue, 2 Jun 2015 12:43:16 +0200
 Dinar Valeev k...@opensuse.org wrote:

 On Tue, Jun 2, 2015 at 12:29 PM, Nikunj A Dadhania
 nik...@linux.vnet.ibm.com wrote:
  Dinar Valeev k...@opensuse.org writes:
 
  On Tue, Jun 2, 2015 at 11:47 AM, Nikunj A Dadhania
  nik...@linux.vnet.ibm.com wrote:
  Dinar valeev k...@opensuse.org writes:
 ...
  @@ -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);
 
  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);
 
  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.

  Thomas
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH] Fix function keys sequence on USB

2015-06-02 Thread Dinar Valeev
On Tue, Jun 2, 2015 at 11:47 AM, Nikunj A Dadhania
nik...@linux.vnet.ibm.com wrote:
 Dinar valeev k...@opensuse.org writes:

 From: Dinar Valeev dval...@suse.com

 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 dval...@suse.com
 ---
  lib/libusb/usb-hid.c | 40 +---
  1 file changed, 17 insertions(+), 23 deletions(-)

 diff --git a/lib/libusb/usb-hid.c b/lib/libusb/usb-hid.c
 index f0cab8a..ccd5ba9 100644
 --- a/lib/libusb/usb-hid.c
 +++ b/lib/libusb/usb-hid.c
 @@ -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;

 Tested fine.


   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;

 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~



 @@ -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

Re: [PATCH] Fix function keys sequence on USB

2015-06-02 Thread Dinar Valeev
On Tue, Jun 2, 2015 at 12:29 PM, Nikunj A Dadhania
nik...@linux.vnet.ibm.com wrote:
 Dinar Valeev k...@opensuse.org writes:

 On Tue, Jun 2, 2015 at 11:47 AM, Nikunj A Dadhania
 nik...@linux.vnet.ibm.com wrote:
 Dinar valeev k...@opensuse.org writes:
 @@ -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 ?
 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




 @@ -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);

 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);

 Home sequence for me is: ^[[H

 Can you check the above change in your setup ?
That works as well.


   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);

 Right.

   write_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.
 ^[[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

Re: [PATCH slof] Fix function keys sequence on USB

2015-05-30 Thread Dinar Valeev
On 05/30/2015 11:59 AM, Alexey Kardashevskiy wrote:
 On 05/29/2015 11:30 PM, Dinar valeev wrote:
 From: Dinar Valeev dval...@suse.com

 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.
 
 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.
 
 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?
-vga std -vnc :1
 
 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.
 
 
 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.
 
 [PATCH slof] usb-hid: Fix function keys sequence on USB
 
 Or/and put me or Nikunj in cc:
 
 
 Signed-off-by: Dinar Valeev dval...@suse.com
 ---
   lib/libusb/usb-hid.c | 40 +---
   1 file changed, 17 insertions(+), 23 deletions(-)

 diff --git a/lib/libusb/usb-hid.c b/lib/libusb/usb-hid.c
 index f0cab8a..ccd5ba9 100644
 --- a/lib/libusb/usb-hid.c
 +++ b/lib/libusb/usb-hid.c
 @@ -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

[PATCH] Caps in not always shift

2015-05-29 Thread Dinar valeev
From: Dinar Valeev dval...@suse.com

Caps behaves like shift only for latin characters.
In case we're typing - for example with caps enabled, SLOF picks _ char
from shifted table.

Threat caps as shift only for letters.

Signed-off-by: Dinar Valeev dval...@suse.com
---
 lib/libusb/usb-hid.c | 19 ---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/lib/libusb/usb-hid.c b/lib/libusb/usb-hid.c
index f0cab8a..9e14cf5 100644
--- a/lib/libusb/usb-hid.c
+++ b/lib/libusb/usb-hid.c
@@ -83,6 +83,8 @@ uint8_t set_leds;
 const uint8_t *key_std   = NULL;
 const uint8_t *key_std_shift = NULL;
 
+uint8_t ctrl; /* modifiers */
+
 /**
  * read character from Keyboard-Buffer
  *
@@ -120,22 +122,27 @@ static void write_key(uint8_t key)
 static void get_char(uint8_t ctrl, uint8_t keypos)
 {
uint8_t ch;
+   int caps = 0;
+//key position for latin letters
+#define KEYP_LATIN_A 4
+#define KEYP_LATIN_Z 29
 
 #ifdef KEY_DEBUG
printf(pos %02X\n, keypos);
 #endif
 
if (set_leds  LED_CAPS_LOCK)   /* is CAPS Lock set ? */
-   ctrl |= MODIFIER_SHIFT; /* simulate shift */
+   caps = 1;
 
-   if (ctrl == 0) {
+   /* caps is a shift only for latin chars */
+   if ((caps == 0  ctrl == 0) || (caps == 1  (keypos  KEYP_LATIN_A || 
keypos  KEYP_LATIN_Z))) {
ch = key_std[keypos];
if (ch != 0)
write_key(ch);
return;
}
 
-   if (ctrl  MODIFIER_SHIFT) {
+   if ((ctrl  MODIFIER_SHIFT) || caps == 1) {
ch = key_std_shift[keypos];
if (ch != 0)
write_key(ch);
@@ -187,6 +194,12 @@ static void check_key_code(uint8_t *buf)
set_leds ^= LED_CAPS_LOCK;
break;
 
+   case 0x36:  /*Shift 
pressed*/
+   ctrl |= MODIFIER_SHIFT;
+   break;
+   case 0xb6:  /*Shift 
unpressed*/
+   ctrl = ~MODIFIER_SHIFT;
+   break;
case 0x3a:  /* F1 */
write_key(0x1b);
write_key(0x5b);
-- 
2.1.4

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH] Fix function keys sequence on USB

2015-05-29 Thread Dinar valeev
From: Dinar Valeev dval...@suse.com

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 dval...@suse.com
---
 lib/libusb/usb-hid.c | 40 +---
 1 file changed, 17 insertions(+), 23 deletions(-)

diff --git a/lib/libusb/usb-hid.c b/lib/libusb/usb-hid.c
index f0cab8a..ccd5ba9 100644
--- a/lib/libusb/usb-hid.c
+++ b/lib/libusb/usb-hid.c
@@ -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