Minor edit

This commit is contained in:
Kristian Lauszus 2012-04-11 02:18:25 +02:00
parent d4fcf68de4
commit f16e348199
2 changed files with 7 additions and 13 deletions

View file

@ -195,12 +195,10 @@ uint8_t PS3BT::Init(uint8_t parent, uint8_t port, bool lowspeed)
for (uint8_t i=0; i<num_of_conf; i++) { for (uint8_t i=0; i<num_of_conf; i++) {
ConfigDescParser<USB_CLASS_WIRELESS_CTRL, WI_SUBCLASS_RF, WI_PROTOCOL_BT, CP_MASK_COMPARE_ALL> confDescrParser(this); ConfigDescParser<USB_CLASS_WIRELESS_CTRL, WI_SUBCLASS_RF, WI_PROTOCOL_BT, CP_MASK_COMPARE_ALL> confDescrParser(this);
rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser); rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
if( rcode ) { if(rcode)
goto FailGetConfDescr; goto FailGetConfDescr;
} if( bNumEP > 3 ) //all endpoints extracted
if( bNumEP > 3 ) { //all endpoints extracted
break; break;
}
} // for (uint8_t i=0; i<num_of_conf; i++... } // for (uint8_t i=0; i<num_of_conf; i++...
if (bNumEP < PS3_MAX_ENDPOINTS) { if (bNumEP < PS3_MAX_ENDPOINTS) {
@ -213,9 +211,7 @@ uint8_t PS3BT::Init(uint8_t parent, uint8_t port, bool lowspeed)
if( rcode ) if( rcode )
goto FailSetDevTblEntry; goto FailSetDevTblEntry;
delay(200); // Give time for address change delay(200); // Give time for address change
//rcode = pUsb->setConf(bAddress, epInfo[ CSR_CONTROL_PIPE ].epAddr, bConfigurationValue);//bConfigurationValue = 0x01
// Set Configuration Value // Set Configuration Value
rcode = pUsb->setConf(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, bConfNum); rcode = pUsb->setConf(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, bConfNum);
@ -259,7 +255,7 @@ uint8_t PS3BT::Init(uint8_t parent, uint8_t port, bool lowspeed)
delay(200);//Give time for address change delay(200);//Give time for address change
rcode = pUsb->setConf(bAddress, epInfo[ PS3_CONTROL_PIPE ].epAddr, bConfigurationValue);//bConfigurationValue = 0x01 rcode = pUsb->setConf(bAddress, epInfo[ PS3_CONTROL_PIPE ].epAddr, 1);
if( rcode ) if( rcode )
goto FailSetConf; goto FailSetConf;
@ -1134,9 +1130,7 @@ void PS3BT::L2CAP_task()
l2cap_state = L2CAP_EV_HID_ENABLE_SIXAXIS; l2cap_state = L2CAP_EV_HID_ENABLE_SIXAXIS;
} }
break; break;
case L2CAP_EV_HID_ENABLE_SIXAXIS: case L2CAP_EV_HID_ENABLE_SIXAXIS:
delay(1000);//There has to be a delay before sending the commands
for (uint8_t i = 0; i < BULK_MAXPKTSIZE; i++)//Reset l2cap in buffer as it sometimes read it as a button has been pressed for (uint8_t i = 0; i < BULK_MAXPKTSIZE; i++)//Reset l2cap in buffer as it sometimes read it as a button has been pressed
l2capinbuf[i] = 0; l2capinbuf[i] = 0;
ButtonState = 0; ButtonState = 0;
@ -1144,6 +1138,7 @@ void PS3BT::L2CAP_task()
if (remote_name[0] == 'P')//First letter in PLAYSTATION(R)3 Controller ('P') - 0x50 if (remote_name[0] == 'P')//First letter in PLAYSTATION(R)3 Controller ('P') - 0x50
{ {
delay(1000);//There has to be a delay before sending the commands
enable_sixaxis(); enable_sixaxis();
for (uint8_t i = 15; i < 19; i++) for (uint8_t i = 15; i < 19; i++)
@ -1158,6 +1153,7 @@ void PS3BT::L2CAP_task()
} }
else if (remote_name[0] == 'N')//First letter in Navigation Controller ('N') - 0x4E else if (remote_name[0] == 'N')//First letter in Navigation Controller ('N') - 0x4E
{ {
delay(1000);//There has to be a delay before sending the commands
enable_sixaxis(); enable_sixaxis();
for (uint8_t i = 15; i < 19; i++) for (uint8_t i = 15; i < 19; i++)

View file

@ -152,8 +152,6 @@
#define PENDING 0x01 #define PENDING 0x01
#define SUCCESSFUL 0x00 #define SUCCESSFUL 0x00
#define bConfigurationValue 0x01 // Used to set configuration
#define PS3_MAX_ENDPOINTS 4 #define PS3_MAX_ENDPOINTS 4
#define WI_SUBCLASS_RF 0x01 #define WI_SUBCLASS_RF 0x01
#define WI_PROTOCOL_BT 0x01 #define WI_PROTOCOL_BT 0x01