disabling safely remove for USB

I am having a USB device which shows in “Safely remove hardware” option. How should i avoid the device being listed in “safely remove hardware” option.

Thanks,
Prasanna

USB devices have to be hot unpluggable as they are hot unpluggable.

Mark Roddy

On Wed, Aug 4, 2010 at 7:37 AM, wrote:

> I am having a USB device which shows in “Safely remove hardware” option.
> How should i avoid the device being listed in “safely remove hardware”
> option.
>
> Thanks,
> Prasanna
>
> —
> NTDEV is sponsored by OSR
>
> 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
>

>

USB devices have to be hot unpluggable as they are hot unpluggable.

That’s a given. I think the OP wants to know if you can remove the
‘Safely remove hardware’ option and just leave it to the user to yank
the device when they want. Not sure why you’d want to do that though…

James

> > USB devices have to be hot unpluggable as they are hot unpluggable.

That’s a given. I think the OP wants to know if you can remove the
‘Safely remove hardware’ option and just leave it to the user to yank
the device when they want. Not sure why you’d want to do that though…

… because with the ‘Safely remove hardware’ option the user MUST click it first or incur the wrath of Windows admonishing them for not clicking the option first.

Tim.

> the device when they want. Not sure why you’d want to do that though…

Maybe because OPs device doesn’t loose any persistent data when
disconnected at arbitrary times. (Like an audio I/O).
I am also curious how to do this,

[MyDriver_AddReg]
HKR,“RemovalPolicy”,0x00010001,3

does set the RemovalPolicy and WdfDeviceQueryProperty() with
DevicePropertyRemovalPolicy returns the correct RemovalPolicy but it
doesn’t change the fact Windows still offers the safe-removal option.
There is no way for my device to be removed “unsafe”.

Best,
Hagen.

On Wed, Aug 4, 2010 at 2:14 PM, James Harper
wrote:
>>
>> USB devices have to be hot unpluggable as they are hot unpluggable.
>>
>
> That’s a given. I think the OP wants to know if you can remove the
> ‘Safely remove hardware’ option and just leave it to the user to yank
> the device when they want. Not sure why you’d want to do that though…
>
> James
>
>
> —
> NTDEV is sponsored by OSR
>
> 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
>

In WDM, set the DEVICE_CAPABILITIES::SurpriseRemovalOk bit.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
>I am having a USB device which shows in “Safely remove hardware” option. How should i avoid the device being listed in “safely remove hardware” option.
>
> Thanks,
> Prasanna
>

for WDF it is the WDF_DEVICE_CAPABILITIES.EjectSupported and
WDF_DEVICE_CAPABILITIES.Removable set in WdfDeviceSetPnpCapabilities.
Translate for WDM. But I’ll go back to my truism - usb devices should set
both these values to true. Your device is removable. It has to be. Set
SurpriseRemoveOK to true to avoid nasty-grams.

Mark Roddy

On Wed, Aug 4, 2010 at 8:42 AM, stephan o’farrill <
xxxxx@gmail.com> wrote:

> the device when they want. Not sure why you’d want to do that though…

Maybe because OPs device doesn’t loose any persistent data when
disconnected at arbitrary times. (Like an audio I/O).
I am also curious how to do this,

[MyDriver_AddReg]
HKR,“RemovalPolicy”,0x00010001,3

does set the RemovalPolicy and WdfDeviceQueryProperty() with
DevicePropertyRemovalPolicy returns the correct RemovalPolicy but it
doesn’t change the fact Windows still offers the safe-removal option.
There is no way for my device to be removed “unsafe”.

Best,
Hagen.

On Wed, Aug 4, 2010 at 2:14 PM, James Harper
wrote:
> >>
> >> USB devices have to be hot unpluggable as they are hot unpluggable.
> >>
> >
> > That’s a given. I think the OP wants to know if you can remove the
> > ‘Safely remove hardware’ option and just leave it to the user to yank
> > the device when they want. Not sure why you’d want to do that though…
> >
> > James
> >
> >
> > —
> > NTDEV is sponsored by OSR
> >
> > 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
>
> 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
>

USB devices are not always removable. If you buy a new laptop today chances are it has at least one embedded USB attached device with is not physically user removable in the usual sense. In that case you normally do not want the device to show up in the Safely Remove Hardware list because if you safely remove the device there you cannot just unplug and re-plug the device to get it to come back again.

For those devices which are really non-removable you would ideally clear the DEVICE_CAPABILITIES Removable bit.

-Glen

yes that is true - embedded usb devices are not physically removable, but I
am not convinced you really want to disable remove.

Mark Roddy

On Wed, Aug 4, 2010 at 1:49 PM, wrote:

> USB devices are not always removable. If you buy a new laptop today
> chances are it has at least one embedded USB attached device with is not
> physically user removable in the usual sense. In that case you normally do
> not want the device to show up in the Safely Remove Hardware list because if
> you safely remove the device there you cannot just unplug and re-plug the
> device to get it to come back again.
>
> For those devices which are really non-removable you would ideally clear
> the DEVICE_CAPABILITIES Removable bit.
>
> -Glen
>
> —
> NTDEV is sponsored by OSR
>
> 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
>

Some of our customers resist on it when our device is built-in. If I
remember correctly, it can be even described in ACPI tables for given
USB port. And then there are some test which check it and there has to
be a correspondence.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com http:</http:>]


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mark Roddy
Sent: Wednesday, August 04, 2010 8:51 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] disabling safely remove for USB

yes that is true - embedded usb devices are not physically
removable, but I am not convinced you really want to disable remove.

Mark Roddy

On Wed, Aug 4, 2010 at 1:49 PM, wrote:

USB devices are not always removable. If you buy a new
laptop today chances are it has at least one embedded USB attached
device with is not physically user removable in the usual sense. In
that case you normally do not want the device to show up in the Safely
Remove Hardware list because if you safely remove the device there you
cannot just unplug and re-plug the device to get it to come back again.

For those devices which are really non-removable you
would ideally clear the DEVICE_CAPABILITIES Removable bit.

-Glen


NTDEV is sponsored by OSR

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 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