Damn it, i forgot to attach :)) The problem is with the user :) I didn't intend this for cases where people have >2 mice, more simply I wanted to able to start gpm like this: gpm -t ps2 -m /dev/misc/psaux -M -t exps2 -m /dev/input/mice -M -t pnp -m /dev/tts/0 -M -t pnp -m /dev/tts/1 Hope you got the point: This way I don't have to know where the user's mouse is. I _know_ that the above won't work always (this was just a primitve example). But anyway... why not support more mice when it is so easy? On Sun, 30 Jun 2002, Nico Schottelius wrote: > either my mailer is broken or you forgot to attach a patch again. > > why should someone use more than 2 mice ? I've even never used two at a > time. I think people only have two hands to use them, don't they ? > > Nico > > Pozsar Balazs [Sun, Jun 16, 2002 at 02:56:34AM +0200]: > > Hi again! > > > > This patch makes gpm handle up to 8 mice. (arbitrary limit, by a #define). > > > > The opt_double varible is renamed to mice_count to make it consistent with > > it's meaning. > > I tested it with 4 mice connected, and works great. > > Two possible problems: > > - in src/gpm.c, around line 988 there's a 'FIXME??', beacuse it wasn't > > clear for me what the original code supposed to do different for > > the first and second mice, and why. But it works :) > > - during argument parsing it doesn't check if the MAX_MICE_COUNT is > > reached, so passing to much -M could make it segfault now. > > > > > > Comments welcome :) > > > > -- > > pozsy > > > > _______________________________________________ > > gpm mailing list > > gpm@xxxxxxxxxxxxxx > > http://lists.linux.it/listinfo/gpm > > > > -- > Please send your messages pgp-signed and/or pgp-encrypted (don't encrypt mails > to mailing list!). If you don't know what pgp is visit www.gnupg.org. > (public pgp key: ftp.schottelius.org/pub/familiy/nico/pgp-key) > -- pozsy
diff -Naur t3/src/gpm.c gpm-uhu/src/gpm.c --- t3/src/gpm.c Sat Feb 23 15:42:23 2002 +++ gpm-uhu/src/gpm.c Sun Jun 9 20:55:03 2002 @@ -63,7 +63,7 @@ * are copied data from mouse_table[0] for dual mouse operation. */ -struct mouse_features mouse_table[3] = { +struct mouse_features mouse_table[MAX_MICE_COUNT] = { { DEF_TYPE, DEF_DEV, DEF_SEQUENCE, DEF_BAUD, DEF_SAMPLE, DEF_DELTA, DEF_ACCEL, DEF_SCALE, 0 /* scaley */, @@ -77,10 +77,11 @@ /* These are only the 'global' options */ +int mice_count=1; char *opt_lut=DEF_LUT; int opt_test=DEF_TEST; int opt_ptrdrag=DEF_PTRDRAG; -int opt_repeater=0, opt_double=0; +int opt_repeater=0; char* opt_repeater_type = 0; int opt_aged = 0; char *opt_special=NULL; /* special commands, like reboot or such */ @@ -887,7 +888,7 @@ statusY = ePtr->y = ePtr->y * maxy / prevmaxy; } - for (i=1; i <= 1+opt_double; i++) { + for (i=1; i <= mice_count; i++) { which_mouse=mouse_table+i; /* used to access options */ /* * the following operation is based on the observation that 80x50 @@ -926,7 +927,7 @@ cmdline(argc, argv); /* parse command line */ atexit(gpm_exited); - for (i=1; i <= 1+opt_double; i++) { + for (i=1; i <= mice_count; i++) { which_mouse=mouse_table+i; /* used to access options */ if (!opt_dev) gpm_report(GPM_PR_OOPS,GPM_MESS_NEED_MDEV); @@ -988,7 +989,11 @@ FD_ZERO(&connSet); FD_SET(ctlfd,&connSet); - if (opt_double) FD_SET(mouse_table[2].fd,&connSet); +// FIXME?? This line looked like this, before gpm handled only two mice: +// -- I am not sure that the extrapolation is good. +// if (opt_double) FD_SET(mouse_table[2].fd,&connSet); + for (i=1; i <= mice_count; i++) + FD_SET(mouse_table[i].fd,&connSet); readySet=connSet; FD_SET(mouse_table[1].fd,&readySet); @@ -1061,7 +1065,7 @@ * lenghtening the file. This is not too clean a code, but it works.... */ - for (i=1; i <= 1+opt_double; i++) { + for (i=1; i <= mice_count; i++) { which_mouse=mouse_table+i; /* used to access options */ if (FD_ISSET(which_mouse->fd,&selSet)) { FD_CLR(which_mouse->fd,&selSet); pending--; diff -Naur t3/src/gpn.c gpm-uhu/src/gpn.c --- t3/src/gpn.c Sat Feb 23 15:42:23 2002 +++ gpm-uhu/src/gpn.c Sun Jun 9 20:46:55 2002 @@ -245,7 +245,8 @@ }; /* initialize for the dual mouse */ - mouse_table[2]=mouse_table[1]=mouse_table[0]; /* copy defaults */ + for (i=1; i<MAX_MICE_COUNT; i++) + mouse_table[i]=mouse_table[0]; /* copy defaults */ which_mouse=mouse_table+1; /* use the first */ while ((opt = getopt(argc, argv, options)) != -1) { @@ -266,11 +267,11 @@ case 'l': opt_lut=optarg; break; case 'm': opt_dev = optarg; break; case 'M': - opt_double++; + mice_count++; opt_repeater++; if (opt_repeater_type == 0) opt_repeater_type = "msc"; - which_mouse=mouse_table+2; break; + which_mouse=mouse_table+mice_count; break; case 'o': opt_options = optarg; break; case 'p': opt_ptrdrag=0; break; case 'r': @@ -312,7 +313,7 @@ /* duplicate initialization */ - for (i=1; i <= 1+opt_double; i++) { + for (i=1; i <= mice_count; i++) { which_mouse=mouse_table+i; /* used to access options */ if (opt_accel < 1) exit(usage("acceleration")); if (opt_delta < 2) exit(usage("delta")); diff -Naur t3/src/headers/gpmInt.h gpm-uhu/src/headers/gpmInt.h --- t3/src/headers/gpmInt.h Sat Feb 23 15:42:23 2002 +++ gpm-uhu/src/headers/gpmInt.h Sun Jun 9 20:47:15 2002 @@ -118,7 +118,9 @@ int fd; }; -extern struct mouse_features mouse_table[3], *which_mouse; /*the current one*/ +#define MAX_MICE_COUNT 8 + +extern struct mouse_features mouse_table[MAX_MICE_COUNT], *which_mouse; /*the current one*/ typedef struct Opt_struct_type {int a,B,d,i,p,r,V,A;} Opt_struct_type; @@ -142,11 +144,12 @@ /* the other variables */ +extern int mice_count; extern char *prgname; extern char *opt_lut; extern int opt_test, opt_ptrdrag; extern int opt_kill; -extern int opt_repeater, opt_double; +extern int opt_repeater; extern char* opt_repeater_type; extern int opt_kernel, opt_explicittype; extern int opt_aged;