Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Nov 2019 18:21:27 -0500
From:      "Farhan Khan" <farhan@farhan.codes>
To:        freebsd-usb@freebsd.org
Subject:   Matching 'struct usb_config' with usbconfig
Message-ID:  <b89cfdf5-c615-41b0-b791-e92606da31b1@www.fastmail.com>

next in thread | raw e-mail | index | archive | help
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?

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?b89cfdf5-c615-41b0-b791-e92606da31b1>