Re: pl2303.c and the pin status

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 21 Mar 2012, Greg KH wrote:

> On Wed, Mar 21, 2012 at 02:47:56PM -0400, Gerald Villemure wrote:
> > Currently if we want to read the status of the PINs on a serial
> > port, I need to open the file (e.g. /dev/ttyUSB0) unfortunately in
> > doing so we *change* RTS/DTR
> 
> Hm, just opening the port shouldn't change the line settings.  Is this
> unique to the pl2303 driver, or does it also happen on a "normal" serial
> port as well?
> 
> > How difficult would it be to extent the usb_serial driver to expose
> > the pin status like this:
> > 
> > /sys/class/tty/ttyUSB0/device/RTS (rw, Request To Send)
> > /sys/class/tty/ttyUSB0/device/CTS (r,  Clear To Send)
> > /sys/class/tty/ttyUSB0/device/DSR (r,  Data Set Ready)
> > /sys/class/tty/ttyUSB0/device/DCD (r,  Data Carrier Detect)
> > /sys/class/tty/ttyUSB0/device/DTR (rw, Data Terminal Ready)
> > /sys/class/tty/ttyUSB0/device/RI  (r,  Ring Indicator)
> > 
> > We could then simply read the file /sys/class/tty/ttyUSB0/device/DCD
> > and get a 1 if it is high.
> 
> That would imply that at all times, even if the port is not open, the
> driver needs to be watching the line settings of the device?  For usb to
> serial devices, this can take a lot of USB traffic to do so, and might
> make people who care about power usage unhappy.
> 
> Or we could just do the querying of the device if the sysfs file is
> open...
> 
> > We could also control RTS/DTS by using something like:
> > echo 1 > /sys/class/tty/ttyUSB0/device/DTR
> > 
> > I realize that if we LIMIT our usage of the serial port to ONLY
> > serial communication then there is not value is this extension.  But
> > the moment you start using it to drive DIY electronics it would be a
> > VERY welcomed addition.
> 
> There is the POSIX interface for serial ports, which we can't ignore, so
> we need to keep that.  But, to extend this to all serial ports, not just
> USB ones, might be nice for some users.
> 
> So, care to work on a patch to the tty core that implements this to see
> if it's even viable?  :)

Alternatively, why not write a program that opens the serial port and
provides an easy interface for reading and writing the values of the
line settings (or are these the modem settings? -- I never can remember
which are which).

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux