Пример #1
0
def set_default_config():
    # restore factory defaults

    # setting the audio to analogue
    set_to_HDMI(False)

    set_config_value("hdmi_ignore_edid_audio", 1)
    set_config_value("hdmi_drive", None)

    # resetting HDMI settings
    set_config_value("disable_overscan", 1)
    set_config_value("overscan_left", 0)
    set_config_value("overscan_right", 0)
    set_config_value("overscan_top", 0)
    set_config_value("overscan_bottom", 0)
    set_config_value("hdmi_pixel_encoding", 2)
    set_config_value("hdmi_group", None)
    set_config_value("hdmi_mode", None)
    set_config_value("display_rotate", 0)
    set_config_comment("kano_screen_used", "xxx")

    # resetting overclocking settings
    set_default_overclock_values()

    # set the keyboard to default
    set_keyboard("en_US", "generic")

    end_config_transaction()
Пример #2
0
        def test_write(configs):

            if self.backup_config_exists:
                which = random.randint(0, 2)
            else:
                which = random.randint(0, 1)

            present = random.randint(0, 1) == 1

            before_write = configs['current'].copy()

            if which == 0:
                # test set_config_value

                key = choose_key(present, configs['current'].values)
                if random.randint(0, 1):
                    value = None

                    print "testing set_config_value({},{})".format(key, value)
                    boot_config.set_config_value(key, value)
                    configs['written'].values[key] = 0
                    configs['written'].comment_keys[key] = True
                else:
                    value = random.randint(0, 1000)
                    print "testing set_config_value({},{})".format(key, value)
                    boot_config.set_config_value(key, value)
                    configs['written'].values[key] = value
                    configs['written'].comment_keys[key] = False

            elif which == 1:
                # test set_config_comment
                key = choose_key(present, configs['current'].comment_values)
                value = str(random.randint(0, 1000))

                print "testing set_config_comment({},{})".format(key, value)
                boot_config.set_config_comment(key, value)
                configs['written'].comment_values[key] = value

            elif which == 2:
                # test restore_backup

                self.assertTrue(
                    self.backup_config_exists)  # bug in test if triggered

                print "testing safe_mode_restore_backup"
                boot_config.safe_mode_restore_config()
                configs['written'] = read_config(
                    boot_config._trans().temp_path)

                self.backup_config_exists = False

                self.assertTrue(compare(configs['backup'], configs['written']))

            after_write = read_config()

            self.assertTrue(compare(before_write, after_write))
            self.assertTrue(boot_config._trans().state == 2)
            self.assertTrue(is_locked())
Пример #3
0
    def set_hdmi_mode_from_str(self, mode):
        if mode == "auto":
            set_hdmi_mode()
            set_config_comment('kano_screen_used', 'xxx')
            return

        group, number = mode.split(":")
        set_hdmi_mode(group, number)
        set_config_comment('kano_screen_used', self.model)
Пример #4
0
        def test_write(configs):

            if self.backup_config_exists:
                which = random.randint(0, 2)
            else:
                which = random.randint(0, 1)

            present = random.randint(0, 1) == 1

            before_write = configs['current'].copy()

            if which == 0:
                # test set_config_value

                key = choose_key(present, configs['current'].values)
                if random.randint(0, 1):
                    value = None

                    print "testing set_config_value({},{})".format(key, value)
                    boot_config.set_config_value(key, value)
                    configs['written'].values[key] = 0
                    configs['written'].comment_keys[key] = True
                else:
                    value = random.randint(0, 1000)
                    print "testing set_config_value({},{})".format(key, value)
                    boot_config.set_config_value(key, value)
                    configs['written'].values[key] = value
                    configs['written'].comment_keys[key] = False

            elif which == 1:
                # test set_config_comment
                key = choose_key(present, configs['current'].comment_values)
                value = str(random.randint(0, 1000))

                print "testing set_config_comment({},{})".format(key, value)
                boot_config.set_config_comment(key, value)
                configs['written'].comment_values[key] = value

            elif which == 2:
                # test restore_backup

                self.assertTrue(self.backup_config_exists)  # bug in test if triggered

                print "testing safe_mode_restore_backup"
                boot_config.safe_mode_restore_config()
                configs['written'] = read_config(boot_config._trans().temp_path)

                self.backup_config_exists = False


                self.assertTrue(compare(configs['backup'], configs['written']))

            after_write = read_config()

            self.assertTrue(compare(before_write, after_write))
            self.assertTrue(boot_config._trans().state == 2)
            self.assertTrue(is_locked())
Пример #5
0
    def set_hdmi_mode_from_str(self, mode):
        if mode == 'auto':
            set_hdmi_mode()
            set_config_comment('kano_screen_used', 'xxx')
            return

        group, number = mode.split(":")
        set_hdmi_mode(group, number)
        set_config_comment('kano_screen_used', self.model)
Пример #6
0
    def apply_changes(self, button, event):
        # Apply changes
        write_overscan_values(self.overscan_values)
        self.original_overscan = self.overscan_values
        set_config_comment('kano_screen_used', get_model())

        # Tell user to reboot to see changes
        common.need_reboot = True

        self.go_to_display()
Пример #7
0
    def apply_changes(self, button, event):
        # Apply changes
        set_config_comment('kano_screen_used', get_model())
        # NB, write_overscan_values ends the transaction
        write_overscan_values(self.overscan_values)
        self.original_overscan = self.overscan_values

        # Tell user to reboot to see changes
        common.need_reboot = True

        self.go_to_display()