Re: pl2303.c and the pin status

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

 



Here is a rundown of were we are:

We have 2 distinct issues:
1. The inability to read the "control lines" status without altering the status of DTR/RTS 2. The simplification of working with the "control lines" from shell scripts.


We have 3 ways to resolve this:
1. Add a new parameter to the open() call so you can open the device file like:
     fd = open(comPort,O_NO_ALTER_DTR_RTS)

Pros: Would open access to elaborate programs written in C
Cons: When I read http://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html its seems that playing with the open() system call may be off limits. There is an options called "O_TTY_INIT" but its seems unused.
Cons: Would not really simplify working with scripts.

2.  Add a single file in sysfs something like:
   /sys/class/tty/ttyUSB0/device/TIOCM

Pros: Access to everything with a single read from a shell script.
Cons: The script would needs to parse out the individual bits. You would also need to read the state of DTR/RTS before you can write a new value to /sys/class/tty/ttyUSB0/device/TIOCM if you want to change only one of the two. Actually this is currently the case with TIOCMGET and TIOCMSET.

3. Add multiple files to sysfs something 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)

Pros: Very easy to script. Ability to set DTR directly without any prior read.
Cons: Could have race conditions when needing to read multiple pins.


At this point we need some heavy hitters like Greg to let us know what they think.

Gérald

--
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