1 /* This tests the case where the transfer length of the GetHubStatus request is invalid.
2    The specific test case is in ux_host_class_hub_status_get.c. */
3 
4 #include "usbx_ux_test_hub.h"
5 
6 #ifdef CTEST
test_application_define(void * first_unused_memory)7 void test_application_define(void *first_unused_memory)
8 #else
9 void usbx_hub_hub_status_get_invalid_length_test_application_define(void *first_unused_memory)
10 #endif
11 {
12 
13     /* Inform user.  */
14     printf("Running Hub Hub Status Get Invalid Length Test...................... ");
15 
16     stepinfo("\n");
17 
18     initialize_hub(first_unused_memory);
19 }
20 
post_init_host()21 static void post_init_host()
22 {
23 #if UX_MAX_DEVICES > 1
24     UX_TEST_SETUP get_port_status_setup = {0};
25     get_port_status_setup.ux_test_setup_request = UX_HOST_CLASS_HUB_GET_STATUS;
26     get_port_status_setup.ux_test_setup_type = UX_REQUEST_IN | UX_REQUEST_TYPE_CLASS | UX_REQUEST_TARGET_OTHER;
27 
28     UX_TEST_ACTION get_port_status_match_action = {0};
29     get_port_status_match_action.usbx_function = UX_TEST_OVERRIDE_UX_HCD_SIM_HOST_ENTRY;
30     get_port_status_match_action.function = UX_HCD_TRANSFER_REQUEST;
31     get_port_status_match_action.req_action = UX_TEST_SETUP_MATCH_REQUEST | UX_TEST_SIM_REQ_ANSWER;
32     get_port_status_match_action.req_setup = &get_port_status_setup;
33     get_port_status_match_action.req_actual_len = 3; /* valid length is supposed to be 4. */
34     get_port_status_match_action.no_return = 0;
35     get_port_status_match_action.status = UX_SUCCESS;
36 
37     ux_test_add_action_to_main_list(get_port_status_match_action);
38 
39     connect_device_to_hub();
40     tx_thread_sleep(100);
41     ux_test_wait_for_enum_thread_completion();
42     UX_TEST_ASSERT(g_dpump_host_from_system_change_function == UX_NULL);
43 #endif
44 }
45 
post_init_device()46 static void post_init_device()
47 {
48 }