Detecting removal of uninstalled usb device

Hello,
I have an application where I am setting a serial number in a USB device. I then remove the device from the Registry using Devcon (Devcon will not uninstall the device if it isn't plugged in). At this point I want the operator to unplug the device from the cable. My problem is that with the device uninstalled Devcon doesn't report the unplug event.
However, Device Manager will refresh upon unplugging the device, even with it uninstalled. So something tells it to refresh. How do I tap into that?
And I did look at this link, but couldn't get it to help me. Did I miss something there?
http://forums.ni.com/ni/board/message?board.id=170&message.id=249567&requireLogin=False
Tay
Solved!
Go to Solution.

One of the annoying bits about URLs is that they're static, so if the target no longer exists, or has been moved, the links are no longer valid. I know the two links that I had provided in my response in that other thread are no longer valid. The first one pointed to a LAVA thread that no longer exists. LAVA had a major server failure a while back. The other link points to a project that was moved to a new location. Don't know about George's site.
As for what to do now, one thing that you can do is to use the Windows Message Queue Library.  The example that ships with the library is pretty self-explanatory. In your case you would want to listen to the WM_DEVICECHANGE message. The readme contained within the archive lists the values for the various messages. 
Message Edited by smercurio_fc on 04-01-2010 09:36 AM

Similar Messages

  • HP Recovery usb device failed

    have a new HP laptop:
    HP ENVY 15t-j100 Select Edition CTO Notebook PC (ENERGY STAR)
     Product Number: E9W31AV
    Several hours after its first boot the laptop failed to load and I got a message saying it can't load win 8.1 os.
    (this was two month ago and since then I am trying to recover it without any success).
    HP US support sent me a recovery usb device with win 8.1
    Before connecting it and starting the recovery:
    1. I did a System Diagnostics. All Passed (memory & hard drive).
    2. I reset the bios to default factory settings (and change the 'usb 3.0 configuration in pre-os to Auto, in case the usb is 2.0).
    3. I connected the recovery usb directly (no hub).
    I started the recovery...
    I finished the "factory image recovery preparations" stage successfully:
    I entered Skip and after that i removed the recovery usb device and continue the recovery by pressing "Continue":
    After that the laptop boot and started "Software Installation" stage:
    After several minutes it boot again and I got the following screen:
    I saved the recovery logs to an external device and this it is saying:
    [ 8:49:57.64] Failed to configure RAID0 + SRT
    [ 8:49:57.65] Please check C:\System.sav\Logs\RSTPrep.log for more information
    [ 8:50:53.50] ------------------------------------------------------------------------------------------
    ***CTO Error condition has been dtected in [Factory Update] phase !! ***
    [ 8:50:53.50] Suggest to create PIN-log and send to TWN PDC NB-PreinPM for further analysis ...
    [ 8:50:53.50] ------------------------------------------------------------------------------------------
    I opened the file ..\System.sav\Logs\RSTPrep.log and i can see the following error:
     RST_BIT=[64]
      Disk Controller and Driver's information
    Name   : Intel(R) Mobile Express Chipset SATA RAID Controller
    PNP    : PCI\VEN_8086&DEV_282A&SUBSYS_1967103C&REV_05\3&11583659&0&FA
    Service: iaStorA
    Driver : X:\windows\System32\drivers\iaStorA.sys
    Version: 12.8.1.1000
    Name   : Microsoft Storage Spaces Controller
    PNP    : ROOT\SPACEPORT\0000
    Service: spaceport
    Driver : X:\windows\System32\drivers\spaceport.sys
    Version: 6.3.9600.16384
    ---------- C:\HP\BIN\RSTONE.INI
    iFFS=1
    [ 8:49:57.32] RStone.ini shows iFFS=1.
    [ 8:49:57.32] System supports mSATA/SSD.
    [ 8:49:57.48] Get parameter from RST.ini...
    [ 8:49:57.56] CACHE_SIZE=0
    [ 8:49:57.56] RST_MODE=maximized
    [ 8:49:57.56] Get m-SATA bus index...
    [ 8:49:57.64] Could not find m-SATA bus...
    [ 8:49:57.64] Failed to configure RAID0 + SRT
    Here are the full logs on DropBox share:
    https://dl.dropboxusercontent.com/u/30077049/HP%20Recovery%20Logs/HP_SSRD_LOG.CAB
    I did everything "by the book", got the same errors 5 times for the above scenario and 5 other times for other bios config (enable\disable features).
    What is the problem?
    It is Hardware issue?
    configuration issue?
    Something related to UEFI \ RAID ?
    Is it possibile to solve it myself?
    Is there a tool i can use?
    I am living outside the US and I don't have an option to send the laptop to HP lab in the US, but Only in my country - Israel.
    The following are my BIOS config screen :
    Thank You!

    have a new HP laptop:
    HP ENVY 15t-j100 Select Edition CTO Notebook PC (ENERGY STAR)
     [photo removed because it contained product serial number]
    Several hours after its first boot the laptop failed to load and I got a message saying it can't load win 8.1 os.
    (this was two month ago and since then I am trying to recover it without any success).
    HP US support sent me a recovery usb device with win 8.1
    Before connecting it and starting the recovery:
    1. I did a System Diagnostics. All Passed (memory & hard drive).
    2. I reset the bios to default factory settings (and change the 'usb 3.0 configuration in pre-os to Auto, in case the usb is 2.0).
    3. I connected the recovery usb directly (no hub).
    I started the recovery...
    I finished the "factory image recovery preparations" stage successfully:
    I entered Skip and after that i removed the recovery usb device and continue the recovery by pressing "Continue":
    After that the laptop boot and started "Software Installation" stage:
    After several minutes it boot again and I got the following screen:
    I saved the recovery logs to an external device and this it is saying:
    [ 8:49:57.64] Failed to configure RAID0 + SRT
    [ 8:49:57.65] Please check C:\System.sav\Logs\RSTPrep.log for more information
    [ 8:50:53.50] ------------------------------------------------------------------------------------------
    ***CTO Error condition has been dtected in [Factory Update] phase !! ***
    [ 8:50:53.50] Suggest to create PIN-log and send to TWN PDC NB-PreinPM for further analysis ...
    [ 8:50:53.50] ------------------------------------------------------------------------------------------
    I opened the file ..\System.sav\Logs\RSTPrep.log and i can see the following error:
     RST_BIT=[64]
      Disk Controller and Driver's information
    Name   : Intel(R) Mobile Express Chipset SATA RAID Controller
    PNP    : PCI\VEN_8086&DEV_282A&SUBSYS_1967103C&REV_05\3&11583659&0&FA
    Service: iaStorA
    Driver : X:\windows\System32\drivers\iaStorA.sys
    Version: 12.8.1.1000
    Name   : Microsoft Storage Spaces Controller
    PNP    : ROOT\SPACEPORT\0000
    Service: spaceport
    Driver : X:\windows\System32\drivers\spaceport.sys
    Version: 6.3.9600.16384
    ---------- C:\HP\BIN\RSTONE.INI
    iFFS=1
    [ 8:49:57.32] RStone.ini shows iFFS=1.
    [ 8:49:57.32] System supports mSATA/SSD.
    [ 8:49:57.48] Get parameter from RST.ini...
    [ 8:49:57.56] CACHE_SIZE=0
    [ 8:49:57.56] RST_MODE=maximized
    [ 8:49:57.56] Get m-SATA bus index...
    [ 8:49:57.64] Could not find m-SATA bus...
    [ 8:49:57.64] Failed to configure RAID0 + SRT
    Here are the full logs on DropBox share:
    https://dl.dropboxusercontent.com/u/30077049/HP%20Recovery%20Logs/HP_SSRD_LOG.CAB
    I did everything "by the book", got the same errors 5 times for the above scenario and 5 other times for other bios config (enable\disable features).
    What is the problem?
    It is Hardware issue?
    configuration issue?
    Something related to UEFI \ RAID ?
    Is it possibile to solve it myself?
    Is there a tool i can use?
    I am living outside the US and I don't have an option to send the laptop to HP lab in the US, but Only in my country - Israel.
    The following are my BIOS config screen :
    Thank You!

  • Laptop doesn't recognise any plugged in usb devices

    laptop doesn't recognise any plugged in usb devices
    HP laptop G6000

    I went to the BIOS to check the power feature settings. Here's what I have set with the BIOS-offered explanation for each option:
    - ACPI BIOS IRQ--> *IRQ9*  [This field controls what IRQ the Advanced Configuration & Power Interface (ACPI) will use.]
    - ACPI Standby mode--> *S1*  [Select which power level your system goes to during standby. If S1 is selected, power is maintained to all devices but all processor activity is halted. If S3 is selected, power is maintained only for the main memory. Exit from the S3 state may not be supported by all installed adapters.]
    - Hard disk timeout--> *Enabled*  [Allows HDDs connected to the system board to automatically enter low power mode after a period of inactivity (about 20 minutes). HDD adapters may not support this function.]
    - After power loss--> *Power on*  [Select "Power on" if you use a power strip to turn the system on.]
    Yesterday I think I changed one of the above but it didn't help the problem with the detection of plugged-in USB devices.
    Today I turned off (disabled) Wake on LAN. This didn't help either: after plugging in one or more USB devices, I still have to open Konsole and run lsusb to wake up the system which then detects the already plugged-in USB device(s) and asks me what I want to do, what app I want to use to read or use the plugged-in USB device. This of course is only a minor annoyance-- maybe I'll never figure out or learn why this problem has been happening in my recently acquired older (2005-built) IBM ThinkCenter desktop tower.
    Do you still want to see the output of # lsusb -v  ?? Tell me where on the web I can post the long output of that command. [The output won't fit in this space-limited reply form.] Also, any more ideas on what could be wrong?

  • [SOLVED] VirtualBox won't recognize host USB devices w/o root access

    VirtualBox is currently unable to detect the host's USB devices without root access. When I try to add a USB filter with user permission, the menu says
    <no devices available>
    but when I run VirtualBox as root, it detects the USB device, obeys the filter once added, and I can access the USB device from inside the virtual machine. Is there any way to get the same behavior from a non-root account?
    This user account is part of the vboxusers group and I have guest additions installed.
    Last edited by boblitz13 (2012-10-19 21:05:01)

    Well, sometimes it's the truly silly things that get you. I rebooted and VB now detects the host USB devices with regular permissions. All of the device filters are now working except the one for my NTFS-formatted external HD. The filter will grab it from the host OS but I cannot access it in the guest. I read that VB used to have a problem with USB 3.0, but that seems to have been resolved in the latest version. Is there any other explanation for why this isn't working?

  • Detecting USB Device insertion/​removal

    Hi All,
    With reference the an earlier post by softengr (here), I'm trying to detect the USB devices while being connected.
    I'm trying to compile the same code posted by softengr, but getting some compilation error even after adding windows.h.
    I think I'm missing some header file here.
    The following are the errors during compilation;
      Undeclared identifier 'DEV_BROADCAST_DEVICEINTERFACE'.
      Undeclared identifier 'NotificationFilter'.
      Undeclared identifier 'GUID_DEVINTERFACE_USB_DEVICE'.
      Undeclared identifier 'GUID_CLASS_USB_DEVICE'.
    I'm using LabWindows/CVI 2012 with Windows7 64bit.
    Can anybody suggest waht am i doing wrong here.
    Thankyou,
    Dosth

    A search of the NI forums for "USB Event notification" returned an entry that may help you:
    Windows device event notification
    Message Edited by Phillip Brooks on 12-01-2008 06:49 AM
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness

  • Audigy NX / Win XP not detected as USB Device! Can't Inst

    My NX which is under a month old all of a sudden is not being detected by Windows XP anymore. I plugged it in today (it was working fine a few days ago) and it was giving washed out music when playing a CD - like everything was muffled and the bass was dominating. I unplugged it, replugged it in but Windows detected the USB device as "Audigy NX" and tried to reinstall the hardware, but failed, and that was the end of it - It did not appear under my device manager profiles, nor could I get it to work anymore with my laptop. I removed all the Audigy NX software, unplugged everything, went into safe mode and uninstalled the drivers, reinstalled the drivers... what it comes down to is that Windows won't even detect the hardware when I pull the cable out and plug it in again. What do I do when all the drivers & problem solutions are dependant on Windows seeing my USB device. (I even uninstalled the USB roots on my computer and redetected them.. it only found my USB mouse, but no the Audigy NX.) I haven't made any hardware or software changes since I last used it - I have been operating Windows XP Home edition, SP2 with no problems with the NX up until now. Perhaps its a Windows thing, but maybe you can offer some help.
    Thanks,
    Echostorm

    Echostorm
    Try doing a Cleansweep for the sound card. This information can be found at the Knowledgebase.
    http://us.creative.com/support/kb/ar...asp?l=2&sid=72
    Jason

  • Program to automatically detect usb device

    Dear labview users,
                                       I wanna build a program such that when a USB device (pen drive/ memory stick) is connected to a PC, it has to detect the device and prompt the user to provide a password and then only the user gets the accessbility to open the memory stick.  This is mainly for security purpose of the PC, such that in no condition without the programmer's knowledge no one should transport the data from the PC.
                                       To add more to the program, this labview program should be run in the background in all the time in the sense that even the labview program is triggered by the user or not, it has to run all the time in background without anybody's intervention. when a memory stick is connected it has to prompt the password.
                                        Is this possible in labview, Iam using labview 8.0. If anybody gets solution to this young chap's idea please response to this query.
    Labview lovers.....

    Hi Shivkumar,
    Would it be acceptable for the entire PC to be in a way "locked down" untill a password is entered once a pen drive is detected? Or would you simply want the password dialog to pop-up when they try to double click on the actual drive under "My Computer" to access the data? Also, if the password is not entered but the pen drive is remove, should the password dialog box disappear?
    Best regards,
    Steven

  • USB Devices Not Detected and High CPU Usage

    Hello, I'm using arch on a Dell 1720 laptop.
    I have some weird issues involving detection of USB devices.
    When the laptop is on battery and I plug in a USB mouse the power flickers on and flickers off again; nothing in the logs/dmesg.
    If I then connect the AC adapter the reconnect the mouse, the same happens, except the CPU usage hits 87%+ on one core.
    Running
    sudo rmmod ehci_hcd
    solves the problem; the CPU usage drops and the mouse gets detected.
    Subsequent attempts to hotplug USB devices does nothing, no high CPU and no Power.
    Rebooting the computer is the only way to use USB devices at the moment.
    usb-autosuspend is disabled in laptop-mode.
    uname -a:
    Linux MatSalleh 2.6.39-ck #1 SMP PREEMPT Sun Jun 5 18:30:30 EDT 2011 x86_64 Intel(R) Core(TM)2 Duo CPU T7250 @ 2.00GHz GenuineIntel GNU/Linux
    The same happens with the stock kernel too
    My kernel line in grub:
    kernel /vmlinuz26-ck root=/dev/sda3 elevator=bfq ro resume=/dev/sda2
    Any ideas?
    Thanks,
    Chris.

    lilsirecho wrote:Perhaps the USB connector is damaged, causing excess power drain suggesting that the current limiter isn't functioning.
    I highly doubt it's that, it was working fine on ubuntu just days before...
    tydell wrote:I had similar problem with USB pendrive, it wasn't detected and it makes high cpu usage. It was problem with ehci_hcd module
    This one helps me to solve this problem
    My USB devices don't even get detected, so that script won't work.
    Last night I hibernated my computer after not using any USB devices, on resume, my CPU usage was 100%, removing the ehci_hcd module fixed it.
    Any more ideas?
    I'm tempted to build a vanilla kernel...

  • My hp photosmart premium all in one keeps telling me randomly to remove my usb device.

    My HP 309 all in one Photo smart Premium Wireless Printer,gives me a remove your usb device reading .None is attached.
    I can reboot it and it goes away ; but returns later.I even connected one and removed it but it did not help.
    I also can"t get my auto feeder to work.I took it to Best Buy and he didn't know what to do either.

    Hello there! Welcome to the forums @mrsddavis ,
    I read your post about the troubles you're having with the printer telling you to "remove a USB device", when you do not have a USB device plugged into the unit. I have a couple suggestions that I hope will help you. You may have tried all of the steps to my first idea, if so move on to the second one. Also, the second step will be in a private message to you, as it cannot be posted publicly.  In regards to the ADF not working, let me know what the problem is, for example, will it pull in paper and then jam, or will it not pull paper in at all? Let me know so I can research that problem for you.
    If you are not sure how to check your forum messages this post, has instructions.
    Power reset:
    Press the Power button to turn on the product.
    With the product turned on, disconnect the power cord from the rear of the product.
    Unplug the power cord from the wall outlet.
    Wait at least 30 seconds.
    Plug the power cord back into the wall outlet.
    Reconnect the power cord to the rear of the product.
    If the product does not turn on by itself, press the Power button to turn it on.
    Ensure the printer is plugged in directly to the wall outlet, avoiding power bars and surge protectors. This ensures the printer is receiving full power and may help greatly.
    Good luck, I hope this helps
    R a i n b o w 7000I work on behalf of HP
    Click the “Kudos Thumbs Up" at the bottom of this post to say
    “Thanks” for helping!
    Click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution!

  • Error message: "Remove USB Device from printer."

    I have an HP Photosmart 309 a All-In-One.  It is attached to my desktop computer, which utilizes the Windows XP system. I've owned the All-In-One for about three years. I do not use the All-In-One -- or this computer -- very much. (I mostly use my laptop.)
    I have not made any changes to this computer and/or All-In-One in quite some time. This error message is new. I do not have a USB device attached to the printer.  Even with the error message displayed, the All-In-One allows me to print, but it will not allow me to make a copy or scan.  How do I make this error message go away?  What's wrong with my All-In-One?  Thank you for your help!

    Hi DuckLakeSue,
    I understand that you are getting an error message to 'Remove USB Device from printer'. Follow the steps provided in this link by the PrintDoc to determine if your wireless radio has failed.
    I hope this helped, let me know.
    Thank you,
    I worked on behalf of HP.

  • How to detect USB device drives

    Hi
    I want to write a program which will detect the drive letter when a usb device is plugged in. i.e., if a usb device is plugged in and the drive letter is "F:", then my program will instantly detect the presense of the device as well as get the drive letter. How's that possible in Java?
    Thanx in advance
    Regards
    Mathew

    cotton.m wrote:
    Well if you're looking for the newUSBDriveListener API you're out of luck.
    There is no way to do what you are looking for in a number of ways.
    1) If something is listed as a drive the best you can now (from FileSystemView) is that it's a drive.
    2) There isn't "new drive/or device added" event API.
    So what you would have to do is when your program starts get the list of roots. Then poll at some intervals to get the list of roots and see if there are changes. If new drives show up then they show up.I agree!!!

  • USB Devices not being detected

    I have a couple of problems i've been struggling with for a while, searching the forums to no avail.
    1)
    Firefox's UI font sucks.
    Here it is compared to Thunar:
    EDIT: Fixed. I had anti aliasing Disabled in .font.conf
    2)
    USB devices aren't autodetected after I start X.
    i.e. if i plug my mouse before logging in (shell) and starting x, it works, but if i wait till later, it doesn't.
    I don't think usb drives are being detected either, but I can't figure out how to try to mount them either. I would like to have automounting of usb drives and autodetection of usb peripherals.
    Thanks
    Last edited by underpenguin (2008-02-06 02:14:04)

    I know you said you searched the wiki and forums, but have you seen this?
    http://wiki.archlinux.org/index.php/Firefox#Fonts

  • USB devices not detected in VMware [SOLVED; Using Virtualbox instead]

    I am running Arch as a host and XP on VMWare workstation 7.  My primary purpose of installing XP on VMWare was to use my edit my Line6  POD (behaves as a usb sound card) and get my USB TV Tuner box to work. The big problem that I am facing is that VMWare is not detecting any USB device (not even my USB Hard Drive).
    I have the usb controller installed.
    Any suggestions?
    Last edited by devadittya (2009-11-24 20:04:45)

    I don't know vmware but with other virtual machines there is often a configuration option whether usb drives should be automatically mounted or not. Sometimes automounting also only works if the vm has the focus, i.e. is the active window.

  • USB Device Failed Detection

    Hello,
    I am trying to connect a USB to SATA/IDE Adapter to a USB port on Solaris 8. In the /var/adm/messages file, two messages show the following:
    usba: /pci@1f,0/pci@1,1/usb@c,3 (ohci0): getting device status failed (-1)
    usba: /pci@1f,0/pci@1,1/usb@c,3 (ohci0): connecting device on port 1 failed
    It appears that the USB device is being detected but the OS doesn't know how to define it. Maybe a device driver might be needed?
    Thx

    Hello,
    I am trying to connect a USB to SATA/IDE Adapter to a
    USB port on Solaris 8. IIRC Solaris 8 only supports USB Keyboard and mouse. You'll probably need to get a newer version of Solaris.
    alan

  • Pmount & safe removal of USB device

    I am new to Linux (still discovering Arch inside a VM for now) and lately I've been looking into working with USB devices. I found out about pmount, great tool, but I wanted a little more. So also as part of me trying to learn C as well, I decided to make some changes.
    First of all, as the title indicates, I added something to safely remove devices. After searching, it seemed that a lot of people simply unmount whatever file system they have mounted before unplugging their USB devices. That just didn't seem like completely enough to me, and I eventually found this post where it seems that there are, indeed, a few more steps to do before one can safely unplug an USB device.
    So I did put those into a new option (-D) of pumount, which will try also try to unmount all partitions of a given device before. Similarly, the same option can be used with pmount to mount all partitions of a device at once.
    Additionally, I also added support for a configuration file (/etc/pmount.conf) where one can predefined, for some devices, a few options. Some are new, others will overwrite any command-line options:
    - fs to define the file system (overwrites option -t)
    - charset to define the I/O character set (overwrites option -c)
    - passphrase to define the file to read passphrase from (overwrites options -p/--passphrase)
    - mntpt to define the mount point. Overwrites the usual way (e.g. specified label), can be anywhere (not restricted to /media/)
    - options to defines the mounting options. That is, this allows you to overwrite the defaut options, as defined in fs.c No checks are done here, so make sure not to include non-existing options, as well as not to include any options auto-added by pmount (that is, things based on command-line options, such as atime/noatime, exec/noexec, etc)
    In the end, with a simple call to pmount I can now have my LUKS encrypted partitions mounted automatically; and when I’m done one call to pumount will have them all unmounted, and the device be prepared for safe removal. I think I now have everything I was looking for.
    The modified source code is available on this BitBucket repository. You can also find a PKGBUILD in the AUR, which uses the official source code and a patch to get there, simply because I figured it would allow people to check the changes more easily.
    I've also made a blog post where I described changes I made a little more, if anyone's interested.
    Maybe that might be useful to others; And any bug reports, suggestions or any other form of constructive criticism is very much welcome.
    -jacky

    [donnie@arch ~]$ sudo sdparm --command=sync /dev/sdb1
        /dev/sdb1: WD        15EADS External   1.75
    [donnie@arch ~]$ sudo sdparm --command=stop /dev/sdb1
        /dev/sdb1: WD        15EADS External   1.75
    [donnie@arch ~]$ sudo umount /dev/sdb1
    umount: /run/media/donnie/wd: device is busy.
            (In some cases useful info about processes that use
             the device is found by lsof(8) or fuser(1))
    I tried to pumount an ext4 external usb western digital 1.5TB drive. It is umounted/safely removed without error but it keeps spinning indefinitely. I am not sure if the drive is being 'safely removed'.
    Thanks you so much for your work.
    UPDATE-1 pumount won't work because default location is now set to /run/media/$HOME/$LABEL by udisks2
    Error: mount point /run/media/donnie/wd is not below /media/
    Failed to umount device /dev/sdb1 : error 4
    I am trying to remove the drive safely using following method without luck.
    [donnie@arch ~]$ sudo sdparm --command=sync /dev/sdb1
    /dev/sdb1: WD 15EADS External 1.75
    [donnie@arch ~]$ sudo sdparm --command=stop /dev/sdb1
    /dev/sdb1: WD 15EADS External 1.75
    [donnie@arch ~]$ sudo umount /dev/sdb1
    umount: /run/media/donnie/wd: device is busy.
    (In some cases useful info about processes that use
    the device is found by lsof(8) or fuser(1))
    Last edited by donniezazen (2012-05-25 09:55:20)

Maybe you are looking for