On Fri, Apr 13, 2018 at 08:43:35AM +0200, Maarten Brock wrote: > On 2018-04-11 12:06, Greg Kroah-Hartman wrote: > > On Wed, Apr 11, 2018 at 11:10:22AM +0200, Uwe Kleine-König wrote: > > > Hello, > > > > > > I have the following setup: > > > > > > - arm/imx6 based machine > > > - null-modem cable between two uart ports (driver: imx.c) > > > - tested with 4.9 and 4.16 > > > > > > To test handshaking signals port A's DTR signal is toggled using > > > TIOCMSET and then port B's DCD and DSR is read to check if the new > > > level > > > is readable there. > > > > > > The problem I'm faced now is that this fails sometimes[1] because > > > when A's > > > DTR is set inactive the level on B's DCD changes (as expected) and the > > > driver calls uart_handle_dcd_change(0) which results in > > > tty_hangup(tty) > > > for B. Then when calling ioctl(fd_B, TIOCMGET, ..) the command is > > > handled in hung_up_tty_ioctl() which returns -EIO. > > > > > > This makes it impossible to reliably get the handshaking state of B > > > and > > > I wonder if that is intended. I would have expected that TIOCMGET > > > worked > > > independent of the port being hung up or not. > > > > From what I recall, after hangup happens, you can't do much with the > > port like this, sorry. > > > > greg k-h > > If the only valid answer you can get from TIOCMGET for DTR is 'DTR is > active' then there is no point in keeping this functionality. I agree with > Uwe that one should be able to poll the state of DTR regardless of its > state. I wasn't entirely sure if gregkh's reply is to interpret as "this is the current state" only or as "this is the right behaviour and should stay as is". Just didn't come around yet to ask that. :-) Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | -- 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