Skip to content

Commit cfb9e08

Browse files
fix(usb_host): Update auto suspend timer public API
1 parent bc944dc commit cfb9e08

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

host/class/hid/usb_host_hid/test_app/main/test_hid_basic.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ static void usb_lib_task(void *arg)
729729
xTaskNotifyGive(arg);
730730
}
731731
#ifdef HID_HOST_SUSPEND_RESUME_API_SUPPORTED
732-
// Auto-suspend timer
732+
// Automatic ssuspend timer
733733
if (event_flags & USB_HOST_LIB_EVENT_FLAGS_AUTO_SUSPEND) {
734734
printf("USB Event flags: AUTO_SUSPEND\n");
735735
TEST_ASSERT_EQUAL(ESP_OK, usb_host_lib_root_port_suspend());
@@ -950,18 +950,18 @@ TEST_CASE("suspend_resume_basic", "[hid_host]")
950950
hid_host_test_event_queue = NULL;
951951
}
952952

953-
#define TEST_HID_PM_TIMER_INTERVAL_MS 500
954-
#define TEST_HID_PM_TIMER_MARGIN_MS 50
953+
#define TEST_HID_SUSPEND_TIMER_INTERVAL_MS 500
954+
#define TEST_HID_SUSPEND_TIMER_MARGIN_MS 50
955955

956956
/**
957-
* @brief Auto Suspend timer
957+
* @brief Automatic Suspend timer
958958
*
959959
* Purpose:
960-
* - Test auto suspend timer functionality (One-Shot and Periodic timer settings)
960+
* - Test automatic suspend timer functionality (One-Shot and Periodic timer settings)
961961
*
962962
* Procedure:
963963
* - Install USB Host lib, Install HID driver, open device and start device
964-
* - Set auto-suspend timer, expect the root port to be suspended by expecting interface events
964+
* - Set automatic suspend timer, expect the root port to be suspended by expecting interface events
965965
* - Issue a CTRL transfer to the device, expect the root port to be resumed
966966
* - Teardown
967967
*/
@@ -983,30 +983,30 @@ TEST_CASE("auto_suspend_timer", "[hid_host]")
983983

984984
// Set one-shot auto suspend timer, and expect suspended event
985985
printf("Set One-Shot auto suspend timer\n");
986-
TEST_ASSERT_EQUAL(ESP_OK, usb_host_lib_set_auto_pm(USB_HOST_LIB_PM_SUSPEND_ONE_SHOT, TEST_HID_PM_TIMER_INTERVAL_MS));
986+
TEST_ASSERT_EQUAL(ESP_OK, usb_host_lib_set_auto_suspend(USB_HOST_LIB_AUTO_SUSPEND_ONE_SHOT, TEST_HID_SUSPEND_TIMER_INTERVAL_MS));
987987
expected_event.event_group = HID_INTERFACE_EVENT;
988988
expected_event.interface_evt.event = HID_HOST_INTERFACE_EVENT_SUSPENDED;
989-
hid_host_test_expect_event(&expected_event, pdMS_TO_TICKS(TEST_HID_PM_TIMER_INTERVAL_MS + TEST_HID_PM_TIMER_MARGIN_MS));
989+
hid_host_test_expect_event(&expected_event, pdMS_TO_TICKS(TEST_HID_SUSPEND_TIMER_INTERVAL_MS + TEST_HID_SUSPEND_TIMER_MARGIN_MS));
990990

991991
// Manually resume the root port and expect the resumed event
992992
TEST_ASSERT_EQUAL(ESP_OK, usb_host_lib_root_port_resume());
993993
expected_event.interface_evt.event = HID_HOST_INTERFACE_EVENT_RESUMED;
994994
hid_host_test_expect_event(&expected_event, expect_event_ticks);
995995

996-
// Make sure no other event is delivered, as the PM timer is a one-shot timer
997-
hid_host_test_expect_event(NULL, pdMS_TO_TICKS(TEST_HID_PM_TIMER_INTERVAL_MS * 2));
996+
// Make sure no other event is delivered, as the auto suspend timer is a one-shot timer
997+
hid_host_test_expect_event(NULL, pdMS_TO_TICKS(TEST_HID_SUSPEND_TIMER_INTERVAL_MS * 2));
998998

999-
// Set periodic PM suspend timer
1000-
printf("Set Periodic auto suspend timer\n");
1001-
TEST_ASSERT_EQUAL(ESP_OK, usb_host_lib_set_auto_pm(USB_HOST_LIB_PM_SUSPEND_PERIODIC, TEST_HID_PM_TIMER_INTERVAL_MS));
999+
// Set periodic auto suspend timer
1000+
printf("Set periodic auto suspend timer\n");
1001+
TEST_ASSERT_EQUAL(ESP_OK, usb_host_lib_set_auto_suspend(USB_HOST_LIB_AUTO_SUSPEND_PERIODIC, TEST_HID_SUSPEND_TIMER_INTERVAL_MS));
10021002

10031003
for (int i = 0; i < 3; i++) {
10041004
// Expect suspend event from the periodic auto suspend timer
10051005
expected_event.interface_evt.event = HID_HOST_INTERFACE_EVENT_SUSPENDED;
1006-
hid_host_test_expect_event(&expected_event, pdMS_TO_TICKS(TEST_HID_PM_TIMER_INTERVAL_MS + TEST_HID_PM_TIMER_MARGIN_MS));
1006+
hid_host_test_expect_event(&expected_event, pdMS_TO_TICKS(TEST_HID_SUSPEND_TIMER_INTERVAL_MS + TEST_HID_SUSPEND_TIMER_MARGIN_MS));
10071007

1008-
// Even though the Periodic timer is running, don't expect any event because of suspended root port
1009-
hid_host_test_expect_event(NULL, pdMS_TO_TICKS(TEST_HID_PM_TIMER_INTERVAL_MS * 2));
1008+
// Even though the periodic timer is running, don't expect any event because of suspended root port
1009+
hid_host_test_expect_event(NULL, pdMS_TO_TICKS(TEST_HID_SUSPEND_TIMER_INTERVAL_MS * 2));
10101010

10111011
// Manually resume the root port and expect the resumed event
10121012
TEST_ASSERT_EQUAL(ESP_OK, usb_host_lib_root_port_resume());
@@ -1019,11 +1019,11 @@ TEST_CASE("auto_suspend_timer", "[hid_host]")
10191019
test_hid_host_device_touch(&dev_params, HID_HOST_TEST_TOUCH_WAY_ASSERT);
10201020
}
10211021

1022-
// Disable the Periodic PM timer
1023-
printf("Disable Periodic auto suspend timer\n");
1024-
TEST_ASSERT_EQUAL(ESP_OK, usb_host_lib_set_auto_pm(USB_HOST_LIB_PM_SUSPEND_PERIODIC, 0));
1022+
// Disable the periodic auto suspend timer
1023+
printf("Disable periodic auto suspend timer\n");
1024+
TEST_ASSERT_EQUAL(ESP_OK, usb_host_lib_set_auto_suspend(USB_HOST_LIB_AUTO_SUSPEND_PERIODIC, 0));
10251025
// Make sure no event is delivered
1026-
hid_host_test_expect_event(NULL, pdMS_TO_TICKS(TEST_HID_PM_TIMER_INTERVAL_MS * 2));
1026+
hid_host_test_expect_event(NULL, pdMS_TO_TICKS(TEST_HID_SUSPEND_TIMER_INTERVAL_MS * 2));
10271027

10281028
// Tear down test
10291029
test_hid_teardown();

0 commit comments

Comments
 (0)