def find_dongle_port():
        """Convenience method which attempts to find the port where a BLED112 dongle is connected.

        This relies on the `pyserial.tools.list_ports.grep method 
        <https://pyserial.readthedocs.io/en/latest/tools.html#serial.tools.list_ports.grep>`_, 
        and simply searches for a port containing the string "Bluegiga" in its description. 
        (This probably only works on Windows at the moment (TODO)).

        Returns:
            A string containing the detected port address, or `None` if no matching port was found.
        """
        logger.debug('Attempting to find Bluegiga dongle...')
        # TODO this will probably only work on Windows at the moment
        ports = list(serial.tools.list_ports.grep('Bluegiga'))
        if len(ports) == 0:
            logger.debug('No Bluegiga-named serial ports discovered')
            return None

        # just return the first port even if multiple dongles
        logger.debug('Found "Bluegiga" serial port at {}'.format(ports[0].device))
        return ports[0].device
def find_dongle_port ( ) : logger . debug ( 'Attempting to find Bluegiga dongle...' ) ports = list ( serial . tools . list_ports . grep ( 'Bluegiga' ) ) if len ( ports ) == 0 : logger . debug ( 'No Bluegiga-named serial ports discovered' ) return None logger . debug ( 'Found "Bluegiga" serial port at {}' . format ( ports [ 0 ] . device ) ) return ports [ 0 ] . device
Convenience method which attempts to find the port where a BLED112 dongle is connected.

        This relies on the `pyserial.tools.list_ports.grep method 
        <https://pyserial.readthedocs.io/en/latest/tools.html#serial.tools.list_ports.grep>`_, 
        and simply searches for a port containing the string "Bluegiga" in its description. 
        (This probably only works on Windows at the moment (TODO)).

        Returns:
            A string containing the detected port address, or `None` if no matching port was found.