# Board type related helpers


def _get_board_type():
    with open('/proc/device-tree/model') as f:
        # model ends with a null byte
        return f.readline().strip().strip('\00')


def is_birch():
    return _get_board_type() == 'Purism Librem 5r2'


def is_librem5():
    return r'Purism Librem 5r' in _get_board_type()


def is_devkit():
    return _get_board_type() == 'Purism Librem 5 devkit'


if __name__ == '__main__':
    print("Board: '{}'".format(_get_board_type()))
    print('devkit: {}'.format(is_devkit()))
    print('librem5: {}'.format(is_librem5()))
