Set Pi gadget mode natively in Balena

Is it possible to set gadget mode configurations natively in Balena? For instance, by setting configuration variables or something like that.
Guidances suggest setting configurations manually after the flash (in the “resin-boot” folder) or manually change config.txt and cmdline.txt to enable the gadget mode. The only thing in these approaches is that configurations would be rewritten after the OS update.

Is there is a way to add some “update resistible” configuration for the gadget mode?

Thanks for reaching out. To suggest a better solution, can you please help us with some context about your use-case with gadget mode? or what are you trying to achieve with gadget mode on a balena device?

Assuming you are using gadget mode to gain access to the device easily without WiFi or SSH config, balena already manages to solve those problems by easy WiFi configuration when creating a managed device or SSH’ing into them directly for development purposes using local mode. The solutions we have in mind would be hacky at best, which would need you to connect your device to the internet rendering the purpose of gadget mode as null.

gadget mode for the device is needed to make it reachable via USB

Hi! @vipulgupta2048
Are there any updates on this topic? Do you know the way to set a gadget mode for the PI in Balena?

And if there is a possibility to update device descriptor (name, serial number) for this device in a gadget mode via Balena?