How long can it take for a COM port to become available on Windows?How can I develop for iPhone using a Windows development machine?How can you find out which process is listening on a port on Windows?How do I install pip on Windows?Android 3.1+ USB as virtual COM portHow to forcibly free a COM port occupied by another application or has hungWMI query shows a single USB serial COM port?How to list com devices in Dos terminal?USB: Virtual COM port specificationScript for COM portsUnderlying hardware beneath virtual Com port

Will it be accepted, if there is no ''Main Character" stereotype?

Short story about space worker geeks who zone out by 'listening' to radiation from stars

Is this Spell Mimic feat balanced?

How was Earth single-handedly capable of creating 3 of the 4 gods of chaos?

How do I define a right arrow with bar in LaTeX?

Is there a problem with hiding "forgot password" until it's needed?

Why is delta-v is the most useful quantity for planning space travel?

Trouble understanding overseas colleagues

How do I rename a LINUX host without needing to reboot for the rename to take effect?

What to do with wrong results in talks?

What defines a dissertation?

What would be the benefits of having both a state and local currencies?

What is difference between behavior and behaviour

Is there any reason not to eat food that's been dropped on the surface of the moon?

Is it okay / does it make sense for another player to join a running game of Munchkin?

Hostile work environment after whistle-blowing on coworker and our boss. What do I do?

Bash method for viewing beginning and end of file

How can I get through very long and very dry, but also very useful technical documents when learning a new tool?

Can I Retrieve Email Addresses from BCC?

Is there any easy technique written in Bhagavad GITA to control lust?

Is expanding the research of a group into machine learning as a PhD student risky?

What's the purpose of "true" in bash "if sudo true; then"

Is HostGator storing my password in plaintext?

I'm in charge of equipment buying but no one's ever happy with what I choose. How to fix this?



How long can it take for a COM port to become available on Windows?


How can I develop for iPhone using a Windows development machine?How can you find out which process is listening on a port on Windows?How do I install pip on Windows?Android 3.1+ USB as virtual COM portHow to forcibly free a COM port occupied by another application or has hungWMI query shows a single USB serial COM port?How to list com devices in Dos terminal?USB: Virtual COM port specificationScript for COM portsUnderlying hardware beneath virtual Com port













0















After a USB device is plugged in, it takes a while for the device to enumerate on Windows and mount as a COM (virtual serial) port. It seems it can takes 2 seconds or more when the device is plugged in directly, or 10 seconds or more if plugged in via a hub.



I currently retry every 2 seconds if I get back "file not found" when attempting to open the COM port, for a maximum of 8 attempts. This means that I retry for around 16 seconds before presenting an error message. However, I sometimes still see the error message in remote logging, meaning that on some machines devices take longer than 16 seconds before they can be opened via a COM port.



Is there any reasonable upper bound that I can use as a timeout?










share|improve this question






















  • Do you have a UI? Can you put up some kind of progress dialog?

    – Anders
    Mar 21 at 16:14











  • Yes. Do you mean a popup like "Waiting for device.." with a Cancel button?

    – Gerrit
    Mar 21 at 16:47











  • Yes, something like that. If not, there might be some hardware arrival notifications you can use if this is some kind of unattended process.

    – Anders
    Mar 21 at 17:28











  • In this instance the user plugs in the device, presses an Upload button and expects it to work. Most of the time it does, but if it's the first time the device is plugged in it seems that it can take Windows a minute or more to install the drivers and get the device ready, and this is after the COM port number is available (but returns file not found if you actually try to open it).

    – Gerrit
    Mar 22 at 10:45















0















After a USB device is plugged in, it takes a while for the device to enumerate on Windows and mount as a COM (virtual serial) port. It seems it can takes 2 seconds or more when the device is plugged in directly, or 10 seconds or more if plugged in via a hub.



I currently retry every 2 seconds if I get back "file not found" when attempting to open the COM port, for a maximum of 8 attempts. This means that I retry for around 16 seconds before presenting an error message. However, I sometimes still see the error message in remote logging, meaning that on some machines devices take longer than 16 seconds before they can be opened via a COM port.



Is there any reasonable upper bound that I can use as a timeout?










share|improve this question






















  • Do you have a UI? Can you put up some kind of progress dialog?

    – Anders
    Mar 21 at 16:14











  • Yes. Do you mean a popup like "Waiting for device.." with a Cancel button?

    – Gerrit
    Mar 21 at 16:47











  • Yes, something like that. If not, there might be some hardware arrival notifications you can use if this is some kind of unattended process.

    – Anders
    Mar 21 at 17:28











  • In this instance the user plugs in the device, presses an Upload button and expects it to work. Most of the time it does, but if it's the first time the device is plugged in it seems that it can take Windows a minute or more to install the drivers and get the device ready, and this is after the COM port number is available (but returns file not found if you actually try to open it).

    – Gerrit
    Mar 22 at 10:45













0












0








0








After a USB device is plugged in, it takes a while for the device to enumerate on Windows and mount as a COM (virtual serial) port. It seems it can takes 2 seconds or more when the device is plugged in directly, or 10 seconds or more if plugged in via a hub.



I currently retry every 2 seconds if I get back "file not found" when attempting to open the COM port, for a maximum of 8 attempts. This means that I retry for around 16 seconds before presenting an error message. However, I sometimes still see the error message in remote logging, meaning that on some machines devices take longer than 16 seconds before they can be opened via a COM port.



Is there any reasonable upper bound that I can use as a timeout?










share|improve this question














After a USB device is plugged in, it takes a while for the device to enumerate on Windows and mount as a COM (virtual serial) port. It seems it can takes 2 seconds or more when the device is plugged in directly, or 10 seconds or more if plugged in via a hub.



I currently retry every 2 seconds if I get back "file not found" when attempting to open the COM port, for a maximum of 8 attempts. This means that I retry for around 16 seconds before presenting an error message. However, I sometimes still see the error message in remote logging, meaning that on some machines devices take longer than 16 seconds before they can be opened via a COM port.



Is there any reasonable upper bound that I can use as a timeout?







windows serial-port usb






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 21 at 15:26









GerritGerrit

550514




550514












  • Do you have a UI? Can you put up some kind of progress dialog?

    – Anders
    Mar 21 at 16:14











  • Yes. Do you mean a popup like "Waiting for device.." with a Cancel button?

    – Gerrit
    Mar 21 at 16:47











  • Yes, something like that. If not, there might be some hardware arrival notifications you can use if this is some kind of unattended process.

    – Anders
    Mar 21 at 17:28











  • In this instance the user plugs in the device, presses an Upload button and expects it to work. Most of the time it does, but if it's the first time the device is plugged in it seems that it can take Windows a minute or more to install the drivers and get the device ready, and this is after the COM port number is available (but returns file not found if you actually try to open it).

    – Gerrit
    Mar 22 at 10:45

















  • Do you have a UI? Can you put up some kind of progress dialog?

    – Anders
    Mar 21 at 16:14











  • Yes. Do you mean a popup like "Waiting for device.." with a Cancel button?

    – Gerrit
    Mar 21 at 16:47











  • Yes, something like that. If not, there might be some hardware arrival notifications you can use if this is some kind of unattended process.

    – Anders
    Mar 21 at 17:28











  • In this instance the user plugs in the device, presses an Upload button and expects it to work. Most of the time it does, but if it's the first time the device is plugged in it seems that it can take Windows a minute or more to install the drivers and get the device ready, and this is after the COM port number is available (but returns file not found if you actually try to open it).

    – Gerrit
    Mar 22 at 10:45
















Do you have a UI? Can you put up some kind of progress dialog?

– Anders
Mar 21 at 16:14





Do you have a UI? Can you put up some kind of progress dialog?

– Anders
Mar 21 at 16:14













Yes. Do you mean a popup like "Waiting for device.." with a Cancel button?

– Gerrit
Mar 21 at 16:47





Yes. Do you mean a popup like "Waiting for device.." with a Cancel button?

– Gerrit
Mar 21 at 16:47













Yes, something like that. If not, there might be some hardware arrival notifications you can use if this is some kind of unattended process.

– Anders
Mar 21 at 17:28





Yes, something like that. If not, there might be some hardware arrival notifications you can use if this is some kind of unattended process.

– Anders
Mar 21 at 17:28













In this instance the user plugs in the device, presses an Upload button and expects it to work. Most of the time it does, but if it's the first time the device is plugged in it seems that it can take Windows a minute or more to install the drivers and get the device ready, and this is after the COM port number is available (but returns file not found if you actually try to open it).

– Gerrit
Mar 22 at 10:45





In this instance the user plugs in the device, presses an Upload button and expects it to work. Most of the time it does, but if it's the first time the device is plugged in it seems that it can take Windows a minute or more to install the drivers and get the device ready, and this is after the COM port number is available (but returns file not found if you actually try to open it).

– Gerrit
Mar 22 at 10:45












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55283897%2fhow-long-can-it-take-for-a-com-port-to-become-available-on-windows%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55283897%2fhow-long-can-it-take-for-a-com-port-to-become-available-on-windows%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript