Add support Xiaomi Mi AIoT Router AC2350 (r2350)

pull/3/head
remittor 3 years ago
parent 5fd5d2fe32
commit de85bf395a

@ -31,7 +31,11 @@ if gw.status < 1:
dn = gw.device_name
if dn == 'rm2100':
if dn == 'rm2100' or dn == 'r2350':
import connect2
sys.exit(0)
if dn == 'r3600' and gw.rom_version == '1.0.17':
import connect2
sys.exit(0)

@ -23,24 +23,37 @@ print("device_name =", gw.device_name)
print("rom_version = {} {}".format(gw.rom_version, gw.rom_channel))
print("mac address = {}".format(gw.mac_address))
dn = gw.device_name
gw.ssh_port = 22
if gw.ping(verbose = 0) is True:
die(0, "Stock SSH server already installed and running")
stok = gw.web_login()
ext_name = 'misystem/set_config_iotdev'
user_id = '_username_'
def exec_cmd(cmd):
params = { 'bssid': 'Xiaomi', 'user_id': user_id, 'ssid': ('-h' + '\n' + cmd + '\n') }
res = requests.get(gw.apiurl + "set_config_iotdev", params = params)
exec_cmd('nvram set ssh_en=1; nvram commit;')
exec_cmd('echo -e "root\\nroot" | passwd root')
exec_cmd("sed -i 's/channel=.*/channel=\"debug\"/g' /etc/init.d/dropbear")
exec_cmd("/etc/init.d/dropbear stop")
exec_cmd("/etc/init.d/dropbear start")
res = requests.get(gw.apiurl + ext_name, params = params)
return res.text
res = exec_cmd('nvram set bootdelay=5; nvram set ssh_en=1; nvram commit;')
if res != '{"code":0}':
die('Extension "/api/{}" not working!'.fromat(ext_name))
cmd = ''
cmd += 'echo -e "root\\nroot" | passwd root' + '\n'
#cmd += 'sed -i \'s/channel=.*/channel="debug"/g\' /etc/init.d/dropbear' + '\n'
cmd += 'sed -i \'s/"$flg_ssh" != "1" -o "$channel" = "release"/-n ""/g\' /etc/init.d/dropbear' + '\n'
cmd += "/etc/init.d/dropbear enable" + '\n'
cmd += "/etc/init.d/dropbear restart" + '\n'
cmd += 'logger -p err -t XMiR "completed!"' + '\n'
res = exec_cmd(cmd)
#if res != '{"code":0}':
# die('Extension "/api/misystem/set_config_iotdev" not working!!!')
time.sleep(0.5)
gw.ping()
gw.ping(contimeout = 32) # RSA host key generate very slow!
print("")
print("#### Connection to device {} is OK ####".format(gw.device_name))

@ -162,6 +162,7 @@ class Gateway():
die("WEB password is not correct!")
self.webpassword = web_pass
self.stok = stok
return stok
@property
def apiurl(self):

Loading…
Cancel
Save