Using: Knoppix 6.2 distro LXterminal 0.1.6 also repeatable with /dev/tty1 and /dev/tty2 Linux Kernel 2.6.32.6
I'm attempting to use an rs232 serial port to control a device that uses [CR] character as the command terminator. I attempt to use stty to configure the port /dev/ttyUSB0 which is an Easy Sync US232R-10 that works well with other programs. The command is formatted as follows: (Parentheses indicate comments and actions below) stty -F /dev/ttyUSB0 -clocal cs8 -hup -parenb -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel opost -isig -icanon -xcase -echo -echoe -echoctl -echoke -crtscts -onlcr onlret -onocr min 1 time 0 115200 (Using two terminals /dev/tty1 and /dev/tty2 and rs232 serial port /dev/ttyUSB0:) (On tty2 enter:) stty -F /dev/ttyUSB0 -clocal cs8 -hup -parenb -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel opost -isig -icanon -xcase -echo -echoe -echoctl -echoke -crtscts -onlcr onlret -onocr min 1 time 0 115200 (then:) cat /dev/ttyUSB0 (then watch the output) (On tty1 enter:) cat /dev/tty1 > /dev/ttyUSB0 (V tells the device to reply with its version number in this case ) V(Pressed Enter Key) (no response was seen on /dev/tty2 with ferther analysis I discovered [LF] character was being transmitted as the line terminator instead of [CR] that was expected) !!! To duplicate this issue for testing make a simple loop back rs232 connector with no need for flow control since I turn it off. In my case since I have a 9 pin type, I just connect a jumper from pin 2 to pin 3. (again Parentheses indicate comments and actions below )!!! (Using two terminals /dev/tty1 and /dev/tty2 and rs232 serial port /dev/ttyUSB0:) (On tty2 enter:) stty -F /dev/ttyUSB0 -clocal cs8 -hup -parenb -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel opost -isig -icanon -xcase -echo -echoe -echoctl -echoke -crtscts -onlcr onlret -onocr min 1 time 0 115200 (then:) cat /dev/ttyUSB0 (then watch the output) (On tty1 enter:) cat /dev/tty1 > /dev/ttyUSB0 (V tells the device to reply with its version number in this case ) V(Pressed Enter Key) (On /dev/tty2 V[LF] can be observed instead of V[CR] which was expected) since [LF] and [CR] characters are not immediately visible you can tell the difference by noting the following. For V[LF]:(two lines with cursor on the next line) V _ For V[CR]:(one line with the cursor on the V) V I made sure "opost" was not negated and used the "onlret" option which is what I believe does not work. In another trial I used the "onlcr" option with "onlret" negated. [cr][nl] was transmitted as the terminator. But this only makes my device respond to the first command since it considers the [LF] character in the buffer as the beginning of the next command. Be careful to make sure the "inlcr" option is not set since it only changes the input and would not help the serial device in anyway. I'll find a work around for my immediate needs but I would like to see this fixed if possible. Thanks, Kevin Van Sickle Continental Automotive Systems Test Engineering Sensorics Business Unit
