initrd: Fixes android-specific usb handling on non-android.
Issue came from hoisting what was previously in a function into the main
scope. It made the whole script `return` early on non-android devices.
@@ -41,8 +41,9 @@ in
# TODO: Only run, when we have the android usb driver
init = lib.mkOrder AFTER_DEVICE_INIT ''
# Setting up Android-specific USB.
+ (
SYS=/sys/class/android_usb/android0
- [ -e "$SYS" ] || return
+ if [ -e "$SYS" ]; then
printf "%s" "0" > "$SYS/enable"
printf "%s" "18D1" > "$SYS/idVendor"
printf "%s" "D001" > "$SYS/idProduct"
@@ -52,6 +53,8 @@ in
sleep 1
${optionalString cfg.usb.adbd "adbd &\n"}
+ fi
+ )
'';
extraUtils = with pkgs; []
++ optional cfg.usb.adbd { package = adbd; extraCommand = "cp -fpv ${glibc.out}/lib/libnss_files.so.* $out/lib"; }
