~ni/nxt-python

6621ea4ffdd014c319ff26283da5c73d76efb30d — Nicolas Schodet 5 months ago ab75eb7
Do not reset USB device on Windows

This is a workaround, no good explanation for now.

Closes https://github.com/schodet/nxt-python/issues/182
1 files changed, 6 insertions(+), 1 deletions(-)

M nxt/backend/usb.py
M nxt/backend/usb.py => nxt/backend/usb.py +6 -1
@@ 15,6 15,7 @@
# GNU General Public License for more details.

import logging
import os

import usb.core



@@ 53,7 54,11 @@ class USBSock:
        :rtype: Brick
        """
        logger.info("connecting via %s", self)
        self._dev.reset()
        if os.name != "nt":
            # Do not reset device on Windows, see
            # https://github.com/schodet/nxt-python/issues/182 and
            # https://github.com/schodet/nxt-python/issues/33
            self._dev.reset()
        self._dev.set_configuration()
        intf = self._dev.get_active_configuration()[(0, 0)]
        self._epout, self._epin = intf