def ibuilder_status(status): s = status print "%sibuilder:%s" % (st.yellow, st.white) if not INTERNET_AVAILABLE: print "\tInternet not available, unable to check for remote platform packages" else: sm = site_manager.SiteManager(status) board_dict = sm.get_remote_board_dict() print "\t%sRemote Platform Packages Available:%s" % (st.purple, st.white) for name in board_dict: print "\t\t%s%s%s" % (st.blue, name, st.white) #print "args.name: %s" % args.name ps = PlatformScanner(s) platforms = ps.get_platforms() if len(platforms) == 0: print "\t%sNo Platforms installed!%s" % (st.red, st.white) print "\t\tuse %s'nysa install-platforms'%s to view all available remote platforms" % ( st.blue, st.white) print "\t\tuse %s'nysa install-platforms <platform name>'%s to install a platform" % ( st.green, st.white) else: print "\t%sPlatforms:%s" % (st.purple, st.white) for platform in platforms: print "\t\t%s%s%s" % (st.blue, platform, st.white) p = ps.get_platforms()[platform](status) print "\t\t\tChecking build tool...", if not p.test_build_tools(): print "%s%s%s" % (st.red, "Failed!", st.white) else: print "%s%s%s" % (st.green, "Passed!", st.white) print ""
def ibuilder_status(status): s = status print "%sibuilder:%s" % (st.yellow, st.white) if not INTERNET_AVAILABLE: print "\tInternet not available, unable to check for remote platform packages" else: sm = site_manager.SiteManager(status) board_dict = sm.get_remote_board_dict() print "\t%sRemote Platform Packages Available:%s" % (st.purple, st.white) for name in board_dict: print "\t\t%s%s%s" % (st.blue, name, st.white) #print "args.name: %s" % args.name ps = PlatformScanner(s) platforms = ps.get_platforms() if len(platforms) == 0: print "\t%sNo Platforms installed!%s" % (st.red, st.white) print "\t\tuse %s'nysa install-platforms'%s to view all available remote platforms" % (st.blue, st.white) print "\t\tuse %s'nysa install-platforms <platform name>'%s to install a platform" % (st.green, st.white) else: print "\t%sPlatforms:%s" % (st.purple, st.white) for platform in platforms: print "\t\t%s%s%s" % (st.blue, platform, st.white) p = ps.get_platforms()[platform](status) print "\t\t\tChecking build tool...", if not p.test_build_tools(): print "%s%s%s" % (st.red, "Failed!", st.white) else: print "%s%s%s" % (st.green, "Passed!", st.white) print ""
def list_platforms(args, status): s = status #print "args.name: %s" % args.name ps = PlatformScanner(s) platforms = ps.get_platforms() print "%sPlatforms:%s" % (purple, white) for platform in platforms: print "\t%s%s%s" % (blue, platform, white)
def setUp(self): self.s = Status() plat = ["", None, None] pscanner = PlatformScanner() platform_dict = pscanner.get_platforms() platform_names = platform_dict.keys() if "sim" in platform_names: #If sim is in the platforms, move it to the end platform_names.remove("sim") platform_names.append("sim") urn = None for platform_name in platform_names: if plat[1] is not None: break self.s.Debug("Platform: %s" % str(platform_name)) platform_instance = platform_dict[platform_name](self.s) #self.s.Verbose("Platform Instance: %s" % str(platform_instance)) instances_dict = platform_instance.scan() for name in instances_dict: try: #s.Verbose("Found Platform Item: %s" % str(platform_item)) n = instances_dict[name] plat = ["", None, None] if n is not None: self.s.Important("Found a nysa instance: %s" % name) try: n.read_sdb() except IndexError: self.s.Warning("%s is not responding..." % name) continue #import pdb; pdb.set_trace() if n.is_device_in_platform(DRIVER): plat = [platform_name, name, n] break continue #self.s.Verbose("\t%s" % psi) except NysaCommError: continue if plat[1] is None: self.driver = None return n = plat[2] self.n = n pcie_urn = n.find_device(DRIVER)[0] self.driver = DRIVER(n, pcie_urn) self.s.set_level("verbose") self.s.Info("Using Platform: %s" % plat[0]) self.s.Info("Instantiated a PCIE Device Device: %s" % pcie_urn)
def setUp(self): self.s = Status() plat = ["", None, None] pscanner = PlatformScanner() platform_dict = pscanner.get_platforms() platform_names = platform_dict.keys() if "sim" in platform_names: #If sim is in the platforms, move it to the end platform_names.remove("sim") platform_names.append("sim") urn = None for platform_name in platform_names: if plat[1] is not None: break self.s.Debug("Platform: %s" % str(platform_name)) platform_instance = platform_dict[platform_name](self.s) #self.s.Verbose("Platform Instance: %s" % str(platform_instance)) instances_dict = platform_instance.scan() for name in instances_dict: #s.Verbose("Found Platform Item: %s" % str(platform_item)) n = instances_dict[name] plat = ["", None, None] if n is not None: self.s.Important("Found a nysa instance: %s" % name) n.read_sdb() #import pdb; pdb.set_trace() if n.is_device_in_platform(DRIVER): plat = [platform_name, name, n] break continue #self.s.Verbose("\t%s" % psi) if plat[1] is None: self.sata_drv = None return n = plat[2] self.n = n sata_urn = n.find_device(DRIVER)[0] dma_urn = n.find_device(DMA)[0] self.memory_urn = self.n.find_device(Memory)[0] self.sata_drv = DRIVER(n, sata_urn) self.dma = DMA(n, dma_urn) self.s.set_level("verbose") self.s.Info("Using Platform: %s" % plat[0]) self.s.Info("Instantiated a SATA Device: %s" % sata_urn) self.s.Info("Instantiated a DMA Device: %s" % dma_urn)
def setUp(self): self.s = Status() self.s.set_level("fatal") plat = ["", None, None] pscanner = PlatformScanner() platform_dict = pscanner.get_platforms() platform_names = platform_dict.keys() if "sim" in platform_names: #If sim is in the platforms, move it to the end platform_names.remove("sim") platform_names.append("sim") urn = None for platform_name in platform_names: if plat[1] is not None: break self.s.Debug("Platform: %s" % str(platform_name)) platform_instance = platform_dict[platform_name](self.s) #self.s.Verbose("Platform Instance: %s" % str(platform_instance)) instances_dict = platform_instance.scan() for name in instances_dict: #s.Verbose("Found Platform Item: %s" % str(platform_item)) n = instances_dict[name] plat = ["", None, None] if n is not None: self.s.Important("Found a nysa instance: %s" % name) n.read_sdb() #import pdb; pdb.set_trace() if n.is_device_in_platform(SFCamera): plat = [platform_name, name, n] break continue #self.s.Verbose("\t%s" % psi) if plat[1] is None: self.camera = None return n = plat[2] urn = n.find_device(SFCamera)[0] self.s.set_level("verbose") self.s.Important("Using Platform: %s" % plat[0]) self.s.Important("Instantiated a SFCamera Device: %s" % urn) self.camera = SFCamera(n, urn) self.received_callback = False
def configure_device(self, driver): self.s.Debug("type of driver: %s" % str(driver)) plat = ["", None, None] pscanner = PlatformScanner() platform_dict = pscanner.get_platforms() platform_names = platform_dict.keys() if "sim" in platform_names: #If sim is in the platforms, move it to the end platform_names.remove("sim") platform_names.append("sim") urn = None for platform_name in platform_names: if plat[1] is not None: break self.s.Debug("Platform: %s" % str(platform_name)) platform_instance = platform_dict[platform_name](self.s) #self.s.Verbose("Platform Instance: %s" % str(platform_instance)) instances_dict = platform_instance.scan() for name in instances_dict: #s.Verbose("Found Platform Item: %s" % str(platform_item)) n = instances_dict[name] plat = ["", None, None] if n is not None: self.s.Important("Found a nysa instance: %s" % name) n.read_sdb() #import pdb; pdb.set_trace() if n.is_device_in_platform(driver): plat = [platform_name, name, n] break continue #self.s.Verbose("\t%s" % psi) if plat[1] is None: self.d = None return n = plat[2] self.n = n urn = n.find_device(driver)[0] self.d = driver(n, urn) self.s.Important("Using Platform: %s" % plat[0]) self.s.Important("Instantiated a driver Device: %s" % urn)
def list_boards(args, status): s = status pc = PlatformScanner(s) pc.get_board_path_dict() platform_class_dict = pc.get_platforms() for platform in platform_class_dict: if s: s.Debug("%s, class: %s" % (platform, str(platform_class_dict[platform]))) print "Scanning %s%s%s..." % (blue, platform, white), p = platform_class_dict[platform](s) dev_dict = p.scan() if len(dev_dict) > 0: print "Found %d board(s)" % len(dev_dict) for plat in dev_dict: print "\tBoard ID: %s%s%s" % (green, str(plat), white) else: print "No boards found"
def test_full_dionysus_read(self): from nysa.host.platform_scanner import PlatformScanner pscanner = PlatformScanner() platform_dict = pscanner.get_platforms() platform_names = platform_dict.keys() if "dionysus" not in platform_names: return s = Status() platform_instance = platform_dict["dionysus"](s) platforms = platform_instance.scan() if len(platforms) == 0: return dionysus = platforms[platforms.keys()[0]] #print "Found Dionysus" s.set_level("fatal") s.Verbose("Read SDB") dionysus.read_sdb()
def setUp(self): self.s = Status() plat = ["", None, None] pscanner = PlatformScanner() platform_dict = pscanner.get_platforms() platform_names = platform_dict.keys() if "sim" in platform_names: platform_names.remove("sim") platform_names.append("sim") urn = None for platform_name in platform_names: if plat[1] is not None: break self.s.Debug("Platform: %s" % str(platform_name)) platform_instance = platform_dict[platform_name](self.s) instances_dict = platform_instance.scan() for name in instances_dict: n = instances_dict[name] plat = ["", None, None] if n is not None: self.s.Important("Found a nysa instance: %s" % name) n.read_sdb() if n.is_device_in_platform(DRIVER): plat = [platform_name, name, n] break continue if plat[1] is None: self.sdio_drv = None return n = plat[2] self.n = n sdio_urn = n.find_device(DRIVER)[0] self.sdio = DRIVER(n, sdio_urn) self.s.set_level("verbose") self.s.Info("Using Platform: %s" % plat[0]) self.s.Info("Instantiated a SDIO Device Device: %s" % sdio_urn)
def __init__(self, name=None): self.s = Status() self.s.set_level("fatal") plat = ["", None, None] pscanner = PlatformScanner() platform_dict = pscanner.get_platforms() platform_names = platform_dict.keys() if "sim" in platform_names: #If sim is in the platforms, move it to the end platform_names.remove("sim") platform_names.append("sim") urn = None if name is not None and name in platform_names: self.s.Debug("Platform: %s" % str(name)) platform_instance = platform_dict[name](self.s) #self.s.Verbose("Platform Instance: %s" % str(platform_instance)) instances_dict = platform_instance.scan() for iname in instances_dict: #s.Verbose("Found Platform Item: %s" % str(platform_item)) n = instances_dict[iname] plat = ["", None, None] if n is not None: self.s.Important("Found a nysa instance: %s" % iname) n.read_sdb() #import pdb; pdb.set_trace() if n.is_device_in_platform(Memory): plat = [name, iname, n] break continue #self.s.Verbose("\t%s" % psi) else: for platform_name in platform_names: if plat[1] is not None: break self.s.Debug("Platform: %s" % str(platform_name)) platform_instance = platform_dict[platform_name](self.s) #self.s.Verbose("Platform Instance: %s" % str(platform_instance)) instances_dict = platform_instance.scan() for name in instances_dict: #s.Verbose("Found Platform Item: %s" % str(platform_item)) n = instances_dict[name] plat = ["", None, None] if n is not None: self.s.Important("Found a nysa instance: %s" % name) n.read_sdb() #import pdb; pdb.set_trace() if n.is_device_in_platform(Memory): plat = [platform_name, name, n] break continue #self.s.Verbose("\t%s" % psi) if plat[1] is None: return self.n = plat[2] self.urn = self.n.find_device(Memory)[0] self.s.set_level("verbose") self.s.Important("Using Platform: %s" % plat[0]) self.s.Important("Instantiated a Memory Device: %s" % self.urn) self.memory = Memory(self.n, self.urn)
def __init__(self, name = None): self.s = Status() self.s.set_level("fatal") plat = ["", None, None] pscanner = PlatformScanner() platform_dict = pscanner.get_platforms() platform_names = platform_dict.keys() if "sim" in platform_names: #If sim is in the platforms, move it to the end platform_names.remove("sim") platform_names.append("sim") urn = None if name is not None and name in platform_names: self.s.Debug("Platform: %s" % str(name)) platform_instance = platform_dict[name](self.s) #self.s.Verbose("Platform Instance: %s" % str(platform_instance)) instances_dict = platform_instance.scan() for iname in instances_dict: #s.Verbose("Found Platform Item: %s" % str(platform_item)) n = instances_dict[iname] plat = ["", None, None] if n is not None: self.s.Important("Found a nysa instance: %s" % iname) n.read_sdb() #import pdb; pdb.set_trace() if n.is_device_in_platform(Memory): plat = [name, iname, n] break continue #self.s.Verbose("\t%s" % psi) else: for platform_name in platform_names: if plat[1] is not None: break self.s.Debug("Platform: %s" % str(platform_name)) platform_instance = platform_dict[platform_name](self.s) #self.s.Verbose("Platform Instance: %s" % str(platform_instance)) instances_dict = platform_instance.scan() for name in instances_dict: #s.Verbose("Found Platform Item: %s" % str(platform_item)) n = instances_dict[name] plat = ["", None, None] if n is not None: self.s.Important("Found a nysa instance: %s" % name) n.read_sdb() #import pdb; pdb.set_trace() if n.is_device_in_platform(Memory): plat = [platform_name, name, n] break continue #self.s.Verbose("\t%s" % psi) if plat[1] is None: return self.n = plat[2] self.urn = self.n.find_device(Memory)[0] self.s.set_level("verbose") self.s.Important("Using Platform: %s" % plat[0]) self.s.Important("Instantiated a Memory Device: %s" % self.urn) self.memory = Memory(self.n, self.urn)
def main(argv): #Parse out the commandline arguments s = status.Status() s.set_level(status.StatusLevel.INFO) parser = argparse.ArgumentParser( formatter_class = argparse.RawDescriptionHelpFormatter, description = DESCRIPTION, epilog = EPILOG ) debug = False parser.add_argument("-d", "--debug", action = "store_true", help = "Enable Debug Messages") parser.add_argument("-l", "--list", action = "store_true", help = "List the available devices from a platform scan") parser.add_argument("platform", type = str, nargs='?', default=["first"], help="Specify the platform to use") args = parser.parse_args() plat = ["", None, None] if args.debug: s.set_level(status.StatusLevel.VERBOSE) s.Debug("Debug Enabled") debug = True pscanner = PlatformScanner() platform_dict = pscanner.get_platforms() platform_names = platform_dict.keys() if "sim" in platform_names: #If sim is in the platforms, move it to the end platform_names.remove("sim") platform_names.append("sim") dev_index = None for platform_name in platform_dict: s.Verbose("Platform: %s" % str(platform_name)) s.Verbose("Type: %s" % str(platform_dict[platform_name])) platform_instance = platform_dict[platform_name](s) s.Verbose("Platform Instance: %s" % str(platform_instance)) instances_dict = platform_instance.scan() if plat[1] is not None: break for name in instances_dict: #s.Verbose("Found Platform Item: %s" % str(platform_item)) n = instances_dict[name] plat = ["", None, None] if n is not None: s.Verbose("Found a nysa instance: %s" % name) n.read_sdb() dev_index = n.find_device(Nysa.get_id_from_name("LCD")) if dev_index is not None: s.Important("Found a device at %d" % dev_index) plat = [platform_name, name, n] break continue if platform_name == args.platform and plat[0] != args.platform: #Found a match for a platfom to use plat = [platform_name, name, n] continue s.Verbose("\t%s" % psi) if args.list: s.Verbose("Listed all platforms, exiting") sys.exit(0) if plat is not None: s.Important("Using: %s" % plat) else: s.Fatal("Didn't find a platform to use!") c = Controller() if dev_index is None: sys.exit("Failed to find an LCD Device") c.start_standalone_app(plat, dev_index, status, debug)