def __init__(self, device, timeout=1, debug=False):
        """
        Open YHSM device.
        """
        self.debug = debug
        self.device = device
        self.num_read_bytes = 0
        self.num_write_bytes = 0
        self.ser = None # to not bomb in destructor on open fail
        self.ser = serial.serial_for_url(device)
        self.ser.baudrate = 115200
        self.ser.timeout = timeout
        if self.debug:
            sys.stderr.write("%s: OPEN %s\n" %(
                    self.__class__.__name__,
                    self.ser
                    ))
        return None
def __init__ ( self , device , timeout = 1 , debug = False ) : self . debug = debug self . device = device self . num_read_bytes = 0 self . num_write_bytes = 0 self . ser = None self . ser = serial . serial_for_url ( device ) self . ser . baudrate = 115200 self . ser . timeout = timeout if self . debug : sys . stderr . write ( "%s: OPEN %s\n" % ( self . __class__ . __name__ , self . ser ) ) return None
Open YHSM device.