def parseDeviceInfo(device_info):
    """
    Parses Vendor, Product, Revision and UID from a Setup API entry
    :param device_info: string of device information to parse
    :return: dictionary of parsed information or original string if error
    """
    # Initialize variables
    vid = ''
    pid = ''
    rev = ''
    uid = ''

    # Split string into segments on \\
    segments = device_info[0].lower().split('\\')
    for segment in segments:
        for item in segment.split('&'):
            if 'ven' in item or 'vid' in item:
                vid = item.split('_')[-1]
            elif 'dev' in item or 'pid' in item:
                pid = item.split('_')[-1]
            elif 'rev' in item or 'mi' in item:
                rev = item.split('_')[-1]

        if len(segments) >= 3:
            uid = segments[2].strip(']')

        if vid != '' or pid != '':
            return {'Vendor ID': vid, 'Product ID': pid, 'Revision': rev, 'UID': uid,
                    'First Installation Date': device_info[1]}
        else:
            continue

    # Unable to parse data, returning whole string
    return device_info