I am experimenting with using a udev rule to set the powermode. The required nvpmodel
command is only available on the host, so this is executed as a global udev rule.
I have manually create a udev file in /lib/udev/rules.d
which reloads on any USB device being plugged in.
(note the non-default udev folder as per https://github.com/balena-os/balena-jetson-tx2/commit/52ffdb88a11f7fcce18a79872dbee7c0a4ec61cd)
Keep in mind that you need to mount -o remount r,w /
so that you can write to that filesystem
The file 101.rules
looks as such:
ACTION=="add", SUBSYSTEMS=="usb", RUN+="/usr/sbin/nvpmodel -m 0"
I will try to add this to the config.json
as per https://github.com/balena-os/meta-balena/blob/master/README.md#udevrules to automate the deployment and will report back here later.