From: "Robin H. Johnson (robbat2)" <robbat2@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] gentoo-x86 commit in dev-libs/libg15/files: g15tools.patch
Date: Fri, 12 Oct 2012 20:01:55 +0000 (UTC) [thread overview]
Message-ID: <20121012200155.B31EF20E47@flycatcher.gentoo.org> (raw)
robbat2 12/10/12 20:01:55
Added: g15tools.patch
Log:
Real working G510 support now, so my keyboard works. See also the libg15render and g15daemon bumps.
(Portage version: 2.2.0_alpha121/cvs/Linux x86_64)
Revision Changes Path
1.1 dev-libs/libg15/files/g15tools.patch
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-libs/libg15/files/g15tools.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-libs/libg15/files/g15tools.patch?rev=1.1&content-type=text/plain
Index: g15tools.patch
===================================================================
Patch from upstream bug tracker:
http://sourceforge.net/tracker/?func=detail&aid=3336448&group_id=167869&atid=844658
As only part of G510 support was merged to upstream. Does NOT apply & compile
on top of 1.2.7-r1.
diff -aNru trunk/libg15/libg15.c mod/libg15/libg15.c
--- trunk/libg15/libg15.c 2011-03-31 23:33:44.000000000 +0000
+++ mod/libg15/libg15.c 2011-06-26 07:08:21.000000000 +0000
@@ -1029,6 +1029,76 @@
}
}
+// Logitech G510 Media Keys implementation. Unknown if this will work for other
+// models. Using the backlight key as a modifier. The assumption is you would
+// normally not be holding down the backlight key while pressing G-keys.
+static void processKeyEvent2Byte(unsigned int *pressed_keys, unsigned char *buffer)
+{
+ // Key modifier
+ *pressed_keys |= G15_KEY_LIGHT;
+
+ // XF86AudioPlay
+ if (*pressed_keys & G15_KEY_G1)
+ *pressed_keys -= G15_KEY_G1;
+
+ // XF86AudioStop
+ if (*pressed_keys & G15_KEY_G2)
+ *pressed_keys -= G15_KEY_G2;
+
+ // XF86AudioPrev
+ if (*pressed_keys & G15_KEY_G3)
+ *pressed_keys -= G15_KEY_G3;
+
+ // XF86AudioNext
+ if (*pressed_keys & G15_KEY_G4)
+ *pressed_keys -= G15_KEY_G4;
+
+ // XF86AudioMute
+ if (*pressed_keys & G15_KEY_G5)
+ *pressed_keys -= G15_KEY_G5;
+
+ // XF86AudioRaiseVolume
+ if (*pressed_keys & G15_KEY_G6)
+ *pressed_keys -= G15_KEY_G6;
+
+ // XF86AudioLowerVolume
+ if (*pressed_keys & G15_KEY_G7)
+ *pressed_keys -= G15_KEY_G7;
+
+ g15_log(stderr,G15_LOG_WARN,"Keyboard: %x, %x\n", buffer[0], buffer[1]);
+
+ if (buffer[0] == 0x02)
+ {
+ // XF86AudioPlay
+ if (buffer[1] & 0x08)
+ *pressed_keys |= G15_KEY_G1;
+
+ // XF86AudioStop
+ if (buffer[1] & 0x04)
+ *pressed_keys |= G15_KEY_G2;
+
+ // XF86AudioPrev
+ if (buffer[1] & 0x02)
+ *pressed_keys |= G15_KEY_G3;
+
+ // XF86AudioNext
+ if (buffer[1] & 0x01)
+ *pressed_keys |= G15_KEY_G4;
+
+ // XF86AudioMute
+ if (buffer[1] & 0x16)
+ *pressed_keys |= G15_KEY_G5;
+
+ // XF86AudioRaiseVolume
+ if (buffer[1] & 0x32)
+ *pressed_keys |= G15_KEY_G6;
+
+ // XF86AudioLowerVolume
+ if (buffer[1] & 0x64)
+ *pressed_keys |= G15_KEY_G7;
+ }
+}
+
int getPressedKeys(unsigned int *pressed_keys, unsigned int timeout)
{
unsigned char buffer[G15_KEY_READ_LENGTH];
@@ -1063,6 +1133,13 @@
case 9:
processKeyEvent9Byte(pressed_keys, buffer);
return G15_NO_ERROR;
+ case 2:
+ if (g15DeviceCapabilities() & G15_DEVICE_G510)
+ {
+ processKeyEvent2Byte(pressed_keys, buffer);
+ return G15_NO_ERROR;
+ }
+ // Deliberate fallthrough
default:
return handle_usb_errors("Keyboard Read", ret); /* allow the app to deal with errors */
}
reply other threads:[~2012-10-12 20:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121012200155.B31EF20E47@flycatcher.gentoo.org \
--to=robbat2@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox