W2K Unplug warning message question.

Hi all,

I’m working on a W2K USB device driver, and one of my clients is complaining
that when he removes the USB device, W2K pops a warning window saying that
he has to stop the device before unpluging it.

My client says that there are USB devices that have the same functionality
than ours (USB - MODEM) that do not have this message…

So my question is:

What needs to be changed in a driver to no longer have this warning
message??

Thanks for any help on this.

Steve


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Maybe you have to set this flag?:

typedef struct _DEVICE_CAPABILITIES {

ULONG SurpriseRemovalOK:1;

} DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES;

This structure is returned in response to IRP_MN_QUERY_CAPABILITIES.


Dave Cox
Hewlett-Packard Co.
SSO/OVBU/SRM (Santa Barbara)
https://ecardfile.com/id/Dave+Cox

-----Original Message-----
From: Steve Goddyn [mailto:xxxxx@trisignal.com]
Sent: Monday, July 16, 2001 9:09 AM
To: NT Developers Interest List
Subject: [ntdev] W2K Unplug warning message question.

Hi all,

I’m working on a W2K USB device driver, and one of my clients
is complaining
that when he removes the USB device, W2K pops a warning
window saying that
he has to stop the device before unpluging it.

My client says that there are USB devices that have the same
functionality
than ours (USB - MODEM) that do not have this message…

So my question is:

What needs to be changed in a driver to no longer have this warning
message??

Thanks for any help on this.

Steve


You are currently subscribed to ntdev as: david_cox2@hp.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

You are correct.

I found it in Walter Oney’s WDM book at page 234 :wink:

Thanks

-----Original Message-----
From: COX,DAVID (HP-Roseville,ex1) [mailto:david_cox2@hp.com]
Sent: July 16, 2001 1:10 PM
To: NT Developers Interest List
Subject: [ntdev] RE: W2K Unplug warning message question.

Maybe you have to set this flag?:

typedef struct _DEVICE_CAPABILITIES {

ULONG SurpriseRemovalOK:1;

} DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES;

This structure is returned in response to IRP_MN_QUERY_CAPABILITIES.


Dave Cox
Hewlett-Packard Co.
SSO/OVBU/SRM (Santa Barbara)
https://ecardfile.com/id/Dave+Cox

-----Original Message-----
From: Steve Goddyn [mailto:xxxxx@trisignal.com]
Sent: Monday, July 16, 2001 9:09 AM
To: NT Developers Interest List
Subject: [ntdev] W2K Unplug warning message question.

Hi all,

I’m working on a W2K USB device driver, and one of my clients
is complaining
that when he removes the USB device, W2K pops a warning
window saying that
he has to stop the device before unpluging it.

My client says that there are USB devices that have the same
functionality
than ours (USB - MODEM) that do not have this message…

So my question is:

What needs to be changed in a driver to no longer have this warning
message??

Thanks for any help on this.

Steve


You are currently subscribed to ntdev as: david_cox2@hp.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@trisignal.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Don’t forget to set this on the IRP’s way down AND on it’s way back up.

Marc Reinig
System Solutions

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of COX,DAVID
(HP-Roseville,ex1)
Sent: Monday, July 16, 2001 10:10 AM
To: NT Developers Interest List
Subject: [ntdev] RE: W2K Unplug warning message question.

Maybe you have to set this flag?:

typedef struct _DEVICE_CAPABILITIES {

ULONG SurpriseRemovalOK:1;

} DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES;

This structure is returned in response to IRP_MN_QUERY_CAPABILITIES.


Dave Cox
Hewlett-Packard Co.
SSO/OVBU/SRM (Santa Barbara)
https://ecardfile.com/id/Dave+Cox

-----Original Message-----
From: Steve Goddyn [mailto:xxxxx@trisignal.com]
Sent: Monday, July 16, 2001 9:09 AM
To: NT Developers Interest List
Subject: [ntdev] W2K Unplug warning message question.

Hi all,

I’m working on a W2K USB device driver, and one of my clients
is complaining
that when he removes the USB device, W2K pops a warning
window saying that
he has to stop the device before unpluging it.

My client says that there are USB devices that have the same
functionality
than ours (USB - MODEM) that do not have this message…

So my question is:

What needs to be changed in a driver to no longer have this warning
message??

Thanks for any help on this.

Steve


You are currently subscribed to ntdev as: david_cox2@hp.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@pacbell.net
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Please check KB article Q298504: HOWTO: Avoid Unsafe Removal Dialog
Box(http://support.microsoft.com/support/kb/articles/Q298/5/04.ASP?)

Regards,
Ravi.

-----Original Message-----
From: Steve Goddyn [mailto:xxxxx@trisignal.com]
Sent: Monday, July 16, 2001 9:09 AM
To: NT Developers Interest List
Subject: [ntdev] W2K Unplug warning message question.

Hi all,

I’m working on a W2K USB device driver, and one of my clients
is complaining that when he removes the USB device, W2K pops
a warning window saying that he has to stop the device before
unpluging it.

My client says that there are USB devices that have the same
functionality than ours (USB - MODEM) that do not have this message…

So my question is:

What needs to be changed in a driver to no longer have this
warning message??

Thanks for any help on this.

Steve


You are currently subscribed to ntdev as: xxxxx@microsoft.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

This response caught my eye…

I would think that if you set the flag on the way down, and something under
you changed it, one would assume that the device under you knew something
you didn’t. So you set the flag as your ‘vote,’ then the lower layers can
outvote you if need be.

If you set it again on the way up, you may be overriding an important
change.

Or, on the other hand, if this is a situation where you should have the
final say, I would think that you would only set it on the way up. I’d
argue that if something is relevent to pass down, don’t change it on the way
up. And if it has no relevence on the way down, there is no point in
setting it on the way down.

I’m not sure how clear I am here…but in short, I think if you are setting
the flag twice you may be breaking something.

-Evan Hillman

Don’t forget to set this on the IRP’s way down AND on it’s way back up.

Marc Reinig
System Solutions

Subject: [ntdev] RE: W2K Unplug warning message question.

Maybe you have to set this flag?:

typedef struct _DEVICE_CAPABILITIES {

ULONG SurpriseRemovalOK:1;

} DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES;

This structure is returned in response to IRP_MN_QUERY_CAPABILITIES.


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

This is a work around for a bug in the USB stack ( I forget where, I think
someone mentioned the KB article that deals with it). You would normally
set it on the way down and forget it. However, the USB Bus driver (I think)
erroneously resets the flag. So, as a work around, we set it on the way up
also.

Marc Reinig
System Solutions

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Evan Hillman
Subject: [ntdev] RE: W2K Unplug warning message question.

I would think that if you set the flag on the way down, and something under
you changed it, one would assume that the device under you knew something
you didn’t. So you set the flag as your ‘vote,’ then the lower layers can
outvote you if need be.

If you set it again on the way up, you may be overriding an important
change.

Or, on the other hand, if this is a situation where you should have the
final say, I would think that you would only set it on the way up. I’d
argue that if something is relevent to pass down, don’t change it on the way
up. And if it has no relevence on the way down, there is no point in
setting it on the way down.

I’m not sure how clear I am here…but in short, I think if you are setting
the flag twice you may be breaking something.

-Evan Hillman

Don’t forget to set this on the IRP’s way down AND on it’s way back up.

Marc Reinig
System Solutions

Subject: [ntdev] RE: W2K Unplug warning message question.

Maybe you have to set this flag?:

typedef struct _DEVICE_CAPABILITIES {

ULONG SurpriseRemovalOK:1;

} DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES;

This structure is returned in response to IRP_MN_QUERY_CAPABILITIES.


You are currently subscribed to ntdev as: xxxxx@pacbell.net
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

On 07/16/01, “Marc Reinig ” wrote:
> This is a work around for a bug in the USB stack ( I forget where, I think
> someone mentioned the KB article that deals with it). You would normally
> set it on the way down and forget it. However, the USB Bus driver (I think)
> erroneously resets the flag. So, as a work around, we set it on the way up
> also.
>
> Marc Reinig
> System Solutions

Well not exactly. The problem is with the bus driver. But it isn’t just
the USB bus driver, it is every bus driver in existance AFAIK, so this
would hold for 1394 devices as well. The DDK docs say to add functionality
as the IRP_MN_QUERY_CAPABILITIES IRP makes its way down the device stack,
and take away functionality as it goes up. These docs are bogus. If you
want to know exactly why, look at the Toaster bus driver sample in the DDK,
and see what the PDO does with the DEVICE_CAPABILITIES structure when the
capabilities IRP gets to it. The PDO’s handler pretty well blows the whole
structure away without looking at it. So, anything you do on the way down,
will only get to the drivers below you, but above the PDO. Once the PDO
gets a hold of this, most if not all changes are gone and forgotten. The
toaster bus itself happens to set the SurpriseRemovalOk bit, but this isn’t
typical. So, you have to set the SurpriseRemovalOk bit as the IRP goes up
the stack. For an NDIS device this is a big problem because NDIS devices
don’t handle PnP IRPs. So, what you have to do is create a WDM upperfilter
for your NDIS miniport. Have the WDM filter pass everything through except
the IRP_MN_QUERY_CAPABILITIES IRP and have it set the SurpriseRemovalOk bit
for your NDIS device, again on the IRP’s way up the stack. Now, on XP this
is no longer necessary as Microsoft added a call called
NdisMSetAttributesEx and that call lets you set this bit for NDIS devices.

But, if you use an Anchor/Cypress EZ-USB device make sure that you delay
flipping the VID/PID through the firmware download until after this
surprise remove bit has been set, or the user could get the ugly pop-up
from the device appearing unplugged to the OS even though you intended to
allow Surprise removes to be okay. This would be really confusing to the
user as the device never leaves the socket. I don’t know how you ensure
this timing with an NDIS driver??

Bill McKenzie
Software Engineer
bSquare Corporation


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> Well not exactly. The problem is with the bus driver. But it isn’t just

the USB bus driver, it is every bus driver in existance AFAIK, so this
would hold for 1394 devices as well. The DDK docs say to add
functionality

Strange thing. 1394bus sets SurpriseRemovalOk = 0 and Removable = 1.
After this, removal of things like sonydcam does not cause the surprise
removal dialogs.

Max


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Hi,

You can try to request device eject by IoRequestEject() before doing actual
remove of the device PDO.

Regards,
Anton Kolomyeytsev

CoolDev.Com - Toolkits for Network & Storage Kernel Software Developers
“KoolSockets” & “KoolStorage” - TDI Client, Kernel Sockets, SCSI
port/miniport
http://www.CoolDev.Com xxxxx@CoolDev.Com
xxxxx@CoolDev.Com

On 07/16/01, “Steve Goddyn ” wrote:
> Hi all,
>
> I’m working on a W2K USB device driver, and one of my clients is complaining
> that when he removes the USB device, W2K pops a warning window saying that
> he has to stop the device before unpluging it.
>
> My client says that there are USB devices that have the same functionality
> than ours (USB - MODEM) that do not have this message…
>
> So my question is:
>
> What needs to be changed in a driver to no longer have this warning
> message??
>
> Thanks for any help on this.
>
> Steve
>
> —
> You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

On 07/17/01, “xxxxx@hotmail.com” wrote:

Hi,

You can try to request device eject by IoRequestEject() before doing actual
remove of the device PDO.

Regards,
Anton Kolomyeytsev

This is the same as requesting the eject manually before unplugging the
device and is not a solution to this problem. If you request an eject
before unplugging the device this is a ‘safe’ removal and is not a surprise
remove. The only way to prevent the surprise removal pop-up is to set the
SurpriseRemovalOk bit in the device capabilities structure as the
capabilities IRP is making its way up the stack.

Bill M.


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

On 07/17/01, ““Maxim S. Shatskih” ” wrote:
> > Well not exactly. The problem is with the bus driver. But it isn’t just
> > the USB bus driver, it is every bus driver in existance AFAIK, so this
> > would hold for 1394 devices as well. The DDK docs say to add
> functionality
>
> Strange thing. 1394bus sets SurpriseRemovalOk = 0 and Removable = 1.
> After this, removal of things like sonydcam does not cause the surprise
> removal dialogs.
>
> Max
>

That is weird, I hadn’t noticed that before. It doesn’t work for the image
class in general, because I have another image device and it causes the
pop-up.

Bill M.


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com