JustKernel

Ray Of Hope

USB Device Redirection

USB Device Redirection is controlled by the Redirection Policy Manager (RPM). RPM is a kernel-mode export driver that is available in Windows 7. By using RPM, third-party developers can load an alternate driver in place of the original USB device driver. RPM abstracts the redirection functionality that is provided by Microsoft. One of the clients for RPM is Windows Virtual PC, a client virtualization solution for Windows 7.

Whenever a client wants to redirect a particular USB device, RPM calls the USB stack to load its alternate driver for the corresponding device rather than load the actual driver. To load an alternate driver, the client needs to first register itself by calling the RPMRegisterAlternateDriver routine. This routine returns a handle that is used for all subsequent communication with RPM. RPM allows up to eight clients to be registered at any given time. Clients also provide the device identification string that matches the alternate driver’s INF file as part of the call to the RPMRegisterAlternateDriver routine.

A client can get a list of devices for which the alternate driver can be loaded by calling the RPMGetAvailableDevices routine. This routine returns all devices except for hubs and HID devices.

Clients can then load the alternate driver by calling the RPMLoadAlternateDriverForDevice routine and specifying the HubID and ConnectionIndex that is returned as part of the call to the RPMGetAvailableDevices routine. This call redirects the USB device and loads the alternate driver.

After the client completes its task, it should call the RPMUnloadAlternateDriverForDevice routine and then the RPMUnregisterAlternateDriver routine.

Originally Posted On: 2010-05-09 10:32:55

Anshul Makkar, anshul_makkar@justkernel.com

Tags:


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.