You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/app-misc/g15daemon/files/g15daemon-1.9.5.3-g510-keys...

341 lines
14 KiB

From http://sourceforge.net/tracker/?func=detail&aid=3152167&group_id=167869&atid=844658
diff -aNru trunk/g15daemon-wip/plugins/g15_plugin_uinput.c mod/g15daemon-wip/plugins/g15_plugin_uinput.c
--- trunk/g15daemon-wip/plugins/g15_plugin_uinput.c 2011-06-26 06:50:50.000000000 +0000
+++ mod/g15daemon-wip/plugins/g15_plugin_uinput.c 2011-06-26 06:51:42.000000000 +0000
@@ -164,146 +164,195 @@
static void g15_process_keys(g15daemon_t *masterlist, unsigned int currentkeys, unsigned int lastkeys)
{
- /* 'G' keys */
- if((currentkeys & G15_KEY_G1) && !(lastkeys & G15_KEY_G1))
- keydown(GKEY_OFFSET);
- else if(!(currentkeys & G15_KEY_G1) && (lastkeys & G15_KEY_G1))
- keyup(GKEY_OFFSET);
-
- if((currentkeys & G15_KEY_G2) && !(lastkeys & G15_KEY_G2))
- keydown(GKEY_OFFSET+1);
- else if(!(currentkeys & G15_KEY_G2) && (lastkeys & G15_KEY_G2))
- keyup(GKEY_OFFSET+1);
-
- if((currentkeys & G15_KEY_G3) && !(lastkeys & G15_KEY_G3))
- keydown(GKEY_OFFSET+2);
- else if(!(currentkeys & G15_KEY_G3) && (lastkeys & G15_KEY_G3))
- keyup(GKEY_OFFSET+2);
-
- if((currentkeys & G15_KEY_G4) && !(lastkeys & G15_KEY_G4))
- keydown(GKEY_OFFSET+3);
- else if(!(currentkeys & G15_KEY_G4) && (lastkeys & G15_KEY_G4))
- keyup(GKEY_OFFSET+3);
-
- if((currentkeys & G15_KEY_G5) && !(lastkeys & G15_KEY_G5))
- keydown(GKEY_OFFSET+4);
- else if(!(currentkeys & G15_KEY_G5) && (lastkeys & G15_KEY_G5))
- keyup(GKEY_OFFSET+4);
-
- if((currentkeys & G15_KEY_G6) && !(lastkeys & G15_KEY_G6))
- keydown(GKEY_OFFSET+5);
- else if(!(currentkeys & G15_KEY_G6) && (lastkeys & G15_KEY_G6))
- keyup(GKEY_OFFSET+5);
-
- if((currentkeys & G15_KEY_G7) && !(lastkeys & G15_KEY_G7))
- keydown(GKEY_OFFSET+6);
- else if(!(currentkeys & G15_KEY_G7) && (lastkeys & G15_KEY_G7))
- keyup(GKEY_OFFSET+6);
-
- if((currentkeys & G15_KEY_G8) && !(lastkeys & G15_KEY_G8))
- keydown(GKEY_OFFSET+7);
- else if(!(currentkeys & G15_KEY_G8) && (lastkeys & G15_KEY_G8))
- keyup(GKEY_OFFSET+7);
-
- if((currentkeys & G15_KEY_G9) && !(lastkeys & G15_KEY_G9))
- keydown(GKEY_OFFSET+8);
- else if(!(currentkeys & G15_KEY_G9) && (lastkeys & G15_KEY_G9))
- keyup(GKEY_OFFSET+8);
-
- if((currentkeys & G15_KEY_G10) && !(lastkeys & G15_KEY_G10))
- keydown(GKEY_OFFSET+9);
- else if(!(currentkeys & G15_KEY_G10) && (lastkeys & G15_KEY_G10))
- keyup(GKEY_OFFSET+9);
-
- if((currentkeys & G15_KEY_G11) && !(lastkeys & G15_KEY_G11))
- keydown(GKEY_OFFSET+10);
- else if(!(currentkeys & G15_KEY_G11) && (lastkeys & G15_KEY_G11))
- keyup(GKEY_OFFSET+10);
-
- if((currentkeys & G15_KEY_G12) && !(lastkeys & G15_KEY_G12))
- keydown(GKEY_OFFSET+11);
- else if(!(currentkeys & G15_KEY_G12) && (lastkeys & G15_KEY_G12))
- keyup(GKEY_OFFSET+11);
-
- if((currentkeys & G15_KEY_G13) && !(lastkeys & G15_KEY_G13))
- keydown(GKEY_OFFSET+12);
- else if(!(currentkeys & G15_KEY_G13) && (lastkeys & G15_KEY_G13))
- keyup(GKEY_OFFSET+12);
-
- if((currentkeys & G15_KEY_G14) && !(lastkeys & G15_KEY_G14))
- keydown(GKEY_OFFSET+13);
- else if(!(currentkeys & G15_KEY_G14) && (lastkeys & G15_KEY_G14))
- keyup(GKEY_OFFSET+13);
-
- if((currentkeys & G15_KEY_G15) && !(lastkeys & G15_KEY_G15))
- keydown(GKEY_OFFSET+14);
- else if(!(currentkeys & G15_KEY_G15) && (lastkeys & G15_KEY_G15))
- keyup(GKEY_OFFSET+14);
-
- if((currentkeys & G15_KEY_G16) && !(lastkeys & G15_KEY_G16))
- keydown(GKEY_OFFSET+15);
- else if(!(currentkeys & G15_KEY_G16) && (lastkeys & G15_KEY_G16))
- keyup(GKEY_OFFSET+15);
-
- if((currentkeys & G15_KEY_G17) && !(lastkeys & G15_KEY_G17))
- keydown(GKEY_OFFSET+16);
- else if(!(currentkeys & G15_KEY_G17) && (lastkeys & G15_KEY_G17))
- keyup(GKEY_OFFSET+16);
-
- if((currentkeys & G15_KEY_G18) && !(lastkeys & G15_KEY_G18))
- keydown(GKEY_OFFSET+17);
- else if(!(currentkeys & G15_KEY_G18) && (lastkeys & G15_KEY_G18))
- keyup(GKEY_OFFSET+17);
-
- /* 'M' keys */
-
- if((currentkeys & G15_KEY_M1) && !(lastkeys & G15_KEY_M1))
- keydown(MKEY_OFFSET);
- else if(!(currentkeys & G15_KEY_M1) && (lastkeys & G15_KEY_M1))
- keyup(MKEY_OFFSET);
-
- if((currentkeys & G15_KEY_M2) && !(lastkeys & G15_KEY_M2))
- keydown(MKEY_OFFSET+1);
- else if(!(currentkeys & G15_KEY_M2) && (lastkeys & G15_KEY_M2))
- keyup(MKEY_OFFSET+1);
-
- if((currentkeys & G15_KEY_M3) && !(lastkeys & G15_KEY_M3))
- keydown(MKEY_OFFSET+2);
- else if(!(currentkeys & G15_KEY_M3) && (lastkeys & G15_KEY_M3))
- keyup(MKEY_OFFSET+2);
-
- if((currentkeys & G15_KEY_MR) && !(lastkeys & G15_KEY_MR))
- keydown(MKEY_OFFSET+3);
- else if(!(currentkeys & G15_KEY_MR) && (lastkeys & G15_KEY_MR))
- keyup(MKEY_OFFSET+3);
-
- if(map_Lkeys){
- /* 'L' keys... */
- if((currentkeys & G15_KEY_L1) && !(lastkeys & G15_KEY_L1))
- keydown(LKEY_OFFSET);
- else if(!(currentkeys & G15_KEY_L1) && (lastkeys & G15_KEY_L1))
- keyup(LKEY_OFFSET);
-
- if((currentkeys & G15_KEY_L2) && !(lastkeys & G15_KEY_L2))
- keydown(LKEY_OFFSET+1);
- else if(!(currentkeys & G15_KEY_L2) && (lastkeys & G15_KEY_L2))
- keyup(LKEY_OFFSET+1);
-
- if((currentkeys & G15_KEY_L3) && !(lastkeys & G15_KEY_L3))
- keydown(LKEY_OFFSET+2);
- else if(!(currentkeys & G15_KEY_L3) && (lastkeys & G15_KEY_L3))
- keyup(LKEY_OFFSET+2);
-
- if((currentkeys & G15_KEY_L4) && !(lastkeys & G15_KEY_L4))
- keydown(LKEY_OFFSET+3);
- else if(!(currentkeys & G15_KEY_L4) && (lastkeys & G15_KEY_L4))
- keyup(LKEY_OFFSET+3);
-
- if((currentkeys & G15_KEY_L5) && !(lastkeys & G15_KEY_L5))
- keydown(LKEY_OFFSET+4);
- else if(!(currentkeys & G15_KEY_L5) && (lastkeys & G15_KEY_L5))
- keyup(LKEY_OFFSET+4);
+ if(!(currentkeys & G15_KEY_LIGHT))
+ {
+ /* 'G' keys */
+ if((currentkeys & G15_KEY_G1) && !(lastkeys & G15_KEY_G1))
+ keydown(GKEY_OFFSET);
+ else if(!(currentkeys & G15_KEY_G1) && (lastkeys & G15_KEY_G1))
+ keyup(GKEY_OFFSET);
+
+ if((currentkeys & G15_KEY_G2) && !(lastkeys & G15_KEY_G2))
+ keydown(GKEY_OFFSET+1);
+ else if(!(currentkeys & G15_KEY_G2) && (lastkeys & G15_KEY_G2))
+ keyup(GKEY_OFFSET+1);
+
+ if((currentkeys & G15_KEY_G3) && !(lastkeys & G15_KEY_G3))
+ keydown(GKEY_OFFSET+2);
+ else if(!(currentkeys & G15_KEY_G3) && (lastkeys & G15_KEY_G3))
+ keyup(GKEY_OFFSET+2);
+
+ if((currentkeys & G15_KEY_G4) && !(lastkeys & G15_KEY_G4))
+ keydown(GKEY_OFFSET+3);
+ else if(!(currentkeys & G15_KEY_G4) && (lastkeys & G15_KEY_G4))
+ keyup(GKEY_OFFSET+3);
+
+ if((currentkeys & G15_KEY_G5) && !(lastkeys & G15_KEY_G5))
+ keydown(GKEY_OFFSET+4);
+ else if(!(currentkeys & G15_KEY_G5) && (lastkeys & G15_KEY_G5))
+ keyup(GKEY_OFFSET+4);
+
+ if((currentkeys & G15_KEY_G6) && !(lastkeys & G15_KEY_G6))
+ keydown(GKEY_OFFSET+5);
+ else if(!(currentkeys & G15_KEY_G6) && (lastkeys & G15_KEY_G6))
+ keyup(GKEY_OFFSET+5);
+
+ if((currentkeys & G15_KEY_G7) && !(lastkeys & G15_KEY_G7))
+ keydown(GKEY_OFFSET+6);
+ else if(!(currentkeys & G15_KEY_G7) && (lastkeys & G15_KEY_G7))
+ keyup(GKEY_OFFSET+6);
+
+ if((currentkeys & G15_KEY_G8) && !(lastkeys & G15_KEY_G8))
+ keydown(GKEY_OFFSET+7);
+ else if(!(currentkeys & G15_KEY_G8) && (lastkeys & G15_KEY_G8))
+ keyup(GKEY_OFFSET+7);
+
+ if((currentkeys & G15_KEY_G9) && !(lastkeys & G15_KEY_G9))
+ keydown(GKEY_OFFSET+8);
+ else if(!(currentkeys & G15_KEY_G9) && (lastkeys & G15_KEY_G9))
+ keyup(GKEY_OFFSET+8);
+
+ if((currentkeys & G15_KEY_G10) && !(lastkeys & G15_KEY_G10))
+ keydown(GKEY_OFFSET+9);
+ else if(!(currentkeys & G15_KEY_G10) && (lastkeys & G15_KEY_G10))
+ keyup(GKEY_OFFSET+9);
+
+ if((currentkeys & G15_KEY_G11) && !(lastkeys & G15_KEY_G11))
+ keydown(GKEY_OFFSET+10);
+ else if(!(currentkeys & G15_KEY_G11) && (lastkeys & G15_KEY_G11))
+ keyup(GKEY_OFFSET+10);
+
+ if((currentkeys & G15_KEY_G12) && !(lastkeys & G15_KEY_G12))
+ keydown(GKEY_OFFSET+11);
+ else if(!(currentkeys & G15_KEY_G12) && (lastkeys & G15_KEY_G12))
+ keyup(GKEY_OFFSET+11);
+
+ if((currentkeys & G15_KEY_G13) && !(lastkeys & G15_KEY_G13))
+ keydown(GKEY_OFFSET+12);
+ else if(!(currentkeys & G15_KEY_G13) && (lastkeys & G15_KEY_G13))
+ keyup(GKEY_OFFSET+12);
+
+ if((currentkeys & G15_KEY_G14) && !(lastkeys & G15_KEY_G14))
+ keydown(GKEY_OFFSET+13);
+ else if(!(currentkeys & G15_KEY_G14) && (lastkeys & G15_KEY_G14))
+ keyup(GKEY_OFFSET+13);
+
+ if((currentkeys & G15_KEY_G15) && !(lastkeys & G15_KEY_G15))
+ keydown(GKEY_OFFSET+14);
+ else if(!(currentkeys & G15_KEY_G15) && (lastkeys & G15_KEY_G15))
+ keyup(GKEY_OFFSET+14);
+
+ if((currentkeys & G15_KEY_G16) && !(lastkeys & G15_KEY_G16))
+ keydown(GKEY_OFFSET+15);
+ else if(!(currentkeys & G15_KEY_G16) && (lastkeys & G15_KEY_G16))
+ keyup(GKEY_OFFSET+15);
+
+ if((currentkeys & G15_KEY_G17) && !(lastkeys & G15_KEY_G17))
+ keydown(GKEY_OFFSET+16);
+ else if(!(currentkeys & G15_KEY_G17) && (lastkeys & G15_KEY_G17))
+ keyup(GKEY_OFFSET+16);
+
+ if((currentkeys & G15_KEY_G18) && !(lastkeys & G15_KEY_G18))
+ keydown(GKEY_OFFSET+17);
+ else if(!(currentkeys & G15_KEY_G18) && (lastkeys & G15_KEY_G18))
+ keyup(GKEY_OFFSET+17);
+
+ /* 'M' keys */
+
+ if((currentkeys & G15_KEY_M1) && !(lastkeys & G15_KEY_M1))
+ keydown(MKEY_OFFSET);
+ else if(!(currentkeys & G15_KEY_M1) && (lastkeys & G15_KEY_M1))
+ keyup(MKEY_OFFSET);
+
+ if((currentkeys & G15_KEY_M2) && !(lastkeys & G15_KEY_M2))
+ keydown(MKEY_OFFSET+1);
+ else if(!(currentkeys & G15_KEY_M2) && (lastkeys & G15_KEY_M2))
+ keyup(MKEY_OFFSET+1);
+
+ if((currentkeys & G15_KEY_M3) && !(lastkeys & G15_KEY_M3))
+ keydown(MKEY_OFFSET+2);
+ else if(!(currentkeys & G15_KEY_M3) && (lastkeys & G15_KEY_M3))
+ keyup(MKEY_OFFSET+2);
+
+ if((currentkeys & G15_KEY_MR) && !(lastkeys & G15_KEY_MR))
+ keydown(MKEY_OFFSET+3);
+ else if(!(currentkeys & G15_KEY_MR) && (lastkeys & G15_KEY_MR))
+ keyup(MKEY_OFFSET+3);
+
+ if(map_Lkeys){
+ /* 'L' keys... */
+ if((currentkeys & G15_KEY_L1) && !(lastkeys & G15_KEY_L1))
+ keydown(LKEY_OFFSET);
+ else if(!(currentkeys & G15_KEY_L1) && (lastkeys & G15_KEY_L1))
+ keyup(LKEY_OFFSET);
+
+ if((currentkeys & G15_KEY_L2) && !(lastkeys & G15_KEY_L2))
+ keydown(LKEY_OFFSET+1);
+ else if(!(currentkeys & G15_KEY_L2) && (lastkeys & G15_KEY_L2))
+ keyup(LKEY_OFFSET+1);
+
+ if((currentkeys & G15_KEY_L3) && !(lastkeys & G15_KEY_L3))
+ keydown(LKEY_OFFSET+2);
+ else if(!(currentkeys & G15_KEY_L3) && (lastkeys & G15_KEY_L3))
+ keyup(LKEY_OFFSET+2);
+
+ if((currentkeys & G15_KEY_L4) && !(lastkeys & G15_KEY_L4))
+ keydown(LKEY_OFFSET+3);
+ else if(!(currentkeys & G15_KEY_L4) && (lastkeys & G15_KEY_L4))
+ keyup(LKEY_OFFSET+3);
+
+ if((currentkeys & G15_KEY_L5) && !(lastkeys & G15_KEY_L5))
+ keydown(LKEY_OFFSET+4);
+ else if(!(currentkeys & G15_KEY_L5) && (lastkeys & G15_KEY_L5))
+ keyup(LKEY_OFFSET+4);
+ }
}
+ else
+ {
+ // G15_KEY_LIGHT - Key modifier for Logitech G510 Media Keys implementation
+
+ // XF86AudioPlay
+ if((currentkeys & G15_KEY_G1) && !(lastkeys & G15_KEY_G1))
+ keydown(KEY_PLAYPAUSE);
+ else if(!(currentkeys & G15_KEY_G1) && (lastkeys & G15_KEY_G1))
+ keyup(KEY_PLAYPAUSE);
+
+ // XF86AudioStop
+ if((currentkeys & G15_KEY_G2) && !(lastkeys & G15_KEY_G2))
+ keydown(KEY_STOPCD);
+ else if(!(currentkeys & G15_KEY_G2) && (lastkeys & G15_KEY_G2))
+ keyup(KEY_STOPCD);
+
+ // XF86AudioPrev
+ if((currentkeys & G15_KEY_G3) && !(lastkeys & G15_KEY_G3))
+ keydown(KEY_PREVIOUSSONG);
+ else if(!(currentkeys & G15_KEY_G3) && (lastkeys & G15_KEY_G3))
+ keyup(KEY_PREVIOUSSONG);
+
+ // XF86AudioNext
+ if((currentkeys & G15_KEY_G4) && !(lastkeys & G15_KEY_G4))
+ keydown(KEY_NEXTSONG);
+ else if(!(currentkeys & G15_KEY_G4) && (lastkeys & G15_KEY_G4))
+ keyup(KEY_NEXTSONG);
+
+ // XF86AudioMute
+ if((currentkeys & G15_KEY_G5) && !(lastkeys & G15_KEY_G5))
+ keydown(KEY_MUTE);
+ else if(!(currentkeys & G15_KEY_G5) && (lastkeys & G15_KEY_G5))
+ keyup(KEY_MUTE);
+
+ // XF86AudioRaiseVolume
+ if((currentkeys & G15_KEY_G6) && !(lastkeys & G15_KEY_G6))
+ keydown(KEY_VOLUMEUP);
+ else if(!(currentkeys & G15_KEY_G6) && (lastkeys & G15_KEY_G6))
+ keyup(KEY_VOLUMEUP);
+
+ // XF86AudioLowerVolume
+ if((currentkeys & G15_KEY_G7) && !(lastkeys & G15_KEY_G7))
+ keydown(KEY_VOLUMEDOWN);
+ else if(!(currentkeys & G15_KEY_G7) && (lastkeys & G15_KEY_G7))
+ keyup(KEY_VOLUMEDOWN);
+ }
}