Modified for PS3 Joystick
Fork of USBDevice by
Diff: USBHID/USBHID.cpp
- Revision:
- 1:ac5cca60029a
- Parent:
- 0:140cdf8e2d60
--- a/USBHID/USBHID.cpp Wed May 30 18:28:11 2012 +0000 +++ b/USBHID/USBHID.cpp Sat Jul 27 14:05:26 2013 +0000 @@ -20,6 +20,9 @@ #include "USBHAL.h" #include "USBHID.h" +//////// for PS3 magic bytes +unsigned char magic_init_bytes[] = {0x21, 0x26, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00}; // PS3 will request these bytes as a class type report 0x0300 +//////// USBHID::USBHID(uint8_t output_report_length, uint8_t input_report_length, uint16_t vendor_id, uint16_t product_id, uint16_t product_release, bool connect): USBDevice(vendor_id, product_id, product_release) { @@ -123,6 +126,7 @@ break; } break; + default: break; } @@ -144,6 +148,24 @@ transfer->direction = HOST_TO_DEVICE; transfer->notify = true; success = true; + //////// for PS3 magic bytes + case GET_REPORT: + switch (transfer->setup.wValue & 0xffff) + { + case 0x0300: //vendor specific request + + transfer->ptr = (unsigned char*)magic_init_bytes; + transfer->remaining = sizeof(magic_init_bytes); + transfer->direction = DEVICE_TO_HOST; + success = true; + + break; + default: + break; + } + break; + //////// + default: break; }