libusb -> WinUSB bridge (c) 2010 JJS
------------------------------------

What this is:

This is a replacement for the libusb0.dll file that comes with such PSP software
as PSPLINK and RemoteJoy (Lite). It redirects the libusb calls to WinUSB
so that these programs can be run on 64 bit version of Windows Vista and Windows 7
without disabling the driver signature check enforcement.


What this is NOT:

This is not a generic replacement for libusb. It implements only a small subset of
libusb functionality and important values such as the USB device IDs are hardcoded.



Known issues:

You can only use ONE device at a time. There is no support for multiple connected PSP
at all (and I only have one, so I am not sure what will happen, something between the
application not recognizing the PSP and the application crashing).

Also, there is no way in WinUSB to reset an usb device. This means the libusb function
usb_reset() is not implemented, causing the following problems:

- PSPLINK: These steps will lead to a situation in which you have to restart the PSP.
  1. Open usbhostfs_pc and connect the PSP so that it shows "Connected to device"
  2. Close usbhostfs_pc
  3. Open usbhostfs_pc AND pspsh. Usbhostfs_pc will repeatedly show "Connected to device",
     pspsh shows nothing. Now you have to reboot the PSP because it will not react anymore.

  The problems lies in opening pspsh while there is still a connection open from a previous
  session on the PSP and usbhostfs_pc has not been able to create a new connection.

  Therefore you have to first start usbhostfs_pc, unplug and replug the PSP and wait for
  the line "Connected to device" to appear once before starting pspsh.  
  
- RemoteJoy Lite: If you close the RemoteJoy application on the PC, you have to unplug
  and replug the USB cord if you want to start usingRemoteJoy again. If you don't, the PC app
  will be stuck at displaying "WAITING". Sometimes it might be necessary to reboot the PSP.



How to use:

The file "libusb0.dll" in the "bin" directory has to be copied to the directory of the
application you want to run (e.g. same directory as "usbhostfs_pc.exe"). There is probably
already a file called "libusb0.dll" there, you should make a backup of this file 
before replacing it.

From now on the application will use the "spoofed" file. To revert to the original, delete
the file "libusb0.dll" and restore the original from the backup you made.

Now you have to change the PSP game or plugin in a way that it reports to the PC as a 
"PSP Type C" (ProductId = 0x01CA) device.



PSPLINK instructions:

As described above, place the file "libusb0.dll" in the directory containing "usbhostfs_pc.exe"
and "pspsh.exe". You don't have to do anything else on the PC side, especially the pid
MUST NOT be changed from the default value.

On the PSP, go into the "ms0:/SEPLUGINS" directory and change the file "psplink.ini" to use
a different pid (USB product ID). Replace the line:

# pid=0x1C9

with

pid=0x1CA

Do the same in the "psplink.ini" file in the game folder on your memory stick.



RemoteJoy Lite instructions:

Place the file "libusb0.dll" in the directory containing "RemoteJoyLite.exe".

Unfortunately the source code for the plugin is not available. Therefore you have to 
hexedit the prx. Open the file "RemoteJoyLite.prx" with a hex editor and search for the 
hexvalue "C901", this is the little endian representation of 0x01C9, which is the 
"PSP Type B" USB product ID.

In version 0.20a you will find this exactly 4 times. Replace all instances with "CA01", the
"PSP Type C" product ID.



Driver installation:

Start the PSP game or plugin you configured above and connect your PSP to your PC.

Windows should detect a new device "PSP Type C" and ask you for the device driver location.
Point the driver installer to the "driver_usb_type_c_winusb" directory and Windows should
be able to find and install the driver.

If you have PSPdisp v0.4+ installed, the driver is already present on your system.

You can also preinstall the driver by downloading and running the PSPdisp v0.4 setup program
and unchecking every installer option except for "Usb driver (WinUSB)". After that, Windows
will be able to install the driver automatically when the PSP is plugged in.



Changelog:

v0.2:
- implemented libusb return error code for usb read/write timeouts
- fixed incorrectly set timeout values

v0.1:
- initial release