Collection of Onion ubus tools
Scans for wifi networks, returns an array of wifi networks containing the SSID and encryption type
ubus call onion wifi-scan '{"device":"wlan0"}'
Sample return:
{
"results": [
{
"ssid": "OnionWiFi",
"encryption": "mixed WPA\/WPA2 PSK (TKIP, CCMP)"
},
...
]
}
Ubus interface for the wifisetup
application.
ubus call onion wifi-setup '{"command":"command name", "base64":false, "params":{"argument":"argument value"}'
command
- Specifies what operation wifisetup is meant to perform
base64
- Specifies if params arguments are base64 encoded
- Default is false
params
- Additional parameter arguments to be passed to wifisetup script
Run wifisetup --help
on the Omega to get a better idea of what is available
Connect to network called MyNetwork with PSK2 password that is superduper:
ubus call onion wifi-setup '{"command":"add", "base64":false, "params":{"ssid":"MyNetwork", "auth":"psk2", "password":"superduper"}}'
Lazar to expand
Ubus interface for the oupgrade
application.
ubus call onion oupgrade '{"params":{"argument":"argument value"}'
Force a firmware upgrade
ubus call onion oupgrade '{"params":{"force":""}}'
Lazar to expand
Interface to control the triggering of the LED on the Omega
List the available triggers.
Usage
ubus call onion omega-led '{"read_triggers": true}'
Return Value Returns an array of all possible triggers:
{
"triggers": [
"none",
"timer",
"default-on",
"gpio",
"heartbeat",
...
]
}
Select trigger to be used
Usage
ubus call onion omega-led '{"set_trigger": "<trigger>"}'
Return Value Returns which trigger was selected: { "trigger": "" }
Interface to the Fast-GPIO application
ubus call onion fast-gpio '{"params":{"argument":"argument value"}'
Lazar to add
Perform a scan of all I2C devices currently on the bus, return all slave addresses.
ubus call onion i2c-scan '{}'
Sample return:
{
"devices": [
"0x20",
"0x27",
"0x3c"
]
}
Sets the colour of the RGB LED on the Expansion Dock using the expled
script
ubus call onion rgb-led '{"command":"<command>", "params":{"colour":"<hex colour value>"}}'
The only available command is set
, it will program the RGB LED to the hex colour value found in the params
object.
If successfull:
{
"colour": "<hex colour value>"
}
If not successfull:
{
"success": False
}
Set the RGB LED to purple:
ubus call onion rgb-led '{"command":"set", "params":{"colour":"0x7700e6"}}'
Control the Omega GPIOs.
Implemented using the sysfs gpio interface.
ubus call onion gpio '{"command":"<command>", "params":{"gpio":"<gpio number>"}}'
Available Commands:
- get
- set
- get-direction
- set-direction
- status
Get the current value of the GPIO
Usage:
ubus call onion gpio '{"command":"get", "params":{"gpio":"<gpio number>"}}'
Sample Return:
{
"success": true,
"pin": "7",
"value": "0"
}
Set the value of the GPIO (if output direction)
Usage:
Set to 0 (LOW):
ubus call onion gpio '{"command":"set", "params":{"gpio":"7", "value":"0"}}'
Set to 1 (HIGH):
ubus call onion gpio '{"command":"set", "params":{"gpio":"7", "value":"1"}}'
Sample Return:
{
"success": true,
"pin": "7",
"value": "0"
}
Get the current direction of the GPIO
Usage:
ubus call onion gpio '{"command":"get-direction", "params":{"gpio":"<gpio number>"}}'
Sample Return:
{
"success": true,
"pin": "7",
"direction": "output"
}
The direction
value will be either input
or output
Set the direction of the GPIO
Usage:
Set to OUTPUT:
ubus call onion gpio '{"command":"set-direction", "params":{"gpio":"7", "value":"output"}}'
Set to INPUT:
ubus call onion gpio '{"command":"set-direction", "params":{"gpio":"7", "value":"input"}}'
Sample Return:
{
"success": true,
"pin": "7",
"direction": "out"
}
Get all available info of a GPIO
Usage:
ubus call onion gpio '{"command":"status", "params":{"gpio":"<gpio number>"}}'
Sample Return:
{
"success": true,
"pin": "7",
"value": "0",
"direction": "out"
}