USB-COM with persistent handle across disconnect-reconnects.

The bus driver gives you dynamically enumerable com ports (the ones that never go away), so there isn’t much of an advantage other than you can at runtime decide how many ports to expose to the app. OTOH i am guessing the app has a fixed set of com port numbers it opens, so dynamicism is not desired here either

d

Bent from my phone


From: Roscoe Casitamailto:xxxxx
Sent: ?9/?3/?2014 6:45 PM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: RE: [ntdev] USB-COM with persistent handle across disconnect-reconnects.

What’s the advantages/disadvantages of the two approaches?

On Sep 3, 2014 6:41 PM, “Doron Holan” > wrote:
You can go with one driver root enumerated N times or have one root enumerated driver that enumerates N PDOs that a second driver loads on.

d

Bent from my phone
________________________________
From: Roscoe Casitamailto:xxxxx
Sent: ?9/?3/?2014 6:32 PM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: Re: [ntdev] USB-COM with persistent handle across disconnect-reconnects.

I believe this is how the current driver works, simple one to one root enumerated device that reconnects as needed.

The goal is to move this to wdf for maintainability.

I was curious about using the bus based approach to enum the device s as needed, so that we only have 1 root enumerated bus, with child fdo’s.

On Sep 3, 2014 6:28 PM, “Mark Roddy” > wrote:
If the driver is not allowing the USB enumerated PDO to complete removal (by for example blocking things at the FDO level) that might account for the bugcheck. Instead of hanging the serial PDOs off of a hot-pluggable FDO, instead a root enumerated FDO could be used for the bus functionality, allowing the related USB FDOs to come and go as needed and maintaining the state of the serial PDOs as per your handle based approach.

Mark Roddy

On Wed, Sep 3, 2014 at 7:41 PM, Roscoe Casita > wrote:

These are usually old point of sale terminals that open a com port at the start of the day, run until close if the store then shutdown.

The problem happens when you unplug or reset the USB scanner device.

Usbser.sys will reattach to the device, but the program still has a handle to the old com port open, which is not reconnected, and usbser enumerates a new com port.

The current driver will enumerate a serial port when the device attaches, and will keep it ‘alive’ as long as a program still has an open handle to the serial port. The driver will reconnect the serial port to the device if it was still active. If the device leaves while no handle is open, or the handle is closed while the device is not attached, then the serial port is removed from the system.

The idea was to use the bus driver to enumerate the serial port, maintain the persistence of the serial port side, facilitate the reconnection, and removal when appropriate.

Let me know any other questions and I will do my best to answer them.

On Sep 3, 2014 4:31 PM, > wrote:
Hmmmm… Which handle gets closed when who resets which the device, by doing what exactly?

Peter
OSR
@OSRDrivers


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
— NTDEV is sponsored by OSR Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See http://www.osr.com/careers For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

— NTDEV is sponsored by OSR Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See http://www.osr.com/careers For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
— NTDEV is sponsored by OSR Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See http://www.osr.com/careers For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
— NTDEV is sponsored by OSR Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See http://www.osr.com/careers For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx>

This might actually be the desired behavior, I’ll dig and learn some

Thanks again, and I appreciate the directional help!

(FYI I will be attending a seminar in the near future from a very reputable
company to further enhance my lack of knowledge.)
On Sep 3, 2014 7:22 PM, “Doron Holan” wrote:

> The bus driver gives you dynamically enumerable com ports (the ones that
> never go away), so there isn’t much of an advantage other than you can at
> runtime decide how many ports to expose to the app. OTOH i am guessing the
> app has a fixed set of com port numbers it opens, so dynamicism is not
> desired here either
>
> d
>
> Bent from my phone
> ------------------------------
> From: Roscoe Casita
> Sent: ‎9/‎3/‎2014 6:45 PM
> To: Windows System Software Devs Interest List
> Subject: RE: [ntdev] USB-COM with persistent handle across
> disconnect-reconnects.
>
> What’s the advantages/disadvantages of the two approaches?
> On Sep 3, 2014 6:41 PM, “Doron Holan” wrote:
>
>> You can go with one driver root enumerated N times or have one root
>> enumerated driver that enumerates N PDOs that a second driver loads on.
>>
>> d
>>
>> Bent from my phone
>> ------------------------------
>> From: Roscoe Casita
>> Sent: ‎9/‎3/‎2014 6:32 PM
>> To: Windows System Software Devs Interest List
>> Subject: Re: [ntdev] USB-COM with persistent handle across
>> disconnect-reconnects.
>>
>> I believe this is how the current driver works, simple one to one root
>> enumerated device that reconnects as needed.
>>
>> The goal is to move this to wdf for maintainability.
>>
>> I was curious about using the bus based approach to enum the device s as
>> needed, so that we only have 1 root enumerated bus, with child fdo’s.
>> On Sep 3, 2014 6:28 PM, “Mark Roddy” wrote:
>>
>>> If the driver is not allowing the USB enumerated PDO to complete removal
>>> (by for example blocking things at the FDO level) that might account for
>>> the bugcheck. Instead of hanging the serial PDOs off of a hot-pluggable
>>> FDO, instead a root enumerated FDO could be used for the bus functionality,
>>> allowing the related USB FDOs to come and go as needed and maintaining the
>>> state of the serial PDOs as per your handle based approach.
>>>
>>> Mark Roddy
>>>
>>>
>>> On Wed, Sep 3, 2014 at 7:41 PM, Roscoe Casita
>>> wrote:
>>>
>>>> These are usually old point of sale terminals that open a com port at
>>>> the start of the day, run until close if the store then shutdown.
>>>>
>>>> The problem happens when you unplug or reset the USB scanner device.
>>>>
>>>> Usbser.sys will reattach to the device, but the program still has a
>>>> handle to the old com port open, which is not reconnected, and usbser
>>>> enumerates a new com port.
>>>>
>>>> The current driver will enumerate a serial port when the device
>>>> attaches, and will keep it ‘alive’ as long as a program still has an open
>>>> handle to the serial port. The driver will reconnect the serial port to the
>>>> device if it was still active. If the device leaves while no handle is
>>>> open, or the handle is closed while the device is not attached, then the
>>>> serial port is removed from the system.
>>>>
>>>> The idea was to use the bus driver to enumerate the serial port,
>>>> maintain the persistence of the serial port side, facilitate the
>>>> reconnection, and removal when appropriate.
>>>>
>>>> Let me know any other questions and I will do my best to answer them.
>>>> On Sep 3, 2014 4:31 PM, wrote:
>>>>
>>>>> Hmmmm… Which handle gets closed when who resets which the device, by
>>>>> doing what exactly?
>>>>>
>>>>> Peter
>>>>> OSR
>>>>> @OSRDrivers
>>>>>
>>>>> —
>>>>> NTDEV is sponsored by OSR
>>>>>
>>>>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>>>>
>>>>> OSR is HIRING!! See http://www.osr.com/careers
>>>>>
>>>>> For our schedule of WDF, WDM, debugging and other seminars visit:
>>>>> http://www.osr.com/seminars
>>>>>
>>>>> To unsubscribe, visit the List Server section of OSR Online at
>>>>> http://www.osronline.com/page.cfm?name=ListServer
>>>>>
>>>> — NTDEV is sponsored by OSR Visit the list at:
>>>> http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See
>>>> http://www.osr.com/careers For our schedule of WDF, WDM, debugging and
>>>> other seminars visit: http://www.osr.com/seminars To unsubscribe,
>>>> visit the List Server section of OSR Online at
>>>> http://www.osronline.com/page.cfm?name=ListServer
>>>>
>>>
>>> — NTDEV is sponsored by OSR Visit the list at:
>>> http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See
>>> http://www.osr.com/careers For our schedule of WDF, WDM, debugging and
>>> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
>>> the List Server section of OSR Online at
>>> http://www.osronline.com/page.cfm?name=ListServer
>>
>> — NTDEV is sponsored by OSR Visit the list at:
>> http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See
>> http://www.osr.com/careers For our schedule of WDF, WDM, debugging and
>> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
>> the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>
>> OSR is HIRING!! See http://www.osr.com/careers
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
> — NTDEV is sponsored by OSR Visit the list at:
> http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See
> http://www.osr.com/careers For our schedule of WDF, WDM, debugging and
> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
> the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Well… Let’s hope we don’t further enhance your LACK of knowledge!!

I look forward to seeing you in our WDF Seminar in a few weeks in Boston. You won’t BELIEVE how much you learn about WDF in just five days: http:

Peter
OSR
@OSRDrivers</http:>

> Well… Let’s hope we don’t further enhance your LACK of knowledge!!

The more I learn, the more I realize I don’t know :slight_smile:

BRGDS,

Dave Cattley

The recent post by Doron about IoGetRequestorSessionId is a good sample.

Not all of us were aware on this call.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

“Dave Cattley” wrote in message news:xxxxx@ntdev…
> Well… Let’s hope we don’t further enhance your LACK of knowledge!!

The more I learn, the more I realize I don’t know :slight_smile:

BRGDS,

Dave Cattley

What if you create a background application that clears the registy HKLM\SYSTEM\CCS\Control\COM Arbiter before you plug in the USB device?

Sorta hacky, and if you have more than one device, you might still have problems.

Tony

Clearing out the arbiter didn’t make existing handles go away or persistent. And he isn’t having the problem of the reinserted device getting a new com name, so touching this value doesn’t help in the slightest.

d

Bent from my phone


From: xxxxx@rtd.commailto:xxxxx
Sent: ?9/?5/?2014 6:33 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: RE:[ntdev] USB-COM with persistent handle across disconnect-reconnects.

What if you create a background application that clears the registy HKLM\SYSTEM\CCS\Control\COM Arbiter before you plug in the USB device?

Sorta hacky, and if you have more than one device, you might still have problems.

Tony


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx>