Skip to content

Commit

Permalink
fixed root handling of settings / config file and bug in set-kano-hdmi
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperknot committed Sep 9, 2014
1 parent 113f78b commit c8879a3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bin/set-kano-hdmi
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ logger.error(status)
logger.error(edid)

# fix hdmi audio status
if not edid['hdmi_supported'] and is_HDMI():
if not edid['hdmi_audio'] and is_HDMI():
logger.error('hdmi audio not supported on this screen, changing to analogue')
set_to_HDMI(False)

Expand Down
16 changes: 10 additions & 6 deletions kano_settings/config_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@
USER_ID = None

username = get_user_unsudoed()
settings_dir = os.path.join('/home', username, '.kano-settings')
if os.path.exists(settings_dir) and os.path.isfile(settings_dir):
os.rename(settings_dir, settings_dir + '.bak')
ensure_dir(settings_dir)
chown_path(settings_dir)
settings_file = os.path.join(settings_dir, 'config')
if username != 'root':
settings_dir = os.path.join('/home', username, '.kano-settings')
if os.path.exists(settings_dir) and os.path.isfile(settings_dir):
os.rename(settings_dir, settings_dir + '.bak')
ensure_dir(settings_dir)
chown_path(settings_dir)
settings_file = os.path.join(settings_dir, 'config')

defaults = {
'Keyboard-continent-index': 1,
Expand Down Expand Up @@ -88,6 +89,9 @@ def get_setting(variable):


def set_setting(variable, value):
if username == 'root':
return

logger.debug('config_file / set_setting: {} {}'.format(variable, value))

data = read_json(settings_file)
Expand Down

0 comments on commit c8879a3

Please sign in to comment.