As mentioned in the discussions at the PR above this installs nvpmodel. However, changes (i.e. nvpmodel -m 0) do not persist across a reboot. Even if the root partition is write mounted beforehand.
Changing the default value at the bottom of /etc/nvpmodel.conf works and persists. First write mount the root folder works, then do the change.
That is a good starting point and I’m looking for a way to automate this. Either modifying the Yocto build or setting the nvpmodel using a custom udev rule on boot.
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.
Does this work even if USB devices are attached on boot?
How do you make a change after the device is deployed using this method? Reflash?
Using a privileged container, you can also add to the udev rules at container build time, would this work also for nvpmodel?
ENV INITSYSTEM on
RUN echo 'ACTION=="add", SUBSYSTEMS=="usb", RUN+="/usr/sbin/nvpmodel -m 0" ' > /etc/udev/rules.d/nvpmodel.rules
You can always make a change to the rules file manually afterwards, all you need to do is remount the root partition as rw.
Good point, yes you should be able to add the udev rules afterwards. In your example you might want to add a number in front of your .rules file to keep it in line with udev standards.
After adding the rule I would guess you need to also reload the udev rules or reboot the device - I’m not sure if you can do that from a privileged container though.