Gadget snap - permissions and snap interfaces

Hi,

Does a gadget snap have soem automatic interfaces configured ?

Can they be augmented by adding further interfaces for hooks in the snap itself ?

If interfaces can be added, how does plug configuration work, can the gadget snap specify it’s own plug defaults [ like it does for other snaps ] ?

For some context, I have a prepare-device that is getting permission denied reading some sysfs files, and not sure if it can be made to work with the correct interfaces or not.

I need to access files under here:

/sys/devices/virtual/dmi/id/
/sys/class/net/*/operstate

Not sure if there is an interface that would help here either.

Thanks.

Cheesr,
Just

Actually, looks like hardware-observe may be enough, I will test it. But the question remains regarding auto-connect.

Cheers,
Just

you’d have to do this auto-connect through a store declaration in the brand store the gadget gets uploaded to …

(you could try doing it through a connections: statement in the gadget.yaml but i’m not sure about the ordering here, the connecting might not happen early enough for the hook, see https://snapcraft.io/docs/gadget-snap)

Thanks @ogra

So I tested it in the end late last night, and it seems like the autoconnect works before the prepare-device hook runs. It definitely worked :slight_smile:

Looking at the changes log, auto-connect seems to happen as part of change 1 - Initialize system state , and then the gadget prepare-device hook is in change 2 - Initialize device

Out of curiosity, if I did do the auto-connect via the brand store, is that something we could manage ourselves, or another thing we have to request is done for us ?

Cheers,
Just

1 Like

i think your brand store admin should be able to grant declarations