Razer Lycosa on Linux: sometimes starts spamming ^@ (ie. Ctrl+2 in `read`) chars continously | Razer Insider

Razer Lycosa on Linux: sometimes starts spamming ^@ (ie. Ctrl+2 in `read`) chars continously


Hi I have Razer Lycosa and using it only on Linux (I don't know [yet](/drivers-razersupport-com-is-http-and-causing-the-page-isn’t-redirecting-properly-w-https-everywhere.49224/) if you have any drivers or firmware updates(if there is such a thing) for it for Linux) but sometimes it starts doing some weird things:

1. Both during using it after a while and sometimes after computer starts up for the first time(cold boot?), Lycosa starts spamming ^@ (an output which I can accomplish in xfce4-terminal, only by running the command read and pressing Ctrl+2 aka C-2, doing that when the keyboard works normally, ofc). I'm unsure and don't remember at this time if this also happens in xfce4-terminal or only on TERM=linux aka console. Sometimes it doesn't spam it but each key press generates one ^@ with it.
2. Sometimes some characters(such as s or t, sometimes more keys) stop working as if they are physically disconnected. All other keys seem to work but I noticed that when a key is held, it's only repeated for a short time, a second or two, then it stops. (normally, it gets repeated until released). Also the repeats seem to be at a slower, possibly not constant, rate.
3. At computer startup, any of the 3 random led states can be selected: wasd only, all, none. (happens on two different systems(actually all 3 now that I remember), as mentioned below)

In all cases, replugging the USB resolves the issue. The second USB cable from the keyboard is never plugged in. I do have headphones connected to the keyboard and the two audio (in&out) from the keyboard are connected to the desktop PC (an ASUS motherboard). I have seen this behavior happen on both a desktop with Intel CPU and on an older 2012 laptop with AMD CPU!

This is kinda hard to reproduce, as it takes some time for this to occur, but it doesn't seem to be because of leaving it or the computer idle. Though I'm getting the feeling that maybe Lycosa isn't receiving enough USB power and that's what's causing it. Or maybe even the USB connection gets briefly interrupted - although I've no reason to believe this would be the case because the keyboard is stable on a table and I don't move it at all; same for all the other computer cables: they aren't being moved/touched/jiggled.

Furthermode, after having stored the keyboard for a few years, when first plugging it in(a laptop), no keys worked though the leds were lit up(iirc)! I actually opened it up, looked inside, there didn't seem to be anything to clean there, put everything back and to my surprise the keyboard started working again as usual and never stopped like that ever again for the past 2-3 years. I've no idea why.

However, way before opening it, when I used it on Windows, on a different AMD desktop(this time) computer, I remember it would sometimes not type the letter r at the BIOS password prompt and thus making me wonder why the password was wrong. This would also happen during Windows usage! And I don't remember if that was the only key that stopped working out of the blue or there were others, but as usual I would replug the keyboard to workaround it.
So, this is why I know that this issue wasn't caused by me opening up the keyboard (which happened a few years later after using it on Windows like this)

I was(and am) using Linux kernel 5.1.3-g7cb9c5d341b9 now, when this latest on-startup spamming of ^@ sequence occurred (once, today), though I doubt it has anything to do with it, I'm willing to try patches, or echo-ing things in /sys/something even. :)

Any ideas?

Thanks!

PS: `sudo powertop` reports `Autosuspend for USB device Razer Lycosa [Razer]` as `Bad` (this is the default, ie. cat /sys/bus/usb/devices/1-6/power/control returns on) which is probably good as it doesn't power it down ever, so I've no reason to believe that Linux or anything else is making it enter some kind of half-sleep state(unless there are other ways, of course). If I manually(and temporarily) set it to Good aka echo 'auto' then the keyboard leds turn off after a second or two of not using the keyboard and turn on again if I press anything. I haven't tried this mode ever until just now for this paragraph!

This topic has been closed for comments

4 Replies

I have encountered this today as follows:
* started up the PC,
* entered simple BIOS password (that doesn't require the letter 's'),
* let the computer boot into linux until the console prompt (TERM=linux),
* typing the 'user' also generated ^@ with each keypress, eventually it didn't anymore, so I could log in, but at prompt typing the 's' key generated nothing, whilst any other key seems to have worked.
* I pressed Ctrl+Alt+Del (which also worked),
* entered BIOS password,
* booted linux to login prompt, logged in and everything seems to have worked so far until now a few hours later, with no issues.

Thus I didn't have to replug the keyboard. Maybe the BIOS emulated the equivalent of a USB keyboard replug.

I'm kind of wondering what's the equivalent of the following for BIOS and/or Linux:

My Razer product does not work at startup after a cold start, what should I do? Make sure that USB ports are not in hibernation mode. Please go to your Windows “Device Manager” and click the + sign next to Universal Serial Bus Controllers. Click on any “Root Hub” and select “Properties.” Click the Power Management tab and ensure that “Allow computer to turn off this device to save power” and proceed to do this under each Root Hub. Also, from the Control Panel and Power Options, select the Hibernation Tab and deselect “Enable hibernate support.”

quote from https://support.razer.com/gaming-keyboards/razer-lycosa
and by `and ensure that “Allow computer to turn off this device to save power” ` do they mean, that option is to be selected or deselected? It's kind of important! 🙂
tl;dr: touch-sensive media key(s) got "stuck"(but not because I've pressed any!) which was causing normal keys to not repeat(when held) regularly and/or stop after 2-3 repeats(for 'f' key, though not always) and to not repeat at regular intervals. Also, scrolling up via mousewheel in xfce4-terminal would scroll back down again almost immediately.

I've just encountered that issue where keys stop repeating and they don't repeat at the same rate. No keys stopped working though. But this issue was coupled with the fact that in a terminal (xfce4-terminal) I'd scroll up via mousewheel and something would cause it to scroll back down to prompt again in less than 1 second. So I can't scroll up.

I immediately ran `sudo powertop` and put keyboard in Good(previously Bad) power mode, which means, it would turn off the keyboard leds(at least) after like 2 seconds of not using the keyboard. But this time it didn't! Which told me that the keyboard was acting as if some keys are still pressed or something. I switched to console(TERM=linux) and ran `showkey` as root. It showed:
code:

keycode 28 release
keycode 165 release


and then the leds turned off!
I re-checked in xfce4-terminal and I could scroll up now with no issue now!

Keycode 28 is Enter key being released after pressing Enter for the `showkey` command; this is normal!
What isn't normal is keycode 165 released!
Eventually I find out that keycode 165 is the previous-media "key" aka |<< (ie. go to previous track in media player, if any was running) which is just above the Num Lock. This is one of those 4+2+1=7 keys that are touch sensitive, but I don't remember touching it, especially not during `showkey`.

So this tells me that somehow this key was being "stuck" somehow! And it got unstuck by itself, when `keycode 165 released` was shown!

So next time I get some key(s) not working or anything related like this, I'll double check if it's not because one of these touch-sensitive keys are being "stuck" (eg. pressing them a few times to unstuck them) and only if those won't fix it, consider re-plugging keyboard(or the equivalent of that, eg. rebooting or maybe even this `sudo powertop` trick I mentioned above, or some software way to disconnect and reconnect the USB through software - I'll have to check).

but I'll definitely try `sudo showkey` (works from within X too, as long as it's ran as root) first, to see which key gets released.

Good find!

PS: in xfce4-terminal, if I'm scrolled up and I press |<< key it will scroll back to prompt!
It happened again on startup, at the login prompt, spamming ^@ intermittently. But I was able to log in as root and ran `showkeys`, the keyboard was spamming:
code:
keycode 165 press
keycode 165 release

And when I press WinKey key(aka Super) which is keycode 125 it also showed some new keycodes:
code:
keycode   0 press
keycode 1 release
keycode 37 release

Keycode 0 is like impossible, right? But I know keycode 1 is for the Escape key which I haven't touched during this particular test. Keycode 37 is the K key.(I tried it)

Here's an excerpt of the above WinKey press during the keycode 165 spam:
code:

de 125 press
keycode 125 press
keycode 165 release
keycode 165 press
keycode 125 press
keycode 125 press
keycode 165 release
keycode 125 press
keycode 0 press
keycode 1 release
keycode 37 release
keycode 125 press
keycode 125 press
keycode 165 release
keycode 125 press
keycode 165 press
keycode 125 press
keycode 125 release
keycode 165 release
keycode 0 press
keycode 1 release
keycode 37 release
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 125 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 125 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 125 press
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 0 press
keycode 1 release
keycode 37 release
keycode 125 press
keycode 125 press
keycode 125 press
keycode 125 press
keycode 125 press
keycode 125 press
keycode 125 press
keycode 125 press
keycode 125 press
keycode 125 press
keycode 125 press
keycode 125 press
keycode 125 press
keycode 125 release
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release
keycode 165 press
keycode 165 release


What else I tried: pressing all the touch-sensitive keys didn't stop the spam, but holding any of those keys stopped the spam at a `keycode 165 release`, this is how I'm able to exit showkeys because it auto-exits 10 seconds after nothing is pressed!
At login prompt or sudo password, the ^@ are visible, but not at command prompt(even though they are happening there too, they're just not visible - nothing it output, unless I logout, then I can see them continue at login prompt)! And it doesn't always spam ^@ (which is why I was able to type my user and the password to login), but it can come back after a few seconds.

I've even seen the s key stopped working temporarily and it came back to working again! At some point pressed s once and it kept repeating until I press d key once, then that stopped it.

Eventually I pressed Ctrl+Alt+Del to safely reboot and no issues in this boot.

So, I've no idea why/what triggers that touch-sensitive key into a spam mode, it doesn't seem to be anything physical (since Ctrl+Alt+Del can fix it, or it can cause it; ie. next reboot can trigger this or if it was already triggered it can usually "fix" it)
New issue: key 'o' decided to stop working and instead of rebooting or replugging the keyboard, I've looked for a software-only solution to emulate replugging it.

Thanks to `<semeion>` on freenode irc #archlinux channel for this usbreset.c program fixed key 'o' for me: https://web.archive.org/web/20190608212549/http://ix.io/1Lh8

So I'll keep using it whenever I encounter any of the above issues. Seems like a good enough software-only workaround.

Any further updates I'll be making in this gist: https://gist.github.com/howaboutsynergy/958d4929030f93416f36749980e33818#gistcomment-2938629
but there's basically not much else to say:)