Disable USB Port in Ubuntu Core

I need to disable a specific USB port to support a feature I’m currently working on for our Ubuntu Core based system.

My research shows that in order to do this, I need write to a few files at /sys/bus/usb/devices/usbX/…

Unfortunately, because these are not writable files in core, I can’t find a good way to approach this issue. Any ideas?

Thank you.

the raw-usb plug should get you access to the device nodes you need … create a snap with a script as oneshot daemon to set the power of the ports on/off …

here is a snap that allows doing this for external USB hubs for inspiration (i never tried it for internal ones TBH)