code formatting fixes

pull/9768/head
Maciej Bocianski 2018-04-16 10:35:24 +02:00 committed by Russ Butler
parent 69a095cf3e
commit ff3b0c1623
2 changed files with 15 additions and 7 deletions

View File

@ -67,11 +67,11 @@ USBTester::~USBTester()
const char *USBTester::get_desc_string(const uint8_t *desc)
{
static char ret_string[128] = {};
static char ret_string[128] = { };
const uint8_t desc_size = desc[0] - 2;
const uint8_t *desc_str = &desc[2];
uint32_t j = 0;
for(uint32_t i = 0; i < desc_size; i+=2, j++) {
for (uint32_t i = 0; i < desc_size; i += 2, j++) {
ret_string[j] = desc_str[i];
}
ret_string[j] = '\0';
@ -80,7 +80,7 @@ const char *USBTester::get_desc_string(const uint8_t *desc)
void USBTester::suspend(bool suspended)
{
if(suspended) {
if (suspended) {
++suspend_count;
} else {
++resume_count;
@ -146,7 +146,7 @@ void USBTester::callback_request(const setup_packet_t *setup)
case VENDOR_TEST_CTRL_OUT:
result = Receive;
data = ctrl_buf;
size = setup->wValue < 8 ? setup->wValue : 8;
size = setup->wValue < 8 ? setup->wValue : 8;
break;
case VENDOR_TEST_CTRL_NONE:
result = Success;
@ -176,8 +176,6 @@ void USBTester::callback_request(const setup_packet_t *setup)
} else {
complete_request(result, data, size);
}
}
void USBTester::callback_request_xfer_done(const setup_packet_t *setup, bool aborted)

View File

@ -62,6 +62,7 @@ bool USBDevice::_request_get_descriptor()
#endif
switch (DESCRIPTOR_TYPE(_transfer.setup.wValue)) {
case DEVICE_DESCRIPTOR:
{
if (device_desc() != NULL) {
if ((device_desc()[0] == DEVICE_DESCRIPTOR_LENGTH) \
&& (device_desc()[1] == DEVICE_DESCRIPTOR)) {
@ -75,6 +76,7 @@ bool USBDevice::_request_get_descriptor()
}
}
break;
}
case CONFIGURATION_DESCRIPTOR:
{
const uint8_t idx = DESCRIPTOR_INDEX(_transfer.setup.wValue);
@ -96,6 +98,7 @@ bool USBDevice::_request_get_descriptor()
break;
}
case STRING_DESCRIPTOR:
{
#ifdef DEBUG
printf("str descriptor\r\n");
#endif
@ -156,21 +159,29 @@ bool USBDevice::_request_get_descriptor()
break;
}
break;
}
case INTERFACE_DESCRIPTOR:
{
#ifdef DEBUG
printf("interface descr\r\n");
#endif
break;
}
case ENDPOINT_DESCRIPTOR:
{
#ifdef DEBUG
printf("endpoint descr\r\n");
#endif
/* TODO: Support is optional, not implemented here */
break;
}
default:
{
#ifdef DEBUG
printf("ERROR\r\n");
#endif
break;
}
}
return success;
@ -406,7 +417,6 @@ void USBDevice::_complete_set_configuration()
_phy->ep0_stall();
return;
}
}
bool USBDevice::_request_get_configuration()