Accessing i2c via snap

Hello All,

I have been building my snap in strict confinement and I’m supposed to use i2c devices to use the gpios connected to the i2c expander under the directory(/sys/devices/platform/{*,**.i2c/). But I couldn’t find any slot to access the i2c device.

Kindly let me know if there any slot available for the same.


here i’m using the i2c bus to connect an oled display:

the code is at:

What OS are you trying to use this on? Are you running Ubuntu Core?

Hi @ijohnson,

Thank you for your quick reply.

Yes, we are using Ubuntu Core.

As I looked into the YAML file, it is been provided for pi. Is the same snap that will support Ubuntu core-based systems?

Yes, the yaml file is for an ubuntu-core image on the pi.

using the i2c plugs: entry like in that snapcraft.yaml should be enough to allow your application to use the i2c bus on ubuntu-core, regardless of what hardware you use.

Do you have i2c slots exposed on your system? What is the output of:

snap interface i2c

and also

snap connections $(snap known model | grep -Po "gadget:\s\K.*")