Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
671c9f500f | ||
|
|
7d13a21b9e | ||
|
|
8bc2f30980 | ||
|
|
4d370eb48b | ||
|
|
fbfd8e008e | ||
|
|
b366fb07e3 | ||
|
|
92df13b064 | ||
|
|
f6f615be35 |
+49
-28
@@ -1,6 +1,6 @@
|
||||
param(
|
||||
[Parameter(Position=0)][String[]]$deviceID,
|
||||
[String[]]$adb
|
||||
[String]$adb,
|
||||
[String]$workdir
|
||||
)
|
||||
Set-PSDebug -Trace 2
|
||||
$ErrorActionPreference = 'Inquire'
|
||||
@@ -8,36 +8,57 @@ $shell = New-Object -ComObject Wscript.Shell
|
||||
[regex]$deviceIDRegex='(?<!:)(\w\w\w\w+)(?=\s+device)'
|
||||
[regex]$deviceIPRegex='(\d+.\d+.\d+.\d+)(?=\/)'
|
||||
|
||||
if( !$adb ){
|
||||
$adb=Get-Command "adb" -ErrorAction SilentlyContinue
|
||||
if( !$adb ){
|
||||
$shell.Popup("ADB not found!")
|
||||
exit 1
|
||||
if($workdir)
|
||||
{
|
||||
Set-Location $workdir
|
||||
}
|
||||
|
||||
if( !$adb )
|
||||
{
|
||||
$adb=Get-Command "adb" -ErrorAction SilentlyContinue
|
||||
if( !$adb )
|
||||
{
|
||||
if( Test-Path adb.exe )
|
||||
{
|
||||
$adb="adb.exe"
|
||||
}
|
||||
else
|
||||
{
|
||||
$shell.Popup("ADB not found!")
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$deviceID=& $adb devices
|
||||
$deviceID=$deviceIDRegex.Matches($deviceID)
|
||||
if($deviceID.Count -eq 0){
|
||||
$shell.Popup("Device not found!")
|
||||
exit 1
|
||||
}
|
||||
foreach ($devid in $deviceID){
|
||||
$env:ANDROID_SERIAL=$devid
|
||||
$devmodel=&$adb shell getprop ro.product.model
|
||||
if($shell.Popup("connect $devmodel $devid wirelessely?",0,'',4) -eq 6) {
|
||||
$tcpip=&$adb shell getprop service.adb.tcp.port
|
||||
if ($tcpip.Length -eq 0)
|
||||
{&$adb tcpip 5555
|
||||
$tcpip='5555'
|
||||
Start-Sleep 1
|
||||
&$adb wait-for-device}
|
||||
$ip=&$adb shell ip -4 addr show wlan0
|
||||
$ip=$deviceIPRegex.Match($ip)
|
||||
if($ip.Length -eq 0)
|
||||
{$shell.Popup("Device IP not found!")
|
||||
exit 1}
|
||||
$result=&$adb connect $ip':'$tcpip
|
||||
$shell.Popup($result)
|
||||
if($deviceID.Count -eq 0)
|
||||
{
|
||||
$shell.Popup("Device not found!")
|
||||
exit 1
|
||||
}
|
||||
foreach ($devid in $deviceID)
|
||||
{
|
||||
$env:ANDROID_SERIAL=$devid
|
||||
$devmodel=&$adb shell getprop ro.product.model
|
||||
if($shell.Popup("connect $devmodel $devid wirelessely?",0,'',4) -eq 6)
|
||||
{
|
||||
$tcpip=&$adb shell getprop service.adb.tcp.port
|
||||
if ($tcpip.Length -eq 0)
|
||||
{
|
||||
&$adb tcpip 5555
|
||||
$tcpip='5555'
|
||||
Start-Sleep 1
|
||||
&$adb wait-for-device
|
||||
}
|
||||
$ip=&$adb shell ip -4 addr show wlan0
|
||||
$ip=$deviceIPRegex.Match($ip)
|
||||
if($ip.Length -eq 0)
|
||||
{
|
||||
$shell.Popup("Device IP not found!")
|
||||
exit 1
|
||||
}
|
||||
$result=&$adb connect $ip':'$tcpip
|
||||
$shell.Popup($result)
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,5 @@
|
||||
;!@Install@!UTF-8!
|
||||
GUIMode="2"
|
||||
MiscFlags="4"
|
||||
RunProgram="powershell -executionpolicy bypass -file %%T\adb-wireless.ps1"
|
||||
RunProgram="powershell -executionpolicy bypass -file %%T\adb-wireless.ps1 -workdir %%S"
|
||||
;Config file generated by 7z SFX Builder v2.1. (http://sourceforge.net/projects/s-zipsfxbuilder/)
|
||||
;!@InstallEnd@!
|
||||
7zSFXBuilder_7zArchive=C:\Users\Josef\Documents\adb-wireless\adb-wireless.7z
|
||||
7zSFXBuilder_SFXIcon=C:\Users\Josef\Documents\adb-wireless\1-45_icon-icons.com_69169.ico
|
||||
7zSFXBuilder_UseDefMod=7zsd_All_x64
|
||||
7zSFXBuilder_UPXCommands=--best --all-methods
|
||||
;!@InstallEnd@!
|
||||
Reference in New Issue
Block a user