Skip to content
This repository has been archived by the owner on Dec 23, 2020. It is now read-only.

Ubuntu 16.04.1: keys repeated till infinite #20

Open
Lurgainn opened this issue Apr 18, 2017 · 6 comments
Open

Ubuntu 16.04.1: keys repeated till infinite #20

Lurgainn opened this issue Apr 18, 2017 · 6 comments

Comments

@Lurgainn
Copy link

With my Logitech G510 keyboard, I used gnome15 for years with the original software 0.9.8 from russo79. It was all OK till Ubuntu 14.04.1 included.
When I upgraded to Ubuntu 16.04.1, this problem started immediately. The problem is perfectly reproducible in a lot of way, for example:

  1. I open Mousepad
  2. I begin to write some sentences, typing rapidly
  3. Into the window of Mousepad I can see the first 10 or 20 or max. 30 letters (not these exact numbers, obviously)
  4. then the writing freeze for about 1/2 sec. and then the last pressed key is repeated without any pause, exactly the same as I continue to press it (it's exactly like the auto-repeat).

I upgraded gnome15 to the 0.10.2 version and also to this last commit of 11 days ago, but the problem is always the same.
If I disable the service for this keyboard, I can use it without any problem, but obviously I can't use any specific features of the G510.

Is there someone that use a G510 with gnome15 in Ubuntu 16.04.1 without problems? Anyway, any suggestion how to debug/resolve my problem?
Thanks very much foe any help.

@dexteradeus
Copy link

dexteradeus commented Nov 12, 2017

I am having the same issue with the g510 on ubuntu 17.10. If keys are typed too fast, either the keyboard will just lock up and be unresponsive, or the last key pressed with repeat indefinitely. In both cases, the only way to recover is to unplug the keyboard and restart the desktop service.

@Lurgainn
Copy link
Author

Lurgainn commented Nov 12, 2017

I did some test and I suppose that the bug could be into the pylibg15.py/libg15.so. I wrote this little code below for my G510, simply to change the led's color to green, and immediately the same issue happened.
The thing that I can't understand is: we are the only guys with this problem or none is ever using the gnome15 project????
I would like to know if Huskynarr is still using all this software.

#!/usr/bin/python
# -*- coding: utf-8 *-*
#

try :
	import pylibg15
except Exception as a:
	print("Exception while importing pylibg15")
	exit

pylibg15.set_debug(1)

try:
	ret = pylibg15.init(True, 1133, 49709)
except Exception as a:
	print("Exception while init pylibg15")
	exit

if ret != pylibg15.G15_NO_ERROR:
	print("Error while init pylibg15")
	exit

color = [0, 255, 0]
pylibg15.set_keyboard_color(color)
pylibg15.set_keyboard_brightness(2)

ret = pylibg15.exit()
print(ret)`

@dexteradeus
Copy link

I've spent some time digging around and the issue seems to stem from libg15 where it calls usb_interrupt_read(). It hangs on that call despite the timeout provided. The proper fix would be to port libg15-gnome15 from libusb-0.1 to libusb-1.0 since ubuntu doesn't provide the compatibility layer like other distros, but that is beyond my skillset.

@Lurgainn
Copy link
Author

The proper fix would be to port libg15-gnome15 from libusb-0.1 to libusb-1.0 since ubuntu doesn't provide the compatibility layer

This was my primary suspect, but I'm not so sure because I compiled and installed libusb-compat-0.1 and the bug is just slightly changed.
The keyboard hangs and the last key is still repeated till infinite, but when I use my script (see below) to stop and restart the service (with the original libusb-0.1 it was effective), the keyboard remain completely off like disconnected from usb. I have to physically disconnect and connect again the keyboard to reuse it.

# Check if g15-desktop-service is running
ps -A | grep g15-desktop-ser >/dev/null

if [ $? == 0 ]
then
	pkill -9 g15-desktop-ser >/dev/null
	sleep 1
fi
xdg-open /etc/xdg/autostart/gnome15.desktop & >/dev/null

@Lurgainn
Copy link
Author

JUST FOUND A FIX!!!!!!
Modify the timeout value from 10 to 50 in the file gnome15/src/gnome15/drivers/pylibg15.py, row 66 and row 73.
So the two rows:
err = libg15.getPressedKeys(byref(pressed_keys), 10)
must be
err = libg15.getPressedKeys(byref(pressed_keys), 50)

It's a dirty patch, but now someone can commit a more refined patch.

@Lurgainn
Copy link
Author

However that timeout is very critical. Even with 50 msecs. very seldom I get the old bug, but at least now the keyboard is usable. I guess that the entire matter of mutex/timeout must be rethought.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants