Weird Ledger Nano S bug


#1

All,

I have a weird behavior when plugging in a Ledger Nano S: the “q” key keeps pressing. Or so it looks like it because wherever I can type text, the text “qqqqq…” keeps displaying.

It prevents me from using Electum because the “q” key have it quit. Too bad… Any ideas, please?


#2

Is any Control-Q/Control-S usage involved in Your activity? If yes, I could know a possible reason. If not, not.


#3

Not particularly. I’ve just tried again, it produces the same q* result without me using the Control key. As soon as the PIN is entered successfully on the Ledger, it starts up.

Just a precision: I’ve tried 2 different USB ports, with the same bad result…


#4

Where do You press Your ‘q’? In chrome-browser?


#5

What do you mean? If I understand you correctly, the “q” key displays anywhere: in Electrum, in the term, etc.


#6

I had a look at this:


#7

To get the facts:

Your ‘q’-key is autorepeating everywhere, inside and outside any ledger activity? Across Your whole desktop? Which desktop? Which terminal?

Or 2ndly

Each and every key prints only (a single) ‘q’, but does not autorepeat? For example: Pressing ‘A’ prints ‘Q’? Pressing ‘BF’ prints ‘QQ’?


#8

Your ‘q’-key is autorepeating everywhere, inside and outside any ledger activity? => Yes.

Across Your whole desktop? Which desktop? Which terminal? => Yes, on XFCE and using Konsole or any program that I can throw it to.

The “q” displays everywhere, in long sequences of “q” repeating ~every 1 second, whether I use my keyboard or not, before, in the mean-time or after: when the PIN code of the Ledger is entered, it all starts. Whatever key I have pressed and even if I have not pressed any key after the PIN code is entered.


#9

Try the xev application to see what’s happening. Maybe, Your USB-device overrides the KeyCode of Your keyboard’s ‘q’-key. xev would show, wether this is truly happening. (You have to move the mouse-pointer into xev’s window.)


#10

Edit:
If ledger is Input/Output device,
it may be recognized as keyboard.
The Keyboard-multiplexer of the OS treats it as additional keyboard.
Example:
Connect 2 USB-Keyboards. Press ‘a’ on the first, press ‘b’ on the other. ‘ab’ will be printed. That’s the keyboard-multiplexer.


#11

Thanks a lot, I’ll test xev tomorrow and let you know how it goes.


#12

Good afternoon,

After more investigation, I can tell that the “q” key stuff starts happening when Electrum unlocks the wallet.

If I plug the Ledger in, start the relevant app on it and do nothing, no “q” key occurs. When I launch Electrum, nothing more happens. But as soon as I select the “use hardware wallet” option, it all starts again.

Here is a Xev output:

KeyRelease event, serial 37, synthetic NO, window 0x3e00001,
root 0x10f, subw 0x0, time 77300046, (41,84), root:(912,547),
state 0x10, keycode 38 (keysym 0x71, q), same_screen YES,
XLookupString gives 1 bytes: (71) “q”
XFilterEvent returns: False

Any ideas, please?


#13

If You change Your X Window System Keyboard from the Multiplexer /dev/… file to the keyboard /dev/… file that corresponds to Your actual keyboard, then I PRESUME that Your Electrum software will auto-detect Your Wallet-USB, and Your normal keyboard will no longer be under wallet’s influence.

Wich device is which can be seen by looking at output of dmesg.


#14

Let’s assume that I have the device name of the keyboard. How do I set X up, then? With the xorg.conf file, is that what you mean?


#15

Add a file here:
/usr/local/etc/X11/xorg.conf.d/keyboard.conf
Similar to:
Section “InputClass”
Identifier “KeyboardDefaults”
Driver “keyboard”
MatchIsKeyboard “on”
EndSection

What You have available is in “man xorg.conf”.

Search for/type:"/"+“Input(Class|Device)”+RETURN

Or use “kbd”-driver’s Device Option: man kbd. (instead of ‘keyboard’)

Read man xorg.conf. You have to add a device line into it. In my example, there is none.


#16

You’re my hero! Thanks again, I’ll try that!


#17

Good evening,

I’ve tried with this /usr/local/etc/X11/xorg.conf.d/keyboard.conf file:

       Section "InputDevice"
           Identifier   "Generic Keyboard"
           Driver       "kbd"
           Option       "CoreKeyboard"
           Option       "XkbRules"      "base"
           Option       "XkbModel"      "pc105"
           Option       "XkbLayout"     "fr"
       EndSection

Unfortunately, after a reboot the problem remains the same: once the Ledger is unlocked, “q” keys are repeatedly emitted.

What am I doing wrong?


#18
$ ls /dev/* | grep kbd 
lrwxr-xr-x  1 root  wheel      -    7B 2018-05-26T15:07:08 /dev/kbd0@ -> kbdmux0
lrwxr-xr-x  1 root  wheel      -    5B 2018-05-26T15:07:08 /dev/kbd1@ -> ukbd0
crw-------  1 root  wheel      -  0x12 2018-05-26T15:07:08 /dev/kbdmux0
crw-------  1 root  wheel      -  0x6f 2018-05-26T15:07:08 /dev/ukbd0

In this example, You would have to select either /dev/kbd1 or /dev/ukbd0 directly, to be sure the USB-keyboard and nothing else will be used.


#19

I see! That would give us:

   Section "InputDevice"
       Identifier   "Generic Keyboard"
       Driver       "kbd"
       Option       "CoreKeyboard"
       Option       "XkbRules"      "base"
       Option       "XkbModel"      "pc105"
       Option       "XkbLayout"     "fr"
       InputDevice    "/dev/kbd0"
   EndSection

Isn’t it?


#20

Looks good. Worth, to try it.