I am trying to programmatically add a udev rule to a balena config installed inside an image.
The context is the same as here: Nvpmodel not installed on Jetson TX2 yocto image - setting the Jetson’s power mode without having to manually adjust every device.
I found the balena config write
and balena config read
calls, but I struggle to set the os.udevrules.101
field.
My desired config.json snippet looks like this:
{
"applicationName": "Development",
...
"os": {
"udevRules": {
"101": "ACTION==\"add\", SUBSYSTEMS==\"usb\", RUN+=\"/usr/sbin/nvpmodel -m 0\"\n"
}
}
}
When I manually create this file and then balena config inject
it this works of course (see above link) and I can read it out using balena os read
I get:
...
os:
udevRules:
101:
"""
ACTION=="add", SUBSYSTEMS=="usb", RUN+="/usr/sbin/nvpmodel -m 0"
"""
What does NOT work is just setting the os.udevRules.101
field with:
balena config write --type some_type --drive some_drive.img os.udevRules.101 "ACTION==\"add\", SUBSYSTEMS==\"usb\", RUN+=\"/usr/sbin/nvpmodel -m 0\""
That command succeeds, but balena config read
s as:
...
s:
udevRules:
- null
- null
... a few 10s of these ...
- null
- ACTION=="add", SUBSYSTEMS=="usb", RUN+="/usr/sbin/nvpmodel -m 0"
So at least the 101
field does not seem to parse correctly.
Any suggestions on how to balena config write
this data?