Page MenuHomeFreeBSD

D52647.id162519.diff
No OneTemporary

D52647.id162519.diff

diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf
--- a/libexec/rc/rc.conf
+++ b/libexec/rc/rc.conf
@@ -589,7 +589,7 @@
moused_nondefault_enable="NO" # Treat non-default mice as enabled unless
# specifically overridden in rc.conf(5).
moused_enable="NO" # Run the mouse daemon.
-moused_type="auto" # See man page for rc.conf(5) for available settings.
+moused_type="evdev" # See man page for rc.conf(5) for available settings.
moused_port="auto" # Set to your mouse port.
moused_flags="" # Any additional flags to moused.
mousechar_start="NO" # if 0xd0-0xd3 default range is occupied in your
diff --git a/libexec/rc/rc.d/moused b/libexec/rc/rc.d/moused
--- a/libexec/rc/rc.d/moused
+++ b/libexec/rc/rc.d/moused
@@ -16,6 +16,7 @@
pidprefix="/var/run/moused"
pidfile="${pidprefix}.pid"
pidarg=
+typearg=
load_rc_config $name
# doesn't make sense to run in a svcj: nojail keyword
@@ -49,15 +50,17 @@
eval myflags=\${moused_${ms}_flags-$moused_flags}
eval myport=\${moused_${ms}_port-/dev/$ms}
eval mytype=\${moused_${ms}_type-$moused_type}
+ if [ -n "$mytype" ] && check_kern_features evdev_support; then
+ typearg="-t ${mytype}"
+ fi
else
ms="default"
myflags="$moused_flags"
myport="$moused_port"
- mytype="$moused_type"
fi
startmsg -n "Starting ${ms} moused"
- /usr/sbin/moused ${myflags} -p ${myport} -t ${mytype} ${pidarg}
+ /usr/sbin/moused ${myflags} -p ${myport} ${typearg} ${pidarg}
startmsg '.'
mousechar_arg=
diff --git a/usr.sbin/moused/moused/moused.8 b/usr.sbin/moused/moused/moused.8
--- a/usr.sbin/moused/moused/moused.8
+++ b/usr.sbin/moused/moused/moused.8
@@ -49,7 +49,7 @@
.Op Fl m Ar N=M
.Op Fl w Ar N
.Op Fl z Ar target
-.Op Fl t Ar mousetype
+.Op Fl t Ar interfacetype
.Op Fl l Ar level
.Op Fl 3 Op Fl E Ar timeout
.Op Fl T Ar distance Ns Op , Ns Ar time Ns Op , Ns Ar after
@@ -329,9 +329,32 @@
.Ar high .
This option may not be supported by all the device.
.It Fl t Ar type
-Ignored.
-Used for compatibiliy with legacy
-.Nm .
+Force the interface type of the mouse attached to the port.
+You may explicitly specify a type listed below, or use
+.Ar auto
+to let the
+.Nm
+utility automatically select an appropriate protocol for the given
+character device.
+If you entirely omit this option in the command line,
+.Fl t Ar auto
+is assumed.
+.Pp
+Valid types for this option are listed below.
+.Bl -tag -compact -width systemmouse
+.It Ar evdev
+Input event device usualy residing in
+.Pa /dev/input .
+.It Ar sysmouse
+Traditional protocol used by e.g.
+.Xr ums 4
+and
+.Xr psm 4
+drivers.
+.El
+.Pp
+Note that this option restricts usage of the given port rather then gives
+a hint.
.It Fl q Ar config
Path to configuration file.
.It Fl Q Ar quirks
diff --git a/usr.sbin/moused/moused/moused.c b/usr.sbin/moused/moused/moused.c
--- a/usr.sbin/moused/moused/moused.c
+++ b/usr.sbin/moused/moused/moused.c
@@ -448,6 +448,7 @@
#endif
static const char *quirks_path = QUIRKSDIR;
static struct quirks_context *quirks;
+static enum device_if force_if = DEVICE_IF_UNKNOWN;
static int opt_rate = 0;
static int opt_resolution = MOUSE_RES_UNKNOWN;
@@ -529,7 +530,8 @@
struct rodent *r;
pid_t mpid;
int c;
- int i;
+ u_int i;
+ int n;
u_long ul;
char *errstr;
@@ -552,26 +554,26 @@
break;
case 'a':
- i = sscanf(optarg, "%lf,%lf", &opt_accelx, &opt_accely);
- if (i == 0) {
+ n = sscanf(optarg, "%lf,%lf", &opt_accelx, &opt_accely);
+ if (n == 0) {
warnx("invalid linear acceleration argument "
"'%s'", optarg);
usage();
}
- if (i == 1)
+ if (n == 1)
opt_accely = opt_accelx;
break;
case 'A':
opt_exp_accel = true;
- i = sscanf(optarg, "%lf,%lf", &opt_expoaccel,
+ n = sscanf(optarg, "%lf,%lf", &opt_expoaccel,
&opt_expoffset);
- if (i == 0) {
+ if (n == 0) {
warnx("invalid exponential acceleration "
"argument '%s'", optarg);
usage();
}
- if (i == 1)
+ if (n == 1)
opt_expoffset = 1.0;
break;
@@ -646,8 +648,19 @@
break;
case 't':
- if (strcmp(optarg, "auto") != 0)
- warnx("ignore mouse type `%s'", optarg);
+ if (strcmp(optarg, "auto") == 0) {
+ force_if = DEVICE_IF_UNKNOWN;
+ break;
+ }
+ for (i = 0; i < nitems(rifs); i++)
+ if (strcmp(optarg, rifs[i].name) == 0) {
+ force_if = i;
+ break;
+ }
+ if (i == nitems(rifs)) {
+ warnx("no such interface type `%s'", optarg);
+ usage();
+ }
break;
case 'w':
@@ -1224,7 +1237,7 @@
fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n",
"usage: moused [-dfg] [-I file] [-F rate] [-r resolution]",
" [-VH [-U threshold]] [-a X[,Y]] [-C threshold] [-m N=M] [-w N]",
- " [-z N] [-t <mousetype>] [-l level] [-3 [-E timeout]]",
+ " [-z N] [-t <interfacetype>] [-l level] [-3 [-E timeout]]",
" [-T distance[,time[,after]]] -p <port> [-q config] [-Q quirks]",
" moused [-d] -i <port|if|type|model|all> -p <port>");
exit(1);
@@ -1338,9 +1351,11 @@
{
int dummy;
- if (ioctl(fd, EVIOCGVERSION, &dummy) >= 0)
+ if ((force_if == DEVICE_IF_UNKNOWN || force_if == DEVICE_IF_EVDEV) &&
+ ioctl(fd, EVIOCGVERSION, &dummy) >= 0)
return (DEVICE_IF_EVDEV);
- if (ioctl(fd, MOUSE_GETLEVEL, &dummy) >= 0)
+ if ((force_if == DEVICE_IF_UNKNOWN || force_if == DEVICE_IF_SYSMOUSE) &&
+ ioctl(fd, MOUSE_GETLEVEL, &dummy) >= 0)
return (DEVICE_IF_SYSMOUSE);
return (DEVICE_IF_UNKNOWN);
}

File Metadata

Mime Type
text/plain
Expires
Thu, Jul 16, 2:27 PM (4 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35126909
Default Alt Text
D52647.id162519.diff (5 KB)

Event Timeline