examples/target-disk-mode: Try to enable ADB
Also warn if it could not be enabled.
@@ -7,6 +7,19 @@ let
config.mobile.boot.stage-1.bootConfig.storage ? internal &&
config.mobile.boot.stage-1.bootConfig.storage.internal != null
;
+
+ # Only enable `adb` if we know how to.
+ # FIXME: relies on implementation details. Poor separation of concerns.
+ enableADB =
+ let
+ value =
+ config.mobile.usb.mode == "android_usb" ||
+ (config.mobile.usb.mode == "gadgetfs" && config.mobile.usb.gadgetfs.functions ? adb)
+ ;
+ in
+ if value then value else
+ builtins.trace "warning: unable to enable ADB for this device." value
+ ;
in
{
mobile.boot.stage-1.tasks = [
@@ -50,6 +63,7 @@ in
app-simulator = pkgs.callPackage ./app/simulator.nix {};
};
+ mobile.adbd.enable = lib.mkDefault enableADB;
mobile.boot.stage-1.networking.enable = true;
mobile.boot.stage-1.ssh.enable = true;
}
