[Midnightbsd-cvs] src: src/etc: Update rc.suspend and rc.resume to take advantage of the
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Thu Dec 4 12:18:04 EST 2008
Log Message:
-----------
Update rc.suspend and rc.resume to take advantage of the new modes. Add ZFS to devd config
Modified Files:
--------------
src/etc:
devd.conf (r1.4 -> r1.5)
rc.suspend (r1.2 -> r1.3)
rc.resume (r1.2 -> r1.3)
-------------- next part --------------
Index: rc.suspend
===================================================================
RCS file: /home/cvs/src/etc/rc.suspend,v
retrieving revision 1.2
retrieving revision 1.3
diff -L etc/rc.suspend -L etc/rc.suspend -u -r1.2 -r1.3
--- etc/rc.suspend
+++ etc/rc.suspend
@@ -31,7 +31,7 @@
# sample run command file for APM Suspend Event
if [ $# -ne 2 ]; then
- echo "Usage: $0 [apm|acpi] [standby,suspend|1-5]"
+ echo "Usage: $0 [apm|acpi] [standby,suspend|1-4]"
exit 1
fi
@@ -49,15 +49,20 @@
# pccardq | awk -F '~' '$5 == "filled" && $4 ~ /sio/ \
# { printf("pccardc power %d 0", $1); }' | sh
-# UHCI has trouble resuming so we just load/unload it. You
-# should add any other kernel modules you want unloaded here.
+# If a device driver has problems suspending, try unloading it before
+# suspend and reloading it on resume. Example:
# kldunload usb
logger -t $subsystem suspend at `date +'%Y%m%d %H:%M:%S'`
sync && sync && sync
-[ $subsystem = "apm" ] && sleep 3
+sleep 3
rm -f /var/run/rc.suspend.pid
-[ $subsystem = "apm" ] && zzz
+if [ $subsystem = "apm" ]; then
+ /usr/sbin/zzz
+else
+ # Notify the kernel to continue the suspend process
+ /usr/sbin/acpiconf -k 0
+fi
exit 0
Index: devd.conf
===================================================================
RCS file: /home/cvs/src/etc/devd.conf,v
retrieving revision 1.4
retrieving revision 1.5
diff -L etc/devd.conf -L etc/devd.conf -u -r1.4 -r1.5
--- etc/devd.conf
+++ etc/devd.conf
@@ -1,5 +1,5 @@
# $MidnightBSD$
-# $FreeBSD: src/etc/devd.conf,v 1.26.2.2 2005/11/23 18:03:32 emax Exp $
+# $FreeBSD: src/etc/devd.conf,v 1.38 2007/06/21 22:50:36 njl Exp $
#
# Refer to devd.conf(5) and devd(8) man pages for the details on how to
# run and configure devd.
@@ -29,17 +29,19 @@
# override these general rules.
#
-# For ethernet like devices start configuring the interface. Due to
-# a historical accident, this script is called pccard_ether.
+# Configure the interface on attach. Due to a historical accident, this
+# script is called pccard_ether.
#
-attach 0 {
- media-type "ethernet";
- action "/etc/pccard_ether $device-name start";
+notify 0 {
+ match "system" "IFNET";
+ match "type" "ATTACH";
+ action "/etc/pccard_ether $subsystem start";
};
-detach 0 {
- media-type "ethernet";
- action "/etc/pccard_ether $device-name stop";
+notify 0 {
+ match "system" "IFNET";
+ match "type" "DETACH";
+ action "/etc/pccard_ether $subsystem stop";
};
#
@@ -114,6 +116,35 @@
action "/etc/rc.d/moused start $device-name";
};
+# Firmware download into the ActiveWire board. After the firmware download is
+# done the device detaches and reappears as something new and shiny
+# automatically.
+attach 100 {
+ match "vendor" "0x0854";
+ match "product" "0x0100";
+ match "release" "0x0000";
+ action "/usr/local/bin/ezdownload -f /usr/local/share/usb/firmware/0854.0100.0_01.hex $device-name";
+};
+
+# Firmware download for Entrega Serial DB25 adapter.
+attach 100 {
+ match "vendor" "0x1645";
+ match "product" "0x8001";
+ match "release" "0x0101";
+ action "if ! kldstat -n usio > /dev/null 2>&1 ; then kldload usio; fi /usr/sbin/ezdownload -v -f /usr/share/usb/firmware/1645.8001.0101 /dev/$device-name";
+};
+
+# This entry starts the ColdSync tool in daemon mode. Make sure you have an up
+# to date /usr/local/etc/palms. We override the 'listen' settings for port and
+# type in /usr/local/etc/coldsync.conf.
+attach 100 {
+ device-name "ugen[0-9]+";
+ match "vendor" "0x082d";
+ match "product" "0x0100";
+ match "release" "0x0100";
+ action "/usr/local/bin/coldsync -md -p /dev/$device-name -t usb";
+};
+
#
# Rescan scsi device-names on attach, but not detach. However, it is
# disabled by default due to reports of problems.
@@ -125,11 +156,42 @@
# Don't even try to second guess what to do about drivers that don't
# match here. Instead, pass it off to syslog. Commented out for the
-# moment, as pnpinfo isn't set in devd yet.
+# moment, as the pnpinfo variable isn't set in devd yet. Individual
+# variables within the bus supplied pnpinfo are set.
nomatch 0 {
# action "logger Unknown device: $pnpinfo $location $bus";
};
+# Various logging of unknown devices.
+nomatch 10 {
+ match "bus" "uhub[0-9]+";
+ action "logger Unknown USB device: vendor $vendor product $product \
+ bus $bus";
+};
+
+# Some PC-CARDs don't offer numerical manufacturer/product IDs, just
+# show the CIS info there.
+nomatch 20 {
+ match "bus" "pccard[0-9]+";
+ match "manufacturer" "0xffffffff";
+ match "product" "0xffffffff";
+ action "logger Unknown PCCARD device: CISproduct $cisproduct \
+ CIS-vendor $cisvendor bus $bus";
+};
+
+nomatch 10 {
+ match "bus" "pccard[0-9]+";
+ action "logger Unknown PCCARD device: manufacturer $manufacturer \
+ product $product CISproduct $cisproduct CIS-vendor \
+ $cisvendor bus $bus";
+};
+
+nomatch 10 {
+ match "bus" "cardbus[0-9]+";
+ action "logger Unknown Cardbus device: device $device class $class \
+ vendor $vendor bus $bus";
+};
+
# Switch power profiles when the AC line state changes.
notify 10 {
match "system" "ACPI";
@@ -147,6 +209,50 @@
action "logger -p kern.emerg 'WARNING: system temperature too high, shutting down soon!'";
};
+# Sample ZFS problem reports handling.
+notify 10 {
+ match "system" "ZFS";
+ match "type" "zpool";
+ action "logger -p kern.err 'ZFS: failed to load zpool $pool'";
+};
+
+notify 10 {
+ match "system" "ZFS";
+ match "type" "vdev";
+ action "logger -p kern.err 'ZFS: vdev failure, zpool=$pool type=$type'";
+};
+
+notify 10 {
+ match "system" "ZFS";
+ match "type" "data";
+ action "logger -p kern.warn 'ZFS: zpool I/O failure, zpool=$pool error=$zio_err'";
+};
+
+notify 10 {
+ match "system" "ZFS";
+ match "type" "io";
+ action "logger -p kern.warn 'ZFS: vdev I/O failure, zpool=$pool path=$vdev_path offset=$zio_offset size=$zio_size error=$zio_err'";
+};
+
+notify 10 {
+ match "system" "ZFS";
+ match "type" "checksum";
+ action "logger -p kern.warn 'ZFS: checksum mismatch, zpool=$pool path=$vdev_path offset=$zio_offset size=$zio_size'";
+};
+
+# User requested suspend, so perform preparation steps and then execute
+# the actual suspend process.
+notify 10 {
+ match "system" "ACPI";
+ match "subsystem" "Suspend";
+ action "/etc/rc.suspend acpi $notify";
+};
+notify 10 {
+ match "system" "ACPI";
+ match "subsystem" "Resume";
+ action "/etc/rc.resume acpi $notify";
+};
+
/* EXAMPLES TO END OF FILE
# The following might be an example of something that a vendor might
@@ -185,6 +291,7 @@
# Button: Button pressed (0 for power, 1 for sleep)
# CMBAT: ACPI battery events
# Lid: Lid state (0 is closed, 1 is open)
+# Suspend, Resume: Suspend and resume notification
# Thermal: ACPI thermal zone events
#
# This example calls a script when the AC state changes, passing the
Index: rc.resume
===================================================================
RCS file: /home/cvs/src/etc/rc.resume,v
retrieving revision 1.2
retrieving revision 1.3
diff -L etc/rc.resume -L etc/rc.resume -u -r1.2 -r1.3
--- etc/rc.resume
+++ etc/rc.resume
@@ -24,13 +24,13 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# $FreeBSD: src/etc/rc.resume,v 1.7 2003/12/30 17:30:39 njl Exp $
+# $FreeBSD: src/etc/rc.resume,v 1.8 2007/06/21 22:50:36 njl Exp $
# $MidnightBSD$
# sample run command file for APM Resume Event
if [ $# -ne 2 ]; then
- echo "Usage: $0 [apm|acpi] [standby,suspend|1-5]"
+ echo "Usage: $0 [apm|acpi] [standby,suspend|1-4]"
exit 1
fi
@@ -48,9 +48,13 @@
# pccardq | awk -F '~' '$5 == "inactive" \
# { printf("pccardc power %d 1", $1); }' | sh
-# UHCI has trouble resuming so we just load/unload it. You
-# should add any other kernel modules you want reloaded here.
-# kldload usb
+# If a device driver has problems resuming, try unloading it before
+# suspend and reloading it on resume. Example:
+# kldunload usb
+
+# wpa_supplicant(8) doesn't seem to reassociate during resume. Uncomment
+# the following to signal it to reassociate.
+# /usr/sbin/wpa_cli reassociate
logger -t $subsystem resumed at `date +'%Y%m%d %H:%M:%S'`
sync && sync && sync
More information about the Midnightbsd-cvs
mailing list