class CheckSDCardMount(StorageUsbStep): def __init__(self, **kwargs): StorageUsbStep.__init__(self, **kwargs) self.sdcard = False self.adb = Adb(serial=self.serial) self.uuid = "" def do(self): self.adb.adb_root() blkid_out = self.adb.run_cmd('blkid') for line in blkid_out.stdout.read().split('\n'): if 'mmcblk0p1' in line: self.sdcard = True self.uuid = line.split(' ')[1].split('=')[1].strip('"') break def check_condition(self): if self.sdcard: vol = self.adb.run_cmd("sm list-volumes") for line in vol.stdout.read().strip().split('\n'): if self.uuid in line: if 'mounted' in line.split()[-2]: self.set_passm("SD Card Mounted with UUID: " + self.uuid) return True self.set_errorm("", "SD Card Not Mounted") return False
globals().update(vars(get_args(sys.argv))) adb_steps.connect_device(serial=serial, port=adb_server_port)() args = {} for entry in script_args: key, val = entry.split("=") args[key] = val uidevice = ui_device(serial=serial) dut = Adb(serial=serial) list_vol = "sm list-volumes" test_file = "test_adb_copy.dat" dut.adb_root() uuid = "" def check_sdcard(): global uuid p = dut.run_cmd('blkid') sdcard = False for line in p.stdout.read().split('\n'): if 'mmcblk0p1' in line: sdcard = True uuid = line.split(' ')[1].split('=')[1].strip('"') break if sdcard: m = dut.run_cmd(list_vol)