USB_TEMPLATE(4)
π USB_TEMPLATE(4) β the kernel interfaces manual page, but make it cute π
okay bestie, gather round, because this is the page for usb_template β the USB device side templates module. it lives in the Kernel Interfaces Manual section, and honestly? it's giving backstage-pass energy. let's go π
β¨ NAME β¨
usb_template β USB device side templates π¦
πΈ SYNOPSIS πΈ
so you wanna get this module in the game. two ways, pick your fighter:
option one β compile it into the kernel. drop this line into your kernel configuration file:
device usb_template
option two β load it at boot time. put this line into loader.conf(5):
usb_template_load="YES"
periodt. π
π DESCRIPTION π
okay so the usb_template module implements a whole lil wardrobe of USB templates β and you literally need these when you're programming a USB device side driver. no templates, no lewk. π
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
- additional USB descriptors
basically the whole fit, head to toe. π
you pick your template with the hw.usb.template sysctl and tunable, or with the usbconfig(8) set_template subcommand. and here's the thing, bestie β 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. so like, the host won't see your new outfit until you do the lil twirl. β¨
π available templates π
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)
twelve templates, twelve personalities, all iconic. π
β SYSCTL VARIABLES β
the following variables are available as both sysctl(8) variables and loader(8) tunables. yes queen, both. multitasking. π
hw.usb.templateβ the currently selected template. set it to-1to make the device disappear from the USB host point of view. (poof. gone. ghosted. π»)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.
ngl, N is doing a lot of heavy lifting here and honestly? we respect the range. π«Ά
π SEE ALSO π
cfumass(4), usb(4), usfs(4), usbconfig(8)
iykyk π
π STANDARDS π
the usb_template module complies to the USB 1.0, 2.0 and 3.0 standard. all three. ate and left no crumbs. π₯
π§ HISTORY π§
the usb_template module was written by Hans Petter Selasky <hselasky@FreeBSD.org>. legend behaviour, fr fr. πΈ
π the cute lil sign-off π
and that's the whole page, bestie! this one came from the Debian source, dated August 7, 2019, and it's the USB_TEMPLATE(4) page in the Kernel Interfaces Manual. mwah. πβ¨ππ¦
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2008 Hans Petter Selasky. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms