USB_TEMPLATE(4)
π USB_TEMPLATE(4) β usb_template: USB device side templates π
okay so bestie, welcome to the Kernel Interfaces Manual page for usb_template β this is the USB device side templates manual, and itβs literally your cheat sheet for making a USB device-side driver behave like different gadgets. π
π NAME π
usb_template β USB device side templates. iconic. no cap. β¨
β¨ SYNOPSIS β¨
To compile this module into the kernel, place the following line in your kernel configuration file:
device usb_template
To load the module at boot time, place the following line in loader.conf(5):
usb_template_load="YES"
π¦ DESCRIPTION π¦
The usb_template module implements various USB templates that are needed when programming an USB device side driver. Think of it as the main character of your USB gadget setup. π«Ά
A USB template consists of an USB device descriptor, one or more USB configuration descriptors, one or more USB interface descriptors, one or more USB endpoint descriptors, USB strings and additional USB descriptors. So itβs giving βwhole bundle,β not just a single descriptor. π
USB templates are selected using the hw.usb.template sysctl and tunable, or by using the usbconfig(8) set_template subcommand. Changing the hw.usb.template sysctl triggers reenumeration by the USB host; changes to other sysctls may not be visible to the host until reenumeration is performed. that last bit is important, bestie β donβt assume the host sees your other sysctl changes until reenumeration happens. π
Available templates are:
0β USB Mass Storage, seecfumass(4)1β CDC Ethernet, seecdce(4)2β Media Transfer Protocol (MTP)3β USB serial port, seeumodem(4)4β USB audio5β USB keyboard6β USB mouse7β USB phone8β CDC Ethernet and serial port9β USB MIDI10β CDC Ethernet, serial port, and storage11β CDC Ethernet Emulation Model, seecdceem(4)
ποΈ SYSCTL VARIABLES ποΈ
The following variables are available as both sysctl(8) variables and loader(8) tunables:
hw.usb.templateβ currently selected template. Set it to-1to make the device disappear from the USB host point of view. π«₯hw.usb.template_powerβ USB bus power consumption in mA at 5V. Must be between0and500. Setting to0marks the device as self-powered. Defaults to500mA. β‘hw.usb.templates.Nβ configuration for template number N.hw.usb.templates.N.vendor_idβ 16-bit vendor identifier (VID), usually assigned by USB-IF.hw.usb.templates.N.product_idβ 16-bit product identifier (PID).hw.usb.templates.N.manufacturerβ string containing human-readable manufacturer name.hw.usb.templates.N.productβ string containing human-readable product name.
π SEE ALSO π
π STANDARDS π
The usb_template module complies to the USB 1.0, 2.0 and 3.0 standard. periodt. β
π§ HISTORY π§
The usb_template module was written by Hans Petter Selasky <hselasky@FreeBSD.org>. π
xoxo π β this is the Debian version, dated August 7, 2019, signing off from the USB_TEMPLATE(4) page. π«Ά
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2008 Hans Petter Selasky. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms