提交 e3ece672 编写于 作者: O openharmony_ci 提交者: Gitee

!28 1. 适配getprop修改为getparam 2. 适配hdc_std的修改

Merge pull request !28 from alex_hold/master
......@@ -168,14 +168,14 @@ class Device(IDevice):
def get_device_type(self):
model = self.get_property("ro.build.characteristics",
abort_on_exception=True)
self.label = self.model_dict.get(model, None)
self.label = self.model_dict.get(model.lower(), None)
def get_property(self, prop_name, retry=RETRY_ATTEMPTS,
abort_on_exception=False):
"""
Hdc command, ddmlib function.
"""
command = "getprop %s" % prop_name
command = "getparam %s" % prop_name
stdout = self.execute_shell_command(
command, timeout=5 * 1000, output_flag=False, retry=retry,
abort_on_exception=abort_on_exception).strip()
......@@ -366,7 +366,7 @@ class Device(IDevice):
pass
def get_recover_result(self, retry=RETRY_ATTEMPTS):
command = "getprop ro.product.device"
command = "getparam ro.product.model"
stdout = self.execute_shell_command(command, timeout=5 * 1000,
output_flag=False, retry=retry,
abort_on_exception=True).strip()
......
......@@ -86,7 +86,7 @@ class DeviceStateMonitor(object):
while int(time.time()*1000) - start_time < wait_time:
try:
result = self.device.get_recover_result(retry=0)
if result == "1":
if result == "ohos":
return True
except Exception as exception:
self.device.log.error("wait for boot complete exception: %s"
......
......@@ -753,10 +753,6 @@ class HdcHelper:
sock = HdcHelper.socket(host=device.host, port=device.port,
timeout=DEFAULT_TIMEOUT)
HdcHelper.handle_shake(sock, device.device_sn)
local_end = os.path.split(local)[-1]
remote_end = os.path.split(remote)[-1]
if not local_end == remote_end:
remote = os.path.join(remote, local_end)
request = HdcHelper.form_hdc_request("file send %s %s" %
(local, remote))
HdcHelper.write(sock, request)
......@@ -772,15 +768,9 @@ class HdcHelper:
device.log.info("%s execute command: hdc file recv %s to %s" %
(convert_serial(device.device_sn), remote, local))
if not os.path.exists(local):
raise HdcError("Local path doesn't exist.")
sock = HdcHelper.socket(host=device.host, port=device.port,
timeout=DEFAULT_TIMEOUT)
HdcHelper.handle_shake(sock, device.device_sn)
local_end = os.path.split(local)[-1]
remote_end = os.path.split(remote)[-1]
if not local_end == remote_end:
remote = os.path.join(remote, local_end)
request = HdcHelper.form_hdc_request("file recv %s %s" %
(local, remote))
HdcHelper.write(sock, request)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册