How do I create a hidraw connection?

I’m packaging an application that expects access to e.g. /dev/hidraw0. It works in devmode so now I’m trying to configure it for strict confinement. I think I need to follow these instructions:

  1. Snaps that want to consume a hidraw device simply plugs: [ hidraw ] and the hidraw device to connect is specified during interface connection.
  2. Available hidraw devices for the system can be seen with snap connections.
  3. Once connected, the consuming snap can use the device via the path specified by the connected slot.

I’ve done the first step, but the next returns no results:

$ sudo snap connections
$ 

These instructions look promising but I’m not sure what to enter for the slot:

To make a connection, use the following syntax:

$ snap connect <snap>:<plug interface> <snap>:<slot interface>

Where do I go from here?

I think that the hidraw interface is meant to be provided by a gadget snap, so currently the only way is to build a gadget snap for your system that exposes that interface.

Alternatively, it seems like the hidraw interface is a good candidate for expanding to hotplug so that the interface would show up dynamically from the core snap if your system has those devices available (my desktop system running classic Ubuntu has some devices present like this but doesn’t have any such interfaces exposed because I don’t have a gadget snap for my classic system).