Xoom compatibility

This commit is contained in:
Oleg Mazurov 2012-02-06 07:49:01 -07:00
parent 2f031cea85
commit 389c6115e3
3 changed files with 33 additions and 7 deletions

6
Usb.h
View file

@ -47,8 +47,14 @@ e-mail : support@circuitsathome.com
/* shield pins. First parameter - SS pin, second parameter - INT pin */ /* shield pins. First parameter - SS pin, second parameter - INT pin */
#if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
#define BOARD_TEENSY_PLUS_PLUS
#endif
#ifdef BOARD_BLACK_WIDDOW #ifdef BOARD_BLACK_WIDDOW
typedef MAX3421e<P6, P3> MAX3421E; // Black Widow typedef MAX3421e<P6, P3> MAX3421E; // Black Widow
#elif defined(BOARD_TEENSY_PLUS_PLUS)
typedef MAX3421e<P9, P8> MAX3421E; // Teensy++ 2.0 & 1.0
#elif defined(BOARD_MEGA_ADK) #elif defined(BOARD_MEGA_ADK)
typedef MAX3421e<P53, P54> MAX3421E; // Arduino Mega ADK typedef MAX3421e<P53, P54> MAX3421E; // Arduino Mega ADK
#else #else

26
adk.cpp
View file

@ -49,8 +49,8 @@ ADK::ADK(USB *p, const char* manufacturer,
epInfo[i].epAddr = 0; epInfo[i].epAddr = 0;
epInfo[i].maxPktSize = (i) ? 0 : 8; epInfo[i].maxPktSize = (i) ? 0 : 8;
epInfo[i].epAttribs = 0; epInfo[i].epAttribs = 0;
//epInfo[i].bmNakPower = (i) ? USB_NAK_NOWAIT : USB_NAK_MAX_POWER; epInfo[i].bmNakPower = (i) ? USB_NAK_NOWAIT : USB_NAK_MAX_POWER;
epInfo[i].bmNakPower = USB_NAK_MAX_POWER; //epInfo[i].bmNakPower = USB_NAK_MAX_POWER;
}//for(uint8_t i=0; i<ADK_MAX_ENDPOINTS; i++... }//for(uint8_t i=0; i<ADK_MAX_ENDPOINTS; i++...
// register in USB subsystem // register in USB subsystem
@ -156,7 +156,16 @@ uint8_t ADK::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<0, 0, 0, 0> confDescrParser(this); ConfigDescParser<0, 0, 0, 0> confDescrParser(this);
delay(1);
rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser); rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
#if defined(XOOM)
//added by Jaylen Scott Vanorden
if( rcode ) {
USBTRACE2("\r\nGot 1st bad code for config: ", rcode);
// Try once more
rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
}
#endif
if( rcode ) { if( rcode ) {
goto FailGetConfDescr; goto FailGetConfDescr;
} }
@ -173,8 +182,6 @@ uint8_t ADK::Init(uint8_t parent, uint8_t port, bool lowspeed)
} }
} }
// Set Configuration Value // Set Configuration Value
rcode = pUsb->setConf(bAddress, 0, bConfNum); rcode = pUsb->setConf(bAddress, 0, bConfNum);
if( rcode ){ if( rcode ){
@ -200,12 +207,21 @@ uint8_t ADK::Init(uint8_t parent, uint8_t port, bool lowspeed)
return 0; //successful configuration return 0; //successful configuration
}//if( buf->idVendor == ADK_VID... }//if( buf->idVendor == ADK_VID...
delay(20); //testing compatibility w/Motorola Xoom //delay(20); //testing compatibility w/Motorola Xoom
//probe device - get accessory protocol revision //probe device - get accessory protocol revision
{ {
uint16_t adkproto = -1; uint16_t adkproto = -1;
delay(1);
rcode = getProto((uint8_t*)&adkproto ); rcode = getProto((uint8_t*)&adkproto );
#if defined(XOOM)
//added by Jaylen Scott Vanorden
if( rcode ) {
USBTRACE2("\r\nGot 1st bad code for proto: ", rcode);
// Try once more
rcode = getProto((uint8_t*)&adkproto );
}
#endif
if( rcode ){ if( rcode ){
goto FailGetProto; //init fails goto FailGetProto; //init fails
} }

4
adk.h
View file

@ -44,6 +44,10 @@ e-mail : support@circuitsathome.com
#define ADK_PID 0x2D00 #define ADK_PID 0x2D00
#define ADB_PID 0x2D01 #define ADB_PID 0x2D01
#define XOOM //enables repeating getProto() and getConf() attempts
//necessary for slow devices such as Motorola XOOM
//defined by default, can be commented out to save memory
/* requests */ /* requests */
#define ADK_GETPROTO 51 //check USB accessory protocol version #define ADK_GETPROTO 51 //check USB accessory protocol version