From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 289ECC4332F for ; Mon, 5 Dec 2022 01:24:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231249AbiLEBYJ (ORCPT ); Sun, 4 Dec 2022 20:24:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231132AbiLEBYI (ORCPT ); Sun, 4 Dec 2022 20:24:08 -0500 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D5FE101CC for ; Sun, 4 Dec 2022 17:24:07 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id 3-20020a17090a098300b00219041dcbe9so9952948pjo.3 for ; Sun, 04 Dec 2022 17:24:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igorinstitute-com.20210112.gappssmtp.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=udJjLFsIsuNM+D3lyGnLy0JwlIO+NVedMCgCplH0XXs=; b=2sodOIYqDSiSgt9c4aOcnZzMycrCLMB+S0oc/UblasgK8rW84vy4R/wwVZEnNlVY93 dVOmV12xvGZ4Oujmwz1r3dUvMOPMVaD0UHuC7nxTuYX1ZsR1ZxnqJL9/U86lKZ3CsYC0 wRRuLNZhYVg+RkW7uXJjyINUWtDmDvcslOU+/WpBe+vPm2tI/jkIT7jDr84wBsQW6PZ/ 577d1OB826wBRXpLZlfIqClwq+/M5pT9pYUA/GGVIdbpLxheD6C67ZXr2wucXtLnWNXx mESa5q578cQ3zESImbIxA0wk1glfr0h4sQZ8FbmVYghHbA94d3IbJjd5o2j6gfbDSPfB NMBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=udJjLFsIsuNM+D3lyGnLy0JwlIO+NVedMCgCplH0XXs=; b=dz/0/j3B1oONkuDJ8ogSmOyKvl0MDxsGAvp1CRuyEHiExj4eNBHvYUufV+IL88ODpd UvtzgQFGaaoeAHcwW7o48CM2n3+krFjCMBowAnsZsBY/cUoqjtuTGRBqddGVf53790mC U/7TvkTzE9HQ34Q6zHxu6mQ1nhnQVSxZ8fW/8DPNMoGS7siGOHd5O/eNaxwraP4jAgKi rRu84xKnDnu64X3WexwraYCugJkEgRPvjkk/dqEaiKE1uqlzMrqOZmAIYkUIsnB39XK+ gVqxy5gpRs77OYyyKTFebSfmHw+LasbkEpGRfw8axKwJ3CLcN5j7+qaA7xuOWzxXfyxS zR1w== X-Gm-Message-State: ANoB5pkqH3fSLN4pg7BHDMsm/Csqh7PYY5tJ1IhL/4WXo6RHCOK2+QIp c2HikqlCYf1ey32gZlsC9yBZxZYPDXtiXHayhLI= X-Google-Smtp-Source: AA0mqf5qIK01sWvLtVrvTGJppmqa9AVW7iYDN5qPvMB9YJRe16Mwf2rVSwykwYB2y8WjCGkUQH5HtQ== X-Received: by 2002:a17:902:8604:b0:186:fe2d:f3cb with SMTP id f4-20020a170902860400b00186fe2df3cbmr66231522plo.132.1670203446986; Sun, 04 Dec 2022 17:24:06 -0800 (PST) Received: from localhost ([121.99.145.49]) by smtp.gmail.com with ESMTPSA id r13-20020aa7962d000000b00576d4d69909sm1481840pfg.8.2022.12.04.17.24.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Dec 2022 17:24:06 -0800 (PST) Date: Mon, 5 Dec 2022 14:24:03 +1300 From: Daniel Beer To: Greg Kroah-Hartman Cc: Jiri Kosina , Benjamin Tissoires , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-i2c@vger.kernel.org, Michael Zaidman , Christina Quast , linux-serial@vger.kernel.org, Jiri Slaby Subject: Re: [PATCH] hid-ft260: add UART support. Message-ID: <20221205012403.GA14904@nyquist.nev> References: <638c51a2.170a0220.3af16.18f8@mx.google.com> <20221204091247.GA11195@nyquist.nev> 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-input@vger.kernel.org On Sun, Dec 04, 2022 at 10:39:21AM +0100, Greg Kroah-Hartman wrote: > > Thanks for reviewing. This device is quite strange -- it presents itself > > as a USB HID, but it provides both an I2C master and a UART. The > > existing driver supports only the I2C functionality currently. > > Lots of devices are a "fake HID" device as other operating systems make > it easy to write userspace drivers that way. Linux included. What > userspace programs are going to want to interact with this device and > what api are they going to use? Hi Greg, The application I'm looking at uses it as a debug console, so personally I'd like to be able to use it with picocom and other terminal programs. > > > > --- a/include/uapi/linux/major.h > > > > +++ b/include/uapi/linux/major.h > > > > @@ -175,4 +175,6 @@ > > > > #define BLOCK_EXT_MAJOR 259 > > > > #define SCSI_OSD_MAJOR 260 /* open-osd's OSD scsi device */ > > > > > > > > +#define FT260_MAJOR 261 > > > > > > A whole new major for just a single tty port? Please no, use dynamic > > > majors if you have to, or better yet, tie into the usb-serial > > > implementation (this is a USB device, right?) and then you don't have to > > > mess with this at all. > > > > As far as I understand it, I don't think usb-serial is usable, due to > > the fact that this is already an HID driver. > > That should not be a restriction at all. You are adding a tty device to > this driver, no reason you can't interact with usb-serial instead. That > way you share the correct userspace tty name and major/minor numbers and > all userspace tools should "just work" as they know that name and how to > interact with it already. > > Try doing that instead of your own "raw" tty device please. Maybe I've misunderstood something. The reason I thought usb-serial was unusable in this instance was that I couldn't see a way to create a port except via usb-serial's own probe function (otherwise, the API looked fine). I don't know whether I'm looking at a serial or an I2C interface until after it's already been probed by HID core, I have a struct hid_device and I've asked what type of interface it is via an HID feature report. This can't be determined otherwise, because strapping pins affect the presentation of interfaces. At that point, I (currently) call uart_add_one_port. I might have missed it, but I didn't see anything analogous in the usb-serial API. Am I going about this the wrong way? Cheers, Daniel -- Daniel Beer Firmware Engineer at Igor Institute daniel.beer@igorinstitute.com or +64-27-420-8101 Offices in Seattle, San Francisco, and Vancouver BC or (206) 494-3312