|
|
|
@ -77,7 +77,7 @@ static int32_t InitAshmemOne(sptr<Ashmem> &asmptr, int32_t asmSize, uint8_t rflg
|
|
|
|
|
|
|
|
|
|
void UsbBulkcallbackTest::SetUpTestCase(void)
|
|
|
|
|
{
|
|
|
|
|
UsbCommonTest::SetTestCaseHapApply();
|
|
|
|
|
UsbCommonTest::GrantPermissionSysNative();
|
|
|
|
|
auto &srvClient = UsbSrvClient::GetInstance();
|
|
|
|
|
auto ret = srvClient.SetPortRole(1, 1, 1);
|
|
|
|
|
sleep(SLEEP_TIME);
|
|
|
|
@ -120,33 +120,33 @@ HWTEST_F(UsbBulkcallbackTest, RegBulkCallback001, TestSize.Level1)
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
EXPECT_TRUE(!(devi.empty())) << "delist NULL";
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback001 %{public}d size=%{public}zu", __LINE__,
|
|
|
|
|
devi.size());
|
|
|
|
|
devi.size());
|
|
|
|
|
USBDevicePipe pipe;
|
|
|
|
|
UsbDevice device = devi.front();
|
|
|
|
|
UsbSrvClient.RequestRight(device.GetName());
|
|
|
|
|
ret = UsbSrvClient.OpenDevice(device, pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback001 %{public}d OpenDevice=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback001 %{public}d OpenDevice=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
UsbInterface interface = device.GetConfigs().front().GetInterfaces().at(1);
|
|
|
|
|
USBEndpoint point = interface.GetEndpoints().front();
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback001 %{public}d point=%{public}d", __LINE__,
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
ret = UsbSrvClient.ClaimInterface(pipe, interface, true);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback001 %{public}d ClaimInterface=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.RegBulkCallback(pipe, point, cb);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback001 %{public}d RegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.UnRegBulkCallback(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback001 %{public}d UnRegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
bool close = UsbSrvClient.Close(pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback001 %{public}d close=%{public}d", __LINE__,
|
|
|
|
|
close);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback001 %{public}d close=%{public}d", __LINE__, close);
|
|
|
|
|
EXPECT_TRUE(close);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "Case End : RegBulkCallback001 : BulkTransfer");
|
|
|
|
|
}
|
|
|
|
@ -168,33 +168,33 @@ HWTEST_F(UsbBulkcallbackTest, RegBulkCallback002, TestSize.Level1)
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
EXPECT_TRUE(!(devi.empty())) << "delist NULL";
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback002 %{public}d size=%{public}zu", __LINE__,
|
|
|
|
|
devi.size());
|
|
|
|
|
devi.size());
|
|
|
|
|
USBDevicePipe pipe;
|
|
|
|
|
UsbDevice device = devi.front();
|
|
|
|
|
UsbSrvClient.RequestRight(device.GetName());
|
|
|
|
|
ret = UsbSrvClient.OpenDevice(device, pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback002 %{public}d OpenDevice=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback002 %{public}d OpenDevice=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
UsbInterface interface = device.GetConfigs().front().GetInterfaces().at(1);
|
|
|
|
|
USBEndpoint point = interface.GetEndpoints().at(1);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback002 %{public}d point=%{public}d", __LINE__,
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
ret = UsbSrvClient.ClaimInterface(pipe, interface, true);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback002 %{public}d ClaimInterface=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.RegBulkCallback(pipe, point, cb);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback002 %{public}d RegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.UnRegBulkCallback(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback002 %{public}d UnRegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
bool close = UsbSrvClient.Close(pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback002 %{public}d close=%{public}d", __LINE__,
|
|
|
|
|
close);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback002 %{public}d close=%{public}d", __LINE__, close);
|
|
|
|
|
EXPECT_TRUE(close);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "Case End : RegBulkCallback002 : BulkTransfer");
|
|
|
|
|
}
|
|
|
|
@ -216,35 +216,35 @@ HWTEST_F(UsbBulkcallbackTest, RegBulkCallback003, TestSize.Level1)
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
EXPECT_TRUE(!(devi.empty())) << "delist NULL";
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback003 %{public}d size=%{public}zu", __LINE__,
|
|
|
|
|
devi.size());
|
|
|
|
|
devi.size());
|
|
|
|
|
USBDevicePipe pipe;
|
|
|
|
|
UsbDevice device = devi.front();
|
|
|
|
|
UsbSrvClient.RequestRight(device.GetName());
|
|
|
|
|
ret = UsbSrvClient.OpenDevice(device, pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback003 %{public}d OpenDevice=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback003 %{public}d OpenDevice=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
UsbInterface interface = device.GetConfigs().front().GetInterfaces().at(1);
|
|
|
|
|
USBEndpoint point = interface.GetEndpoints().at(1);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback003 %{public}d point=%{public}d", __LINE__,
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
ret = UsbSrvClient.ClaimInterface(pipe, interface, true);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback003 %{public}d ClaimInterface=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
pipe.SetBusNum(BUFFER_SIZE);
|
|
|
|
|
ret = UsbSrvClient.RegBulkCallback(pipe, point, cb);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback003 %{public}d RegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret != 0);
|
|
|
|
|
ret = UsbSrvClient.UnRegBulkCallback(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback003 %{public}d UnRegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret != 0);
|
|
|
|
|
pipe.SetBusNum(device.GetBusNum());
|
|
|
|
|
bool close = UsbSrvClient.Close(pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback003 %{public}d close=%{public}d", __LINE__,
|
|
|
|
|
close);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback003 %{public}d close=%{public}d", __LINE__, close);
|
|
|
|
|
EXPECT_TRUE(close);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "Case End : RegBulkCallback003 : BulkTransfer");
|
|
|
|
|
}
|
|
|
|
@ -266,35 +266,35 @@ HWTEST_F(UsbBulkcallbackTest, RegBulkCallback004, TestSize.Level1)
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
EXPECT_TRUE(!(devi.empty())) << "delist NULL";
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback004 %{public}d size=%{public}zu", __LINE__,
|
|
|
|
|
devi.size());
|
|
|
|
|
devi.size());
|
|
|
|
|
USBDevicePipe pipe;
|
|
|
|
|
UsbDevice device = devi.front();
|
|
|
|
|
UsbSrvClient.RequestRight(device.GetName());
|
|
|
|
|
ret = UsbSrvClient.OpenDevice(device, pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback004 %{public}d OpenDevice=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback004 %{public}d OpenDevice=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
UsbInterface interface = device.GetConfigs().front().GetInterfaces().at(1);
|
|
|
|
|
USBEndpoint point = interface.GetEndpoints().at(1);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback004 %{public}d point=%{public}d", __LINE__,
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
ret = UsbSrvClient.ClaimInterface(pipe, interface, true);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback004 %{public}d ClaimInterface=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
pipe.SetDevAddr(BUFFER_SIZE);
|
|
|
|
|
ret = UsbSrvClient.RegBulkCallback(pipe, point, cb);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback004 %{public}d RegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret != 0);
|
|
|
|
|
ret = UsbSrvClient.UnRegBulkCallback(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback004 %{public}d UnRegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret != 0);
|
|
|
|
|
pipe.SetDevAddr(device.GetDevAddr());
|
|
|
|
|
bool close = UsbSrvClient.Close(pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback004 %{public}d close=%{public}d", __LINE__,
|
|
|
|
|
close);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback004 %{public}d close=%{public}d", __LINE__, close);
|
|
|
|
|
EXPECT_TRUE(close);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "Case End : RegBulkCallback004 : BulkTransfer");
|
|
|
|
|
}
|
|
|
|
@ -316,35 +316,35 @@ HWTEST_F(UsbBulkcallbackTest, RegBulkCallback005, TestSize.Level1)
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
EXPECT_TRUE(!(devi.empty())) << "delist NULL";
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback005 %{public}d size=%{public}zu", __LINE__,
|
|
|
|
|
devi.size());
|
|
|
|
|
devi.size());
|
|
|
|
|
USBDevicePipe pipe;
|
|
|
|
|
UsbDevice device = devi.front();
|
|
|
|
|
UsbSrvClient.RequestRight(device.GetName());
|
|
|
|
|
ret = UsbSrvClient.OpenDevice(device, pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback005 %{public}d OpenDevice=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback005 %{public}d OpenDevice=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
UsbInterface interface = device.GetConfigs().front().GetInterfaces().at(1);
|
|
|
|
|
USBEndpoint point = interface.GetEndpoints().at(0);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback005 %{public}d point=%{public}d", __LINE__,
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
ret = UsbSrvClient.ClaimInterface(pipe, interface, true);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback005 %{public}d ClaimInterface=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
pipe.SetDevAddr(BUFFER_SIZE);
|
|
|
|
|
ret = UsbSrvClient.RegBulkCallback(pipe, point, cb);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback005 %{public}d RegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret != 0);
|
|
|
|
|
ret = UsbSrvClient.UnRegBulkCallback(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback005 %{public}d UnRegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret != 0);
|
|
|
|
|
pipe.SetDevAddr(device.GetDevAddr());
|
|
|
|
|
bool close = UsbSrvClient.Close(pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback005 %{public}d close=%{public}d", __LINE__,
|
|
|
|
|
close);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback005 %{public}d close=%{public}d", __LINE__, close);
|
|
|
|
|
EXPECT_TRUE(close);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "Case End : RegBulkCallback005 : BulkTransfer");
|
|
|
|
|
}
|
|
|
|
@ -366,35 +366,35 @@ HWTEST_F(UsbBulkcallbackTest, RegBulkCallback006, TestSize.Level1)
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
EXPECT_TRUE(!(devi.empty())) << "delist NULL";
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback006 %{public}d size=%{public}zu", __LINE__,
|
|
|
|
|
devi.size());
|
|
|
|
|
devi.size());
|
|
|
|
|
USBDevicePipe pipe;
|
|
|
|
|
UsbDevice device = devi.front();
|
|
|
|
|
UsbSrvClient.RequestRight(device.GetName());
|
|
|
|
|
ret = UsbSrvClient.OpenDevice(device, pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback006 %{public}d OpenDevice=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback006 %{public}d OpenDevice=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
UsbInterface interface = device.GetConfigs().front().GetInterfaces().at(1);
|
|
|
|
|
USBEndpoint point = interface.GetEndpoints().at(0);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback006 %{public}d point=%{public}d", __LINE__,
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
ret = UsbSrvClient.ClaimInterface(pipe, interface, true);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback006 %{public}d ClaimInterface=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
pipe.SetBusNum(BUFFER_SIZE);
|
|
|
|
|
ret = UsbSrvClient.RegBulkCallback(pipe, point, cb);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback006 %{public}d RegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret != 0);
|
|
|
|
|
ret = UsbSrvClient.UnRegBulkCallback(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback006 %{public}d UnRegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret != 0);
|
|
|
|
|
pipe.SetBusNum(device.GetBusNum());
|
|
|
|
|
bool close = UsbSrvClient.Close(pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback006 %{public}d close=%{public}d", __LINE__,
|
|
|
|
|
close);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::RegBulkCallback006 %{public}d close=%{public}d", __LINE__, close);
|
|
|
|
|
EXPECT_TRUE(close);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "Case End : RegBulkCallback006 : BulkTransfer");
|
|
|
|
|
}
|
|
|
|
@ -427,21 +427,21 @@ HWTEST_F(UsbBulkcallbackTest, BulkRead001, TestSize.Level1)
|
|
|
|
|
UsbInterface interface = device.GetConfigs().front().GetInterfaces().at(1);
|
|
|
|
|
USBEndpoint point = interface.GetEndpoints().front();
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead001 %{public}d point=%{public}d", __LINE__,
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
ret = UsbSrvClient.ClaimInterface(pipe, interface, true);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead001 %{public}d ClaimInterface=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead001 %{public}d ClaimInterface=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.RegBulkCallback(pipe, point, cb);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead001 %{public}d RegBulkCallback=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead001 %{public}d RegBulkCallback=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.BulkRead(pipe, point, ashmem);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead001 %{public}d BulkRead=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.UnRegBulkCallback(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead001 %{public}d UnRegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead001 %{public}d UnRegBulkCallback=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.BulkCancel(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead001 %{public}d BulkCancel=%{public}d", __LINE__, ret);
|
|
|
|
@ -480,21 +480,21 @@ HWTEST_F(UsbBulkcallbackTest, BulkRead002, TestSize.Level1)
|
|
|
|
|
UsbInterface interface = device.GetConfigs().front().GetInterfaces().at(1);
|
|
|
|
|
USBEndpoint point = interface.GetEndpoints().at(1);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead002 %{public}d point=%{public}d", __LINE__,
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
ret = UsbSrvClient.ClaimInterface(pipe, interface, true);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead002 %{public}d ClaimInterface=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead002 %{public}d ClaimInterface=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.RegBulkCallback(pipe, point, cb);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead002 %{public}d RegBulkCallback=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead002 %{public}d RegBulkCallback=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.BulkRead(pipe, point, ashmem);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead002 %{public}d BulkRead=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret != 0);
|
|
|
|
|
ret = UsbSrvClient.UnRegBulkCallback(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead002 %{public}d UnRegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead002 %{public}d UnRegBulkCallback=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.BulkCancel(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead002 %{public}d BulkCancel=%{public}d", __LINE__, ret);
|
|
|
|
@ -533,14 +533,14 @@ HWTEST_F(UsbBulkcallbackTest, BulkRead003, TestSize.Level1)
|
|
|
|
|
UsbInterface interface = device.GetConfigs().front().GetInterfaces().at(1);
|
|
|
|
|
USBEndpoint point = interface.GetEndpoints().front();
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead003 %{public}d point=%{public}d", __LINE__,
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
ret = UsbSrvClient.ClaimInterface(pipe, interface, true);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead003 %{public}d ClaimInterface=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead003 %{public}d ClaimInterface=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.RegBulkCallback(pipe, point, cb);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead003 %{public}d RegBulkCallback=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead003 %{public}d RegBulkCallback=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
pipe.SetBusNum(BUFFER_SIZE);
|
|
|
|
|
ret = UsbSrvClient.BulkRead(pipe, point, ashmem);
|
|
|
|
@ -548,8 +548,8 @@ HWTEST_F(UsbBulkcallbackTest, BulkRead003, TestSize.Level1)
|
|
|
|
|
EXPECT_TRUE(ret != 0);
|
|
|
|
|
pipe.SetBusNum(device.GetBusNum());
|
|
|
|
|
ret = UsbSrvClient.UnRegBulkCallback(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead003 %{public}d UnRegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead003 %{public}d UnRegBulkCallback=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.BulkCancel(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead003 %{public}d BulkCancel=%{public}d", __LINE__, ret);
|
|
|
|
@ -588,14 +588,14 @@ HWTEST_F(UsbBulkcallbackTest, BulkRead004, TestSize.Level1)
|
|
|
|
|
UsbInterface interface = device.GetConfigs().front().GetInterfaces().at(1);
|
|
|
|
|
USBEndpoint point = interface.GetEndpoints().front();
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead004 %{public}d point=%{public}d", __LINE__,
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
ret = UsbSrvClient.ClaimInterface(pipe, interface, true);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead004 %{public}d ClaimInterface=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead004 %{public}d ClaimInterface=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.RegBulkCallback(pipe, point, cb);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead004 %{public}d RegBulkCallback=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead004 %{public}d RegBulkCallback=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
pipe.SetDevAddr(BUFFER_SIZE);
|
|
|
|
|
ret = UsbSrvClient.BulkRead(pipe, point, ashmem);
|
|
|
|
@ -603,8 +603,8 @@ HWTEST_F(UsbBulkcallbackTest, BulkRead004, TestSize.Level1)
|
|
|
|
|
EXPECT_TRUE(ret != 0);
|
|
|
|
|
pipe.SetDevAddr(device.GetDevAddr());
|
|
|
|
|
ret = UsbSrvClient.UnRegBulkCallback(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead004 %{public}d UnRegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead004 %{public}d UnRegBulkCallback=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.BulkCancel(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkRead004 %{public}d BulkCancel=%{public}d", __LINE__, ret);
|
|
|
|
@ -638,31 +638,29 @@ HWTEST_F(UsbBulkcallbackTest, BulkWrite001, TestSize.Level1)
|
|
|
|
|
UsbDevice device = devi.front();
|
|
|
|
|
UsbSrvClient.RequestRight(device.GetName());
|
|
|
|
|
ret = UsbSrvClient.OpenDevice(device, pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite001 %{public}d OpenDevice=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite001 %{public}d OpenDevice=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
UsbInterface interface = device.GetConfigs().front().GetInterfaces().at(1);
|
|
|
|
|
USBEndpoint point = interface.GetEndpoints().at(1);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite001 %{public}d point=%{public}d", __LINE__,
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
ret = UsbSrvClient.ClaimInterface(pipe, interface, true);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite001 %{public}d ClaimInterface=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite001 %{public}d ClaimInterface=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.RegBulkCallback(pipe, point, cb);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite001 %{public}d RegBulkCallback=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite001 %{public}d RegBulkCallback=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.BulkWrite(pipe, point, ashmem);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite001 %{public}d BulkWrite=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.UnRegBulkCallback(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite001 %{public}d UnRegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite001 %{public}d UnRegBulkCallback=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.BulkCancel(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite001 %{public}d BulkCancel=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite001 %{public}d BulkCancel=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
bool close = UsbSrvClient.Close(pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite001 %{public}d close=%{public}d", __LINE__, close);
|
|
|
|
@ -693,20 +691,19 @@ HWTEST_F(UsbBulkcallbackTest, BulkWrite002, TestSize.Level1)
|
|
|
|
|
UsbDevice device = devi.front();
|
|
|
|
|
UsbSrvClient.RequestRight(device.GetName());
|
|
|
|
|
ret = UsbSrvClient.OpenDevice(device, pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite002 %{public}d OpenDevice=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite002 %{public}d OpenDevice=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
UsbInterface interface = device.GetConfigs().front().GetInterfaces().at(1);
|
|
|
|
|
USBEndpoint point = interface.GetEndpoints().at(1);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite002 %{public}d point=%{public}d", __LINE__,
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
ret = UsbSrvClient.ClaimInterface(pipe, interface, true);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite002 %{public}d ClaimInterface=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite002 %{public}d ClaimInterface=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.RegBulkCallback(pipe, point, cb);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite002 %{public}d RegBulkCallback=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite002 %{public}d RegBulkCallback=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
pipe.SetBusNum(BUFFER_SIZE);
|
|
|
|
|
ret = UsbSrvClient.BulkWrite(pipe, point, ashmem);
|
|
|
|
@ -714,12 +711,11 @@ HWTEST_F(UsbBulkcallbackTest, BulkWrite002, TestSize.Level1)
|
|
|
|
|
EXPECT_TRUE(ret != 0);
|
|
|
|
|
pipe.SetBusNum(device.GetBusNum());
|
|
|
|
|
ret = UsbSrvClient.UnRegBulkCallback(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite002 %{public}d UnRegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite002 %{public}d UnRegBulkCallback=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.BulkCancel(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite002 %{public}d BulkCancel=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite002 %{public}d BulkCancel=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
bool close = UsbSrvClient.Close(pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite002 %{public}d close=%{public}d", __LINE__, close);
|
|
|
|
@ -750,20 +746,19 @@ HWTEST_F(UsbBulkcallbackTest, BulkWrite003, TestSize.Level1)
|
|
|
|
|
UsbDevice device = devi.front();
|
|
|
|
|
UsbSrvClient.RequestRight(device.GetName());
|
|
|
|
|
ret = UsbSrvClient.OpenDevice(device, pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite003 %{public}d OpenDevice=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite003 %{public}d OpenDevice=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
UsbInterface interface = device.GetConfigs().front().GetInterfaces().at(1);
|
|
|
|
|
USBEndpoint point = interface.GetEndpoints().at(1);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite003 %{public}d point=%{public}d", __LINE__,
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
ret = UsbSrvClient.ClaimInterface(pipe, interface, true);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite003 %{public}d ClaimInterface=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite003 %{public}d ClaimInterface=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.RegBulkCallback(pipe, point, cb);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite003 %{public}d RegBulkCallback=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite003 %{public}d RegBulkCallback=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
pipe.SetDevAddr(BUFFER_SIZE);
|
|
|
|
|
ret = UsbSrvClient.BulkWrite(pipe, point, ashmem);
|
|
|
|
@ -771,12 +766,11 @@ HWTEST_F(UsbBulkcallbackTest, BulkWrite003, TestSize.Level1)
|
|
|
|
|
EXPECT_TRUE(ret != 0);
|
|
|
|
|
pipe.SetDevAddr(device.GetDevAddr());
|
|
|
|
|
ret = UsbSrvClient.UnRegBulkCallback(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite003 %{public}d UnRegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite003 %{public}d UnRegBulkCallback=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.BulkCancel(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite003 %{public}d BulkCancel=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite003 %{public}d BulkCancel=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
bool close = UsbSrvClient.Close(pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkWrite003 %{public}d close=%{public}d", __LINE__, close);
|
|
|
|
@ -812,25 +806,25 @@ HWTEST_F(UsbBulkcallbackTest, BulkCancel001, TestSize.Level1)
|
|
|
|
|
ret = UsbSrvClient.ClaimInterface(pipe, interface, true);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.RegBulkCallback(pipe, point, cb);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkCancel001 %{public}d RegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkCancel001 %{public}d RegBulkCallback=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.BulkRead(pipe, point, ashmem);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkCancel001 %{public}d BulkRead=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.UnRegBulkCallback(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkCancel001 %{public}d UnRegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
pipe.SetBusNum(BUFFER_SIZE);
|
|
|
|
|
ret = UsbSrvClient.BulkCancel(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkCancel001 %{public}d BulkCancel=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkCancel001 %{public}d BulkCancel=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret != 0);
|
|
|
|
|
pipe.SetBusNum(device.GetBusNum());
|
|
|
|
|
ret = UsbSrvClient.BulkCancel(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkCancel002 %{public}d BulkCancel=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkCancel002 %{public}d BulkCancel=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
bool close = UsbSrvClient.Close(pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkCancel001 %{public}d close=%{public}d", __LINE__, close);
|
|
|
|
@ -861,33 +855,33 @@ HWTEST_F(UsbBulkcallbackTest, BulkCancel002, TestSize.Level1)
|
|
|
|
|
UsbDevice device = devi.front();
|
|
|
|
|
UsbSrvClient.RequestRight(device.GetName());
|
|
|
|
|
ret = UsbSrvClient.OpenDevice(device, pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkCancel002 %{public}d OpenDevice=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkCancel002 %{public}d OpenDevice=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
UsbInterface interface = device.GetConfigs().front().GetInterfaces().at(1);
|
|
|
|
|
USBEndpoint point = interface.GetEndpoints().front();
|
|
|
|
|
ret = UsbSrvClient.ClaimInterface(pipe, interface, true);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.RegBulkCallback(pipe, point, cb);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkCancel002 %{public}d RegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkCancel002 %{public}d RegBulkCallback=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.BulkRead(pipe, point, ashmem);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkCancel002 %{public}d BulkRead=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.UnRegBulkCallback(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkCancel002 %{public}d UnRegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
pipe.SetDevAddr(BUFFER_SIZE);
|
|
|
|
|
ret = UsbSrvClient.BulkCancel(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkCancel002 %{public}d BulkCancel=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkCancel002 %{public}d BulkCancel=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret != 0);
|
|
|
|
|
pipe.SetDevAddr(device.GetDevAddr());
|
|
|
|
|
ret = UsbSrvClient.BulkCancel(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkCancel002 %{public}d BulkCancel=%{public}d", __LINE__,
|
|
|
|
|
ret);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkCancel002 %{public}d BulkCancel=%{public}d", __LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
bool close = UsbSrvClient.Close(pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::BulkCancel002 %{public}d close=%{public}d", __LINE__, close);
|
|
|
|
@ -910,33 +904,33 @@ HWTEST_F(UsbBulkcallbackTest, UnRegBulkCallback001, TestSize.Level1)
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
EXPECT_TRUE(!(devi.empty())) << "delist NULL";
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::UnRegBulkCallback001 %{public}d size=%{public}zu", __LINE__,
|
|
|
|
|
devi.size());
|
|
|
|
|
devi.size());
|
|
|
|
|
USBDevicePipe pipe;
|
|
|
|
|
UsbDevice device = devi.front();
|
|
|
|
|
UsbSrvClient.RequestRight(device.GetName());
|
|
|
|
|
ret = UsbSrvClient.OpenDevice(device, pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::UnRegBulkCallback001 %{public}d OpenDevice=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
UsbInterface interface = device.GetConfigs().front().GetInterfaces().at(1);
|
|
|
|
|
USBEndpoint point = interface.GetEndpoints().front();
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::UnRegBulkCallback001 %{public}d point=%{public}d", __LINE__,
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
ret = UsbSrvClient.ClaimInterface(pipe, interface, true);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::UnRegBulkCallback001 %{public}d ClaimInterface=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.RegBulkCallback(pipe, point, cb);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::UnRegBulkCallback001 %{public}d RegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
ret = UsbSrvClient.UnRegBulkCallback(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::UnRegBulkCallback001 %{public}d UnRegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
bool close = UsbSrvClient.Close(pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::UnRegBulkCallback001 %{public}d close=%{public}d", __LINE__,
|
|
|
|
|
close);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::UnRegBulkCallback001 %{public}d close=%{public}d", __LINE__, close);
|
|
|
|
|
EXPECT_TRUE(close);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "Case End : UnRegBulkCallback001 : BulkTransfer");
|
|
|
|
|
}
|
|
|
|
@ -960,29 +954,29 @@ HWTEST_F(UsbBulkcallbackTest, UnRegBulkCallback002, TestSize.Level1)
|
|
|
|
|
UsbSrvClient.RequestRight(device.GetName());
|
|
|
|
|
ret = UsbSrvClient.OpenDevice(device, pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::UnRegBulkCallback002 %{public}d OpenDevice=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
UsbInterface interface = device.GetConfigs().front().GetInterfaces().at(1);
|
|
|
|
|
USBEndpoint point = interface.GetEndpoints().front();
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::UnRegBulkCallback002 %{public}d point=%{public}d", __LINE__,
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
ret = UsbSrvClient.ClaimInterface(pipe, interface, true);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::UnRegBulkCallback002 %{public}d ClaimInterface=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
pipe.SetBusNum(BUFFER_SIZE);
|
|
|
|
|
ret = UsbSrvClient.RegBulkCallback(pipe, point, cb);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::UnRegBulkCallback002 %{public}d RegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret != 0);
|
|
|
|
|
ret = UsbSrvClient.UnRegBulkCallback(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::UnRegBulkCallback002 %{public}d UnRegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret != 0);
|
|
|
|
|
pipe.SetBusNum(device.GetBusNum());
|
|
|
|
|
bool close = UsbSrvClient.Close(pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::UnRegBulkCallback002 %{public}d close=%{public}d", __LINE__,
|
|
|
|
|
close);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::UnRegBulkCallback002 %{public}d close=%{public}d", __LINE__, close);
|
|
|
|
|
EXPECT_TRUE(close);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "Case End : UnRegBulkCallback002 : BulkTransfer");
|
|
|
|
|
}
|
|
|
|
@ -1002,38 +996,38 @@ HWTEST_F(UsbBulkcallbackTest, UnRegBulkCallback003, TestSize.Level1)
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
EXPECT_TRUE(!(devi.empty())) << "delist NULL";
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::UnRegBulkCallback003 %{public}d size=%{public}zu", __LINE__,
|
|
|
|
|
devi.size());
|
|
|
|
|
devi.size());
|
|
|
|
|
USBDevicePipe pipe;
|
|
|
|
|
UsbDevice device = devi.front();
|
|
|
|
|
UsbSrvClient.RequestRight(device.GetName());
|
|
|
|
|
ret = UsbSrvClient.OpenDevice(device, pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::UnRegBulkCallback003 %{public}d OpenDevice=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
UsbInterface interface = device.GetConfigs().front().GetInterfaces().at(1);
|
|
|
|
|
USBEndpoint point = interface.GetEndpoints().front();
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::UnRegBulkCallback003 %{public}d point=%{public}d", __LINE__,
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
point.GetInterfaceId());
|
|
|
|
|
ret = UsbSrvClient.ClaimInterface(pipe, interface, true);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::UnRegBulkCallback003 %{public}d ClaimInterface=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret == 0);
|
|
|
|
|
pipe.SetDevAddr(BUFFER_SIZE);
|
|
|
|
|
ret = UsbSrvClient.RegBulkCallback(pipe, point, cb);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::UnRegBulkCallback003 %{public}d RegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret != 0);
|
|
|
|
|
ret = UsbSrvClient.UnRegBulkCallback(pipe, point);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::UnRegBulkCallback003 %{public}d UnRegBulkCallback=%{public}d",
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
__LINE__, ret);
|
|
|
|
|
EXPECT_TRUE(ret != 0);
|
|
|
|
|
pipe.SetDevAddr(device.GetDevAddr());
|
|
|
|
|
bool close = UsbSrvClient.Close(pipe);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "UsbBulkcallbackTest::UnRegBulkCallback003 %{public}d close=%{public}d", __LINE__,
|
|
|
|
|
close);
|
|
|
|
|
USB_HILOGI(
|
|
|
|
|
MODULE_USB_SERVICE, "UsbBulkcallbackTest::UnRegBulkCallback003 %{public}d close=%{public}d", __LINE__, close);
|
|
|
|
|
EXPECT_TRUE(close);
|
|
|
|
|
USB_HILOGI(MODULE_USB_SERVICE, "Case End : UnRegBulkCallback003 : BulkTransfer");
|
|
|
|
|
}
|
|
|
|
|
} // BulkCallback
|
|
|
|
|
} // USB
|
|
|
|
|
} // OHOS
|
|
|
|
|
} // namespace BulkCallback
|
|
|
|
|
} // namespace USB
|
|
|
|
|
} // namespace OHOS
|
|
|
|
|