Getting USB gadgets to work when you plug them in

For users

A properly handled USB gadget in Debian will cause the desktop software to propose the packages you need to get the gadget working, and once the package is installed, you can run the relevant program and access the gadget.

If this is not working, either the gadget isn't supported by Debian or the package maintainers should fix their packages to get it to work.

For package maintainers

A hardware related package in Debian should announce the hardware it support using AppStream metadata. When this is done, the isenkram desktop daemon will know what package to propose to install when the hardware gadget is installed.

Once the package is installed, it should set up device access for the user logged into the console, to make sure the programs in the package can access the USB device and talk to the gadget. Here are recipes on how to do this.

  1. First, check the AppStream maintainer guidelines to learn how to announce hardware support via the APT packaging system. Packages can announce support for specific USB vendor/product IDs or whole USB classes, as well as other combinations using the modalias notation.

  2. Next, make sure the package include udev rules to recognize the USB device and provide access to the /dev/ file for the logged in user. There are two approaches for this, one is using the file group plugdev, the other is using the udev tag uaccess. The preferred way is using the uaccess tag, either directly or via markers recognized by /lib/udev/rules.d/70-uaccess.rules.

udev rules

Here are some example udev rules ensuring access to the user logged into the console for the device in question:

# LEGO Mindstorms NXT 2.0
SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="0694", ATTR{idProduct}=="0002", \
    ENV{ID_LEGO_MINDSTORMS}=="1", TAG+="uaccess"
# Tenx Technology, Inc. Rocket Launcher
SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="1130", ATTR{idProduct}=="0202", \