From owner-freebsd-usb@freebsd.org Mon Nov 25 23:21:52 2019 Return-Path: Delivered-To: freebsd-usb@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 50E0F1BD84D for ; Mon, 25 Nov 2019 23:21:52 +0000 (UTC) (envelope-from farhan@farhan.codes) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47MNMz1j33z449x for ; Mon, 25 Nov 2019 23:21:50 +0000 (UTC) (envelope-from farhan@farhan.codes) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 8576AA2E for ; Mon, 25 Nov 2019 18:21:48 -0500 (EST) Received: from imap22 ([10.202.2.72]) by compute5.internal (MEProxy); Mon, 25 Nov 2019 18:21:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=farhan.codes; h= mime-version:message-id:date:from:to:subject:content-type; s= fm1; bh=5z5/VZHx918O3LE9fwl9Ljh4UPXtDW2i06eInax8bzg=; b=vdfA9Tev k/If34jinSX8gxz/ZZPFeof24LnaxOuTpb5NCJTKJxvtPY+NPpYxvB4j1Yo+a1Gz JSfaCm2PRBwnUxFU1HBeEtf9apDfmX7MzY+N9jDG7y6VViKIL9EzAJ3nALgWWnZB dci9LMJMenPa7Upje/LRMsxblAAMXKb9mRgM0pybNoqq5+A6ai/S5TEZhvUd6yax kCwcLxU3vtTpcQVkexQ65l1X3RGefNMocz4IUQbf+zXhxPTiLXH6Fg/BPa6KCQ6n oMzPiNMGW6ucoXhi/vzJUBlN6SixpKE/ktqdyRCmLelpp8vSiLv2TW+qk83OFRea ZAhAFRpRcIyGog== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=5z5/VZHx918O3LE9fwl9Ljh4UPXtD W2i06eInax8bzg=; b=Iak/z727LUSEvrpWesKUIZjnR3JfH4GOGXa/nkxx7mVvF 8ennBJCDjXaPz6P10I4s0hZmd2W4iek7OMOkkZXvNtTpeupqOQ9RZuNkyQh++7Y9 6Y/jYWyxUgi7idMmHtfLf3xUOvkd0ChbCBVxOYCJhEnsw7L2TJQlV29rSKITBril SSKO760/Y0NACQJlCLn5gMKgD65Ym0Pmbc32c40qwathDJzd+vMnn59jns+37q6H fUSi91H4t7VBv3r+IF2CbF62NkyV96oW5DC7sApw0jYYxSrN0EcSAQtDLFWAA6Qu R+Tj0G4tzq2Exo3dslENCP7WImLayI1Ib7ptovcCA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudeivddgtdekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfffhffvufgtsehttdertd erredtnecuhfhrohhmpedfhfgrrhhhrghnucfmhhgrnhdfuceofhgrrhhhrghnsehfrghr hhgrnhdrtghouggvsheqnecurfgrrhgrmhepmhgrihhlfhhrohhmpehfrghrhhgrnhesfh grrhhhrghnrdgtohguvghsnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id A5698668005F; Mon, 25 Nov 2019 18:21:47 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.7-578-g826f590-fmstable-20191119v1 Mime-Version: 1.0 Message-Id: Date: Mon, 25 Nov 2019 18:21:27 -0500 From: "Farhan Khan" To: freebsd-usb@freebsd.org Subject: Matching 'struct usb_config' with usbconfig Content-Type: text/plain X-Rspamd-Queue-Id: 47MNMz1j33z449x X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=farhan.codes header.s=fm1 header.b=vdfA9Tev; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=Iak/z727; dmarc=none; spf=pass (mx1.freebsd.org: domain of farhan@farhan.codes designates 64.147.123.20 as permitted sender) smtp.mailfrom=farhan@farhan.codes X-Spamd-Result: default: False [-5.08 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[farhan.codes:s=fm1,messagingengine.com:s=fm1]; XM_UA_NO_VERSION(0.01)[]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:64.147.123.20]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-usb@freebsd.org]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[4]; DMARC_NA(0.00)[farhan.codes]; MV_CASE(0.50)[]; DKIM_TRACE(0.00)[farhan.codes:+,messagingengine.com:+]; IP_SCORE(-3.49)[ip: (-9.81), ipnet: 64.147.123.0/24(-4.91), asn: 11403(-2.68), country: US(-0.05)]; RCVD_IN_DNSWL_LOW(-0.10)[20.123.147.64.list.dnswl.org : 127.0.5.1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:11403, ipnet:64.147.123.0/24, country:US]; RCVD_TLS_LAST(0.00)[]; MID_RHS_WWW(0.50)[] X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Nov 2019 23:21:52 -0000 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