Click here to Skip to main content
15,900,258 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to call usb function Set_Port Feature( PORT RESET ) so that I reset a port from the usb hub.

I do not know almost nothing about drivers ... So I do not even know where to look for!

I know that it is possible to send the command Set_Port Feature( PORT RESET ) to a hub and that is what I want to make the hub reset a port.

Any help?
Posted

Sending SetPortFeature (PORT_RESET) to a hub will only tell it to perform a USB reset.

The supply of power over USB is separate to that, and is controlled by ClearPortFeature (PORT_POWER) and SetPortFeature (PORT_POWER) (for hubs that support per-port power control).
 
Share this answer
 
The DevCon[^] example in the WDK[^] is a command-line utility that shows how to enable, disable, restart, update, remove and query devices using the SetupAPI and CfgMgr32 API functions.

Download DevCon from here:

devcon.exe[^]

Learn using DevCom from the command-line:

devcon help


Find hardware IDs for all USB devices:

devcon find "USB\*"


Restart your desired HUB or any other device:

devcon restart "USB\ROOT_HUB20\5&3849BCE7&0"


If power limits on your USB port have been exceeded use

devcon rescan


to reset it, or do something of everything from your C# console application:

C#
using System;
using System.Diagnostics;

namespace Test
{
    class Program
    {
        public static void Main(string[] args)
        {
            var p = new Process();
            p.StartInfo = new ProcessStartInfo( @"devcon.exe", @"find USB\*" );
            p.StartInfo.UseShellExecute = false;
            p.Start();
            p.WaitForExit();

            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
        }
    }
}


Hope this helps!


Tefik Becirovic

 
Share this answer
 
v3
Thanks Tefik but it does not really help!

What I really need is to power off the 5V USB line for each port - USB port RESET!
And your answer does not do it. It makes USB rescan like "device manager scan hardware".


I have a PCB board made by me that has a LED at the 5V line and is always ON. Also the USB connection is not reseted (I have measured it)

I have made some search and I am beginning to accept that the only way is to make a USB HUB specific driver!

It is shame that Microsoft driver does not have this function available since it is part of USB. It would be great for many applications to be able to reset the port without physicall human intervention.
 
Share this answer
 
Thanks,

How can I call ClearPortFeature (PORT_POWER) and SetPortFeature (PORT_POWER)?
From an application is possible or only at driver level!?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900