Auto-connection request for `arduino-mhall` serial-port

One thing I noticed is that, when I plug in multiple arduino boards, I still only get one slot: core:usb20-serial. When I try to flash them from the arduino IDE, one of them randomly gives a “permission denied” error. In general, the last one you plug in is the one you can access, but sometimes it changes.

Is this expected behavior? Should I see multiple slots or should multiple serial-ports work with the same slot?

Oh that sounds like a bug with the hotplug system then. Each device is supposed to get it’s own slot. I imagine the logic we have around choosing a unique name for a serial port slot might break down when you plug in multiple devices with exactly the same vendor id and product id. Could you file a bug at ?

1 Like

Ok so to clarify - is this requesting auto-connection of serial-port for both arduino and arduino-mhall or just arduino?

I am not sure whether I actually need serial-port anymore for either snap because raw-usb seems to do what I need at the moment. Does serial-port have an advantage over raw-usb?

it helps the users that actually have a serial port on their mainboard (they are rare but i suppose you can still buy them :wink: )

Ok, then I’m requesting auto-connections for the following

I’m not entirely sure what the rules are for these requests. Should I create a new topic per snap or per request?

1 Like

Any update on this request?

@jdstrand @popey Can I get an update on these requests?

Ok, I’m a bit confused from the cross-posting. It seems all that is needed is serial-port with hotplug, but there is a mixture of requests for serial-port and raw-usb. Can you clarify your current requests and justifications?

Thanks for taking a look at this. I’ll also respond here to your questions about the other two requests 1 2.

The snaps are arduino, s4a and arduino-mhall119. They all need access to Arduino-compatible boards connected via USB. There are several reasons why serial-port is not sufficient for this yet. (these are the reasons why the snaps need raw-usb)

  • Hotplug support is still experimental. At the moment, using it requires users to run a bunch of commands. I’d like the Arduino IDE to just work. As popey said “Arduino developers range from expert to complete newbie with a kit as a present for their birthday. We should make it as smooth as possible.” The s4a - “Scratch for Arduino” snap targets kids directly, to help them program Arduino’s and robots without writing code.
  • When I plug in multiple arduino boards, I only get one slot: core:usb20-serial. The slot only gives access to one of the devices, it seemingly picks one device at random and gives the snap access to that one device. Other devices are not accessible.
  • This requires greedy plugs, which doesn’t seem to work with hotplug at the moment.

However, I do like the design of Hotplug support, and I’d like to tinker with it, so that’s why I’m also asking for a greedy auto-connection to the serial-port interface. This will also make it easy to switch to serial-port immediately when it leaves “experimental” and the bugs are fixed.

Let me know if you want me to open a single thread for all the requests. I didn’t do that now because some of the threads already have votes in them.

@jdstrand @reviewers, do you need more information or can the voting continue?

Note that greedy plugs are supported in some way today AIUI, but I don’t know and it doesn’t seem that anyone has actually commented on or tested whether it works with hotplug…

FWIW, I think the below kind of declaration would be sufficient for accessing all serial-port slots, hotplug or otherwise, but I have no way to test this. @jdstrand and/or @roadmr do you have a way to test end-to-end if greedy plugs work with hotplug with something like the following snap-declaration for some test snap?

      slots-per-plug: *

I’m happy to try this out. However, this still leaves the issue that hotplug support is currently experimental and that it has an issue when multiple Arduino boards are connected.

I would really like to get this snap working out of the box. In the five weeks since I posted this request, the arduino snap has risen from 0 to 8.000 active installs and it keeps growing steady. I would like to give these people the best out-of-the-box experience and make their Arduino experience on Ubuntu as painless as possible.

+1 to auto-connect serial-port (with greedy plugs) and raw-usb. @reviewers - can others vote on this?

1 Like

@galgalesh - assuming the request goes through for serial-port, I’ll grant slots-per-plug: * in the snap declaration and you can test out that functionality.

1 Like

I need to quote the star (*), otherwise this throws a yaml linting error. A non-quoted star apparently has special meaning in yaml.

I now have this in my snapcraft.yaml:

    interface: content
    target: $SNAP/lib/gtk-2.0
    default-provider: gtk2-common-themes
    interface: content
    target: $SNAP/data-dir/themes
    default-provider: gtk-common-themes
    interface: content
    target: $SNAP/data-dir/icons
    default-provider: gtk-common-themes
    interface: content
    target: $SNAP/data-dir/sounds
    default-provider: gtk-common-themes
      slots-per-plug: "*"

However, I get a warning from review-tools:

Review Tools did not fully pass for this snap.
Specific measures might need to be taken on the Snap Store before this snap can be fully accepted.
Linting Issues:
- unknown attribute 'allow-auto-connection' for interface 'serial-port' (plugs)

Should review-tools be updated for this syntax or am I using it incorrectly?

I’m sorry that I wasn’t clear. The “slots-per-plug” will be added to the snap declaration, not your snap. You continue to use serial-port like normal. When the votes are tallied and we connect serial-port automatically, I’ll adjust the snap declaration in the store accordingly.

Thanks for the clarification. Stupid question; what is the snap declaration? I thought this was snap.yaml in the snap package?

So Publishers only need to request greedy plugs on the forum here? and snaps don’t need to be updated? Does this mean that the information provided in Plug/slot declaration rules: greedy plugs is only relevant to actual snapd developers or people managing the snapcraft store?

The snap declaration is a signed assertion (document) that corresponds to your snap. You can view it by doing “snap download foo”; that will download both the .snap file for the snap and a .assert file (feel free to look at it).

The ‘base declaration’ is something encoded in snapd that declares how interfaces can be installed, connected or auto-connected (you can see it with sudo snap debug get-base-declaration). The ‘snap declaration’, among other things, may have overrides to the base declaration for snapd to consider when evaluating things like auto-connection. The snap declaration is something that the store maintains and signs (snapd will verify the signature as needed) and reviewers are able to modify the portions of the snap declaration that relate to overriding the base declaration and setting aliases. In this manner, snaps just plugs and slots as desired and reviewers can update the snap declaration for a snap as per our processes.

Correct, just follow the processes you’ve always used to plugs and slots things and continue to make requests for auto-connection, etc in the forum like always. Snaps do not need to be updated. The information in the aforementioned link is primarily of interest to snapd developers and store reviewers, yes.


Very informative, thanks!