From a2cf5e13ed149e668eb8e99264182362411d2e81 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Thu, 31 Mar 2016 23:36:15 +0200 Subject: [PATCH] docs: add very basic ubus docs Signed-off-by: John Crispin --- docs/header.txt | 5 +++ docs/index.txt | 13 ++++++++ docs/ubus.txt | 82 ++++++++++++++++++++++++++++++++++++++++++++++++ pages/header.txt | 2 +- 4 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 docs/header.txt create mode 100644 docs/index.txt create mode 100644 docs/ubus.txt diff --git a/docs/header.txt b/docs/header.txt new file mode 100644 index 0000000..7ed3eb6 --- /dev/null +++ b/docs/header.txt @@ -0,0 +1,5 @@ +== image:../logo/logo_small.png[width="39"] Linux Embedded Developement Environment + +|==== +^| link:index.html[Index] ^| link:ubus.html[uBus] ^| link:procd.html[Procd] +|==== diff --git a/docs/index.txt b/docs/index.txt new file mode 100644 index 0000000..765c5f0 --- /dev/null +++ b/docs/index.txt @@ -0,0 +1,13 @@ +include::header.txt[] + +=== The Web Presence + +The documentation you're reading is generated from text files using the +http://www.methods.co.nz/asciidoc/[AsciiDoc] suite. Any changes made to the +projects documentation will be reflected in our +web.git+ repository: + +---- +git clone http://git.lede-project.org/web.git +---- + +If you would like to contribute to the documentation then please send patches to our lede-dev mailing list and use the prefix "doc:" in the patches subject. diff --git a/docs/ubus.txt b/docs/ubus.txt new file mode 100644 index 0000000..9c57c0a --- /dev/null +++ b/docs/ubus.txt @@ -0,0 +1,82 @@ +include::header.txt[] + +== uBus - IPC/RPC + +uBus is the interconnect system used by most service running on a _LEDE_ setup. +Service 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. + +---- +root@lede:/# ubus +Usage: ubus [] [arguments...] +Options: +-s : Set the unix domain socket to connect to +-t : Set the timeout (in seconds) for a command to complete +-S: Use simplified output (for scripts) +-v: More verbose output + +Commands: +- list [] List objects +- call [] Call an object method +- listen [...] Listen for events +- send [] Send an event +- wait_for [...] Wait for multiple objects to appear on ubus +---- + +To find out which services are currently running on the bus simply use the list command. This will show a complete list. + +---- +root@lede:/# ubus list +dhcp +log +network +network.device +network.interface +network.interface.loopback +network.interface.wan +network.interface.wan6 +network.wireless +service +system +---- + +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 + +---- +root@OpenWrt:/# ubus -v list system +'system' @6b093875 + "board":{} + "info":{} + "upgrade":{} + "watchdog":{"frequency":"Integer","timeout":"Integer","stop":"Boolean"} + "signal":{"pid":"Integer","signum":"Integer"} +---- + +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. + +---- +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" + } +} +---- + +You can call a method and pass it some parameters by simply appending a JSON structure to the CLI command. +---- +root@lede:/# ubus call system signal '{ "pid": 123, "signum": 9 }' +root@lede:/# echo $? +0 +---- + + diff --git a/pages/header.txt b/pages/header.txt index 6b8bd3d..a9a9453 100644 --- a/pages/header.txt +++ b/pages/header.txt @@ -1,5 +1,5 @@ == image:logo/logo_small.png[width="39"] Linux Embedded Developement Environment |==== -^| link:index.html[About] ^| link:communication.html[Communication] ^| link:rules.html[Rules] ^| link:source.html[Source] ^| link:todo.html[Todo] ^| link:meetings.html[Meetings] +^| link:index.html[About] ^| link:communication.html[Communication] ^| link:rules.html[Rules] ^| link:source.html[Source] ^| link:todo.html[Todo] ^| link:meetings.html[Meetings] ^| link:docs/index.html[Documentation] |==== -- 2.30.2