Lines Matching +full:sub +full:- +full:bus
1 // SPDX-License-Identifier: GPL-2.0+
14 * I considered using /dev/bus/usb/device# for each device
16 * reason -- maybe it's just too deep of a directory structure.
24 * this in any plug-and-play environment.)
26 * 1999-12-16: Thomas Sailer <sailer@ife.ee.ethz.ch>
29 * into one page, only the device list for one bus.
32 * 2000-01-04: Thomas Sailer <sailer@ife.ee.ethz.ch>
34 * 2000-07-05: Ashley Montanaro <ashley@compsoc.man.ac.uk>
36 * per device, not per bus
54 /* T: Bus=dd Lev=dd Prnt=dd Port=dd Cnt=dd Dev#=ddd Spd=dddd MxCh=dd */
55 "\nT: Bus=%2.2d Lev=%2.2d Prnt=%2.2d Port=%2.2d Cnt=%2.2d Dev#=%3d Spd=%-4s MxCh=%2d\n";
76 /* D: Ver=xx.xx Cls=xx(sssss) Sub=xx Prot=xx MxPS=dd #Cfgs=dd */
77 "D: Ver=%2x.%02x Cls=%02x(%-5s) Sub=%02x Prot=%02x MxPS=%2d #Cfgs=%3d\n";
88 /* A: FirstIf#=dd IfCount=dd Cls=xx(sssss) Sub=xx Prot=xx */
89 "A: FirstIf#=%2d IfCount=%2d Cls=%02x(%-5s) Sub=%02x Prot=%02x\n";
92 /* I: If#=dd Alt=dd #EPs=dd Cls=xx(sssss) Sub=xx Prot=xx Driver=xxxx*/
93 "I:%c If#=%2d Alt=%2d #EPs=%2d Cls=%02x(%-5s) Sub=%02x Prot=%02x Driver=%s\n";
97 "E: Ad=%02x(%c) Atr=%02x(%-4s) MxPS=%4d Ivl=%d%cs\n";
117 {USB_CLASS_CONTENT_SEC, "c-sec"},
127 {-1, "unk."} /* leave as last */
136 for (ix = 0; clas_info[ix].class != -1; ix++) in class_decode()
183 start += sprintf(start, format_endpt, desc->bEndpointAddress, dir, in usb_dump_endpoint_descriptor()
184 desc->bmAttributes, type, in usb_dump_endpoint_descriptor()
202 desc = &intfc->altsetting[setno].desc; in usb_dump_interface_descriptor()
204 driver_name = (iface->dev.driver in usb_dump_interface_descriptor()
205 ? iface->dev.driver->name in usb_dump_interface_descriptor()
207 active = (desc == &iface->cur_altsetting->desc); in usb_dump_interface_descriptor()
211 desc->bInterfaceNumber, in usb_dump_interface_descriptor()
212 desc->bAlternateSetting, in usb_dump_interface_descriptor()
213 desc->bNumEndpoints, in usb_dump_interface_descriptor()
214 desc->bInterfaceClass, in usb_dump_interface_descriptor()
215 class_decode(desc->bInterfaceClass), in usb_dump_interface_descriptor()
216 desc->bInterfaceSubClass, in usb_dump_interface_descriptor()
217 desc->bInterfaceProtocol, in usb_dump_interface_descriptor()
226 const struct usb_host_interface *desc = &intfc->altsetting[setno]; in usb_dump_interface()
230 for (i = 0; i < desc->desc.bNumEndpoints; i++) { in usb_dump_interface()
232 start, end, &desc->endpoint[i].desc); in usb_dump_interface()
243 iad->bFirstInterface, in usb_dump_iad_descriptor()
244 iad->bInterfaceCount, in usb_dump_iad_descriptor()
245 iad->bFunctionClass, in usb_dump_iad_descriptor()
246 class_decode(iad->bFunctionClass), in usb_dump_iad_descriptor()
247 iad->bFunctionSubClass, in usb_dump_iad_descriptor()
248 iad->bFunctionProtocol); in usb_dump_iad_descriptor()
272 desc->bNumInterfaces, in usb_dump_config_descriptor()
273 desc->bConfigurationValue, in usb_dump_config_descriptor()
274 desc->bmAttributes, in usb_dump_config_descriptor()
275 desc->bMaxPower * mul); in usb_dump_config_descriptor()
291 start = usb_dump_config_descriptor(start, end, &config->desc, active, in usb_dump_config()
294 if (config->intf_assoc[i] == NULL) in usb_dump_config()
297 config->intf_assoc[i]); in usb_dump_config()
299 for (i = 0; i < config->desc.bNumInterfaces; i++) { in usb_dump_config()
300 intfc = config->intf_cache[i]; in usb_dump_config()
301 interface = config->interface[i]; in usb_dump_config()
302 for (j = 0; j < intfc->num_altsetting; j++) { in usb_dump_config()
316 u16 bcdUSB = le16_to_cpu(desc->bcdUSB); in usb_dump_device_descriptor()
317 u16 bcdDevice = le16_to_cpu(desc->bcdDevice); in usb_dump_device_descriptor()
323 desc->bDeviceClass, in usb_dump_device_descriptor()
324 class_decode(desc->bDeviceClass), in usb_dump_device_descriptor()
325 desc->bDeviceSubClass, in usb_dump_device_descriptor()
326 desc->bDeviceProtocol, in usb_dump_device_descriptor()
327 desc->bMaxPacketSize0, in usb_dump_device_descriptor()
328 desc->bNumConfigurations); in usb_dump_device_descriptor()
332 le16_to_cpu(desc->idVendor), in usb_dump_device_descriptor()
333 le16_to_cpu(desc->idProduct), in usb_dump_device_descriptor()
346 if (dev->manufacturer) in usb_dump_device_strings()
348 dev->manufacturer); in usb_dump_device_strings()
351 if (dev->product) in usb_dump_device_strings()
352 start += sprintf(start, format_string_product, dev->product); in usb_dump_device_strings()
356 if (dev->serial) in usb_dump_device_strings()
358 dev->serial); in usb_dump_device_strings()
368 start = usb_dump_device_descriptor(start, end, &dev->descriptor); in usb_dump_desc()
372 for (i = 0; i < dev->descriptor.bNumConfigurations; i++) { in usb_dump_desc()
373 start = usb_dump_config(dev->speed, in usb_dump_desc()
374 start, end, dev->config + i, in usb_dump_desc()
376 (dev->config + i) == dev->actconfig); in usb_dump_desc()
384 * buffer - the user-space buffer to write data into
385 * nbytes - the maximum number of bytes to write
386 * skip_bytes - the number of bytes to skip before writing anything
387 * file_offset - the offset into the devices file on completion
392 struct usb_device *usbdev, struct usb_bus *bus, in usb_device_dump() argument
413 return -ENOMEM; in usb_device_dump()
415 if (usbdev->parent && usbdev->parent->devnum != -1) in usb_device_dump()
416 parent_devnum = usbdev->parent->devnum; in usb_device_dump()
421 switch (usbdev->speed) { in usb_device_dump()
437 bus->busnum, level, parent_devnum, in usb_device_dump()
438 index, count, usbdev->devnum, in usb_device_dump()
439 speed, usbdev->maxchild); in usb_device_dump()
441 * level = topology-tier level; in usb_device_dump()
451 if (usbdev->speed == USB_SPEED_HIGH || in usb_device_dump()
452 usbdev->speed >= USB_SPEED_SUPER) in usb_device_dump()
462 bus->bandwidth_allocated, max, in usb_device_dump()
463 (100 * bus->bandwidth_allocated + max / 2) in usb_device_dump()
465 bus->bandwidth_int_reqs, in usb_device_dump()
466 bus->bandwidth_isoc_reqs); in usb_device_dump()
469 data_end = usb_dump_desc(data_end, pages_start + (2 * PAGE_SIZE) - 256, in usb_device_dump()
472 if (data_end > (pages_start + (2 * PAGE_SIZE) - 256)) in usb_device_dump()
475 length = data_end - pages_start; in usb_device_dump()
478 length -= *skip_bytes; in usb_device_dump()
483 return -EFAULT; in usb_device_dump()
485 *nbytes -= length; in usb_device_dump()
491 *skip_bytes -= length; in usb_device_dump()
499 file_offset, childdev, bus, in usb_device_dump()
500 level + 1, chix - 1, ++cnt); in usb_device_dump()
502 if (ret == -EFAULT) in usb_device_dump()
512 struct usb_bus *bus; in usb_device_read() local
518 return -EINVAL; in usb_device_read()
524 idr_for_each_entry(&usb_bus_idr, bus, id) { in usb_device_read()
526 if (!bus_to_hcd(bus)->rh_registered) in usb_device_read()
528 usb_lock_device(bus->root_hub); in usb_device_read()
530 bus->root_hub, bus, 0, 0, 0); in usb_device_read()
531 usb_unlock_device(bus->root_hub); in usb_device_read()