主導機 mbed用のプログラムです

Dependencies:   mbed

Fork of F3RC_syudou_master by F3RC1班

Committer:
hirokimineshita
Date:
Thu Apr 30 05:59:05 2015 +0000
Revision:
0:736c76a75def
Child:
8:6d0de6154e8f
2015/04/30 PM 2 upload

Who changed what in which revision?

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