Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

xhci: dbc: allow setting manufacturer string through sysfs

Add dbc_manufacturer sysfs attribute to allow changing the manufacturer
description presented by the debug device when a host requests a string
descriptor with iManufacturer index.

Value can only be changed while debug capability (DbC) is in disabled
state to prevent USB device descriptor change while connected to a USB
host.

The default value is "Linux Foundation".
The string length can be from 1 to 126 characters.
String is terminated at null or newline, driver does not support empty
string.

[ mn: Improve commit message and sysfs entry documentation ]

Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://patch.msgid.link/20260120181148.128712-5-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Łukasz Bartosik and committed by
Greg Kroah-Hartman
db7fd195 33d15312

+49
+13
Documentation/ABI/testing/sysfs-bus-pci-drivers-xhci_hcd
··· 114 114 connected to a USB host. 115 115 The default value is "Linux USB Debug Target". 116 116 The field length can be from 1 to 126 characters. 117 + 118 + What: /sys/bus/pci/drivers/xhci_hcd/.../dbc_manufacturer 119 + Date: January 2026 120 + Contact: Łukasz Bartosik <ukaszb@chromium.org> 121 + Description: 122 + The dbc_manufacturer attribute allows to change the manufacturer 123 + string descriptor presented by the debug device when a host 124 + requests a string descriptor with iManufacturer index. 125 + Value can only be changed while debug capability (DbC) is in 126 + disabled state to prevent USB device descriptor change while 127 + connected to a USB host. 128 + The default value is "Linux Foundation". 129 + The field length can be from 1 to 126 characters.
+36
drivers/usb/host/xhci-dbgcap.c
··· 1210 1210 return size; 1211 1211 } 1212 1212 1213 + static ssize_t dbc_manufacturer_show(struct device *dev, 1214 + struct device_attribute *attr, 1215 + char *buf) 1216 + { 1217 + struct xhci_hcd *xhci = hcd_to_xhci(dev_get_drvdata(dev)); 1218 + struct xhci_dbc *dbc = xhci->dbc; 1219 + 1220 + return sysfs_emit(buf, "%s\n", dbc->str.manufacturer); 1221 + } 1222 + 1223 + static ssize_t dbc_manufacturer_store(struct device *dev, 1224 + struct device_attribute *attr, 1225 + const char *buf, size_t size) 1226 + { 1227 + struct xhci_hcd *xhci = hcd_to_xhci(dev_get_drvdata(dev)); 1228 + struct xhci_dbc *dbc = xhci->dbc; 1229 + size_t len; 1230 + 1231 + if (dbc->state != DS_DISABLED) 1232 + return -EBUSY; 1233 + 1234 + len = strcspn(buf, "\n"); 1235 + if (!len) 1236 + return -EINVAL; 1237 + 1238 + if (len > USB_MAX_STRING_LEN) 1239 + return -E2BIG; 1240 + 1241 + memcpy(dbc->str.manufacturer, buf, len); 1242 + dbc->str.manufacturer[len] = '\0'; 1243 + 1244 + return size; 1245 + } 1246 + 1213 1247 static ssize_t dbc_product_show(struct device *dev, 1214 1248 struct device_attribute *attr, 1215 1249 char *buf) ··· 1401 1367 static DEVICE_ATTR_RW(dbc_bcdDevice); 1402 1368 static DEVICE_ATTR_RW(dbc_serial); 1403 1369 static DEVICE_ATTR_RW(dbc_product); 1370 + static DEVICE_ATTR_RW(dbc_manufacturer); 1404 1371 static DEVICE_ATTR_RW(dbc_bInterfaceProtocol); 1405 1372 static DEVICE_ATTR_RW(dbc_poll_interval_ms); 1406 1373 ··· 1412 1377 &dev_attr_dbc_bcdDevice.attr, 1413 1378 &dev_attr_dbc_serial.attr, 1414 1379 &dev_attr_dbc_product.attr, 1380 + &dev_attr_dbc_manufacturer.attr, 1415 1381 &dev_attr_dbc_bInterfaceProtocol.attr, 1416 1382 &dev_attr_dbc_poll_interval_ms.attr, 1417 1383 NULL