[arch-projects] [mkinitcpio] [PATCH 04/18] usbinput: use autodetection on newer kernels

Dave Reisner dreisner at archlinux.org
Fri Nov 23 18:48:49 EST 2012


This is a partial "revert" of 822a88700e since kernels as of 3.5 add
module aliases for hid devices.

Fixes FS#32575.

Signed-off-by: Dave Reisner <dreisner at archlinux.org>
---
 install/usbinput | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/install/usbinput b/install/usbinput
index f427600..a292345 100644
--- a/install/usbinput
+++ b/install/usbinput
@@ -1,9 +1,20 @@
 #!/bin/bash
 
 build() {
+    local major minor
+
     add_checked_modules -f '(_cs|sl811_hcd|isp116x_hcd)' '/usb/host'
-    add_all_modules '/hid/hid-'
-    add_module 'usbhid?'
+
+    # As of 3.5, modaliases seem to be exported for HID
+    # devices, so we can leverage autodetection.
+    IFS=.- read major minor _ <<<"$KERNELVERSION"
+    if (( major > 3 || (major == 3 && minor >= 5) )); then
+        add_checked_modules '/hid/hid'
+    else
+        add_all_modules '/hid/hid'
+    fi
+
+    add_module 'usbhid'
 }
 
 help() {
-- 
1.8.0



More information about the arch-projects mailing list