From: Peng Li Date: Fri, 22 Jun 2018 08:26:16 +0000 (+0800) Subject: fix mac address id X-Git-Url: http://47.100.26.94:8080/?a=commitdiff_plain;h=c049e62c874efcae34bbce9e01d4b9829217b0b1;p=remote-debug.git fix mac address id --- diff --git a/mqtt-client.py b/mqtt-client.py index cbc7cd4..59eff28 100644 --- a/mqtt-client.py +++ b/mqtt-client.py @@ -21,7 +21,9 @@ if __name__ == '__main__': def on_message(client, userdata, msg): print(msg.topic+" "+str(msg.payload)) if msg.topic == id + '-response': - print 'port is', str(msg.payload) + port = msg.payload + print 'port is', str(port) + print 'run ssh user@autossh.suanzi.ai -p ' + str(port) + ' to connect to ' + id + ' device' client = mqtt.Client() client.on_connect = on_connect diff --git a/suanzi-support b/suanzi-support index 8809b05..d016b06 100755 --- a/suanzi-support +++ b/suanzi-support @@ -67,7 +67,7 @@ class MyClient(mqtt.Client): if __name__ == '__main__': mac = hex(get_mac()) - id = os.getenv('USER') + '-' + '{:0>12}'.format(mac[2:13]) + id = os.getenv('USER') + '-' + '{:0>12}'.format(mac[2:-1]) print 'id is: ' , id client = MyClient(id) client.connect(MQTT_SERVER, MQTT_PORT, 60)