Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp2499336pxt; Mon, 9 Aug 2021 01:46:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXVHwSPX2MXoafpP1/V/Z7qa29wZiLAqI5Vz63dvEtQk04+AnF3sW/Cp0eu5kRYKVMnuQ6 X-Received: by 2002:a17:906:46d5:: with SMTP id k21mr21817283ejs.53.1628498779828; Mon, 09 Aug 2021 01:46:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628498779; cv=none; d=google.com; s=arc-20160816; b=GW1dMnp6HjoLEogZekxlAgmYk5DgOWsvGQu6ZCXvJx66oR/U1D4a3X6FnR48q7sk4d AAX+KrQYao7mCHFCUTQKwhEQR/LT6c7tn3yygsMKSajs1ncTpYe51uWUYcTPM8SF6VzW 5wE95HARWLEGtt+ux2l177peFN9C0sMaZUp9gOZwVP+6Lu+lILGf++woherkUnvm2xvd STuBRQ2EpKCzRuCNYtFlkl3zp/zXOCilZQ/N0Tt6rA7dqNQoeWmKrAJqw8dVZUXt9xl0 vcf6LdgffTB4a7GXnpd/si3h6lA1kx6ghg4de3ogaJg67x5hocWj6MFB/hvf0BF9G8+l aiIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=fPBeTrE4mN+w49db5zBAbtE2qcziSmZwH58zw+uB5vQ=; b=rz9HqLEYReFSurqg/6UUmVN8xmG3JaYTvnQvT2LbaWEDgDkYZXwnWIscTivcbOwN2T UkQAsxf1I4SxBbCkdqntdvYf0E7PVgp2JFP4casc8QFczOHnv8UoyqNZkwsHPw2Fkii/ 0HOHrsPk3q3mpZ1A3BX9g+9ndS4OaPLiLTai0mr0PK90Q8tdbVaiR69CaGfNDXVFzWTq MKj6xYl8AbHDCUHtUP3Zgc8IJdTbETr9hi0srE5sHO9ib/BEsh3d8I3mIIpBtoeoO66T yGoB16HmspuV9HLgxoOtYuirQt0aoAN39ffZ3af337pwpLgcwdjKxepnosn/15i83Yyp qjZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ohGQ0pIc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c88si19778944edd.240.2021.08.09.01.45.56; Mon, 09 Aug 2021 01:46:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ohGQ0pIc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234000AbhHIIor (ORCPT + 99 others); Mon, 9 Aug 2021 04:44:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:48428 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233926AbhHIIoq (ORCPT ); Mon, 9 Aug 2021 04:44:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B464A60462; Mon, 9 Aug 2021 08:44:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1628498666; bh=grKMIOHGb1ru2VuvTfMUqYUzzhQ8CKPOf/66tvSq5SE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ohGQ0pIcLDIwANoZV7kjmnxzXBUNFuQw6YcdqMD1JTOKpdiE6h+u0gZ5iu3NX63/T CPB4KgXOi9pLRJOZ+1urLnJehhN9tao6D/3eWOk8UGUXGdioLpf5JzVALc8ziIGs2X aM3cyJpa5ApvCP2z9kjuNxY7spMM/MyhH07XkHb4= Date: Mon, 9 Aug 2021 10:44:23 +0200 From: Greg KH To: Muni Sekhar Cc: Oliver Neukum , kernelnewbies , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: read() via USB bus Message-ID: References: <8923f2b8-0be0-ffbf-70a4-c03c9a02d58a@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8923f2b8-0be0-ffbf-70a4-c03c9a02d58a@suse.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 09, 2021 at 10:15:29AM +0200, Oliver Neukum wrote: > > On 09.08.21 09:58, Muni Sekhar wrote: > > Hi all, > > > > PCIe memory mapped registers can be read via readb(), readw(), readl() > > kernel API's. Similarly what are the kernel API to read the device > > registers via USB bus > > > > Hi, > > I am afraid this is based on a fundamental misunderstanding on how > USB works. It is based on passing messages, not reading and writing > registers. > > USB devices are primarily based on endpoints, not registers. A literal > answer to your question would point you to the clear/set/get_feature > standard requests of chapter 9 of the specification, but that really > will not help you, as you are making assumption that fundamentally > do not apply. > > I hope this list stays friendly to newcomers and we will answer > specific questions, but at this point I must advise you to first > read an introductory book. Along these lines, take a look at the book, Linux Device Drivers, third edition, which is free online, as it has a chapter about USB drivers and how they work. That should help you out to understand the issues involved with USB devices. If you have specific questions after looking at that, and reading the basic usb-skeleton.c driver in the kernel source tree, please let us know! thanks, greg k-h