-
Notifications
You must be signed in to change notification settings - Fork 75
commandline introduction
This page explains the software development oriented tools, tricks & tips.
There are also more operational commands, see here.
Note that below examples use DbusCli (executable name: dbus). It is pre-installed on the CCGX, and can also be installed on your development computer. There are alternatives as well, see dbus-send.
Get a list of all dbus services
dbus -y
Get all paths of the com.victronenergy.settings service
dbus -y com.victronenergy.settings
Read a value
dbus -y com.victronenergy.settings /Settings/Logscript/Enabled GetValue
Read all values (works with most services, except some of the Python services including localsettings).
dbus -y com.victronenergy.solarcharger.ttyO2 / GetValue
Write a value
dbus -y com.victronenergy.settings /Settings/Logscript/Enabled SetValue %1
See the dbus interface
dbus -y com.victronenergy.settings /Settings/Logscript/Enabled
dbus-spy is an ncurses tool, which shows a list of all com.victronenergy.* services on the D-Bus, and all paths and values within each service. The values are updated in real-time and can be changed.
The interface works somewhat like the CCGX gui:
- up/down keys: move up and down in the menus
- right/left: move in and out submenus
- enter: enter a submenu or change a value.
- 't': switch between values and texts.
- ctrl-c or 'q': close the application
Besides above there is also the very cool Favorites
function. See f
and F
in the Readme for details.
Caveat: by default dbus-spy will only show the values of D-Bus services which support a GetValue on '/', because finding all paths without this feature will take a long time, and a lot of D-Bus communication. If you want the content of the other services as well, start dbus-spy with the -i option and be patient.
dbus-send is a faster, but somewhat more complicated to use, alternative for dbus-cli as used in previous paragraph.
dbus-send --system --dest=com.victronenergy.settings /Settings/System/RemoteSupportPort com.victronenergy.BusItem.SetValue variant:int32:67
dbus-send --system --dest=com.victronenergy.settings /Settings/System/RemoteSupportPort com.victronenergy.BusItem.GetValue
dbus-send --system --print-reply --dest=com.victronenergy.settings /Settings/System/LogLevel com.victronenergy.BusItem.SetValue variant:int32:0
dbus-send --system --print-reply --dest=com.victronenergy.settings /Settings/System/LogLevel com.victronenergy.BusItem.SetValue variant:int32:0
dbus-send --system --print-reply --dest=net.connman /net/connman/technology/wifi net.connman.Technology.SetProperty string:"Powered" variant:boolean:true
dbus-send --system --print-reply --dest=net.connman /net/connman/ net.connman.Technology.SetProperty string:"Powered" variant:boolean:true
Connmand Manager
dbus-send --system --type=method_call --print-reply --dest=net.connman net.connman.Manager.GetProperties
dbus-send --system --type=method_call --print-reply --dest=net.connman net.connman.Manager.GetTechnologies
dbus-send --system --type=method_call --print-reply --dest=net.connman net.connman.Manager.GetServices
dbus-send --system --type=method_call --print-reply --dest=net.connman / net.connman.Technology.Scan
dbus-send --system --type=method_call --print-reply --dest=com.victronenergy.qwacs /Manager com.victronenergy.manager.TestArray
dbus-send --system --type=method_call --print-reply --dest=com.victronenergy.qwacs /Gateway com.victronenergy.gateway.GetUplink
**Connmand Service**
dbus-send --system --type=method_call --print-reply --dest=net.connman net.connman.Service.GetProperties
**Connman NTP**
dbus-send --system --type=method_call --print-reply --dest=net.connman org.freedesktop.DBus.Introspectable.Introspect
dbus-send --system --type=method_call --print-reply --dest=net.connman / net.connman.Clock.GetProperties
dbus-send --system --type=method_call --print-reply --dest=net.connman / net.connman.Clock.SetProperty string:"Timezone" variant:string:"Europe/Amsterdam"
dbus-send --system --type=method_call --print-reply --dest=net.connman / net.connman.Clock.SetProperty string:"Timerservers" array:string:"0.pool.ntp.org","1.pool.ntp.org"
**udev mount**
dbus-send --system --type=signal / com.victronenergy.udev.mount string:$DEVNAME string:"/media/$name"
**udev umount**
dbus-send --system --type=signal / com.victronenergy.udev.umount string:$DEVNAME string:"/media/$name"
svstat /service/logscript
svstat /service/*
svc -d /service/logscript
svc -u /service/logscript
tail -F /log/logscript/current | tai64nlocal
more /log/mk2/current | tai64nlocal
tail /log/*/current | tai64nlocal
dmesg
cat /log/messages.2 /log/messages.1 /log/messages.0 /log/messages | tai64nlocal
logread
grep -h -i "ERROR" /log/*/current | tai64nlocal
for file in `ls /log/*/current`; do echo "cleared log at `date`" > $file; done
Note that Venus updates are image based. See the swupdate issue.
The package manager, opkg, is still available. And can be used to install optional installs.
root@ccgx:~# opkg list-installed
base-files - 3.0.14-r76
base-passwd - 3.5.26-r0
bash - 4.2-r5
...
websockify-c - v0.8.0-r1
wget - 1.14-r16.2
wpa-supplicant - 2.2-r1
wpa-supplicant-cli - 2.2-r1
wpa-supplicant-passphrase - 2.2-r1
zip - 3.0-r1
/opt/colorcontrol/opkg-scripts/set-feed
Then update the package list
opkg update
Then install a package
opkg install [name of package here]
To find other packages, such as gdb, do:
opkg list | grep gdb
Configure the ipaddress:
export CURRENTIP=192.168.4.108
First arrange auto-login by using ssh-copy-id to all ipnumbers you want to look at.
ssh-copy-id root@$CURRENTIP
Check that you have the right one
ssh root@$CURRENTIP "ifconfig"
Then copy past below lines.
ssh root@$CURRENTIP "cat /log/vrmlogger/* | tai64nlocal"
ssh root@$CURRENTIP "cat /log/vrmpubnub/* | tai64nlocal"
ssh root@$CURRENTIP "cat /log/mk2/* | tai64nlocal"
ssh root@$CURRENTIP "cat /log/dbus-pvinverter-vebus/* | tai64nlocal"
ssh root@$CURRENTIP "cat /log/dbus-systemcalc-py/* | tai64nlocal"
ssh root@$CURRENTIP "cat /log/vecan/* | tai64nlocal" (note, starting message is not in the logs)
ssh root@$CURRENTIP "cat /log/messages.2 /log/messages.1 /log/messages.0 /log/messages | tai64nlocal"
ssh root@$CURRENTIP "cat /log/messages.2 /log/messages.1 /log/messages.0 /log/messages | tai64nlocal | grep Aligment"
root@CCGX:/sys/devices/system/cpu/cpu0/cpufreq# cat ./scaling_available_governors
conservative userspace powersave ondemand performance
root@CCGX:/sys/devices/system/cpu/cpu0/cpufreq# echo performance > ./scaling_governor
root@CCGX:/sys/devices/system/cpu/cpu0/cpufreq# cat ./scaling_governor
performance
root@CCGX:/sys/devices/system/cpu/cpu0/cpufreq# cat ./cpuinfo_cur_freq
600000
The serial starter takes care of starting the drivers for built-in ttys (VE.Direct and VE.Bus ports), as well as all serial devices that are connected through USB, ie the plug-and-play work.
To work on a port yourself, you need to tell serial-starter to leave a tty alone. These commands exist for that purpose:
/opt/victronenergy/serial-starter/stop-tty.sh ttyUSB0
/opt/victronenergy/serial-starter/start-tty.sh ttyUSB0
Once serial-starter has backed off (tip: use ps to make sure), some example commands that can be used to see the output are these:
root@raspberrypi2:~# stty -F /dev/ttyUSB0 115200
root@raspberrypi2:~# cat /dev/ttyUSB0
/XMX5LGBBFG1009224834
1-3:0.2.8(42)
0-0:1.0.0(171227232200W)
0-0:96.1.1(4530303330303033313536383532323135)
...
More detail information is in the Howto add a driver to Venus document.