diff options
author | zsquareplusc <cliechti@gmx.net> | 2019-02-08 01:17:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-08 01:17:49 +0100 |
commit | 86ae7f9323be04b2950e64f463c470ebd3443641 (patch) | |
tree | 0c074610ab8c0ffb44bf7d0e67ea8dc80c47391c | |
parent | a27715f322bb08b1fccffebab776c94df50057e9 (diff) | |
parent | 029b111cabdf5d3a0f270846d8324077173efd4e (diff) | |
download | pyserial-git-86ae7f9323be04b2950e64f463c470ebd3443641.tar.gz |
Merge pull request #400 from smeng9/master
Add bytesize and stopbits argument parser to tcp_serial_redirect
-rwxr-xr-x | examples/tcp_serial_redirect.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/examples/tcp_serial_redirect.py b/examples/tcp_serial_redirect.py index 53dc0ad..ae7fe2d 100755 --- a/examples/tcp_serial_redirect.py +++ b/examples/tcp_serial_redirect.py @@ -66,6 +66,13 @@ it waits for the next connect. group = parser.add_argument_group('serial port') group.add_argument( + "--bytesize", + choices=[5, 6, 7, 8], + type=int, + help="set bytesize, one of {5 6 7 8}, default: 8", + default=8) + + group.add_argument( "--parity", choices=['N', 'E', 'O', 'S', 'M'], type=lambda c: c.upper(), @@ -73,6 +80,13 @@ it waits for the next connect. default='N') group.add_argument( + "--stopbits", + choices=[1, 1.5, 2], + type=float, + help="set stopbits, one of {1 1.5 2}, default: 1", + default=1) + + group.add_argument( '--rtscts', action='store_true', help='enable RTS/CTS flow control (default off)', @@ -117,7 +131,9 @@ it waits for the next connect. # connect to serial port ser = serial.serial_for_url(args.SERIALPORT, do_not_open=True) ser.baudrate = args.BAUDRATE + ser.bytesize = args.bytesize ser.parity = args.parity + ser.stopbits = args.stopbits ser.rtscts = args.rtscts ser.xonxoff = args.xonxoff |