# Path: kano/logging.py
# class lazy_logger:
# class loader:
#     def __getattr__(self, name):
#     def __init__(self, old_mod):
#     def __getattr__(self, name):
# def log_excepthook(exc_class, exc_value, tb):
# 
# Path: kano/utils/shell.py
# def run_cmd(cmd, localised=False, unsudo=False):
#     '''
#     Executes cmd, returning stdout, stderr, return code
#     if localised is False, LC_ALL will be set to "C"
#     '''
#     env = os.environ.copy()
#     if not localised:
#         env['LC_ALL'] = 'C'
# 
#     if unsudo and \
#             'SUDO_USER' in os.environ and \
#             os.environ['SUDO_USER'] != 'root':
#         cmd = "sudo -u {} bash -c '{}' ".format(os.environ['SUDO_USER'], cmd)
# 
#     process = subprocess.Popen(cmd, shell=True, env=env,
#                                stdout=subprocess.PIPE, stderr=subprocess.PIPE,
#                                preexec_fn=restore_signals)
# 
#     stdout, stderr = process.communicate()
#     returncode = process.returncode
#     return stdout, stderr, returncode
# 
# Path: kano/utils/file_operations.py
# def read_file_contents_as_lines(path):
#     if os.path.exists(path):
#         with open(path) as infile:
#             content = infile.readlines()
#             lines = [line.strip() for line in content]
#             return lines


import traceback
from kano.logging import logger
from kano.utils.shell import run_cmd
from kano.utils.file_operations import read_file_contents_as_lines
        'arch': 'armv8'
    },
    RPI_3_PLUS_KEY: {
        'name': 'Raspberry Pi 3 B+',
        'cpu_profile': RPI_3_CPU_PROFILE,
        'performance': RPI_3_PLUS_SCORE,
        'arch': 'armv8'
    }
}


_g_revision = None


def get_board_property(board_key, prop):
    board = BOARD_PROPERTIES.get(board_key)

    if not board:
        return

    board_prop = board.get(prop)

    if not board_prop:
        return

    return board_prop


def detect_kano_keyboard_type():
    # Get information of all devices

# Path: kano/logging.py
# class lazy_logger:
# class loader:
#     def __getattr__(self, name):
#     def __init__(self, old_mod):
#     def __getattr__(self, name):
# def log_excepthook(exc_class, exc_value, tb):
# 
# Path: kano/utils/shell.py
# def run_cmd(cmd, localised=False, unsudo=False):
#     '''
#     Executes cmd, returning stdout, stderr, return code
#     if localised is False, LC_ALL will be set to "C"
#     '''
#     env = os.environ.copy()
#     if not localised:
#         env['LC_ALL'] = 'C'
# 
#     if unsudo and \
#             'SUDO_USER' in os.environ and \
#             os.environ['SUDO_USER'] != 'root':
#         cmd = "sudo -u {} bash -c '{}' ".format(os.environ['SUDO_USER'], cmd)
# 
#     process = subprocess.Popen(cmd, shell=True, env=env,
#                                stdout=subprocess.PIPE, stderr=subprocess.PIPE,
#                                preexec_fn=restore_signals)
# 
#     stdout, stderr = process.communicate()
#     returncode = process.returncode
#     return stdout, stderr, returncode
# 
# Path: kano/utils/file_operations.py
# def read_file_contents_as_lines(path):
#     if os.path.exists(path):
#         with open(path) as infile:
#             content = infile.readlines()
#             lines = [line.strip() for line in content]
#             return lines


# Path: kano/utils/hardware.py
import traceback
from kano.logging import logger
from kano.utils.shell import run_cmd
from kano.utils.file_operations import read_file_contents_as_lines

        'arch': 'armv8'
    },
    RPI_3_PLUS_KEY: {
        'name': 'Raspberry Pi 3 B+',
        'cpu_profile': RPI_3_CPU_PROFILE,
        'performance': RPI_3_PLUS_SCORE,
        'arch': 'armv8'
    }
}


_g_revision = None


def get_board_property(board_key, prop):
    board = BOARD_PROPERTIES.get(board_key)

    if not board:
        return

    board_prop = board.get(prop)

    if not board_prop:
        return

    return board_prop


def detect_kano_keyboard_type():
    # Get information of all devices

    stdout, dummy_stderr, dummy_ret = run_cmd('lsusb')