Seitenleiste


Access to information is restricted depending on your login. Request login-information through our contact form.

service:wince:appnotepub:remountusb

Disconnect / Reconnect USB Devices

During runtime you can remove or re-enumerate USB Class drivers. Note that this interface is a non standard
API. Keith & Koep extended the OHCI driver with that interface to help customers with problems on different
USB devices with unspecified problems.

#define FILE_DEVICE_USB          0x0000B001
#define IOCTL_DISCONNECT_PORT    CTL_CODE(FILE_DEVICE_USB, 0x401, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_RECONNECT_PORT     CTL_CODE(FILE_DEVICE_USB, 0x402, METHOD_BUFFERED, FILE_ANY_ACCESS)


void Disconnect_USB_Port(int portno)   // 0,1 
{
  HANDLE hDeviceUSB = CreateFile( TEXT("HCD1:"), GENERIC_READ|GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0); 
  unsigned long ReEnumeratePorts = 1 << portno;  // 1 = Port 1  2 = Port 2  3=both
  DeviceIoControl( hDeviceUSB, IOCTL_DISCONNECT_PORT, &ReEnumeratePorts, sizeo(ReEnumeratePorts), NULL, 0, &returned, NULL);
  CloseHandle(hDeviceUSB);
}

void Reconnect_USB_Port(int portno)   // 0,1 
{
  HANDLE hDeviceUSB = CreateFile( TEXT("HCD1:"), GENERIC_READ|GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0); 
  unsigned long ReEnumeratePorts = 1 << portno;  // 1 = Port 1  2 = Port 2  3=both
  DeviceIoControl( hDeviceUSB, IOCTL_RECONNECT_PORT, &ReEnumeratePorts, sizeo(ReEnumeratePorts), NULL, 0, &returned, NULL);
  CloseHandle(hDeviceUSB);
}
Cookies helfen bei der Bereitstellung von Inhalten. Durch die Nutzung dieser Seiten erklären Sie sich damit einverstanden, dass Cookies auf Ihrem Rechner gespeichert werden. Weitere Information
service/wince/appnotepub/remountusb.txt · Zuletzt geändert: 2015/10/14 11:14 von