fx set-device

set the default device to interact with

usage: fx set-device [DEVICE[:SSH_PORT]]

fx set-device is used to specify the default device to target for
the current Fuchsia build directory, i.e. $FUCHSIA_BUILD_DIR.
This means a device is set within the scope of a build directory (i.e. out/arm64 may
have a different default device than out/x64).

If no device name is given, set-device will attempt to discover devices. If
one device is found, that device is set as the default for the current build
directory. If more than one device is found, the user must select one.

If specified, DEVICE may be a Fuchsia device name or network address that will be resolved
using ffx.

The default device resolution is performed by ffx using
a prioritized list of configuration to resolve the default target.
Once there is a value, the remainder of the list is ignored.

* Specify the target on the ffx command line with --target.
* If configured, use the user level configuration set by ffx target default set.
  This user level configuration is stored relative to $HOME. This is controlled by
  running `ffx target default set`.
* The default configuration compiled into ffx checks two environment variables:
    "$FUCHSIA_DEVICE_ADDR"
    "$FUCHSIA_NODENAME"
   These are used by Fuchsia infra jobs to specify which target should be used
    when running a specific test FUCHSIA_NODENAME is also set to any
    build-directory default target set by `fx set-device`.
* If only one device is discovered

If there is still no target device identified, or if there are multiple devices discovered,
an error is returned indicating a specific device needs to be identified as the default device
for that command.

Examples:
  fx set-device strut-wind-ahead-turf
  fx set-device strut-wind-ahead-turf:222
  fx set-device 192.168.1.2
  fx set-device 192.168.3.1:8022
  fx set-device [fe80::7:8%eth0]
  fx set-device [fe80::7:8%eth0]:5222
  fx set-device

To unset, use `fx unset-device`.

set-device source code