Testing Connectivity of Multiple Devices

Running multiple Cuttlefish virtual devices can be simply done by executing the following command

launch_cvd --num_instances=n

When you are running two or more instances using --num_instances flag, instances share medium for Wi-Fi and Bluetooth. So, the Cuttlefish instance can discover / connect other devices via Bluetooth / Wi-Fi without any other action.

But, If you are executing multiple instances by using flag --base_instance_num and multiple launch_cvd command, you need to specify wmediumd's vhost server path to share Wi-Fi medium, and also need to prevent launching multiple VM instances for AP.

Example

Launching 2 Cuttlefish instances that share the Wi-Fi medium using serial execution of launch_cvd.

launch_cvd
launch_cvd --base_instance_num=2 \
  --vhost_user_mac80211_hwsim=$HOME/cuttlefish_runtime.1/internal/vhost_user_mac80211 \
  --ap_kernel_image="" --ap_rootfs_image="" #Prevent launching multiple VM instances for AP

Bluetooth

The Cuttlefish bluetooth implementation is supported by rootcanal and can be controlled with the Web UI command line console.

In the console, there are several commands that allow for the control of bluetooth on the guest device

Command Description
list List current devices and phys
add DEVICE_TYPE [ARGS] Create new device of type DEVICE_TYPE
del DEVICE_INDEX Delete a device
add_phy PHY_TYPE Add new phy with PHY_TYPE
del_phy PHY_INDEX Delete a phy
add_device_to_phy DEVICE_INDEX PHY_INDEX Add a device to phy
del_device_from_phy DEVICE_INDEX PHY_INDEX Delete a device from phy
add_remote HOSTNAME PORT PHY_TYPE Add a remote Rootcanal as device and register it to phy
Device type and args
beacon [MAC_ADDRESS] [ADVERTISE_INTERVAL]
scripted_beacon [MAC_ADDRESS] [CONFIG_PATH] [EVENTS_PATH]
keyboard [MAC_ADDRESS] [ADVERTISE_INTERVAL]
loopback [MAC_ADDRESS] [ADVERTISE_INTERVAL]
sniffer

Wi-Fi

wmediumd_control

wmediumd_control is a command line tool that controls Wi-Fi medium. It has commands to manipulate Wi-Fi.

Command Description
set_snr MAC_ADDR1 MAC_ADDR2 SNR_VALUE Set SNR value (0~255) between two stations
start_pcap PCAP_FILE_PATH Start capturing all frames transmitted to air and stores it to .pcap file
stop_pcap Stop and finalize current packet capture
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_position MAC_ADDR X_POSITION Y_POSITION Set position of the station in two-dimensional space

OpenWRT

If you want to connect to OpenWRT (Access Point), use following command

Connection Type Method
ssh
ssh root@192.168.96.2
Admin webpage https://192.168.96.2