Access to procfs, configfs, sysfs

Great! I’m not alone here! :slight_smile:

@jdstrand, interface libcomposite or libcomposite-support would be the simplest solution here. Still as I understand you propose to divide one libcomposite interface into more specific use cases and add to the existing ones. It’s interesting but I’m not sure how to achieve that.

Apparmor should catch the difference between:

Audio: /config/usb-gadget/gadget/functions/uac1.name /config/usb-gadget/gadget/functions/uac2.name

HID: /config/usb-gadget/gadget/functions/hid.name

Serial port: /config/usb-gadget/gadget/functions/gser.name

Mass storage: /config/usb-gadget/gadget/functions/mass_storage.name

Ethernet: /config/usb-gadget/gadget/functions/rndis.name /config/usb-gadget/gadget/functions/ncm.name /config/usb-gadget/gadget/functions/ecm.name /config/usb-gadget/gadget/functions/eem.name

Where “gadget” is arbitrary name for gadget (g1, g2 … etc) and the last “name” also (0, 1, usb0, usb1). That said you will end up with: /config/usb-gadget/*/functions/"$FUNCTION_NAME".*

Apparmor should decide whether to allow particular $FUNCTION_NAME for a particular snap. Still allowing to access for every snap with libcomposite to: /config/usb-gadget/"$GADGET_NAME"/strings/* /config/usb-gadget/"$GADGET_NAME"/configs/* And of course it should be possible to mkdir $GADGET_NAME and write to UDC, idVendor, idProduct in it.

Nowadays I’m interested in uac1, uac2 which could go into alsa interface (as it creates a new alsa sound card). And HID. It can go to hidraw interface as you mentioned.

Serial port “gser” could go to serial-port maybe? It could be a separate simple snap maintained by @ogra :wink: that simply configures one serial port /dev/ttyGS0 with libcomposite and nothing more. Some snap configuration may allow to add several additional ports if user wants. This snap can be installed by those users who needs this functionality or added by --extra-snaps in ubuntu-image to make it available from the very beginning.