The hidraw interface

hidraw enables raw access to USB and Bluetooth Human Interface (hidraw) devices. This interface is restricted because it provides privileged access to hardware devices.

Auto-Connect: no Attributes:

  • Should specify a single path attribute:
    • path (slot): path to hidraw device node e.g. /dev/hidraw0
  • Or three attributes:
    • usb-vendor (slot): integer representing the USB Vendor ID, must be in range 0 < vid <= 65535
    • usb-product (slot): integer representing the USB Product ID, must be in range 0 <= vid <= 65535
    • path (slot): path where a symlink will be created to the device e.g. /dev/hidraw-mydevice

To use a hidraw device, the snap developer must add plugs: [ hidraw ] to a snap’s snapcraft.yaml. The snap user can then access a specific hidraw device with an interface connection.

Use snap interface hidraw to see which hidraw devices are available on the system.

Once connected, the consuming snap can use the device via the path specified by the connected slot.

ⓘ This is a snap interface. See Interface management and Supported interfaces for further details on how interfaces are used.

@degville While this is true, I think it’s more useful to have users look at the output of

$ snap interface hidraw

since that will give them a short explanation of the interface as well as showing them the available slots and plugs for just that interface. snap connections shows all connections which gets to be quite unwieldy to look at when you have a few snaps. This also applies to hotplug interfaces, for example the serial-port interface shows this for me (with an actual USB serial-port device connected):

$ snap interface serial-port 
name:    serial-port
summary: allows accessing a specific serial port
slots:
  - core:pl2303serialport (allows accessing a specific serial port)
1 Like

Great suggestion, and I totally agree - thanks! I’ll update these docs accordingly.

1 Like