ubus (OpenWrt micro bus architecture)
來源:ubus (OpenWrt micro bus architecture)
ubus (OpenWrt micro bus architecture)
provide communication between various daemons and applications
using Unix sockets and it uses TLV (type-length-value) messages
Every daemon registers a set of paths under a specific namespace.
The ubus command line tool allows to interact with the ubusd server
ubus
顯示目前系統ubus提供那些service
ubus list
root@OpenWrt:/# ubus list dhcp log network network.device network.interface network.interface.lan network.interface.loopback network.interface.wan network.interface.wan6 network.wireless service session system uci
顯示system service 細節
-v (More verbose output)
顯示提供那些call object method
root@OpenWrt:/# ubus -v list system
'system' @b4b76d22
"board":{}
"info":{}
"upgrade":{}
"watchdog":{"frequency":"Integer","timeout":"Integer","stop":"Boolean"}
"signal":{"pid":"Integer","signum":"Integer"}
"nandupgrade":{"path":"String"}
root@OpenWrt:/#呼叫ubus service
root@OpenWrt:/# ubus call system board
{
"kernel": "3.18.29",
"hostname": "OpenWrt",
"system": "Atheros AR7240 rev 2",
"model": "TP-Link TL-WR741N\/ND v1",
"release": {
"distribution": "OpenWrt",
"version": "Chaos Calmer",
"revision": "r49118",
"codename": "chaos_calmer",
"target": "ar71xx\/generic",
"description": "OpenWrt Chaos Calmer 15.05.1"
}
}其它
openwrt中ubus的具体使用
ubus有两种调用,一个是method调用,一个是notification
其中method包括等待函数返回和不用等待返回
notification是广播和DBus的signal类似
ubus可以和ubusd服务器交互(和当前所有已经注册的服务).它对研究和调试注册的命名空间以及编写脚本非常有用
ubuscall 调用指定命名空间中指定的方法,并且通过消息传递给它, 消息参数必须是有效的JSON字符串,并且携带函数所要求的键及值
本站的文章和资源来自互联网或者站长的原创,按照 CC BY -NC -SA 3.0 CN协议发布和共享,转载或引用本站文章应遵循相同协议。如果有侵犯版权的资 源请尽快联系站长,我们会在24h内删除有争议的资源。欢迎大家多多交流,期待共同学习进步。








