Subject: Re: [bug#30604] [PATCH v11 5/6] linux-initrd: Provide our own 'modprobe' program.

From: [email-masked] (Ludovic Courtès)
Date: Tue, 13 Mar 2018 10:28:52 +0100

[email-masked] (Ludovic Courtès) skribis:

> Something annoying is that my external USB keyboard doesn’t work while
> in the initrd (when I type my passphrase).  I can see that it’s detected
> early on, before I type my passphrase:

I tried looking up “modalias” right when entering a /sys/devices
directory, like you did in the initial patch, but that didn’t help:

diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index 4515839e9..213a8bbb9 100644
--- a/gnu/build/linux-modules.scm
+++ b/gnu/build/linux-modules.scm
@@ -480,19 +480,22 @@ side-effect and would thus need to traverse /sys/devices again."
      (string-append module-directory "/modules.alias")))
 
   (define (enter? director stat result) result)
-  (define (down directory stat result) result)
-  (define (up directory stat result) result)
-  (define (skip entry stat result) result)
-  (define (error name stat errno result) result)
-  (define (leaf file stat result)
-    (if (string=? (basename file) "modalias")
+  (define (down directory stat result)
+    ;; Check for "modalias" right when entering DIRECTORY instead of waiting
+    ;; for LEAF to be called.  XXX: Doesn't help!
+    (let ((modalias (string-append directory "/modalias")))
+      (if (file-exists? modalias)
           (let* ((alias   (string-trim-right
-                         (call-with-input-file file get-string-all)))
+                           (call-with-input-file modalias get-string-all)))
                  (modules (matching-modules alias aliases)))
             (load-linux-modules-from-directory modules
                                                module-directory)
             (append modules result))
-        result))
+          result)))
+  (define (up directory stat result) result)
+  (define (skip entry stat result) result)
+  (define (error name stat errno result) result)
+  (define (leaf file stat result) file stat result)
 
   (file-system-fold enter? leaf down up skip error '() "/sys/devices"))

Ludo’.