Giter VIP home page Giter VIP logo

Comments (2)

zsquareplusc avatar zsquareplusc commented on May 27, 2024

When the device disappears and reapers while the port is open, it won't work under the old name. Other operating systems tend to assign a new device in such cases, e.g. under Linux, it may become /dv/ttyUSB1 and /dev/ttyUSB0 will disappear as soon as the application closes the port. Windows tries to assign the same COM port for the device so the old instance shadows the new one, or something like that.

I know of no workaround. Maybe there are solutions, e.g. if the device is connected through a hub, the hub could be disabled or the device itself could be powered down. USB has such commands but i do not know of a Windows API that exposes these (never looked for that).
Alternatively, make your device slower so that the PC can close the port before the device reappears on USB... like an additional delay at startup (maybe only when the device is in test mode).

A silly alternative would be to use two (or more?) alternating serial numbers for the device, so it would get a different COM port after each reboot of the device. But i would not suggest to really do this.

from pyserial.

n-epifanov avatar n-epifanov commented on May 27, 2024

Hope it helps someone to come up with a solution: this problem has a workaround for C# http://stackoverflow.com/a/9057158/396583 And it works reliably. Port gets reopened alright after replugging USB cable.

from pyserial.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.