/usr/src/etc/rc.d/moused patch

YONETANI Tomokazu qhwt+dragonfly-submit at les.ath.cx
Wed Apr 28 08:34:34 PDT 2004


On Wed, Apr 28, 2004 at 07:32:22AM -0700, walt wrote:
> Sascha Wildner wrote:
> 
> >:-?
> 
> I turned on debugging in the moused script:
> <many lines of setup stuff snipped>
> + debug run_rc_command: evaluating moused_start().
> + eval moused_start
> + moused_start
> + echo -n Starting moused:
> + /usr/sbin/moused -p /dev/psm0 -t auto
> + _mousechar_arg=
> + vidcontrol -m on
> ESC[=0AESC[=7FESC[=0GESC[=0HESC[=7Ividcontrol: showing the mouse: Invalid 
> argument
> + echo .
> + _return=0
> 
> I don't know where that string of control characters comes from.
> 
> Below is the relevant part of your moused script.  Does it look correct?
> From the debugging output above it looks like the 'case' statement never
> ran, but I'm not certain:
> 
> viddev=/dev/ttyv0
> 
> moused_start()
> {
>         echo -n 'Starting moused:'
>         /usr/sbin/moused ${moused_flags} -p ${moused_port} -t ${moused_type}
> 
>         _mousechar_arg=
>         case ${mousechar_start} in
>         [Nn][Oo] | '')
>                 ;;
>         *)
>                 echo -n ' mousechar_start'
>                 _mousechar_arg="-M ${mousechar_start}"
>                 ;;
>         esac
> 
>         vidcontrol < ${viddev} ${_mousechar_arg} -m on
> 
>         echo '.'
> }

Short answer(workaround):
add ">/dev/null 2>&1" at the end of vidcontrol line in the script.

Longer answer:
The ioctl request for showing/hiding mouse cursor returns an error
if the mouse cursor is already in the requested state. The recent
big change to vidcontrol(8) changed the way it handles the failed
operations and tries to revert the original configuration as much
as possible, with a small side-effect of showing a false alert.
You've never seen an error with the previous version of vidcontrol
because it simply discarded the error returned by ioctl().
You can either fix vidcontrol to not show the error message, or
change syscons driver to not return EINVAL, but IMHO the latter
looks more correct.

(untested)
Index: sys/dev/misc/syscons/scmouse.c
===================================================================
RCS file: /home/source/dragonfly/cvs/src/sys/dev/misc/syscons/scmouse.c,v
retrieving revision 1.4
diff -u -r1.4 scmouse.c
--- sys/dev/misc/syscons/scmouse.c	7 Aug 2003 21:16:59 -0000	1.4
+++ sys/dev/misc/syscons/scmouse.c	28 Apr 2004 15:23:39 -0000
@@ -670,12 +670,9 @@
 		cur_scp->status &= ~MOUSE_HIDDEN;
 		if (!ISGRAPHSC(cur_scp))
 		    mark_all(cur_scp);
-		splx(s);
-		return 0;
-	    } else {
-		splx(s);
-		return EINVAL;
 	    }
+	    splx(s);
+	    return 0;
 	    break;
 
 	case MOUSE_HIDE:
@@ -683,12 +680,9 @@
 	    if (scp->sc->flags & SC_MOUSE_ENABLED) {
 		scp->sc->flags &= ~SC_MOUSE_ENABLED;
 		sc_remove_all_mouse(scp->sc);
-		splx(s);
-		return 0;
-	    } else {
-		splx(s);
-		return EINVAL;
 	    }
+	    splx(s);
+	    return 0;
 	    break;
 
 	case MOUSE_MOVEABS:





More information about the Submit mailing list