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