示例#1
0
class CLevelVoltagePowerSupply(ALevelVoltage):
    def __init__(self, level, voltage):
        ALevelVoltage.__init__(self, level, voltage)
        from power_supply import get_power_supply_obj
        from power import get_power_obj
        from usb_cut import USBCut
        self.usbcut = USBCut()
        self.power_supply = get_power_supply_obj()
        self.power = get_power_obj()

    def make_level_voltage(self):
        self.power.power_off()
        time.sleep(10)
        self.usbcut.usb_disconnect()
        time.sleep(5)
        self.power_supply.set_power_supply_output(0)
        time.sleep(5)
        self.power_supply.set_power_supply_voltage(self.voltage)
        time.sleep(5)
        self.power_supply.set_power_supply_output(1)
        time.sleep(5)
        self.usbcut.usb_connect()
        time.sleep(30)
        self.power.boot_up_device()
        self.power.adb_root()
示例#2
0
 def __init__(self, level, voltage):
     ALevelVoltage.__init__(self, level, voltage)
     from power_supply import get_power_supply_obj
     from power import get_power_obj
     from usb_cut import USBCut
     self.usbcut = USBCut()
     self.power_supply = get_power_supply_obj()
     self.power = get_power_obj()
示例#3
0
 def capture_screen_not_charging(self, screenshot):
     script_name = "capture_screen.sh"
     script_path = os.path.join(os.path.dirname(__file__), "device_scripts",
                                script_name)
     exec_dir = "/mnt/sdcard/"
     screenshot_on_device = "/mnt/sdcard/screenshot.png"
     np = NohupProcess(self.testDevice, script_path, exec_dir,
                       "5 %s" % screenshot_on_device)
     np.start()
     USBCut().cut(10)
     cmd = "pull %s %s" % (screenshot_on_device, screenshot)
     self.testDevice.adb_cmd_common(cmd)
示例#4
0
class CS0ixNormal(AS0ix):

    IDLE_SCREEN_OFF = 1
    #CHECK_WAKE = 2
    RESUME_BY_POWER = 4
    #RESUME_BY_CHARGER = 8

    def __init__(self, serial = None):
        AS0ix.__init__(self, serial)
        self.conf_name = "normal"
        self.retry = 1
        from usb_cut import USBCut
        self.usbcut = USBCut()

    def reconnect_usb(self):
        self.usbcut.connect_usb_retry()

    def sleep(self, sleep_time, flags = 0):
        if flags & CS0ixNormal.IDLE_SCREEN_OFF == 0:
            self.set_screen_status("off")
            time.sleep(2)
        self.relay08.usb_disconnect()
        print "[Info]--- Sleep %ss" % sleep_time
        time.sleep(sleep_time)
        # check screen on event from log
        if flags & CS0ixNormal.RESUME_BY_POWER:
            self.relay08.press_power_key(1)
            time.sleep(20)
        self.usbcut.connect_usb_retry()
        self.set_screen_status("on")
        self.unlock_screen()

    def suspend_resume_special(self, sleep_time = None, sleep_flags = 0):
        if not sleep_time:
            sleep_time = self.get_sleep_time_from_conf()
        pre = self.get_suspend_stat()
        self.sleep(sleep_time, sleep_flags)
        post = self.get_suspend_stat()
        return post - pre
示例#5
0
 def get_actual_backlight_battery_saver(self):
     from settings import BatterySaverSetting
     script_name = "battery_saver.sh"
     script_path = os.path.join(os.path.dirname(__file__), "device_scripts",
                                script_name)
     exec_dir = "/mnt/sdcard/"
     BatterySaverSetting().launch()
     bounds = self.d(className="android.widget.Switch").bounds
     x = (bounds["left"] + bounds["right"]) / 2
     y = (bounds["top"] + bounds["bottom"]) / 2
     display_info_txt = "/mnt/sdcard/display.txt"
     string_args = "5 %s %s %s" % (x, y, display_info_txt)
     np = NohupProcess(self.testDevice, script_path, exec_dir, string_args)
     np.start()
     USBCut().cut(10)
     cmd = "cat %s | grep mActualBacklight=" % display_info_txt
     msg = self.testDevice.adb_cmd_capture_msg(cmd)
     backlight = msg.split("=")[1]
     print "[info]--- actual backlight:", backlight
     return int(backlight)
示例#6
0
 def capture_uidump_with_charging(self, uidump_file, charger_type=None):
     from constants_def import CDP, DCP
     script_name = "dump_ui.sh"
     script_path = os.path.join(os.path.dirname(__file__), "device_scripts",
                                script_name)
     exec_dir = "/mnt/sdcard/"
     uidump_on_device = "/mnt/sdcard/uidump.xml"
     np = NohupProcess(self.testDevice, script_path, exec_dir,
                       "6 %s" % uidump_on_device)
     np.start()
     if charger_type == None:
         USBCut().cut(10)
     elif charger_type in [CDP, DCP]:
         if charger_type == CDP:
             self.enable_cdp_charging(1, 0)
         else:
             self.enable_dcp_charging(1, 0)
         time.sleep(10)
         self.three_way_cutter_reconnect_sdp(3, 2, 5)
     cmd = "pull %s %s" % (uidump_on_device, uidump_file)
     self.testDevice.adb_cmd_common(cmd)
示例#7
0
class CUSBCharger(ACharger):

    def __init__(self, config):
        ACharger.__init__(self, config)
        from usb_cut import USBCut
        self.charger = USBCut()
        self.config = config

    def charge(self, charger_unit):
        self.charger.usb_disconnect()
        time.sleep(charger_unit[1])
        self.charger.usb_connect()
        time.sleep(charger_unit[2])

    def reconnect_usb(self):
        self.charger.connect_usb_retry()
示例#8
0
 def __init__(self, serial = None):
     AS0ix.__init__(self, serial)
     self.conf_name = "normal"
     self.retry = 1
     from usb_cut import USBCut
     self.usbcut = USBCut()
示例#9
0
 def __init__(self, config):
     ACharger.__init__(self, config)
     from usb_cut import USBCut
     self.charger = USBCut()
     self.config = config