ubus为openwrt平台开发中的进程间通信提供了一个通用的框架,它让进程间通信的实现变得非常简单。
同时ubus也作为Luci重要的组件,提供web界面和系统之间的信息沟通。
适用版本openwrt v19.07.4
- ubus支持的命令
root@Eric:/# ubus
Usage: ubus [<options>] <command> [arguments...]
Options:
-s <socket>: Set the unix domain socket to connect to
-t <timeout>: Set the timeout (in seconds) for a command to complete
-S: Use simplified output (for scripts)
-v: More verbose output
-m <type>: (for monitor): include a specific message type
(can be used more than once)
-M <r|t> (for monitor): only capture received or transmitted traffic
Commands:
- list [<path>] List objects
- call <path> <method> [<message>] Call an object method
- listen [<path>...] Listen for events
- send <type> [<message>] Send an event
- wait_for <object> [<object>...] Wait for multiple objects to appear on ubus
- monitor Monitor ubus traffic
- 例如:feeds/xluci2/luci2-base/htdocs/luci2/system.js中获取系统信息
getSystemInfo: L.rpc.declare({
object: 'system',
method: 'info',
expect: { '': { } }
}),
本质上是调用ubus call system info
root@Eric:/# ubus call system info
{
"localtime": 1599411007,
"uptime": 1838,
"load": [
24736,
15552,
12384
],
"memory": {
"total": 60755968,
"free": 33140736,
"shared": 143360,
"buffered": 2838528,
"available": 26689536,
"cached": 7913472
},
"swap": {
"total": 0,
"free": 0
}
}
知道以上关系,就可以进行luci界面调试了~~~