08-26-2011, 05:15 PM
Regarding DualShock 3 Controllers compatibility with Vista / 7.
DS3 Controllers do send a correctly formed HID Descriptor and it is correctly recognised by the OS as a game-controller. You can view it in Devices and Printers, and it displays properly in Game Controllers.
![[Image: attachment.php?aid=29681]](https://forums.pcsx2.net/attachment.php?aid=29681)
[Note the Dual PSX-USB Adaptor displays in Devices and Printers, but not in Game Controllers]
There is one issue with it though, it requires a Start command to be sent to wake it up before it will start issuing Reports. This is a well known issue, Linux has had a kernel quirk for it for a long time.
The Start command is a Set Feature Report with Report ID 0xF4, the problem is this Feature Report is not in the HID Descriptor. So it is not accessible from a user application. The HidUsb driver will refuse any Report ID that is not included in the HID Descriptor.
To get around this it is possible to write a Lower Filter driver which can issue the Set Feature Report. The following is code from a filter driver which modifies the Report ID and TransferBuffer contents, of a User application issued Set Feature Report with Report ID 0xEE (valid in HID Descriptor), to issue the Start Command.
This code would be inserted into the one of the DDK Samples (general\toaster\wdm\filter) in the FilterPass function, and built as a Kernel Mode Device Lower Filter. Code could be modified and used on the return of a Query Descriptor request if automatic start was required.
This in essence what the MotionInJoy drivers do for you, with a few extra features (setting the LEDs etc).
I've used this on XP, DS3 starts properly and is usable in games. Again for Vista / 7 the Driver must be signed, so as a general solution it's not recommended.
DS3 Controllers do send a correctly formed HID Descriptor and it is correctly recognised by the OS as a game-controller. You can view it in Devices and Printers, and it displays properly in Game Controllers.
[Note the Dual PSX-USB Adaptor displays in Devices and Printers, but not in Game Controllers]
There is one issue with it though, it requires a Start command to be sent to wake it up before it will start issuing Reports. This is a well known issue, Linux has had a kernel quirk for it for a long time.
The Start command is a Set Feature Report with Report ID 0xF4, the problem is this Feature Report is not in the HID Descriptor. So it is not accessible from a user application. The HidUsb driver will refuse any Report ID that is not included in the HID Descriptor.
To get around this it is possible to write a Lower Filter driver which can issue the Set Feature Report. The following is code from a filter driver which modifies the Report ID and TransferBuffer contents, of a User application issued Set Feature Report with Report ID 0xEE (valid in HID Descriptor), to issue the Start Command.
Code:
/** Startup Filter for DualShock 3 **/
DebugPrint(("FilterPass %d - %d \n", irpStack->MajorFunction, irpStack->MinorFunction));
if (irpStack->MajorFunction == IRP_MJ_INTERNAL_DEVICE_CONTROL)
{
DebugPrint(("IoControlCode %d\n", irpStack->Parameters.DeviceIoControl.IoControlCode));
if(irpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_INTERNAL_USB_SUBMIT_URB)
{
PURB pHxp = (PURB) irpStack->Parameters.Others.Argument1;
DebugPrint(("Report [%d] - [%d]\n", (int) pHxp->UrbHeader.Length, (int) pHxp->UrbHeader.Function));
if (pHxp->UrbHeader.Function == URB_FUNCTION_CLASS_INTERFACE)
{
UCHAR* Buffer = (UCHAR*) pHxp->UrbControlVendorClassRequest.TransferBuffer;
DebugPrint(("Flags [0x%04X] Length [0x%04X]\n",
pHxp->UrbControlVendorClassRequest.TransferFlags,
pHxp->UrbControlVendorClassRequest.TransferBufferLength));
DebugPrint(("Request [0x%02X] Value [0x%04X] Index [0x%04X]\n",
(int) pHxp->UrbControlVendorClassRequest.Request,
(int) pHxp->UrbControlVendorClassRequest.Value,
(int) pHxp->UrbControlVendorClassRequest.Index));
if ((pHxp->UrbControlVendorClassRequest.Value == 0x3EE)
&& (USBD_TRANSFER_DIRECTION_FLAG(pHxp->UrbControlVendorClassRequest.TransferFlags) == USBD_TRANSFER_DIRECTION_OUT)
&& (Buffer[0] == (UCHAR) 0xEE))
{
if(Buffer[1] == (UCHAR) 0x01)
{
pHxp->UrbControlVendorClassRequest.Value = 0x3F4;
pHxp->UrbControlVendorClassRequest.TransferBufferLength = 4;
Buffer[0] = 0x42;
Buffer[1] = 0x0C;
Buffer[2] = 0x00;
Buffer[3] = 0x00;
}
}
}
}
}
/** END - Startup Filter **/
This code would be inserted into the one of the DDK Samples (general\toaster\wdm\filter) in the FilterPass function, and built as a Kernel Mode Device Lower Filter. Code could be modified and used on the return of a Query Descriptor request if automatic start was required.
This in essence what the MotionInJoy drivers do for you, with a few extra features (setting the LEDs etc).
I've used this on XP, DS3 starts properly and is usable in games. Again for Vista / 7 the Driver must be signed, so as a general solution it's not recommended.