Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp208485pxb; Wed, 11 Nov 2020 01:23:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJwhXWv9lTXN5QjRyXxgZMvwYKHUwnG+byn/rg32pKShQqg48vArbH/FIbLPeke5YON6YVhx X-Received: by 2002:a17:906:1e45:: with SMTP id i5mr23762016ejj.203.1605086612630; Wed, 11 Nov 2020 01:23:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605086612; cv=none; d=google.com; s=arc-20160816; b=riEdd0rqmIQfB8STVy7fb6EN+pXB9y0wlADW78/IvNKB7MvQ75Aw/WC0yY5xhej1MG otinxjJX3LiJbg/8hDR5tOWqdhhcI0AVZQ4JgCcaWD5f1vmoiV/lSxfuLiZ9lKDil0ZK s3LoaoeLP+VGJsSK0pM5EP4wAK3QA5oinTVmb/Rk812FhHzNVqb9ZpjPjh0+E1HHEpdy Vm3PxmLsxfANxHoqDdP4cU1ToGBVnySp95bMfM/t11GxGE8hse/KekaROJ4JCM3wmOfu IbghYKTPXYcZaW8HAYlgRhLjyG7vxd+EPZelCRgSThY8/NzDW4Ky/HVX0eIzUwGs4kRg g+ng== 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:ironport-sdr :ironport-sdr; bh=HZ7paVmWm03few+YYAIIhcTwovot0b7l5hk6sO0B0ns=; b=o1f/JpBIVDI9CMEIWTtO6SmO5Nrz7Ow7T8m0pJJC0hTg5tngvRBBf0Alejb+GYX+hW vPlooL8jLquX+d0vzjx0QsjZEcQJJEA8QMTr5xCl8Uq18gRZ6K/Xt7rAxjiRGp7wJnBm SJ0Fqpar0NgKGC7t81pV2EGiPBvU2wUeIajQx+XeeA2Q00c5mjlqx4hb0egdD5TTI81Q 8lw/G7SvErvFMiv8FaKDHmHakFtxHIky42cP4AdzhYqsYz4EZ1X5Pnv63bZUIaOAOOae M2wh8L5W7DP2Hq08Je3Nu0hqYJivRIyAHakqYHl97I00ZVsorqMBRxjJb/phaVZFjAkb WHXQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z8si1148626edp.59.2020.11.11.01.23.06; Wed, 11 Nov 2020 01:23:32 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726575AbgKKJVb (ORCPT + 99 others); Wed, 11 Nov 2020 04:21:31 -0500 Received: from mga02.intel.com ([134.134.136.20]:44180 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726216AbgKKJVb (ORCPT ); Wed, 11 Nov 2020 04:21:31 -0500 IronPort-SDR: KYZKcO6pmpoYZGaUaDLjBVO71Gimqyk/0MWnR9pDXuh7i0d2mSbeFGbAoptl2ml2iYvRLjGH4x ID42EaIlIR2g== X-IronPort-AV: E=McAfee;i="6000,8403,9801"; a="157129497" X-IronPort-AV: E=Sophos;i="5.77,469,1596524400"; d="scan'208";a="157129497" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2020 01:21:24 -0800 IronPort-SDR: pV8MvkyFMwZdIn4NyFLcxNJwScFDgOhxUOJHLLolqmBxb8azAk54Ms1+UlYy0vrp9QQcLJOk+p JtRYN7hpaX2Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,469,1596524400"; d="scan'208";a="428688764" Received: from kuha.fi.intel.com ([10.237.72.162]) by fmsmga001.fm.intel.com with SMTP; 11 Nov 2020 01:21:21 -0800 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Wed, 11 Nov 2020 11:21:20 +0200 Date: Wed, 11 Nov 2020 11:21:20 +0200 From: Heikki Krogerus To: Greg KH Cc: Prashant Malani , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Benson Leung Subject: Re: [PATCH v3 2/2] usb: typec: Expose Product Type VDOs via sysfs Message-ID: <20201111092120.GO1224435@kuha.fi.intel.com> References: <20201023214328.1262883-1-pmalani@chromium.org> <20201023214328.1262883-2-pmalani@chromium.org> <20201110115453.GI1224435@kuha.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg, On Tue, Nov 10, 2020 at 01:22:06PM +0100, Greg KH wrote: > > I've now come to the conclusion that this is not the correct approach. > > Instead, the whole identity, all six VDOs, should be supplied > > separately with a "raw" sysfs attribute file after all. > > > > The three attribute files that we already have - so id_header, > > cert_stat and product - can always supply the actual VDO as is, > > regardless of the product type, so they are fine. But these new > > attribute files, product_type_vdoX, would behave differently as they > > supply different information depending on the product type. That just > > does not feel right to me. > > > > So lets just add the "raw" sysfs attribute file. We can think about > > extracting some other details from the product type VDOs once the > > specification has settled down a bit and we can be quite certain that > > those details will always be available. > > > > Would this be OK to you? I think we should be able to dump the data to > > the "raw" sysfs attribute file with something like hex_dump_to_buffer(). > > Does this mean that the value of the attributes depends on something > external to the device? If so, how is userspace going to know how to > parse this any differently than the kernel could today? > > And I say this as the maintainer of 'lsusb' which probably should start > getting support for the typec attributes that are being exposed here :) OK, this is great! I really want you opinion on this. Let me try to explain the situation. So USB Power Delivery specification defines a set of these product types, as I'm sure you already know. You have your hub, alternate mode adapter, and so on. Then there are also a couple of cable types. Originally I though that a product type simply equals a device type (and that still feels correct to me). Each product type can have its own "ABI" in form of the attribute files, that really should not be a problem, right? The problem with that was that we do not always know the product type. For example UCSI does not supply the operating system the response to the Discover Identity request from the partner device that contains this information. It would mean that depending on your system, we will claim that, let's say a hub really is a hub, or just some kind of a default partner device. There was discussion about this back in the day on this mailing list, and it was considered to be at least a little bit confusing for the user. In the end I did not propose the separate device types for each USB PD product type (yet). Instead we only expose the header part of the response to the Discover Identity (when we have it) because that part is the same for all product types. So basically we have just the "default" partner device type for everything for now. But since now we clearly need all the identity details, not just the header, it's good to talk about this again. Maybe even the "raw" attribute file is not that useful in the end, and we really should finally introduce the separate device types for each product types? Or maybe there is a third option that I have not even thought of? thanks, -- heikki