• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 
16 #include "virtual_touch_pad.h"
17 
18 #include <linux/input-event-codes.h>
19 #include <linux/uinput.h>
20 
21 namespace OHOS {
22 namespace ExternalDeviceManager {
VirtualTouchPad(const uint32_t maxX,const uint32_t maxY,const uint32_t maxPressure)23 VirtualTouchPad::VirtualTouchPad(const uint32_t maxX, const uint32_t maxY, const uint32_t maxPressure)
24     : VirtualDevice("VSoC touchpad", 0x6006)
25 {
26     uinputDev_.absmin[ABS_X] = 0;
27     uinputDev_.absmax[ABS_X] = maxX;
28     uinputDev_.absmin[ABS_Y] = 0;
29     uinputDev_.absmax[ABS_Y] = maxY;
30 
31     uinputDev_.absmin[ABS_PRESSURE] = 0;
32     uinputDev_.absmax[ABS_PRESSURE] = maxPressure;
33 
34     miscellaneous_ = {MSC_SCAN};
35     eventTypes_ = {EV_ABS, EV_KEY, EV_SYN, EV_MSC};
36     keys_ = {BTN_TOOL_PEN, BTN_TOOL_RUBBER, BTN_TOUCH, BTN_STYLUS, BTN_RIGHT};
37     properties_ = {INPUT_PROP_DIRECT};
38     abs_ = {ABS_X, ABS_Y, ABS_PRESSURE};
39 }
40 } // namespace ExternalDeviceManager
41 } // namespace OHOS
42