RFC: Showing undesired connections

snap connections currently doesn’t show undesired connections. This is confusing because there is no feedback to the user why an auto-connection doesn’t work.

Idea 1: add manual as a note to interfaces which have undesired connections.

Interface         Plug               Slot                Notes
content[themes]   arduino:themes     themes:themes       -
home              arduino:home       :home               -
raw-usb           arduino:raw-usb    -                   manual

However, this doesn’t really work with greedy plugs, and users have no way of knowing what the undesired connection is exactly.

Idea 2: replace the “empty” line with a manual,disconnected line.

Interface         Plug               Slot                Notes
content[themes]   arduino:themes     themes:themes       -
home              arduino:home       :home               -
raw-usb           arduino:raw-usb    :raw                manual,disconnected

However, this makes it harder to see which interfaces are not connected to anything.

Idea 3: add a new line with manual,disconnected.

Interface         Plug               Slot                Notes
content[themes]   arduino:themes     themes:themes       -
home              arduino:home       :home               -
raw-usb           arduino:raw-usb    -                   -
raw-usb           arduino:raw-usb    :raw-usb            manual,disconnected

Maybe this is the ideal? What do you think?

See 'snap connections' command for the previous discussion about the output of the connections command.

I think Idea 1 most closely matches the existing design, 2 and 3 both suffer from the problem that you have something in Plug and Slot, which up to this point has always meant that there is a connection there, regardless of what is the Notes and I don’t think we want to give up that property. Indeed in at least our test suite we have many things where to check that something is disconnected we will grep and match for <iface>\s+<plug>\s+-.* to indicate that the plug is disconnected.

Idea 1 is slightly unclear where if it was not auto-connected and a user manually connects the plug and the slot, and then disconnects again, should the disconnection be marked as manual? or should it not have any notes like it does at the beginning? I think it should probably not be marked as manual so that we can say that a disconnected plug+slot that says “manual” is always a plug+slot that was auto-connected and the user manually disconnected it, and that a connected plug+slot that says “manual” is always a plug+slot that was not autoconnected and the user manually connected it.

@ijohnson, I also think idea 1 is the best one for simple connections such as raw-usb. However, it becomes confusing quickly when a plug has multiple connections. Let’s take the serial-port interface as an example. Arduino has a greedy autoconnect for serial-port, so this is what it could look like when you have two usb-serial devices connected.

Interface      Plug                  Slot                Notes
serial-port    arduino:serial-port   :usb20-serial       -
serial-port    arduino:serial-port   :usb30-serial       -

Now, what happens when you disconnect one? Adding “manual” to the active connection doesn’t make sense, because that connection isn’t manual.

Interface      Plug                  Slot                Notes
serial-port    arduino:serial-port   :usb20-serial       manual

You’d have to add a new line, with a disconnected slot and manual. But now you break the current behavior that having a “-” in either plug or slot means there is no connection.

Interface      Plug                  Slot                Notes
serial-port    arduino:serial-port   :usb20-serial       -
serial-port    arduino:serial-port   -                   manual

Unrelated to this problem, there is also a second problem. When a user sees the following:

Interface      Plug                         Slot     Notes
serial-port    arduino:serial-port          -        manual

If the user wants to remove this manual disconnect, how will they know which connection to forget? The user needs to remember which connection they disconnected previously in order to be able to forget that change, because there is no way to get the disconnected slot.