request for snap interface that expose userspace device APIs

Bug #1641752 reported by Jian Luo on 2016-11-14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zygmunt Krynicki

Bug Description

Embedded systems (which are likely called IoT devices these days :) sometime need access to peripherals via user-space device APIs, namely i2cdev[1], spidev[2] and uio[3]. Snaps of type core and gadget should be able to expose these interfaces to other privileged snaps.

Accesses to these character special devices should be granted through this interface:
- /dev/spidevB.C rw,ioctl
- /dev/i2c-%d rw,ioctl
- /dev/uio%d rw,mmap,poll,select

Optionally read-only accesses to sysfs entries can be granted to get device information:
- /sys/class/i2c-dev/** r
- /sys/class/uio/** r

Tests can be done with tools in [4] [5] [6] accordingly.

This interface is IMHO similar to bool_file, gpio and serial-port in regards to security concerns.


Lorn Potter (lorn-potter) wrote :

There is already an i2c interface,

an iio interface in the works based on the i2c interface.

spidev and uio could also be written based on what i2c is, with obvious changes.

Didier Roche (didrocks) wrote :

The thing is that they are not exposed in gadget snaps for various devices if I'm correct (like the GPIO one). I did open a bug last week for this:

Zygmunt Krynicki (zyga) wrote :

This bug is rather old so I'd like to summarize where we are now:

- there are i2c, iio and spi interfaces in snapd
- there is no uio interface yet

Interfaces must be defined by the gadget but we now have support for hot-plug detection that could be used instead of static declaration.

I'm not familiar with uio devices, can you share some information about development boards that have them? I found updated reference to the kernel documentation here but none of the reference platforms for snapd seems to have those.

affects: snappy → snapd
Changed in snapd:
status: New → Confirmed
importance: Undecided → Medium
Zygmunt Krynicki (zyga) wrote :

I've started working on the new interface. Scheduled it for 2.43 but may slip to 2.43.1 depending on release timings.

Changed in snapd:
assignee: nobody → Zygmunt Krynicki (zyga)
status: Confirmed → In Progress
milestone: none → 2.43
Zygmunt Krynicki (zyga) wrote :

I've implemented and tested the interface and proposed it for merging into snapd

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers