MartijnBraam/gpsd-py3

device() errors when path is udp://*:29998

woodbri opened this issue · 0 comments

When the device is not a serial device gpsd.device() fails as "speed" and "driver" are not in the dict.
Made the following changes:

def device():
    """ Get information about current gps device
    :return: dict
    """
    global state

    speed = ''
    if 'bps' in state['devices']['devices'][0].keys():
        speed = state['devices']['devices'][0]['bps']

    driver = ''
    if 'driver' in state['devices']['devices'][0].keys():
        driver = state['devices']['devices'][0]['driver']

    return {
        'path': state['devices']['devices'][0]['path'],
        'speed': speed,
        'driver': driver
    }