We’ve changed the implementation of matter-pi-gpio-commander to use chardev for GPIO access, and as a result require the use of a custom-device interface. Please refer to the existing discussion here
The custom-device interface slot and plug definitions can be reviewed from the chardev branch. This will be merged into main once we have the approval.
This request is to (1) approve the use of the custom-device and if possible (2) set up an auto connection for it.
As it was already discussed, custom device seems to be the right approach to fit matter-pi-gpio-commander needs for now, until gpio-aggregator will be released.
Thus +1 from me for granting matter-pi-gpio-commander auto-connect to custom-device interface
Usually when more than one slot is available for a concrete plug type (e.g. one provided by the core and other provided by an app snap), the interface does not auto-connect any more (even if it is allowed to do so) because snapd does not know which slot should be plugged. In your case, it seems that two custom-device slots exists (matter-pi-gpio-commander:custom-gpio-dev and console-conf:terminal-devices)
For the custom device interface, I expected snapd to use the custom-device attribute to choose which slot to connect to, but maybe it is not the case. If you can check that only one slot (matter-pi-gpio-commander:custom-gpio-dev) is available in Ubuntu Server 24 (where it is auto-connecting properly) it will be a good sign that it might be the problem.
We found that it was not auto connecting because my declaration was incomplete. However, after discussion with @pedronis, it seems that we should not be granting auto-connect for custom-device in the global store since these snaps may be installed on devices where the device nodes are not the expected underlying device and so these should be manually connected instead.
I’m now reverting the auto-connection (maintaining the manual connection). Would it still work for you?
We have this in the store and making this change breaks the user experience. We have written a blog post and documentations based on this behavior. At least, we have to change them before dropping the auto connection.
I doubt that the policy applies to this case. The custom-device’s slot and plug are on the same snap, and this snap is only expected to run on supported Raspberry Pis. The snap’s name, interface definition and documentation make that very clear. There is no supported scenario where someone would install this snap and manually connect it to another slot, exposing a different device node.
Does the snap has a check in one of its hooks or similar that is being installed on the devices it expects to be installed on and not somewhere else? (Ideally before it starts actually using the connections)
@alexmurray@jslarraz please go ahead and drop the auto-connection assertion for classic.
Checking the device model needs another super-priv interface to access /sys/firmware/devicetree/base/model which adds even more unwanted complexity for granting access to the GPIO.
The self-connection command for the custom device is very strange. We’d rather refine the existing slot, and split it into two slots: custom-gpio0 (for legacy pis) and custom-gpio4 (for pi5) and leave the right connection decision to users. We have also considered keeping a single slot but calling it e.g. pi-gpio.