Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Test Xdevice
提交
08979ee7
T
Test Xdevice
项目概览
OpenHarmony
/
Test Xdevice
9 个月 前同步成功
通知
6
Star
23
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Test Xdevice
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
08979ee7
编写于
9月 16, 2021
作者:
A
alex_hold
提交者:
Gitee
9月 16, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update extension/src/xdevice_extension/_core/environment/device.py.
Signed-off-by:<hejian3@huawei.com>
上级
3eb25e64
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
13 deletion
+17
-13
extension/src/xdevice_extension/_core/environment/device.py
extension/src/xdevice_extension/_core/environment/device.py
+17
-13
未找到文件。
extension/src/xdevice_extension/_core/environment/device.py
浏览文件 @
08979ee7
...
...
@@ -27,6 +27,7 @@ from xdevice import Plugin
from
xdevice
import
exec_cmd
from
xdevice
import
ConfigConst
from
xdevice_extension._core
import
utils
from
xdevice_extension._core.environment.dmlib
import
HdcHelper
from
xdevice_extension._core.exception
import
HdcError
from
xdevice_extension._core.environment.dmlib
import
CollectingOutputReceiver
...
...
@@ -72,7 +73,7 @@ def perform_device_action(func):
if
self
.
usb_type
==
DeviceConnectorType
.
hdc
:
cmd
=
"hdc reset"
self
.
log
.
info
(
"re-execute hdc reset"
)
exec_cmd
(
cmd
)
exec_cmd
(
cmd
)
if
not
self
.
recover_device
():
LOG
.
debug
(
"set device %s %s false"
%
(
self
.
device_sn
,
ConfigConst
.
recover_state
))
...
...
@@ -166,9 +167,7 @@ class Device(IDevice):
return
self
.
device_state_monitor
.
wait_for_device_available
()
def
get_device_type
(
self
):
model
=
self
.
get_property
(
"ro.build.characteristics"
,
abort_on_exception
=
True
)
self
.
label
=
self
.
model_dict
.
get
(
model
.
lower
(),
None
)
self
.
label
=
self
.
model_dict
.
get
(
"default"
,
None
)
def
get_property
(
self
,
prop_name
,
retry
=
RETRY_ATTEMPTS
,
abort_on_exception
=
False
):
...
...
@@ -193,7 +192,7 @@ class Device(IDevice):
if
self
.
usb_type
==
DeviceConnectorType
.
hdc
:
LOG
.
debug
(
"%s execute command hdc %s%s"
%
(
convert_serial
(
self
.
device_sn
),
command
,
timeout_msg
))
cmd
=
[
"hdc_std"
,
"-t"
,
self
.
device_sn
]
cmd
=
[
"hdc_std"
,
"-t"
,
self
.
device_sn
]
if
isinstance
(
command
,
list
):
cmd
.
extend
(
command
)
else
:
...
...
@@ -292,9 +291,6 @@ class Device(IDevice):
timeout
=
kwargs
.
get
(
"timeout"
,
TIMEOUT
)
HdcHelper
.
push_file
(
self
,
local
,
remote
,
is_create
=
is_create
,
timeout
=
timeout
)
if
not
self
.
is_file_exist
(
remote
):
LOG
.
error
(
"push %s to %s failed"
%
(
local
,
remote
))
raise
HdcError
(
"push %s to %s failed"
%
(
local
,
remote
))
@
perform_device_action
def
pull_file
(
self
,
remote
,
local
,
**
kwargs
):
...
...
@@ -337,9 +333,7 @@ class Device(IDevice):
def
is_file_exist
(
self
,
file_path
):
file_path
=
check_path_legal
(
file_path
)
command
=
[
"hdc_std"
,
"shell"
,
"ls"
,
file_path
]
output
=
exec_cmd
(
command
)
output
=
self
.
execute_shell_command
(
"ls {}"
.
format
(
file_path
))
if
output
and
"No such file or directory"
not
in
output
:
return
True
return
False
...
...
@@ -360,10 +354,20 @@ class Device(IDevice):
self
.
_stop_catch_device_log
()
def
_start_catch_device_log
(
self
):
pass
if
self
.
hilog_file_pipe
:
command
=
"hilog"
if
self
.
usb_type
==
DeviceConnectorType
.
hdc
:
cmd
=
[
'hdc_std'
,
"-t"
,
self
.
device_sn
,
"shell"
,
command
]
LOG
.
info
(
"execute command: %s"
%
" "
.
join
(
cmd
).
replace
(
self
.
device_sn
,
convert_serial
(
self
.
device_sn
)))
self
.
device_hilog_proc
=
utils
.
start_standing_subprocess
(
cmd
,
self
.
hilog_file_pipe
)
def
_stop_catch_device_log
(
self
):
pass
if
self
.
device_hilog_proc
:
utils
.
stop_standing_subprocess
(
self
.
device_hilog_proc
)
self
.
device_hilog_proc
=
None
self
.
hilog_file_pipe
=
None
def
get_recover_result
(
self
,
retry
=
RETRY_ATTEMPTS
):
command
=
"getparam ro.product.model"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录