Running multiple Cuttlefish virtual devices can be simply done by executing the following command
When you are running two or more instances using
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
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.
Launching 2 Cuttlefish instances that share the Wi-Fi medium using serial execution of 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
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
|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]|
wmediumd_control is a command line tool that controls Wi-Fi medium. It has
commands to manipulate Wi-Fi.
|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|
If you want to connect to OpenWRT (Access Point), use following command