Perhaps a simpler solution would be to use GenericPS/2 as your mouse type. Rob
> -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf > Of [EMAIL PROTECTED] > Sent: 02 April 2003 14:26 > To: [EMAIL PROTECTED] > Subject: [patch hack] against X taking ages for console switch > > > [Please CC me, I am not on this list.] > > After recently updating my XFree86 CVS to 4.3 branch and compiling it, > I notized that X needs ages for starting and console switches (VT -> X, > not X -> VT). > > It turned out that the major reason for that is the mouse driver which > tries 11 times to reset the mouse doing several hundred usleeps. > > Now, the actual trouble is due to the fact that I am using an IMPS/2 > mouse and GPM as repeater: > > --------<XF86Config>--------- > Section "InputDevice" > Driver "mouse" > Identifier "Mouse[1]" > Option "ButtonNumber" "5" > Option "Device" "/dev/gpmdata" <-- GPM > Option "Name" "WheelMouse" > Option "Protocol" "ImPS/2" > Option "ZAxisMapping" "4 5" > Option "CorePointer" > Option "SkipInit" "1" <-- see patch below > EndSection > ----------------------------- > > When switching from VT to X console, XFree86 opens /dev/gpmdata > and wants to configrure it -- something it actually cannot: > initMouseHW (Xserver/hw/xfree86/input/mouse/mouse.c) gets called > which executes the block (around line 2600) > if(ps2Init) { REDO: ... if(paramlen>0) { if(!ps2SendPacket()) ... > > In the function ps2SendPacket() from (dito/pnp.c): > it traps the following code: > /* Some mice accidently enter wrap mode during init */ > if (c == *(bytes + i) /* wrap mode */ > && (*(bytes + i) != 0xEC)) /* avoid recursion */ > ps2DisableWrapMode(pInfo); > (because strace told me that after writing a byte to /dev/gpmdata, > XFree86 reads exactly this byte again thinking it is "wrap mode" > triggering a ps2DisableWrapMode() calling again ps2SendPacket(), > having again 10 tries, all that with usleep(10000)). > > In fact, we loop the code with the REDO: statement above for 11 times > until finally bailing out without having done any initialisation. > > This turns out to take quite a lot of time spent in useless usleeps. > > But hey, we can do that more quckly by simply skipping this senseless > tries right from the beginning: > > The solution is simple. The device is managed by GPM, so there is > nothing to configure anyways, so XFree86 does not need to. > I wrote the following quick hack which skips the PS/2 init in case > this is requested by > Option "SkipInit" "1" > > The patch works perfectly for me reducing VT switch time > about 5 seconds (!!). > I.e. before the patch, the windows appear filled with background color > and X freezes for 5 seconds -- after the patch, the windows appear > immedately with proper content. > > However, due to *NOTE* (see patch), this is just a quick hack. > The skip_init should be included in pInfo->private or so. > > (Directory: xc/programs/Xserver/hw/xfree86/input/mouse) > -----------------------------<patch>------------------------------ > ----------- > --- mouse.c-orig 2003-04-02 13:16:19.000000000 +0200 > +++ mouse.c 2003-04-02 14:42:16.000000000 +0200 > @@ -198,7 +198,8 @@ > OPTION_FLOW_CONTROL, > OPTION_VTIME, > OPTION_VMIN, > - OPTION_DRAGLOCKBUTTONS > + OPTION_DRAGLOCKBUTTONS, > + OPTION_SKIPINIT > } MouseOpts; > > static const OptionInfoRec mouseOptions[] = { > @@ -237,6 +238,7 @@ > { OPTION_VTIME, "VTime", OPTV_INTEGER, > {0}, FALSE }, > { OPTION_VMIN, "VMin", OPTV_INTEGER, > {0}, FALSE }, > { OPTION_DRAGLOCKBUTTONS, "DragLockButtons",OPTV_STRING, > {0}, FALSE }, > + { OPTION_SKIPINIT, "SkipInit", OPTV_BOOLEAN, > {0}, FALSE }, > /* end serial options */ > { -1, NULL, OPTV_NONE, > {0}, FALSE } > }; > @@ -362,6 +364,8 @@ > } > #endif > > +Bool skip_init=0; <-- *NOTE* > + > /* Process options common to all mouse types. */ > static void > MouseCommonOptions(InputInfoPtr pInfo) > @@ -657,6 +661,10 @@ > from = X_CONFIG; > xf86Msg(from, "%s: Buttons: %d\n", pInfo->name, pMse->buttons); > > + if (xf86SetBoolOption(pInfo->options, "SkipInit", FALSE)) { > + xf86Msg(X_CONFIG, "%s: skip init\n", pInfo->name); > + skip_init=1; > + } > } > /* > * map bits corresponding to lock buttons. > @@ -2389,7 +2397,7 @@ > unsigned char *param = NULL; > int paramlen = 0; > int count = 10; > - Bool ps2Init = TRUE; > + Bool ps2Init = !skip_init; > > switch (pMse->protocolID) { > case PROT_LOGI: /* Logitech Mice */ > ------------------------------------------------------------------ > ---------- > > Would you please consider applying some patch like that for those > using GPM? > (It's cool, because using GPM is now faster than using /dev/psaux.) > > Especially note that when using GPM, this patch does NOT change > anything. By setting ps2Init = !skip_init, we do not enter the > config block in initMouseHW(). Previous behavior was to enter it > and leave it after 11 Resets without having done anything else > than trying 11 times to reset. > > [Please CC me, I am not on this list.] > > Regards, > Wolfgang > > _______________________________________________ > Devel mailing list > [EMAIL PROTECTED] > http://XFree86.Org/mailman/listinfo/devel > _______________________________________________ Devel mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/devel
