• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #include <cstdint>
16 #include <cstdio>
17 #include <cstdlib>
18 #include <fcntl.h>
19 #include <gtest/gtest.h>
20 #include <securec.h>
21 #include <string>
22 #include <unistd.h>
23 #include "input_device_manager.h"
24 #include "input_manager.h"
25 #include "osal_time.h"
26 #include "osal_mem.h"
27 #include "input_uhdf_log.h"
28 
29 using namespace testing::ext;
30 using namespace OHOS::Input;
31 static IInputInterface *g_inputInterface;
32 static InputEventCb g_callback;
33 static InputHostCb g_hotplugCb;
34 static int32_t g_touchIndex;
35 static uint32_t g_index = 1;
36 static int32_t g_fileDescriptorFirst = 3;
37 static int32_t g_fileDescriptorSecond = 4;
38 static uint32_t g_type = INDEV_TYPE_MOUSE;
39 static const int32_t KEEP_ALIVE_TIME_MS = 3000;
40 static const int32_t INVALID_INDEX = 15;
41 static const int32_t INVALID_INDEX1 = -1;
42 static const int32_t MAX_DEVICES = 32;
43 static const int32_t TEST_RESULT_LEN = 32;
44 static const int32_t TEST_TYPE = 2;
45 static const int32_t TEST_LEN1 = 10;
46 static const int32_t TEST_LEN2 = -1;
47 static const int32_t VALUE_NULL = 0;
48 static const int32_t VALUE_DEFAULT = 1;
49 static const uint32_t INIT_DEFAULT_VALUE = 255;
50 static const uint32_t STATUS = INPUT_DEVICE_STATUS_CLOSED;
51 static const string NODE_PATH = "dev/input/";
52 static const size_t COUNT = 1;
53 static const size_t INVALID_DEV_INDEX = 33;
54 
55 namespace {
56 std::string g_errLog;
MyLogCallback(const LogType type,const LogLevel level,const unsigned int domain,const char * tag,const char * msg)57 void MyLogCallback(const LogType type, const LogLevel level, const unsigned int domain, const char *tag,
58     const char *msg)
59 {
60     g_errLog = msg;
61 }
62 }
63 
64 class HdiInputTest : public testing::Test {
65 public:
66     static void SetUpTestCase();
67     static void TearDownTestCase();
68     void SetUp();
69     void TearDown();
70 };
71 
SetUpTestCase()72 void HdiInputTest::SetUpTestCase()
73 {
74     int32_t ret = GetInputInterface(&g_inputInterface);
75     if (ret != INPUT_SUCCESS) {
76         printf("%s: get input hdi failed, ret %d\n", __func__, ret);
77     }
78 }
79 
TearDownTestCase()80 void HdiInputTest::TearDownTestCase()
81 {
82     ReleaseInputInterface(&g_inputInterface);
83 }
84 
SetUp()85 void HdiInputTest::SetUp()
86 {
87 }
88 
TearDown()89 void HdiInputTest::TearDown()
90 {
91 }
92 
93 #define INPUT_CHECK_NULL_POINTER(pointer, ret) do { \
94     if ((pointer) == nullptr) { \
95         printf("%s: null pointer", __func__); \
96         ASSERT_EQ ((ret), INPUT_SUCCESS); \
97     } \
98 } while (0)
99 
ReportEventPkgCallback(const InputEventPackage ** pkgs,uint32_t count,uint32_t devIndex)100 static void ReportEventPkgCallback(const InputEventPackage **pkgs, uint32_t count, uint32_t devIndex)
101 {
102     if (pkgs == nullptr) {
103         printf("%s: pkgs is null\n", __func__);
104         return;
105     }
106     for (uint32_t i = 0; i < count; i++) {
107         printf("device action Index: %u devIndex: %u type: %u code: %u value %d\n",
108             i, devIndex, pkgs[i]->type, pkgs[i]->code, pkgs[i]->value);
109     }
110 }
111 
ReportHotPlugEventPkgCallback(const InputHotPlugEvent * msg)112 static void ReportHotPlugEventPkgCallback(const InputHotPlugEvent *msg)
113 {
114     if (msg == nullptr) {
115         printf("%s: msg is null\n", __func__);
116         return;
117     }
118     printf("%s: device hotplug action devIndex: %u devType: %u status: %u\n", __func__,
119         msg->devIndex, msg->devType, msg->status);
120     if (msg->status == INPUT_DEVICE_STATUS_OPENED) {
121         EXPECT_EQ(g_inputInterface->iInputManager->OpenInputDevice(msg->devIndex), INPUT_SUCCESS);
122     } else if (msg->status == INPUT_DEVICE_STATUS_CLOSED) {
123         EXPECT_EQ(g_inputInterface->iInputManager->CloseInputDevice(msg->devIndex), INPUT_SUCCESS);
124     } else {
125         // do nothing
126     }
127 }
128 
129 /**
130   * @tc.name: ScanInputDevice001
131   * @tc.desc: scan input device test
132   * @tc.type: FUNC
133   * @tc.require: AR000F867R
134   */
135 HWTEST_F(HdiInputTest, ScanInputDevice001, TestSize.Level1)
136 {
137     InputDevDesc sta[MAX_DEVICES];
138     if (memset_s(sta, MAX_DEVICES * sizeof(InputDevDesc), 0, MAX_DEVICES * sizeof(InputDevDesc)) != EOK) {
139         printf("%s: memset_s failed\n", __func__);
140         return;
141     }
142     printf("%s: [Input] ScanInputDevice001 enter %d\n", __func__, __LINE__);
143     int32_t ret;
144     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
145     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR);
146     ret  = g_inputInterface->iInputManager->ScanInputDevice(sta, sizeof(sta) / sizeof(InputDevDesc));
147     if (ret == INPUT_SUCCESS) {
148         printf("%s: ScanInputDevice result: %d, %d, %d, %d\n",
149                __func__, sta[0].devType, sta[0].devIndex, sta[1].devType, sta[1].devIndex);
150     }
151     for (int32_t i = 1; i < MAX_DEVICES; i++) {
152         if (sta[i].devIndex == 0) {
153             break;
154         }
155         if (sta[i].devType == INDEV_TYPE_TOUCH) {
156             g_touchIndex = sta[i].devIndex;
157         }
158     }
159     EXPECT_EQ(ret, INPUT_SUCCESS);
160 }
161 
162 /**
163   * @tc.name: OpenInputDevice001
164   * @tc.desc: open input device test
165   * @tc.type: FUNC
166   * @tc.require: AR000F867R
167   */
168 HWTEST_F(HdiInputTest, OpenInputDev001, TestSize.Level1)
169 {
170     printf("%s: [Input] OpenInputDev001 enter %d\n", __func__, __LINE__);
171     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
172     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR);
173     int32_t ret = g_inputInterface->iInputManager->OpenInputDevice(VALUE_DEFAULT);
174     if (ret != INPUT_SUCCESS) {
175         printf("%s: open device1 failed, ret %d\n", __func__, ret);
176     }
177     EXPECT_EQ(ret, INPUT_SUCCESS);
178 }
179 
180 /**
181   * @tc.name: OpenInputDevice002
182   * @tc.desc: open input device test
183   * @tc.type: FUNC
184   * @tc.require: AR000F867R
185   */
186 HWTEST_F(HdiInputTest, OpenInputDevice002, TestSize.Level1)
187 {
188     printf("%s: [Input] OpenInputDev002 enter %d\n", __func__, __LINE__);
189     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
190     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR);
191     /* Device "15" is used for testing nonexistent device node */
192     int32_t ret = g_inputInterface->iInputManager->OpenInputDevice(INVALID_INDEX);
193     if (ret != HDF_SUCCESS) {
194         printf("%s: device %d dose not exist, can't open it, ret %d\n", __func__, INVALID_INDEX, ret);
195     }
196     EXPECT_NE(ret, INPUT_SUCCESS);
197 }
198 
199 
200 /**
201   * @tc.name: OpenInputDevice003
202   * @tc.desc: open input device test
203   * @tc.type: FUNC
204   * @tc.require: AR000F867R
205   */
206 HWTEST_F(HdiInputTest, OpenInputDevice003, TestSize.Level1)
207 {
208     printf("%s: [Input] OpenInputDev003 enter %d\n", __func__, __LINE__);
209     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
210     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR);
211     /* Device "-1" is used for testing nonexistent device node */
212     int32_t ret = g_inputInterface->iInputManager->OpenInputDevice(INVALID_INDEX1);
213     if (ret != HDF_SUCCESS) {
214         printf("%s: device %d dose not exist, can't open it, ret %d\n", __func__, INVALID_INDEX1, ret);
215     }
216     EXPECT_NE(ret, INPUT_SUCCESS);
217 }
218 
219 /**
220   * @tc.name: CloseInputDevice001
221   * @tc.desc: close input device test
222   * @tc.type: FUNC
223   * @tc.require: AR000F867T, AR000F8QNL
224   */
225 HWTEST_F(HdiInputTest, CloseInputDevice001, TestSize.Level1)
226 {
227     printf("%s: [Input] CloseInputDev001 enter %d\n", __func__, __LINE__);
228     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
229     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR);
230     int32_t ret = g_inputInterface->iInputManager->CloseInputDevice(VALUE_DEFAULT);
231     if (ret != INPUT_SUCCESS) {
232         printf("%s: close device %d failed, ret %d\n", __func__, g_touchIndex, ret);
233     }
234     EXPECT_EQ(ret, INPUT_SUCCESS);
235 }
236 
237 /**
238   * @tc.name: CloseInputDevice002
239   * @tc.desc: close input device test
240   * @tc.type: FUNC
241   * @tc.require: AR000F867T
242   */
243 HWTEST_F(HdiInputTest, CloseInputDevice002, TestSize.Level1)
244 {
245     printf("%s: [Input] CloseInputDev002 enter %d\n", __func__, __LINE__);
246     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
247     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR);
248     /* Device "15" is used for testing nonexistent device node */
249     int32_t ret = g_inputInterface->iInputManager->CloseInputDevice(INVALID_INDEX);
250     if (ret == INPUT_FAILURE) {
251         printf("%s: device %d doesn't exist, can't close it, ret %d\n", __func__, INVALID_INDEX, ret);
252     }
253     EXPECT_NE(ret, INPUT_SUCCESS);
254 }
255 
256 /**
257   * @tc.name: CloseInputDevice003
258   * @tc.desc: close input device test
259   * @tc.type: FUNC
260   * @tc.require: AR000F867T
261   */
262 HWTEST_F(HdiInputTest, CloseInputDevice003, TestSize.Level1)
263 {
264     printf("%s: [Input] CloseInputDev002 enter %d\n", __func__, __LINE__);
265     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
266     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR);
267     /* Device "-1" is used for testing nonexistent device node */
268     int32_t ret = g_inputInterface->iInputManager->CloseInputDevice(INVALID_INDEX1);
269     if (ret == INPUT_FAILURE) {
270         printf("%s: device %d doesn't exist, can't close it, ret %d\n", __func__, INVALID_INDEX1, ret);
271     }
272     EXPECT_NE(ret, INPUT_SUCCESS);
273 }
274 
275 /**
276   * @tc.name: GetInputDevice001
277   * @tc.desc: get input device info test
278   * @tc.type: FUNC
279   * @tc.require: AR000F867S
280   */
281 HWTEST_F(HdiInputTest, GetInputDevice001, TestSize.Level1)
282 {
283     printf("%s: [Input] GetInputDevice001 enter %d\n", __func__, __LINE__);
284     InputDeviceInfo *dev = nullptr;
285     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
286     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR);
287     int32_t ret = g_inputInterface->iInputManager->GetInputDevice(g_touchIndex, &dev);
288     if (ret != INPUT_SUCCESS) {
289         printf("%s: get device %d failed, ret %d\n", __func__, g_touchIndex, ret);
290     }
291     printf("GetInputDevice001 %s: devIndex = %u, devType = %u\n", __func__, dev->devIndex, dev->devType);
292     printf("GetInputDevice001: chipInfo = %s, vendorName = %s, chipName = %s, devName = %s\n",
293         dev->chipInfo, dev->vendorName, dev->chipName, dev->attrSet.devName);
294     printf("GetInputDevice001: busType = %u, vendor = %u, product = %u, version = %u\n",
295         dev->attrSet.id.busType, dev->attrSet.id.vendor, dev->attrSet.id.product, dev->attrSet.id.version);
296     EXPECT_EQ(ret, INPUT_SUCCESS);
297 }
298 
299 /**
300   * @tc.name: GetInputDevice002
301   * @tc.desc: get input device info test
302   * @tc.type: FUNC
303   * @tc.require: AR000F867S
304   */
305 HWTEST_F(HdiInputTest, GetInputDevice002, TestSize.Level1)
306 {
307     printf("%s: [Input] GetInputDevice002 enter %d\n", __func__, __LINE__);
308     InputDeviceInfo *dev = nullptr;
309     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
310     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR);
311     int32_t ret = g_inputInterface->iInputManager->GetInputDevice(INVALID_INDEX1, &dev);
312     if (ret != INPUT_SUCCESS) {
313         printf("%s: get device %d failed, ret %d\n", __func__, INVALID_INDEX1, ret);
314     }
315     EXPECT_NE(ret, INPUT_SUCCESS);
316 }
317 
318 /**
319   * @tc.name: GetInputDevice003
320   * @tc.desc: get input device info test
321   * @tc.type: FUNC
322   * @tc.require: AR000F867S
323   */
324 HWTEST_F(HdiInputTest, GetInputDevice003, TestSize.Level1)
325 {
326     printf("%s: [Input] GetInputDevice003 enter %d\n", __func__, __LINE__);
327     InputDeviceInfo *dev = nullptr;
328     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
329     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR);
330     int32_t ret = g_inputInterface->iInputManager->GetInputDevice(INVALID_INDEX, &dev);
331     if (ret != INPUT_SUCCESS) {
332         printf("%s: get device %d failed, ret %d\n", __func__, INVALID_INDEX, ret);
333     }
334     EXPECT_NE(ret, INPUT_SUCCESS);
335 }
336 
337 /**
338   * @tc.name: GetInputDeviceList001
339   * @tc.desc: get input device list info test
340   * @tc.type: FUNC
341   * @tc.require: AR000F8680
342   */
343 HWTEST_F(HdiInputTest, GetInputDeviceList001, TestSize.Level1)
344 {
345     printf("%s: [Input] GetInputDeviceList001 enter\n", __func__);
346     int32_t ret;
347     uint32_t num = 0;
348     InputDeviceInfo *dev = nullptr;
349     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
350     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR);
351     ret = g_inputInterface->iInputManager->GetInputDeviceList(&num, &dev, MAX_INPUT_DEV_NUM);
352     if (ret != INPUT_SUCCESS) {
353         printf("%s: get device list failed, ret %d\n", __func__, ret);
354     }
355     /* num <= MAX_INPUT_DEV_NUM return true */
356     ASSERT_LE(num, MAX_INPUT_DEV_NUM);
357     for (uint32_t i = 0; i < num; i++) {
358         printf("%s: num = %u, device[%u]'s info is:\n", __func__, num, i);
359         printf("%s: index = %u, devType = %u\n", __func__, (dev + i)->devIndex, (dev + i)->devType);
360         printf("%s: chipInfo = %s, vendorName = %s, chipName = %s, devName = %s\n",
361             __func__, (dev + i)->chipInfo, (dev + i)->vendorName, (dev + i)->chipName, (dev + i)->attrSet.devName);
362     }
363     EXPECT_EQ(ret, INPUT_SUCCESS);
364 }
365 
366 /**
367   * @tc.name: RegisterCallbackAndReportData001
368   * @tc.desc: get input device chip info test
369   * @tc.type: FUNC
370   * @tc.require: AR000F8682, AR000F8QNL
371   */
372 HWTEST_F(HdiInputTest, RegisterCallbackAndReportData001, TestSize.Level1)
373 {
374     printf("%s: [Input] RegisterCallbackAndReportData001 enter\n", __func__);
375     int32_t ret;
376     g_callback.EventPkgCallback = ReportEventPkgCallback;
377     g_hotplugCb.HotPlugCallback = ReportHotPlugEventPkgCallback;
378     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
379     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputReporter, INPUT_NULL_PTR);
380     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR);
381     ret  = g_inputInterface->iInputReporter->RegisterReportCallback(g_touchIndex, &g_callback);
382     if (ret != INPUT_SUCCESS) {
383         printf("%s: register callback failed for device %d, ret %d\n", __func__, g_touchIndex, ret);
384     }
385     EXPECT_EQ(ret, INPUT_SUCCESS);
386     ret = g_inputInterface->iInputManager->OpenInputDevice(VALUE_DEFAULT);
387     EXPECT_EQ(ret, INPUT_SUCCESS);
388     printf("%s: wait 3s for testing, pls touch the panel now\n", __func__);
389     printf("%s: The event data is as following:\n", __func__);
390     OsalMSleep(KEEP_ALIVE_TIME_MS);
391 }
392 
393 /**
394   * @tc.name: RegisterReportCallback001
395   * @tc.desc: register report callback fail
396   * @tc.type: FUNC
397   * @tc.require: AR000F8682, AR000F8QNL
398   */
399 HWTEST_F(HdiInputTest, RegisterReportCallback001, TestSize.Level1)
400 {
401     printf("%s: [Input] RegisterReportCallback001 enter\n", __func__);
402     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
403     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputReporter, INPUT_NULL_PTR);
404     int32_t ret;
405     ret = g_inputInterface->iInputReporter->RegisterReportCallback(0, nullptr);
406     if (ret != INPUT_SUCCESS) {
407         printf("%s: register report callback failed, ret %d\n", __func__, ret);
408     }
409     EXPECT_NE(ret, INPUT_SUCCESS);
410 }
411 
412 /**
413   * @tc.name: UnregisterReportCallback001
414   * @tc.desc: get input device chip info test
415   * @tc.type: FUNC
416   * @tc.require: SR000F867Q
417   */
418 HWTEST_F(HdiInputTest, UnregisterReportCallback001, TestSize.Level1)
419 {
420     printf("%s: [Input] UnregisterReportCallback001 enter\n", __func__);
421     int32_t ret;
422     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
423     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputReporter, INPUT_NULL_PTR);
424     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR);
425 
426     ret  = g_inputInterface->iInputReporter->UnregisterReportCallback(g_touchIndex);
427     if (ret != INPUT_SUCCESS) {
428         printf("%s: unregister callback failed for device %d, ret %d\n", __func__, g_touchIndex, ret);
429     }
430     EXPECT_EQ(ret, INPUT_SUCCESS);
431     ret = g_inputInterface->iInputManager->CloseInputDevice(VALUE_DEFAULT);
432     if (ret != INPUT_SUCCESS) {
433         printf("%s: close device %d failed, ret %d\n", __func__, g_touchIndex, ret);
434     }
435     EXPECT_EQ(ret, INPUT_SUCCESS);
436 }
437 
438 /**
439   * @tc.name: UnRegisterReportCallback001
440   * @tc.desc: unregister report callback fail
441   * @tc.type: FUNC
442   * @tc.require: AR000F8682, AR000F8QNL
443   */
444 HWTEST_F(HdiInputTest, UnRegisterReportCallback001, TestSize.Level1)
445 {
446     printf("%s: [Input] UnRegisterReportCallback001 enter\n", __func__);
447     int32_t ret;
448     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
449     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputReporter, INPUT_NULL_PTR);
450     ret = g_inputInterface->iInputReporter->UnregisterReportCallback(INVALID_DEV_INDEX);
451     if (ret != INPUT_SUCCESS) {
452         printf("%s: unregister report callback failed, ret %d\n", __func__, ret);
453     }
454     EXPECT_NE(ret, INPUT_SUCCESS);
455 }
456 
457 
458 /**
459   * @tc.name: FindIndexFromFd
460   * @tc.desc: find index from fd test
461   * @tc.type: FUNC
462   * @tc.require: SR000F867Q
463   */
464 HWTEST_F(HdiInputTest, FindIndexFromFd001, TestSize.Level1)
465 {
466     printf("%s: [Input] FindIndexFromFd001 enter\n", __func__);
467     int32_t ret;
468     InputDeviceManager InputDeviceManagerTest;
469     int32_t fd = VALUE_NULL;
470     uint32_t index = VALUE_NULL;
471     ret = InputDeviceManagerTest.FindIndexFromFd(fd, &index);
472     if (ret != INPUT_SUCCESS) {
473         printf("%s: find index from fd failed, ret %d\n", __func__, ret);
474     }
475     EXPECT_NE(ret, INPUT_SUCCESS);
476 }
477 
478 /**
479   * @tc.name: FindIndexFromDevName
480   * @tc.desc: find index from device name test
481   * @tc.type: FUNC
482   * @tc.require: SR000F867Q
483   */
484 HWTEST_F(HdiInputTest, FindIndexFromDevName001, TestSize.Level1)
485 {
486     printf("%s: [Input] FindIndexFromDevName001 enter\n", __func__);
487     int32_t ret;
488     InputDeviceManager InputDeviceManagerTest;
489     string devName = "MOUSE1";
490     uint32_t index = VALUE_NULL;
491     ret = InputDeviceManagerTest.FindIndexFromDevName(devName, &index);
492     if (ret != INPUT_SUCCESS) {
493         printf("%s: find index from device name failed, ret %d\n", __func__, ret);
494     }
495     EXPECT_NE(ret, INPUT_SUCCESS);
496 }
497 
498 /**
499   * @tc.name: SetPowerStatus
500   * @tc.desc: set power status test
501   * @tc.type: FUNC
502   * @tc.require: SR000F867Q
503   */
504 HWTEST_F(HdiInputTest, SetPowerStatus001, TestSize.Level1)
505 {
506     printf("%s: [Input] SetPowerStatus001 enter\n", __func__);
507     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
508     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR);
509 
510     int32_t ret;
511     uint32_t status = VALUE_NULL;
512     ret = g_inputInterface->iInputController->SetPowerStatus(g_touchIndex, status);
513     if (ret != INPUT_SUCCESS) {
514         printf("%s: set power status failed, ret %d\n", __func__, ret);
515     }
516     EXPECT_EQ(ret, INPUT_SUCCESS);
517 }
518 
519 /**
520   * @tc.name: SetPowerStatus
521   * @tc.desc: set power status test
522   * @tc.type: FUNC
523   * @tc.require: SR000F867Q
524   */
525 HWTEST_F(HdiInputTest, SetPowerStatus002, TestSize.Level1)
526 {
527     printf("%s: [Input] SetPowerStatus002 enter\n", __func__);
528     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
529     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR);
530 
531     int32_t ret;
532     uint32_t status = VALUE_NULL;
533     ret = g_inputInterface->iInputController->SetPowerStatus(INVALID_INDEX, status);
534     if (ret != INPUT_SUCCESS) {
535         printf("%s: set power status failed, ret %d\n", __func__, ret);
536     }
537     EXPECT_NE(ret, INPUT_SUCCESS);
538 }
539 
540 /**
541   * @tc.name: SetPowerStatus
542   * @tc.desc: set power status test
543   * @tc.type: FUNC
544   * @tc.require: SR000F867Q
545   */
546 HWTEST_F(HdiInputTest, SetPowerStatus003, TestSize.Level1)
547 {
548     printf("%s: [Input] SetPowerStatus003 enter\n", __func__);
549     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
550     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR);
551 
552     int32_t ret;
553     uint32_t status = VALUE_NULL;
554     ret = g_inputInterface->iInputController->SetPowerStatus(INVALID_INDEX1, status);
555     if (ret != INPUT_SUCCESS) {
556         printf("%s: set power status failed, ret %d\n", __func__, ret);
557     }
558     EXPECT_NE(ret, INPUT_SUCCESS);
559 }
560 
561 /**
562   * @tc.name: GetPowerStatus
563   * @tc.desc: get power status test
564   * @tc.type: FUNC
565   * @tc.require: SR000F867Q
566   */
567 HWTEST_F(HdiInputTest, GetPowerStatus001, TestSize.Level1)
568 {
569     printf("%s: [Input] GetPowerStatus001 enter\n", __func__);
570     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
571     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR);
572 
573     int32_t ret;
574     uint32_t status = VALUE_NULL;
575     ret = g_inputInterface->iInputController->GetPowerStatus(g_touchIndex, &status);
576     if (ret != INPUT_SUCCESS) {
577         printf("%s: get power status failed, ret %d\n", __func__, ret);
578     }
579     EXPECT_EQ(ret, INPUT_SUCCESS);
580 }
581 
582 /**
583   * @tc.name: GetPowerStatus
584   * @tc.desc: get power status test
585   * @tc.type: FUNC
586   * @tc.require: SR000F867Q
587   */
588 HWTEST_F(HdiInputTest, GetPowerStatus002, TestSize.Level1)
589 {
590     printf("%s: [Input] GetPowerStatus002 enter\n", __func__);
591     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
592     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR);
593 
594     int32_t ret;
595     uint32_t status = VALUE_NULL;
596     ret = g_inputInterface->iInputController->GetPowerStatus(INVALID_INDEX, &status);
597     if (ret != INPUT_SUCCESS) {
598         printf("%s: get power status failed, ret %d\n", __func__, ret);
599     }
600     EXPECT_NE(ret, INPUT_SUCCESS);
601 }
602 
603 /**
604   * @tc.name: GetPowerStatus
605   * @tc.desc: get power status test
606   * @tc.type: FUNC
607   * @tc.require: SR000F867Q
608   */
609 HWTEST_F(HdiInputTest, GetPowerStatus003, TestSize.Level1)
610 {
611     printf("%s: [Input] GetPowerStatus003 enter\n", __func__);
612     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
613     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR);
614 
615     int32_t ret;
616     uint32_t status = VALUE_NULL;
617     ret = g_inputInterface->iInputController->GetPowerStatus(INVALID_INDEX1, &status);
618     if (ret != INPUT_SUCCESS) {
619         printf("%s: get power status failed, ret %d\n", __func__, ret);
620     }
621     EXPECT_NE(ret, INPUT_SUCCESS);
622 }
623 
624 /**
625   * @tc.name: GetDeviceType
626   * @tc.desc: get device type test
627   * @tc.type: FUNC
628   * @tc.require: SR000F867Q
629   */
630 HWTEST_F(HdiInputTest, GetDeviceType001, TestSize.Level1)
631 {
632     printf("%s: [Input] GetDeviceType001 enter\n", __func__);
633     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
634     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR);
635 
636     int32_t ret;
637     uint32_t deviceType = INIT_DEFAULT_VALUE;
638     ret = g_inputInterface->iInputController->GetDeviceType(g_touchIndex, &deviceType);
639     if (ret != INPUT_SUCCESS) {
640         printf("%s: get device type failed, ret %d\n", __func__, ret);
641     }
642     EXPECT_EQ(ret, INPUT_SUCCESS);
643 }
644 
645 /**
646   * @tc.name: GetDeviceType
647   * @tc.desc: get device type test
648   * @tc.type: FUNC
649   * @tc.require: SR000F867Q
650   */
651 HWTEST_F(HdiInputTest, GetDeviceType002, TestSize.Level1)
652 {
653     printf("%s: [Input] GetDeviceType002 enter\n", __func__);
654     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
655     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR);
656 
657     int32_t ret;
658     uint32_t deviceType = INIT_DEFAULT_VALUE;
659     ret = g_inputInterface->iInputController->GetDeviceType(INVALID_INDEX, &deviceType);
660     if (ret != INPUT_SUCCESS) {
661         printf("%s: get device type failed, ret %d\n", __func__, ret);
662     }
663     EXPECT_NE(ret, INPUT_SUCCESS);
664 }
665 
666 /**
667   * @tc.name: GetDeviceType
668   * @tc.desc: get device type test
669   * @tc.type: FUNC
670   * @tc.require: SR000F867Q
671   */
672 HWTEST_F(HdiInputTest, GetDeviceType003, TestSize.Level1)
673 {
674     printf("%s: [Input] GetDeviceType003 enter\n", __func__);
675     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
676     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR);
677 
678     int32_t ret;
679     uint32_t deviceType = INIT_DEFAULT_VALUE;
680     ret = g_inputInterface->iInputController->GetDeviceType(INVALID_INDEX1, &deviceType);
681     if (ret != INPUT_SUCCESS) {
682         printf("%s: get device type failed, ret %d\n", __func__, ret);
683     }
684     EXPECT_NE(ret, INPUT_SUCCESS);
685 }
686 
687 /**
688   * @tc.name: GetChipInfo
689   * @tc.desc: get input device chip info test
690   * @tc.type: FUNC
691   * @tc.require: SR000F867Q
692   */
693 HWTEST_F(HdiInputTest, GetChipInfo001, TestSize.Level1)
694 {
695     printf("%s: [Input] GetChipInfo001 enter\n", __func__);
696     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
697     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR);
698 
699     int32_t ret;
700     char chipInfo[TEST_LEN1] = {0};
701     ret = g_inputInterface->iInputController->GetChipInfo(g_touchIndex, chipInfo, TEST_LEN1);
702     if (ret != INPUT_SUCCESS) {
703         printf("%s: get chip info failed, ret %d\n", __func__, ret);
704     }
705     EXPECT_EQ(ret, INPUT_SUCCESS);
706 }
707 
708 /**
709   * @tc.name: GetChipInfo
710   * @tc.desc: get input device chip info test
711   * @tc.type: FUNC
712   * @tc.require: SR000F867Q
713   */
714 HWTEST_F(HdiInputTest, GetChipInfo002, TestSize.Level1)
715 {
716     printf("%s: [Input] GetChipInfo002 enter\n", __func__);
717     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
718     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR);
719 
720     int32_t ret;
721     char chipInfo[TEST_LEN1] = {0};
722     ret = g_inputInterface->iInputController->GetChipInfo(INVALID_INDEX, chipInfo, TEST_LEN1);
723     if (ret != INPUT_SUCCESS) {
724         printf("%s: get chip info failed, ret %d\n", __func__, ret);
725     }
726     EXPECT_NE(ret, INPUT_SUCCESS);
727 }
728 
729 /**
730   * @tc.name: GetChipInfo
731   * @tc.desc: get input device chip info test
732   * @tc.type: FUNC
733   * @tc.require: SR000F867Q
734   */
735 HWTEST_F(HdiInputTest, GetChipInfo003, TestSize.Level1)
736 {
737     printf("%s: [Input] GetChipInfo003 enter\n", __func__);
738     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
739     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR);
740 
741     int32_t ret;
742     char chipInfo[TEST_LEN1] = {0};
743     ret = g_inputInterface->iInputController->GetChipInfo(g_touchIndex, chipInfo, TEST_LEN2);
744     if (ret != INPUT_SUCCESS) {
745         printf("%s: get device chip info failed, ret %d\n", __func__, ret);
746     }
747     EXPECT_NE(ret, INPUT_SUCCESS);
748 }
749 
750 /**
751   * @tc.name: GetVendorName
752   * @tc.desc: get device vendor name test
753   * @tc.type: FUNC
754   * @tc.require: SR000F867Q
755   */
756 HWTEST_F(HdiInputTest, GetVendorName001, TestSize.Level1)
757 {
758     printf("%s: [Input] GetVendorName001 enter\n", __func__);
759     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
760     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR);
761 
762     int32_t ret;
763     char vendorName[TEST_LEN1] = {0};
764     ret = g_inputInterface->iInputController->GetVendorName(g_touchIndex, vendorName, TEST_LEN1);
765     if (ret != INPUT_SUCCESS) {
766         HDF_LOGE("%s: get device vendor name failed, ret %d", __func__, ret);
767     }
768     EXPECT_EQ(ret, INPUT_SUCCESS);
769 }
770 
771 /**
772   * @tc.name: GetVendorName
773   * @tc.desc: get device vendor name test
774   * @tc.type: FUNC
775   * @tc.require: SR000F867Q
776   */
777 HWTEST_F(HdiInputTest, GetVendorName002, TestSize.Level1)
778 {
779     printf("%s: [Input] GetVendorName002 enter\n", __func__);
780     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
781     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR);
782 
783     int32_t ret;
784     char vendorName[TEST_LEN1] = {0};
785     ret = g_inputInterface->iInputController->GetVendorName(INVALID_INDEX, vendorName, TEST_LEN1);
786     if (ret != INPUT_SUCCESS) {
787         HDF_LOGE("%s: get device vendor name failed, ret %d", __func__, ret);
788     }
789     EXPECT_NE(ret, INPUT_SUCCESS);
790 }
791 
792 /**
793   * @tc.name: GetVendorName
794   * @tc.desc: get device vendor name test
795   * @tc.type: FUNC
796   * @tc.require: SR000F867Q
797   */
798 HWTEST_F(HdiInputTest, GetVendorName003, TestSize.Level1)
799 {
800     printf("%s: [Input] GetVendorName003 enter\n", __func__);
801     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
802     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR);
803 
804     int32_t ret;
805     char vendorName[TEST_LEN1] = {0};
806     ret = g_inputInterface->iInputController->GetVendorName(g_touchIndex, vendorName, TEST_LEN2);
807     if (ret != INPUT_SUCCESS) {
808         HDF_LOGE("%s: get device vendor name failed, ret %d", __func__, ret);
809     }
810     EXPECT_NE(ret, INPUT_SUCCESS);
811 }
812 
813 /**
814   * @tc.name: GetChipName
815   * @tc.desc: get device chip name test
816   * @tc.type: FUNC
817   * @tc.require: SR000F867Q
818   */
819 HWTEST_F(HdiInputTest, GetChipName001, TestSize.Level1)
820 {
821     printf("%s: [Input] GetChipName001 enter\n", __func__);
822     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
823     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR);
824 
825     int32_t ret;
826     char chipName[TEST_LEN1] = {0};
827     ret = g_inputInterface->iInputController->GetChipName(g_touchIndex, chipName, TEST_LEN1);
828     if (ret != INPUT_SUCCESS) {
829         HDF_LOGE("%s: get device chip name failed, ret %d", __func__, ret);
830     }
831     EXPECT_EQ(ret, INPUT_SUCCESS);
832 }
833 
834 /**
835   * @tc.name: GetChipName
836   * @tc.desc: get device chip name test
837   * @tc.type: FUNC
838   * @tc.require: SR000F867Q
839   */
840 HWTEST_F(HdiInputTest, GetChipName002, TestSize.Level1)
841 {
842     printf("%s: [Input] GetChipName002 enter\n", __func__);
843     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
844     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR);
845 
846     int32_t ret;
847     char chipName[TEST_LEN1] = {0};
848     ret = g_inputInterface->iInputController->GetChipName(INVALID_INDEX, chipName, TEST_LEN1);
849     if (ret != INPUT_SUCCESS) {
850         HDF_LOGE("%s: get device chip name failed, ret %d", __func__, ret);
851     }
852     EXPECT_NE(ret, INPUT_SUCCESS);
853 }
854 
855 /**
856   * @tc.name: GetChipName
857   * @tc.desc: get device chip name test
858   * @tc.type: FUNC
859   * @tc.require: SR000F867Q
860   */
861 HWTEST_F(HdiInputTest, GetChipName003, TestSize.Level1)
862 {
863     printf("%s: [Input] GetChipName003 enter\n", __func__);
864     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
865     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR);
866 
867     int32_t ret;
868     char chipName[TEST_LEN1] = {0};
869     ret = g_inputInterface->iInputController->GetChipName(g_touchIndex, chipName, TEST_LEN2);
870     if (ret != INPUT_SUCCESS) {
871         HDF_LOGE("%s: get device chip name failed, ret %d", __func__, ret);
872     }
873     EXPECT_NE(ret, INPUT_SUCCESS);
874 }
875 
876 /**
877   * @tc.name: SetGestureMode
878   * @tc.desc: set device gestureMode test
879   * @tc.type: FUNC
880   * @tc.require: SR000F867Q
881   */
882 HWTEST_F(HdiInputTest, SetGestureMode001, TestSize.Level1)
883 {
884     printf("%s: [Input] SetGestureMode001 enter\n", __func__);
885     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
886     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR);
887 
888     int32_t ret;
889     uint32_t gestureMode = VALUE_DEFAULT;
890     ret = g_inputInterface->iInputController->SetGestureMode(g_touchIndex, gestureMode);
891     if (ret != INPUT_SUCCESS) {
892         HDF_LOGE("%s: set device gestureMode failed, ret %d", __func__, ret);
893     }
894     EXPECT_EQ(ret, INPUT_SUCCESS);
895 }
896 
897 /**
898   * @tc.name: SetGestureMode
899   * @tc.desc: set device gestureMode test
900   * @tc.type: FUNC
901   * @tc.require: SR000F867Q
902   */
903 HWTEST_F(HdiInputTest, SetGestureMode002, TestSize.Level1)
904 {
905     printf("%s: [Input] SetGestureMode002 enter\n", __func__);
906     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
907     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR);
908 
909     int32_t ret;
910     uint32_t gestureMode = VALUE_DEFAULT;
911     ret = g_inputInterface->iInputController->SetGestureMode(INVALID_INDEX, gestureMode);
912     if (ret != INPUT_SUCCESS) {
913         HDF_LOGE("%s: set device gestureMode failed, ret %d", __func__, ret);
914     }
915     EXPECT_NE(ret, INPUT_SUCCESS);
916 }
917 
918 /**
919   * @tc.name: RunCapacitanceTest
920   * @tc.desc: run capacitance test test
921   * @tc.type: FUNC
922   * @tc.require: SR000F867Q
923   */
924 HWTEST_F(HdiInputTest, RunCapacitanceTest001, TestSize.Level1)
925 {
926     printf("%s: [Input] RunCapacitanceTest001 enter\n", __func__);
927     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
928     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR);
929 
930     int32_t ret;
931     char result[TEST_RESULT_LEN] = {0};
932     uint32_t testType = TEST_TYPE;
933     ret = g_inputInterface->iInputController->RunCapacitanceTest(g_touchIndex, testType, result, TEST_RESULT_LEN);
934     if (ret != INPUT_SUCCESS) {
935         HDF_LOGE("%s: run capacitance test failed, ret %d", __func__, ret);
936     }
937     EXPECT_EQ(ret, INPUT_SUCCESS);
938 }
939 
940 /**
941   * @tc.name: RunCapacitanceTest002
942   * @tc.desc: run capacitance test test002
943   * @tc.type: FUNC
944   * @tc.require: SR000F867Q
945   */
946 HWTEST_F(HdiInputTest, RunCapacitanceTest002, TestSize.Level1)
947 {
948     printf("%s: [Input] RunCapacitanceTest002 enter\n", __func__);
949     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
950     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR);
951 
952     int32_t ret;
953     char result[TEST_RESULT_LEN] = {0};
954     uint32_t testType = TEST_TYPE;
955     ret = g_inputInterface->iInputController->RunCapacitanceTest(g_touchIndex, testType, nullptr, TEST_RESULT_LEN);
956     if (ret != INPUT_SUCCESS) {
957         HDF_LOGE("%s: run capacitance test002 failed, ret %d", __func__, ret);
958     }
959     EXPECT_NE(ret, INPUT_SUCCESS);
960 }
961 
962 /**
963   * @tc.name: RunExtraCommand
964   * @tc.desc: run extra command test
965   * @tc.type: FUNC
966   * @tc.require: SR000F867Q
967   */
968 HWTEST_F(HdiInputTest, RunExtraCommand001, TestSize.Level1)
969 {
970     printf("%s: [Input] RunExtraCommand001 enter\n", __func__);
971     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
972     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR);
973 
974     int32_t ret;
975     InputExtraCmd extraCmd = {0};
976     extraCmd.cmdCode = "WakeUpMode";
977     extraCmd.cmdValue = "Enable";
978     ret = g_inputInterface->iInputController->RunExtraCommand(g_touchIndex, &extraCmd);
979     if (ret != INPUT_SUCCESS) {
980         HDF_LOGE("%s: run extra command failed, ret %d", __func__, ret);
981     }
982     EXPECT_EQ(ret, INPUT_SUCCESS);
983 }
984 
985 /**
986   * @tc.name: RunExtraCommand
987   * @tc.desc: run extra command test
988   * @tc.type: FUNC
989   * @tc.require: SR000F867Q
990   */
991 HWTEST_F(HdiInputTest, RunExtraCommand002, TestSize.Level1)
992 {
993     printf("%s: [Input] RunExtraCommand002 enter\n", __func__);
994     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
995     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR);
996 
997     int32_t ret;
998     InputExtraCmd extraCmd = {0};
999     extraCmd.cmdCode = "WakeUpMode";
1000     extraCmd.cmdValue = "Enable";
1001     ret = g_inputInterface->iInputController->RunExtraCommand(INVALID_INDEX, &extraCmd);
1002     if (ret != INPUT_SUCCESS) {
1003         HDF_LOGE("%s: run extra command failed, ret %d", __func__, ret);
1004     }
1005     EXPECT_NE(ret, INPUT_SUCCESS);
1006 }
1007 
1008 /**
1009   * @tc.name: RegisterHotPlugCallback
1010   * @tc.desc: Register Hot Plug Callback
1011   * @tc.type: FUNC
1012   * @tc.require: SR000F867Q
1013   */
1014 HWTEST_F(HdiInputTest, RegisterHotPlugCallback001, TestSize.Level1)
1015 {
1016     printf("%s: [Input] RegisterHotPlugCallback001 enter\n", __func__);
1017     int32_t ret;
1018     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
1019     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputReporter, INPUT_NULL_PTR);
1020 
1021     ret  = g_inputInterface->iInputReporter->RegisterHotPlugCallback(&g_hotplugCb);
1022     if (ret != INPUT_SUCCESS) {
1023         printf("%s: Register Hot Plug Callback failed, ret %d\n", __func__, ret);
1024     }
1025     EXPECT_EQ(ret, INPUT_SUCCESS);
1026 }
1027 
1028 /**
1029   * @tc.name: UnregisterHotPlugCallback
1030   * @tc.desc: Unregister Hot Plug Callback
1031   * @tc.type: FUNC
1032   * @tc.require: SR000F867Q
1033   */
1034 HWTEST_F(HdiInputTest, UnregisterHotPlugCallback001, TestSize.Level1)
1035 {
1036     printf("%s: [Input] UnregisterHotPlugCallback001 enter\n", __func__);
1037     int32_t ret;
1038     INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
1039     INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputReporter, INPUT_NULL_PTR);
1040 
1041     ret  = g_inputInterface->iInputReporter->UnregisterHotPlugCallback();
1042     if (ret != INPUT_SUCCESS) {
1043         printf("%s: Unregister Hot Plug Callback failed, ret %d\n", __func__, ret);
1044     }
1045     EXPECT_EQ(ret, INPUT_SUCCESS);
1046 }
1047 
1048 /**
1049   * @tc.name: SendHotPlugEvent
1050   * @tc.desc: Send Hot Plug Event
1051   * @tc.type: FUNC
1052   * @tc.require: SR000F867Q
1053   */
1054 HWTEST_F(HdiInputTest, SendHotPlugEvent001, TestSize.Level1)
1055 {
1056     printf("%s: [Input] SendHotPlugEvent001 enter\n", __func__);
1057     LOG_SetCallback(MyLogCallback);
1058     InputDeviceManager iInputDeviceManager;
1059     iInputDeviceManager.SendHotPlugEvent(g_type, g_index, STATUS);
1060     EXPECT_TRUE(g_errLog.find("SendHotPlugEvent") != std::string::npos);
1061 }
1062 
1063 /**
1064   * @tc.name: DoWithEventDeviceAdd
1065   * @tc.desc: Do With Event Device Add
1066   * @tc.type: FUNC
1067   * @tc.require: SR000F867Q
1068   */
1069 HWTEST_F(HdiInputTest, DoWithEventDeviceAdd001, TestSize.Level1)
1070 {
1071     printf("%s: [Input] DoWithEventDeviceAdd001 enter\n", __func__);
1072     LOG_SetCallback(MyLogCallback);
1073     InputDeviceManager iInputDeviceManager;
1074     iInputDeviceManager.DoWithEventDeviceAdd(g_fileDescriptorFirst, g_fileDescriptorSecond, NODE_PATH);
1075     EXPECT_TRUE(g_errLog.find("DoWithEventDeviceAdd") != std::string::npos);
1076 }
1077 
1078 /**
1079   * @tc.name: DoWithEventDeviceDel
1080   * @tc.desc: Do With Event Device Del
1081   * @tc.type: FUNC
1082   * @tc.require: SR000F867Q
1083   */
1084 HWTEST_F(HdiInputTest, DoWithEventDeviceDel001, TestSize.Level1)
1085 {
1086     printf("%s: [Input] DoWithEventDeviceDel001 enter\n", __func__);
1087     LOG_SetCallback(MyLogCallback);
1088     InputDeviceManager iInputDeviceManager;
1089     iInputDeviceManager.DoWithEventDeviceDel(g_fileDescriptorFirst, g_index);
1090     EXPECT_TRUE(g_errLog.find("DoWithEventDeviceDel") != std::string::npos);
1091 }
1092 
1093 /**
1094   * @tc.name: ReportEventPkg001
1095   * @tc.desc: Report Event Pkg
1096   * @tc.type: FUNC
1097   * @tc.require: SR000F867Q
1098   */
1099 HWTEST_F(HdiInputTest, ReportEventPkg001, TestSize.Level1)
1100 {
1101     printf("%s: [Input] ReportEventPkg001 enter\n", __func__);
1102     LOG_SetCallback(MyLogCallback);
1103     InputEventPackage **evtPkg = (InputEventPackage **)OsalMemAlloc(sizeof(InputEventPackage *) * COUNT);
1104     INPUT_CHECK_NULL_POINTER(evtPkg, INPUT_NULL_PTR);
1105     InputDeviceManager iInputDeviceManager;
1106     iInputDeviceManager.ReportEventPkg(g_fileDescriptorFirst, evtPkg, COUNT);
1107     EXPECT_TRUE(g_errLog.find("ReportEventPkg") != std::string::npos);
1108 }
1109 
1110 /**
1111   * @tc.name: DoRead
1112   * @tc.desc: Do Read
1113   * @tc.type: FUNC
1114   * @tc.require: SR000F867Q
1115   */
1116 HWTEST_F(HdiInputTest, DoRead001, TestSize.Level1)
1117 {
1118     printf("%s: [Input] DoRead001 enter\n", __func__);
1119     LOG_SetCallback(MyLogCallback);
1120     struct input_event evtBuffer[EVENT_BUFFER_SIZE] {};
1121     InputDeviceManager iInputDeviceManager;
1122     iInputDeviceManager.DoRead(g_fileDescriptorFirst, evtBuffer, EVENT_BUFFER_SIZE);
1123     EXPECT_TRUE(g_errLog.find("DoRead") != std::string::npos);
1124 }
1125 
1126 /**
1127   * @tc.name: InotifyEventHandler
1128   * @tc.desc: Inotify Event Handler
1129   * @tc.type: FUNC
1130   * @tc.require: SR000F867Q
1131   */
1132 HWTEST_F(HdiInputTest, InotifyEventHandler001, TestSize.Level1)
1133 {
1134     printf("%s: [Input] InotifyEventHandler001 enter\n", __func__);
1135     int32_t ret;
1136     struct input_event evtBuffer[EVENT_BUFFER_SIZE] {};
1137     InputDeviceManager iInputDeviceManager;
1138     ret = iInputDeviceManager.InotifyEventHandler(g_fileDescriptorFirst, g_fileDescriptorSecond);
1139     if (ret != INPUT_SUCCESS) {
1140         printf("%s: Inotify Event Handler failed, ret %d\n", __func__, ret);
1141     }
1142     EXPECT_EQ(ret, INPUT_SUCCESS);
1143 }
1144 
1145 /**
1146   * @tc.name: ScanDevice
1147   * @tc.desc: Scan Device Fail
1148   * @tc.type: FUNC
1149   * @tc.require: SR000F867Q
1150   */
1151 HWTEST_F(HdiInputTest, ScanDevice001, TestSize.Level1)
1152 {
1153     printf("%s: [Input] ScanDevice001 enter\n", __func__);
1154     int32_t ret;
1155     InputDeviceManager iInputDeviceManager;
1156     ret = iInputDeviceManager.ScanDevice(nullptr, 0);
1157     if (ret != INPUT_SUCCESS) {
1158         printf("%s: Scan Device failed, ret %d\n", __func__, ret);
1159     }
1160     EXPECT_NE(ret, INPUT_SUCCESS);
1161 }
1162 
1163 /**
1164   * @tc.name: GetDeviceList
1165   * @tc.desc: Get Device List Fail
1166   * @tc.type: FUNC
1167   * @tc.require: SR000F867Q
1168   */
1169 HWTEST_F(HdiInputTest, GetDeviceList001, TestSize.Level1)
1170 {
1171     printf("%s: [Input] GetDeviceList001 enter\n", __func__);
1172     int32_t ret;
1173     InputDeviceManager iInputDeviceManager;
1174     ret = iInputDeviceManager.GetDeviceList(nullptr, nullptr, 0);
1175     if (ret != INPUT_SUCCESS) {
1176         printf("%s: Get Device List Failed, ret %d\n", __func__, ret);
1177     }
1178     EXPECT_NE(ret, INPUT_SUCCESS);
1179 }
1180