Matching 'struct usb_config' with usbconfig
Hans Petter Selasky
hps at selasky.org
Tue Nov 26 08:19:59 UTC 2019
On 2019-11-26 00:21, Farhan Khan wrote:
> Hi all,
>
> I have a clarification question about the USB protocol.
>
> I ran "lsusb -v" (same as usbconfig dump_info) and saw that a device's wMaxPacketSize was 0x0200 (512 bytes). However, the "struct usb_config" seems to set the bufsize field as 16384 (16 * 1024). What is the reason for this difference? Also, why would the number of usb_config Endpoints and the usb_config struct differ?
Hi,
The buffer size is usually larger to avoid buffer underruns, but should
be a multiplum of the wMaxPacketSize. We have an own flag for that,
proxy buffer.
usb_config is usually a sub-set of the endpoints the device has, and for
sake of double buffering you may repeat the same entry.
--HPS
>
> Full context, the device is a Realtek RTL8188EU. The USB configuration variable is rtwn_config_common, as defined in sys/dev/rtwn/usb/rtwn_usb_ep.c. The bufsize is set to RTWN_USB_TXBUFSZ, which is defined as:
> #define RTWN_USB_TXBUFSZ (16 * 1024)
>
> Also, note that there are 3 Endpoints, but 5 elements in the rtwn_config_common structure. What explains this?
>
> Thanks! And see configuration below:
>
> -----BEGIN COMMAND BLOCK-----
> Bus 003 Device 004: ID 0bda:8179 Realtek Semiconductor Corp. RTL8188EUS 802.11n Wireless Network Adapter
> Device Descriptor:
> bLength 18
> bDescriptorType 1
> bcdUSB 2.00
> bDeviceClass 0 (Defined at Interface level)
> bDeviceSubClass 0
> bDeviceProtocol 0
> bMaxPacketSize0 64
> idVendor 0x0bda Realtek Semiconductor Corp.
> idProduct 0x8179 RTL8188EUS 802.11n Wireless Network Adapter
> bcdDevice 0.00
> iManufacturer 1
> iProduct 2
> iSerial 3
> bNumConfigurations 1
> Configuration Descriptor:
> bLength 9
> bDescriptorType 2
> wTotalLength 39
> bNumInterfaces 1
> bConfigurationValue 1
> iConfiguration 0
> bmAttributes 0xa0
> (Bus Powered)
> Remote Wakeup
> MaxPower 500mA
> Interface Descriptor:
> bLength 9
> bDescriptorType 4
> bInterfaceNumber 0
> bAlternateSetting 0
> bNumEndpoints 3
> bInterfaceClass 255 Vendor Specific Class
> bInterfaceSubClass 255 Vendor Specific Subclass
> bInterfaceProtocol 255 Vendor Specific Protocol
> iInterface 0
> Endpoint Descriptor:
> bLength 7
> bDescriptorType 5
> bEndpointAddress 0x81 EP 1 IN
> bmAttributes 2
> Transfer Type Bulk
> Synch Type None
> Usage Type Data
> wMaxPacketSize 0x0200 1x 512 bytes
> bInterval 0
> Endpoint Descriptor:
> bLength 7
> bDescriptorType 5
> bEndpointAddress 0x02 EP 2 OUT
> bmAttributes 2
> Transfer Type Bulk
> Synch Type None
> Usage Type Data
> wMaxPacketSize 0x0200 1x 512 bytes
> bInterval 0
> Endpoint Descriptor:
> bLength 7
> bDescriptorType 5
> bEndpointAddress 0x03 EP 3 OUT
> bmAttributes 2
> Transfer Type Bulk
> Synch Type None
> Usage Type Data
> wMaxPacketSize 0x0200 1x 512 bytes
> bInterval 0
> -----END COMMAND BLOCK-----
>
>
>
> --
> Farhan Khan
> PGP Fingerprint: 1312 89CE 663E 1EB2 179C 1C83 C41D 2281 F8DA C0DE
>
> _______________________________________________
> freebsd-usb at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-usb
> To unsubscribe, send any mail to "freebsd-usb-unsubscribe at freebsd.org"
>
More information about the freebsd-usb
mailing list