You are not logged in.

#1 2013-04-05 06:24:46

rabcor
Banned
Registered: 2013-02-09
Posts: 500

[Solved]Logitech G510 Keyboard

Edit: I created a proper guide for this here. Thats where you wnat to go if you're trying to make this keyboard work.

I've got a logitech G510 keyboard (one of those gaming keyboardw tih LCD panels and macro keys, etc.) i've been trying to get it working now. for the first time i was modifying the source of a package i was compiling, it turns out my keyboard isn't officially supported by "libg15" which is the AUR package i need to make it work (along with "libg15render" and "g15daemon", but "libg15" is the only one i think i need to modify)

I read that i had to add this line to libg15.c

DEVICE("Logitech G510 Gaming Keyboard",0x46d,0xc22e, G15_LCD|G15_KEYS|G15_DEVICE_5BYTE_RETURN|G15_DEVICE_IS_SHARED),

Near the start of the code which i successfully did. However the daemon doesn't detect my keyboard even if it looks for it. I have a suspicion it is this part here -> 0x46d,0xc22e

That went wrong somewhere for me. Thats just the hunch i have about all this. and that's probably because that's the only part of the code i don't know what is. Also it looks like the only part of the code that could've gone wrong to me in that context.

How do i find out the value i need to have where i put "0x46d,0xc22e" (which i'm guessing is some sort of identifier for the USB Keyboard) or if you think that's not the problem, what do you think might be?

The G15 Daemon gives me that it doesn't find any supported devices. and shows me a list of what it looked for (so i know it did look for the one i entered)

This is where i found the line i had to enter.

Last edited by rabcor (2014-06-03 10:55:02)

Offline

#2 2013-04-07 01:19:08

rabcor
Banned
Registered: 2013-02-09
Posts: 500

Re: [Solved]Logitech G510 Keyboard

A whole lot of trouble later...

Last edited by rabcor (2013-04-13 00:16:04)

Offline

#3 2013-04-13 01:00:40

rabcor
Banned
Registered: 2013-02-09
Posts: 500

Re: [Solved]Logitech G510 Keyboard

Now i've managed to hardcode into the daemon all the things i want my G keys to do. ran into this and that problem along the way but finally managed to automate everything as much as my capabilities allow me to. i'm done with this for now.

I had to hardcode the things i want my G-keys to do into the uinput plugin file (after configuring libg15 to support my keyboard and then the g15daemon and libg15 for my media keys to work.) the reason i had to do this was because g15macro kindof screwed up my keyboard if i started it, it ruined all keybindings i had previously made for the media keys and any keybindings set by g15daemon (via xmodmap i think)

after a week of hard work in C which is a programming language i never touched until now.. hell i've only touched high level ones so far... i managed to get the board working at a level that i'm satisfied with. But i had an issue since i bound commands to open folders and to do a mouse click to some of the keys that if i started the daemon at bootup with systemd before X none of those said commands would work. (also for launching programs) this i hotfixed by restarting the daemon in .xinitrc by adding 2 lines

(sleep 0 && sudo g15daemon -k) 
(sleep 2 && sudo g15daemon)

(unsure if this is needed if you use a display manager, but i've been too lazy to install one)
and before that of course i had to put nopasswd in the sudoers file for the g15daemon.

Right now here are my only remaining bugs.

The vol+/- wheel behaves badly, it's very usable, but it's not perfect and sometimes lowers/highers the volume more than you wanted it to while turning. the key to making it work is scrolling the wheel slowly.

Scroll fast and it will just be mean to you.

my other bug is that until one of the extra keys (G1-18, M1-3 or MR or the multimedia keys) are pressed. the M leds don't light up. and well.. i thought it would be easy to make it set the led on on startup but... nope. not in a reliable way anyways that would make sure that the led wouldn't be diferent from the button toggled.

The MR led works just fine but since i have no skillz when it comes to C i didn't make a config file for anything, so to edit the keybindings that i hardcoded (as i said, hardcoded) i need to edit the source code, therefore without a config file using the MR button to record macros isn't very plausible... hardly even possible. but the led works and i thought about using it to toggle something (a friend suggested showing and hiding hidden folders and files that i locate on my desktop big_smile)

otherwise apart from some USB errors that don't seem to have any effect(those were there before i touched anything), everything seems to be running ideally and the board is even bettter (utility wise) than i ever made it on my windows setup.

Does anyone want the heavily modified/edited source?

Last edited by rabcor (2013-04-13 01:02:43)

Offline

#4 2013-05-16 17:13:25

eNTi
Member
Registered: 2006-04-30
Posts: 109

Re: [Solved]Logitech G510 Keyboard

i'm quite interested in that. since i got a g110 and for some time now not even my windows key is recognized any more, i was wondering about writing my own driver or looking at the libg15. would you mind posting your patches to the libg15 repository? looks like a viable contribution.

Offline

#5 2013-06-18 15:10:08

rabcor
Banned
Registered: 2013-02-09
Posts: 500

Re: [Solved]Logitech G510 Keyboard

(I think the answer to your question is the xmodmaprc in the g15daemon, not in libg15. using xev find what key is being picked up when you press your win key, and the keycode, then find it in xmodmaprc and edit it, theres another way to do this without modifying the drivers too but i forgot how)
It's been quite a while since i did this, but i think there was a patch specific for g110 floating around somewhere.

I've zipped the drivers up to a 7z file, credits should go to various people for this stuff, many people worked on it and i only modified it for my G510 to work properly with it (which took me a week due to unfamiliarity with C), and much of the ground work had already been done by various others while i just had to fit some pieces together.

In the zip you will find the made package for x86_64, the source and pkgbuild if you want to compile it yourself (or have 32 bit version) (remember that you have to change the md5sum in pkgbuild if you edit a file and bzip2 the source again) but you will not find the dependencies which will probably be written down in the pkgbuild.

The files that (i remember) were modified are (heaviest modified first)

Libg15 (base driver)
libg15.c
libg15.h

G15daemon (gives more direct control over the G keys and whatnot, i forgot.)
plugins/g15_plugin_uinput.c
/contrib/xmodmaprc


libg15render (untouched, but is a dependancy for g15daemon)

what i did

Libg15

libg15.c
Removed support for other keyboards.
Added support for the G510 media keys, backlight controls dependant of current M-led state and probably something more than that which i've forgotten.

libg15.h
I completely forgot what happened in here, most likely because most if not all the stuff edited in this file was from patches made by other people than myself. my memory is faulty on this since it's been a 2 months since i was working on this stuff, but i may have removed some lines that were specifically dedicated to other keyboards than the g510. those lines will still be in the AUR package.

G15daemon
coded in the patches that came with the aur package and updated pkgbuild.

g15_plugin_uinput.c
Hardcoded in custom keybinds for the G keys and enabled switching of layout by pressing M keys. Also enabled switching of Mkey leds and the MR key led. Fiddled with making the media keys work (they use the light key(modifier)+G1-G7 because the original driver didn't support the G510's media keys.) making the volume wheel work at a usable level was HELL. As any decent programmer i made some comments about added dependencies for my custom keybinds to work (for example mouse click emulation on a button needed 3rd party software to work) and other stuff.

xmodmaprc
I don't remember exactly what i did, i think it was related to making the windows/Meta key work though, it for some reason read the windows key as something else, can't remember what and i managed to fixx that in here if i recall correctly.



The reason i hardcoded my G keys was because g15macro seemed to mess upp all work i did in g15daemon . it destroyed my media keys and broke my windows key (again) thinking back now i could have modified the g15macro code to make it work instead, but since i don't need my MR key to work and i only use a specific set of macros on my G keys (to open folders/software and whatnot) this is just.. easier for me.

Known issues:
-M leds will not light up until after a G/M key is pressed, but the default is M1, i tried to fix it but gave up on it, it's not that important.

-Volume Wheel doesn't behave as well as i'd like it to, but i noticed after all this trouble that it isn't perfect in windows either (seems that logitech didn't do a much better job than i with it in windows either) it was hell to make it usable. it's the most retarded key on the keyboard.

-Scroll Lock LED doesn't work, but i noticed that this is more likely a Linux related issue than a driver one. (it doesn't seem to work on other keyboards either)
I don't know C (programming language) so much of my written code (for example the hard coded G keys) may look terribly ugly to someone who does. but bottom line is that it works as intended, and much better than it ever did with G15macro (it had tons of problems that were solved by hard-coding the keys, such as you had to press a key twice to make it work or whatnot)

-G keys occasionally don't detect when you release the key (hold the key down) there is little i could do to fix this but a way is to use only keypress(when you press the button down) down to perform the whole action/macro (so pressdown button and release button should happen when you press down the G key, rather than pressing down the G key to pressdown a button and then releasing the G key to release the button/s. the flaw with that method however is that i don't think you can hold down the g-key to make it hold down the key you're trying to press for longer than a second)

Because i may have sacrificed compatibility with many other G keyboards with my modifications, i removed support for them in libg15.c

const libg15_devices_t g15_devices[] = {
    DEVICE("Logitech G510",0x46d,0xc22d,G15_LCD|G15_KEYS|G15_DEVICE_IS_SHARED|G15_DEVICE_G510), /* without audio activated */
    DEVICE("Logitech G510",0x46d,0xc22e,G15_LCD|G15_KEYS|G15_DEVICE_IS_SHARED|G15_DEVICE_G510), /* with audio activated */
    DEVICE(NULL,0,0,0)
};

This is around line 45. that's where you can add a new "DEVICE("",X,X,X,X|X|X|X)," entry for your specific keyboard if you want to see what happens if you use these with your keyboard (don't expect it to work without making modifications of your own though).

If you have the same keyboard as i, or the drivers just so happen to wokr for you, i suggest you head over to the plugins/g15_plugin_uinput.c and find my G key code, they start around line 185. for convenience's sake as ugly as it may look i added comments to the beginning of each line stating which M-key the area you're editing is assigned to.

Around line 530 you'll find the media key entries if you want to mess with them or try to make the wheel work better (it's hell! don't go there!) If the keys aren't working properly for you, the keys were coded in from libg15.c originally, you may have to edit some entries in there to make it work (around line 940) you can also set the Backlight colors depending on current M-led in there (around line 570)

Lets see now i've covered how to edit the backlighting colors, how to fiddle with the media keys if you'd like and how to edit the G-key code. (you can use the code i already wrote as an example code, although what i wrote for m1's G13-g18 is fairly universal. G13 is close tab, g14 is kill, g15 is next tab, g18 is previous tab, g17 is open terminal and g16 is mouseclick which has a dependency)

So if you have another keyboard, i think you'll have better luck comparing my code to the unmodified code (which you can get from aur or the g15daemon sourceforge page) and modifying it yourself for your own keyboard if it wasn't working before. much of the code i made or copied from others is specifically made for g510, but i think the G-key hardcode can be used by anybody. (that is inside of g15_plugin_uinput.c) Good luck.

Last edited by rabcor (2013-06-21 18:37:23)

Offline

#6 2013-10-02 18:29:29

Ultrak1ll
Member
Registered: 2011-12-04
Posts: 7

Re: [Solved]Logitech G510 Keyboard

Thank you!
Got my G510 keyboard display working. Now will try to get the media keys working.

Offline

#7 2013-10-15 15:57:07

rabcor
Banned
Registered: 2013-02-09
Posts: 500

Re: [Solved]Logitech G510 Keyboard

Your welcome, glad to have helped! smile

Update: I encourage you to check the Gnome15 project if you're trying to make this keyboard work, i haven't used it myself (since i obviously see no need currently, but i might later) as an alternative to my hardcoded goodness.

Update2: I tried using Gnome15 with my G510,says "driver for G510 failed to load"... and here was hoping that i wouldn't actually have to tell it how to read my keyboard. I'm debating with myself whether i should check the source code for Gnome15 or stick with the g15tools i already had mostly working.

Update3: I found out i needed to be in a group to make the keyboard work, this stuff works, but i was in no way satisfied with it except that it has a nice user interface to work with for configurations. I'm going straight back to these drivers i've managed to make work here however, and i wil consider improving them and making them more user-friendly so i can share it with others.

Last edited by rabcor (2013-11-03 20:33:54)

Offline

#8 2014-02-04 07:02:34

rabcor
Banned
Registered: 2013-02-09
Posts: 500

Re: [Solved]Logitech G510 Keyboard

Found unlisted dependendency for libg15; "libusb-compat"  if it fails to build that's what's missing.

Offline

Board footer

Powered by FluxBB