Skip to content

lua debugging via serial console

Noodlesalat edited this page Feb 18, 2019 · 2 revisions

lua debugging via serial console

This presents a very simple way of getting a debug output of a lua script on the serial console. Shortly before the device reboots this can be used, e.g. in order to debug things such as the "Save & Reboot"-button in the config-modes wizard.

In this example the device of the serial-console was /dev/ttyS0. No additional steps are required as this should work out of the box.

-- open serial console to send messages
local wserial = io.open("/dev/ttyS0","w")

-- write messages (two dot for string concat)
wserial:write("DEBUG: this is my debug output"..aVariable.."\n")
-- send all queued messages (this is non-obligatory)
wserial:flush()

-- close serial connection
wserial:close()
Clone this wiki locally