Connection with gadget spidev0 plug


#1

Hello,

We are following Ogra’s instructions @ https://ograblog.wordpress.com/ and found this blog very helpful.
We plan to publish our snap soon, but have own gadget for raspberry pi which provides all necessary snaps and configurations.
Have one doubt - we would like to establish connection with gadget spidev0 plug.
Any tips how this can be done automatically? ( as we know that gadget can’t be published because we don’t have private store.)
Currently we have done this manually using below command from the console -
snap connect :spi : spidev0

Thanks in advance,
Smita


#2

Has any one figured out how to connect with gadget spidev0 plug?


#3

@ogra
Hello Ogra,
Can you please suggest correct way to establish connection with gadget spidev0 plug through scripts.
Currently we have done this manually using below command from the console -
snap connect :spi pi3:spidev0

Thanks in advance.


#4

i can not, because there is no “correct” way outside of using the store here… i fear the only correct solution is to have a snap ID for the gadget (since the connections stanza in gadget.yaml requires it) which means to upload it to some brand store.

that said, you can probably hack around it by injecting a script into your image (i.e. by copying it from an initrd snippet you ship in the gadget or by modifying the SD after flashing or some such or perhaps via cloud-init hackery) that calls the snap connect command … but indeed neither of these ways are clean …


#5

Hmm …thanks for the reply


#6

Hi Ogra,
Coming back to you once again.
Is there any way we can use snapd-control interface to achieve this?
Idea is to have configuration snap that uses snap-control interface to connect spi interface between our snap and gadget snap.
Similar to approach in below example-

I know that snap-control interface is restricted, but may be there is option to allow its use of specific purpose.
Regards,
Smita


#7

The snapd-control interface is limited to be used in brand stores, uploads of snaps using the snapd-control interface to the global store are automatically blocked by store policy.

This is exactly what most brand-store users do (they typically use a REST API in this config snap and control all their devices securely and centrally through this)