From owner-freebsd-hackers@freebsd.org Wed Aug 26 08:16:37 2020 Return-Path: Delivered-To: freebsd-hackers@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 BF54F3CDB99 for ; Wed, 26 Aug 2020 08:16:37 +0000 (UTC) (envelope-from wojtek@puchar.net) Received: from puchar.net (puchar.net [194.1.144.90]) (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 4BbzGX50jGz4r59 for ; Wed, 26 Aug 2020 08:16:35 +0000 (UTC) (envelope-from wojtek@puchar.net) Received: Received: from 127.0.0.1 (localhost [127.0.0.1]) by puchar.net (8.15.2/8.15.2) with ESMTPS id 07Q8GSBj081547 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Wed, 26 Aug 2020 10:16:28 +0200 (CEST) (envelope-from puchar-wojtek@puchar.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=puchar.net; s=default; t=1598429788; bh=WD58J4fufKKMpKEn2bIlVSDTUjImaubgSWG9Umla/tI=; h=Date:From:To:Subject; b=ER9QVFIpXQAfnVW2NVAJu0fcIIFDmFa5wa0y2QVgNIlF9C9KlXB54TFbaMVBrUqNQ FnNZbCHZSSorYIq+Q6GqHdDiWKgZxC/GG+xI22T7AalmjWk8TO/tEiPIyJvG6kTwFh LNRxH2epGpAGExBxGAzd+e3tVzRHsWzSZRundIxM= Received: from localhost (puchar-wojtek@localhost) by puchar.net (8.15.2/8.15.2/Submit) with ESMTP id 07Q8GSG1081544 for ; Wed, 26 Aug 2020 10:16:28 +0200 (CEST) (envelope-from puchar-wojtek@puchar.net) Date: Wed, 26 Aug 2020 10:16:28 +0200 (CEST) From: Wojciech Puchar To: freebsd-hackers@freebsd.org Subject: USB experts help needed Message-ID: User-Agent: Alpine 2.20 (BSF 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Rspamd-Queue-Id: 4BbzGX50jGz4r59 X-Spamd-Bar: ++ Authentication-Results: mx1.freebsd.org; dkim=fail (headers rsa verify failed) header.d=puchar.net header.s=default header.b=ER9QVFIp; dmarc=none; spf=pass (mx1.freebsd.org: domain of wojtek@puchar.net designates 194.1.144.90 as permitted sender) smtp.mailfrom=wojtek@puchar.net X-Spamd-Result: default: False [2.10 / 15.00]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; TO_DN_NONE(0.00)[]; NEURAL_SPAM_MEDIUM(0.39)[0.394]; RCPT_COUNT_ONE(0.00)[1]; DMARC_NA(0.00)[puchar.net]; R_DKIM_REJECT(1.00)[puchar.net:s=default]; DKIM_TRACE(0.00)[puchar.net:-]; NEURAL_SPAM_LONG(0.58)[0.582]; NEURAL_SPAM_SHORT(0.42)[0.420]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:43476, ipnet:194.1.144.0/24, country:PL]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[freebsd-hackers] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2020 08:16:37 -0000 i am implementing my own "mass storage device" (actually fake but doesn't matter) on microcontroller. I already finished implementing control endpoint part so it is properly detected configured itp. But i have no idea why i'm getting USB reset after successful reply to "get max lun" control endpoint command (0xFE). i reply with one byte of zero according to USB mass storage specs. below is log from my microcontroller's program USB: RESET USB: Setting USB address 6 USB: Host received response from control interface. USB: Sending config descriptor 0100:8 bytes. USB: Host received response from control interface. USB: Sending config descriptor 0100:18 bytes. USB: Host received response from control interface. USB: Sending config descriptor 0300:2 bytes. USB: Host received response from control interface. USB: Sending config descriptor 0300:4 bytes. USB: Host received response from control interface. USB: Sending config descriptor 0301:2 bytes. USB: Host received response from control interface. USB: Sending config descriptor 0301:32 bytes. USB: Host received response from control interface. USB: Sending config descriptor 0302:2 bytes. USB: Host received response from control interface. USB: Sending config descriptor 0302:12 bytes. USB: Host received response from control interface. USB: Sending config descriptor 0200:9 bytes. USB: Host received response from control interface. USB: Sending config descriptor 0200:32 bytes. USB: Host received response from control interface. USB: Set configuration 1 received. USB: Host received response from control interface. USB: Mass storage get MAX LUN received. USB: Host received response from control interface. USB: RESET ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ USB: Setting USB address 6 USB: Host received response from control interface. USB: Sending config descriptor 0100:8 bytes. USB: Host received response from control interface. USB: Sending config descriptor 0100:18 bytes. USB: Host received response from control interface. USB: Sending config descriptor 0200:9 bytes. USB: Host received response from control interface. USB: Sending config descriptor 0200:32 bytes. USB: Host received response from control interface. USB: Set configuration 1 received. USB: Host received response from control interface. USB: Mass storage reset received. USB: Host received response from control interface. USB: Clear endpoint 1 received. USB: Host received response from control interface. . . . after reset FreeBSD seems to again perform initialization without asking for amount of LUN again the last "clear endpoint 1" is because i don't have endpoint 1 implemented yet