From 1ed68d422ea534cd715142f2a377442009dc5c2d Mon Sep 17 00:00:00 2001 From: Peng Li Date: Sat, 28 Jul 2018 20:56:39 +0800 Subject: [PATCH 1/1] Use hostname infor instead of users list --- board/suanzi-support | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/board/suanzi-support b/board/suanzi-support index 3795d83..f55b41a 100755 --- a/board/suanzi-support +++ b/board/suanzi-support @@ -39,11 +39,8 @@ def get_mac_str(): m = re.sub('^0x|L$', '', mac) return '{:0>12}'.format(m) - -def get_users(): - out = check_output("/bin/ls /home", shell=True).strip() - out = out.strip().split() - return " ".join(out) +def get_hostname(): + return check_output("/bin/hostname", shell=True).strip(); def exec_ssh(port): if port == None: @@ -71,7 +68,7 @@ def on_message(client, userdata, msg): else: raise Exception ('run ssh failed') if payload['command'] == 'list': - response = {'from': userdata['id'], 'type':'response', 'command':payload['command'], 'data': get_users()} + response = {'from': userdata['id'], 'type':'response', 'command':payload['command'], 'data': get_hostname()} client.publish(payload['from'], str(response)) -- 2.11.0