19762338dSopenharmony_ci/* 29762338dSopenharmony_ci * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 39762338dSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 49762338dSopenharmony_ci * you may not use this file except in compliance with the License. 59762338dSopenharmony_ci * You may obtain a copy of the License at 69762338dSopenharmony_ci * 79762338dSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 89762338dSopenharmony_ci * 99762338dSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 109762338dSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 119762338dSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 129762338dSopenharmony_ci * See the License for the specific language governing permissions and 139762338dSopenharmony_ci * limitations under the License. 149762338dSopenharmony_ci */ 159762338dSopenharmony_ci 169762338dSopenharmony_ci#include <iostream> 179762338dSopenharmony_ci#include <vector> 189762338dSopenharmony_ci 199762338dSopenharmony_ci#include "hdf_log.h" 209762338dSopenharmony_ci#include "usbd_request_test.h" 219762338dSopenharmony_ci#include "v1_1/iusb_interface.h" 229762338dSopenharmony_ci#include "v1_1/usb_types.h" 239762338dSopenharmony_ci 249762338dSopenharmony_ciconst int SLEEP_TIME = 3; 259762338dSopenharmony_ciconst uint8_t INDEX_1 = 1; 269762338dSopenharmony_ciconst uint8_t INDEX_INVALID = 255; 279762338dSopenharmony_ciconst uint8_t CONFIG_ID_0 = 0; 289762338dSopenharmony_ciconst uint8_t CONFIG_ID_INVALID = 222; 299762338dSopenharmony_ciconst uint8_t BUS_NUM_INVALID = 255; 309762338dSopenharmony_ciconst uint8_t DEV_ADDR_INVALID = 255; 319762338dSopenharmony_ciconst uint8_t STRING_ID_INVALID = 233; 329762338dSopenharmony_ciconst uint32_t MAX_BUFFER_LENGTH = 255; 339762338dSopenharmony_ciconst int TAG_NUM_10 = 10; 349762338dSopenharmony_ciconst uint8_t INTERFACEID_OK = 1; 359762338dSopenharmony_ciconst uint8_t INTERFACEID_INVALID = 255; 369762338dSopenharmony_ciconst uint8_t POINTID_INVALID = 158; 379762338dSopenharmony_ci// data interface have 2 point : 1->bulk_out 2->bulk_in 389762338dSopenharmony_ciconst uint8_t POINTID_DIR_IN = USB_ENDPOINT_DIR_IN | 2; 399762338dSopenharmony_ciconst uint8_t POINTID_DIR_OUT = USB_ENDPOINT_DIR_OUT | 1; 409762338dSopenharmony_ciconst uint8_t INVALID_NUM = 222; 419762338dSopenharmony_ciconst uint32_t TIME_WAIT = 10000; 429762338dSopenharmony_ci 439762338dSopenharmony_ciusing namespace testing::ext; 449762338dSopenharmony_ciusing namespace OHOS; 459762338dSopenharmony_ciusing namespace OHOS::USB; 469762338dSopenharmony_ciusing namespace std; 479762338dSopenharmony_ciusing namespace OHOS::HDI::Usb::V1_0; 489762338dSopenharmony_ciusing namespace OHOS::HDI::Usb::V1_1; 499762338dSopenharmony_ci 509762338dSopenharmony_ciUsbDev UsbdRequestTest::dev_ = {0, 0}; 519762338dSopenharmony_cisptr<UsbSubscriberTest> UsbdRequestTest::subscriber_ = nullptr; 529762338dSopenharmony_ci 539762338dSopenharmony_cinamespace { 549762338dSopenharmony_cisptr<OHOS::HDI::Usb::V1_1::IUsbInterface> g_usbInterface = nullptr; 559762338dSopenharmony_ci 569762338dSopenharmony_ciint32_t SwitchErrCode(int32_t ret) 579762338dSopenharmony_ci{ 589762338dSopenharmony_ci return ret == HDF_ERR_NOT_SUPPORT ? HDF_SUCCESS : ret; 599762338dSopenharmony_ci} 609762338dSopenharmony_ci 619762338dSopenharmony_civoid UsbdRequestTest::SetUpTestCase(void) 629762338dSopenharmony_ci{ 639762338dSopenharmony_ci g_usbInterface = OHOS::HDI::Usb::V1_1::IUsbInterface::Get(); 649762338dSopenharmony_ci if (g_usbInterface == nullptr) { 659762338dSopenharmony_ci HDF_LOGE("%{public}s:IUsbInterface::Get() failed.", __func__); 669762338dSopenharmony_ci exit(0); 679762338dSopenharmony_ci } 689762338dSopenharmony_ci auto ret = g_usbInterface->SetPortRole(1, 1, 1); 699762338dSopenharmony_ci sleep(SLEEP_TIME); 709762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::[Device] %{public}d SetPortRole=%{public}d", __LINE__, ret); 719762338dSopenharmony_ci ret = SwitchErrCode(ret); 729762338dSopenharmony_ci ASSERT_EQ(0, ret); 739762338dSopenharmony_ci if (ret != 0) { 749762338dSopenharmony_ci exit(0); 759762338dSopenharmony_ci } 769762338dSopenharmony_ci 779762338dSopenharmony_ci subscriber_ = new UsbSubscriberTest(); 789762338dSopenharmony_ci if (g_usbInterface->BindUsbdSubscriber(subscriber_) != HDF_SUCCESS) { 799762338dSopenharmony_ci HDF_LOGE("%{public}s: bind usbd subscriber_ failed", __func__); 809762338dSopenharmony_ci exit(0); 819762338dSopenharmony_ci } 829762338dSopenharmony_ci 839762338dSopenharmony_ci std::cout << "please connect device, press enter to continue" << std::endl; 849762338dSopenharmony_ci int c; 859762338dSopenharmony_ci while ((c = getchar()) != '\n' && c != EOF) {} 869762338dSopenharmony_ci dev_ = { subscriber_->busNum_, subscriber_->devAddr_ }; 879762338dSopenharmony_ci 889762338dSopenharmony_ci ret = g_usbInterface->OpenDevice(dev_); 899762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest:: %{public}d OpenDevice=%{public}d", __LINE__, ret); 909762338dSopenharmony_ci ASSERT_EQ(0, ret); 919762338dSopenharmony_ci} 929762338dSopenharmony_ci 939762338dSopenharmony_civoid UsbdRequestTest::TearDownTestCase(void) 949762338dSopenharmony_ci{ 959762338dSopenharmony_ci g_usbInterface->UnbindUsbdSubscriber(subscriber_); 969762338dSopenharmony_ci dev_ = { subscriber_->busNum_, subscriber_->devAddr_ }; 979762338dSopenharmony_ci auto ret = g_usbInterface->CloseDevice(dev_); 989762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest:: %{public}d Close=%{public}d", __LINE__, ret); 999762338dSopenharmony_ci ASSERT_EQ(0, ret); 1009762338dSopenharmony_ci} 1019762338dSopenharmony_ci 1029762338dSopenharmony_civoid UsbdRequestTest::SetUp(void) {} 1039762338dSopenharmony_ci 1049762338dSopenharmony_civoid UsbdRequestTest::TearDown(void) {} 1059762338dSopenharmony_ci 1069762338dSopenharmony_ci/** 1079762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Func_0200 1089762338dSopenharmony_ci * @tc.desc: Test functions to SetConfig 1099762338dSopenharmony_ci * @tc.desc: int32_t SetConfig(const UsbDev &dev, uint8_t configIndex); 1109762338dSopenharmony_ci * @tc.desc: Positive test: parameters correctly 1119762338dSopenharmony_ci * @tc.type: FUNC 1129762338dSopenharmony_ci */ 1139762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Func_0200, Function | MediumTest | Level1) 1149762338dSopenharmony_ci{ 1159762338dSopenharmony_ci uint8_t configIndex = INDEX_1; 1169762338dSopenharmony_ci struct UsbDev dev = dev_; 1179762338dSopenharmony_ci auto ret = g_usbInterface->SetConfig(dev, configIndex); 1189762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Func_0200 %{public}d SetConfig=%{public}d", __LINE__, ret); 1199762338dSopenharmony_ci ASSERT_EQ(0, ret); 1209762338dSopenharmony_ci} 1219762338dSopenharmony_ci 1229762338dSopenharmony_ci/** 1239762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_0400 1249762338dSopenharmony_ci * @tc.desc: Test functions to SetConfig 1259762338dSopenharmony_ci * @tc.desc: int32_t SetConfig(const UsbDev &dev, uint8_t configIndex); 1269762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum error 1279762338dSopenharmony_ci * @tc.type: FUNC 1289762338dSopenharmony_ci */ 1299762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_0400, Function | MediumTest | Level1) 1309762338dSopenharmony_ci{ 1319762338dSopenharmony_ci uint8_t configIndex = INDEX_1; 1329762338dSopenharmony_ci struct UsbDev dev = { BUS_NUM_INVALID, dev_.devAddr }; 1339762338dSopenharmony_ci auto ret = g_usbInterface->SetConfig(dev, configIndex); 1349762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_0400 %{public}d SetConfig=%{public}d", 1359762338dSopenharmony_ci __LINE__, ret); 1369762338dSopenharmony_ci ASSERT_NE(ret, 0); 1379762338dSopenharmony_ci} 1389762338dSopenharmony_ci 1399762338dSopenharmony_ci/** 1409762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_0500 1419762338dSopenharmony_ci * @tc.desc: Test functions to SetConfig 1429762338dSopenharmony_ci * @tc.desc: int32_t SetConfig(const UsbDev &dev, uint8_t configIndex); 1439762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, devAddr error 1449762338dSopenharmony_ci * @tc.type: FUNC 1459762338dSopenharmony_ci */ 1469762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_0500, Function | MediumTest | Level1) 1479762338dSopenharmony_ci{ 1489762338dSopenharmony_ci uint8_t configIndex = INDEX_1; 1499762338dSopenharmony_ci struct UsbDev dev = { dev_.busNum, DEV_ADDR_INVALID }; 1509762338dSopenharmony_ci auto ret = g_usbInterface->SetConfig(dev, configIndex); 1519762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_0500 %{public}d SetConfig=%{public}d", 1529762338dSopenharmony_ci __LINE__, ret); 1539762338dSopenharmony_ci ASSERT_NE(ret, 0); 1549762338dSopenharmony_ci} 1559762338dSopenharmony_ci 1569762338dSopenharmony_ci/** 1579762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_0600 1589762338dSopenharmony_ci * @tc.desc: Test functions to SetConfig 1599762338dSopenharmony_ci * @tc.desc: int32_t SetConfig(const UsbDev &dev, uint8_t configIndex); 1609762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, configIndex error 1619762338dSopenharmony_ci * @tc.type: FUNC 1629762338dSopenharmony_ci */ 1639762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_0600, Function | MediumTest | Level1) 1649762338dSopenharmony_ci{ 1659762338dSopenharmony_ci uint8_t configIndex = INDEX_INVALID; 1669762338dSopenharmony_ci struct UsbDev dev = dev_; 1679762338dSopenharmony_ci auto ret = g_usbInterface->SetConfig(dev, configIndex); 1689762338dSopenharmony_ci ASSERT_NE(ret, 0); 1699762338dSopenharmony_ci configIndex = INDEX_1; 1709762338dSopenharmony_ci ret = g_usbInterface->SetConfig(dev, configIndex); 1719762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_0600 %{public}d SetConfig=%{public}d", 1729762338dSopenharmony_ci __LINE__, ret); 1739762338dSopenharmony_ci ASSERT_EQ(0, ret); 1749762338dSopenharmony_ci} 1759762338dSopenharmony_ci 1769762338dSopenharmony_ci/** 1779762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_0700 1789762338dSopenharmony_ci * @tc.desc: Test functions to SetConfig 1799762338dSopenharmony_ci * @tc.desc: int32_t SetConfig(const UsbDev &dev, uint8_t configIndex); 1809762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum && devAddr error 1819762338dSopenharmony_ci * @tc.type: FUNC 1829762338dSopenharmony_ci */ 1839762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_0700, Function | MediumTest | Level1) 1849762338dSopenharmony_ci{ 1859762338dSopenharmony_ci uint8_t configIndex = INDEX_1; 1869762338dSopenharmony_ci struct UsbDev dev = { BUS_NUM_INVALID, DEV_ADDR_INVALID }; 1879762338dSopenharmony_ci auto ret = g_usbInterface->SetConfig(dev, configIndex); 1889762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_0700 %{public}d SetConfig=%{public}d", 1899762338dSopenharmony_ci __LINE__, ret); 1909762338dSopenharmony_ci ASSERT_NE(ret, 0); 1919762338dSopenharmony_ci} 1929762338dSopenharmony_ci 1939762338dSopenharmony_ci/** 1949762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_0800 1959762338dSopenharmony_ci * @tc.desc: Test functions to SetConfig 1969762338dSopenharmony_ci * @tc.desc: int32_t SetConfig(const UsbDev &dev, uint8_t configIndex); 1979762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum && configIndex error 1989762338dSopenharmony_ci * @tc.type: FUNC 1999762338dSopenharmony_ci */ 2009762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_0800, Function | MediumTest | Level1) 2019762338dSopenharmony_ci{ 2029762338dSopenharmony_ci uint8_t configIndex = INDEX_INVALID; 2039762338dSopenharmony_ci struct UsbDev dev = { BUS_NUM_INVALID, dev_.devAddr }; 2049762338dSopenharmony_ci auto ret = g_usbInterface->SetConfig(dev, configIndex); 2059762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_0800 %{public}d SetConfig=%{public}d", 2069762338dSopenharmony_ci __LINE__, ret); 2079762338dSopenharmony_ci ASSERT_NE(ret, 0); 2089762338dSopenharmony_ci} 2099762338dSopenharmony_ci 2109762338dSopenharmony_ci/** 2119762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_0900 2129762338dSopenharmony_ci * @tc.desc: Test functions to SetConfig 2139762338dSopenharmony_ci * @tc.desc: int32_t SetConfig(const UsbDev &dev, uint8_t configIndex); 2149762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, devAddr && configIndex error 2159762338dSopenharmony_ci * @tc.type: FUNC 2169762338dSopenharmony_ci */ 2179762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_0900, Function | MediumTest | Level1) 2189762338dSopenharmony_ci{ 2199762338dSopenharmony_ci uint8_t configIndex = INDEX_INVALID; 2209762338dSopenharmony_ci struct UsbDev dev = { dev_.busNum, DEV_ADDR_INVALID }; 2219762338dSopenharmony_ci auto ret = g_usbInterface->SetConfig(dev, configIndex); 2229762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_0900 %{public}d SetConfig=%{public}d", 2239762338dSopenharmony_ci __LINE__, ret); 2249762338dSopenharmony_ci ASSERT_NE(ret, 0); 2259762338dSopenharmony_ci} 2269762338dSopenharmony_ci 2279762338dSopenharmony_ci/** 2289762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_1000 2299762338dSopenharmony_ci * @tc.desc: Test functions to SetConfig 2309762338dSopenharmony_ci * @tc.desc: int32_t SetConfig(const UsbDev &dev, uint8_t configIndex); 2319762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum && devAddr && configIndex error 2329762338dSopenharmony_ci * @tc.type: FUNC 2339762338dSopenharmony_ci */ 2349762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_1000, Function | MediumTest | Level1) 2359762338dSopenharmony_ci{ 2369762338dSopenharmony_ci uint8_t configIndex = INDEX_INVALID; 2379762338dSopenharmony_ci struct UsbDev dev = { BUS_NUM_INVALID, DEV_ADDR_INVALID }; 2389762338dSopenharmony_ci auto ret = g_usbInterface->SetConfig(dev, configIndex); 2399762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_1000 %{public}d SetConfig=%{public}d", 2409762338dSopenharmony_ci __LINE__, ret); 2419762338dSopenharmony_ci ASSERT_NE(ret, 0); 2429762338dSopenharmony_ci} 2439762338dSopenharmony_ci 2449762338dSopenharmony_ci/**********************************************************************************************************/ 2459762338dSopenharmony_ci 2469762338dSopenharmony_ci/** 2479762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Func_0300 2489762338dSopenharmony_ci * @tc.desc: Test functions to GetConfig 2499762338dSopenharmony_ci * @tc.desc: int32_t GetConfig(const UsbDev &dev, uint8_t &configIndex); 2509762338dSopenharmony_ci * @tc.desc: Positive test: parameters correctly 2519762338dSopenharmony_ci * @tc.type: FUNC 2529762338dSopenharmony_ci */ 2539762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Func_0300, Function | MediumTest | Level1) 2549762338dSopenharmony_ci{ 2559762338dSopenharmony_ci uint8_t configIndex = INDEX_1; 2569762338dSopenharmony_ci struct UsbDev dev = dev_; 2579762338dSopenharmony_ci auto ret = g_usbInterface->GetConfig(dev, configIndex); 2589762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Func_0300 %{public}d GetConfig=%{public}d", __LINE__, ret); 2599762338dSopenharmony_ci ASSERT_EQ(0, ret); 2609762338dSopenharmony_ci} 2619762338dSopenharmony_ci 2629762338dSopenharmony_ci/** 2639762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_1100 2649762338dSopenharmony_ci * @tc.desc: Test functions to GetConfig 2659762338dSopenharmony_ci * @tc.desc: int32_t GetConfig(const UsbDev &dev, uint8_t &configIndex); 2669762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum error 2679762338dSopenharmony_ci * @tc.type: FUNC 2689762338dSopenharmony_ci */ 2699762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_1100, Function | MediumTest | Level1) 2709762338dSopenharmony_ci{ 2719762338dSopenharmony_ci uint8_t configIndex = INDEX_1; 2729762338dSopenharmony_ci struct UsbDev dev = { BUS_NUM_INVALID, dev_.devAddr }; 2739762338dSopenharmony_ci auto ret = g_usbInterface->GetConfig(dev, configIndex); 2749762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_1100 %{public}d GetConfig=%{public}d", 2759762338dSopenharmony_ci __LINE__, ret); 2769762338dSopenharmony_ci ASSERT_NE(ret, 0); 2779762338dSopenharmony_ci} 2789762338dSopenharmony_ci 2799762338dSopenharmony_ci/** 2809762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_1200 2819762338dSopenharmony_ci * @tc.desc: Test functions to GetConfig 2829762338dSopenharmony_ci * @tc.desc: int32_t GetConfig(const UsbDev &dev, uint8_t &configIndex); 2839762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, devAddr error 2849762338dSopenharmony_ci * @tc.type: FUNC 2859762338dSopenharmony_ci */ 2869762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_1200, Function | MediumTest | Level1) 2879762338dSopenharmony_ci{ 2889762338dSopenharmony_ci uint8_t configIndex = INDEX_1; 2899762338dSopenharmony_ci struct UsbDev dev = { dev_.busNum, DEV_ADDR_INVALID }; 2909762338dSopenharmony_ci auto ret = g_usbInterface->GetConfig(dev, configIndex); 2919762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_1200 %{public}d GetConfig=%{public}d", 2929762338dSopenharmony_ci __LINE__, ret); 2939762338dSopenharmony_ci ASSERT_NE(ret, 0); 2949762338dSopenharmony_ci} 2959762338dSopenharmony_ci 2969762338dSopenharmony_ci/** 2979762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_1300 2989762338dSopenharmony_ci * @tc.desc: Test functions to GetConfig 2999762338dSopenharmony_ci * @tc.desc: int32_t GetConfig(const UsbDev &dev, uint8_t &configIndex); 3009762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum && devAddr error 3019762338dSopenharmony_ci * @tc.type: FUNC 3029762338dSopenharmony_ci */ 3039762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_1300, Function | MediumTest | Level1) 3049762338dSopenharmony_ci{ 3059762338dSopenharmony_ci uint8_t configIndex = INDEX_1; 3069762338dSopenharmony_ci struct UsbDev dev = { BUS_NUM_INVALID, DEV_ADDR_INVALID }; 3079762338dSopenharmony_ci auto ret = g_usbInterface->GetConfig(dev, configIndex); 3089762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_1300 %{public}d GetConfig=%{public}d", 3099762338dSopenharmony_ci __LINE__, ret); 3109762338dSopenharmony_ci ASSERT_NE(ret, 0); 3119762338dSopenharmony_ci} 3129762338dSopenharmony_ci 3139762338dSopenharmony_ci/** 3149762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Func_0700 3159762338dSopenharmony_ci * @tc.desc: Test functions to ClaimInterface 3169762338dSopenharmony_ci * @tc.desc: int32_t ClaimInterface(const UsbDev &dev, uint8_t interfaceId); 3179762338dSopenharmony_ci * @tc.desc: Positive test: parameters correctly 3189762338dSopenharmony_ci * @tc.type: FUNC 3199762338dSopenharmony_ci */ 3209762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Func_0700, Function | MediumTest | Level1) 3219762338dSopenharmony_ci{ 3229762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 3239762338dSopenharmony_ci struct UsbDev dev = dev_; 3249762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 3259762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Func_0700 %{public}d ClaimInterface=%{public}d", __LINE__, ret); 3269762338dSopenharmony_ci ASSERT_EQ(0, ret); 3279762338dSopenharmony_ci} 3289762338dSopenharmony_ci 3299762338dSopenharmony_ci/** 3309762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_3300 3319762338dSopenharmony_ci * @tc.desc: Test functions to ClaimInterface 3329762338dSopenharmony_ci * @tc.desc: int32_t ClaimInterface(const UsbDev &dev, uint8_t interfaceId); 3339762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum error 3349762338dSopenharmony_ci * @tc.type: FUNC 3359762338dSopenharmony_ci */ 3369762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_3300, Function | MediumTest | Level1) 3379762338dSopenharmony_ci{ 3389762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 3399762338dSopenharmony_ci struct UsbDev dev = dev_; 3409762338dSopenharmony_ci dev.busNum = BUS_NUM_INVALID; 3419762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 3429762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_3300 %{public}d ret=%{public}d", __LINE__, ret); 3439762338dSopenharmony_ci ASSERT_NE(ret, 0); 3449762338dSopenharmony_ci} 3459762338dSopenharmony_ci 3469762338dSopenharmony_ci/** 3479762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_3400 3489762338dSopenharmony_ci * @tc.desc: Test functions to ClaimInterface 3499762338dSopenharmony_ci * @tc.desc: int32_t ClaimInterface(const UsbDev &dev, uint8_t interfaceId); 3509762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, devAddr error 3519762338dSopenharmony_ci * @tc.type: FUNC 3529762338dSopenharmony_ci */ 3539762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_3400, Function | MediumTest | Level1) 3549762338dSopenharmony_ci{ 3559762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 3569762338dSopenharmony_ci struct UsbDev dev = { dev_.busNum, DEV_ADDR_INVALID }; 3579762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 3589762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_3400 %{public}d ret=%{public}d", __LINE__, ret); 3599762338dSopenharmony_ci ASSERT_NE(ret, 0); 3609762338dSopenharmony_ci} 3619762338dSopenharmony_ci 3629762338dSopenharmony_ci/** 3639762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_3500 3649762338dSopenharmony_ci * @tc.desc: Test functions to ClaimInterface 3659762338dSopenharmony_ci * @tc.desc: int32_t ClaimInterface(const UsbDev &dev, uint8_t interfaceId); 3669762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, interfaceId error 3679762338dSopenharmony_ci * @tc.type: FUNC 3689762338dSopenharmony_ci */ 3699762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_3500, Function | MediumTest | Level1) 3709762338dSopenharmony_ci{ 3719762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 3729762338dSopenharmony_ci struct UsbDev dev = dev_; 3739762338dSopenharmony_ci interfaceId = INTERFACEID_INVALID; 3749762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 3759762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_3500 %{public}d ret=%{public}d", __LINE__, ret); 3769762338dSopenharmony_ci ASSERT_NE(ret, 0); 3779762338dSopenharmony_ci} 3789762338dSopenharmony_ci 3799762338dSopenharmony_ci/** 3809762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_3600 3819762338dSopenharmony_ci * @tc.desc: Test functions to ClaimInterface 3829762338dSopenharmony_ci * @tc.desc: int32_t ClaimInterface(const UsbDev &dev, uint8_t interfaceId); 3839762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum && devAddr error 3849762338dSopenharmony_ci * @tc.type: FUNC 3859762338dSopenharmony_ci */ 3869762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_3600, Function | MediumTest | Level1) 3879762338dSopenharmony_ci{ 3889762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 3899762338dSopenharmony_ci struct UsbDev dev = { BUS_NUM_INVALID, DEV_ADDR_INVALID }; 3909762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 3919762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_3600 %{public}d ret=%{public}d", __LINE__, ret); 3929762338dSopenharmony_ci ASSERT_NE(ret, 0); 3939762338dSopenharmony_ci} 3949762338dSopenharmony_ci 3959762338dSopenharmony_ci/** 3969762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_3700 3979762338dSopenharmony_ci * @tc.desc: Test functions to ClaimInterface 3989762338dSopenharmony_ci * @tc.desc: int32_t ClaimInterface(const UsbDev &dev, uint8_t interfaceId); 3999762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum && interfaceId error 4009762338dSopenharmony_ci * @tc.type: FUNC 4019762338dSopenharmony_ci */ 4029762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_3700, Function | MediumTest | Level1) 4039762338dSopenharmony_ci{ 4049762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_INVALID; 4059762338dSopenharmony_ci struct UsbDev dev = { BUS_NUM_INVALID, dev_.devAddr }; 4069762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 4079762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_3700 %{public}d ret=%{public}d", __LINE__, ret); 4089762338dSopenharmony_ci ASSERT_NE(ret, 0); 4099762338dSopenharmony_ci} 4109762338dSopenharmony_ci 4119762338dSopenharmony_ci/** 4129762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_3800 4139762338dSopenharmony_ci * @tc.desc: Test functions to ClaimInterface 4149762338dSopenharmony_ci * @tc.desc: int32_t ClaimInterface(const UsbDev &dev, uint8_t interfaceId); 4159762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, devAddr && interfaceId error 4169762338dSopenharmony_ci * @tc.type: FUNC 4179762338dSopenharmony_ci */ 4189762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_3800, Function | MediumTest | Level1) 4199762338dSopenharmony_ci{ 4209762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_INVALID; 4219762338dSopenharmony_ci struct UsbDev dev = { dev_.busNum, DEV_ADDR_INVALID }; 4229762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 4239762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_3800 %{public}d ret=%{public}d", __LINE__, ret); 4249762338dSopenharmony_ci ASSERT_NE(ret, 0); 4259762338dSopenharmony_ci} 4269762338dSopenharmony_ci 4279762338dSopenharmony_ci/** 4289762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_3900 4299762338dSopenharmony_ci * @tc.desc: Test functions to ClaimInterface 4309762338dSopenharmony_ci * @tc.desc: int32_t ClaimInterface(const UsbDev &dev, uint8_t interfaceId); 4319762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum && devAddr && interfaceId error 4329762338dSopenharmony_ci * @tc.type: FUNC 4339762338dSopenharmony_ci */ 4349762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_3900, Function | MediumTest | Level1) 4359762338dSopenharmony_ci{ 4369762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_INVALID; 4379762338dSopenharmony_ci struct UsbDev dev = { BUS_NUM_INVALID, DEV_ADDR_INVALID }; 4389762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 4399762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_3900 %{public}d ret=%{public}d", __LINE__, ret); 4409762338dSopenharmony_ci ASSERT_NE(ret, 0); 4419762338dSopenharmony_ci} 4429762338dSopenharmony_ci 4439762338dSopenharmony_ci/**********************************************************************************************************/ 4449762338dSopenharmony_ci 4459762338dSopenharmony_ci/** 4469762338dSopenharmony_ci * @tc.name: SUB_USB_DeviceManager_HDI_Func_0100 4479762338dSopenharmony_ci * @tc.desc: Test functions to GetDeviceDescriptor 4489762338dSopenharmony_ci * @tc.desc: int32_t GetDeviceDescriptor(const UsbDev &dev, std::vector<uint8_t> &descriptor); 4499762338dSopenharmony_ci * @tc.desc: Positive test: parameters correctly 4509762338dSopenharmony_ci * @tc.type: FUNC 4519762338dSopenharmony_ci */ 4529762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_DeviceManager_HDI_Func_0100, Function | MediumTest | Level1) 4539762338dSopenharmony_ci{ 4549762338dSopenharmony_ci struct UsbDev dev = dev_; 4559762338dSopenharmony_ci std::vector<uint8_t> devData(MAX_BUFFER_LENGTH); 4569762338dSopenharmony_ci auto ret = g_usbInterface->GetDeviceDescriptor(dev, devData); 4579762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_DeviceManager_HDI_Func_0100 " 4589762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", devData.size(), sizeof(devData), ret); 4599762338dSopenharmony_ci ASSERT_EQ(0, ret); 4609762338dSopenharmony_ci} 4619762338dSopenharmony_ci 4629762338dSopenharmony_ci/** 4639762338dSopenharmony_ci * @tc.name: SUB_USB_DeviceManager_HDI_Compatibility_0100 4649762338dSopenharmony_ci * @tc.desc: Test functions to GetDeviceDescriptor 4659762338dSopenharmony_ci * @tc.desc: int32_t GetDeviceDescriptor(const UsbDev &dev, std::vector<uint8_t> &descriptor); 4669762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum error 4679762338dSopenharmony_ci * @tc.type: FUNC 4689762338dSopenharmony_ci */ 4699762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_DeviceManager_HDI_Compatibility_0100, Function | MediumTest | Level1) 4709762338dSopenharmony_ci{ 4719762338dSopenharmony_ci struct UsbDev dev = { BUS_NUM_INVALID, dev_.devAddr }; 4729762338dSopenharmony_ci std::vector<uint8_t> devData(MAX_BUFFER_LENGTH); 4739762338dSopenharmony_ci auto ret = g_usbInterface->GetDeviceDescriptor(dev, devData); 4749762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_DeviceManager_HDI_Compatibility_0100 " 4759762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", devData.size(), sizeof(devData), ret); 4769762338dSopenharmony_ci ASSERT_NE(ret, 0); 4779762338dSopenharmony_ci} 4789762338dSopenharmony_ci 4799762338dSopenharmony_ci/** 4809762338dSopenharmony_ci * @tc.name: SUB_USB_DeviceManager_HDI_Compatibility_0200 4819762338dSopenharmony_ci * @tc.desc: Test functions to GetDeviceDescriptor 4829762338dSopenharmony_ci * @tc.desc: int32_t GetDeviceDescriptor(const UsbDev &dev, std::vector<uint8_t> &descriptor); 4839762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, devAddr error 4849762338dSopenharmony_ci * @tc.type: FUNC 4859762338dSopenharmony_ci */ 4869762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_DeviceManager_HDI_Compatibility_0200, Function | MediumTest | Level1) 4879762338dSopenharmony_ci{ 4889762338dSopenharmony_ci uint8_t devAddr = DEV_ADDR_INVALID; 4899762338dSopenharmony_ci struct UsbDev dev = { dev_.busNum, devAddr }; 4909762338dSopenharmony_ci std::vector<uint8_t> devData(MAX_BUFFER_LENGTH); 4919762338dSopenharmony_ci auto ret = g_usbInterface->GetDeviceDescriptor(dev, devData); 4929762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_DeviceManager_HDI_Compatibility_0200 " 4939762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", devData.size(), sizeof(devData), ret); 4949762338dSopenharmony_ci ASSERT_NE(ret, 0); 4959762338dSopenharmony_ci} 4969762338dSopenharmony_ci 4979762338dSopenharmony_ci/** 4989762338dSopenharmony_ci * @tc.name: SUB_USB_DeviceManager_HDI_Compatibility_0300 4999762338dSopenharmony_ci * @tc.desc: Test functions to GetDeviceDescriptor 5009762338dSopenharmony_ci * @tc.desc: int32_t GetDeviceDescriptor(const UsbDev &dev, std::vector<uint8_t> &descriptor); 5019762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, length error 5029762338dSopenharmony_ci * @tc.type: FUNC 5039762338dSopenharmony_ci */ 5049762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_DeviceManager_HDI_Compatibility_0300, Function | MediumTest | Level1) 5059762338dSopenharmony_ci{ 5069762338dSopenharmony_ci struct UsbDev dev = dev_; 5079762338dSopenharmony_ci std::vector<uint8_t> devData(MAX_BUFFER_LENGTH); 5089762338dSopenharmony_ci auto ret = g_usbInterface->GetDeviceDescriptor(dev, devData); 5099762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_DeviceManager_HDI_Compatibility_0300 " 5109762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", devData.size(), sizeof(devData), ret); 5119762338dSopenharmony_ci ASSERT_EQ(0, ret); 5129762338dSopenharmony_ci} 5139762338dSopenharmony_ci 5149762338dSopenharmony_ci/** 5159762338dSopenharmony_ci * @tc.name: SUB_USB_DeviceManager_HDI_Compatibility_0400 5169762338dSopenharmony_ci * @tc.desc: Test functions to GetDeviceDescriptor 5179762338dSopenharmony_ci * @tc.desc: int32_t GetDeviceDescriptor(const UsbDev &dev, std::vector<uint8_t> &descriptor); 5189762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum && devAddr error 5199762338dSopenharmony_ci * @tc.type: FUNC 5209762338dSopenharmony_ci */ 5219762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_DeviceManager_HDI_Compatibility_0400, Function | MediumTest | Level1) 5229762338dSopenharmony_ci{ 5239762338dSopenharmony_ci uint8_t busNum = BUS_NUM_INVALID; 5249762338dSopenharmony_ci uint8_t devAddr = DEV_ADDR_INVALID; 5259762338dSopenharmony_ci struct UsbDev dev = { busNum, devAddr }; 5269762338dSopenharmony_ci std::vector<uint8_t> devData(MAX_BUFFER_LENGTH); 5279762338dSopenharmony_ci auto ret = g_usbInterface->GetDeviceDescriptor(dev, devData); 5289762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_DeviceManager_HDI_Compatibility_0400 " 5299762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", devData.size(), sizeof(devData), ret); 5309762338dSopenharmony_ci ASSERT_NE(ret, 0); 5319762338dSopenharmony_ci} 5329762338dSopenharmony_ci 5339762338dSopenharmony_ci/** 5349762338dSopenharmony_ci * @tc.name: SUB_USB_DeviceManager_HDI_Compatibility_0500 5359762338dSopenharmony_ci * @tc.desc: Test functions to GetDeviceDescriptor 5369762338dSopenharmony_ci * @tc.desc: int32_t GetDeviceDescriptor(const UsbDev &dev, std::vector<uint8_t> &descriptor); 5379762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum && length error 5389762338dSopenharmony_ci * @tc.type: FUNC 5399762338dSopenharmony_ci */ 5409762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_DeviceManager_HDI_Compatibility_0500, Function | MediumTest | Level1) 5419762338dSopenharmony_ci{ 5429762338dSopenharmony_ci struct UsbDev dev = { BUS_NUM_INVALID, dev_.devAddr }; 5439762338dSopenharmony_ci std::vector<uint8_t> devData(MAX_BUFFER_LENGTH); 5449762338dSopenharmony_ci auto ret = g_usbInterface->GetDeviceDescriptor(dev, devData); 5459762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_DeviceManager_HDI_Compatibility_0500 " 5469762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", devData.size(), sizeof(devData), ret); 5479762338dSopenharmony_ci ASSERT_NE(ret, 0); 5489762338dSopenharmony_ci} 5499762338dSopenharmony_ci 5509762338dSopenharmony_ci/** 5519762338dSopenharmony_ci * @tc.name: SUB_USB_DeviceManager_HDI_Compatibility_0600 5529762338dSopenharmony_ci * @tc.desc: Test functions to GetDeviceDescriptor 5539762338dSopenharmony_ci * @tc.desc: int32_t GetDeviceDescriptor(const UsbDev &dev, std::vector<uint8_t> &descriptor); 5549762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, devAddr && length error 5559762338dSopenharmony_ci * @tc.type: FUNC 5569762338dSopenharmony_ci */ 5579762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_DeviceManager_HDI_Compatibility_0600, Function | MediumTest | Level1) 5589762338dSopenharmony_ci{ 5599762338dSopenharmony_ci struct UsbDev dev = { dev_.busNum, DEV_ADDR_INVALID }; 5609762338dSopenharmony_ci std::vector<uint8_t> devData(MAX_BUFFER_LENGTH); 5619762338dSopenharmony_ci auto ret = g_usbInterface->GetDeviceDescriptor(dev, devData); 5629762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_DeviceManager_HDI_Compatibility_0600 " 5639762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", devData.size(), sizeof(devData), ret); 5649762338dSopenharmony_ci ASSERT_NE(ret, 0); 5659762338dSopenharmony_ci} 5669762338dSopenharmony_ci 5679762338dSopenharmony_ci/** 5689762338dSopenharmony_ci * @tc.name: SUB_USB_DeviceManager_HDI_Compatibility_0700 5699762338dSopenharmony_ci * @tc.desc: Test functions to GetDeviceDescriptor 5709762338dSopenharmony_ci * @tc.desc: int32_t GetDeviceDescriptor(const UsbDev &dev, std::vector<uint8_t> &descriptor); 5719762338dSopenharmony_ci * @tc.desc: Reverse test: busNum、devAddr、length error 5729762338dSopenharmony_ci * @tc.type: FUNC 5739762338dSopenharmony_ci */ 5749762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_DeviceManager_HDI_Compatibility_0700, Function | MediumTest | Level1) 5759762338dSopenharmony_ci{ 5769762338dSopenharmony_ci uint8_t busNum = BUS_NUM_INVALID; 5779762338dSopenharmony_ci uint8_t devAddr = DEV_ADDR_INVALID; 5789762338dSopenharmony_ci struct UsbDev dev = { busNum, devAddr }; 5799762338dSopenharmony_ci std::vector<uint8_t> devData(MAX_BUFFER_LENGTH); 5809762338dSopenharmony_ci auto ret = g_usbInterface->GetDeviceDescriptor(dev, devData); 5819762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_DeviceManager_HDI_Compatibility_0700 " 5829762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", devData.size(), sizeof(devData), ret); 5839762338dSopenharmony_ci ASSERT_NE(ret, 0); 5849762338dSopenharmony_ci} 5859762338dSopenharmony_ci 5869762338dSopenharmony_ci/**********************************************************************************************************/ 5879762338dSopenharmony_ci 5889762338dSopenharmony_ci/** 5899762338dSopenharmony_ci * @tc.name: SUB_USB_DeviceManager_HDI_Func_0200 5909762338dSopenharmony_ci * @tc.desc: Test functions to GetStringDescriptor 5919762338dSopenharmony_ci * @tc.desc: int32_t GetStringDescriptor(const UsbDev &dev, uint8_t descId, std::vector<uint8_t> &descriptor); 5929762338dSopenharmony_ci * @tc.desc: Positive test: parameters correctly 5939762338dSopenharmony_ci * @tc.type: FUNC 5949762338dSopenharmony_ci */ 5959762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_DeviceManager_HDI_Func_0200, Function | MediumTest | Level1) 5969762338dSopenharmony_ci{ 5979762338dSopenharmony_ci uint8_t stringId = 0; 5989762338dSopenharmony_ci struct UsbDev dev = dev_; 5999762338dSopenharmony_ci std::vector<uint8_t> devData(MAX_BUFFER_LENGTH); 6009762338dSopenharmony_ci auto ret = g_usbInterface->GetStringDescriptor(dev, stringId, devData); 6019762338dSopenharmony_ci HDF_LOGI( 6029762338dSopenharmony_ci "UsbdRequestTest::SUB_USB_DeviceManager_HDI_Func_0200 length=%{public}zu buffer=%{public}zu ret=%{public}d", 6039762338dSopenharmony_ci devData.size(), sizeof(devData), ret); 6049762338dSopenharmony_ci ASSERT_EQ(0, ret); 6059762338dSopenharmony_ci} 6069762338dSopenharmony_ci 6079762338dSopenharmony_ci/** 6089762338dSopenharmony_ci * @tc.name: SUB_USB_DeviceManager_HDI_Compatibility_0800 6099762338dSopenharmony_ci * @tc.desc: Test functions to GetStringDescriptor 6109762338dSopenharmony_ci * @tc.desc: int32_t GetStringDescriptor(const UsbDev &dev, uint8_t descId, std::vector<uint8_t> &descriptor); 6119762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum error 6129762338dSopenharmony_ci * @tc.type: FUNC 6139762338dSopenharmony_ci */ 6149762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_DeviceManager_HDI_Compatibility_0800, Function | MediumTest | Level1) 6159762338dSopenharmony_ci{ 6169762338dSopenharmony_ci uint8_t stringId = 1; 6179762338dSopenharmony_ci struct UsbDev dev = dev_; 6189762338dSopenharmony_ci std::vector<uint8_t> devData(MAX_BUFFER_LENGTH); 6199762338dSopenharmony_ci auto ret = g_usbInterface->GetStringDescriptor(dev, stringId, devData); 6209762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_DeviceManager_HDI_Compatibility_0800 " 6219762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", devData.size(), sizeof(devData), ret); 6229762338dSopenharmony_ci ASSERT_EQ(0, ret); 6239762338dSopenharmony_ci} 6249762338dSopenharmony_ci 6259762338dSopenharmony_ci/** 6269762338dSopenharmony_ci * @tc.name: SUB_USB_DeviceManager_HDI_Compatibility_0900 6279762338dSopenharmony_ci * @tc.desc: Test functions to GetStringDescriptor 6289762338dSopenharmony_ci * @tc.desc: int32_t GetStringDescriptor(const UsbDev &dev, uint8_t descId, std::vector<uint8_t> &descriptor); 6299762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, stringId error 6309762338dSopenharmony_ci * @tc.type: FUNC 6319762338dSopenharmony_ci */ 6329762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_DeviceManager_HDI_Compatibility_0900, Function | MediumTest | Level1) 6339762338dSopenharmony_ci{ 6349762338dSopenharmony_ci uint8_t stringId = INVALID_NUM; 6359762338dSopenharmony_ci struct UsbDev dev = dev_; 6369762338dSopenharmony_ci std::vector<uint8_t> devData(MAX_BUFFER_LENGTH); 6379762338dSopenharmony_ci auto ret = g_usbInterface->GetStringDescriptor(dev, stringId, devData); 6389762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_DeviceManager_HDI_Compatibility_0900 " 6399762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", devData.size(), sizeof(devData), ret); 6409762338dSopenharmony_ci ASSERT_EQ(0, ret); 6419762338dSopenharmony_ci} 6429762338dSopenharmony_ci 6439762338dSopenharmony_ci/** 6449762338dSopenharmony_ci * @tc.name: SUB_USB_DeviceManager_HDI_Compatibility_1000 6459762338dSopenharmony_ci * @tc.desc: Test functions to GetStringDescriptor 6469762338dSopenharmony_ci * @tc.desc: int32_t GetStringDescriptor(const UsbDev &dev, uint8_t descId, std::vector<uint8_t> &descriptor); 6479762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, devAddr error 6489762338dSopenharmony_ci * @tc.type: FUNC 6499762338dSopenharmony_ci */ 6509762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_DeviceManager_HDI_Compatibility_1000, Function | MediumTest | Level1) 6519762338dSopenharmony_ci{ 6529762338dSopenharmony_ci uint8_t stringId = 0; 6539762338dSopenharmony_ci struct UsbDev dev = { dev_.busNum, DEV_ADDR_INVALID }; 6549762338dSopenharmony_ci std::vector<uint8_t> devData(MAX_BUFFER_LENGTH); 6559762338dSopenharmony_ci auto ret = g_usbInterface->GetStringDescriptor(dev, stringId, devData); 6569762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_DeviceManager_HDI_Compatibility_1000 " 6579762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", devData.size(), sizeof(devData), ret); 6589762338dSopenharmony_ci ASSERT_NE(ret, 0); 6599762338dSopenharmony_ci} 6609762338dSopenharmony_ci 6619762338dSopenharmony_ci/** 6629762338dSopenharmony_ci * @tc.name: SUB_USB_DeviceManager_HDI_Compatibility_1100 6639762338dSopenharmony_ci * @tc.desc: Test functions to GetStringDescriptor 6649762338dSopenharmony_ci * @tc.desc: int32_t GetStringDescriptor(const UsbDev &dev, uint8_t descId, std::vector<uint8_t> &descriptor); 6659762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum && devAddr error 6669762338dSopenharmony_ci * @tc.type: FUNC 6679762338dSopenharmony_ci */ 6689762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_DeviceManager_HDI_Compatibility_1100, Function | MediumTest | Level1) 6699762338dSopenharmony_ci{ 6709762338dSopenharmony_ci uint8_t stringId = 0; 6719762338dSopenharmony_ci struct UsbDev dev = { BUS_NUM_INVALID, DEV_ADDR_INVALID }; 6729762338dSopenharmony_ci std::vector<uint8_t> devData(MAX_BUFFER_LENGTH); 6739762338dSopenharmony_ci auto ret = g_usbInterface->GetStringDescriptor(dev, stringId, devData); 6749762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_DeviceManager_HDI_Compatibility_1100 " 6759762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", devData.size(), sizeof(devData), ret); 6769762338dSopenharmony_ci ASSERT_NE(ret, 0); 6779762338dSopenharmony_ci} 6789762338dSopenharmony_ci 6799762338dSopenharmony_ci/** 6809762338dSopenharmony_ci * @tc.name: SUB_USB_DeviceManager_HDI_Compatibility_1200 6819762338dSopenharmony_ci * @tc.desc: Test functions to GetStringDescriptor 6829762338dSopenharmony_ci * @tc.desc: int32_t GetStringDescriptor(const UsbDev &dev, uint8_t descId, std::vector<uint8_t> &descriptor); 6839762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum error 6849762338dSopenharmony_ci * @tc.type: FUNC 6859762338dSopenharmony_ci */ 6869762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_DeviceManager_HDI_Compatibility_1200, Function | MediumTest | Level1) 6879762338dSopenharmony_ci{ 6889762338dSopenharmony_ci uint8_t stringId = 0; 6899762338dSopenharmony_ci struct UsbDev dev = { BUS_NUM_INVALID, dev_.devAddr }; 6909762338dSopenharmony_ci std::vector<uint8_t> devData(MAX_BUFFER_LENGTH); 6919762338dSopenharmony_ci auto ret = g_usbInterface->GetStringDescriptor(dev, stringId, devData); 6929762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_DeviceManager_HDI_Compatibility_1200 " 6939762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", devData.size(), sizeof(devData), ret); 6949762338dSopenharmony_ci ASSERT_NE(ret, 0); 6959762338dSopenharmony_ci} 6969762338dSopenharmony_ci 6979762338dSopenharmony_ci/** 6989762338dSopenharmony_ci * @tc.name: SUB_USB_DeviceManager_HDI_Compatibility_1300 6999762338dSopenharmony_ci * @tc.desc: Test functions to GetStringDescriptor 7009762338dSopenharmony_ci * @tc.desc: int32_t GetStringDescriptor(const UsbDev &dev, uint8_t descId, std::vector<uint8_t> &descriptor); 7019762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, devAddr && stringID error 7029762338dSopenharmony_ci * @tc.type: FUNC 7039762338dSopenharmony_ci */ 7049762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_DeviceManager_HDI_Compatibility_1300, Function | MediumTest | Level1) 7059762338dSopenharmony_ci{ 7069762338dSopenharmony_ci uint8_t stringId = STRING_ID_INVALID; 7079762338dSopenharmony_ci struct UsbDev dev = { dev_.busNum, DEV_ADDR_INVALID }; 7089762338dSopenharmony_ci std::vector<uint8_t> devData(MAX_BUFFER_LENGTH); 7099762338dSopenharmony_ci auto ret = g_usbInterface->GetStringDescriptor(dev, stringId, devData); 7109762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_DeviceManager_HDI_Compatibility_1300 " 7119762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", devData.size(), sizeof(devData), ret); 7129762338dSopenharmony_ci ASSERT_NE(ret, 0); 7139762338dSopenharmony_ci} 7149762338dSopenharmony_ci 7159762338dSopenharmony_ci/** 7169762338dSopenharmony_ci * @tc.name: SUB_USB_DeviceManager_HDI_Compatibility_1400 7179762338dSopenharmony_ci * @tc.desc: Test functions to GetStringDescriptor 7189762338dSopenharmony_ci * @tc.desc: int32_t GetStringDescriptor(const UsbDev &dev, uint8_t descId, std::vector<uint8_t> &descriptor); 7199762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum && devAddr && stringID error 7209762338dSopenharmony_ci * @tc.type: FUNC 7219762338dSopenharmony_ci */ 7229762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_DeviceManager_HDI_Compatibility_1400, Function | MediumTest | Level1) 7239762338dSopenharmony_ci{ 7249762338dSopenharmony_ci uint8_t stringId = STRING_ID_INVALID; 7259762338dSopenharmony_ci struct UsbDev dev = { BUS_NUM_INVALID, DEV_ADDR_INVALID }; 7269762338dSopenharmony_ci std::vector<uint8_t> devData(MAX_BUFFER_LENGTH); 7279762338dSopenharmony_ci auto ret = g_usbInterface->GetStringDescriptor(dev, stringId, devData); 7289762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_DeviceManager_HDI_Compatibility_1400 " 7299762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", devData.size(), sizeof(devData), ret); 7309762338dSopenharmony_ci ASSERT_NE(ret, 0); 7319762338dSopenharmony_ci} 7329762338dSopenharmony_ci 7339762338dSopenharmony_ci/**********************************************************************************************************/ 7349762338dSopenharmony_ci 7359762338dSopenharmony_ci/** 7369762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Func_0400 7379762338dSopenharmony_ci * @tc.desc: Test functions to GetConfigDescriptor 7389762338dSopenharmony_ci * @tc.desc: int32_t GetConfigDescriptor(const UsbDev &dev, uint8_t descId, std::vector<uint8_t> &descriptor); 7399762338dSopenharmony_ci * @tc.desc: Positive test: parameters correctly 7409762338dSopenharmony_ci * @tc.type: FUNC 7419762338dSopenharmony_ci */ 7429762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Func_0400, Function | MediumTest | Level1) 7439762338dSopenharmony_ci{ 7449762338dSopenharmony_ci uint8_t configId = CONFIG_ID_0; 7459762338dSopenharmony_ci struct UsbDev dev = dev_; 7469762338dSopenharmony_ci std::vector<uint8_t> devData(MAX_BUFFER_LENGTH); 7479762338dSopenharmony_ci auto ret = g_usbInterface->GetConfigDescriptor(dev, configId, devData); 7489762338dSopenharmony_ci HDF_LOGI( 7499762338dSopenharmony_ci "UsbdRequestTest::SUB_USB_HostManager_HDI_Func_0400 length=%{public}zu buffer=%{public}zu ret=%{public}d", 7509762338dSopenharmony_ci devData.size(), sizeof(devData), ret); 7519762338dSopenharmony_ci ASSERT_EQ(0, ret); 7529762338dSopenharmony_ci} 7539762338dSopenharmony_ci 7549762338dSopenharmony_ci/** 7559762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_1400 7569762338dSopenharmony_ci * @tc.desc: Test functions to GetConfigDescriptor 7579762338dSopenharmony_ci * @tc.desc: int32_t GetConfigDescriptor(const UsbDev &dev, uint8_t descId, std::vector<uint8_t> &descriptor); 7589762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum error 7599762338dSopenharmony_ci * @tc.type: FUNC 7609762338dSopenharmony_ci */ 7619762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_1400, Function | MediumTest | Level1) 7629762338dSopenharmony_ci{ 7639762338dSopenharmony_ci uint8_t configId = CONFIG_ID_0; 7649762338dSopenharmony_ci struct UsbDev dev = { BUS_NUM_INVALID, dev_.devAddr }; 7659762338dSopenharmony_ci std::vector<uint8_t> devData(MAX_BUFFER_LENGTH); 7669762338dSopenharmony_ci auto ret = g_usbInterface->GetConfigDescriptor(dev, configId, devData); 7679762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_1400 " 7689762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", devData.size(), sizeof(devData), ret); 7699762338dSopenharmony_ci ASSERT_NE(ret, 0); 7709762338dSopenharmony_ci} 7719762338dSopenharmony_ci 7729762338dSopenharmony_ci/** 7739762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_1500 7749762338dSopenharmony_ci * @tc.desc: Test functions to GetConfigDescriptor 7759762338dSopenharmony_ci * @tc.desc: int32_t GetConfigDescriptor(const UsbDev &dev, uint8_t descId, std::vector<uint8_t> &descriptor); 7769762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, devAddr error 7779762338dSopenharmony_ci * @tc.type: FUNC 7789762338dSopenharmony_ci */ 7799762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_1500, Function | MediumTest | Level1) 7809762338dSopenharmony_ci{ 7819762338dSopenharmony_ci uint8_t configId = CONFIG_ID_0; 7829762338dSopenharmony_ci struct UsbDev dev = { dev_.busNum, DEV_ADDR_INVALID }; 7839762338dSopenharmony_ci std::vector<uint8_t> devData(MAX_BUFFER_LENGTH); 7849762338dSopenharmony_ci auto ret = g_usbInterface->GetConfigDescriptor(dev, configId, devData); 7859762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_1500 " 7869762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", devData.size(), sizeof(devData), ret); 7879762338dSopenharmony_ci ASSERT_NE(ret, 0); 7889762338dSopenharmony_ci} 7899762338dSopenharmony_ci 7909762338dSopenharmony_ci/** 7919762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_1600 7929762338dSopenharmony_ci * @tc.desc: Test functions to GetConfigDescriptor 7939762338dSopenharmony_ci * @tc.desc: int32_t GetConfigDescriptor(const UsbDev &dev, uint8_t descId, std::vector<uint8_t> &descriptor); 7949762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, configId error 7959762338dSopenharmony_ci * @tc.type: FUNC 7969762338dSopenharmony_ci */ 7979762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_1600, Function | MediumTest | Level1) 7989762338dSopenharmony_ci{ 7999762338dSopenharmony_ci uint8_t configId = CONFIG_ID_0; 8009762338dSopenharmony_ci struct UsbDev dev = dev_; 8019762338dSopenharmony_ci std::vector<uint8_t> devData(MAX_BUFFER_LENGTH); 8029762338dSopenharmony_ci auto ret = g_usbInterface->GetConfigDescriptor(dev, configId, devData); 8039762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_1600 " 8049762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", devData.size(), sizeof(devData), ret); 8059762338dSopenharmony_ci ASSERT_EQ(0, ret); 8069762338dSopenharmony_ci} 8079762338dSopenharmony_ci 8089762338dSopenharmony_ci/** 8099762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_1700 8109762338dSopenharmony_ci * @tc.desc: Test functions to GetConfigDescriptor 8119762338dSopenharmony_ci * @tc.desc: int32_t GetConfigDescriptor(const UsbDev &dev, uint8_t descId, std::vector<uint8_t> &descriptor); 8129762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum && devAddr error 8139762338dSopenharmony_ci * @tc.type: FUNC 8149762338dSopenharmony_ci */ 8159762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_1700, Function | MediumTest | Level1) 8169762338dSopenharmony_ci{ 8179762338dSopenharmony_ci uint8_t configId = CONFIG_ID_0; 8189762338dSopenharmony_ci struct UsbDev dev = { BUS_NUM_INVALID, DEV_ADDR_INVALID }; 8199762338dSopenharmony_ci std::vector<uint8_t> devData(MAX_BUFFER_LENGTH); 8209762338dSopenharmony_ci auto ret = g_usbInterface->GetConfigDescriptor(dev, configId, devData); 8219762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_1700 " 8229762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", devData.size(), sizeof(devData), ret); 8239762338dSopenharmony_ci ASSERT_NE(ret, 0); 8249762338dSopenharmony_ci} 8259762338dSopenharmony_ci 8269762338dSopenharmony_ci/** 8279762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_1800 8289762338dSopenharmony_ci * @tc.desc: Test functions to GetConfigDescriptor 8299762338dSopenharmony_ci * @tc.desc: int32_t GetConfigDescriptor(const UsbDev &dev, uint8_t descId, std::vector<uint8_t> &descriptor); 8309762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum、configId error 8319762338dSopenharmony_ci * @tc.type: FUNC 8329762338dSopenharmony_ci */ 8339762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_1800, Function | MediumTest | Level1) 8349762338dSopenharmony_ci{ 8359762338dSopenharmony_ci uint8_t configId = CONFIG_ID_INVALID; 8369762338dSopenharmony_ci struct UsbDev dev = { BUS_NUM_INVALID, dev_.devAddr }; 8379762338dSopenharmony_ci std::vector<uint8_t> devData(MAX_BUFFER_LENGTH); 8389762338dSopenharmony_ci auto ret = g_usbInterface->GetConfigDescriptor(dev, configId, devData); 8399762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_1800 " 8409762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", devData.size(), sizeof(devData), ret); 8419762338dSopenharmony_ci ASSERT_NE(ret, 0); 8429762338dSopenharmony_ci} 8439762338dSopenharmony_ci 8449762338dSopenharmony_ci/** 8459762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_1900 8469762338dSopenharmony_ci * @tc.desc: Test functions to GetConfigDescriptor 8479762338dSopenharmony_ci * @tc.desc: int32_t GetConfigDescriptor(const UsbDev &dev, uint8_t descId, std::vector<uint8_t> &descriptor); 8489762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, devAddr && configId error 8499762338dSopenharmony_ci * @tc.type: FUNC 8509762338dSopenharmony_ci */ 8519762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_1900, Function | MediumTest | Level1) 8529762338dSopenharmony_ci{ 8539762338dSopenharmony_ci uint8_t configId = CONFIG_ID_INVALID; 8549762338dSopenharmony_ci struct UsbDev dev = { dev_.busNum, DEV_ADDR_INVALID }; 8559762338dSopenharmony_ci std::vector<uint8_t> devData(MAX_BUFFER_LENGTH); 8569762338dSopenharmony_ci auto ret = g_usbInterface->GetConfigDescriptor(dev, configId, devData); 8579762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_1900 " 8589762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", devData.size(), sizeof(devData), ret); 8599762338dSopenharmony_ci ASSERT_NE(ret, 0); 8609762338dSopenharmony_ci} 8619762338dSopenharmony_ci 8629762338dSopenharmony_ci/** 8639762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_2000 8649762338dSopenharmony_ci * @tc.desc: Test functions to GetConfigDescriptor 8659762338dSopenharmony_ci * @tc.desc: int32_t GetConfigDescriptor(const UsbDev &dev, uint8_t descId, std::vector<uint8_t> &descriptor); 8669762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum && devAddr && configId error 8679762338dSopenharmony_ci * @tc.type: FUNC 8689762338dSopenharmony_ci */ 8699762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_2000, Function | MediumTest | Level1) 8709762338dSopenharmony_ci{ 8719762338dSopenharmony_ci uint8_t configId = CONFIG_ID_INVALID; 8729762338dSopenharmony_ci struct UsbDev dev = { BUS_NUM_INVALID, DEV_ADDR_INVALID }; 8739762338dSopenharmony_ci std::vector<uint8_t> devData(MAX_BUFFER_LENGTH); 8749762338dSopenharmony_ci auto ret = g_usbInterface->GetConfigDescriptor(dev, configId, devData); 8759762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_2000 " 8769762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", devData.size(), sizeof(devData), ret); 8779762338dSopenharmony_ci ASSERT_NE(ret, 0); 8789762338dSopenharmony_ci} 8799762338dSopenharmony_ci 8809762338dSopenharmony_ci/** 8819762338dSopenharmony_ci * @tc.name: SUB_USB_DeviceManager_HDI_Func_1200 8829762338dSopenharmony_ci * @tc.desc: Test functions to GetRawDescriptor 8839762338dSopenharmony_ci * @tc.desc: int32_t GetRawDescriptor(const UsbDev &dev, std::vector<uint8_t> &descriptor); 8849762338dSopenharmony_ci * @tc.desc: Positive test: parameters correctly 8859762338dSopenharmony_ci * @tc.type: FUNC 8869762338dSopenharmony_ci */ 8879762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_DeviceManager_HDI_Func_1200, Function | MediumTest | Level1) 8889762338dSopenharmony_ci{ 8899762338dSopenharmony_ci struct UsbDev dev = dev_; 8909762338dSopenharmony_ci std::vector<uint8_t> rawData; 8919762338dSopenharmony_ci auto ret = g_usbInterface->GetRawDescriptor(dev, rawData); 8929762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_DeviceManager_HDI_Func_1200 " 8939762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", rawData.size(), sizeof(rawData), ret); 8949762338dSopenharmony_ci ASSERT_EQ(0, ret); 8959762338dSopenharmony_ci} 8969762338dSopenharmony_ci 8979762338dSopenharmony_ci/** 8989762338dSopenharmony_ci * @tc.name: SUB_USB_DeviceManager_HDI_Compatibility_1600 8999762338dSopenharmony_ci * @tc.desc: Test functions to GetRawDescriptor 9009762338dSopenharmony_ci * @tc.desc: int32_t GetRawDescriptor(const UsbDev &dev, std::vector<uint8_t> &descriptor); 9019762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum error 9029762338dSopenharmony_ci * @tc.type: FUNC 9039762338dSopenharmony_ci */ 9049762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_DeviceManager_HDI_Compatibility_1600, Function | MediumTest | Level1) 9059762338dSopenharmony_ci{ 9069762338dSopenharmony_ci struct UsbDev dev = { BUS_NUM_INVALID, dev_.devAddr }; 9079762338dSopenharmony_ci std::vector<uint8_t> rawData; 9089762338dSopenharmony_ci auto ret = g_usbInterface->GetRawDescriptor(dev, rawData); 9099762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_DeviceManager_HDI_Compatibility_1600 " 9109762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", rawData.size(), sizeof(rawData), ret); 9119762338dSopenharmony_ci ASSERT_NE(ret, 0); 9129762338dSopenharmony_ci} 9139762338dSopenharmony_ci 9149762338dSopenharmony_ci/** 9159762338dSopenharmony_ci * @tc.name: SUB_USB_DeviceManager_HDI_Compatibility_1700 9169762338dSopenharmony_ci * @tc.desc: Test functions to GetRawDescriptor 9179762338dSopenharmony_ci * @tc.desc: int32_t GetRawDescriptor(const UsbDev &dev, std::vector<uint8_t> &descriptor); 9189762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, devAddr error 9199762338dSopenharmony_ci * @tc.type: FUNC 9209762338dSopenharmony_ci */ 9219762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_DeviceManager_HDI_Compatibility_1700, Function | MediumTest | Level1) 9229762338dSopenharmony_ci{ 9239762338dSopenharmony_ci struct UsbDev dev = { dev_.busNum, DEV_ADDR_INVALID }; 9249762338dSopenharmony_ci std::vector<uint8_t> rawData; 9259762338dSopenharmony_ci auto ret = g_usbInterface->GetRawDescriptor(dev, rawData); 9269762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_DeviceManager_HDI_Compatibility_1700 " 9279762338dSopenharmony_ci "length=%{public}zu buffer=%{public}zu ret=%{public}d", rawData.size(), sizeof(rawData), ret); 9289762338dSopenharmony_ci ASSERT_NE(ret, 0); 9299762338dSopenharmony_ci} 9309762338dSopenharmony_ci 9319762338dSopenharmony_ci/** 9329762338dSopenharmony_ci * @tc.name: SUB_USB_DeviceManager_HDI_Func_1300 9339762338dSopenharmony_ci * @tc.desc: Test functions to GetFileDescriptor 9349762338dSopenharmony_ci * @tc.desc: int32_t GetFileDescriptor(const UsbDev &dev, int32_t &fd); 9359762338dSopenharmony_ci * @tc.desc: Positive test: parameters correctly 9369762338dSopenharmony_ci * @tc.type: FUNC 9379762338dSopenharmony_ci */ 9389762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_DeviceManager_HDI_Func_1300, Function | MediumTest | Level1) 9399762338dSopenharmony_ci{ 9409762338dSopenharmony_ci struct UsbDev dev = dev_; 9419762338dSopenharmony_ci int32_t fd = 0; 9429762338dSopenharmony_ci auto ret = g_usbInterface->GetFileDescriptor(dev, fd); 9439762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_DeviceManager_HDI_Func_1300 %{public}d fd=%{public}d ret=%{public}d", 9449762338dSopenharmony_ci __LINE__, fd, ret); 9459762338dSopenharmony_ci ASSERT_EQ(0, ret); 9469762338dSopenharmony_ci} 9479762338dSopenharmony_ci 9489762338dSopenharmony_ci/** 9499762338dSopenharmony_ci * @tc.name: SUB_USB_DeviceManager_HDI_Compatibility_1800 9509762338dSopenharmony_ci * @tc.desc: Test functions to GetFileDescriptor 9519762338dSopenharmony_ci * @tc.desc: int32_t GetFileDescriptor(const UsbDev &dev, int32_t &fd); 9529762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum error 9539762338dSopenharmony_ci * @tc.type: FUNC 9549762338dSopenharmony_ci */ 9559762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_DeviceManager_HDI_Compatibility_1800, Function | MediumTest | Level1) 9569762338dSopenharmony_ci{ 9579762338dSopenharmony_ci struct UsbDev dev = { BUS_NUM_INVALID, dev_.devAddr }; 9589762338dSopenharmony_ci int32_t fd = 0; 9599762338dSopenharmony_ci auto ret = g_usbInterface->GetFileDescriptor(dev, fd); 9609762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_DeviceManager_HDI_Compatibility_1800 %{public}d fd=%{public}d ret=%{public}d", 9619762338dSopenharmony_ci __LINE__, fd, ret); 9629762338dSopenharmony_ci ASSERT_NE(ret, 0); 9639762338dSopenharmony_ci} 9649762338dSopenharmony_ci 9659762338dSopenharmony_ci/** 9669762338dSopenharmony_ci * @tc.name: SUB_USB_DeviceManager_HDI_Compatibility_1900 9679762338dSopenharmony_ci * @tc.desc: Test functions to GetFileDescriptor 9689762338dSopenharmony_ci * @tc.desc: int32_t GetFileDescriptor(const UsbDev &dev, int32_t &fd); 9699762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, devAddr error 9709762338dSopenharmony_ci * @tc.type: FUNC 9719762338dSopenharmony_ci */ 9729762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_DeviceManager_HDI_Compatibility_1900, Function | MediumTest | Level1) 9739762338dSopenharmony_ci{ 9749762338dSopenharmony_ci struct UsbDev dev = { dev_.busNum, DEV_ADDR_INVALID }; 9759762338dSopenharmony_ci int32_t fd = 0; 9769762338dSopenharmony_ci auto ret = g_usbInterface->GetFileDescriptor(dev, fd); 9779762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_DeviceManager_HDI_Compatibility_1900 %{public}d fd=%{public}d ret=%{public}d", 9789762338dSopenharmony_ci __LINE__, fd, ret); 9799762338dSopenharmony_ci ASSERT_NE(ret, 0); 9809762338dSopenharmony_ci} 9819762338dSopenharmony_ci 9829762338dSopenharmony_ci/** 9839762338dSopenharmony_ci * @tc.name: SUB_USB_DeviceManager_HDI_Compatibility_2000 9849762338dSopenharmony_ci * @tc.desc: Test functions to GetFileDescriptor 9859762338dSopenharmony_ci * @tc.desc: int32_t GetFileDescriptor(const UsbDev &dev, int32_t &fd); 9869762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, fd error 9879762338dSopenharmony_ci * @tc.type: FUNC 9889762338dSopenharmony_ci */ 9899762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_DeviceManager_HDI_Compatibility_2000, Function | MediumTest | Level1) 9909762338dSopenharmony_ci{ 9919762338dSopenharmony_ci struct UsbDev dev = dev_; 9929762338dSopenharmony_ci int32_t fd = MAX_BUFFER_LENGTH; 9939762338dSopenharmony_ci auto ret = g_usbInterface->GetFileDescriptor(dev, fd); 9949762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_DeviceManager_HDI_Compatibility_2000 %{public}d fd=%{public}d ret=%{public}d", 9959762338dSopenharmony_ci __LINE__, fd, ret); 9969762338dSopenharmony_ci ASSERT_EQ(0, ret); 9979762338dSopenharmony_ci} 9989762338dSopenharmony_ci 9999762338dSopenharmony_ci/** 10009762338dSopenharmony_ci * @tc.number : SUB_USB_HostManager_HDI_Func_2100 10019762338dSopenharmony_ci * @tc.name : GetDeviceFileDescriptor001 10029762338dSopenharmony_ci * @tc.desc : int32_t GetDeviceFileDescriptor(const UsbDev &dev, int32_t &fd) 10039762338dSopenharmony_ci * @tc.desc : Positive test: parameters correctly 10049762338dSopenharmony_ci * @tc.size : MediumTest 10059762338dSopenharmony_ci * @tc.type : Function 10069762338dSopenharmony_ci * @tc.level : Level 3 10079762338dSopenharmony_ci */ 10089762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, GetDeviceFileDescriptor001, Function | MediumTest | Level1) 10099762338dSopenharmony_ci{ 10109762338dSopenharmony_ci struct UsbDev dev = dev_; 10119762338dSopenharmony_ci int32_t fd = 0; 10129762338dSopenharmony_ci auto ret = g_usbInterface->GetDeviceFileDescriptor(dev, fd); 10139762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::GetDeviceFileDescriptor001 %{public}d fd=%{public}d ret=%{public}d", __LINE__, fd, ret); 10149762338dSopenharmony_ci ASSERT_EQ(0, ret); 10159762338dSopenharmony_ci} 10169762338dSopenharmony_ci 10179762338dSopenharmony_ci/** 10189762338dSopenharmony_ci * @tc.number : SUB_USB_HostManager_HDI_Compatibility_0110 10199762338dSopenharmony_ci * @tc.name : GetDeviceFileDescriptor002 10209762338dSopenharmony_ci * @tc.desc : int32_t GetDeviceFileDescriptor(const UsbDev &dev, int32_t &fd) 10219762338dSopenharmony_ci * @tc.desc : Negative test: parameters exception, busNum error 10229762338dSopenharmony_ci * @tc.size : MediumTest 10239762338dSopenharmony_ci * @tc.type : Function 10249762338dSopenharmony_ci * @tc.level : Level 3 10259762338dSopenharmony_ci */ 10269762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, GetDeviceFileDescriptor002, Function | MediumTest | Level1) 10279762338dSopenharmony_ci{ 10289762338dSopenharmony_ci struct UsbDev dev = {BUS_NUM_INVALID, dev_.devAddr}; 10299762338dSopenharmony_ci int32_t fd = 0; 10309762338dSopenharmony_ci auto ret = g_usbInterface->GetDeviceFileDescriptor(dev, fd); 10319762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::GetDeviceFileDescriptor002 %{public}d fd=%{public}d ret=%{public}d", __LINE__, fd, ret); 10329762338dSopenharmony_ci ASSERT_NE(ret, 0); 10339762338dSopenharmony_ci} 10349762338dSopenharmony_ci 10359762338dSopenharmony_ci/** 10369762338dSopenharmony_ci * @tc.number : SUB_USB_HostManager_HDI_Compatibility_0120 10379762338dSopenharmony_ci * @tc.name : GetDeviceFileDescriptor003 10389762338dSopenharmony_ci * @tc.desc : int32_t GetDeviceFileDescriptor(const UsbDev &dev, int32_t &fd) 10399762338dSopenharmony_ci * @tc.desc : Negative test: parameters exception, devAddr error 10409762338dSopenharmony_ci * @tc.size : MediumTest 10419762338dSopenharmony_ci * @tc.type : Function 10429762338dSopenharmony_ci * @tc.level : Level 3 10439762338dSopenharmony_ci */ 10449762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, GetDeviceFileDescriptor003, Function | MediumTest | Level1) 10459762338dSopenharmony_ci{ 10469762338dSopenharmony_ci struct UsbDev dev = {dev_.busNum, DEV_ADDR_INVALID}; 10479762338dSopenharmony_ci int32_t fd = 0; 10489762338dSopenharmony_ci auto ret = g_usbInterface->GetDeviceFileDescriptor(dev, fd); 10499762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::GetDeviceFileDescriptor003 %{public}d fd=%{public}d ret=%{public}d", __LINE__, fd, ret); 10509762338dSopenharmony_ci ASSERT_NE(ret, 0); 10519762338dSopenharmony_ci} 10529762338dSopenharmony_ci 10539762338dSopenharmony_ci/** 10549762338dSopenharmony_ci * @tc.number : SUB_USB_HostManager_HDI_Compatibility_0130 10559762338dSopenharmony_ci * @tc.name : GetDeviceFileDescriptor004 10569762338dSopenharmony_ci * @tc.desc : int32_t GetDeviceFileDescriptor(const UsbDev &dev, int32_t &fd) 10579762338dSopenharmony_ci * @tc.desc : Negative test: parameters exception, fd error 10589762338dSopenharmony_ci * @tc.size : MediumTest 10599762338dSopenharmony_ci * @tc.type : Function 10609762338dSopenharmony_ci * @tc.level : Level 3 10619762338dSopenharmony_ci */ 10629762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, GetDeviceFileDescriptor004, Function | MediumTest | Level1) 10639762338dSopenharmony_ci{ 10649762338dSopenharmony_ci struct UsbDev dev = dev_; 10659762338dSopenharmony_ci int32_t fd = MAX_BUFFER_LENGTH; 10669762338dSopenharmony_ci auto ret = g_usbInterface->GetDeviceFileDescriptor(dev, fd); 10679762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::GetDeviceFileDescriptor004 %{public}d fd=%{public}d ret=%{public}d", __LINE__, fd, ret); 10689762338dSopenharmony_ci ASSERT_EQ(0, ret); 10699762338dSopenharmony_ci} 10709762338dSopenharmony_ci 10719762338dSopenharmony_ci/** 10729762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Func_0500 10739762338dSopenharmony_ci * @tc.desc: Test functions to RequestQueue 10749762338dSopenharmony_ci * @tc.desc: int32_t RequestQueue(const UsbDev &dev, const UsbPipe &pipe, std::vector<uint8_t> &clientData, 10759762338dSopenharmony_ci std::vector<uint8_t> &buffer); 10769762338dSopenharmony_ci * @tc.desc: Positive test: parameters correctly 10779762338dSopenharmony_ci * @tc.type: FUNC 10789762338dSopenharmony_ci */ 10799762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Func_0500, Function | MediumTest | Level1) 10809762338dSopenharmony_ci{ 10819762338dSopenharmony_ci struct UsbDev dev = dev_; 10829762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 10839762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_IN; 10849762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 10859762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Func_0500 %{public}d ClaimInterface=%{public}d", __LINE__, ret); 10869762338dSopenharmony_ci ASSERT_EQ(0, ret); 10879762338dSopenharmony_ci struct UsbPipe pipe = { interfaceId, pointId }; 10889762338dSopenharmony_ci std::vector<uint8_t> clientData = {'q', 'u', 'e', 'u', 'e', 'r', 'e', 'a', 'd'}; 10899762338dSopenharmony_ci std::vector<uint8_t> bufferData(MAX_BUFFER_LENGTH); 10909762338dSopenharmony_ci ret = g_usbInterface->RequestQueue(dev, pipe, clientData, bufferData); 10919762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Func_0500 " 10929762338dSopenharmony_ci "interfaceId=%{public}d pointId=%{public}d ret=%{public}d", interfaceId, pointId, ret); 10939762338dSopenharmony_ci ASSERT_EQ(0, ret); 10949762338dSopenharmony_ci} 10959762338dSopenharmony_ci 10969762338dSopenharmony_ci/** 10979762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_2100 10989762338dSopenharmony_ci * @tc.desc: Test functions to RequestQueue 10999762338dSopenharmony_ci * @tc.desc: int32_t RequestQueue(const UsbDev &dev, const UsbPipe &pipe, std::vector<uint8_t> &clientData, 11009762338dSopenharmony_ci std::vector<uint8_t> &buffer); 11019762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum && devAddr error 11029762338dSopenharmony_ci * @tc.type: FUNC 11039762338dSopenharmony_ci */ 11049762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_2100, Function | MediumTest | Level1) 11059762338dSopenharmony_ci{ 11069762338dSopenharmony_ci struct UsbDev dev = dev_; 11079762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_IN; 11089762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 11099762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 11109762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_2100 %{public}d ClaimInterface=%{public}d", 11119762338dSopenharmony_ci __LINE__, ret); 11129762338dSopenharmony_ci ASSERT_EQ(0, ret); 11139762338dSopenharmony_ci dev = { BUS_NUM_INVALID, DEV_ADDR_INVALID }; 11149762338dSopenharmony_ci struct UsbPipe pipe = { interfaceId, pointId }; 11159762338dSopenharmony_ci std::vector<uint8_t> clientData = {'q', 'u', 'e', 'u', 'e', 'r', 'e', 'a', 'd'}; 11169762338dSopenharmony_ci std::vector<uint8_t> bufferData(MAX_BUFFER_LENGTH); 11179762338dSopenharmony_ci ret = g_usbInterface->RequestQueue(dev, pipe, clientData, bufferData); 11189762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_2100 " 11199762338dSopenharmony_ci "interfaceId=%{public}d pointId=%{public}d ret=%{public}d", interfaceId, pointId, ret); 11209762338dSopenharmony_ci ASSERT_NE(ret, 0); 11219762338dSopenharmony_ci} 11229762338dSopenharmony_ci 11239762338dSopenharmony_ci/** 11249762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_2200 11259762338dSopenharmony_ci * @tc.desc: Test functions to RequestQueue 11269762338dSopenharmony_ci * @tc.desc: int32_t RequestQueue(const UsbDev &dev, const UsbPipe &pipe, std::vector<uint8_t> &clientData, 11279762338dSopenharmony_ci std::vector<uint8_t> &buffer); 11289762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, devAddr error 11299762338dSopenharmony_ci * @tc.type: FUNC 11309762338dSopenharmony_ci */ 11319762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_2200, Function | MediumTest | Level1) 11329762338dSopenharmony_ci{ 11339762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_IN; 11349762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 11359762338dSopenharmony_ci struct UsbDev dev = dev_; 11369762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 11379762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_2200 %{public}d ClaimInterface=%{public}d", 11389762338dSopenharmony_ci __LINE__, ret); 11399762338dSopenharmony_ci ASSERT_EQ(0, ret); 11409762338dSopenharmony_ci dev.devAddr = DEV_ADDR_INVALID; 11419762338dSopenharmony_ci struct UsbPipe pipe = { interfaceId, pointId }; 11429762338dSopenharmony_ci std::vector<uint8_t> clientData = {'q', 'u', 'e', 'u', 'e', 'r', 'e', 'a', 'd'}; 11439762338dSopenharmony_ci std::vector<uint8_t> bufferData(MAX_BUFFER_LENGTH); 11449762338dSopenharmony_ci ret = g_usbInterface->RequestQueue(dev, pipe, clientData, bufferData); 11459762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_2200 " 11469762338dSopenharmony_ci "interfaceId=%{public}d pointId=%{public}d ret=%{public}d", interfaceId, pointId, ret); 11479762338dSopenharmony_ci ASSERT_NE(ret, 0); 11489762338dSopenharmony_ci} 11499762338dSopenharmony_ci 11509762338dSopenharmony_ci/** 11519762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_2300 11529762338dSopenharmony_ci * @tc.desc: Test functions to RequestQueue 11539762338dSopenharmony_ci * @tc.desc: int32_t RequestQueue(const UsbDev &dev, const UsbPipe &pipe, std::vector<uint8_t> &clientData, 11549762338dSopenharmony_ci std::vector<uint8_t> &buffer); 11559762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum && configIndex error 11569762338dSopenharmony_ci * @tc.type: FUNC 11579762338dSopenharmony_ci */ 11589762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_2300, Function | MediumTest | Level1) 11599762338dSopenharmony_ci{ 11609762338dSopenharmony_ci struct UsbDev dev = dev_; 11619762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_IN; 11629762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 11639762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 11649762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_2300 %{public}d ClaimInterface=%{public}d", 11659762338dSopenharmony_ci __LINE__, ret); 11669762338dSopenharmony_ci ASSERT_EQ(0, ret); 11679762338dSopenharmony_ci interfaceId = INVALID_NUM; 11689762338dSopenharmony_ci dev.busNum = BUS_NUM_INVALID; 11699762338dSopenharmony_ci struct UsbPipe pipe = { interfaceId, pointId }; 11709762338dSopenharmony_ci std::vector<uint8_t> clientData = {'q', 'u', 'e', 'u', 'e', 'r', 'e', 'a', 'd'}; 11719762338dSopenharmony_ci std::vector<uint8_t> bufferData(MAX_BUFFER_LENGTH); 11729762338dSopenharmony_ci ret = g_usbInterface->RequestQueue(dev, pipe, clientData, bufferData); 11739762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_2300 " 11749762338dSopenharmony_ci "interfaceId=%{public}d pointId=%{public}d ret=%{public}d", interfaceId, pointId, ret); 11759762338dSopenharmony_ci ASSERT_NE(ret, 0); 11769762338dSopenharmony_ci} 11779762338dSopenharmony_ci 11789762338dSopenharmony_ci/** 11799762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_2400 11809762338dSopenharmony_ci * @tc.desc: Test functions to RequestQueue 11819762338dSopenharmony_ci * @tc.desc: int32_t RequestQueue(const UsbDev &dev, const UsbPipe &pipe, std::vector<uint8_t> &clientData, 11829762338dSopenharmony_ci std::vector<uint8_t> &buffer); 11839762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum error 11849762338dSopenharmony_ci * @tc.type: FUNC 11859762338dSopenharmony_ci */ 11869762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_2400, Function | MediumTest | Level1) 11879762338dSopenharmony_ci{ 11889762338dSopenharmony_ci struct UsbDev dev = dev_; 11899762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_IN; 11909762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 11919762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 11929762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_2400 %{public}d ClaimInterface=%{public}d", 11939762338dSopenharmony_ci __LINE__, ret); 11949762338dSopenharmony_ci ASSERT_EQ(0, ret); 11959762338dSopenharmony_ci dev.busNum = BUS_NUM_INVALID; 11969762338dSopenharmony_ci struct UsbPipe pipe = { interfaceId, pointId }; 11979762338dSopenharmony_ci std::vector<uint8_t> clientData = {'q', 'u', 'e', 'u', 'e', 'r', 'e', 'a', 'd'}; 11989762338dSopenharmony_ci std::vector<uint8_t> bufferData(MAX_BUFFER_LENGTH); 11999762338dSopenharmony_ci ret = g_usbInterface->RequestQueue(dev, pipe, clientData, bufferData); 12009762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_2400 %{public}d RequestQueue=%{public}d", 12019762338dSopenharmony_ci __LINE__, ret); 12029762338dSopenharmony_ci ASSERT_NE(ret, 0); 12039762338dSopenharmony_ci} 12049762338dSopenharmony_ci 12059762338dSopenharmony_ci/** 12069762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_2500 12079762338dSopenharmony_ci * @tc.desc: Test functions to RequestQueue 12089762338dSopenharmony_ci * @tc.desc: int32_t RequestQueue(const UsbDev &dev, const UsbPipe &pipe, std::vector<uint8_t> &clientData, 12099762338dSopenharmony_ci std::vector<uint8_t> &buffer); 12109762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum && interfaceId && pointId error 12119762338dSopenharmony_ci * @tc.type: FUNC 12129762338dSopenharmony_ci */ 12139762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_2500, Function | MediumTest | Level1) 12149762338dSopenharmony_ci{ 12159762338dSopenharmony_ci struct UsbDev dev = dev_; 12169762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_IN; 12179762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 12189762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 12199762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_2500 %{public}d ClaimInterface=%{public}d", 12209762338dSopenharmony_ci __LINE__, ret); 12219762338dSopenharmony_ci ASSERT_EQ(0, ret); 12229762338dSopenharmony_ci dev.busNum = BUS_NUM_INVALID; 12239762338dSopenharmony_ci interfaceId = INVALID_NUM; 12249762338dSopenharmony_ci pointId = INVALID_NUM; 12259762338dSopenharmony_ci struct UsbPipe pipe = { interfaceId, pointId }; 12269762338dSopenharmony_ci std::vector<uint8_t> clientData = {'q', 'u', 'e', 'u', 'e', 'r', 'e', 'a', 'd'}; 12279762338dSopenharmony_ci std::vector<uint8_t> bufferData(MAX_BUFFER_LENGTH); 12289762338dSopenharmony_ci ret = g_usbInterface->RequestQueue(dev, pipe, clientData, bufferData); 12299762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_2500 %{public}d RequestQueue=%{public}d", 12309762338dSopenharmony_ci __LINE__, ret); 12319762338dSopenharmony_ci ASSERT_NE(ret, 0); 12329762338dSopenharmony_ci} 12339762338dSopenharmony_ci 12349762338dSopenharmony_ci/** 12359762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_2600 12369762338dSopenharmony_ci * @tc.desc: Test functions to RequestQueue 12379762338dSopenharmony_ci * @tc.desc: int32_t RequestQueue(const UsbDev &dev, const UsbPipe &pipe, std::vector<uint8_t> &clientData, 12389762338dSopenharmony_ci std::vector<uint8_t> &buffer); 12399762338dSopenharmony_ci * @tc.desc: Positive test: parameters correctly 12409762338dSopenharmony_ci * @tc.type: FUNC 12419762338dSopenharmony_ci */ 12429762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_2600, Function | MediumTest | Level1) 12439762338dSopenharmony_ci{ 12449762338dSopenharmony_ci struct UsbDev dev = dev_; 12459762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_OUT; 12469762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 12479762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 12489762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_2600 %{public}d ClaimInterface=%{public}d", 12499762338dSopenharmony_ci __LINE__, ret); 12509762338dSopenharmony_ci ASSERT_EQ(0, ret); 12519762338dSopenharmony_ci struct UsbPipe pipe = { interfaceId, pointId }; 12529762338dSopenharmony_ci std::vector<uint8_t> clientData = {'q', 'u', 'e', 'u', 'e', 'w', 'r', 'i', 't', 'e'}; 12539762338dSopenharmony_ci std::vector<uint8_t> bufferData = {'r', 'e', 'q', 'u', 'e', 's', 't', '0', '0', '7'}; 12549762338dSopenharmony_ci ret = g_usbInterface->RequestQueue(dev, pipe, clientData, bufferData); 12559762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_2600 %{public}d RequestQueue=%{public}d", 12569762338dSopenharmony_ci __LINE__, ret); 12579762338dSopenharmony_ci ASSERT_EQ(0, ret); 12589762338dSopenharmony_ci} 12599762338dSopenharmony_ci 12609762338dSopenharmony_ci/** 12619762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_2700 12629762338dSopenharmony_ci * @tc.desc: Test functions to RequestQueue 12639762338dSopenharmony_ci * @tc.desc: int32_t RequestQueue(const UsbDev &dev, const UsbPipe &pipe, std::vector<uint8_t> &clientData, 12649762338dSopenharmony_ci std::vector<uint8_t> &buffer); 12659762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, interfaceId error 12669762338dSopenharmony_ci * @tc.type: FUNC 12679762338dSopenharmony_ci */ 12689762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_2700, Function | MediumTest | Level1) 12699762338dSopenharmony_ci{ 12709762338dSopenharmony_ci struct UsbDev dev = dev_; 12719762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_OUT; 12729762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 12739762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 12749762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_2700 %{public}d ClaimInterface=%{public}d", 12759762338dSopenharmony_ci __LINE__, ret); 12769762338dSopenharmony_ci ASSERT_EQ(0, ret); 12779762338dSopenharmony_ci interfaceId = INVALID_NUM; 12789762338dSopenharmony_ci struct UsbPipe pipe = { interfaceId, pointId }; 12799762338dSopenharmony_ci std::vector<uint8_t> clientData = {'q', 'u', 'e', 'u', 'e', 'w', 'r', 'i', 't', 'e'}; 12809762338dSopenharmony_ci std::vector<uint8_t> bufferData = {'r', 'e', 'q', 'u', 'e', 's', 't', '0', '0', '8'}; 12819762338dSopenharmony_ci ret = g_usbInterface->RequestQueue(dev, pipe, clientData, bufferData); 12829762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_2700 %{public}d RequestQueue=%{public}d", 12839762338dSopenharmony_ci __LINE__, ret); 12849762338dSopenharmony_ci ASSERT_NE(ret, 0); 12859762338dSopenharmony_ci} 12869762338dSopenharmony_ci 12879762338dSopenharmony_ci/** 12889762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_2800 12899762338dSopenharmony_ci * @tc.desc: Test functions to RequestQueue 12909762338dSopenharmony_ci * @tc.desc: int32_t RequestQueue(const UsbDev &dev, const UsbPipe &pipe, std::vector<uint8_t> &clientData, 12919762338dSopenharmony_ci std::vector<uint8_t> &buffer); 12929762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, interfaceId && pointId error 12939762338dSopenharmony_ci * @tc.type: FUNC 12949762338dSopenharmony_ci */ 12959762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_2800, Function | MediumTest | Level1) 12969762338dSopenharmony_ci{ 12979762338dSopenharmony_ci struct UsbDev dev = dev_; 12989762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_OUT; 12999762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 13009762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 13019762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_2800 %{public}d ClaimInterface=%{public}d", 13029762338dSopenharmony_ci __LINE__, ret); 13039762338dSopenharmony_ci ASSERT_EQ(0, ret); 13049762338dSopenharmony_ci interfaceId = INVALID_NUM; 13059762338dSopenharmony_ci pointId = INVALID_NUM; 13069762338dSopenharmony_ci struct UsbPipe pipe = { interfaceId, pointId }; 13079762338dSopenharmony_ci std::vector<uint8_t> clientData = {'q', 'u', 'e', 'u', 'e', 'w', 'r', 'i', 't', 'e'}; 13089762338dSopenharmony_ci std::vector<uint8_t> bufferData = {'r', 'e', 'q', 'u', 'e', 's', 't', '0', '0', '9'}; 13099762338dSopenharmony_ci ret = g_usbInterface->RequestQueue(dev, pipe, clientData, bufferData); 13109762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_2800 %{public}d RequestQueue=%{public}d", 13119762338dSopenharmony_ci __LINE__, ret); 13129762338dSopenharmony_ci ASSERT_NE(ret, 0); 13139762338dSopenharmony_ci} 13149762338dSopenharmony_ci 13159762338dSopenharmony_ci/**********************************************************************************************************/ 13169762338dSopenharmony_ci 13179762338dSopenharmony_ci/** 13189762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Func_0600 13199762338dSopenharmony_ci * @tc.desc: Test functions to RequestWait 13209762338dSopenharmony_ci * @tc.desc: int32_t RequestWait(const UsbDev &dev, std::vector<uint8_t> &clientData, std::vector<uint8_t> &buffer, 13219762338dSopenharmony_ci * int32_t timeout); 13229762338dSopenharmony_ci * @tc.desc: Positive test: parameters correctly 13239762338dSopenharmony_ci * @tc.type: FUNC 13249762338dSopenharmony_ci */ 13259762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Func_0600, Function | MediumTest | Level1) 13269762338dSopenharmony_ci{ 13279762338dSopenharmony_ci struct UsbDev dev = dev_; 13289762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_IN; 13299762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 13309762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 13319762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Func_0600 %{public}d ClaimInterface=%{public}d", __LINE__, ret); 13329762338dSopenharmony_ci ASSERT_EQ(0, ret); 13339762338dSopenharmony_ci struct UsbPipe pipe = { interfaceId, pointId }; 13349762338dSopenharmony_ci std::vector<uint8_t> clientData = {'q', 'u', 'e', 'u', 'e', 'r', 'e', 'a', 'd'}; 13359762338dSopenharmony_ci std::vector<uint8_t> bufferData(MAX_BUFFER_LENGTH); 13369762338dSopenharmony_ci ret = g_usbInterface->RequestQueue(dev, pipe, clientData, bufferData); 13379762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Func_0600 %{public}d RequestQueue=%{public}d", __LINE__, ret); 13389762338dSopenharmony_ci ASSERT_EQ(0, ret); 13399762338dSopenharmony_ci std::vector<uint8_t> waitData(TAG_NUM_10); 13409762338dSopenharmony_ci ret = g_usbInterface->RequestWait(dev, waitData, bufferData, TIME_WAIT); 13419762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Func_0600 %{public}d RequestWait=%{public}d", __LINE__, ret); 13429762338dSopenharmony_ci ASSERT_EQ(0, ret); 13439762338dSopenharmony_ci} 13449762338dSopenharmony_ci 13459762338dSopenharmony_ci/** 13469762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_2900 13479762338dSopenharmony_ci * @tc.desc: Test functions to RequestWait 13489762338dSopenharmony_ci * @tc.desc: int32_t RequestWait(const UsbDev &dev, std::vector<uint8_t> &clientData, std::vector<uint8_t> &buffer, 13499762338dSopenharmony_ci * int32_t timeout); 13509762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum error 13519762338dSopenharmony_ci * @tc.type: FUNC 13529762338dSopenharmony_ci */ 13539762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_2900, Function | MediumTest | Level1) 13549762338dSopenharmony_ci{ 13559762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_IN; 13569762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 13579762338dSopenharmony_ci struct UsbDev dev = dev_; 13589762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 13599762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_2900 %{public}d ClaimInterface=%{public}d", 13609762338dSopenharmony_ci __LINE__, ret); 13619762338dSopenharmony_ci ASSERT_EQ(0, ret); 13629762338dSopenharmony_ci std::vector<uint8_t> clientData = {'q', 'u', 'e', 'u', 'e', 'r', 'e', 'a', 'd'}; 13639762338dSopenharmony_ci std::vector<uint8_t> bufferData(MAX_BUFFER_LENGTH); 13649762338dSopenharmony_ci struct UsbPipe pipe = { interfaceId, pointId }; 13659762338dSopenharmony_ci ret = g_usbInterface->RequestQueue(dev, pipe, clientData, bufferData); 13669762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_2900 %{public}d RequestQueue=%{public}d", 13679762338dSopenharmony_ci __LINE__, ret); 13689762338dSopenharmony_ci ASSERT_EQ(0, ret); 13699762338dSopenharmony_ci dev.busNum = BUS_NUM_INVALID; 13709762338dSopenharmony_ci std::vector<uint8_t> waitData(TAG_NUM_10); 13719762338dSopenharmony_ci ret = g_usbInterface->RequestWait(dev, waitData, bufferData, TIME_WAIT); 13729762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_2900 %{public}d RequestWait=%{public}d", 13739762338dSopenharmony_ci __LINE__, ret); 13749762338dSopenharmony_ci ASSERT_NE(ret, 0); 13759762338dSopenharmony_ci} 13769762338dSopenharmony_ci 13779762338dSopenharmony_ci/** 13789762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_3000 13799762338dSopenharmony_ci * @tc.desc: Test functions to RequestWait 13809762338dSopenharmony_ci * @tc.desc: int32_t RequestWait(const UsbDev &dev, std::vector<uint8_t> &clientData, std::vector<uint8_t> &buffer, 13819762338dSopenharmony_ci * int32_t timeout); 13829762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, devAddr error 13839762338dSopenharmony_ci * @tc.type: FUNC 13849762338dSopenharmony_ci */ 13859762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_3000, Function | MediumTest | Level1) 13869762338dSopenharmony_ci{ 13879762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_IN; 13889762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 13899762338dSopenharmony_ci struct UsbDev dev = dev_; 13909762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 13919762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_3000 %{public}d ClaimInterface=%{public}d", 13929762338dSopenharmony_ci __LINE__, ret); 13939762338dSopenharmony_ci ASSERT_EQ(0, ret); 13949762338dSopenharmony_ci std::vector<uint8_t> clientData = {'q', 'u', 'e', 'u', 'e', 'r', 'e', 'a', 'd'}; 13959762338dSopenharmony_ci std::vector<uint8_t> bufferData(MAX_BUFFER_LENGTH); 13969762338dSopenharmony_ci struct UsbPipe pipe = { interfaceId, pointId }; 13979762338dSopenharmony_ci ret = g_usbInterface->RequestQueue(dev, pipe, clientData, bufferData); 13989762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_3000 %{public}d RequestQueue=%{public}d", 13999762338dSopenharmony_ci __LINE__, ret); 14009762338dSopenharmony_ci ASSERT_EQ(0, ret); 14019762338dSopenharmony_ci dev.devAddr = DEV_ADDR_INVALID; 14029762338dSopenharmony_ci std::vector<uint8_t> waitData(TAG_NUM_10); 14039762338dSopenharmony_ci ret = g_usbInterface->RequestWait(dev, waitData, bufferData, TIME_WAIT); 14049762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_3000 %{public}d RequestWait=%{public}d", 14059762338dSopenharmony_ci __LINE__, ret); 14069762338dSopenharmony_ci ASSERT_NE(ret, 0); 14079762338dSopenharmony_ci} 14089762338dSopenharmony_ci 14099762338dSopenharmony_ci/** 14109762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_3100 14119762338dSopenharmony_ci * @tc.desc: Test functions to RequestWait 14129762338dSopenharmony_ci * @tc.desc: int32_t RequestWait(const UsbDev &dev, std::vector<uint8_t> &clientData, std::vector<uint8_t> &buffer, 14139762338dSopenharmony_ci * int32_t timeout); 14149762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, timeout error 14159762338dSopenharmony_ci * @tc.type: FUNC 14169762338dSopenharmony_ci */ 14179762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_3100, Function | MediumTest | Level1) 14189762338dSopenharmony_ci{ 14199762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_IN; 14209762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 14219762338dSopenharmony_ci struct UsbDev dev = dev_; 14229762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 14239762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_3100 %{public}d ClaimInterface=%{public}d", 14249762338dSopenharmony_ci __LINE__, ret); 14259762338dSopenharmony_ci ASSERT_EQ(0, ret); 14269762338dSopenharmony_ci std::vector<uint8_t> clientData = {'q', 'u', 'e', 'u', 'e', 'r', 'e', 'a', 'd'}; 14279762338dSopenharmony_ci struct UsbPipe pipe = { interfaceId, pointId }; 14289762338dSopenharmony_ci std::vector<uint8_t> bufferData(MAX_BUFFER_LENGTH); 14299762338dSopenharmony_ci ret = g_usbInterface->RequestQueue(dev, pipe, clientData, bufferData); 14309762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_3100 %{public}d RequestQueue=%{public}d", 14319762338dSopenharmony_ci __LINE__, ret); 14329762338dSopenharmony_ci ASSERT_EQ(0, ret); 14339762338dSopenharmony_ci std::vector<uint8_t> waitData(TAG_NUM_10); 14349762338dSopenharmony_ci ret = g_usbInterface->RequestWait(dev, waitData, bufferData, -TIME_WAIT); 14359762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_3100 %{public}d RequestWait=%{public}d", 14369762338dSopenharmony_ci __LINE__, ret); 14379762338dSopenharmony_ci ASSERT_EQ(0, ret); 14389762338dSopenharmony_ci} 14399762338dSopenharmony_ci 14409762338dSopenharmony_ci/** 14419762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_3200 14429762338dSopenharmony_ci * @tc.desc: Test functions to RequestWait 14439762338dSopenharmony_ci * @tc.desc: int32_t RequestWait(const UsbDev &dev, std::vector<uint8_t> &clientData, std::vector<uint8_t> &buffer, 14449762338dSopenharmony_ci * int32_t timeout); 14459762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum && devAddr error 14469762338dSopenharmony_ci * @tc.type: FUNC 14479762338dSopenharmony_ci */ 14489762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_3200, Function | MediumTest | Level1) 14499762338dSopenharmony_ci{ 14509762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_IN; 14519762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 14529762338dSopenharmony_ci struct UsbDev dev = dev_; 14539762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 14549762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_3200 %{public}d ClaimInterface=%{public}d", 14559762338dSopenharmony_ci __LINE__, ret); 14569762338dSopenharmony_ci ASSERT_EQ(0, ret); 14579762338dSopenharmony_ci struct UsbPipe pipe = { interfaceId, pointId }; 14589762338dSopenharmony_ci std::vector<uint8_t> clientData = {'q', 'u', 'e', 'u', 'e', 'r', 'e', 'a', 'd'}; 14599762338dSopenharmony_ci std::vector<uint8_t> bufferData(MAX_BUFFER_LENGTH); 14609762338dSopenharmony_ci ret = g_usbInterface->RequestQueue(dev, pipe, clientData, bufferData); 14619762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_3200 %{public}d RequestQueue=%{public}d", 14629762338dSopenharmony_ci __LINE__, ret); 14639762338dSopenharmony_ci ASSERT_EQ(0, ret); 14649762338dSopenharmony_ci std::vector<uint8_t> waitData(TAG_NUM_10); 14659762338dSopenharmony_ci dev.devAddr = DEV_ADDR_INVALID; 14669762338dSopenharmony_ci dev.busNum = BUS_NUM_INVALID; 14679762338dSopenharmony_ci ret = g_usbInterface->RequestWait(dev, waitData, bufferData, TIME_WAIT); 14689762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_3200 %{public}d RequestWait=%{public}d", 14699762338dSopenharmony_ci __LINE__, ret); 14709762338dSopenharmony_ci ASSERT_NE(ret, 0); 14719762338dSopenharmony_ci} 14729762338dSopenharmony_ci 14739762338dSopenharmony_ci/**********************************************************************************************************/ 14749762338dSopenharmony_ci 14759762338dSopenharmony_ci/** 14769762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_TranFunc_0300 14779762338dSopenharmony_ci * @tc.desc: Test functions to RequestCancel 14789762338dSopenharmony_ci * @tc.desc: int32_t RequestCancel(const UsbDev &dev, const UsbPipe &pipe); 14799762338dSopenharmony_ci * @tc.desc: Positive test: parameters correctly 14809762338dSopenharmony_ci * @tc.type: FUNC 14819762338dSopenharmony_ci */ 14829762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_TranFunc_0300, Function | MediumTest | Level1) 14839762338dSopenharmony_ci{ 14849762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_IN; 14859762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 14869762338dSopenharmony_ci struct UsbDev dev = dev_; 14879762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 14889762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranFunc_0300 %{public}d ClaimInterface=%{public}d", 14899762338dSopenharmony_ci __LINE__, ret); 14909762338dSopenharmony_ci ASSERT_EQ(0, ret); 14919762338dSopenharmony_ci struct UsbPipe pipe = { interfaceId, pointId }; 14929762338dSopenharmony_ci std::vector<uint8_t> clientData = {'q', 'u', 'e', 'u', 'e', 'r', 'e', 'a', 'd'}; 14939762338dSopenharmony_ci std::vector<uint8_t> bufferData = {'r', 'e', 'q', 'u', 'e', 's', 't', '0', '0', '1'}; 14949762338dSopenharmony_ci ret = g_usbInterface->RequestQueue(dev, pipe, clientData, bufferData); 14959762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranFunc_0300 %{public}d RequestQueue=%{public}d", 14969762338dSopenharmony_ci __LINE__, ret); 14979762338dSopenharmony_ci ASSERT_EQ(0, ret); 14989762338dSopenharmony_ci ret = g_usbInterface->RequestCancel(dev, pipe); 14999762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranFunc_0300 %{public}d RequestCancel=%{public}d", 15009762338dSopenharmony_ci __LINE__, ret); 15019762338dSopenharmony_ci ASSERT_EQ(0, ret); 15029762338dSopenharmony_ci} 15039762338dSopenharmony_ci 15049762338dSopenharmony_ci/** 15059762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_TranCompatibility_3200 15069762338dSopenharmony_ci * @tc.desc: Test functions to RequestCancel 15079762338dSopenharmony_ci * @tc.desc: int32_t RequestCancel(const UsbDev &dev, const UsbPipe &pipe); 15089762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum error 15099762338dSopenharmony_ci * @tc.type: FUNC 15109762338dSopenharmony_ci */ 15119762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_TranCompatibility_3200, Function | MediumTest | Level1) 15129762338dSopenharmony_ci{ 15139762338dSopenharmony_ci struct UsbDev dev = dev_; 15149762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_IN; 15159762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 15169762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 15179762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_3200 %{public}d ClaimInterface=%{public}d", 15189762338dSopenharmony_ci __LINE__, ret); 15199762338dSopenharmony_ci ASSERT_EQ(0, ret); 15209762338dSopenharmony_ci struct UsbPipe pipe = { interfaceId, pointId }; 15219762338dSopenharmony_ci std::vector<uint8_t> clientData = {'q', 'u', 'e', 'u', 'e', 'r', 'e', 'a', 'd'}; 15229762338dSopenharmony_ci std::vector<uint8_t> bufferData = {'r', 'e', 'q', 'u', 'e', 's', 't', '0', '0', '2'}; 15239762338dSopenharmony_ci ret = g_usbInterface->RequestQueue(dev, pipe, clientData, bufferData); 15249762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_3200 %{public}d RequestQueue=%{public}d", 15259762338dSopenharmony_ci __LINE__, ret); 15269762338dSopenharmony_ci ASSERT_EQ(0, ret); 15279762338dSopenharmony_ci dev.busNum = BUS_NUM_INVALID; 15289762338dSopenharmony_ci ret = g_usbInterface->RequestCancel(dev, pipe); 15299762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_3200 %{public}d RequestCancel=%{public}d", 15309762338dSopenharmony_ci __LINE__, ret); 15319762338dSopenharmony_ci ASSERT_NE(ret, 0); 15329762338dSopenharmony_ci dev = dev_; 15339762338dSopenharmony_ci ret = g_usbInterface->RequestCancel(dev, pipe); 15349762338dSopenharmony_ci HDF_LOGI( 15359762338dSopenharmony_ci "UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_3200 again %{public}d RequestCancel=%{public}d", 15369762338dSopenharmony_ci __LINE__, ret); 15379762338dSopenharmony_ci ASSERT_EQ(0, ret); 15389762338dSopenharmony_ci} 15399762338dSopenharmony_ci 15409762338dSopenharmony_ci/** 15419762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_TranCompatibility_3300 15429762338dSopenharmony_ci * @tc.desc: Test functions to RequestCancel 15439762338dSopenharmony_ci * @tc.desc: int32_t RequestCancel(const UsbDev &dev, const UsbPipe &pipe); 15449762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, devAddr error 15459762338dSopenharmony_ci * @tc.type: FUNC 15469762338dSopenharmony_ci */ 15479762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_TranCompatibility_3300, Function | MediumTest | Level1) 15489762338dSopenharmony_ci{ 15499762338dSopenharmony_ci struct UsbDev dev = dev_; 15509762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_IN; 15519762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 15529762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 15539762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_3300 %{public}d ClaimInterface=%{public}d", 15549762338dSopenharmony_ci __LINE__, ret); 15559762338dSopenharmony_ci ASSERT_EQ(0, ret); 15569762338dSopenharmony_ci std::vector<uint8_t> clientData = {'q', 'u', 'e', 'u', 'e', 'r', 'e', 'a', 'd'}; 15579762338dSopenharmony_ci std::vector<uint8_t> bufferData = {'r', 'e', 'q', 'u', 'e', 's', 't', '0', '0', '3'}; 15589762338dSopenharmony_ci struct UsbPipe pipe = { interfaceId, pointId }; 15599762338dSopenharmony_ci ret = g_usbInterface->RequestQueue(dev, pipe, clientData, bufferData); 15609762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_3300 %{public}d RequestQueue=%{public}d", 15619762338dSopenharmony_ci __LINE__, ret); 15629762338dSopenharmony_ci ASSERT_EQ(0, ret); 15639762338dSopenharmony_ci dev.devAddr = DEV_ADDR_INVALID; 15649762338dSopenharmony_ci ret = g_usbInterface->RequestCancel(dev, pipe); 15659762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_3300 %{public}d RequestCancel=%{public}d", 15669762338dSopenharmony_ci __LINE__, ret); 15679762338dSopenharmony_ci ASSERT_NE(ret, 0); 15689762338dSopenharmony_ci dev = dev_; 15699762338dSopenharmony_ci ret = g_usbInterface->RequestCancel(dev, pipe); 15709762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::UsbdRequestCancel003 again %{public}d RequestCancel=%{public}d", __LINE__, ret); 15719762338dSopenharmony_ci ASSERT_EQ(0, ret); 15729762338dSopenharmony_ci} 15739762338dSopenharmony_ci 15749762338dSopenharmony_ci/** 15759762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_TranCompatibility_3400 15769762338dSopenharmony_ci * @tc.desc: Test functions to RequestCancel 15779762338dSopenharmony_ci * @tc.desc: int32_t RequestCancel(const UsbDev &dev, const UsbPipe &pipe); 15789762338dSopenharmony_ci * @tc.desc: Positive test: intfId && endpointId error in pipe but not used 15799762338dSopenharmony_ci * @tc.type: FUNC 15809762338dSopenharmony_ci */ 15819762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_TranCompatibility_3400, Function | MediumTest | Level1) 15829762338dSopenharmony_ci{ 15839762338dSopenharmony_ci struct UsbDev dev = dev_; 15849762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_OUT; 15859762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 15869762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 15879762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_3400 %{public}d ClaimInterface=%{public}d", 15889762338dSopenharmony_ci __LINE__, ret); 15899762338dSopenharmony_ci ASSERT_EQ(0, ret); 15909762338dSopenharmony_ci struct UsbPipe pipe = { interfaceId, pointId }; 15919762338dSopenharmony_ci std::vector<uint8_t> clientData = {'q', 'u', 'e', 'u', 'e', 'r', 'e', 'a', 'd'}; 15929762338dSopenharmony_ci std::vector<uint8_t> bufferData = {'r', 'e', 'q', 'u', 'e', 's', 't', '0', '0', '4'}; 15939762338dSopenharmony_ci ret = g_usbInterface->RequestQueue(dev, pipe, clientData, bufferData); 15949762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_3400 %{public}d RequestQueue=%{public}d", 15959762338dSopenharmony_ci __LINE__, ret); 15969762338dSopenharmony_ci ASSERT_EQ(0, ret); 15979762338dSopenharmony_ci pipe.intfId = INTERFACEID_INVALID; 15989762338dSopenharmony_ci pipe.endpointId = POINTID_INVALID; 15999762338dSopenharmony_ci ret = g_usbInterface->RequestCancel(dev, pipe); 16009762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_3400 %{public}d RequestCancel=%{public}d", 16019762338dSopenharmony_ci __LINE__, ret); 16029762338dSopenharmony_ci ASSERT_EQ(0, ret); 16039762338dSopenharmony_ci pipe = {interfaceId, pointId}; 16049762338dSopenharmony_ci ret = g_usbInterface->RequestCancel(dev, pipe); 16059762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::UsbdRequestCancel004 %{public}d again RequestCancel=%{public}d", __LINE__, ret); 16069762338dSopenharmony_ci ASSERT_EQ(0, ret); 16079762338dSopenharmony_ci} 16089762338dSopenharmony_ci 16099762338dSopenharmony_ci/** 16109762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_TranCompatibility_3500 16119762338dSopenharmony_ci * @tc.desc: Test functions to RequestCancel 16129762338dSopenharmony_ci * @tc.desc: int32_t RequestCancel(const UsbDev &dev, const UsbPipe &pipe); 16139762338dSopenharmony_ci * @tc.desc: Negative test: call twice 16149762338dSopenharmony_ci * @tc.type: FUNC 16159762338dSopenharmony_ci */ 16169762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_TranCompatibility_3500, Function | MediumTest | Level1) 16179762338dSopenharmony_ci{ 16189762338dSopenharmony_ci struct UsbDev dev = dev_; 16199762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_OUT; 16209762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 16219762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 16229762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_3500 %{public}d ClaimInterface=%{public}d", 16239762338dSopenharmony_ci __LINE__, ret); 16249762338dSopenharmony_ci ASSERT_EQ(0, ret); 16259762338dSopenharmony_ci struct UsbPipe pipe = { interfaceId, pointId }; 16269762338dSopenharmony_ci std::vector<uint8_t> clientData = {'q', 'u', 'e', 'u', 'e', 'r', 'e', 'a', 'd'}; 16279762338dSopenharmony_ci std::vector<uint8_t> bufferData = {'r', 'e', 'q', 'u', 'e', 's', 't', '0', '0', '5'}; 16289762338dSopenharmony_ci ret = g_usbInterface->RequestQueue(dev, pipe, clientData, bufferData); 16299762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_3500 %{public}d RequestQueue=%{public}d", 16309762338dSopenharmony_ci __LINE__, ret); 16319762338dSopenharmony_ci ASSERT_EQ(0, ret); 16329762338dSopenharmony_ci ret = g_usbInterface->RequestCancel(dev, pipe); 16339762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_3500 %{public}d RequestCancel=%{public}d", 16349762338dSopenharmony_ci __LINE__, ret); 16359762338dSopenharmony_ci ASSERT_EQ(0, ret); 16369762338dSopenharmony_ci dev = dev_; 16379762338dSopenharmony_ci pipe = {interfaceId, pointId}; 16389762338dSopenharmony_ci ret = g_usbInterface->RequestCancel(dev, pipe); 16399762338dSopenharmony_ci ASSERT_EQ(0, ret); 16409762338dSopenharmony_ci} 16419762338dSopenharmony_ci 16429762338dSopenharmony_ci/** 16439762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_TranCompatibility_3600 16449762338dSopenharmony_ci * @tc.desc: Test functions to RequestCancel 16459762338dSopenharmony_ci * @tc.desc: int32_t RequestCancel(const UsbDev &dev, const UsbPipe &pipe); 16469762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum error && interfaceid ignore 16479762338dSopenharmony_ci * @tc.type: FUNC 16489762338dSopenharmony_ci */ 16499762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_TranCompatibility_3600, Function | MediumTest | Level1) 16509762338dSopenharmony_ci{ 16519762338dSopenharmony_ci struct UsbDev dev = dev_; 16529762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_OUT; 16539762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 16549762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 16559762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_3600 %{public}d ClaimInterface=%{public}d", 16569762338dSopenharmony_ci __LINE__, ret); 16579762338dSopenharmony_ci ASSERT_EQ(0, ret); 16589762338dSopenharmony_ci std::vector<uint8_t> clientData = {'q', 'u', 'e', 'u', 'e', 'r', 'e', 'a', 'd'}; 16599762338dSopenharmony_ci std::vector<uint8_t> bufferData = {'r', 'e', 'q', 'u', 'e', 's', 't', '0', '0', '6'}; 16609762338dSopenharmony_ci struct UsbPipe pipe = { interfaceId, pointId }; 16619762338dSopenharmony_ci ret = g_usbInterface->RequestQueue(dev, pipe, clientData, bufferData); 16629762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_3600 %{public}d RequestQueue=%{public}d", 16639762338dSopenharmony_ci __LINE__, ret); 16649762338dSopenharmony_ci ASSERT_EQ(0, ret); 16659762338dSopenharmony_ci dev.busNum = BUS_NUM_INVALID; 16669762338dSopenharmony_ci pipe.intfId = 224; 16679762338dSopenharmony_ci ret = g_usbInterface->RequestCancel(dev, pipe); 16689762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_3600 %{public}d RequestCancel=%{public}d", 16699762338dSopenharmony_ci __LINE__, ret); 16709762338dSopenharmony_ci ASSERT_NE(ret, 0); 16719762338dSopenharmony_ci dev.busNum = dev_.busNum; 16729762338dSopenharmony_ci pipe.intfId = INTERFACEID_OK; 16739762338dSopenharmony_ci ret = g_usbInterface->RequestCancel(dev, pipe); 16749762338dSopenharmony_ci ASSERT_EQ(0, ret); 16759762338dSopenharmony_ci} 16769762338dSopenharmony_ci 16779762338dSopenharmony_ci/** 16789762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_TranCompatibility_3700 16799762338dSopenharmony_ci * @tc.desc: Test functions to RequestCancel 16809762338dSopenharmony_ci * @tc.desc: int32_t RequestCancel(const UsbDev &dev, const UsbPipe &pipe); 16819762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, devAddr error && interfaceid ignore 16829762338dSopenharmony_ci * @tc.type: FUNC 16839762338dSopenharmony_ci */ 16849762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_TranCompatibility_3700, Function | MediumTest | Level1) 16859762338dSopenharmony_ci{ 16869762338dSopenharmony_ci struct UsbDev dev = dev_; 16879762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_OUT; 16889762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 16899762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 16909762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_3700 %{public}d ClaimInterface=%{public}d", 16919762338dSopenharmony_ci __LINE__, ret); 16929762338dSopenharmony_ci ASSERT_EQ(0, ret); 16939762338dSopenharmony_ci struct UsbPipe pipe = { interfaceId, pointId }; 16949762338dSopenharmony_ci std::vector<uint8_t> clientData = {'q', 'u', 'e', 'u', 'e', 'r', 'e', 'a', 'd'}; 16959762338dSopenharmony_ci std::vector<uint8_t> bufferData = {'r', 'e', 'q', 'u', 'e', 's', 't', '0', '0', '7'}; 16969762338dSopenharmony_ci ret = g_usbInterface->RequestQueue(dev, pipe, clientData, bufferData); 16979762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_3700 %{public}d RequestQueue=%{public}d", 16989762338dSopenharmony_ci __LINE__, ret); 16999762338dSopenharmony_ci ASSERT_EQ(0, ret); 17009762338dSopenharmony_ci dev.devAddr = DEV_ADDR_INVALID; 17019762338dSopenharmony_ci pipe.intfId = INTERFACEID_INVALID; 17029762338dSopenharmony_ci ret = g_usbInterface->RequestCancel(dev, pipe); 17039762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_3700 %{public}d RequestCancel=%{public}d", 17049762338dSopenharmony_ci __LINE__, ret); 17059762338dSopenharmony_ci ASSERT_NE(ret, 0); 17069762338dSopenharmony_ci dev.devAddr = dev_.devAddr; 17079762338dSopenharmony_ci pipe.intfId = INTERFACEID_OK; 17089762338dSopenharmony_ci ret = g_usbInterface->RequestCancel(dev, pipe); 17099762338dSopenharmony_ci ASSERT_EQ(0, ret); 17109762338dSopenharmony_ci} 17119762338dSopenharmony_ci 17129762338dSopenharmony_ci/** 17139762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_TranCompatibility_3800 17149762338dSopenharmony_ci * @tc.desc: Test functions to RequestCancel 17159762338dSopenharmony_ci * @tc.desc: int32_t RequestCancel(const UsbDev &dev, const UsbPipe &pipe); 17169762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum error && devAddr error && interfaceid ignore 17179762338dSopenharmony_ci * @tc.type: FUNC 17189762338dSopenharmony_ci */ 17199762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_TranCompatibility_3800, Function | MediumTest | Level1) 17209762338dSopenharmony_ci{ 17219762338dSopenharmony_ci struct UsbDev dev = dev_; 17229762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_OUT; 17239762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 17249762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 17259762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_3800 %{public}d ClaimInterface=%{public}d", 17269762338dSopenharmony_ci __LINE__, ret); 17279762338dSopenharmony_ci ASSERT_EQ(0, ret); 17289762338dSopenharmony_ci struct UsbPipe pipe = { interfaceId, pointId }; 17299762338dSopenharmony_ci std::vector<uint8_t> clientData = {'q', 'u', 'e', 'u', 'e', 'r', 'e', 'a', 'd'}; 17309762338dSopenharmony_ci std::vector<uint8_t> bufferData = {'r', 'e', 'q', 'u', 'e', 's', 't', '0', '0', '8'}; 17319762338dSopenharmony_ci ret = g_usbInterface->RequestQueue(dev, pipe, clientData, bufferData); 17329762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_3800 %{public}d RequestQueue=%{public}d", 17339762338dSopenharmony_ci __LINE__, ret); 17349762338dSopenharmony_ci ASSERT_EQ(0, ret); 17359762338dSopenharmony_ci dev.busNum = BUS_NUM_INVALID; 17369762338dSopenharmony_ci dev.devAddr = DEV_ADDR_INVALID; 17379762338dSopenharmony_ci pipe.intfId = INTERFACEID_INVALID; 17389762338dSopenharmony_ci ret = g_usbInterface->RequestCancel(dev, pipe); 17399762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_3800 %{public}d RequestCancel=%{public}d", 17409762338dSopenharmony_ci __LINE__, ret); 17419762338dSopenharmony_ci ASSERT_NE(ret, 0); 17429762338dSopenharmony_ci dev = dev_; 17439762338dSopenharmony_ci pipe.intfId = INTERFACEID_OK; 17449762338dSopenharmony_ci ret = g_usbInterface->RequestCancel(dev, pipe); 17459762338dSopenharmony_ci ASSERT_EQ(0, ret); 17469762338dSopenharmony_ci} 17479762338dSopenharmony_ci 17489762338dSopenharmony_ci/**********************************************************************************************************/ 17499762338dSopenharmony_ci 17509762338dSopenharmony_ci/** 17519762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Func_0800 17529762338dSopenharmony_ci * @tc.desc: Test functions to ReleaseInterface 17539762338dSopenharmony_ci * @tc.desc: int32_t ReleaseInterface(const UsbDev &dev, uint8_t interfaceId); 17549762338dSopenharmony_ci * @tc.desc: Positive test: parameters correctly 17559762338dSopenharmony_ci * @tc.type: FUNC 17569762338dSopenharmony_ci */ 17579762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Func_0800, Function | MediumTest | Level1) 17589762338dSopenharmony_ci{ 17599762338dSopenharmony_ci struct UsbDev dev = dev_; 17609762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 17619762338dSopenharmony_ci auto ret = g_usbInterface->ReleaseInterface(dev, interfaceId); 17629762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Func_0800 %{public}d ret=%{public}d", __LINE__, ret); 17639762338dSopenharmony_ci ASSERT_EQ(0, ret); 17649762338dSopenharmony_ci} 17659762338dSopenharmony_ci 17669762338dSopenharmony_ci/** 17679762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_4000 17689762338dSopenharmony_ci * @tc.desc: Test functions to ReleaseInterface 17699762338dSopenharmony_ci * @tc.desc: int32_t ReleaseInterface(const UsbDev &dev, uint8_t interfaceId); 17709762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum error 17719762338dSopenharmony_ci * @tc.type: FUNC 17729762338dSopenharmony_ci */ 17739762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_4000, Function | MediumTest | Level1) 17749762338dSopenharmony_ci{ 17759762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 17769762338dSopenharmony_ci struct UsbDev dev = { BUS_NUM_INVALID, dev_.devAddr }; 17779762338dSopenharmony_ci auto ret = g_usbInterface->ReleaseInterface(dev, interfaceId); 17789762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_4000 %{public}d ret=%{public}d", __LINE__, ret); 17799762338dSopenharmony_ci ASSERT_NE(ret, 0); 17809762338dSopenharmony_ci} 17819762338dSopenharmony_ci 17829762338dSopenharmony_ci/** 17839762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_4100 17849762338dSopenharmony_ci * @tc.desc: Test functions to ReleaseInterface 17859762338dSopenharmony_ci * @tc.desc: int32_t ReleaseInterface(const UsbDev &dev, uint8_t interfaceId); 17869762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, devAddr error 17879762338dSopenharmony_ci * @tc.type: FUNC 17889762338dSopenharmony_ci */ 17899762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_4100, Function | MediumTest | Level1) 17909762338dSopenharmony_ci{ 17919762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 17929762338dSopenharmony_ci struct UsbDev dev = { dev_.busNum, DEV_ADDR_INVALID }; 17939762338dSopenharmony_ci auto ret = g_usbInterface->ReleaseInterface(dev, interfaceId); 17949762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_4100 %{public}d ret=%{public}d", __LINE__, ret); 17959762338dSopenharmony_ci ASSERT_NE(ret, 0); 17969762338dSopenharmony_ci} 17979762338dSopenharmony_ci 17989762338dSopenharmony_ci/** 17999762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_4200 18009762338dSopenharmony_ci * @tc.desc: Test functions to ReleaseInterface 18019762338dSopenharmony_ci * @tc.desc: int32_t ReleaseInterface(const UsbDev &dev, uint8_t interfaceId); 18029762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, interfaceId error 18039762338dSopenharmony_ci * @tc.type: FUNC 18049762338dSopenharmony_ci */ 18059762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_4200, Function | MediumTest | Level1) 18069762338dSopenharmony_ci{ 18079762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_INVALID; 18089762338dSopenharmony_ci struct UsbDev dev = dev_; 18099762338dSopenharmony_ci auto ret = g_usbInterface->ReleaseInterface(dev, interfaceId); 18109762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_4200 %{public}d ret=%{public}d", __LINE__, ret); 18119762338dSopenharmony_ci ASSERT_NE(ret, 0); 18129762338dSopenharmony_ci} 18139762338dSopenharmony_ci 18149762338dSopenharmony_ci/** 18159762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_4300 18169762338dSopenharmony_ci * @tc.desc: Test functions to ReleaseInterface 18179762338dSopenharmony_ci * @tc.desc: int32_t ReleaseInterface(const UsbDev &dev, uint8_t interfaceId); 18189762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum && devAddr error 18199762338dSopenharmony_ci * @tc.type: FUNC 18209762338dSopenharmony_ci */ 18219762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_4300, Function | MediumTest | Level1) 18229762338dSopenharmony_ci{ 18239762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 18249762338dSopenharmony_ci struct UsbDev dev = { BUS_NUM_INVALID, DEV_ADDR_INVALID }; 18259762338dSopenharmony_ci auto ret = g_usbInterface->ReleaseInterface(dev, interfaceId); 18269762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_4300 %{public}d ret=%{public}d", __LINE__, ret); 18279762338dSopenharmony_ci ASSERT_NE(ret, 0); 18289762338dSopenharmony_ci} 18299762338dSopenharmony_ci 18309762338dSopenharmony_ci/** 18319762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_4400 18329762338dSopenharmony_ci * @tc.desc: Test functions to ReleaseInterface 18339762338dSopenharmony_ci * @tc.desc: int32_t ReleaseInterface(const UsbDev &dev, uint8_t interfaceId); 18349762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum && interfaceid error 18359762338dSopenharmony_ci * @tc.type: FUNC 18369762338dSopenharmony_ci */ 18379762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_4400, Function | MediumTest | Level1) 18389762338dSopenharmony_ci{ 18399762338dSopenharmony_ci int32_t interfaceId = INTERFACEID_INVALID; 18409762338dSopenharmony_ci struct UsbDev dev = { DEV_ADDR_INVALID, dev_.devAddr }; 18419762338dSopenharmony_ci auto ret = g_usbInterface->ReleaseInterface(dev, interfaceId); 18429762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_4400 %{public}d ret=%{public}d", __LINE__, ret); 18439762338dSopenharmony_ci ASSERT_NE(ret, 0); 18449762338dSopenharmony_ci} 18459762338dSopenharmony_ci 18469762338dSopenharmony_ci/** 18479762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_4500 18489762338dSopenharmony_ci * @tc.desc: Test functions to ReleaseInterface 18499762338dSopenharmony_ci * @tc.desc: int32_t ReleaseInterface(const UsbDev &dev, uint8_t interfaceId); 18509762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, devAddr && interfaceid error 18519762338dSopenharmony_ci * @tc.type: FUNC 18529762338dSopenharmony_ci */ 18539762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_4500, Function | MediumTest | Level1) 18549762338dSopenharmony_ci{ 18559762338dSopenharmony_ci int32_t interfaceId = INTERFACEID_INVALID; 18569762338dSopenharmony_ci struct UsbDev dev = { dev_.busNum, DEV_ADDR_INVALID }; 18579762338dSopenharmony_ci auto ret = g_usbInterface->ReleaseInterface(dev, interfaceId); 18589762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_4500 %{public}d ret=%{public}d", __LINE__, ret); 18599762338dSopenharmony_ci ASSERT_NE(ret, 0); 18609762338dSopenharmony_ci} 18619762338dSopenharmony_ci 18629762338dSopenharmony_ci/** 18639762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_Compatibility_4600 18649762338dSopenharmony_ci * @tc.desc: Test functions to ReleaseInterface 18659762338dSopenharmony_ci * @tc.desc: int32_t ReleaseInterface(const UsbDev &dev, uint8_t interfaceId); 18669762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum && devAddr && interfaceid error 18679762338dSopenharmony_ci * @tc.type: FUNC 18689762338dSopenharmony_ci */ 18699762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_Compatibility_4600, Function | MediumTest | Level1) 18709762338dSopenharmony_ci{ 18719762338dSopenharmony_ci int32_t interfaceId = INTERFACEID_INVALID; 18729762338dSopenharmony_ci struct UsbDev dev = { BUS_NUM_INVALID, DEV_ADDR_INVALID }; 18739762338dSopenharmony_ci auto ret = g_usbInterface->ReleaseInterface(dev, interfaceId); 18749762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_Compatibility_4600 %{public}d ret=%{public}d", __LINE__, ret); 18759762338dSopenharmony_ci ASSERT_NE(ret, 0); 18769762338dSopenharmony_ci} 18779762338dSopenharmony_ci 18789762338dSopenharmony_ci/** 18799762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_TranFunc_0700 18809762338dSopenharmony_ci * @tc.desc: Test functions to BulkCancel 18819762338dSopenharmony_ci * @tc.desc: int32_t BulkCancel(const UsbDev &dev, const UsbPipe &pipe); 18829762338dSopenharmony_ci * @tc.desc: Positive test: parameters correctly 18839762338dSopenharmony_ci * @tc.type: FUNC 18849762338dSopenharmony_ci */ 18859762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_TranFunc_0700, Function | MediumTest | Level1) 18869762338dSopenharmony_ci{ 18879762338dSopenharmony_ci struct UsbDev dev = dev_; 18889762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 18899762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_IN; 18909762338dSopenharmony_ci struct UsbPipe pipe = {interfaceId, pointId}; 18919762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 18929762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranFunc_0700 %{public}d ClaimInterface=%{public}d", 18939762338dSopenharmony_ci __LINE__, ret); 18949762338dSopenharmony_ci ASSERT_EQ(0, ret); 18959762338dSopenharmony_ci sptr<UsbdBulkCallbackTest> usbdBulkCallback = new UsbdBulkCallbackTest(); 18969762338dSopenharmony_ci ret = g_usbInterface->RegBulkCallback(dev, pipe, usbdBulkCallback); 18979762338dSopenharmony_ci HDF_LOGI("UsbdTransferTest::SUB_USB_HostManager_HDI_TranFunc_0700 %{public}d RegBulkCallback=%{public}d", 18989762338dSopenharmony_ci __LINE__, ret); 18999762338dSopenharmony_ci ASSERT_EQ(ret, 0); 19009762338dSopenharmony_ci ret = g_usbInterface->BulkCancel(dev, pipe); 19019762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranFunc_0700 %{public}d BulkCancel=%{public}d", 19029762338dSopenharmony_ci __LINE__, ret); 19039762338dSopenharmony_ci ASSERT_EQ(0, ret); 19049762338dSopenharmony_ci ret = g_usbInterface->UnRegBulkCallback(dev, pipe); 19059762338dSopenharmony_ci HDF_LOGI("UsbdTransferTest::SUB_USB_HostManager_HDI_TranFunc_0700 %{public}d UnRegBulkCallback=%{public}d", 19069762338dSopenharmony_ci __LINE__, ret); 19079762338dSopenharmony_ci ASSERT_EQ(ret, 0); 19089762338dSopenharmony_ci} 19099762338dSopenharmony_ci 19109762338dSopenharmony_ci/** 19119762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_TranCompatibility_8100 19129762338dSopenharmony_ci * @tc.desc: Test functions to BulkCancel 19139762338dSopenharmony_ci * @tc.desc: int32_t BulkCancel(const UsbDev &dev, const UsbPipe &pipe); 19149762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum error 19159762338dSopenharmony_ci * @tc.type: FUNC 19169762338dSopenharmony_ci */ 19179762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_TranCompatibility_8100, Function | MediumTest | Level1) 19189762338dSopenharmony_ci{ 19199762338dSopenharmony_ci struct UsbDev dev = dev_; 19209762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 19219762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_IN; 19229762338dSopenharmony_ci struct UsbPipe pipe = {interfaceId, pointId}; 19239762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 19249762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_8100 %{public}d ClaimInterface=%{public}d", 19259762338dSopenharmony_ci __LINE__, ret); 19269762338dSopenharmony_ci ASSERT_EQ(0, ret); 19279762338dSopenharmony_ci sptr<UsbdBulkCallbackTest> usbdBulkCallback = new UsbdBulkCallbackTest(); 19289762338dSopenharmony_ci ret = g_usbInterface->RegBulkCallback(dev, pipe, usbdBulkCallback); 19299762338dSopenharmony_ci HDF_LOGI( 19309762338dSopenharmony_ci "UsbdTransferTest::SUB_USB_HostManager_HDI_TranCompatibility_8100 %{public}d RegBulkCallback=%{public}d", 19319762338dSopenharmony_ci __LINE__, ret); 19329762338dSopenharmony_ci ASSERT_EQ(ret, 0); 19339762338dSopenharmony_ci dev.busNum = BUS_NUM_INVALID; 19349762338dSopenharmony_ci ret = g_usbInterface->BulkCancel(dev, pipe); 19359762338dSopenharmony_ci HDF_LOGI( 19369762338dSopenharmony_ci "UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_8100 %{public}d BulkCancel=%{public}d", 19379762338dSopenharmony_ci __LINE__, ret); 19389762338dSopenharmony_ci ASSERT_NE(0, ret); 19399762338dSopenharmony_ci dev = dev_; 19409762338dSopenharmony_ci ret = g_usbInterface->UnRegBulkCallback(dev, pipe); 19419762338dSopenharmony_ci HDF_LOGI( 19429762338dSopenharmony_ci "UsbdTransferTest::SUB_USB_HostManager_HDI_TranCompatibility_8100 %{public}d UnRegBulkCallback=%{public}d", 19439762338dSopenharmony_ci __LINE__, ret); 19449762338dSopenharmony_ci ASSERT_EQ(ret, 0); 19459762338dSopenharmony_ci} 19469762338dSopenharmony_ci 19479762338dSopenharmony_ci/** 19489762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_TranCompatibility_8200 19499762338dSopenharmony_ci * @tc.desc: Test functions to BulkCancel 19509762338dSopenharmony_ci * @tc.desc: int32_t BulkCancel(const UsbDev &dev, const UsbPipe &pipe); 19519762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, devAddr error 19529762338dSopenharmony_ci * @tc.type: FUNC 19539762338dSopenharmony_ci */ 19549762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_TranCompatibility_8200, Function | MediumTest | Level1) 19559762338dSopenharmony_ci{ 19569762338dSopenharmony_ci struct UsbDev dev = dev_; 19579762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 19589762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_IN; 19599762338dSopenharmony_ci struct UsbPipe pipe = {interfaceId, pointId}; 19609762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 19619762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_8200 %{public}d ClaimInterface=%{public}d", 19629762338dSopenharmony_ci __LINE__, ret); 19639762338dSopenharmony_ci ASSERT_EQ(0, ret); 19649762338dSopenharmony_ci sptr<UsbdBulkCallbackTest> usbdBulkCallback = new UsbdBulkCallbackTest(); 19659762338dSopenharmony_ci ret = g_usbInterface->RegBulkCallback(dev, pipe, usbdBulkCallback); 19669762338dSopenharmony_ci HDF_LOGI( 19679762338dSopenharmony_ci "UsbdTransferTest::SUB_USB_HostManager_HDI_TranCompatibility_8200 %{public}d RegBulkCallback=%{public}d", 19689762338dSopenharmony_ci __LINE__, ret); 19699762338dSopenharmony_ci ASSERT_EQ(ret, 0); 19709762338dSopenharmony_ci dev.devAddr = DEV_ADDR_INVALID; 19719762338dSopenharmony_ci ret = g_usbInterface->BulkCancel(dev, pipe); 19729762338dSopenharmony_ci HDF_LOGI( 19739762338dSopenharmony_ci "UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_8200 %{public}d BulkCancel=%{public}d", 19749762338dSopenharmony_ci __LINE__, ret); 19759762338dSopenharmony_ci ASSERT_NE(0, ret); 19769762338dSopenharmony_ci dev = dev_; 19779762338dSopenharmony_ci ret = g_usbInterface->UnRegBulkCallback(dev, pipe); 19789762338dSopenharmony_ci HDF_LOGI( 19799762338dSopenharmony_ci "UsbdTransferTest::SUB_USB_HostManager_HDI_TranCompatibility_8200 %{public}d UnRegBulkCallback=%{public}d", 19809762338dSopenharmony_ci __LINE__, ret); 19819762338dSopenharmony_ci ASSERT_EQ(ret, 0); 19829762338dSopenharmony_ci} 19839762338dSopenharmony_ci 19849762338dSopenharmony_ci/** 19859762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_TranCompatibility_8300 19869762338dSopenharmony_ci * @tc.desc: Test functions to BulkCancel 19879762338dSopenharmony_ci * @tc.desc: int32_t BulkCancel(const UsbDev &dev, const UsbPipe &pipe); 19889762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, busNum && devAddr && interfaceid error 19899762338dSopenharmony_ci * @tc.type: FUNC 19909762338dSopenharmony_ci */ 19919762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_TranCompatibility_8300, Function | MediumTest | Level1) 19929762338dSopenharmony_ci{ 19939762338dSopenharmony_ci struct UsbDev dev = dev_; 19949762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 19959762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_IN; 19969762338dSopenharmony_ci struct UsbPipe pipe = {interfaceId, pointId}; 19979762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 19989762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_8300 %{public}d ClaimInterface=%{public}d", 19999762338dSopenharmony_ci __LINE__, ret); 20009762338dSopenharmony_ci ASSERT_EQ(0, ret); 20019762338dSopenharmony_ci sptr<UsbdBulkCallbackTest> usbdBulkCallback = new UsbdBulkCallbackTest(); 20029762338dSopenharmony_ci ret = g_usbInterface->RegBulkCallback(dev, pipe, usbdBulkCallback); 20039762338dSopenharmony_ci HDF_LOGI( 20049762338dSopenharmony_ci "UsbdTransferTest::SUB_USB_HostManager_HDI_TranCompatibility_8300 %{public}d RegBulkCallback=%{public}d", 20059762338dSopenharmony_ci __LINE__, ret); 20069762338dSopenharmony_ci ASSERT_EQ(ret, 0); 20079762338dSopenharmony_ci dev.busNum = BUS_NUM_INVALID; 20089762338dSopenharmony_ci dev.devAddr = DEV_ADDR_INVALID; 20099762338dSopenharmony_ci pipe.intfId = POINTID_INVALID; 20109762338dSopenharmony_ci ret = g_usbInterface->BulkCancel(dev, pipe); 20119762338dSopenharmony_ci HDF_LOGI( 20129762338dSopenharmony_ci "UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_8300 %{public}d BulkCancel=%{public}d", 20139762338dSopenharmony_ci __LINE__, ret); 20149762338dSopenharmony_ci ASSERT_NE(0, ret); 20159762338dSopenharmony_ci dev = dev_; 20169762338dSopenharmony_ci pipe = {interfaceId, pointId}; 20179762338dSopenharmony_ci ret = g_usbInterface->UnRegBulkCallback(dev, pipe); 20189762338dSopenharmony_ci HDF_LOGI( 20199762338dSopenharmony_ci "UsbdTransferTest::SUB_USB_HostManager_HDI_TranCompatibility_8300 %{public}d UnRegBulkCallback=%{public}d", 20209762338dSopenharmony_ci __LINE__, ret); 20219762338dSopenharmony_ci ASSERT_EQ(ret, 0); 20229762338dSopenharmony_ci} 20239762338dSopenharmony_ci 20249762338dSopenharmony_ci/** 20259762338dSopenharmony_ci * @tc.name: SUB_USB_HostManager_HDI_TranCompatibility_8400 20269762338dSopenharmony_ci * @tc.desc: Test functions to BulkCancel 20279762338dSopenharmony_ci * @tc.desc: int32_t BulkCancel(const UsbDev &dev, const UsbPipe &pipe); 20289762338dSopenharmony_ci * @tc.desc: Negative test: parameters exception, intfId error 20299762338dSopenharmony_ci * @tc.type: FUNC 20309762338dSopenharmony_ci */ 20319762338dSopenharmony_ciHWTEST_F(UsbdRequestTest, SUB_USB_HostManager_HDI_TranCompatibility_8400, Function | MediumTest | Level1) 20329762338dSopenharmony_ci{ 20339762338dSopenharmony_ci struct UsbDev dev = dev_; 20349762338dSopenharmony_ci uint8_t interfaceId = INTERFACEID_OK; 20359762338dSopenharmony_ci uint8_t pointId = POINTID_DIR_IN; 20369762338dSopenharmony_ci struct UsbPipe pipe = {interfaceId, pointId}; 20379762338dSopenharmony_ci auto ret = g_usbInterface->ClaimInterface(dev, interfaceId, 1); 20389762338dSopenharmony_ci HDF_LOGI("UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_8400 %{public}d ClaimInterface=%{public}d", 20399762338dSopenharmony_ci __LINE__, ret); 20409762338dSopenharmony_ci ASSERT_EQ(0, ret); 20419762338dSopenharmony_ci sptr<UsbdBulkCallbackTest> usbdBulkCallback = new UsbdBulkCallbackTest(); 20429762338dSopenharmony_ci ret = g_usbInterface->RegBulkCallback(dev, pipe, usbdBulkCallback); 20439762338dSopenharmony_ci HDF_LOGI( 20449762338dSopenharmony_ci "UsbdTransferTest::SUB_USB_HostManager_HDI_TranCompatibility_8400 %{public}d RegBulkCallback=%{public}d", 20459762338dSopenharmony_ci __LINE__, ret); 20469762338dSopenharmony_ci ASSERT_EQ(ret, 0); 20479762338dSopenharmony_ci pipe.intfId = POINTID_INVALID; 20489762338dSopenharmony_ci ret = g_usbInterface->BulkCancel(dev, pipe); 20499762338dSopenharmony_ci HDF_LOGI( 20509762338dSopenharmony_ci "UsbdRequestTest::SUB_USB_HostManager_HDI_TranCompatibility_8400 %{public}d BulkCancel=%{public}d", 20519762338dSopenharmony_ci __LINE__, ret); 20529762338dSopenharmony_ci ASSERT_NE(0, ret); 20539762338dSopenharmony_ci pipe = {interfaceId, pointId}; 20549762338dSopenharmony_ci ret = g_usbInterface->UnRegBulkCallback(dev, pipe); 20559762338dSopenharmony_ci HDF_LOGI( 20569762338dSopenharmony_ci "UsbdTransferTest::SUB_USB_HostManager_HDI_TranCompatibility_8400 %{public}d UnRegBulkCallback=%{public}d", 20579762338dSopenharmony_ci __LINE__, ret); 20589762338dSopenharmony_ci ASSERT_EQ(ret, 0); 20599762338dSopenharmony_ci} 20609762338dSopenharmony_ci} // namespace 2061