Hi! This is a patch against 1.20.0, and unfortunately doesn't apply to current cvs version because the m_imps2 function has changed. A4Tech dual-wheel mice send these bytes in imps2 mode: data[3]= 0xff first wheel up 0x01 first wheel down 0xfe second wheel up 0x02 second wheel down Current code translates both wheels as if the first wheel was scrolled, and doesn't even try to repeat them. Using this patch, when is -Rimps2 mode, X receives button4 and button5 events for scrooling the first wheel, and button6 and button7 events for the second, just as if you configured X to control the mice itself in IMPS/2 mode. Comments welcome :) ps: I haven't tried the current cvs, only looked at the source, but I think m_imps2/r_imps2 is messed up there... m_imps2 stores scrooling information (from data[3]) in state->wdx and state->wdy, while r_imps2 checks bits of state->buttons. Am I missing something? -- pozsy
diff -Naur gpm-1.20.0/src/headers/gpm.h gpm-torok/src/headers/gpm.h --- gpm-1.20.0/src/headers/gpm.h Sat Feb 23 15:42:23 2002 +++ gpm-torok/src/headers/gpm.h Sat Jun 1 20:28:34 2002 @@ -76,6 +76,8 @@ /*....................................... Cfg buttons */ +#define GPM_B_DOWN2 128 +#define GPM_B_UP2 64 #define GPM_B_DOWN 32 #define GPM_B_UP 16 #define GPM_B_FOURTH 8 diff -Naur gpm-1.20.0/src/mice.c gpm-torok/src/mice.c --- gpm-1.20.0/src/mice.c Sat Feb 23 15:42:23 2002 +++ gpm-torok/src/mice.c Sat Jun 1 22:28:18 2002 @@ -512,12 +512,13 @@ (dy > 0 ? 0x20 : 0); buffer[1] = dx & 0xFF; buffer[2] = (-dy) & 0xFF; - buffer[3] = - (state->buttons & GPM_B_UP ? -1 : 0) + - (state->buttons & GPM_B_DOWN ? 1 : 0); + buffer[3] = + (state->buttons & GPM_B_UP2 ? -2 : 0) + + (state->buttons & GPM_B_UP ? -1 : 0) + + (state->buttons & GPM_B_DOWN ? 1 : 0) + + (state->buttons & GPM_B_DOWN2 ? 2 : 0); return write(fd,buffer,4); - } static int M_logimsc(Gpm_Event *state, unsigned char *data) /* same as msc */ @@ -592,8 +609,23 @@ static int M_imps2(Gpm_Event *state, signed char *data) { int ret = M_ps2(state, data); - state->buttons |= (data[3]<0) * GPM_B_UP + (data[3]>0) * GPM_B_DOWN; - + if (data[3] == -2) + state->buttons |= GPM_B_UP2; + else + state->buttons &= ~GPM_B_UP2; + if (data[3] == -1) + state->buttons |= GPM_B_UP; + else + state->buttons &= ~GPM_B_UP; + if (data[3] == 0x01) + state->buttons |= GPM_B_DOWN; + else + state->buttons &= ~GPM_B_DOWN; + if (data[3] == 0x02) + state->buttons |= GPM_B_DOWN2; + else + state->buttons &= ~GPM_B_DOWN2; + return ret; }