Esempio n. 1
0
 def close(self):  # SYNC
     """
     Power down modem
     """
     # call default implementation (closing all channels)
     AbstractModem.close(self)
     writeToFile(THINKPAD_POWER_PATH, "0")
Esempio n. 2
0
 def open(self, on_ok, on_error):
     """
     Power on modem
     """
     writeToFile(THINKPAD_POWER_PATH, "1")
     # call default implementation (open all channels)
     AbstractModem.open(self, on_ok, on_error)
Esempio n. 3
0
 def _modemOn(self):
     """
     Lowlevel initialize this modem.
     """
     logger.debug("reset-cycling modem")
     writeToFile(MODEM_SYSFS_POWER_PATH, "0\n")
     sleep(1)
     writeToFile(MODEM_SYSFS_POWER_PATH, "1\n")
     sleep(1)
     logger.debug("reset cycle complete")
     sleep(2)
     # FIXME open device node and listen for \r\n^SYSSTART\r\n
     return True
Esempio n. 4
0
    def _modemOn(self):
        """
        Lowlevel initialize this modem.
        """
        logger.debug("reset-cycling modem")
        writeToFile(SYSFS_CALYPSO_POWER_PATH, "0\n")
        sleep(1)
        writeToFile(SYSFS_CALYPSO_RESET_PATH, "0\n")
        sleep(1)
        writeToFile(SYSFS_CALYPSO_POWER_PATH, "1\n")
        sleep(1)
        writeToFile(SYSFS_CALYPSO_RESET_PATH, "1\n")
        sleep(1)
        writeToFile(SYSFS_CALYPSO_RESET_PATH, "0\n")
        sleep(1)
        logger.debug("reset cycle complete")

        device = serial.Serial()
        device.port = DEVICE_CALYPSO_PATH
        device.baudrate = 115200
        device.rtscts = True
        device.xonxoff = False
        device.bytesize = serial.EIGHTBITS
        device.parity = serial.PARITY_NONE
        device.stopbits = serial.STOPBITS_ONE
        device.timeout = 1
        logger.debug("opening port now")
        device.open()
        device.write("\0xf9\0xf9")
        device.flush()
        sleep(0.2)
        device.write("\0x7E\0x03\0xEF\0xC3\0x01\0x70\0x7E")
        device.flush()
        sleep(0.2)
        device.write("\r\nAT\r\n")
        device.flush()
        result = device.read(64)
        logger.debug("got %s", repr(result))
        ok = False
        for retries in xrange(5):
            logger.debug("port open, sending ATE0")
            device.write("ATE0\r\n")
            device.flush()
            result = device.read(64)
            logger.debug("got %s", repr(result))
            if "OK" in result:
                ok = True
                break
        device.close()
        return ok
Esempio n. 5
0
 def _modemOff(self):
     device = serial.Serial()
     device.port = DEVICE_CALYPSO_PATH
     device.baudrate = 115200
     device.rtscts = True
     device.xonxoff = False
     device.bytesize = serial.EIGHTBITS
     device.parity = serial.PARITY_NONE
     device.stopbits = serial.STOPBITS_ONE
     device.timeout = 1
     logger.debug("opening port now")
     device.open()
     device.write("\0xf9\0xf9")
     device.flush()
     sleep(0.2)
     device.write("\0x7E\0x03\0xEF\0xC3\0x01\0x70\0x7E")
     device.flush()
     sleep(0.2)
     device.write("\r\nAT@POFF\r\n")
     device.flush()
     sleep(0.2)
     writeToFile(SYSFS_CALYPSO_POWER_PATH, "0\n")
Esempio n. 6
0
 def _modemOff(self):
     """
     Lowlevel deinitialize this modem.
     """
     writeToFile(MODEM_SYSFS_POWER_PATH, "0\n")
Esempio n. 7
0
 def recoverFromSuspend(self, ok_callback, error_callback):
     writeToFile(SYSFS_CALYPSO_FLOW_CONTROL_PATH, "0")
     AbstractModem.recoverFromSuspend(self, ok_callback, error_callback)
Esempio n. 8
0
 def post_ok(ok_callback=ok_callback):
     writeToFile(SYSFS_CALYPSO_FLOW_CONTROL_PATH, "1")
     ok_callback()