Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp317161pxb; Thu, 12 Nov 2020 04:47:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJyiS8wAD/0aqFKD2tw8u2VE3ZAsHzm0fyGnIhO659vpVZ8y3J5lR3kpfP3raCrB2rrvCgB9 X-Received: by 2002:a17:906:1fc9:: with SMTP id e9mr29161800ejt.319.1605185220859; Thu, 12 Nov 2020 04:47:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605185220; cv=none; d=google.com; s=arc-20160816; b=zcYHSh5IA8IrrUL6mvGQ5Fe15NQvvw///c1VGbQiK7GLEVg+GS5G0afwNVVvA8Gmvf 9b54Yq3i/StAKIE1NuY3Sw0C9r2pPSn8coBDzoKI8YZk5hFKhZTBU+qVhBA725vSJKqp wASu0u/QUDhQSgXbBIiuI07aw6LBfIaxSSmbOnD42ZVy/vKqijhZUZ+jL0LXfSzozlaG VafNjH4TCJVPY1nYzNayV3GdzRQFG1WozTriWhPoc2GRPcVT01yfMOMqaRM2i9Widb42 pkw71KHbN/nKdMkaNmJEjqnwhV5L7ryFxdSlRoK1XptJ9hXyceo7/j1/5VJqfM4TTw2l XNiA== 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=ruZRbhDXZQ+46KkWkicK2s3mxaavQhTywcHLs+mID60=; b=xMOcCQ/XjPr6/hDaDAaueQr+Z8cGvKJsffVu1Rh0ak4+XHfk06ouj+7ejKyaAdhBaL Mv6Up5Zv1hU3pLv+qrqKTQwHpDB9fB01rW+vD3jjjgKAlavt29ayosvEjYKmQzebLmuS N3sadJMme031qfhlmNo9CGH6ZyMb8pHfMZea+jKLJXdH56WyzcQho9s9djTtJBwmSFo4 iEP+ELk1SVCm6KKB9BGTrIM//1uTZue6hz7Bkgh4h0Y6GlWDRtKNm+NJ20LwBpP/EKQc /aQ+IgPxYc824oGFyI4pahJhvOanpSXzTxYlCO8gEKSv+nu/E0SSaN/h4uMMUMECULAr BX3g== 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 g12si3970280edn.285.2020.11.12.04.46.37; Thu, 12 Nov 2020 04:47:00 -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 S1728069AbgKLMnu (ORCPT + 99 others); Thu, 12 Nov 2020 07:43:50 -0500 Received: from mga04.intel.com ([192.55.52.120]:60504 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727646AbgKLMnu (ORCPT ); Thu, 12 Nov 2020 07:43:50 -0500 IronPort-SDR: otbR1JLwLu1RBxt6bzxquAa1N3WDBUkrkQLoC7YsQkjB5q1cpoqinH1jMkBAwv857eZKizHW2j 2geA9X9OjzVw== X-IronPort-AV: E=McAfee;i="6000,8403,9802"; a="167717469" X-IronPort-AV: E=Sophos;i="5.77,472,1596524400"; d="scan'208";a="167717469" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Nov 2020 04:43:48 -0800 IronPort-SDR: fsFIy+cgjj5mCIALl4pFdwQtH9jpbeYRKJ+LkG20X3MmxlB61B5wkqSOhDDYdp7CfF7ZMlVneK 4/3UU/iW/AwA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,472,1596524400"; d="scan'208";a="429188768" Received: from kuha.fi.intel.com ([10.237.72.162]) by fmsmga001.fm.intel.com with SMTP; 12 Nov 2020 04:43:46 -0800 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Thu, 12 Nov 2020 14:43:45 +0200 Date: Thu, 12 Nov 2020 14:43:45 +0200 From: Heikki Krogerus To: Prashant Malani Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, gregkh@linuxfoundation.org, Benson Leung Subject: Re: [PATCH v3 2/2] usb: typec: Expose Product Type VDOs via sysfs Message-ID: <20201112124345.GS1224435@kuha.fi.intel.com> References: <20201023214328.1262883-1-pmalani@chromium.org> <20201023214328.1262883-2-pmalani@chromium.org> <20201110115453.GI1224435@kuha.fi.intel.com> <20201112024055.GA1367855@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201112024055.GA1367855@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 11, 2020 at 06:40:55PM -0800, Prashant Malani wrote: > Hi Heikki, > > On Tue, Nov 10, 2020 at 01:54:53PM +0200, Heikki Krogerus wrote: > > On Fri, Oct 23, 2020 at 02:43:28PM -0700, Prashant Malani 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. > > OOI: I'd like to understand the reservations around this approach. Can't > userspace just read these and then interpret them appropriately according > to the id_header as well as PD revision (and version number) if that's exposed? > The only thing I see changing is how we name those product_type_vdoX > sysfs files, i.e product_type_vdo0 == passive_cable_vdo OR active_cable_vdo1 > depending on the product type. > > That said, perhaps I'm missing some aspect of this. I don't think the userspace should have to interpret any of these VDOs. If the userspace has to interpret the information, then the userspace should interpret everything for the sake of consistency (so the "raw" attribute file). But I still think that defining separate device types for every product type would be the best way to handle the identity. We could then have sysfs attribute files that are specific for each product type. It does not even matter that some of the product types are going to be removed. We will have to handle all of them in any case, including the ones that were removed. This way things would be much more clear for the userspace. The only problem IMO with the separate device types for each product type is that we don't always have access to the Discover Identity result. It means depending on your system we will claim the partner device type is "default" (no identity information) or the actual product type. That is also a bit inconsistent, but is is acceptable? I would really like to here what Greg thinks about all this. > > 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(). > > FWIW, "raw" option SGTM (the product type VDOs can be parsed from the > buffer since the format is fixed). Well, I'm starting to think that what if we just prepare patches where we propose separate device type for every product type? Of course, if they are OK to you? thanks, -- heikki