def help(self, cmds): for cmd in cmds: if cmd == 'help': d.info('repo:[init][,sync|fsync]') d.info(' init : repo init source code') d.info(' sync : repo sync source code') d.info(' fsync: repo sync source code with -f') elif cmd == 'cfg': d.info('url: {}'.format(self._url))
def repo_sync(self, force=False): hw = HwInfo() cpus = hw.get_cups() if int(cpus) > 5: cpus = 5 if force: cmd = r'repo sync -c -j{n} -f'.format(n=cpus) else: cmd = r'repo sync -c -j{n}'.format(n=cpus) d.info(cmd) subprocess.call(cmd, shell=True)
def help(self, cmds): super(Fpc, self).help(cmds) for cmd in cmds: if cmd == 'help': d.info('ftest:[make][,push][,xxx]') d.info(' make: build fingerprint test binary') d.info(' push: push ftest to /data/') d.info(' xxx : run ftest xxx test')
def run(self, cmds): d.dbg('PyCmdProcess.run(): %s' % cmds) for key in cmds: # check help. if key == 'help': for sub_cmd in cmds[key]: if sub_cmd != 'cfg': # no show while cfg. d.info('help:[help][,cfg]') d.info(' help: show help') d.info(' cfg : show config info') if key in self._cmd_dict: d.dbg(self._cmd_dict[key]) if type(self._cmd_dict[key]) == dict: sub_cmds = self._cmd_dict[key] for sub_key in sub_cmds.iterkeys(): f = sub_cmds[sub_key] d.dbg(f(cmds[key])) else: t = type(self._cmd_dict[key]) if t == list: for f in self._cmd_dict[key]: d.dbg(f(cmds[key])) else: f = self._cmd_dict[key] d.dbg(f(cmds[key])) else: d.err('No handler for: %s' % key)
def flash_images(self, images): fimgs = list() avb = None for image in images: if image == 'fw': self.flash_firmware('{path}/{fw}'.format(path=self._flashfiles, fw=self._fw)) elif image == 'ioc': self.flash_ioc('{path}/{fw}'.format(path=self._flashfiles, fw=self._ioc)) else: # avb make images. d.info('update %s image' % image) if not avb: avb = AvbImage() avb.avb_make_image(image, self) fimgs.append(image) # flash images. if len(fimgs) != 0: fimgs.append('vbmeta') # setup flash env ad = Android() # ad.adb_wait() # enter bootloader mode. ad.run_cmd_handler(['rebootloader']) # unlock ad.run_cmd_handler(['deviceunlock']) # flash image now for image in fimgs: fimage = r'{}/{}.img'.format(self._flashfiles, image) d.info('fastboot flash {} {}'.format(image, fimage)) ad.flash_image(image, fimage) # lock device. ad.run_cmd_handler(['devicelock']) # reboot ad.run_cmd_handler(['fastreboot'])
def help(self, cmds): super(Cwp, self).help(cmds) for cmd in cmds: if cmd == 'help': d.info('make:[option][,option]') d.info(' [option]:') d.info(' all: make all of images') d.info(' sos: make sos image') d.info(' sos_dm: make sos_dm image') d.info(' sos_kernel: make sos_kernel image') d.info(' uos: make uos image') d.info(' uos_kernel: make uos_kernel image') d.info(' flash: flash all of image') d.info(' flash_sos: flash sos image') d.info(' flash_uos: flash uos image') d.info(' flash_data: flash data image') elif cmd == 'cfg': d.info('url: {}'.format(self._url))
def help(self, cmds): for cmd in cmds: if cmd == 'help': d.info('make:[option][,option]') d.info(' [option]:') d.info(' all/flashfiles: make all of images') d.info(' boot : make bootimage') d.info(' system: make systemimage') d.info(' tos : make tosimage') d.info(' vendor: make vendorimage') d.info(' mmm#xxx: make xxx dir') d.info('flash:[option][,option]') d.info(' [option]:') d.info(' boot : flash bootimage') d.info(' system: flash systemimage') d.info(' tos : flash tosimage') d.info(' vendor: flash vendorimage') d.info(' fw : flash firmware') d.info(' ioc : flash ioc') elif cmd == 'cfg': d.info('pdt: {}'.format(self._pdt)) d.info('opt: {}'.format(self._opt)) d.info('user: {}'.format(self._user)) d.info('out: {}'.format(self._out)) d.info('flashfiles: {}'.format(self._flashfiles)) d.info('fw: {}'.format(self._fw)) d.info('ioc: {}'.format(self._ioc))
def flash_ioc(self, ioc): tool = '/opt/intel/platformflashtool/bin/ioc_flash_server_app' cmd = r'sudo {} -s /dev/ttyUSB2 -grfabc -t {}'.format(tool, ioc) d.info(cmd) subprocess.call(cmd, shell=True)
def flash_firmware(self, fw): tool = '/opt/intel/platformflashtool/bin/ias-spi-programmer' cmd = r'sudo {} --write {}'.format(tool, fw) d.info(cmd) subprocess.call(cmd, shell=True)
def repo_init(self): cmd = r'repo init -u %s' % self._url d.info(cmd) subprocess.call(cmd, shell=True)
def help(self, cmds): for cmd in cmds: if cmd == 'help': d.info('ps:kw[,list/kill]') d.info(' kw: the keyword will be search.') d.info(' list/kill: list/kill the ps.')
def hwif_handler(self, cmds): for cmd in cmds: if cmd == 'ncpu': d.info(self.get_cups()) elif cmd == 'ip': d.info(self.get_host_ip())
def help(self, cmds): for cmd in cmds: if cmd == 'help': d.info('hwinfo:[ncpu][,ip]') d.info(' ncpu: get number of CPU') d.info(' ip: get host IP address')
def help(self, cmds): for cmd in cmds: if cmd == 'help': d.info('del:[xxx][,xxx]') d.info(' xxx: xxx file will be delete.') d.info('fdel:[path,]file') d.info(' path: path to be find, not set to ./') d.info(' file: file to be delete.') d.info('find:[path,]file') d.info(' path: path to find, not set to ./') d.info(' file: file to be find.')