confirm that it works: `iex -S mix` and then `iex(1)> KioskNerves.hello` which
should output `:world`
config,target.exs: just change to eth0, use directNet
$> export MIX_TARGET=rpi3 # don’t have to keep exporting
$> mix firmware
$> mix burn # uses a local SSH key to make sure the machine can reconnect later
move the micro sd card to the rpi3, turn it on, wait for it to boot up
`ping nerves.local` to see traffic
`ssh nerves.local` to connect
running tiny mdns server to respond to `nerves.local`; can make a change in config/target.exs file
exit the ssh connection: `~.` you won’t see it, but it’ll just exit your shit; even if the connection is totally fucked
Helpers
Toolshed: analogs for *nix bash commands
To update code on target
make changes
mix firmware
mix firmware.gen.script
./upload.sh is generated; run that command
Logger
use `require Logger` and `Logger.debug`, etc
connect via ssh
once those functions are run, the logs are available via RingLogger – RingLogger.attach and then do the thing that outputs the log message
if you need to see something that happened earlier, RingLogger.next to see it all; to search for something, RingLogger.grep(Elixir regex sigil)
Shoehorn
separates application code from mission-critical code
if an application crashes, it shouldn’t take down the whole OS; this is similar in concept
Revert
`Nerves.Runtime.revert` but this might not work as expected – had to put the SD card back in the writer and then re-run the burn command
Displaying
uses webengine_kiosk which uses qt
if mix compile doesn’t work, try `which qmake`; if not found, `brew link qt5 –force` or `QMAKE=/usr/local/opt/qt/bin/qmake mix compile`
Supervision tree
kiosk_nerves/lib/kiosk_nerves/application.ex – has two `def children` for the supervisor to start things for host and target separately, like deps and devDeps
Adding config to run in “host mode,” which doesn’t run in fullscreen, for instance: in config/config.exs
If needing to use pid to reference a process that we start using the supervision tree’s “name” tuple, we can use the value of the “name” property in place of the pid
Doing Work
Make changes, `mix firmware`, `./upload.sh`, and after it reboots, `ssh nerves.local`
Ponchos vs Umbrellas
umbrella problem: everything from the top-down gets compiled; not ideal when developing against host and target devices
poncho solves this by allowing side-by-side compiles
Troubleshoot
Using socat, get IP address of device, subtract 1 from the last block of numbers, go to http://172.31.43.93:9223/ in host browser
Cool Things
In target’s iex: `File.write! “/sys/class/backlight/rpi_backlight/brightness”, “99”` to change brightness of device in realtime
Can create a module to change these files, and therefore, properties of the hardware