modify print log,add USBD_LOG_INFO forever print

This commit is contained in:
sakumisu
2021-11-13 13:09:22 +08:00
parent 27bbaa0e0e
commit 5a22e7a57b
9 changed files with 87 additions and 61 deletions

View File

@@ -24,7 +24,7 @@ int audio_class_request_handler(struct usb_setup_packet *setup, uint8_t **data,
vol = (audio_control_info.vol_current - 0xDB00 + 1) * 100 / (0xFFFF - 0xDB00);
}
usbd_audio_set_volume(vol);
USBD_LOG("current volume:%d\r\n", vol);
USBD_LOG_INFO("current audio volume:%d\r\n", vol);
}
}
@@ -67,8 +67,8 @@ int audio_class_request_handler(struct usb_setup_packet *setup, uint8_t **data,
break;
default:
USBD_LOG_ERR("Unhandled request 0x%02x", setup->bRequest);
break;
USBD_LOG_WRN("Unhandled Audio Class bRequest 0x%02x\r\n", setup->bRequest);
return -1;
}
return 0;

View File

@@ -57,19 +57,19 @@ static void usbd_cdc_acm_reset(void)
/**
* @brief Handler called for Class requests not handled by the USB stack.
*
* @param pSetup Information about the request to execute.
* @param setup Information about the request to execute.
* @param len Size of the buffer.
* @param data Buffer containing the request result.
*
* @return 0 on success, negative errno code on fail.
*/
static int cdc_acm_class_request_handler(struct usb_setup_packet *pSetup, uint8_t **data, uint32_t *len)
static int cdc_acm_class_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len)
{
USBD_LOG_DBG("CDC Class request: "
"bRequest 0x%02x\r\n",
setup->bRequest);
switch (pSetup->bRequest) {
switch (setup->bRequest) {
case CDC_REQUEST_SET_LINE_CODING:
/*******************************************************************************/
@@ -105,9 +105,9 @@ static int cdc_acm_class_request_handler(struct usb_setup_packet *pSetup, uint8_
break;
case CDC_REQUEST_SET_CONTROL_LINE_STATE:
usbd_cdc_acm_cfg.line_state = (uint8_t)pSetup->wValue;
bool dtr = (pSetup->wValue & 0x01);
bool rts = (pSetup->wValue & 0x02);
usbd_cdc_acm_cfg.line_state = (uint8_t)setup->wValue;
bool dtr = (setup->wValue & 0x01);
bool rts = (setup->wValue & 0x02);
USBD_LOG_DBG("DTR 0x%x,RTS 0x%x\r\n",
dtr, rts);
usbd_cdc_acm_set_dtr(dtr);
@@ -125,8 +125,7 @@ static int cdc_acm_class_request_handler(struct usb_setup_packet *pSetup, uint8_
break;
default:
USBD_LOG_DBG("CDC ACM request 0x%x, value 0x%x\r\n",
pSetup->bRequest, pSetup->wValue);
USBD_LOG_WRN("Unhandled CDC Class bRequest 0x%02x\r\n", setup->bRequest);
return -1;
}

View File

@@ -28,8 +28,8 @@ int dfu_class_request_handler(struct usb_setup_packet *setup, uint8_t **data, ui
case DFU_REQUEST_ABORT:
break;
default:
USBD_LOG_ERR("Unhandled request 0x%02x", setup->bRequest);
break;
USBD_LOG_WRN("Unhandled DFU Class bRequest 0x%02x\r\n", setup->bRequest);
return -1;
}
return 0;

View File

@@ -90,19 +90,19 @@ int hid_custom_request_handler(struct usb_setup_packet *setup, uint8_t **data, u
switch (value) {
case HID_DESCRIPTOR_TYPE_HID:
USBD_LOG("get HID Descriptor\r\n");
USBD_LOG_INFO("get HID Descriptor\r\n");
*data = (uint8_t *)current_hid_intf->hid_descriptor;
*len = current_hid_intf->hid_descriptor[0];
break;
case HID_DESCRIPTOR_TYPE_HID_REPORT:
USBD_LOG("get Report Descriptor\r\n");
USBD_LOG_INFO("get Report Descriptor\r\n");
*data = (uint8_t *)current_hid_intf->hid_report_descriptor;
*len = current_hid_intf->hid_report_descriptor_len;
break;
case HID_DESCRIPTOR_TYPE_HID_PHYSICAL:
USBD_LOG_DBG("get PHYSICAL Descriptor\r\n");
USBD_LOG_INFO("get PHYSICAL Descriptor\r\n");
break;
@@ -180,8 +180,8 @@ int hid_class_request_handler(struct usb_setup_packet *setup, uint8_t **data, ui
break;
default:
USBD_LOG_ERR("Unhandled request 0x%02x\r\n", setup->bRequest);
break;
USBD_LOG_WRN("Unhandled HID Class bRequest 0x%02x\r\n", setup->bRequest);
return -1;
}
return 0;

View File

@@ -113,24 +113,24 @@ static void usbd_msc_reset(void)
/**
* @brief Handler called for Class requests not handled by the USB stack.
*
* @param pSetup Information about the request to execute.
* @param setup Information about the request to execute.
* @param len Size of the buffer.
* @param data Buffer containing the request result.
*
* @return 0 on success, negative errno code on fail.
*/
static int msc_storage_class_request_handler(struct usb_setup_packet *pSetup, uint8_t **data, uint32_t *len)
static int msc_storage_class_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len)
{
USBD_LOG_DBG("MSC Class request: "
"bRequest 0x%02x\r\n",
setup->bRequest);
switch (pSetup->bRequest) {
switch (setup->bRequest) {
case MSC_REQUEST_RESET:
USBD_LOG_DBG("MSC_REQUEST_RESET");
USBD_LOG_DBG("MSC_REQUEST_RESET\r\n");
if (pSetup->wLength) {
USBD_LOG_WRN("Invalid length");
if (setup->wLength) {
USBD_LOG_WRN("Invalid length\r\n");
return -1;
}
@@ -138,10 +138,10 @@ static int msc_storage_class_request_handler(struct usb_setup_packet *pSetup, ui
break;
case MSC_REQUEST_GET_MAX_LUN:
USBD_LOG_DBG("MSC_REQUEST_GET_MAX_LUN");
USBD_LOG_DBG("MSC_REQUEST_GET_MAX_LUN\r\n");
if (pSetup->wLength != 1) {
USBD_LOG_WRN("Invalid length");
if (setup->wLength != 1) {
USBD_LOG_WRN("Invalid length\r\n");
return -1;
}
@@ -150,8 +150,7 @@ static int msc_storage_class_request_handler(struct usb_setup_packet *pSetup, ui
break;
default:
USBD_LOG_WRN("Unknown request 0x%02x, value 0x%02x",
pSetup->bRequest, pSetup->wValue);
USBD_LOG_WRN("Unhandled MSC Class bRequest 0x%02x\r\n", setup->bRequest);
return -1;
}

View File

@@ -27,7 +27,7 @@ extern struct video_probe_and_commit_controls commit;
int video_class_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len)
{
USBD_LOG_DBG("VIDEO Class request: "
USBD_LOG_DBG("Video Class request: "
"bRequest 0x%02x\r\n",
setup->bRequest);
@@ -90,8 +90,8 @@ int video_class_request_handler(struct usb_setup_packet *setup, uint8_t **data,
break;
default:
USBD_LOG_ERR("Unhandled request 0x%02x", setup->bRequest);
break;
USBD_LOG_WRN("Unhandled Video Class bRequest 0x%02x\r\n", setup->bRequest);
return -1;
}
return 0;