diff --git a/demos/bsp/boards/embedded_artists/board_ea4357.h b/demos/bsp/boards/embedded_artists/board_ea4357.h index 0cef17358..138e6e199 100644 --- a/demos/bsp/boards/embedded_artists/board_ea4357.h +++ b/demos/bsp/boards/embedded_artists/board_ea4357.h @@ -66,8 +66,8 @@ #include "oem_base_board/pca9532.h" // LEDs -//#define CFG_PRINTF_TARGET PRINTF_TARGET_SWO -#define CFG_PRINTF_TARGET PRINTF_TARGET_UART +#define CFG_PRINTF_TARGET PRINTF_TARGET_SWO +//#define CFG_PRINTF_TARGET PRINTF_TARGET_UART /*========================================================================= HARDWARE MAC ADDRESS diff --git a/demos/host/host_freertos/host_freertos.uvopt b/demos/host/host_freertos/host_freertos.uvopt index 83d554cf5..39a67a860 100644 --- a/demos/host/host_freertos/host_freertos.uvopt +++ b/demos/host/host_freertos/host_freertos.uvopt @@ -331,7 +331,7 @@ 0 0 0 - 96 + 97 102 0 ..\src\main.c @@ -379,8 +379,8 @@ 0 0 0 - 41 - 50 + 43 + 55 0 ..\src\mouse_app.c mouse_app.c @@ -833,9 +833,9 @@ 1 0 0 - 51 + 52 0 - 348 + 349 355 0 ..\..\bsp\lpc43xx\CMSIS_LPC43xx_DriverLib\src\lpc43xx_uart.c @@ -939,7 +939,7 @@ 0 0 0 - 149 + 150 151 0 ..\..\bsp\lpc43xx\startup_keil\startup_LPC43xx.s @@ -1075,7 +1075,7 @@ 0 27 0 - 22 + 23 29 0 ..\..\..\vendor\freertos\freertos\Source\portable\RVDS\ARM_CM4F\port.c diff --git a/demos/host/host_os_none/host_os_none.uvopt b/demos/host/host_os_none/host_os_none.uvopt index 2fcf8cbe9..45db11ebb 100644 --- a/demos/host/host_os_none/host_os_none.uvopt +++ b/demos/host/host_os_none/host_os_none.uvopt @@ -392,10 +392,10 @@ 1 0 0 - 0 + 54 0 - 170 - 175 + 171 + 191 0 ..\src\main.c main.c @@ -426,7 +426,7 @@ 0 20 0 - 117 + 120 129 0 ..\src\keyboard_app.c @@ -442,7 +442,7 @@ 0 0 0 - 119 + 122 131 0 ..\src\mouse_app.c @@ -498,7 +498,7 @@ 0 2 0 - 138 + 139 146 0 ..\..\bsp\boards\embedded_artists\board_ea4357.c @@ -514,7 +514,7 @@ 0 1 0 - 100 + 101 106 0 ..\..\bsp\boards\printf_retarget.c @@ -712,10 +712,10 @@ 1 0 0 - 30 + 0 0 1 - 21 + 1 0 ..\..\..\tinyusb\host\usbh.c usbh.c @@ -730,7 +730,7 @@ 0 47 0 - 1 + 4 13 0 ..\..\..\tinyusb\host\ehci\ehci.c @@ -778,7 +778,7 @@ 0 8 0 - 58 + 68 77 0 ..\..\..\tinyusb\hal\hal_lpc43xx.c @@ -842,7 +842,7 @@ 0 28 0 - 15 + 23 32 0 ..\..\..\tinyusb\class\cdc_host.c @@ -1002,7 +1002,7 @@ 0 0 0 - 145 + 146 151 0 ..\..\bsp\lpc43xx\startup_keil\startup_LPC43xx.s diff --git a/demos/host/src/tusb_config.h b/demos/host/src/tusb_config.h index dba30c76c..215a77cbc 100644 --- a/demos/host/src/tusb_config.h +++ b/demos/host/src/tusb_config.h @@ -69,7 +69,7 @@ #define TUSB_CFG_CONFIGURATION_MAX 1 //------------- USBD -------------// -#define TUSB_CFG_HOST_ENUM_BUFFER_SIZE 256 +#define TUSB_CFG_HOST_ENUM_BUFFER_SIZE 255 //------------- CLASS -------------// #define TUSB_CFG_HOST_HUB 0 diff --git a/tests/lpc18xx_43xx/test/host/usbh/test_enum_task.c b/tests/lpc18xx_43xx/test/host/usbh/test_enum_task.c index e5c928efc..b6e9877c2 100644 --- a/tests/lpc18xx_43xx/test/host/usbh/test_enum_task.c +++ b/tests/lpc18xx_43xx/test/host/usbh/test_enum_task.c @@ -153,7 +153,7 @@ tusb_error_t control_xfer_stub(uint8_t dev_addr, const tusb_control_request_t * case 4: // get full-length configuration descriptor TEST_ASSERT_EQUAL(TUSB_REQUEST_GET_DESCRIPTOR, p_request->bRequest); TEST_ASSERT_EQUAL(TUSB_DESC_TYPE_CONFIGURATION, p_request->wValue >> 8); - TEST_ASSERT_EQUAL(desc_configuration.configuration.wTotalLength, p_request->wLength); + TEST_ASSERT_EQUAL(TUSB_CFG_HOST_ENUM_BUFFER_SIZE, p_request->wLength); memcpy(data, &desc_configuration, p_request->wLength); break; diff --git a/tests/support/tusb_config.h b/tests/support/tusb_config.h index 4b4c83b4e..e9c7b92a4 100644 --- a/tests/support/tusb_config.h +++ b/tests/support/tusb_config.h @@ -69,7 +69,7 @@ #define TUSB_CFG_HOST_DEVICE_MAX 2 #define TUSB_CFG_CONFIGURATION_MAX 2 -#define TUSB_CFG_HOST_ENUM_BUFFER_SIZE 256 +#define TUSB_CFG_HOST_ENUM_BUFFER_SIZE 255 //------------- CLASS -------------// #define TUSB_CFG_HOST_HID_KEYBOARD 1 diff --git a/tinyusb/class/hid.h b/tinyusb/class/hid.h index 06374e035..e68d1596f 100644 --- a/tinyusb/class/hid.h +++ b/tinyusb/class/hid.h @@ -104,8 +104,9 @@ typedef ATTR_PREPACKED struct ATTR_PACKED { typedef ATTR_PACKED_STRUCT(struct) { uint8_t buttons; /**< buttons mask for currently pressed buttons in the mouse. */ - int8_t x; /**< Current delta x movement of the mouse. */ - int8_t y; /**< Current delta y movement on the mouse. */ + int8_t x; /**< Current delta x movement of the mouse. */ + int8_t y; /**< Current delta y movement on the mouse. */ + int8_t wheel; /**< Current delta wheel movement on the mouse. */ } tusb_mouse_report_t; /** diff --git a/tinyusb/class/hid_host.c b/tinyusb/class/hid_host.c index ddcbb57fa..60e0ab6d3 100644 --- a/tinyusb/class/hid_host.c +++ b/tinyusb/class/hid_host.c @@ -197,7 +197,10 @@ void hidh_init(void) #endif } -//uint8_t report_descriptor[256] TUSB_CFG_ATTR_USBRAM; +#if 0 +uint8_t report_descriptor[256] TUSB_CFG_ATTR_USBRAM; +#endif + tusb_error_t hidh_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t const *p_interface_desc, uint16_t *p_length) { tusb_error_t error; @@ -215,41 +218,29 @@ tusb_error_t hidh_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con OSAL_SUBTASK_BEGIN +#if 0 //------------- SET IDLE request -------------// // TODO this request can be stalled by device (indicate not supported), // until we have clear stall handler, temporarily disable it. -// OSAL_SUBTASK_INVOKED_AND_WAIT( -// usbh_control_xfer_subtask( -// dev_addr, -// &(tusb_control_request_t) -// { -// .bmRequestType = { .direction = TUSB_DIR_HOST_TO_DEV, .type = TUSB_REQUEST_TYPE_CLASS, .recipient = TUSB_REQUEST_RECIPIENT_INTERFACE }, -// .bRequest = HID_REQUEST_CONTROL_SET_IDLE, -// .wValue = 0, -// .wIndex = p_interface_desc->bInterfaceNumber -// }, -// NULL ), -// error -// ); + OSAL_SUBTASK_INVOKED_AND_WAIT( + usbh_control_xfer_subtask( dev_addr, bm_request_type(TUSB_DIR_HOST_TO_DEV, TUSB_REQUEST_TYPE_CLASS, TUSB_REQUEST_RECIPIENT_INTERFACE), + HID_REQUEST_CONTROL_SET_IDLE, 0, p_interface_desc->bInterfaceNumber, + 0, NULL ), + error + ); - //------------- TODO skip Get Report Descriptor -------------// -// memclr_(report_descriptor, 256); - -// OSAL_SUBTASK_INVOKED_AND_WAIT( -// usbh_control_xfer_subtask( -// dev_addr, -// &(tusb_control_request_t) -// { -// .bmRequestType = { .direction = TUSB_DIR_DEV_TO_HOST, .type = TUSB_REQUEST_TYPE_STANDARD, .recipient = TUSB_REQUEST_RECIPIENT_INTERFACE }, -// .bRequest = TUSB_REQUEST_GET_DESCRIPTOR, -// .wValue = HID_DESC_TYPE_REPORT, -// .wIndex = p_interface_desc->bInterfaceNumber, -// .wLength = p_desc_hid->wReportLength, -// }, -// report_descriptor ), -// error -// ); -// uint8_t *p_report_desc = NULL; // report descriptor has to be global & in USB RAM + //------------- Get Report Descriptor TODO HID parser -------------// + if ( p_desc_hid->bNumDescriptors ) + { + OSAL_SUBTASK_INVOKED_AND_WAIT( + usbh_control_xfer_subtask( dev_addr, bm_request_type(TUSB_DIR_DEV_TO_HOST, TUSB_REQUEST_TYPE_STANDARD, TUSB_REQUEST_RECIPIENT_INTERFACE), + TUSB_REQUEST_GET_DESCRIPTOR, (p_desc_hid->bReportType << 8), 0, + p_desc_hid->wReportLength, report_descriptor ), + error + ); + // if error in getting report descriptor --> treating like there is none + } +#endif if ( HID_SUBCLASS_BOOT == p_interface_desc->bInterfaceSubClass ) { diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c index ce0c047d9..3b9af5801 100644 --- a/tinyusb/host/usbh.c +++ b/tinyusb/host/usbh.c @@ -418,14 +418,14 @@ tusb_error_t enumeration_body_subtask(void) error ); SUBTASK_ASSERT_STATUS(error); - SUBTASK_ASSERT_WITH_HANDLER( TUSB_CFG_HOST_ENUM_BUFFER_SIZE > ((tusb_descriptor_configuration_t*)enum_data_buffer)->wTotalLength, + SUBTASK_ASSERT_WITH_HANDLER( TUSB_CFG_HOST_ENUM_BUFFER_SIZE >= ((tusb_descriptor_configuration_t*)enum_data_buffer)->wTotalLength, tusbh_device_mount_failed_cb(TUSB_ERROR_USBH_MOUNT_CONFIG_DESC_TOO_LONG, NULL) ); //------------- Get full configuration descriptor -------------// OSAL_SUBTASK_INVOKED_AND_WAIT( usbh_control_xfer_subtask( new_addr, bm_request_type(TUSB_DIR_DEV_TO_HOST, TUSB_REQUEST_TYPE_STANDARD, TUSB_REQUEST_RECIPIENT_DEVICE), TUSB_REQUEST_GET_DESCRIPTOR, (TUSB_DESC_TYPE_CONFIGURATION << 8) | (configure_selected - 1), 0, - ((tusb_descriptor_configuration_t*) enum_data_buffer)->wTotalLength, enum_data_buffer ), + TUSB_CFG_HOST_ENUM_BUFFER_SIZE, enum_data_buffer ), error ); SUBTASK_ASSERT_STATUS(error);