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

Sascha Wildner saw at online.de
Wed Apr 28 09:14:47 PDT 2004


YONETANI Tomokazu wrote:

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.
I think having syscons return an error (current behavior) is correct. It 
is /usr/src/etc/rc.d/moused which is buggy. It calls vidcontrol twelve 
times where once would be enough. It also doesn't stop moused when it is 
given a "stop" argument. This causes "/usr/etc/rc.d/moused restart" to 
fail because restart just does a stop (moused is not stopped) and a 
start (mouse already on -> error message).

Both changes are enough to stop all of vidcontrol's error messages on my 
system. They are in my patch which is at the beginning of this thread 
and which walt is for some reason unable to apply. So he misses the 
moused_stop routine and still gets an error with "moused restart". I've 
attached the patch again.

Could someone else please try to apply my patch? :) It really contains 
the correct solution. Why _not_ have syscons report an error if the 
mouse is already on and the user tries to turn it on?

Regards,
Sascha
--
http://yoyodyne.ath.cx
*** /usr/src/etc/rc.d/moused	Tue Apr 27 18:08:53 2004
--- /usr/s/src/etc/rc.d/moused	Tue Apr 27 18:08:26 2004
***************
*** 15,20 ****
--- 15,26 ----
  rcvar=`set_rcvar`
  command="/usr/sbin/${name}"
  start_cmd="moused_start"
+ stop_cmd="moused_stop"
+ sig_stop="-INT"
+ 
+ # stdin must be redirected because it might be for a serial console
+ #
+ viddev=/dev/ttyv0
  
  moused_start()
  {
***************
*** 31,41 ****
  		;;
  	esac
  
! 	for ttyv in /dev/ttyv* ; do
! 		vidcontrol < ${ttyv} ${_mousechar_arg} -m on
! 	done
  	echo '.'
  }
  
  load_rc_config $name
  run_rc_command "$1"
--- 37,56 ----
  		;;
  	esac
  
! 	vidcontrol < ${viddev} ${_mousechar_arg} -m on
! 
  	echo '.'
  }
  
+ moused_stop()
+ {
+ 	pids="`check_process $command`"
+ 	if [ -n "$pids" ]; then
+ 		for pid in $pids; do
+ 			kill $sig_stop $pid
+ 		done
+ 	fi
+ }
+ 
  load_rc_config $name
  run_rc_command "$1"




More information about the Submit mailing list