On Sat, May 26, 2018 at 04:50:46PM +0200, Jacek Anaszewski wrote: > On 05/22/2018 11:03 AM, Johan Hovold wrote: > > On Wed, May 16, 2018 at 11:12:53PM +0200, Jacek Anaszewski wrote: > > > On 05/16/2018 09:11 AM, Johan Hovold wrote: > > > > On Mon, May 14, 2018 at 09:50:20PM +0200, Jacek Anaszewski wrote: > > > > > > > > > There is no ready solution for tty, but it can be implemented with > > > > > not so big effort. I don't know what exactly Pavel had on mind, > > > > > but I myself see now, that the better approach would be a new > > > > > ledtrig-ttydev driver, that would expose three sysfs files: tty_id, > > > > > rx, tx. It would also expose the API like e.g.: > > > > > > > > > > ttydev_trig_notify(int tty_id, bool rx) > > > > > > > > There is no unique integer tty_id; consider ttyS0 and ttyUSB0 for > > > > example. So this would not work as it stands. > > > > > > Ah right, so maybe the string with tty suffix, e.g. "0", "1", > > > "S0", "S1", "USB0", "USB1". We could go also for an enum > > > representing tty kind, however I'm not aware if there is > > > a fixed set of tty kinds. > > > > You need to use the full device name if you want something unique as tty > > devices are not even required to use the common tty-prefix (e.g. consider > > gsmtty0). > > In this case we would need the following API: > > ttydev_trig_notify(const char *tty_devname) > > As an alternative a chain notifier could be used similarly > as in case of ledtrig-netdev.c. If tty subsystem doesn't have > one, then maybe it would be worthwhile to implement it. Ugh, I hate notifier chains, they are ripe for abuse and should be avoided where ever possible as it's really hard to always know exactly what is going to happen on them. So please no, if at all possible, do not add such a thing to the tty layer. thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html