Example #1
0
#!/usr/bin/python3
import termioschk
import termios


class basehandler:
    def op(self, io1, io2):
        return termioschk.dup_base_termios()


termioschk.test_ser2net_termios(
    "base termios settings", basehandler(),
    ("connection: &con", "  accepter: telnet,tcp,3023",
     "  connector: serialdev,/dev/ttyPipeA0", "  options:",
     "    banner: 12345"), "telnet,tcp,localhost,3023",
    "serialdev,/dev/ttyPipeB0,9600N81")


class cs5handler:
    def op(self, io1, io2):
        return termioschk.dup_base_termios(cflags=termios.CS5,
                                           cflags_mask=termios.CSIZE)


termioschk.test_ser2net_termios(
    "cs5 termios settings", cs5handler(),
    ("connection: &con", "  accepter: telnet,tcp,3023",
     "  connector: serialdev,/dev/ttyPipeA0,9600n51", "  options:",
     "    banner: 12345"), "telnet,tcp,localhost,3023",
    "serialdev,/dev/ttyPipeB0,9600N81")
Example #2
0
import termioschk
import termios
import time
import gensio
import utils
from serialsim import *


class basehandler:
    def op(self, io1, io2):
        return termioschk.dup_base_termios()


termioschk.test_ser2net_termios(
    "base rfc2217", basehandler(),
    ("connection: &con", "  accepter: telnet,tcp,3023",
     "  connector: serialdev,/dev/ttyPipeA0", "  options:",
     "    banner: 12345"), "telnet,tcp,localhost,3023",
    "serialdev,/dev/ttyPipeB0,9600N81")


class cshandler:
    def __init__(self, cs, bits):
        self.cs = cs
        self.bits = bits
        return

    def op(self, io1, io2):
        sio1 = io1.cast_to_sergensio()
        bits = sio1.sg_datasize_s(self.bits)
        if (bits != self.bits):
            raise Exception("Bit value was not set, set to %d, got %d" %
Example #3
0
#!/usr/bin/python
import termioschk
import termios


class basehandler:
    def op(self, io1, io2):
        return termioschk.dup_base_termios()


termioschk.test_ser2net_termios(
    "base termios settings", basehandler(),
    "BANNER:b:12345\n    3023:telnet:100:/dev/ttyPipeA0:b\n",
    "telnet,tcp,localhost,3023", "serialdev,/dev/ttyPipeB0,9600N81")


class cs5handler:
    def op(self, io1, io2):
        return termioschk.dup_base_termios(cflags=termios.CS5,
                                           cflags_mask=termios.CSIZE)


termioschk.test_ser2net_termios(
    "cs5 termios settings", cs5handler(),
    "BANNER:b:12345\n    3023:telnet:100:/dev/ttyPipeA0:b 9600N51\n",
    "telnet,tcp,localhost,3023", "serialdev,/dev/ttyPipeB0,9600N81")


class cs6handler:
    def op(self, io1, io2):
        return termioschk.dup_base_termios(cflags=termios.CS6,
Example #4
0
#!/usr/bin/python
import termioschk
import termios
import time
import genio
import utils


class basehandler:
    def op(self, io1, io2):
        return termioschk.dup_base_termios()


termioschk.test_ser2net_termios(
    "base rfc2217", basehandler(),
    "BANNER:b:12345\n    3023:telnet:100:/dev/ttyPipeA0:b remctl\n",
    "telnet,tcp,localhost,3023", "termios,/dev/ttyPipeB0,9600N81")


class cshandler:
    def __init__(self, cs, bits):
        self.cs = cs
        self.bits = bits
        return

    def op(self, io1, io2):
        sio1 = io1.cast_to_sergenio()
        bits = sio1.sg_datasize_s(self.bits)
        if (bits != self.bits):
            raise Exception("Bit value was not set, set to %d, got %d" %
                            (self.bits, bits))