Wi-Fi

This page describes how to control Wi-Fi on a Cuttlefish device.

Use Wmediumd

The Cuttlefish Wi-Fi feature uses Wmediumd, a simulation tool, to simulate the wireless medium. Wmediumd manages the delivery of Wi-Fi packets between two Cuttlefish instances or between a Cuttlefish instance and an OpenWRT instance. Wmedium for Cuttlefish is implemented in /platform/external/wmediumd/.

To control the Wmediumd interface, use the WmediumdService (Android 14 or higher) or wmedium_control (Android 13 or lower) tool.

WmediumdService

For devices running Android 14 or higher, use WmediumdService to control the Wmedium tool. For details on how to control this service using the REST API or the command line interface (CLI), see Cuttlefish: Environment Control.

The following table lists the methods in WmediumdService. For detailed information about the methods, see wmediumd.proto.

Methods Description
ListStations List all stations attached to Wmediumd.
LoadConfig Load Wmediumd configuration with a given file.
ReloadConfig Reload currently loaded Wmediumd configuration file.
SetCivicloc Set civic location (for example, postal address) of the specific station.
SetLci Set LCI (latitude, longitude, altitude) of the specific station.
SetPosition Set position of the station in two-dimensional space.
SetSnr Set signal-to-noise ratio (SNR) value (0-255) between two stations.
SetTxpower Set transmit power (TX power) of the specific station.
StartPcap Start capturing all frames transmitted to air and store it to a .pcap file.
StopPcap Stop and finalize current packet capture.

wmediumd_control

For devices running Android 13 or lower, use the wmediumd_control tool to control the wireless medium in Cuttlefish devices. The following table lists subcommands in wmediumd_control.

Subcommands Description
list_stations List all stations attached to Wmediumd.
reload_config [CONFIG_FILE_PATH] Reload Wmediumd configuration with CONFIG_FILE_PATH . If CONFIG_FILE_PATH is omitted, reload currently loaded config file.
set_civicloc MAC_ADDR CIVICLOC Set civic location (for example, postal address) of the specific station.
set_lci MAC_ADDR LCI Set LCI (latitude, longitude, altitude) of the specific station.
set_position MAC_ADDR X_POSITION Y_POSITION Set position of the station in two-dimensional space.
set_snr MAC_ADDR1 MAC_ADDR2 SNR_VALUE Set signal-to-noise ratio (SNR) value (0-255) between two stations.
start_pcap PCAP_FILE_PATH Start capturing all frames transmitted to air and store it to a .pcap file.
stop_pcap Stop and finalize current packet capture.

Use OpenWRT

The Cuttlefish Wi-Fi feature supports using OpenWRT for virtualizing Wi-Fi access points (APs). The OpenWRT implementation for Cuttlefish is at platform/external/openwrt-prebuilts/.

To connect to OpenWRT, use the information in the following table. If you don't append any options when launching Cuttlefish, the device ID is cvd-1, and the OpenWRT WAN IP address is 192.168.94.2 or 192.168.96.2.

Connection type Destination
SSH root@OPENWRT_WAN_IP_ADDRESS
Webpage https://localhost:1443/devices/DEVICE_ID/openwrt
Webpage (legacy) https://OPENWRT_WAN_IP_ADDRESS

OpenwrtControlService

For devices running Android 14 or higher, to control and configure virtualized Wi-Fi APs, use the OpenwrtControlService service. For details on how to control this service using the REST API or the CLI, see Cuttlefish: Environment Control.

The following table lists the methods in OpenwrtControlService. For detailed information about the methods, see openwrt_control.proto.

Methods Description
LuciRpc Send RPC call to the Luci web interface in OpenWRT.
OpenwrtIpAddr Get OpenWRT WAN IP address. Use this address to connect an OpenWRT instance through SSH or a web interface.