Exemplo n.º 1
0
 def __init__(self):
     self._sat_home = envstore.store.get_sat_home()
     self._satt_venv_bin = envstore.store.get_sat_venv_bin()
     self._post_process_bin_path = os.path.join(self._sat_home, 'satt', 'process', 'bin')
     self._variables = envstore.store.get_current()
     self._os = targetos.get_instance()
     self.ParseArguments()
Exemplo n.º 2
0
    def __init__(self, control):
        self.sat_home_path = envstore.store.get_sat_home()
        self._variables = envstore.store.get_current()

        self._debug_print("Logger::init")
        self._control = control
        self._parser = argparse.ArgumentParser(
            description='sat-trace to trace your system')
        self._parser.add_argument(
            '-c',
            '--power',
            action='store',
            help='Read current and voltage -p <polling period ms>',
            required=False)
        self._parser.add_argument('--debug',
                                  action='store_true',
                                  help='Debug prints',
                                  required=False)
        self._parser.add_argument('-m', help='Trace mode', required=False)

        self._satt_venv_bin = envstore.store.get_sat_venv_bin()
        # get instance to os specific object:
        self._os = targetos.get_instance()

        # Initialize controller
        if not self._control.initialize():
            print "ERROR: trace device not found, or more than one device connected"
            sys.exit(-1)
Exemplo n.º 3
0
    def action(self):
        os.system('cls' if os.name == 'nt' else 'clear')
        print '**************************************'
        print '*  Setup SATT environment variables! *'
        print '*  (*) [Enter]-key to choose default *'
        print '**************************************\n'
        print helper.color.BOLD + 'Current configuration:' + helper.color.END
        configurations_exits = True
        if self._variables['sat_os'] >= 0:
            print('   ' + helper.color.BOLD +
                  targetos.OsHelper.osdata[self._variables['sat_os']].Name +
                  helper.color.END)
            print(
                '   ' + '-' *
                len(targetos.OsHelper.osdata[self._variables['sat_os']].Name))
            print('   Trace out     : ' + helper.color.BOLD +
                  self._variables['sat_trace_logging_method'] +
                  helper.color.END)
            print('   Control bus   : ' + helper.color.BOLD +
                  self._variables['sat_control_bus'] + helper.color.END),
            if self._variables['sat_control_bus'] == 'SSH':
                print '-> ' + helper.color.BOLD + self._variables[
                    'sat_control_ip'] + helper.color.END
            else:
                print
            if self._variables['sat_target_source'] != "":
                print('   Build path    : ' + helper.color.BOLD +
                      self._variables['sat_target_source'] + helper.color.END)
            if os.path.basename(self._variables['sat_target_build']) != "":
                print('   Product       : ' + helper.color.BOLD +
                      os.path.basename(self._variables['sat_target_build']) +
                      helper.color.END)
            if self._variables['sat_path_kernel'] != "":
                print('   Kernel path   : ' + helper.color.BOLD +
                      self._variables['sat_path_kernel'] + helper.color.END)

            print
            print helper.color.BOLD + 'Change values:' + helper.color.END
            print ' * 0) No  - keep current setup'
            print '   1) Yes - select setup'
            selection = self._readchar()

        else:
            print "   None"
            selection = '1'
            configurations_exits = False

        print

        if selection == '1':
            if configurations_exits:
                self.select_prev_setup()
            self.set_os()
            self.set_control_bus()
            self.set_trace_destination()
            self._os = targetos.get_instance()
            self._os.config(self._variables)

            self._config.add_config(self._variables)
Exemplo n.º 4
0
    def action(self):
        if self._variables['sat_path_kernel'] == '':
            print "No kernel path set.\nPlease call 'satt config' first."
            print
            sys.exit(-1)

        parser = argparse.ArgumentParser(description='satt build')
        parser.add_argument('-l', '--load', action='store_true',
                            help='Only load kernel-module into device', required=False)
        self._args = parser.parse_args()

        # SATT_CONTROL_BUS
        if self._variables['sat_control_bus'] == "SSH":
            self._control = SshControl(False)
        elif self._variables['sat_control_bus'] == "SHELL":
            self._control = ShellControl(False)
        else:  # self._variables['sat_control_bus'] == "ADB":
            self._control = AdbControl(False)

        if not self._args.load:
            print 'Make SATT kernel-module'
            os.chdir(os.path.join(self._sat_home, 'src', 'kernel-module'))
            os.environ['SAT_TARGET_BUILD'] = self._variables['sat_target_build']
            os.environ['SAT_TARGET_SOURCE'] = self._variables['sat_target_source']
            os.environ['SAT_PATH_KERNEL'] = self._variables['sat_path_kernel']
            os.environ['SAT_TARGET_DEV'] = self._variables['sat_path_kernel_src']
            subprocess.call('make clean', shell=True)
            subprocess.call('./build.sh', shell=True)

        if self._control.initialize():
            kmod_path = os.path.join(self._sat_home, 'src', 'kernel-module', 'sat.ko')
            if os.path.isfile(kmod_path):
                target_os = targetos.get_instance()
                print '\nCopy SATT kernel-module into target device'
                self._control.push_local_file(kmod_path,  target_os.get_tmp_folder() + '/sat.ko')
                try:
                    self._control.shell_command('rmmod sat', True)
                except:
                    pass