Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docs:guide-developer:ubus [2016/10/27 06:20] – ↷ Page moved from docs:config:ubus to docs:guide-developer:ubus bobafetthotmaildocs:guide-developer:ubus [2020/01/11 13:16] (current) – removed duplicated description stokito
Line 3: Line 3:
 ===== uBus - IPC/RPC ===== ===== uBus - IPC/RPC =====
  
-uBus is the interconnect system used by most services running on a //LEDE// setup. Services can connect to the bus and provide methods that can be called by other services or clients.+uBus is the interconnect system used by most services running on a //OpenWrt// setup. Services can connect to the bus and provide methods that can be called by other services or clients.
  
-There is a CLI that can be used to communicate with services on the bus.+See [[docs:techref:ubus|uBus Technical Reference]]
  
-<code> 
-root@lede:/# 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 
  
-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 
-</code> 
  
 +====Reference documentation for ubus====
  
-To find out which services are currently running on the bus simply use the list commandThis will show a complete list. +**Path only contains the first contextE.g. network for network.interface.wan**
- +
- +
-<code> +
-root@lede:/# ubus list +
-dhcp +
-log +
-network +
-network.device +
-network.interface +
-network.interface.loopback +
-network.interface.wan +
-network.interface.wan6 +
-network.wireless +
-service +
-system +
-</code> +
- +
- +
-To find out which methods a specific service provides also use the list command but add a few more parameters to see a complete list +
- +
- +
-<code> +
-root@OpenWrt:/# ubus -v list system +
-'system' @6b093875 +
-        "board":{} +
-        "info":{} +
-        "upgrade":{} +
-        "watchdog":{"frequency":"Integer","timeout":"Integer","stop":"Boolean"+
-        "signal":{"pid":"Integer","signum":"Integer"+
-</code> +
- +
- +
-You can now call a remote method and receive a reply. A reply may be a simple integer return code or a more complete reply. Internally the bus uses a blob format, the CLI conveniently converts this to JSON. +
- +
- +
-<code> +
-root@lede:/# ubus call system board +
-+
-        "kernel": "4.4.6", +
-        "hostname": "lede", +
-        "system": "MIPS Malta", +
-        "release":+
-                "distribution": "LEDE", +
-                "version": "HEAD", +
-                "revision": "3", +
-                "codename": "designated_driver", +
-                "target": "malta\/le", +
-                "description": "LEDE Designated Driver 3" +
-        } +
-+
-</code> +
- +
- +
-You can call a method and pass it some parameters by simply appending a JSON structure to the CLI command. +
- +
- +
-<code> +
-root@lede:/# ubus call system signal '{ "pid": 123, "signum": 9 }' +
-root@lede:/# echo $? +
-+
-</code>+
  
 +^ path ^ Description ^ Package ^
 +| [[docs:guide-developer:ubus:dhcp]] | dhcp server | odhcpd |
 +| [[docs:guide-developer:ubus:file]] | file | rpcd |
 +| [[docs:guide-developer:ubus:hostapd]] | acesspoints | wpad/hostapd |
 +| [[docs:guide-developer:ubus:iwinfo]] | wireless informations | rpcd iwinfo |
 +| [[docs:guide-developer:ubus:log]] | logging | procd |
 +| [[docs:guide-developer:ubus:mdns]] | mdns avahi replacement | mdnsd |
 +| [[docs:guide-developer:ubus:network]] | network | netifd |
 +| [[docs:guide-developer:ubus:service]] | init/service | procd |
 +| [[docs:guide-developer:ubus:session]] | Session management | rpcd |
 +| [[docs:guide-developer:ubus:system]] | system misc | procd |
 +| [[docs:guide-developer:ubus:uci]] | Unified Configuration Interface | rpcd |
  • Last modified: 2016/10/27 06:20
  • by bobafetthotmail