git: 66e7f048f0c8 - main - moused(8): Start moused with devd
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 21 Sep 2025 13:16:26 UTC
The branch main has been updated by wulf:
URL: https://cgit.FreeBSD.org/src/commit/?id=66e7f048f0c8e9e726738fadd9dc819bfda3cbfe
commit 66e7f048f0c8e9e726738fadd9dc819bfda3cbfe
Author: Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2025-09-21 13:14:49 +0000
Commit: Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2025-09-21 13:14:49 +0000
moused(8): Start moused with devd
It is appeared that currently starting of moused does not depend on
moused_enable variable value in rc.conf. That leads to missing USB mice
support in default configuration. Start moused in traditional per
device mode with devd to follow POLA.
One daemon per system mode still can be enabled with setting of
moused_port="auto"
moused_nondefault_enable="NO"
variables in /etc/rc.conf
To revert to sysmouse mode add moused_type="sysmouse" to /etc/rc.conf
Reported by: many
Requested by: glebius
Reviewed by: glebius
MFC after: 1 day
Differential Revision: https://reviews.freebsd.org/D52430
---
libexec/rc/rc.conf | 4 ++--
libexec/rc/rc.d/moused | 11 ++++++-----
sbin/devd/moused.conf | 9 +++++++++
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf
index b5482f081ce5..1220d060232d 100644
--- a/libexec/rc/rc.conf
+++ b/libexec/rc/rc.conf
@@ -586,11 +586,11 @@ font8x14="NO" # font 8x14 from /usr/share/{syscons,vt}/fonts/* (or NO).
font8x8="NO" # font 8x8 from /usr/share/{syscons,vt}/fonts/* (or NO).
blanktime="300" # blank time (in seconds) or "NO" to turn it off.
saver="NO" # screen saver: Uses /boot/kernel/${saver}_saver.ko
-moused_nondefault_enable="NO" # Treat non-default mice as enabled unless
+moused_nondefault_enable="YES" # Treat non-default mice as enabled unless
# specifically overridden in rc.conf(5).
moused_enable="NO" # Run the mouse daemon.
moused_type="evdev" # See man page for rc.conf(5) for available settings.
-moused_port="auto" # Set to your mouse port.
+moused_port="/dev/psm0" # Set to your mouse port.
moused_flags="" # Any additional flags to moused.
mousechar_start="NO" # if 0xd0-0xd3 default range is occupied in your
# language code table, specify alternative range
diff --git a/libexec/rc/rc.d/moused b/libexec/rc/rc.d/moused
index 64e4f815eea9..35a26bd57275 100755
--- a/libexec/rc/rc.d/moused
+++ b/libexec/rc/rc.d/moused
@@ -28,9 +28,10 @@ moused_svcj="NO"
# expected to be the mouse device.
#
if [ -n "$2" ]; then
- eval moused_$2_enable=\${moused_$2_enable-${moused_nondefault_enable}}
- rcvar="moused_${2}_enable"
- pidfile="${pidprefix}.$2.pid"
+ ms=`basename $2`
+ eval moused_${ms}_enable=\${moused_${ms}_enable-${moused_nondefault_enable}}
+ rcvar="moused_${ms}_enable"
+ pidfile="${pidprefix}.${ms}.pid"
pidarg="-I $pidfile"
fi
@@ -45,10 +46,10 @@ moused_start()
# the moused_port variable, which if not defined sets it to the
# passed in device name.
#
- ms=$1
+ ms=`basename $1`
if [ -n "$ms" ]; then
eval myflags=\${moused_${ms}_flags-$moused_flags}
- eval myport=\${moused_${ms}_port-/dev/$ms}
+ eval myport=\${moused_${ms}_port-/dev/$1}
eval mytype=\${moused_${ms}_type-$moused_type}
if [ -n "$mytype" ] && check_kern_features evdev_support; then
typearg="-t ${mytype}"
diff --git a/sbin/devd/moused.conf b/sbin/devd/moused.conf
index ed1060ffdf2e..8821c2bb8375 100644
--- a/sbin/devd/moused.conf
+++ b/sbin/devd/moused.conf
@@ -33,3 +33,12 @@ notify 100 {
action "service moused quietstop $cdev";
};
+
+notify 100 {
+ match "system" "DEVFS";
+ match "subsystem" "CDEV";
+ match "type" "CREATE";
+ match "cdev" "input/event[0-9]+";
+
+ action "service moused quietstart $cdev";
+};