docs: add very basic ubus docs
authorJohn Crispin <blogic@openwrt.org>
Thu, 31 Mar 2016 21:36:15 +0000 (23:36 +0200)
committerJohn Crispin <blogic@openwrt.org>
Thu, 31 Mar 2016 21:36:15 +0000 (23:36 +0200)
Signed-off-by: John Crispin <blogic@openwrt.org>
docs/header.txt [new file with mode: 0644]
docs/index.txt [new file with mode: 0644]
docs/ubus.txt [new file with mode: 0644]
pages/header.txt

diff --git a/docs/header.txt b/docs/header.txt
new file mode 100644 (file)
index 0000000..7ed3eb6
--- /dev/null
@@ -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 (file)
index 0000000..765c5f0
--- /dev/null
@@ -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 (file)
index 0000000..9c57c0a
--- /dev/null
@@ -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 [<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
+----
+
+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
+----
+
+
index 6b8bd3d45769510a890668f1abbefdf3a363cb03..a9a94531dea592a8b4ccb076fe7c96c049568dbf 100644 (file)
@@ -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]
 |====