[PATCH 2/2] Load modules for USB keyboard if no keyboard is present at panic
USB modules are not normally loaded at break=top time but since USB
keyboards are very common we should take the effort to try to load
extra kernel modules at break (=panic) time. This patch closes #615831
and has been adapted from comments mentioned in
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/229732
and tested on a HP ProLiant MicroServer that lacks a PS2 port
completely.
Signed-off-by: Timo Juhani Lindfors <timo.lindfors@iki.fi>
diff --git a/scripts/functions b/scripts/functions
index af49e45..3c95b55 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -37,6 +37,20 @@ try_modprobe()
modprobe $1
}
+kbd_handler_exists()
+{
+ local line
+
+ while read line; do
+ case "$line" in
+ H:*kbd*)
+ return 0
+ ;;
+ esac
+ done < /proc/bus/input/devices
+ return 1
+}
+
panic()
{
if command -v chvt >/dev/null 2>&1; then
@@ -52,6 +66,13 @@ panic()
fi
try_modprobe i8042
try_modprobe atkbd
+ if ! kbd_handler_exists; then
+ try_modprobe ehci-hcd
+ try_modprobe uhci-hcd
+ try_modprobe ohci-hcd
+ try_modprobe usbhid
+ fi
+
REASON="$@" PS1='(initramfs) ' /bin/sh -i </dev/console >/dev/console 2>&1
}
--
1.7.2.3
Reply to: