From a7e8a2ba9aa5e8a6ba074f397b1fd789a8f25205 Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 26 Mar 2013 02:06:30 +0700 Subject: [PATCH] pass all the current tests --- tests/test/host/hid/test_hid_host.c | 3 +-- tests/test/host/test_usbh.c | 1 + tinyusb/host/usbh.c | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test/host/hid/test_hid_host.c b/tests/test/host/hid/test_hid_host.c index 3a398257..3114eaf1 100644 --- a/tests/test/host/hid/test_hid_host.c +++ b/tests/test/host/hid/test_hid_host.c @@ -88,11 +88,10 @@ void test_hidh_open_ok(void) void test_hidh_close(void) { - hidh_keyboard_init_Ignore(); hidh_keyboard_close_Expect(dev_addr); //------------- Code Under TEST -------------// -// hidh_close(dev_addr); + hidh_close(dev_addr); } void test_hihd_isr(void) diff --git a/tests/test/host/test_usbh.c b/tests/test/host/test_usbh.c index 6c5a83ae..1058e54d 100644 --- a/tests/test/host/test_usbh.c +++ b/tests/test/host/test_usbh.c @@ -181,6 +181,7 @@ void test_usbh_device_unplugged_isr(void) usbh_devices[dev_addr].core_id = 0; usbh_devices[dev_addr].hub_addr = 0; usbh_devices[dev_addr].hub_port = 0; + usbh_devices[dev_addr].flag_supported_class = TUSB_CLASS_FLAG_HID; class_close_expect(); hcd_pipe_control_close_ExpectAndReturn(dev_addr, TUSB_ERROR_NONE); diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c index 587e8a84..7559142c 100644 --- a/tinyusb/host/usbh.c +++ b/tinyusb/host/usbh.c @@ -232,8 +232,11 @@ void usbh_device_unplugged_isr(uint8_t hostid) // if device unplugged is not a hub TODO handle hub unplugged for (uint8_t class_code = 1; class_code < TUSB_CLASS_MAX_CONSEC_NUMBER; class_code++) { - if (usbh_class_drivers[class_code].close) + if ((usbh_devices[dev_addr].flag_supported_class & BIT_(class_code)) && + usbh_class_drivers[class_code].close) + { usbh_class_drivers[class_code].close(dev_addr); + } } }