Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754687AbdFNI1b (ORCPT ); Wed, 14 Jun 2017 04:27:31 -0400 Received: from mail-yw0-f196.google.com ([209.85.161.196]:33305 "EHLO mail-yw0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754397AbdFNI12 (ORCPT ); Wed, 14 Jun 2017 04:27:28 -0400 MIME-Version: 1.0 In-Reply-To: References: <1497336734-19368-1-git-send-email-tal.shorer@gmail.com> <1497336734-19368-2-git-send-email-tal.shorer@gmail.com> <20170614021505.5a915c2b@alans-desktop> From: Tal Shorer Date: Wed, 14 Jun 2017 11:27:27 +0300 Message-ID: Subject: Re: [PATCH v2 1/8] tty: add a poll() callback in struct tty_operations To: Alan Cox Cc: linux-doc@vger.kernel.org, "" , USB list , "" , Felipe Balbi , Jonathan Corbet Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1790 Lines: 32 On Wed, Jun 14, 2017 at 11:20 AM, Tal Shorer wrote: > On Wed, Jun 14, 2017 at 4:15 AM, Alan Cox wrote: >> On Tue, 13 Jun 2017 09:52:07 +0300 >> Tal Shorer wrote: >> >>> If a tty driver wants to notify the user of some exceptional event, >>> such as a usb cdc acm device set_line_coding event, it needs a way to >>> modify the mask returned by poll() and possible also add wait queues. >>> In order to do that, we allow the driver to supply a poll() callback >>> of its own, which will be called in n_tty_poll(). >>> >>> Signed-off-by: Tal Shorer >> >> You might be in any line discipline so you need to support that for each >> ldisc that supports poll(). Also what do I do when I get an exception >> event - what does it mean, how do I understand that, are you proposing a >> standardized meaning ? Have you checked whether that conflicts with SuS >> v3 or POSIX ? What will it do with existing code. >> >> At the very least it probably has to be something you turn on, and you >> might then want to model it on the pty/tty interface logic and extend >> TIOCPKT a shade. > That would cut it, but TIOCPKT is too coupled with having a linked tty. > I could make acm behave like a pty (accept TIOCPKT and issue the > ctrl_status bits), but for that I need n_tty to know that packet does > not always mean a linked tty is present, and that in case it isn't we > take our own ctrl_status bits instead of the link's. I could write a > small (inline?) function to fetch the correct ctrl_status bits and put > that in n_tty. Does that make sense? Or (maybe) better yet, I can do a hack and have the acm tty point to itself as the link, which means n_tty doesn't have to change at all. Any thoughts?