Skip to content

Commit

Permalink
fix all warnings for ARM, fix a few small bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
xxxajk committed Dec 4, 2013
1 parent 8715cbd commit e18eb57
Show file tree
Hide file tree
Showing 25 changed files with 461 additions and 338 deletions.
11 changes: 6 additions & 5 deletions BTD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ bPollEnable(false) // Don't start polling before dongle is connected
uint8_t BTD::ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed) {
const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR);
uint8_t buf[constBufSize];
USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
uint8_t rcode;
UsbDevice *p = NULL;
EpInfo *oldep_ptr = NULL;
Expand Down Expand Up @@ -98,11 +99,11 @@ uint8_t BTD::ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed) {
return USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL;
}

epInfo[0].maxPktSize = (uint8_t)((USB_DEVICE_DESCRIPTOR*)buf)->bMaxPacketSize0; // Extract Max Packet Size from device descriptor
epInfo[1].epAddr = ((USB_DEVICE_DESCRIPTOR*)buf)->bNumConfigurations; // Steal and abuse from epInfo structure to save memory
epInfo[0].maxPktSize = udd->bMaxPacketSize0; // Extract Max Packet Size from device descriptor
epInfo[1].epAddr = udd->bNumConfigurations; // Steal and abuse from epInfo structure to save memory

VID = ((USB_DEVICE_DESCRIPTOR*)buf)->idVendor;
PID = ((USB_DEVICE_DESCRIPTOR*)buf)->idProduct;
VID = udd->idVendor;
PID = udd->idProduct;

return USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET;

Expand Down Expand Up @@ -249,8 +250,8 @@ uint8_t BTD::Init(uint8_t parent, uint8_t port, bool lowspeed) {
return 0; // Successful configuration

/* diagnostic messages */
FailGetDevDescr:
#ifdef DEBUG_USB_HOST
FailGetDevDescr:
NotifyFailGetDevDescr();
goto Fail;
#endif
Expand Down
4 changes: 2 additions & 2 deletions BTD.h
Original file line number Diff line number Diff line change
Expand Up @@ -468,13 +468,13 @@ class BTD : public USBDeviceConfig, public UsbConfigXtracter {

uint16_t PID, VID; // PID and VID of device connected

bool bPollEnable;
uint8_t pollInterval;
bool bPollEnable;

/* Variables used by high level HCI task */
uint8_t hci_state; //current state of bluetooth hci connection
uint16_t hci_counter; // counter used for bluetooth hci reset loops
uint8_t hci_num_reset_loops; // this value indicate how many times it should read before trying to reset
uint16_t hci_num_reset_loops; // this value indicate how many times it should read before trying to reset
uint16_t hci_event_flag; // hci flags of received bluetooth events
uint8_t inquiry_counter;

Expand Down
22 changes: 12 additions & 10 deletions PS3USB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ bPollEnable(false) // don't start polling before dongle is connected

uint8_t PS3USB::Init(uint8_t parent, uint8_t port, bool lowspeed) {
uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
uint8_t rcode;
UsbDevice *p = NULL;
EpInfo *oldep_ptr = NULL;
Expand Down Expand Up @@ -97,8 +98,8 @@ uint8_t PS3USB::Init(uint8_t parent, uint8_t port, bool lowspeed) {
if (rcode)
goto FailGetDevDescr;

VID = ((USB_DEVICE_DESCRIPTOR*)buf)->idVendor;
PID = ((USB_DEVICE_DESCRIPTOR*)buf)->idProduct;
VID = udd->idVendor;
PID = udd->idProduct;

if (VID != PS3_VID || (PID != PS3_PID && PID != PS3NAVIGATION_PID && PID != PS3MOVE_PID))
goto FailUnknownDevice;
Expand All @@ -110,7 +111,7 @@ uint8_t PS3USB::Init(uint8_t parent, uint8_t port, bool lowspeed) {
return USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL;

// Extract Max Packet Size from device descriptor
epInfo[0].maxPktSize = (uint8_t)((USB_DEVICE_DESCRIPTOR*)buf)->bMaxPacketSize0;
epInfo[0].maxPktSize = udd->bMaxPacketSize0;

// Assign new address to the device
rcode = pUsb->setAddr(0, 0, bAddress);
Expand All @@ -129,7 +130,7 @@ uint8_t PS3USB::Init(uint8_t parent, uint8_t port, bool lowspeed) {
D_PrintHex<uint8_t > (bAddress, 0x80);
#endif
delay(300); // Spec says you should wait at least 200ms

p->lowspeed = false;

//get pointer to assigned address record
Expand All @@ -154,14 +155,14 @@ uint8_t PS3USB::Init(uint8_t parent, uint8_t port, bool lowspeed) {
epInfo[ PS3_OUTPUT_PIPE ].epAttribs = EP_INTERRUPT;
epInfo[ PS3_OUTPUT_PIPE ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
epInfo[ PS3_OUTPUT_PIPE ].maxPktSize = EP_MAXPKTSIZE;
epInfo[ PS3_OUTPUT_PIPE ].bmSndToggle = bmSNDTOG0;
epInfo[ PS3_OUTPUT_PIPE ].bmRcvToggle = bmRCVTOG0;
epInfo[ PS3_OUTPUT_PIPE ].bmSndToggle = 0;
epInfo[ PS3_OUTPUT_PIPE ].bmRcvToggle = 0;
epInfo[ PS3_INPUT_PIPE ].epAddr = 0x01; // PS3 report endpoint
epInfo[ PS3_INPUT_PIPE ].epAttribs = EP_INTERRUPT;
epInfo[ PS3_INPUT_PIPE ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
epInfo[ PS3_INPUT_PIPE ].maxPktSize = EP_MAXPKTSIZE;
epInfo[ PS3_INPUT_PIPE ].bmSndToggle = bmSNDTOG0;
epInfo[ PS3_INPUT_PIPE ].bmRcvToggle = bmRCVTOG0;
epInfo[ PS3_INPUT_PIPE ].bmSndToggle = 0;
epInfo[ PS3_INPUT_PIPE ].bmRcvToggle = 0;

rcode = pUsb->setEpInfoEntry(bAddress, 3, epInfo);
if (rcode)
Expand Down Expand Up @@ -237,16 +238,17 @@ uint8_t PS3USB::Init(uint8_t parent, uint8_t port, bool lowspeed) {
FailSetConfDescr:
#ifdef DEBUG_USB_HOST
NotifyFailSetConfDescr();
#endif
goto Fail;
#endif

FailUnknownDevice:
#ifdef DEBUG_USB_HOST
NotifyFailUnknownDevice(VID, PID);
#endif
rcode = USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED;
Fail:

#ifdef DEBUG_USB_HOST
Fail:
Notify(PSTR("\r\nPS3 Init Failed, error code: "), 0x80);
NotifyFail(rcode);
#endif
Expand Down
11 changes: 6 additions & 5 deletions Usb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ uint8_t USB::Configuring(uint8_t parent, uint8_t port, bool lowspeed) {
uint8_t devConfigIndex;
uint8_t rcode = 0;
uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
USB_DEVICE_DESCRIPTOR *udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR *>(buf);
UsbDevice *p = NULL;
EpInfo *oldep_ptr = NULL;
EpInfo epInfo;
Expand Down Expand Up @@ -694,10 +695,9 @@ uint8_t USB::Configuring(uint8_t parent, uint8_t port, bool lowspeed) {

//if (!bAddress)
// return USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL;

uint16_t vid = (uint16_t)((USB_DEVICE_DESCRIPTOR*)buf)->idVendor;
uint16_t pid = (uint16_t)((USB_DEVICE_DESCRIPTOR*)buf)->idProduct;
uint8_t klass = ((USB_DEVICE_DESCRIPTOR*)buf)->bDeviceClass;
uint16_t vid = udd->idVendor;
uint16_t pid = udd->idProduct;
uint8_t klass = udd->bDeviceClass;

// Attempt to configure if VID/PID or device class matches with a driver
for (devConfigIndex = 0; devConfigIndex < USB_NUMDEVICES; devConfigIndex++) {
Expand Down Expand Up @@ -767,13 +767,14 @@ uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t con
uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser *p) {
const uint8_t bufSize = 64;
uint8_t buf[bufSize];
USB_CONFIGURATION_DESCRIPTOR *ucd = reinterpret_cast<USB_CONFIGURATION_DESCRIPTOR *>(buf);

uint8_t ret = getConfDescr(addr, ep, 9, conf, buf);

if (ret)
return ret;

uint16_t total = ((USB_CONFIGURATION_DESCRIPTOR*)buf)->wTotalLength;
uint16_t total = ucd->wTotalLength;

//USBTRACE2("\r\ntotal conf.size:", total);

Expand Down
23 changes: 12 additions & 11 deletions XBOXOLD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const uint8_t XBOXOLDBUTTONS[] PROGMEM = {
0, // A
2, // X
3, // Y
};
};

XBOXOLD::XBOXOLD(USB *p) :
pUsb(p), // pointer to USB class instance - mandatory
Expand All @@ -61,6 +61,7 @@ bPollEnable(false) { // don't start polling before dongle is connected

uint8_t XBOXOLD::Init(uint8_t parent, uint8_t port, bool lowspeed) {
uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
uint8_t rcode;
UsbDevice *p = NULL;
EpInfo *oldep_ptr = NULL;
Expand Down Expand Up @@ -113,20 +114,20 @@ uint8_t XBOXOLD::Init(uint8_t parent, uint8_t port, bool lowspeed) {
if (rcode)
goto FailGetDevDescr;

VID = ((USB_DEVICE_DESCRIPTOR*)buf)->idVendor;
PID = ((USB_DEVICE_DESCRIPTOR*)buf)->idProduct;
VID = udd->idVendor;
PID = udd->idProduct;

if ((VID != XBOX_VID && VID != MADCATZ_VID && VID != JOYTECH_VID) || (PID != XBOX_OLD_PID1 && PID != XBOX_OLD_PID2 && PID != XBOX_OLD_PID3 && PID != XBOX_OLD_PID4)) // Check if VID and PID match
goto FailUnknownDevice;

// Allocate new address according to device class
bAddress = addrPool.AllocAddress(parent, false, port);

if (!bAddress)
return USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL;

// Extract Max Packet Size from device descriptor
epInfo[0].maxPktSize = (uint8_t)((USB_DEVICE_DESCRIPTOR*)buf)->bMaxPacketSize0;
epInfo[0].maxPktSize = udd->bMaxPacketSize0;

// Assign new address to the device
rcode = pUsb->setAddr(0, 0, bAddress);
Expand All @@ -145,7 +146,7 @@ uint8_t XBOXOLD::Init(uint8_t parent, uint8_t port, bool lowspeed) {
D_PrintHex<uint8_t > (bAddress, 0x80);
#endif
delay(300); // Spec says you should wait at least 200ms

p->lowspeed = false;

//get pointer to assigned address record
Expand All @@ -169,14 +170,14 @@ uint8_t XBOXOLD::Init(uint8_t parent, uint8_t port, bool lowspeed) {
epInfo[ XBOX_INPUT_PIPE ].epAttribs = EP_INTERRUPT;
epInfo[ XBOX_INPUT_PIPE ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
epInfo[ XBOX_INPUT_PIPE ].maxPktSize = EP_MAXPKTSIZE;
epInfo[ XBOX_INPUT_PIPE ].bmSndToggle = bmSNDTOG0;
epInfo[ XBOX_INPUT_PIPE ].bmRcvToggle = bmRCVTOG0;
epInfo[ XBOX_INPUT_PIPE ].bmSndToggle = 0;
epInfo[ XBOX_INPUT_PIPE ].bmRcvToggle = 0;
epInfo[ XBOX_OUTPUT_PIPE ].epAddr = 0x02; // XBOX output endpoint
epInfo[ XBOX_OUTPUT_PIPE ].epAttribs = EP_INTERRUPT;
epInfo[ XBOX_OUTPUT_PIPE ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
epInfo[ XBOX_OUTPUT_PIPE ].maxPktSize = EP_MAXPKTSIZE;
epInfo[ XBOX_OUTPUT_PIPE ].bmSndToggle = bmSNDTOG0;
epInfo[ XBOX_OUTPUT_PIPE ].bmRcvToggle = bmRCVTOG0;
epInfo[ XBOX_OUTPUT_PIPE ].bmSndToggle = 0;
epInfo[ XBOX_OUTPUT_PIPE ].bmRcvToggle = 0;

rcode = pUsb->setEpInfoEntry(bAddress, 3, epInfo);
if (rcode)
Expand Down Expand Up @@ -221,8 +222,8 @@ uint8_t XBOXOLD::Init(uint8_t parent, uint8_t port, bool lowspeed) {
#endif
rcode = USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED;

Fail:
#ifdef DEBUG_USB_HOST
Fail:
Notify(PSTR("\r\nXbox Init Failed, error code: "), 0x80);
NotifyFail(rcode);
#endif
Expand Down
53 changes: 30 additions & 23 deletions XBOXRECV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ bPollEnable(false) { // don't start polling before dongle is connected

uint8_t XBOXRECV::Init(uint8_t parent, uint8_t port, bool lowspeed) {
uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
uint8_t rcode;
UsbDevice *p = NULL;
EpInfo *oldep_ptr = NULL;
Expand Down Expand Up @@ -91,8 +92,8 @@ uint8_t XBOXRECV::Init(uint8_t parent, uint8_t port, bool lowspeed) {
if (rcode)
goto FailGetDevDescr;

VID = ((USB_DEVICE_DESCRIPTOR*)buf)->idVendor;
PID = ((USB_DEVICE_DESCRIPTOR*)buf)->idProduct;
VID = udd->idVendor;
PID = udd->idProduct;

if (VID != XBOX_VID && VID != MADCATZ_VID) // We just check if it's a Xbox receiver using the Vendor ID
goto FailUnknownDevice;
Expand All @@ -110,7 +111,7 @@ uint8_t XBOXRECV::Init(uint8_t parent, uint8_t port, bool lowspeed) {
return USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL;

// Extract Max Packet Size from device descriptor
epInfo[0].maxPktSize = (uint8_t)((USB_DEVICE_DESCRIPTOR*)buf)->bMaxPacketSize0;
epInfo[0].maxPktSize = udd->bMaxPacketSize0;

// Assign new address to the device
rcode = pUsb->setAddr(0, 0, bAddress);
Expand All @@ -129,7 +130,7 @@ uint8_t XBOXRECV::Init(uint8_t parent, uint8_t port, bool lowspeed) {
D_PrintHex<uint8_t > (bAddress, 0x80);
#endif
delay(300); // Spec says you should wait at least 200ms

p->lowspeed = false;

//get pointer to assigned address record
Expand All @@ -153,53 +154,53 @@ uint8_t XBOXRECV::Init(uint8_t parent, uint8_t port, bool lowspeed) {
epInfo[ XBOX_INPUT_PIPE_1 ].epAttribs = EP_INTERRUPT;
epInfo[ XBOX_INPUT_PIPE_1 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
epInfo[ XBOX_INPUT_PIPE_1 ].maxPktSize = EP_MAXPKTSIZE;
epInfo[ XBOX_INPUT_PIPE_1 ].bmSndToggle = bmSNDTOG0;
epInfo[ XBOX_INPUT_PIPE_1 ].bmRcvToggle = bmRCVTOG0;
epInfo[ XBOX_INPUT_PIPE_1 ].bmSndToggle = 0;
epInfo[ XBOX_INPUT_PIPE_1 ].bmRcvToggle = 0;
epInfo[ XBOX_OUTPUT_PIPE_1 ].epAddr = 0x01; // XBOX 360 output endpoint - poll interval 8ms
epInfo[ XBOX_OUTPUT_PIPE_1 ].epAttribs = EP_INTERRUPT;
epInfo[ XBOX_OUTPUT_PIPE_1 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
epInfo[ XBOX_OUTPUT_PIPE_1 ].maxPktSize = EP_MAXPKTSIZE;
epInfo[ XBOX_OUTPUT_PIPE_1 ].bmSndToggle = bmSNDTOG0;
epInfo[ XBOX_OUTPUT_PIPE_1 ].bmRcvToggle = bmRCVTOG0;
epInfo[ XBOX_OUTPUT_PIPE_1 ].bmSndToggle = 0;
epInfo[ XBOX_OUTPUT_PIPE_1 ].bmRcvToggle = 0;

epInfo[ XBOX_INPUT_PIPE_2 ].epAddr = 0x03; // XBOX 360 report endpoint - poll interval 1ms
epInfo[ XBOX_INPUT_PIPE_2 ].epAttribs = EP_INTERRUPT;
epInfo[ XBOX_INPUT_PIPE_2 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
epInfo[ XBOX_INPUT_PIPE_2 ].maxPktSize = EP_MAXPKTSIZE;
epInfo[ XBOX_INPUT_PIPE_2 ].bmSndToggle = bmSNDTOG0;
epInfo[ XBOX_INPUT_PIPE_2 ].bmRcvToggle = bmRCVTOG0;
epInfo[ XBOX_INPUT_PIPE_2 ].bmSndToggle = 0;
epInfo[ XBOX_INPUT_PIPE_2 ].bmRcvToggle = 0;
epInfo[ XBOX_OUTPUT_PIPE_2 ].epAddr = 0x03; // XBOX 360 output endpoint - poll interval 8ms
epInfo[ XBOX_OUTPUT_PIPE_2 ].epAttribs = EP_INTERRUPT;
epInfo[ XBOX_OUTPUT_PIPE_2 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
epInfo[ XBOX_OUTPUT_PIPE_2 ].maxPktSize = EP_MAXPKTSIZE;
epInfo[ XBOX_OUTPUT_PIPE_2 ].bmSndToggle = bmSNDTOG0;
epInfo[ XBOX_OUTPUT_PIPE_2 ].bmRcvToggle = bmRCVTOG0;
epInfo[ XBOX_OUTPUT_PIPE_2 ].bmSndToggle = 0;
epInfo[ XBOX_OUTPUT_PIPE_2 ].bmRcvToggle = 0;

epInfo[ XBOX_INPUT_PIPE_3 ].epAddr = 0x05; // XBOX 360 report endpoint - poll interval 1ms
epInfo[ XBOX_INPUT_PIPE_3 ].epAttribs = EP_INTERRUPT;
epInfo[ XBOX_INPUT_PIPE_3 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
epInfo[ XBOX_INPUT_PIPE_3 ].maxPktSize = EP_MAXPKTSIZE;
epInfo[ XBOX_INPUT_PIPE_3 ].bmSndToggle = bmSNDTOG0;
epInfo[ XBOX_INPUT_PIPE_3 ].bmRcvToggle = bmRCVTOG0;
epInfo[ XBOX_INPUT_PIPE_3 ].bmSndToggle = 0;
epInfo[ XBOX_INPUT_PIPE_3 ].bmRcvToggle = 0;
epInfo[ XBOX_OUTPUT_PIPE_3 ].epAddr = 0x05; // XBOX 360 output endpoint - poll interval 8ms
epInfo[ XBOX_OUTPUT_PIPE_3 ].epAttribs = EP_INTERRUPT;
epInfo[ XBOX_OUTPUT_PIPE_3 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
epInfo[ XBOX_OUTPUT_PIPE_3 ].maxPktSize = EP_MAXPKTSIZE;
epInfo[ XBOX_OUTPUT_PIPE_3 ].bmSndToggle = bmSNDTOG0;
epInfo[ XBOX_OUTPUT_PIPE_3 ].bmRcvToggle = bmRCVTOG0;
epInfo[ XBOX_OUTPUT_PIPE_3 ].bmSndToggle = 0;
epInfo[ XBOX_OUTPUT_PIPE_3 ].bmRcvToggle = 0;

epInfo[ XBOX_INPUT_PIPE_4 ].epAddr = 0x07; // XBOX 360 report endpoint - poll interval 1ms
epInfo[ XBOX_INPUT_PIPE_4 ].epAttribs = EP_INTERRUPT;
epInfo[ XBOX_INPUT_PIPE_4 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
epInfo[ XBOX_INPUT_PIPE_4 ].maxPktSize = EP_MAXPKTSIZE;
epInfo[ XBOX_INPUT_PIPE_4 ].bmSndToggle = bmSNDTOG0;
epInfo[ XBOX_INPUT_PIPE_4 ].bmRcvToggle = bmRCVTOG0;
epInfo[ XBOX_INPUT_PIPE_4 ].bmSndToggle = 0;
epInfo[ XBOX_INPUT_PIPE_4 ].bmRcvToggle = 0;
epInfo[ XBOX_OUTPUT_PIPE_4 ].epAddr = 0x07; // XBOX 360 output endpoint - poll interval 8ms
epInfo[ XBOX_OUTPUT_PIPE_4 ].epAttribs = EP_INTERRUPT;
epInfo[ XBOX_OUTPUT_PIPE_4 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
epInfo[ XBOX_OUTPUT_PIPE_4 ].maxPktSize = EP_MAXPKTSIZE;
epInfo[ XBOX_OUTPUT_PIPE_4 ].bmSndToggle = bmSNDTOG0;
epInfo[ XBOX_OUTPUT_PIPE_4 ].bmRcvToggle = bmRCVTOG0;
epInfo[ XBOX_OUTPUT_PIPE_4 ].bmSndToggle = 0;
epInfo[ XBOX_OUTPUT_PIPE_4 ].bmRcvToggle = 0;

rcode = pUsb->setEpInfoEntry(bAddress, 9, epInfo);
if (rcode)
Expand Down Expand Up @@ -235,16 +236,15 @@ uint8_t XBOXRECV::Init(uint8_t parent, uint8_t port, bool lowspeed) {
#ifdef DEBUG_USB_HOST
NotifyFailSetConfDescr();
#endif
goto Fail;

FailUnknownDevice:
#ifdef DEBUG_USB_HOST
NotifyFailUnknownDevice(VID,PID);
#endif
rcode = USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED;

Fail:
#ifdef DEBUG_USB_HOST
Fail:
Notify(PSTR("\r\nXbox 360 Init Failed, error code: "), 0x80);
NotifyFail(rcode);
#endif
Expand Down Expand Up @@ -442,7 +442,9 @@ uint8_t XBOXRECV::getBatteryLevel(uint8_t controller) {
}

void XBOXRECV::XboxCommand(uint8_t controller, uint8_t* data, uint16_t nbytes) {
#ifdef EXTRADEBUG
uint8_t rcode;
#endif
uint8_t outputPipe;
switch (controller) {
case 0: outputPipe = XBOX_OUTPUT_PIPE_1;
Expand All @@ -453,8 +455,13 @@ void XBOXRECV::XboxCommand(uint8_t controller, uint8_t* data, uint16_t nbytes) {
break;
case 3: outputPipe = XBOX_OUTPUT_PIPE_4;
break;
default:
return;
}
rcode = pUsb->outTransfer(bAddress, epInfo[ outputPipe ].epAddr, nbytes, data);
#ifdef EXTRADEBUG
rcode =
#endif
pUsb->outTransfer(bAddress, epInfo[ outputPipe ].epAddr, nbytes, data);
#ifdef EXTRADEBUG
if (rcode)
Notify(PSTR("Error sending Xbox message\r\n"), 0x80);
Expand Down
Loading

0 comments on commit e18eb57

Please sign in to comment.