modify class request print log
This commit is contained in:
@@ -5,9 +5,9 @@ struct usbd_audio_control_info audio_control_info = { 0xdb00, 0x0000, 0x0100, 0x
|
||||
|
||||
int audio_class_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len)
|
||||
{
|
||||
USBD_LOG_DBG("Class request:"
|
||||
"bRequest 0x%02x, bmRequestType 0x%02x len %d",
|
||||
setup->bRequest, setup->bmRequestType, *len);
|
||||
USBD_LOG_DBG("AUDIO Class request: "
|
||||
"bRequest 0x%02x\r\n",
|
||||
setup->bRequest);
|
||||
|
||||
switch (setup->bRequest) {
|
||||
case AUDIO_REQUEST_SET_CUR:
|
||||
@@ -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_WRN("vol:%d\r\n", vol);
|
||||
USBD_LOG("current volume:%d\r\n", vol);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,9 @@ int audio_class_request_handler(struct usb_setup_packet *setup, uint8_t **data,
|
||||
case AUDIO_REQUEST_SET_RES:
|
||||
break;
|
||||
|
||||
case AUDIO_REQUEST_SET_MEM:
|
||||
break;
|
||||
|
||||
case AUDIO_REQUEST_GET_MIN:
|
||||
*data = (uint8_t *)&audio_control_info.vol_min;
|
||||
*len = 2;
|
||||
@@ -58,6 +61,10 @@ int audio_class_request_handler(struct usb_setup_packet *setup, uint8_t **data,
|
||||
*data = (uint8_t *)&audio_control_info.vol_res;
|
||||
*len = 2;
|
||||
break;
|
||||
case AUDIO_REQUEST_GET_MEM:
|
||||
*data[0] = 0;
|
||||
*len = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
USBD_LOG_ERR("Unhandled request 0x%02x", setup->bRequest);
|
||||
@@ -85,9 +92,11 @@ void audio_notify_handler(uint8_t event, void *arg)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
__weak void usbd_audio_set_volume(uint8_t vol)
|
||||
{
|
||||
}
|
||||
|
||||
void usbd_audio_add_interface(usbd_class_t *class, usbd_interface_t *intf)
|
||||
{
|
||||
static usbd_class_t *last_class = NULL;
|
||||
|
||||
@@ -65,6 +65,10 @@ static void usbd_cdc_acm_reset(void)
|
||||
*/
|
||||
static int cdc_acm_class_request_handler(struct usb_setup_packet *pSetup, uint8_t **data, uint32_t *len)
|
||||
{
|
||||
USBD_LOG_DBG("CDC Class request: "
|
||||
"bRequest 0x%02x\r\n",
|
||||
setup->bRequest);
|
||||
|
||||
switch (pSetup->bRequest) {
|
||||
case CDC_REQUEST_SET_LINE_CODING:
|
||||
|
||||
|
||||
@@ -306,7 +306,7 @@ struct cdc_ecm_descriptor {
|
||||
USB_DEVICE_CLASS_CDC, /* bFunctionClass */ \
|
||||
CDC_ABSTRACT_CONTROL_MODEL, /* bFunctionSubClass */ \
|
||||
CDC_COMMON_PROTOCOL_AT_COMMANDS, /* bFunctionProtocol */ \
|
||||
0x00, /* iFunction */ /* CDC Control Interface */ \
|
||||
0x00, /* iFunction */ \
|
||||
0x09, /* bLength */ \
|
||||
USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \
|
||||
bFirstInterface, /* bInterfaceNumber */ \
|
||||
@@ -315,31 +315,31 @@ struct cdc_ecm_descriptor {
|
||||
USB_DEVICE_CLASS_CDC, /* bInterfaceClass */ \
|
||||
CDC_ABSTRACT_CONTROL_MODEL, /* bInterfaceSubClass */ \
|
||||
CDC_COMMON_PROTOCOL_AT_COMMANDS, /* bInterfaceProtocol */ \
|
||||
str_idx, /* iInterface */ /* CDC Header */ \
|
||||
str_idx, /* iInterface */ \
|
||||
0x05, /* bLength */ \
|
||||
CDC_CS_INTERFACE, /* bDescriptorType */ \
|
||||
CDC_FUNC_DESC_HEADER, /* bDescriptorSubtype */ \
|
||||
WBVAL(CDC_V1_10), /* bcdCDC */ /* CDC Call */ \
|
||||
WBVAL(CDC_V1_10), /* bcdCDC */ \
|
||||
0x05, /* bLength */ \
|
||||
CDC_CS_INTERFACE, /* bDescriptorType */ \
|
||||
CDC_FUNC_DESC_CALL_MANAGEMENT, /* bDescriptorSubtype */ \
|
||||
bFirstInterface, /* bmCapabilities */ \
|
||||
(uint8_t)(bFirstInterface + 1), /* bDataInterface */ /* CDC ACM: support line request */ \
|
||||
(uint8_t)(bFirstInterface + 1), /* bDataInterface */ \
|
||||
0x04, /* bLength */ \
|
||||
CDC_CS_INTERFACE, /* bDescriptorType */ \
|
||||
CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT, /* bDescriptorSubtype */ \
|
||||
0x02, /* bmCapabilities */ /* CDC Union */ \
|
||||
0x02, /* bmCapabilities */ \
|
||||
0x05, /* bLength */ \
|
||||
CDC_CS_INTERFACE, /* bDescriptorType */ \
|
||||
CDC_FUNC_DESC_UNION, /* bDescriptorSubtype */ \
|
||||
bFirstInterface, /* bMasterInterface */ \
|
||||
(uint8_t)(bFirstInterface + 1), /* bSlaveInterface0 */ /* Endpoint Notification */ \
|
||||
(uint8_t)(bFirstInterface + 1), /* bSlaveInterface0 */ \
|
||||
0x07, /* bLength */ \
|
||||
USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \
|
||||
int_ep, /* bEndpointAddress */ \
|
||||
0x03, /* bmAttributes */ \
|
||||
0x40, 0x00, /* wMaxPacketSize */ \
|
||||
0x01, /* bInterval */ /* CDC Data Interface */ \
|
||||
0x00, /* bInterval */ \
|
||||
0x09, /* bLength */ \
|
||||
USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \
|
||||
(uint8_t)(bFirstInterface + 1), /* bInterfaceNumber */ \
|
||||
@@ -348,19 +348,19 @@ struct cdc_ecm_descriptor {
|
||||
CDC_DATA_INTERFACE_CLASS, /* bInterfaceClass */ \
|
||||
0x00, /* bInterfaceSubClass */ \
|
||||
0x00, /* bInterfaceProtocol */ \
|
||||
0x00, /* iInterface */ /* Endpoint Out */ \
|
||||
0x00, /* iInterface */ \
|
||||
0x07, /* bLength */ \
|
||||
USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \
|
||||
out_ep, /* bEndpointAddress */ \
|
||||
0x02, /* bmAttributes */ \
|
||||
0x40, 0x00, /* wMaxPacketSize */ \
|
||||
0x01, /* bInterval */ /* Endpoint In */ \
|
||||
0x00, /* bInterval */ \
|
||||
0x07, /* bLength */ \
|
||||
USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \
|
||||
in_ep, /* bEndpointAddress */ \
|
||||
0x02, /* bmAttributes */ \
|
||||
0x40, 0x00, /* wMaxPacketSize */ \
|
||||
0x01 /* bInterval */
|
||||
0x00 /* bInterval */
|
||||
#else
|
||||
#define CDC_ACM_DESCRIPTOR_INIT(bFirstInterface, int_ep, out_ep, in_ep, str_idx) \
|
||||
/* Interface Associate */ \
|
||||
@@ -371,7 +371,7 @@ struct cdc_ecm_descriptor {
|
||||
USB_DEVICE_CLASS_CDC, /* bFunctionClass */ \
|
||||
CDC_ABSTRACT_CONTROL_MODEL, /* bFunctionSubClass */ \
|
||||
CDC_COMMON_PROTOCOL_AT_COMMANDS, /* bFunctionProtocol */ \
|
||||
0x00, /* iFunction */ /* CDC Control Interface */ \
|
||||
0x00, /* iFunction */ \
|
||||
0x09, /* bLength */ \
|
||||
USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \
|
||||
bFirstInterface, /* bInterfaceNumber */ \
|
||||
@@ -380,31 +380,31 @@ struct cdc_ecm_descriptor {
|
||||
USB_DEVICE_CLASS_CDC, /* bInterfaceClass */ \
|
||||
CDC_ABSTRACT_CONTROL_MODEL, /* bInterfaceSubClass */ \
|
||||
CDC_COMMON_PROTOCOL_AT_COMMANDS, /* bInterfaceProtocol */ \
|
||||
str_idx, /* iInterface */ /* CDC Header */ \
|
||||
str_idx, /* iInterface */ \
|
||||
0x05, /* bLength */ \
|
||||
CDC_CS_INTERFACE, /* bDescriptorType */ \
|
||||
CDC_FUNC_DESC_HEADER, /* bDescriptorSubtype */ \
|
||||
WBVAL(CDC_V1_10), /* bcdCDC */ /* CDC Call */ \
|
||||
WBVAL(CDC_V1_10), /* bcdCDC */ \
|
||||
0x05, /* bLength */ \
|
||||
CDC_CS_INTERFACE, /* bDescriptorType */ \
|
||||
CDC_FUNC_DESC_CALL_MANAGEMENT, /* bDescriptorSubtype */ \
|
||||
bFirstInterface, /* bmCapabilities */ \
|
||||
(uint8_t)(bFirstInterface + 1), /* bDataInterface */ /* CDC ACM: support line request */ \
|
||||
(uint8_t)(bFirstInterface + 1), /* bDataInterface */ \
|
||||
0x04, /* bLength */ \
|
||||
CDC_CS_INTERFACE, /* bDescriptorType */ \
|
||||
CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT, /* bDescriptorSubtype */ \
|
||||
0x02, /* bmCapabilities */ /* CDC Union */ \
|
||||
0x02, /* bmCapabilities */ \
|
||||
0x05, /* bLength */ \
|
||||
CDC_CS_INTERFACE, /* bDescriptorType */ \
|
||||
CDC_FUNC_DESC_UNION, /* bDescriptorSubtype */ \
|
||||
bFirstInterface, /* bMasterInterface */ \
|
||||
(uint8_t)(bFirstInterface + 1), /* bSlaveInterface0 */ /* Endpoint Notification */ \
|
||||
(uint8_t)(bFirstInterface + 1), /* bSlaveInterface0 */ \
|
||||
0x07, /* bLength */ \
|
||||
USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \
|
||||
int_ep, /* bEndpointAddress */ \
|
||||
0x03, /* bmAttributes */ \
|
||||
0x02, 0x00, /* wMaxPacketSize */ \
|
||||
0x01, /* bInterval */ /* CDC Data Interface */ \
|
||||
0x00, 0x02, /* wMaxPacketSize */ \
|
||||
0x00, /* bInterval */ \
|
||||
0x09, /* bLength */ \
|
||||
USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \
|
||||
(uint8_t)(bFirstInterface + 1), /* bInterfaceNumber */ \
|
||||
@@ -413,19 +413,19 @@ struct cdc_ecm_descriptor {
|
||||
CDC_DATA_INTERFACE_CLASS, /* bInterfaceClass */ \
|
||||
0x00, /* bInterfaceSubClass */ \
|
||||
0x00, /* bInterfaceProtocol */ \
|
||||
0x00, /* iInterface */ /* Endpoint Out */ \
|
||||
0x00, /* iInterface */ \
|
||||
0x07, /* bLength */ \
|
||||
USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \
|
||||
out_ep, /* bEndpointAddress */ \
|
||||
0x02, /* bmAttributes */ \
|
||||
0x02, 0x00, /* wMaxPacketSize */ \
|
||||
0x01, /* bInterval */ /* Endpoint In */ \
|
||||
0x00, 0x02, /* wMaxPacketSize */ \
|
||||
0x00, /* bInterval */ \
|
||||
0x07, /* bLength */ \
|
||||
USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \
|
||||
in_ep, /* bEndpointAddress */ \
|
||||
0x02, /* bmAttributes */ \
|
||||
0x02, 0x00, /* wMaxPacketSize */ \
|
||||
0x01 /* bInterval */
|
||||
0x00, 0x02, /* wMaxPacketSize */ \
|
||||
0x00 /* bInterval */
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
|
||||
@@ -14,26 +14,18 @@ int dfu_class_request_handler(struct usb_setup_packet *setup, uint8_t **data, ui
|
||||
|
||||
switch (setup->bRequest) {
|
||||
case DFU_REQUEST_DETACH:
|
||||
|
||||
break;
|
||||
|
||||
case DFU_REQUEST_DNLOAD:
|
||||
|
||||
break;
|
||||
case DFU_REQUEST_UPLOAD:
|
||||
|
||||
break;
|
||||
case DFU_REQUEST_GETSTATUS:
|
||||
|
||||
break;
|
||||
case DFU_REQUEST_CLRSTATUS:
|
||||
|
||||
break;
|
||||
case DFU_REQUEST_GETSTATE:
|
||||
|
||||
break;
|
||||
case DFU_REQUEST_ABORT:
|
||||
|
||||
break;
|
||||
default:
|
||||
USBD_LOG_ERR("Unhandled request 0x%02x", setup->bRequest);
|
||||
|
||||
@@ -63,9 +63,9 @@ static void usbd_hid_reset(void)
|
||||
|
||||
int hid_custom_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len)
|
||||
{
|
||||
USBD_LOG_DBG("Standard request:"
|
||||
"bmRequestType 0x%02x, bRequest 0x%02x, len %d\r\n",
|
||||
setup->bmRequestType, setup->bRequest, *len);
|
||||
USBD_LOG_DBG("HID Custom request: "
|
||||
"bRequest 0x%02x\r\n",
|
||||
setup->bRequest);
|
||||
|
||||
if (REQTYPE_GET_DIR(setup->bmRequestType) == USB_REQUEST_DEVICE_TO_HOST &&
|
||||
setup->bRequest == USB_REQUEST_GET_DESCRIPTOR) {
|
||||
@@ -118,9 +118,9 @@ int hid_custom_request_handler(struct usb_setup_packet *setup, uint8_t **data, u
|
||||
|
||||
int hid_class_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len)
|
||||
{
|
||||
USBD_LOG("Class request:"
|
||||
"bmRequestType 0x%02x bRequest 0x%02x, len %d\r\n",
|
||||
setup->bmRequestType, setup->bRequest, *len);
|
||||
USBD_LOG_DBG("HID Class request: "
|
||||
"bRequest 0x%02x\r\n",
|
||||
setup->bRequest);
|
||||
|
||||
struct usbd_hid_cfg_private *current_hid_intf = NULL;
|
||||
usb_slist_t *i;
|
||||
|
||||
@@ -27,9 +27,9 @@ 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("Class request:"
|
||||
"bRequest 0x%02x, bmRequestType 0x%02x len %d",
|
||||
setup->bRequest, setup->bmRequestType, *len);
|
||||
USBD_LOG_DBG("VIDEO Class request: "
|
||||
"bRequest 0x%02x\r\n",
|
||||
setup->bRequest);
|
||||
|
||||
switch (setup->bRequest) {
|
||||
case VIDEO_REQUEST_SET_CUR:
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#define _USB_DC_H
|
||||
|
||||
#include "stdint.h"
|
||||
#include "bflb_platform.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "string.h"
|
||||
#include "stdint.h"
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "usb_slist.h"
|
||||
|
||||
#ifndef __packed
|
||||
@@ -127,14 +128,14 @@
|
||||
#define DBVAL(x) (x & 0xFF), ((x >> 8) & 0xFF), ((x >> 16) & 0xFF), ((x >> 24) & 0xFF)
|
||||
|
||||
#if 0
|
||||
#define USBD_LOG_WRN(a, ...) bflb_platform_printf(a, ##__VA_ARGS__)
|
||||
#define USBD_LOG_DBG(a, ...) bflb_platform_printf(a, ##__VA_ARGS__)
|
||||
#define USBD_LOG_ERR(a, ...) bflb_platform_printf(a, ##__VA_ARGS__)
|
||||
#define USBD_LOG_WRN(a, ...) printf(a, ##__VA_ARGS__)
|
||||
#define USBD_LOG_DBG(a, ...) printf(a, ##__VA_ARGS__)
|
||||
#define USBD_LOG_ERR(a, ...) printf(a, ##__VA_ARGS__)
|
||||
#else
|
||||
#define USBD_LOG_WRN(a, ...) bflb_platform_printf(a, ##__VA_ARGS__)
|
||||
#define USBD_LOG_WRN(a, ...) printf(a, ##__VA_ARGS__)
|
||||
#define USBD_LOG_DBG(a, ...)
|
||||
#define USBD_LOG_ERR(a, ...) bflb_platform_printf(a, ##__VA_ARGS__)
|
||||
#define USBD_LOG(a, ...) bflb_platform_printf(a, ##__VA_ARGS__)
|
||||
#define USBD_LOG_ERR(a, ...) printf(a, ##__VA_ARGS__)
|
||||
#define USBD_LOG(a, ...) printf(a, ##__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user