1+ [CmdletBinding (PositionalBinding = $false )]
2+ param (
3+ [string ]$Interface = " " ,
4+ [Parameter (ValueFromRemainingArguments )]
5+ [string []]$RemainingArgs
6+ )
7+
8+
19$ErrorActionPreference = " Stop"
210Set-StrictMode - Version Latest
311
@@ -105,16 +113,22 @@ if ($tcp_devices) {
105113 if (Is- EmulatorDevice - DeviceSerial " $selected_device_serial " ) {
106114 $device_ip_only = " host.docker.internal"
107115 } else {
108- # Try different common Wi-Fi interface names
109- $wifi_interfaces = @ (" wlan0" , " wlan1" , " wifi0" , " wifi1" , " rmnet_data1" )
110116 $device_ip_only = $null
117+ $wifi_interfaces = @ ()
118+ if (-not [string ]::IsNullOrEmpty($Interface )) {
119+ Write-Host " Using specified network interface: $Interface "
120+ $wifi_interfaces = @ ($Interface )
121+ } else {
122+ # Try different common Wi-Fi interface names
123+ $wifi_interfaces = @ (" wlan0" , " wlan1" , " wifi0" , " wifi1" , " rmnet_data1" , " swlan0" , " swlan1" )
124+ }
111125
112- foreach ($interface in $wifi_interfaces ) {
113- $ADB_COMMAND = " ip -f inet addr show $interface | grep 'inet ' | awk '{print `$ 2}' | cut -d/ -f1"
126+ foreach ($interface_item in $wifi_interfaces ) {
127+ $ADB_COMMAND = " ip -f inet addr show $interface_item | grep 'inet ' | awk '{print `$ 2}' | cut -d/ -f1"
114128 $ip_result = adb - s $selected_device_serial shell $ADB_COMMAND
115129 if ($ip_result -and $ip_result.Trim () -ne " " ) {
116130 $device_ip_only = $ip_result.Trim ()
117- Write-Host " Found IP on interface $interface `: $device_ip_only "
131+ Write-Host " Found IP on interface $interface_item `: $device_ip_only "
118132 break
119133 }
120134 }
@@ -133,4 +147,8 @@ if ($tcp_devices) {
133147Write-Output " Device IP is: $device_ip "
134148$env: ADB_CONNECT_ADDR = " $device_ip "
135149
136- docker compose run -- build -- rm -- remove-orphans - it mobile- use-full - ip $args
150+ if (-not (Test-Path " ./llm-config.override.jsonc" )) {
151+ [System.IO.File ]::WriteAllText(" ./llm-config.override.jsonc" , " {}" )
152+ }
153+
154+ docker compose run -- build -- rm -- remove-orphans - it mobile- use-full - ip $RemainingArgs
0 commit comments