[PC-BSD Commits] r1907 - pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/cardDetect

svn at pcbsd.org svn at pcbsd.org
Sun May 18 12:29:50 PDT 2008


Author: melkor
Date: 2008-05-18 12:29:50 -0700 (Sun, 18 May 2008)
New Revision: 1907

Modified:
   pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/cardDetect/mouse_config.sh
Log:


Modified: pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/cardDetect/mouse_config.sh
===================================================================
--- pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/cardDetect/mouse_config.sh	2008-05-18 18:44:19 UTC (rev 1906)
+++ pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/cardDetect/mouse_config.sh	2008-05-18 19:29:50 UTC (rev 1907)
@@ -1,47 +1,67 @@
-#!/usr/bin/perl
+#!/bin/sh
 #
 #This script was taken from Frenzy Live CD developed by Sergei Mozhaisky
 # Name    : Mouse detection script
-# Version : 0.3 
-# Author  : Sergei Mozhaisky (techniX)
+# Version : 0.4
+# Author  : Sergei Mozhaisky (technix at frenzy.org.ua)
 #
 
-$msg_detect = "Detecting mouse...";
-$msg_running = " moused is already running.\n";
-$msg_notfound = " NOT FOUND\n";
-$msg_found = "found at";
-$msg_started = "mouse daemon started.\n";
+. gettext.sh
+export TEXTDOMAIN="frenzytools"
+export TEXTDOMAINDIR="/usr/local/share/locale"
 
-print $msg_detect;
+msg_detect=$(gettext "Detecting mouse...")
+msg_running=$(gettext "moused is already running.")
+msg_notfound=$(gettext "NOT FOUND")
+msg_found=$(gettext "found at")
+msg_started=$(gettext "mouse daemon started.")
 
-open (M, "/var/run/moused.pid"); $pidx = <M>; close (M); $pidx =~ s/\n//g;
-if ($pidx eq "") {$pidx = 0}
-$moused_is_running = "ps ax | grep moused | grep -v grep ";
-$cmd = `$moused_is_running`;
-if ($cmd ne "") {print $msg_running; exit;}
+# -----------------
 
-if (probe_mouse("/dev/psm0")) {exit;}
-if (probe_mouse("/dev/cuaa0")) {exit;}
-if (probe_mouse("/dev/cuaa1")) {exit;}
-print $msg_notfound;
-exit;
+probe_mouse ()
+{
+device=$1
+FOUND_MOUSE=1
+mouseprobe=`moused -i all -p ${device} 2>&1`
+if [ -n "`printf "${mouseprobe}" | sed "s/\n//g" | grep ":"`" ]; then
+FOUND_MOUSE=0
+fi
+}
 
-sub probe_mouse
+start_mouse ()
 {
-my $device = $_[0];
-my $mouseprobe = `moused -i all -p $device 2>&1`;
-if (($mouseprobe =~ m/unable/g)||($mouseprobe =~ m/cannot/g))
-{
-return 0;
-} 
-else 
-{
-print " $msg_found $device, ";
-$moused_start=`moused -3 -r high -t auto -p $device`;
-print $msg_started;
-$vidcontrol=`vidcontrol -m on`;
-return -1;
+device=$1
+printf " ${msg_found} $device, "
+start_moused=`moused -3 -r high -t auto -p ${device} > /dev/null 2>&1`
+printf "${msg_started} \n"
+start_vidcontrol=`vidcontrol -m on > /dev/null 2>&1`
+# add this to rc.conf ?
+#echo "
+#moused_enable=\"YES\"
+#moused_port=\"${device}\"
+#moused_flags=\"-3 -r high -t auto\"
+#" >> /etc/rc.conf
 }
-}
 
+# -----------------------------
 
+printf "$msg_detect"
+
+FOUND_MOUSE=1
+#MOUSED_PID=`cat /var/run/moused.pid`
+MOUSED_RUNNING=`ps ax | grep moused | grep -v grep`
+if [ -n "${MOUSED_RUNNING}" ]; then
+printf " $msg_running \n"
+exit 0
+fi
+
+for i in /dev/psm0 /dev/cuad0 /dev/cuad1 /dev/cuad2 /dev/cuad3 /dev/cuaa0 /dev/cuaa1 /dev/cuaa2 /dev/cuaa3
+do
+probe_mouse $i
+if [ ${FOUND_MOUSE} -eq 1 ]; then
+start_mouse $i
+exit 0
+fi
+done
+printf " $msg_notfound \n"
+exit 0



More information about the Commits mailing list