Пример #1
0
 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))
Пример #2
0
    def repo_sync(self, force=False):
        hw = HwInfo()
        cpus = hw.get_cups()
        if int(cpus) > 5:
            cpus = 5

        if force == True:
            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)
Пример #3
0
 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')
Пример #4
0
    def run(self, cmds):
        d.dbg('CmdProcessing.run(): %s' % cmds)
        for key in cmds.keys():
            # 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)
Пример #5
0
    def print_log(self, log_type, text=None):
        if log_type == 'logcat':
            cmd = 'adb logcat'
        elif log_type == 'dmesg':
            cmd = 'adb shell dmesg'
        elif log_type == 'kmsg':
            cmd = 'adb shell cat /proc/kmsg'
        else:
            d.err('unknown type!')
            return

        if text != None and len(text) != 0:
            filter_cnt=0
            for i in range(len(text)):
                if text[i] == 'all':
                    cmd = r' {}'.format(cmd)
                    break;
                elif text[i] == 'wait':
                    subprocess.call(r'adb wait-for-device', shell=True)
                    continue
                elif text[i] == 'root':
                    subprocess.call(r'adb root', shell=True)
                    continue
                elif text[i] == 'clear' or text[i] == 'clr':
                    subprocess.call(r'clear', shell=True)
                    continue
                else:
                    if filter_cnt == 0:
                        txt = text[i]
                    else:
                        txt=r'{}|{}'.format(txt, text[i])
                    filter_cnt+=1

            cmd = r'{} | grep --color -iE "{}"'.format(cmd, txt)
            d.info(cmd)
            #self.adb_root()
            subprocess.call(cmd, shell=True)
Пример #6
0
 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 avb == None:
                 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'])
Пример #7
0
 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))
Пример #8
0
 def flash_ioc(self, ioc):
     cmd = r'sudo /opt/intel/platformflashtool/bin/ioc_flash_server_app -s /dev/ttyUSB2 -grfabc -t {}'.format(
         ioc)
     d.info(cmd)
     subprocess.call(cmd, shell=True)
Пример #9
0
 def flash_firmware(self, fw):
     cmd = r'sudo /opt/intel/platformflashtool/bin/ias-spi-programmer --write {}'.format(
         fw)
     d.info(cmd)
     subprocess.call(cmd, shell=True)
Пример #10
0
 def flash_image(self, pt, image):
     cmd = r'fastboot flash %s %s' % (pt, image)
     d.info(cmd)
     subprocess.call(cmd, shell=True)
Пример #11
0
 def help(self, cmds):
     for cmd in cmds:
         if cmd == 'help':
             d.info('adb:[option][,option]')
             d.info('  wait: wait for adb device')
             d.info('  root: run adb root')
             d.info('  device: show adb device')
             d.info('  reboot: reboot device')
             d.info('  rebloader: reboot bootloader')
             d.info('  power: sent power on/off key')
             d.info('  back: sent back key')
             d.info('  unlock: sent tap to unlock device')
             d.info('fastboot:[option][,option]')
             d.info('  reboot: reboot device')
             d.info('  lock: lock device')
             d.info('  unlock: unlock device')
             d.info('  xxx: fastboot flash xxx image')
             d.info('logcat: [wait][,root][,clr][,xxx]')
             d.info('  wait: wait for adb device')
             d.info('  root: run adb root')
             d.info('  clr : clear screen display')
             d.info('  xxx : grep xxx')
             d.info('dmesg : [wait][,root][,clr][,xxx]')
             d.info('  wait: wait for adb device')
             d.info('  root: run adb root')
             d.info('  clr : clear screen display')
             d.info('  xxx : grep xxx')
             d.info('kmsg  : [wait][,root][,clr][,xxx]')
             d.info('  wait: wait for adb device')
             d.info('  root: run adb root')
             d.info('  clr : clear screen display')
             d.info('  xxx : grep xxx')
Пример #12
0
 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.')
Пример #13
0
 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())
Пример #14
0
 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')
Пример #15
0
 def repo_init(self):
     cmd = r'repo init -u %s' % self._url
     d.info(cmd)
     subprocess.call(cmd, shell=True)
Пример #16
0
 def help(self, cmds):
     super(Cwp, self).help(cmds)
     for cmd in cmds.values():
         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))