Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -Nuar g15daemon-1.9.5.3.orig/g15daemon/utility_funcs.c g15daemon-1.9.5.3/g15daemon/utility_funcs.c
- --- g15daemon-1.9.5.3.orig/g15daemon/utility_funcs.c 2008-01-26 07:02:07.000000000 +0200
- +++ g15daemon-1.9.5.3/g15daemon/utility_funcs.c 2011-11-09 09:19:43.000000000 +0200
- @@ -356,7 +356,7 @@
- config_items_t * item=NULL;
- char line[1024];
- - config_fd = open(filename,O_CREAT|O_RDWR|O_TRUNC);
- + config_fd = open(filename,O_CREAT|O_RDWR|O_TRUNC, 0644);
- if(config_fd){
- snprintf(line,1024,"# G15Daemon Configuration File\n# any items entered before a [section] header\n# will be in the Global config space\n# comments you wish to keep should start with a semicolon';'\n");
- write(config_fd,line,strlen(line));
- --- g15daemon-1.9.5.3.orig/libg15daemon_client/g15daemon_net.c
- +++ g15daemon-1.9.5.3/libg15daemon_client/g15daemon_net.c
- @@ -217,7 +217,7 @@
- if(poll(pfd,1,100)>0){
- if(pfd[0].revents & POLLPRI && !(pfd[0].revents & POLLERR || pfd[0].revents & POLLHUP || pfd[0].revents & POLLNVAL)) {
- memset(packet,0,sizeof(packet));
- - msgret = recv(sock, packet, 10 , MSG_OOB);
- + msgret = recv(sock, packet, sizeof(packet) , MSG_OOB);
- if (msgret < 1) {
- return -1;
- }
- --- a/plugins/g15_plugin_uinput.c 2008-01-24 12:51:07.000000000 +0000
- +++ b/plugins/g15_plugin_uinput.c 2015-02-19 20:07:05.367774209 +0000
- @@ -43,9 +43,16 @@
- #include <libg15.h>
- +static char cmd[256];
- static int uinp_fd = -1;
- static config_section_t *uinput_cfg=NULL;
- static int map_Lkeys = 0;
- +static int vol_state = 0;
- +static int mkey_state = 0;
- +static int mr_state = 0;
- +static unsigned int mled_state = G15_LED_M1;
- +/*mkey state 0,1 and 2 = M1, M2 and M3*/
- +
- #define GKEY_OFFSET 167
- #define MKEY_OFFSET 185
- @@ -125,6 +132,16 @@
- event.value = G15KEY_DOWN;
- write (uinp_fd, &event, sizeof(event));
- +
- + /* Need to write sync event */
- + memset(&event, 0, sizeof(event));
- +
- + event.type = EV_SYN;
- + event.code = SYN_REPORT;
- + event.value = 0;
- +
- + write(uinp_fd, &event, sizeof(event));
- +
- }
- static void g15_uinput_keyup(unsigned char code)
- @@ -137,8 +154,17 @@
- event.value = G15KEY_UP;
- write (uinp_fd, &event, sizeof(event));
- -}
- + /* Need to write sync event */
- + memset(&event, 0, sizeof(event));
- +
- + event.type = EV_SYN;
- + event.code = SYN_REPORT;
- + event.value = 0;
- +
- + write(uinp_fd, &event, sizeof(event));
- +
- +}
- void (*keyup)(unsigned char code) = &g15_uinput_keyup;
- void (*keydown)(unsigned char code) = &g15_uinput_keydown;
- #else
- @@ -147,148 +173,338 @@
- #endif
- #endif
- +/*The layout of the 'G' keys is now hard-coded here below. See /usr/include/linux/input.h for details on the keys you can use*/
- 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))
- + {
- +if((currentkeys & G15_KEY_G1) && !(lastkeys & G15_KEY_G1))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G1 on %d", mkey_state);
- + system(cmd);
- + }
- +else if(!(currentkeys & G15_KEY_G1) && (lastkeys & G15_KEY_G1))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G1 off %d", mkey_state);
- + system(cmd);
- + }
- +
- +if((currentkeys & G15_KEY_G2) && !(lastkeys & G15_KEY_G2))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G2 on %d", mkey_state);
- + system(cmd);
- + }
- +else if(!(currentkeys & G15_KEY_G2) && (lastkeys & G15_KEY_G2))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G2 off %d", mkey_state);
- + system(cmd);
- + }
- +
- +if((currentkeys & G15_KEY_G3) && !(lastkeys & G15_KEY_G3))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G3 on %d", mkey_state);
- + system(cmd);
- + }
- +else if(!(currentkeys & G15_KEY_G3) && (lastkeys & G15_KEY_G3))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G3 off %d", mkey_state);
- + system(cmd);
- + }
- +
- +if((currentkeys & G15_KEY_G4) && !(lastkeys & G15_KEY_G4))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G4 on %d", mkey_state);
- + system(cmd);
- + }
- +else if(!(currentkeys & G15_KEY_G4) && (lastkeys & G15_KEY_G4))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G4 off %d", mkey_state);
- + system(cmd);
- + }
- +
- +if((currentkeys & G15_KEY_G5) && !(lastkeys & G15_KEY_G5))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G5 on %d", mkey_state);
- + system(cmd);
- + }
- +else if(!(currentkeys & G15_KEY_G5) && (lastkeys & G15_KEY_G5))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G5 off %d", mkey_state);
- + system(cmd);
- + }
- +
- +if((currentkeys & G15_KEY_G6) && !(lastkeys & G15_KEY_G6))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G6 on %d", mkey_state);
- + system(cmd);
- + }
- +else if(!(currentkeys & G15_KEY_G6) && (lastkeys & G15_KEY_G6))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G6 off %d", mkey_state);
- + system(cmd);
- + }
- +
- +if((currentkeys & G15_KEY_G7) && !(lastkeys & G15_KEY_G7))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G7 on %d", mkey_state);
- + system(cmd);
- + }
- +else if(!(currentkeys & G15_KEY_G7) && (lastkeys & G15_KEY_G7))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G7 off %d", mkey_state);
- + system(cmd);
- + }
- +
- +if((currentkeys & G15_KEY_G8) && !(lastkeys & G15_KEY_G8))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G8 on %d", mkey_state);
- + system(cmd);
- + }
- +else if(!(currentkeys & G15_KEY_G8) && (lastkeys & G15_KEY_G8))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G8 off %d", mkey_state);
- + system(cmd);
- + }
- +
- +if((currentkeys & G15_KEY_G9) && !(lastkeys & G15_KEY_G9))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G9 on %d", mkey_state);
- + system(cmd);
- + }
- +else if(!(currentkeys & G15_KEY_G9) && (lastkeys & G15_KEY_G9))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G9 off %d", mkey_state);
- + system(cmd);
- + }
- +
- +if((currentkeys & G15_KEY_G10) && !(lastkeys & G15_KEY_G10))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G10 on %d", mkey_state);
- + system(cmd);
- + }
- +else if(!(currentkeys & G15_KEY_G10) && (lastkeys & G15_KEY_G10))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G10 off %d", mkey_state);
- + system(cmd);
- + }
- +
- +if((currentkeys & G15_KEY_G11) && !(lastkeys & G15_KEY_G11))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G11 on %d", mkey_state);
- + system(cmd);
- }
- +else if(!(currentkeys & G15_KEY_G11) && (lastkeys & G15_KEY_G11))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G11 off %d", mkey_state);
- + system(cmd);
- + }
- +
- +if((currentkeys & G15_KEY_G12) && !(lastkeys & G15_KEY_G12))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G12 on %d", mkey_state);
- + system(cmd);
- + }
- +else if(!(currentkeys & G15_KEY_G12) && (lastkeys & G15_KEY_G12))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G12 off %d", mkey_state);
- + system(cmd);
- + }
- +
- +if((currentkeys & G15_KEY_G13) && !(lastkeys & G15_KEY_G13))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G13 on %d", mkey_state);
- + system(cmd);
- + }
- +else if(!(currentkeys & G15_KEY_G13) && (lastkeys & G15_KEY_G13))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G13 off %d", mkey_state);
- + system(cmd);
- + }
- +
- +if((currentkeys & G15_KEY_G14) && !(lastkeys & G15_KEY_G14))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G14 on %d", mkey_state);
- + system(cmd);
- + }
- +else if(!(currentkeys & G15_KEY_G14) && (lastkeys & G15_KEY_G14))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G14 off %d", mkey_state);
- + system(cmd);
- + }
- +
- +if((currentkeys & G15_KEY_G15) && !(lastkeys & G15_KEY_G15))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G15 on %d", mkey_state);
- + system(cmd);
- + }
- +else if(!(currentkeys & G15_KEY_G15) && (lastkeys & G15_KEY_G15))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G15 off %d", mkey_state);
- + system(cmd);
- + }
- +
- +if((currentkeys & G15_KEY_G16) && !(lastkeys & G15_KEY_G16))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G16 on %d", mkey_state);
- + system(cmd);
- + }
- +else if(!(currentkeys & G15_KEY_G16) && (lastkeys & G15_KEY_G16))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G16 off %d", mkey_state);
- + system(cmd);
- + }
- +
- +if((currentkeys & G15_KEY_G17) && !(lastkeys & G15_KEY_G17))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G17 on %d", mkey_state);
- + system(cmd);
- + }
- +else if(!(currentkeys & G15_KEY_G17) && (lastkeys & G15_KEY_G17))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G17 off %d", mkey_state);
- + system(cmd);
- + }
- +
- +if((currentkeys & G15_KEY_G18) && !(lastkeys & G15_KEY_G18))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G18 on %d", mkey_state);
- + system(cmd);
- + }
- +else if(!(currentkeys & G15_KEY_G18) && (lastkeys & G15_KEY_G18))
- + { snprintf(cmd, sizeof cmd,
- + "sudo -H -u '#1000' /usr/share/g15daemon/macros/G18 off %d", mkey_state);
- + system(cmd);
- + }
- +
- + /* 'M' keys... */
- +
- + if((currentkeys & G15_KEY_M1) && !(lastkeys & G15_KEY_M1))
- + //keydown(MKEY_OFFSET);
- + mkey_state = 0;
- + /*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);
- + mkey_state = 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);
- + mkey_state = 2;
- + /*else if(!(currentkeys & G15_KEY_M3) && (lastkeys & G15_KEY_M3))
- + keyup(MKEY_OFFSET+2);*/
- +
- + if((currentkeys & G15_KEY_MR) && !(lastkeys & G15_KEY_MR) && mr_state == 0){
- + mr_state = 1;
- + system("sudo -H -u '#1000' /usr/share/g15daemon/macros/MacroRecord on & disown");
- + }
- + else if(!(currentkeys & G15_KEY_MR) && (lastkeys & G15_KEY_MR) && mr_state == 1){
- + /*Toggle function on first key release*/
- + }
- + else if((currentkeys & G15_KEY_MR) && !(lastkeys & G15_KEY_MR) && mr_state == 1){
- + mr_state = 0;
- + system("sudo -H -u '#1000' /usr/share/g15daemon/macros/MacroRecord off & disown");
- + }
- + else if(!(currentkeys & G15_KEY_MR) && (lastkeys & G15_KEY_MR) && mr_state == 0){
- + /*Úntoggle function on second key release*/
- + }
- +
- + 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);
- +
- + // XF86AudioRaise/LowerVolume (this was a pain to figure out, i dropped it at one point while it was semi-functioning and fixed it later)
- + if(((currentkeys & G15_KEY_G6) && !(lastkeys & G15_KEY_G6)) && (vol_state == 0 || vol_state == 1)){
- + keydown(KEY_VOLUMEUP);
- + vol_state = 1;
- + }
- + else if(((currentkeys & G15_KEY_G7) && !(lastkeys & G15_KEY_G7)) && (vol_state == 0 || vol_state == 2)){
- + keydown(KEY_VOLUMEDOWN);
- + vol_state = 2;
- + }
- + else if((!(currentkeys & G15_KEY_G6) || !(currentkeys & G15_KEY_G7)) && ((lastkeys & G15_KEY_G7) || (lastkeys & G15_KEY_G6))){
- + keyup(KEY_VOLUMEUP);
- + keyup(KEY_VOLUMEDOWN);
- + vol_state = 0;
- + }
- + }
- +/*Set led states per M key (Doing this in the switch was slow and didn't activate till after button release)*/
- + if(mkey_state == 0)
- + mled_state = G15_LED_M1;
- + else if(mkey_state == 1)
- + mled_state = G15_LED_M2;
- + else if(mkey_state == 2)
- + mled_state = G15_LED_M3;
- +
- +/*Set leds and toggle MR led depending on mr_state*/
- + if(mr_state == 0)
- + setLEDs(mled_state -0x20);
- + else if(mr_state == 1)
- + setLEDs(mled_state -0x20 | G15_LED_MR -0x20);
- +
- }
- --- a/contrib/xmodmaprc 2008-01-24 12:51:08.000000000 +0000
- +++ b/contrib/xmodmaprc 2013-04-11 15:25:26.000000000 +0000
- @@ -3,7 +3,7 @@
- keycode 130 = XF86Launch9
- keycode 131 = XF86Launch2
- keycode 132 = XF86Phone
- -keycode 133 = XF86Messenger
- +keycode 133 = Super_L
- keycode 136 = XF86LaunchD
- keycode 137 = XF86Support
- keycode 138 = XF86Word
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement