mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-12-15 19:23:01 +03:00
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.
This commit is contained in:
parent
6be693e7b9
commit
93d508bedc
@ -41,17 +41,20 @@ 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
|
||||
printf "%s" "0" > "$SYS/enable"
|
||||
printf "%s" "18D1" > "$SYS/idVendor"
|
||||
printf "%s" "D001" > "$SYS/idProduct"
|
||||
printf "%s" "${concatStringsSep "," cfg.usb.features}" > "$SYS/functions"
|
||||
sleep 0.5
|
||||
printf "%s" "1" > "$SYS/enable"
|
||||
sleep 1
|
||||
if [ -e "$SYS" ]; then
|
||||
printf "%s" "0" > "$SYS/enable"
|
||||
printf "%s" "18D1" > "$SYS/idVendor"
|
||||
printf "%s" "D001" > "$SYS/idProduct"
|
||||
printf "%s" "${concatStringsSep "," cfg.usb.features}" > "$SYS/functions"
|
||||
sleep 0.5
|
||||
printf "%s" "1" > "$SYS/enable"
|
||||
sleep 1
|
||||
|
||||
${optionalString cfg.usb.adbd "adbd &\n"}
|
||||
${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"; }
|
||||
|
Loading…
Reference in New Issue
Block a user