mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-30 17:50:46 +00:00
target: Properly propagate ADB port information
Some ADB servers may use non-standard port number. Hence, add 'adb_port' property to AndroidTarget class and pass port number down to adb_command(). Signed-off-by: Metin Kaya <metin.kaya@arm.com>
This commit is contained in:
parent
38d4796e41
commit
bbdd2ab67c
@ -1903,6 +1903,10 @@ class AndroidTarget(Target):
|
|||||||
def adb_server(self):
|
def adb_server(self):
|
||||||
return getattr(self.conn, 'adb_server', None)
|
return getattr(self.conn, 'adb_server', None)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def adb_port(self):
|
||||||
|
return getattr(self.conn, 'adb_port', None)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@memoized
|
@memoized
|
||||||
def android_id(self):
|
def android_id(self):
|
||||||
@ -2240,8 +2244,10 @@ class AndroidTarget(Target):
|
|||||||
flags.append('-g') # Grant all runtime permissions
|
flags.append('-g') # Grant all runtime permissions
|
||||||
self.logger.debug("Replace APK = {}, ADB flags = '{}'".format(replace, ' '.join(flags)))
|
self.logger.debug("Replace APK = {}, ADB flags = '{}'".format(replace, ' '.join(flags)))
|
||||||
if isinstance(self.conn, AdbConnection):
|
if isinstance(self.conn, AdbConnection):
|
||||||
return adb_command(self.adb_name, "install {} {}".format(' '.join(flags), quote(filepath)),
|
return adb_command(self.adb_name,
|
||||||
timeout=timeout, adb_server=self.adb_server)
|
"install {} {}".format(' '.join(flags), quote(filepath)),
|
||||||
|
timeout=timeout, adb_server=self.adb_server,
|
||||||
|
adb_port=self.adb_port)
|
||||||
else:
|
else:
|
||||||
dev_path = self.get_workpath(filepath.rsplit(os.path.sep, 1)[-1])
|
dev_path = self.get_workpath(filepath.rsplit(os.path.sep, 1)[-1])
|
||||||
await self.push.asyn(quote(filepath), dev_path, timeout=timeout)
|
await self.push.asyn(quote(filepath), dev_path, timeout=timeout)
|
||||||
@ -2319,7 +2325,7 @@ class AndroidTarget(Target):
|
|||||||
async def uninstall_package(self, package):
|
async def uninstall_package(self, package):
|
||||||
if isinstance(self.conn, AdbConnection):
|
if isinstance(self.conn, AdbConnection):
|
||||||
adb_command(self.adb_name, "uninstall {}".format(quote(package)), timeout=30,
|
adb_command(self.adb_name, "uninstall {}".format(quote(package)), timeout=30,
|
||||||
adb_server=self.adb_server)
|
adb_server=self.adb_server, adb_port=self.adb_port)
|
||||||
else:
|
else:
|
||||||
await self.execute.asyn("pm uninstall {}".format(quote(package)), timeout=30)
|
await self.execute.asyn("pm uninstall {}".format(quote(package)), timeout=30)
|
||||||
|
|
||||||
@ -2338,7 +2344,8 @@ class AndroidTarget(Target):
|
|||||||
logcat_opts = '-d' + formatstr + filtstr
|
logcat_opts = '-d' + formatstr + filtstr
|
||||||
if isinstance(self.conn, AdbConnection):
|
if isinstance(self.conn, AdbConnection):
|
||||||
command = 'logcat {} {} {}'.format(logcat_opts, op, quote(filepath))
|
command = 'logcat {} {} {}'.format(logcat_opts, op, quote(filepath))
|
||||||
adb_command(self.adb_name, command, timeout=timeout, adb_server=self.adb_server)
|
adb_command(self.adb_name, command, timeout=timeout, adb_server=self.adb_server,
|
||||||
|
adb_port=self.adb_port)
|
||||||
else:
|
else:
|
||||||
dev_path = self.get_workpath('logcat')
|
dev_path = self.get_workpath('logcat')
|
||||||
command = 'logcat {} {} {}'.format(logcat_opts, op, quote(dev_path))
|
command = 'logcat {} {} {}'.format(logcat_opts, op, quote(dev_path))
|
||||||
@ -2352,7 +2359,8 @@ class AndroidTarget(Target):
|
|||||||
if locked:
|
if locked:
|
||||||
try:
|
try:
|
||||||
if isinstance(self.conn, AdbConnection):
|
if isinstance(self.conn, AdbConnection):
|
||||||
adb_command(self.adb_name, 'logcat -c', timeout=30, adb_server=self.adb_server)
|
adb_command(self.adb_name, 'logcat -c', timeout=30, adb_server=self.adb_server,
|
||||||
|
adb_port=self.adb_port)
|
||||||
else:
|
else:
|
||||||
await self.execute.asyn('logcat -c', timeout=30)
|
await self.execute.asyn('logcat -c', timeout=30)
|
||||||
finally:
|
finally:
|
||||||
@ -3154,7 +3162,7 @@ class ChromeOsTarget(LinuxTarget):
|
|||||||
# We can't determine if the target supports android until connected to the linux host so
|
# We can't determine if the target supports android until connected to the linux host so
|
||||||
# create unconditionally.
|
# create unconditionally.
|
||||||
# Pull out adb connection settings
|
# Pull out adb connection settings
|
||||||
adb_conn_params = ['device', 'adb_server', 'timeout']
|
adb_conn_params = ['device', 'adb_server', 'adb_port', 'timeout']
|
||||||
self.android_connection_settings = {}
|
self.android_connection_settings = {}
|
||||||
self.android_connection_settings.update(
|
self.android_connection_settings.update(
|
||||||
(key, value)
|
(key, value)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user