| #!/bin/bash |
| # Copyright 2026 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| #### CATEGORY=Other |
| ### Enable support for ffx's USB protocol |
| ## See go/enable-usb-ffx for more information. |
| |
| source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/../lib/vars.sh || exit $? |
| fx-config-read |
| |
| fx-command-exec host-tool ffx config get connectivity.enable_usb 2>/dev/null | grep true >/dev/null 2>&1 && (echo "USB is already enabled"; exit 0) |
| |
| fx-command-exec host-tool ffx config set connectivity.enable_usb true |
| fx-command-exec host-tool ffx daemon stop |
| |
| fx-command-exec host-tool ffx target list -f addresses --allow-addrs usb | grep usb >/dev/null 2>&1 || (echo "USB was enabled but no USB device was found. Make sure your device is plugged in and try `ffx target list` to verify it has a USB address."; exit 1) |