1usb_get_string_descr(9F) Kernel Functions for Drivers usb_get_string_descr(9F)
2
3
4
6 usb_get_string_descr - Get string descriptor from device
7
9 #include <sys/usb/usba.h>
10
11
12
13 int usb_get_string_descr(dev_info_t *dip,
14 uint16_t langid, uint8_t index,
15 char *buf, size_t buflen);
16
17
19 Solaris DDI specific (Solaris DDI)
20
22 dip Pointer to the device's dev_info structure.
23
24
25 langid Language ID. Currently only USB_LANG_ID (English ascii) is
26 valid.
27
28
29 index String index indicating descriptor to retrieve.
30
31
32 buf Address into which the string descriptor is placed.
33
34
35 buflen Size of buf in bytes.
36
37
39 The usb_get_string_descr() function retrieves a parsed string descrip‐
40 tor from a device. dip specifies the device, while index indicates
41 which descriptor to return.
42
43
44 String descriptors provide information about other descriptors, or
45 information that is encoded in other descriptors, in readable form.
46 Many descriptor types have one or more index fields which identify
47 string descriptors. (See Sections 9.5 and 9.6 of the USB 2.0 specifi‐
48 cation.) For example, a configuration descriptor's seventh byte con‐
49 tains the string descriptor index describing a specific configuration.
50
51
52 Retrieved descriptors that do not fit into buflen bytes are truncated.
53 All returned descriptors are null-terminated.
54
56 USB_SUCCESS String descriptor is returned in buf.
57
58
59 USB_INVALID_ARGS dip or buf are NULL, or index or buflen is 0.
60
61
62 USB_FAILURE Descriptor cannot be retrieved.
63
64
66 May be called from user or kernel context.
67
69 /* Get the first string descriptor. */
70
71 char buf[SIZE];
72
73 if (usb_get_string_descr(
74 dip, USB_LANG_ID, 0, buf, SIZE) == USB_SUCCESS) {
75 cmn_err (CE_NOTE, "%s%d: %s",
76 ddi_driver_name(dip), ddi_get_instance(dip), buf);
77 }
78
79
81 See attributes(5) for descriptions of the following attributes:
82
83
84
85
86 ┌─────────────────────────────┬─────────────────────────────┐
87 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
88 ├─────────────────────────────┼─────────────────────────────┤
89 │Architecture │PCI-based systems │
90 ├─────────────────────────────┼─────────────────────────────┤
91 │Interface stability │Committed │
92 ├─────────────────────────────┼─────────────────────────────┤
93 │Availability │SUNWusb │
94 └─────────────────────────────┴─────────────────────────────┘
95
97 attributes(5), usb_get_dev_data(9F), usb_string_descr(9S)
98
99
100
101SunOS 5.11 5 Jan 2004 usb_get_string_descr(9F)