Ejemplo n.º 1
0
def test_read_profile(jsonfile):
    classes = globals()
    XObject.set_classes(classes)
    parser = ProfileParser()
    parser.read_profile(jsonfile)

    boards = Profile.get_boards()
    boards[power_profile['id']] = power_profile

    assert len(Profile.get_extendio()) == 1
    assert len(Profile.get_busswitch()) == 9
    assert len(Profile.get_eeprom()) == 8
    assert len(Profile.get_boards()) == 5
    assert len(Profile.get_buses()) == 8
    assert len(Profile.get_chips()) == 12
Ejemplo n.º 2
0
def select_channel(channel_name):
    """ select which channel to operate
        
        Args:
        channel_name: which channel   will be select, check it in profile. for example:'back-light
            
        Returns:
            object:  return  switch object.
                    
        Raises:
            KeyError: If the key is invalid.    
            ValueError: If the parameter is invalid
    """
    busswitch = Profile.get_busswitch()
    chipname = busswitch[channel_name]['chip']
    channel = busswitch[channel_name]['channel']

    switcher = XObject.get_chip_object(chipname)
    if switcher.select_channel(channel) is False:
        logger.warning("select %s channel %s fail" % (chipname, channel_name))

    return switcher