ROBOSTEP_3rd_SHARE / Mbed 2 deprecated PS3conOut2

Dependencies:   mbed

Fork of PS3conOut by ROBOSTEP_3rd_SHARE

Committer:
ideguti
Date:
Sat Apr 18 06:27:36 2015 +0000
Revision:
0:0805c5a1b328
Child:
1:7b9e3032bb7b
koueki you no program

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ideguti 0:0805c5a1b328 1 /*
ideguti 0:0805c5a1b328 2 Copyright (c) 2010 Peter Barrett
ideguti 0:0805c5a1b328 3
ideguti 0:0805c5a1b328 4 Permission is hereby granted, free of charge, to any person obtaining a copy
ideguti 0:0805c5a1b328 5 of this software and associated documentation files (the "Software"), to deal
ideguti 0:0805c5a1b328 6 in the Software without restriction, including without limitation the rights
ideguti 0:0805c5a1b328 7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
ideguti 0:0805c5a1b328 8 copies of the Software, and to permit persons to whom the Software is
ideguti 0:0805c5a1b328 9 furnished to do so, subject to the following conditions:
ideguti 0:0805c5a1b328 10
ideguti 0:0805c5a1b328 11 The above copyright notice and this permission notice shall be included in
ideguti 0:0805c5a1b328 12 all copies or substantial portions of the Software.
ideguti 0:0805c5a1b328 13
ideguti 0:0805c5a1b328 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
ideguti 0:0805c5a1b328 15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
ideguti 0:0805c5a1b328 16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
ideguti 0:0805c5a1b328 17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
ideguti 0:0805c5a1b328 18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
ideguti 0:0805c5a1b328 19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
ideguti 0:0805c5a1b328 20 THE SOFTWARE.
ideguti 0:0805c5a1b328 21 */
ideguti 0:0805c5a1b328 22
ideguti 0:0805c5a1b328 23 /*
ideguti 0:0805c5a1b328 24 Tue Apr 26 2011 Bart Janssens: added PS3 USB support
ideguti 0:0805c5a1b328 25 */
ideguti 0:0805c5a1b328 26
ideguti 0:0805c5a1b328 27 #include <stdio.h>
ideguti 0:0805c5a1b328 28 #include <stdlib.h>
ideguti 0:0805c5a1b328 29 #include <stdio.h>
ideguti 0:0805c5a1b328 30 #include <string.h>
ideguti 0:0805c5a1b328 31
ideguti 0:0805c5a1b328 32 #include "USBHost.h"
ideguti 0:0805c5a1b328 33 #include "Utils.h"
ideguti 0:0805c5a1b328 34 #include "ps3.h"
ideguti 0:0805c5a1b328 35
ideguti 0:0805c5a1b328 36 #define AUTOEVT(_class,_subclass,_protocol) (((_class) << 16) | ((_subclass) << 8) | _protocol)
ideguti 0:0805c5a1b328 37 #define AUTO_KEYBOARD AUTOEVT(CLASS_HID,1,1)
ideguti 0:0805c5a1b328 38 #define AUTO_MOUSE AUTOEVT(CLASS_HID,1,2)
ideguti 0:0805c5a1b328 39 //#define AUTO_PS3 AUTOEVT(CLASS_HID,0,0)
ideguti 0:0805c5a1b328 40
ideguti 0:0805c5a1b328 41 u8 auto_mouse[4]; // buttons,dx,dy,scroll
ideguti 0:0805c5a1b328 42 u8 auto_keyboard[8]; // modifiers,reserved,keycode1..keycode6
ideguti 0:0805c5a1b328 43 u8 auto_joystick[4]; // x,y,buttons,throttle
ideguti 0:0805c5a1b328 44 //u8 auto_ps3[48];
ideguti 0:0805c5a1b328 45
ideguti 0:0805c5a1b328 46
ideguti 0:0805c5a1b328 47
ideguti 0:0805c5a1b328 48
ideguti 0:0805c5a1b328 49 void AutoEventCallback(int device, int endpoint, int status, u8* data, int len, void* userData)
ideguti 0:0805c5a1b328 50 {
ideguti 0:0805c5a1b328 51 int evt = (int)userData;
ideguti 0:0805c5a1b328 52 switch (evt)
ideguti 0:0805c5a1b328 53 {
ideguti 0:0805c5a1b328 54 case AUTO_KEYBOARD:
ideguti 0:0805c5a1b328 55 printf("AUTO_KEYBOARD ");
ideguti 0:0805c5a1b328 56 break;
ideguti 0:0805c5a1b328 57 case AUTO_MOUSE:
ideguti 0:0805c5a1b328 58 printf("AUTO_MOUSE ");
ideguti 0:0805c5a1b328 59 break;
ideguti 0:0805c5a1b328 60 // case AUTO_PS3:
ideguti 0:0805c5a1b328 61 // printf("AUTO_PS3 ");
ideguti 0:0805c5a1b328 62 // ParsePs3Report(data,len);
ideguti 0:0805c5a1b328 63 // break;
ideguti 0:0805c5a1b328 64 default:
ideguti 0:0805c5a1b328 65 printf("HUH ");
ideguti 0:0805c5a1b328 66 }
ideguti 0:0805c5a1b328 67 //printfBytes("data",data,len);
ideguti 0:0805c5a1b328 68 USBInterruptTransfer(device,endpoint,data,len,AutoEventCallback,userData);
ideguti 0:0805c5a1b328 69 }
ideguti 0:0805c5a1b328 70
ideguti 0:0805c5a1b328 71 // Establish transfers for interrupt events
ideguti 0:0805c5a1b328 72 void AddAutoEvent(int device, InterfaceDescriptor* id, EndpointDescriptor* ed)
ideguti 0:0805c5a1b328 73 {
ideguti 0:0805c5a1b328 74 printf("message from endpoint %02X\r\n",ed->bEndpointAddress);
ideguti 0:0805c5a1b328 75 printf("Class Sub Proto: %02X %02X %02X\r\n",id->bInterfaceClass,id->bInterfaceSubClass,id->bInterfaceProtocol);
ideguti 0:0805c5a1b328 76 //if ((ed->bmAttributes & 3) != ENDPOINT_INTERRUPT || !(ed->bEndpointAddress & 0x80))
ideguti 0:0805c5a1b328 77 // return;
ideguti 0:0805c5a1b328 78
ideguti 0:0805c5a1b328 79 // Make automatic interrupt enpoints for known devices
ideguti 0:0805c5a1b328 80 u32 evt = AUTOEVT(id->bInterfaceClass,id->bInterfaceSubClass,id->bInterfaceProtocol);
ideguti 0:0805c5a1b328 81 printf("Evt: %08X \r\n",evt);
ideguti 0:0805c5a1b328 82 u8* dst = 0;
ideguti 0:0805c5a1b328 83 int len;
ideguti 0:0805c5a1b328 84 switch (evt)
ideguti 0:0805c5a1b328 85 {
ideguti 0:0805c5a1b328 86 case AUTO_MOUSE:
ideguti 0:0805c5a1b328 87 dst = auto_mouse;
ideguti 0:0805c5a1b328 88 len = sizeof(auto_mouse);
ideguti 0:0805c5a1b328 89 break;
ideguti 0:0805c5a1b328 90 case AUTO_KEYBOARD:
ideguti 0:0805c5a1b328 91 dst = auto_keyboard;
ideguti 0:0805c5a1b328 92 len = sizeof(auto_keyboard);
ideguti 0:0805c5a1b328 93 break;
ideguti 0:0805c5a1b328 94 // case AUTO_PS3:
ideguti 0:0805c5a1b328 95 // printf("PS3 event ? \r\n");
ideguti 0:0805c5a1b328 96 // dst = auto_ps3;
ideguti 0:0805c5a1b328 97 // len = sizeof(auto_ps3);
ideguti 0:0805c5a1b328 98 default:
ideguti 0:0805c5a1b328 99 printf("Interrupt endpoint %02X %08X\r\n",ed->bEndpointAddress,evt);
ideguti 0:0805c5a1b328 100 break;
ideguti 0:0805c5a1b328 101 }
ideguti 0:0805c5a1b328 102 if (dst)
ideguti 0:0805c5a1b328 103 {
ideguti 0:0805c5a1b328 104 printf("Auto Event for %02X %08X\r\n",ed->bEndpointAddress,evt);
ideguti 0:0805c5a1b328 105 USBInterruptTransfer(device,ed->bEndpointAddress,dst,len,AutoEventCallback,(void*)evt);
ideguti 0:0805c5a1b328 106 }
ideguti 0:0805c5a1b328 107 }
ideguti 0:0805c5a1b328 108
ideguti 0:0805c5a1b328 109 void PrintString(int device, int i)
ideguti 0:0805c5a1b328 110 {
ideguti 0:0805c5a1b328 111 u8 buffer[256];
ideguti 0:0805c5a1b328 112 int le = GetDescriptor(device,DESCRIPTOR_TYPE_STRING,i,buffer,255);
ideguti 0:0805c5a1b328 113 if (le < 0)
ideguti 0:0805c5a1b328 114 return;
ideguti 0:0805c5a1b328 115 char* dst = (char*)buffer;
ideguti 0:0805c5a1b328 116 for (int j = 2; j < le; j += 2)
ideguti 0:0805c5a1b328 117 *dst++ = buffer[j];
ideguti 0:0805c5a1b328 118 *dst = 0;
ideguti 0:0805c5a1b328 119 printf("%d:%s\r\n",i,(const char*)buffer);
ideguti 0:0805c5a1b328 120 }
ideguti 0:0805c5a1b328 121
ideguti 0:0805c5a1b328 122 // Walk descriptors and create endpoints for a given device
ideguti 0:0805c5a1b328 123 int StartAutoEvent(int device, int configuration, int interfaceNumber)
ideguti 0:0805c5a1b328 124 {
ideguti 0:0805c5a1b328 125
ideguti 0:0805c5a1b328 126 printf("StartAutoEvent \r\n");
ideguti 0:0805c5a1b328 127
ideguti 0:0805c5a1b328 128 u8 buffer[255];
ideguti 0:0805c5a1b328 129 int err = GetDescriptor(device,DESCRIPTOR_TYPE_CONFIGURATION,0,buffer,255);
ideguti 0:0805c5a1b328 130 if (err < 0)
ideguti 0:0805c5a1b328 131 return err;
ideguti 0:0805c5a1b328 132
ideguti 0:0805c5a1b328 133 int len = buffer[2] | (buffer[3] << 8);
ideguti 0:0805c5a1b328 134 u8* d = buffer;
ideguti 0:0805c5a1b328 135 u8* end = d + len;
ideguti 0:0805c5a1b328 136 while (d < end)
ideguti 0:0805c5a1b328 137 {
ideguti 0:0805c5a1b328 138 if (d[1] == DESCRIPTOR_TYPE_INTERFACE)
ideguti 0:0805c5a1b328 139 {
ideguti 0:0805c5a1b328 140 InterfaceDescriptor* id = (InterfaceDescriptor*)d;
ideguti 0:0805c5a1b328 141 if (id->bInterfaceNumber == interfaceNumber)
ideguti 0:0805c5a1b328 142 {
ideguti 0:0805c5a1b328 143 d += d[0];
ideguti 0:0805c5a1b328 144 while (d < end && d[1] != DESCRIPTOR_TYPE_INTERFACE)
ideguti 0:0805c5a1b328 145 {
ideguti 0:0805c5a1b328 146 if (d[1] == DESCRIPTOR_TYPE_ENDPOINT)
ideguti 0:0805c5a1b328 147 AddAutoEvent(device,id,(EndpointDescriptor*)d);
ideguti 0:0805c5a1b328 148 d += d[0];
ideguti 0:0805c5a1b328 149 }
ideguti 0:0805c5a1b328 150 }
ideguti 0:0805c5a1b328 151 }
ideguti 0:0805c5a1b328 152 d += d[0];
ideguti 0:0805c5a1b328 153 }
ideguti 0:0805c5a1b328 154 return 0;
ideguti 0:0805c5a1b328 155 }
ideguti 0:0805c5a1b328 156
ideguti 0:0805c5a1b328 157 /*
ideguti 0:0805c5a1b328 158 int StartPS3Event(int device, int configuration, int interfaceNumber)
ideguti 0:0805c5a1b328 159 {
ideguti 0:0805c5a1b328 160
ideguti 0:0805c5a1b328 161 printf("StartPS3Event \r\n");
ideguti 0:0805c5a1b328 162
ideguti 0:0805c5a1b328 163 EndpointDescriptor* ep;
ideguti 0:0805c5a1b328 164
ideguti 0:0805c5a1b328 165 u8 buf[4];
ideguti 0:0805c5a1b328 166 buf[0] = 0x42;
ideguti 0:0805c5a1b328 167 buf[1] = 0x0c;
ideguti 0:0805c5a1b328 168 buf[2] = 0x00;
ideguti 0:0805c5a1b328 169 buf[3] = 0x00;
ideguti 0:0805c5a1b328 170
ideguti 0:0805c5a1b328 171 u8 buf2[8];
ideguti 0:0805c5a1b328 172 u8 buf3[8];
ideguti 0:0805c5a1b328 173
ideguti 0:0805c5a1b328 174 buf2[0] = 0x01;
ideguti 0:0805c5a1b328 175 buf2[1] = 0x00;
ideguti 0:0805c5a1b328 176 buf2[2] = 0x00;
ideguti 0:0805c5a1b328 177 buf2[3] = 0x02;
ideguti 0:0805c5a1b328 178 buf2[4] = 0x72;
ideguti 0:0805c5a1b328 179 buf2[5] = 0xAD;
ideguti 0:0805c5a1b328 180 buf2[6] = 0xF3;
ideguti 0:0805c5a1b328 181 buf2[7] = 0x5B;
ideguti 0:0805c5a1b328 182
ideguti 0:0805c5a1b328 183
ideguti 0:0805c5a1b328 184
ideguti 0:0805c5a1b328 185
ideguti 0:0805c5a1b328 186 int result;
ideguti 0:0805c5a1b328 187 int err;
ideguti 0:0805c5a1b328 188
ideguti 0:0805c5a1b328 189 u8 buffer[255];
ideguti 0:0805c5a1b328 190 err = GetDescriptor(device,DESCRIPTOR_TYPE_CONFIGURATION,0,buffer,255);
ideguti 0:0805c5a1b328 191 if (err < 0)
ideguti 0:0805c5a1b328 192 return err;
ideguti 0:0805c5a1b328 193
ideguti 0:0805c5a1b328 194
ideguti 0:0805c5a1b328 195
ideguti 0:0805c5a1b328 196 //configure the device
ideguti 0:0805c5a1b328 197 //err = USBControlTransfer(device, HOST_TO_DEVICE|REQUEST_TYPE_STANDARD|RECIPIENT_DEVICE, SET_CONFIGURATION, 1, 0, 0, 0, 0, 0 );
ideguti 0:0805c5a1b328 198 err = SetConfiguration(device,1);
ideguti 0:0805c5a1b328 199 printf("set config result = %d\r\n", err);
ideguti 0:0805c5a1b328 200
ideguti 0:0805c5a1b328 201 // get Mac address
ideguti 0:0805c5a1b328 202 //err = USBControlTransfer(device, HOST_TO_DEVICE|REQUEST_TYPE_CLASS|RECIPIENT_DEVICE, HID_REQUEST_GET_REPORT, 0x03f5, 0, buf3, sizeof(buf3), 0, 0 );
ideguti 0:0805c5a1b328 203 //printf("get Mac to %02X:%02X:%02X:%02X:%02X:%02X , result = %d\r\n", buf3[2], buf3[3], buf3[4], buf3[5], buf3[6], buf3[7], err);
ideguti 0:0805c5a1b328 204
ideguti 0:0805c5a1b328 205 // set Mac address
ideguti 0:0805c5a1b328 206 err = USBControlTransfer(device, HOST_TO_DEVICE|REQUEST_TYPE_CLASS|RECIPIENT_INTERFACE, HID_REQUEST_SET_REPORT, 0x03f5, 0, buf2, sizeof(buf2), 0, 0 );
ideguti 0:0805c5a1b328 207 printf("set Mac to %02X:%02X:%02X:%02X:%02X:%02X , result = %d\r\n", buf2[2], buf2[3], buf2[4], buf2[5], buf2[6], buf2[7], err);
ideguti 0:0805c5a1b328 208
ideguti 0:0805c5a1b328 209 // get Mac address
ideguti 0:0805c5a1b328 210 //err = USBControlTransfer(device, HOST_TO_DEVICE|REQUEST_TYPE_CLASS|RECIPIENT_DEVICE, HID_REQUEST_GET_REPORT, 0x03f5, 0, buf3, sizeof(buf3), 0, 0 );
ideguti 0:0805c5a1b328 211 //printf("get Mac to %02X:%02X:%02X:%02X:%02X:%02X , result = %d\r\n", buf3[2], buf3[3], buf3[4], buf3[5], buf3[6], buf3[7], err);
ideguti 0:0805c5a1b328 212
ideguti 0:0805c5a1b328 213 err = USBControlTransfer(device, HOST_TO_DEVICE|REQUEST_TYPE_CLASS|RECIPIENT_INTERFACE, HID_REQUEST_SET_REPORT, 0x03f4,0, buf, sizeof(buf), 0, 0 );
ideguti 0:0805c5a1b328 214 printf("set report result = %d\r\n", err);
ideguti 0:0805c5a1b328 215 //USBTransfer(device,0,DEVICE_TO_HOST,buf,sizeof(buf),0,0);
ideguti 0:0805c5a1b328 216
ideguti 0:0805c5a1b328 217 int len = buffer[2] | (buffer[3] << 8);
ideguti 0:0805c5a1b328 218 u8* d = buffer;
ideguti 0:0805c5a1b328 219 u8* end = d + len;
ideguti 0:0805c5a1b328 220 while (d < end)
ideguti 0:0805c5a1b328 221 {
ideguti 0:0805c5a1b328 222 if (d[1] == DESCRIPTOR_TYPE_INTERFACE)
ideguti 0:0805c5a1b328 223 {
ideguti 0:0805c5a1b328 224 InterfaceDescriptor* id = (InterfaceDescriptor*)d;
ideguti 0:0805c5a1b328 225 if (id->bInterfaceNumber == interfaceNumber)
ideguti 0:0805c5a1b328 226 {
ideguti 0:0805c5a1b328 227 d += d[0];
ideguti 0:0805c5a1b328 228 while (d < end && d[1] != DESCRIPTOR_TYPE_INTERFACE)
ideguti 0:0805c5a1b328 229 {
ideguti 0:0805c5a1b328 230 if (d[1] == DESCRIPTOR_TYPE_ENDPOINT)
ideguti 0:0805c5a1b328 231 ep = (EndpointDescriptor*)d;
ideguti 0:0805c5a1b328 232
ideguti 0:0805c5a1b328 233 if (ep->bEndpointAddress == 0x02) {
ideguti 0:0805c5a1b328 234 printf("PS3 input endpoint (0x02) found\r\n");
ideguti 0:0805c5a1b328 235
ideguti 0:0805c5a1b328 236 }
ideguti 0:0805c5a1b328 237 if (ep->bEndpointAddress == 0x81) {
ideguti 0:0805c5a1b328 238 printf("PS3 output endpoint (0x81) found\r\n");
ideguti 0:0805c5a1b328 239 AddAutoEvent(device,id,(EndpointDescriptor*)d);
ideguti 0:0805c5a1b328 240 }
ideguti 0:0805c5a1b328 241 d += d[0];
ideguti 0:0805c5a1b328 242 }
ideguti 0:0805c5a1b328 243 }
ideguti 0:0805c5a1b328 244 }
ideguti 0:0805c5a1b328 245 d += d[0];
ideguti 0:0805c5a1b328 246 }
ideguti 0:0805c5a1b328 247 return 0;
ideguti 0:0805c5a1b328 248 }
ideguti 0:0805c5a1b328 249 */
ideguti 0:0805c5a1b328 250
ideguti 0:0805c5a1b328 251 // Implemented in main.cpp
ideguti 0:0805c5a1b328 252 int OnDiskInsert(int device);
ideguti 0:0805c5a1b328 253
ideguti 0:0805c5a1b328 254 // Implemented in TestShell.cpp
ideguti 0:0805c5a1b328 255 int OnBluetoothInsert(int device);
ideguti 0:0805c5a1b328 256
ideguti 0:0805c5a1b328 257 void OnLoadDevice(int device, DeviceDescriptor* deviceDesc, InterfaceDescriptor* interfaceDesc)
ideguti 0:0805c5a1b328 258 {
ideguti 0:0805c5a1b328 259 printf("LoadDevice %d %02X:%02X:%02X\r\n",device,interfaceDesc->bInterfaceClass,interfaceDesc->bInterfaceSubClass,interfaceDesc->bInterfaceProtocol);
ideguti 0:0805c5a1b328 260 char s[128];
ideguti 0:0805c5a1b328 261 u8 my_mac[6] = {0x00, 0x1B, 0xDC, 0x06, 0x39, 0x56}; // mac address of my Bluetooth device
ideguti 0:0805c5a1b328 262
ideguti 0:0805c5a1b328 263 u8 buf2[6];
ideguti 0:0805c5a1b328 264
ideguti 0:0805c5a1b328 265 buf2[0] = 0x00;
ideguti 0:0805c5a1b328 266 buf2[1] = 0x02;
ideguti 0:0805c5a1b328 267 buf2[2] = 0x72;
ideguti 0:0805c5a1b328 268 buf2[3] = 0xAD;
ideguti 0:0805c5a1b328 269 buf2[4] = 0xF3;
ideguti 0:0805c5a1b328 270 buf2[5] = 0x5B;
ideguti 0:0805c5a1b328 271
ideguti 0:0805c5a1b328 272
ideguti 0:0805c5a1b328 273 for (int i = 1; i < 3; i++)
ideguti 0:0805c5a1b328 274 {
ideguti 0:0805c5a1b328 275 if (GetString(device,i,s,sizeof(s)) < 0)
ideguti 0:0805c5a1b328 276 break;
ideguti 0:0805c5a1b328 277 printf("%d: %s\r\n",i,s);
ideguti 0:0805c5a1b328 278 }
ideguti 0:0805c5a1b328 279
ideguti 0:0805c5a1b328 280 switch (interfaceDesc->bInterfaceClass)
ideguti 0:0805c5a1b328 281 {
ideguti 0:0805c5a1b328 282 case CLASS_MASS_STORAGE:
ideguti 0:0805c5a1b328 283 if (interfaceDesc->bInterfaceSubClass == 0x06 && interfaceDesc->bInterfaceProtocol == 0x50)
ideguti 0:0805c5a1b328 284 OnDiskInsert(device); // it's SCSI!
ideguti 0:0805c5a1b328 285 break;
ideguti 0:0805c5a1b328 286 case CLASS_WIRELESS_CONTROLLER:
ideguti 0:0805c5a1b328 287 if (interfaceDesc->bInterfaceSubClass == 0x01 && interfaceDesc->bInterfaceProtocol == 0x01)
ideguti 0:0805c5a1b328 288 OnBluetoothInsert(device); // it's bluetooth!
ideguti 0:0805c5a1b328 289 break;
ideguti 0:0805c5a1b328 290 case CLASS_HID:
ideguti 0:0805c5a1b328 291 //追加部分
ideguti 0:0805c5a1b328 292 /*if (interfaceDesc->bInterfaceSubClass == 0x01 && interfaceDesc->bInterfaceProtocol == 0x01)
ideguti 0:0805c5a1b328 293 OnBluetoothInsert(device); // it's bluetooth!
ideguti 0:0805c5a1b328 294 break;
ideguti 0:0805c5a1b328 295 *///追加部分ここまで
ideguti 0:0805c5a1b328 296 printf("idVendor = %04X idProduct = %04X \r\n",deviceDesc->idVendor,deviceDesc->idProduct);
ideguti 0:0805c5a1b328 297 //printf("device = %d configuration = %d interfaceNumber = %d\r\n", device, configuration, interfaceNumber);
ideguti 0:0805c5a1b328 298 //if (deviceDesc->idVendor == 0x054C && deviceDesc->idProduct == 0x0268) StartPS3Event(device,1,0);
ideguti 0:0805c5a1b328 299 if (deviceDesc->idVendor == 0x054C && deviceDesc->idProduct == 0x0268) {
ideguti 0:0805c5a1b328 300 Ps3USB _Ps3USB(device,1,0);
ideguti 0:0805c5a1b328 301
ideguti 0:0805c5a1b328 302 _Ps3USB.SetPair(my_mac);
ideguti 0:0805c5a1b328 303 _Ps3USB.Enable();
ideguti 0:0805c5a1b328 304 _Ps3USB.Led(1);
ideguti 0:0805c5a1b328 305 _Ps3USB.Rumble(0x20,0xff,0x20,0xff);
ideguti 0:0805c5a1b328 306 _Ps3USB.ShowPair();
ideguti 0:0805c5a1b328 307
ideguti 0:0805c5a1b328 308 }
ideguti 0:0805c5a1b328 309 else StartAutoEvent(device,1,0);
ideguti 0:0805c5a1b328 310 break;
ideguti 0:0805c5a1b328 311 default:
ideguti 0:0805c5a1b328 312 printf("Not yet supported \r\n");
ideguti 0:0805c5a1b328 313 //StartAutoEvent(device,1,0);
ideguti 0:0805c5a1b328 314 break;
ideguti 0:0805c5a1b328 315 }
ideguti 0:0805c5a1b328 316 }