Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Hardware & Devices
  4. How to toggle USB power line

How to toggle USB power line

Scheduled Pinned Locked Moved Hardware & Devices
helpcsharpdebuggingjsontutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dybs
    wrote on last edited by
    #1

    I have an externally powered USB device, and sometimes I get a "Device attached to the system is not functioning" error. I've been debugging and googling this for a couple days now, and I'm just not getting anywhere anymore. I've found the unplugging and replugging the USB will usually resolve this. I know toggling the Vcc line on the UBS port will prompt the device to reset its USB state. I can't physically disconnect the device because it could be running as part of an unattended test and may need to be reconnected like this (I'm logging any USB errors I encounter and the conditions so we can debug them later). Is there a way I can toggle the USB power signal via C# or a Win32 API call? NOTE: I can pretty consistenly get this to happen in XP, not as often on 7 or one Vista laptop. Other Vista laptops I've tried have never seen this problem, even running the exact same version of the PC code. But since i can get it to happen on multiple computers with different setups, I don't think its a PC issue. Any help is appreciated. Dybs

    The shout of progress is not "Eureka!" it's "Strange... that's not what i expected". - peterchen

    I 1 Reply Last reply
    0
    • D dybs

      I have an externally powered USB device, and sometimes I get a "Device attached to the system is not functioning" error. I've been debugging and googling this for a couple days now, and I'm just not getting anywhere anymore. I've found the unplugging and replugging the USB will usually resolve this. I know toggling the Vcc line on the UBS port will prompt the device to reset its USB state. I can't physically disconnect the device because it could be running as part of an unattended test and may need to be reconnected like this (I'm logging any USB errors I encounter and the conditions so we can debug them later). Is there a way I can toggle the USB power signal via C# or a Win32 API call? NOTE: I can pretty consistenly get this to happen in XP, not as often on 7 or one Vista laptop. Other Vista laptops I've tried have never seen this problem, even running the exact same version of the PC code. But since i can get it to happen on multiple computers with different setups, I don't think its a PC issue. Any help is appreciated. Dybs

      The shout of progress is not "Eureka!" it's "Strange... that's not what i expected". - peterchen

      I Offline
      I Offline
      Indivara
      wrote on last edited by
      #2

      What happens if you disable the device in device manager? Does it even appear there? I don't think the power can be switched off on individual USB ports (if it's possible at all to control power to the ports). On my motherboard, the power is permanently on, even when shut down. There is a tool here[^] that allows you to control devices from the command line, it may help if enabling and disabling fixes the issue. Also, you could look into the WDK[^], but I doubt there is anything that allows direct control of USB power. <edit> http://msdn.microsoft.com/en-us/library/ms798253.aspx[^] Looks like I was wrong about the WDK, it can be done (per device, not the port directly), but in kernel mode. </edit>

      modified on Monday, December 21, 2009 8:34 AM

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups