mirror of https://github.com/ARMmbed/mbed-os.git
USBHost : fix indentation USBHost.cpp
parent
27877bd4e8
commit
41f12260b1
|
@ -46,7 +46,8 @@ USBHost * USBHost::instHost = NULL;
|
||||||
* - when the usb_thread receives the event, it:
|
* - when the usb_thread receives the event, it:
|
||||||
* - call the callback attached to the endpoint where the td is attached
|
* - call the callback attached to the endpoint where the td is attached
|
||||||
*/
|
*/
|
||||||
void USBHost::usb_process() {
|
void USBHost::usb_process()
|
||||||
|
{
|
||||||
|
|
||||||
bool controlListState;
|
bool controlListState;
|
||||||
bool bulkListState;
|
bool bulkListState;
|
||||||
|
@ -79,8 +80,7 @@ void USBHost::usb_process() {
|
||||||
too_many_hub = false;
|
too_many_hub = false;
|
||||||
buf[4] = 0;
|
buf[4] = 0;
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
Lock lock(this);
|
Lock lock(this);
|
||||||
|
|
||||||
for (i = 0; i < MAX_DEVICE_CONNECTED; i++) {
|
for (i = 0; i < MAX_DEVICE_CONNECTED; i++) {
|
||||||
|
@ -105,8 +105,9 @@ void USBHost::usb_process() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MAX_HUB_NB
|
#if MAX_HUB_NB
|
||||||
if (usb_msg->hub_parent)
|
if (usb_msg->hub_parent) {
|
||||||
devices[i].setHubParent((USBHostHub *)(usb_msg->hub_parent));
|
devices[i].setHubParent((USBHostHub *)(usb_msg->hub_parent));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (j = 0; j < timeout_set_addr; j++) {
|
for (j = 0; j < timeout_set_addr; j++) {
|
||||||
|
@ -165,10 +166,11 @@ void USBHost::usb_process() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hub_in_use[k] == true)
|
if (hub_in_use[k] == true) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (k == MAX_HUB_NB) {
|
if (k == MAX_HUB_NB) {
|
||||||
USB_ERR("Too many hubs connected!!\r\n");
|
USB_ERR("Too many hubs connected!!\r\n");
|
||||||
|
@ -176,8 +178,9 @@ void USBHost::usb_process() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (usb_msg->hub_parent)
|
if (usb_msg->hub_parent) {
|
||||||
((USBHostHub *)(usb_msg->hub_parent))->deviceConnected(&devices[i]);
|
((USBHostHub *)(usb_msg->hub_parent))->deviceConnected(&devices[i]);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((i < MAX_DEVICE_CONNECTED) && !too_many_hub) {
|
if ((i < MAX_DEVICE_CONNECTED) && !too_many_hub) {
|
||||||
|
@ -191,8 +194,7 @@ void USBHost::usb_process() {
|
||||||
// a device has been disconnected
|
// a device has been disconnected
|
||||||
case DEVICE_DISCONNECTED_EVENT:
|
case DEVICE_DISCONNECTED_EVENT:
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
Lock lock(this);
|
Lock lock(this);
|
||||||
|
|
||||||
controlListState = disableList(CONTROL_ENDPOINT);
|
controlListState = disableList(CONTROL_ENDPOINT);
|
||||||
|
@ -204,9 +206,15 @@ void USBHost::usb_process() {
|
||||||
freeDevice((USBDeviceConnected*)&devices[idx]);
|
freeDevice((USBDeviceConnected*)&devices[idx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (controlListState) enableList(CONTROL_ENDPOINT);
|
if (controlListState) {
|
||||||
if (bulkListState) enableList(BULK_ENDPOINT);
|
enableList(CONTROL_ENDPOINT);
|
||||||
if (interruptListState) enableList(INTERRUPT_ENDPOINT);
|
}
|
||||||
|
if (bulkListState) {
|
||||||
|
enableList(BULK_ENDPOINT);
|
||||||
|
}
|
||||||
|
if (interruptListState) {
|
||||||
|
enableList(INTERRUPT_ENDPOINT);
|
||||||
|
}
|
||||||
|
|
||||||
} while(0);
|
} while(0);
|
||||||
|
|
||||||
|
@ -224,8 +232,9 @@ void USBHost::usb_process() {
|
||||||
if (ep->getDir() == IN) {
|
if (ep->getDir() == IN) {
|
||||||
buf_transfer = ep->getBufStart();
|
buf_transfer = ep->getBufStart();
|
||||||
printf("READ SUCCESS [%d bytes transferred - td: 0x%08X] on ep: [%p - addr: %02X]: ", ep->getLengthTransferred(), usb_msg->td_addr, ep, ep->getAddress());
|
printf("READ SUCCESS [%d bytes transferred - td: 0x%08X] on ep: [%p - addr: %02X]: ", ep->getLengthTransferred(), usb_msg->td_addr, ep, ep->getAddress());
|
||||||
for (int i = 0; i < ep->getLengthTransferred(); i++)
|
for (int i = 0; i < ep->getLengthTransferred(); i++) {
|
||||||
printf("%02X ", buf_transfer[i]);
|
printf("%02X ", buf_transfer[i]);
|
||||||
|
}
|
||||||
printf("\r\n\r\n");
|
printf("\r\n\r\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -266,9 +275,10 @@ USBHost::USBHost() : usbThread(osPriorityNormal, USB_THREAD_STACK)
|
||||||
devices[i].setAddress(i + 1);
|
devices[i].setAddress(i + 1);
|
||||||
deviceReset[i] = false;
|
deviceReset[i] = false;
|
||||||
deviceInited[i] = false;
|
deviceInited[i] = false;
|
||||||
for (uint8_t j = 0; j < MAX_INTF; j++)
|
for (uint8_t j = 0; j < MAX_INTF; j++) {
|
||||||
deviceAttachedDriver[i][j] = false;
|
deviceAttachedDriver[i][j] = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if MAX_HUB_NB
|
#if MAX_HUB_NB
|
||||||
for (uint8_t i = 0; i < MAX_HUB_NB; i++) {
|
for (uint8_t i = 0; i < MAX_HUB_NB; i++) {
|
||||||
|
@ -294,8 +304,9 @@ void USBHost::transferCompleted(volatile uint32_t addr)
|
||||||
{
|
{
|
||||||
uint8_t state;
|
uint8_t state;
|
||||||
|
|
||||||
if(addr == 0)
|
if(addr == 0) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
volatile HCTD* tdList = NULL;
|
volatile HCTD* tdList = NULL;
|
||||||
|
|
||||||
|
@ -315,20 +326,23 @@ void USBHost::transferCompleted(volatile uint32_t addr)
|
||||||
|
|
||||||
#ifdef USBHOST_OTHER
|
#ifdef USBHOST_OTHER
|
||||||
state = ((HCTD *)td)->state;
|
state = ((HCTD *)td)->state;
|
||||||
if (state == USB_TYPE_IDLE)
|
if (state == USB_TYPE_IDLE) {
|
||||||
ep->setLengthTransferred((uint32_t)td->currBufPtr - (uint32_t)ep->getBufStart());
|
ep->setLengthTransferred((uint32_t)td->currBufPtr - (uint32_t)ep->getBufStart());
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
if (((HCTD *)td)->control >> 28) {
|
if (((HCTD *)td)->control >> 28) {
|
||||||
state = ((HCTD *)td)->control >> 28;
|
state = ((HCTD *)td)->control >> 28;
|
||||||
} else {
|
} else {
|
||||||
if (td->currBufPtr)
|
if (td->currBufPtr) {
|
||||||
ep->setLengthTransferred((uint32_t)td->currBufPtr - (uint32_t)ep->getBufStart());
|
ep->setLengthTransferred((uint32_t)td->currBufPtr - (uint32_t)ep->getBufStart());
|
||||||
|
}
|
||||||
state = 16 /*USB_TYPE_IDLE*/;
|
state = 16 /*USB_TYPE_IDLE*/;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (state == USB_TYPE_IDLE)
|
if (state == USB_TYPE_IDLE) {
|
||||||
ep->setLengthTransferred((uint32_t)td->currBufPtr - (uint32_t)ep->getBufStart());
|
ep->setLengthTransferred((uint32_t)td->currBufPtr - (uint32_t)ep->getBufStart());
|
||||||
|
}
|
||||||
|
|
||||||
ep->unqueueTransfer(td);
|
ep->unqueueTransfer(td);
|
||||||
|
|
||||||
|
@ -365,9 +379,10 @@ USBHost * USBHost::getHostInst()
|
||||||
// be sure that the new device connected is not already connected...
|
// be sure that the new device connected is not already connected...
|
||||||
int idx = findDevice(hub, port, hub_parent);
|
int idx = findDevice(hub, port, hub_parent);
|
||||||
if (idx != -1) {
|
if (idx != -1) {
|
||||||
if (deviceInited[idx])
|
if (deviceInited[idx]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
message_t * usb_msg = mail_usb_event.alloc();
|
message_t * usb_msg = mail_usb_event.alloc();
|
||||||
usb_msg->event_id = DEVICE_CONNECTED_EVENT;
|
usb_msg->event_id = DEVICE_CONNECTED_EVENT;
|
||||||
|
@ -387,8 +402,9 @@ USBHost * USBHost::getHostInst()
|
||||||
// be sure that the device disconnected is connected...
|
// be sure that the device disconnected is connected...
|
||||||
int idx = findDevice(hub, port, hub_parent);
|
int idx = findDevice(hub, port, hub_parent);
|
||||||
if (idx != -1) {
|
if (idx != -1) {
|
||||||
if (!deviceInUse[idx])
|
if (!deviceInUse[idx]) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -422,8 +438,9 @@ void USBHost::freeDevice(USBDeviceConnected * dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
// notify hub parent that this device has been disconnected
|
// notify hub parent that this device has been disconnected
|
||||||
if (dev->getHubParent())
|
if (dev->getHubParent()) {
|
||||||
dev->getHubParent()->deviceDisconnected(dev);
|
dev->getHubParent()->deviceDisconnected(dev);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -667,8 +684,9 @@ int USBHost::findDevice(uint8_t hub, uint8_t port, USBHostHub * hub_parent)
|
||||||
for (int i = 0; i < MAX_DEVICE_CONNECTED; i++) {
|
for (int i = 0; i < MAX_DEVICE_CONNECTED; i++) {
|
||||||
if (devices[i].getHub() == hub && devices[i].getPort() == port) {
|
if (devices[i].getHub() == hub && devices[i].getPort() == port) {
|
||||||
if (hub_parent != NULL) {
|
if (hub_parent != NULL) {
|
||||||
if (hub_parent == devices[i].getHubParent())
|
if (hub_parent == devices[i].getHubParent()) {
|
||||||
return i;
|
return i;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -774,8 +792,9 @@ USB_TYPE USBHost::getDeviceDescriptor(USBDeviceConnected * dev, uint8_t * buf, u
|
||||||
GET_DESCRIPTOR,
|
GET_DESCRIPTOR,
|
||||||
(DEVICE_DESCRIPTOR << 8) | (0),
|
(DEVICE_DESCRIPTOR << 8) | (0),
|
||||||
0, buf, MIN(DEVICE_DESCRIPTOR_LENGTH, max_len_buf));
|
0, buf, MIN(DEVICE_DESCRIPTOR_LENGTH, max_len_buf));
|
||||||
if (len_dev_descr)
|
if (len_dev_descr) {
|
||||||
*len_dev_descr = MIN(DEVICE_DESCRIPTOR_LENGTH, max_len_buf);
|
*len_dev_descr = MIN(DEVICE_DESCRIPTOR_LENGTH, max_len_buf);
|
||||||
|
}
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
@ -799,8 +818,9 @@ USB_TYPE USBHost::getConfigurationDescriptor(USBDeviceConnected * dev, uint8_t *
|
||||||
total_conf_descr_length = buf[2] | (buf[3] << 8);
|
total_conf_descr_length = buf[2] | (buf[3] << 8);
|
||||||
total_conf_descr_length = MIN(max_len_buf, total_conf_descr_length);
|
total_conf_descr_length = MIN(max_len_buf, total_conf_descr_length);
|
||||||
|
|
||||||
if (len_conf_descr)
|
if (len_conf_descr) {
|
||||||
*len_conf_descr = total_conf_descr_length;
|
*len_conf_descr = total_conf_descr_length;
|
||||||
|
}
|
||||||
|
|
||||||
USB_DBG("TOTAL_LENGTH: %d \t NUM_INTERF: %d", total_conf_descr_length, buf[4]);
|
USB_DBG("TOTAL_LENGTH: %d \t NUM_INTERF: %d", total_conf_descr_length, buf[4]);
|
||||||
|
|
||||||
|
@ -812,7 +832,8 @@ USB_TYPE USBHost::getConfigurationDescriptor(USBDeviceConnected * dev, uint8_t *
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
USB_TYPE USBHost::setAddress(USBDeviceConnected * dev, uint8_t address) {
|
USB_TYPE USBHost::setAddress(USBDeviceConnected * dev, uint8_t address)
|
||||||
|
{
|
||||||
return controlWrite( dev,
|
return controlWrite( dev,
|
||||||
USB_HOST_TO_DEVICE | USB_RECIPIENT_DEVICE,
|
USB_HOST_TO_DEVICE | USB_RECIPIENT_DEVICE,
|
||||||
SET_ADDRESS,
|
SET_ADDRESS,
|
||||||
|
@ -830,15 +851,18 @@ USB_TYPE USBHost::setConfiguration(USBDeviceConnected * dev, uint8_t conf)
|
||||||
0, NULL, 0);
|
0, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t USBHost::numberDriverAttached(USBDeviceConnected * dev) {
|
uint8_t USBHost::numberDriverAttached(USBDeviceConnected * dev)
|
||||||
|
{
|
||||||
int index = findDevice(dev);
|
int index = findDevice(dev);
|
||||||
uint8_t cnt = 0;
|
uint8_t cnt = 0;
|
||||||
if (index == -1)
|
if (index == -1) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
for (uint8_t i = 0; i < MAX_INTF; i++) {
|
for (uint8_t i = 0; i < MAX_INTF; i++) {
|
||||||
if (deviceAttachedDriver[index][i])
|
if (deviceAttachedDriver[index][i]) {
|
||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -848,8 +872,7 @@ USB_TYPE USBHost::enumerate(USBDeviceConnected * dev, IUSBEnumerator* pEnumerato
|
||||||
uint16_t total_conf_descr_length = 0;
|
uint16_t total_conf_descr_length = 0;
|
||||||
USB_TYPE res;
|
USB_TYPE res;
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
Lock lock(this);
|
Lock lock(this);
|
||||||
|
|
||||||
// don't enumerate a device which all interfaces are registered to a specific driver
|
// don't enumerate a device which all interfaces are registered to a specific driver
|
||||||
|
@ -893,8 +916,9 @@ USB_TYPE USBHost::enumerate(USBDeviceConnected * dev, IUSBEnumerator* pEnumerato
|
||||||
|
|
||||||
#if (DEBUG > 3)
|
#if (DEBUG > 3)
|
||||||
USB_DBG("CONFIGURATION DESCRIPTOR:\r\n");
|
USB_DBG("CONFIGURATION DESCRIPTOR:\r\n");
|
||||||
for (int i = 0; i < total_conf_descr_length; i++)
|
for (int i = 0; i < total_conf_descr_length; i++) {
|
||||||
printf("%02X ", data[i]);
|
printf("%02X ", data[i]);
|
||||||
|
}
|
||||||
printf("\r\n\r\n");
|
printf("\r\n\r\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1016,7 +1040,8 @@ USB_TYPE USBHost::interruptRead(USBDeviceConnected * dev, USBEndpoint * ep, uint
|
||||||
return generalTransfer(dev, ep, buf, len, blocking, INTERRUPT_ENDPOINT, false);
|
return generalTransfer(dev, ep, buf, len, blocking, INTERRUPT_ENDPOINT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
USB_TYPE USBHost::generalTransfer(USBDeviceConnected * dev, USBEndpoint * ep, uint8_t * buf, uint32_t len, bool blocking, ENDPOINT_TYPE type, bool write) {
|
USB_TYPE USBHost::generalTransfer(USBDeviceConnected * dev, USBEndpoint * ep, uint8_t * buf, uint32_t len, bool blocking, ENDPOINT_TYPE type, bool write)
|
||||||
|
{
|
||||||
|
|
||||||
#if DEBUG_TRANSFER
|
#if DEBUG_TRANSFER
|
||||||
const char * type_str = (type == BULK_ENDPOINT) ? "BULK" : ((type == INTERRUPT_ENDPOINT) ? "INTERRUPT" : "ISOCHRONOUS");
|
const char * type_str = (type == BULK_ENDPOINT) ? "BULK" : ((type == INTERRUPT_ENDPOINT) ? "INTERRUPT" : "ISOCHRONOUS");
|
||||||
|
@ -1056,8 +1081,9 @@ USB_TYPE USBHost::generalTransfer(USBDeviceConnected * dev, USBEndpoint * ep, ui
|
||||||
#if DEBUG_TRANSFER
|
#if DEBUG_TRANSFER
|
||||||
if (write) {
|
if (write) {
|
||||||
USB_DBG_TRANSFER("%s WRITE buffer", type_str);
|
USB_DBG_TRANSFER("%s WRITE buffer", type_str);
|
||||||
for (int i = 0; i < ep->getLengthTransferred(); i++)
|
for (int i = 0; i < ep->getLengthTransferred(); i++) {
|
||||||
printf("%02X ", buf[i]);
|
printf("%02X ", buf[i]);
|
||||||
|
}
|
||||||
printf("\r\n\r\n");
|
printf("\r\n\r\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1082,11 +1108,13 @@ USB_TYPE USBHost::generalTransfer(USBDeviceConnected * dev, USBEndpoint * ep, ui
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
USB_TYPE USBHost::controlRead(USBDeviceConnected * dev, uint8_t requestType, uint8_t request, uint32_t value, uint32_t index, uint8_t * buf, uint32_t len) {
|
USB_TYPE USBHost::controlRead(USBDeviceConnected * dev, uint8_t requestType, uint8_t request, uint32_t value, uint32_t index, uint8_t * buf, uint32_t len)
|
||||||
|
{
|
||||||
return controlTransfer(dev, requestType, request, value, index, buf, len, false);
|
return controlTransfer(dev, requestType, request, value, index, buf, len, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
USB_TYPE USBHost::controlWrite(USBDeviceConnected * dev, uint8_t requestType, uint8_t request, uint32_t value, uint32_t index, uint8_t * buf, uint32_t len) {
|
USB_TYPE USBHost::controlWrite(USBDeviceConnected * dev, uint8_t requestType, uint8_t request, uint32_t value, uint32_t index, uint8_t * buf, uint32_t len)
|
||||||
|
{
|
||||||
return controlTransfer(dev, requestType, request, value, index, buf, len, true);
|
return controlTransfer(dev, requestType, request, value, index, buf, len, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1112,15 +1140,18 @@ USB_TYPE USBHost::controlTransfer(USBDeviceConnected * dev, uint8_t requestType,
|
||||||
|
|
||||||
#if DEBUG_TRANSFER
|
#if DEBUG_TRANSFER
|
||||||
USB_DBG_TRANSFER("SETUP PACKET: ");
|
USB_DBG_TRANSFER("SETUP PACKET: ");
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++) {
|
||||||
printf("%01X ", setupPacket[i]);
|
printf("%01X ", setupPacket[i]);
|
||||||
|
}
|
||||||
printf("\r\n");
|
printf("\r\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
control->setNextToken(TD_SETUP);
|
control->setNextToken(TD_SETUP);
|
||||||
res = addTransfer(control, (uint8_t*)setupPacket, 8);
|
res = addTransfer(control, (uint8_t*)setupPacket, 8);
|
||||||
|
|
||||||
if (res == USB_TYPE_PROCESSING) control->ep_queue.get();
|
if (res == USB_TYPE_PROCESSING) {
|
||||||
|
control->ep_queue.get();
|
||||||
|
}
|
||||||
res = control->getState();
|
res = control->getState();
|
||||||
|
|
||||||
USB_DBG_TRANSFER("CONTROL setup stage %s", control->getStateString());
|
USB_DBG_TRANSFER("CONTROL setup stage %s", control->getStateString());
|
||||||
|
@ -1134,20 +1165,24 @@ USB_TYPE USBHost::controlTransfer(USBDeviceConnected * dev, uint8_t requestType,
|
||||||
control->setNextToken(token);
|
control->setNextToken(token);
|
||||||
res = addTransfer(control, (uint8_t *)buf, length_transfer);
|
res = addTransfer(control, (uint8_t *)buf, length_transfer);
|
||||||
|
|
||||||
if (res == USB_TYPE_PROCESSING) control->ep_queue.get();
|
if (res == USB_TYPE_PROCESSING) {
|
||||||
|
control->ep_queue.get();
|
||||||
|
}
|
||||||
res = control->getState();
|
res = control->getState();
|
||||||
|
|
||||||
#if DEBUG_TRANSFER
|
#if DEBUG_TRANSFER
|
||||||
USB_DBG_TRANSFER("CONTROL %s stage %s", (write) ? "WRITE" : "READ", control->getStateString());
|
USB_DBG_TRANSFER("CONTROL %s stage %s", (write) ? "WRITE" : "READ", control->getStateString());
|
||||||
if (write) {
|
if (write) {
|
||||||
USB_DBG_TRANSFER("CONTROL WRITE buffer");
|
USB_DBG_TRANSFER("CONTROL WRITE buffer");
|
||||||
for (int i = 0; i < control->getLengthTransferred(); i++)
|
for (int i = 0; i < control->getLengthTransferred(); i++) {
|
||||||
printf("%02X ", buf[i]);
|
printf("%02X ", buf[i]);
|
||||||
|
}
|
||||||
printf("\r\n\r\n");
|
printf("\r\n\r\n");
|
||||||
} else {
|
} else {
|
||||||
USB_DBG_TRANSFER("CONTROL READ SUCCESS [%d bytes transferred]", control->getLengthTransferred());
|
USB_DBG_TRANSFER("CONTROL READ SUCCESS [%d bytes transferred]", control->getLengthTransferred());
|
||||||
for (int i = 0; i < control->getLengthTransferred(); i++)
|
for (int i = 0; i < control->getLengthTransferred(); i++) {
|
||||||
printf("%02X ", buf[i]);
|
printf("%02X ", buf[i]);
|
||||||
|
}
|
||||||
printf("\r\n\r\n");
|
printf("\r\n\r\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1161,13 +1196,16 @@ USB_TYPE USBHost::controlTransfer(USBDeviceConnected * dev, uint8_t requestType,
|
||||||
control->setNextToken(token);
|
control->setNextToken(token);
|
||||||
res = addTransfer(control, NULL, 0);
|
res = addTransfer(control, NULL, 0);
|
||||||
|
|
||||||
if (res == USB_TYPE_PROCESSING) control->ep_queue.get();
|
if (res == USB_TYPE_PROCESSING) {
|
||||||
|
control->ep_queue.get();
|
||||||
|
}
|
||||||
res = control->getState();
|
res = control->getState();
|
||||||
|
|
||||||
USB_DBG_TRANSFER("CONTROL ack stage %s", control->getStateString());
|
USB_DBG_TRANSFER("CONTROL ack stage %s", control->getStateString());
|
||||||
|
|
||||||
if (res != USB_TYPE_IDLE)
|
if (res != USB_TYPE_IDLE) {
|
||||||
return res;
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
return USB_TYPE_OK;
|
return USB_TYPE_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue