1 /*
2 * Copyright (c) 2021-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
16 #include "virtual_keyboard_consumer_ctrl.h"
17
18 namespace OHOS {
19 namespace MMI {
20 namespace {
21 constexpr int32_t ABS_MAX_VOLUME = 572;
22
23 AbsInfo absInfos[] = {
24 {ABS_VOLUME, 0, ABS_MAX_VOLUME, 0, 0}
25 };
26 } // namespace
27
VirtualKeyboardConsumerCtrl()28 VirtualKeyboardConsumerCtrl::VirtualKeyboardConsumerCtrl()
29 : VirtualDevice("Virtual KeyboardConsumerCtrl", BUS_USB, 0x24ae, 0x4035)
30 {
31 eventTypes_ = { EV_KEY, EV_REL, EV_ABS, EV_MSC };
32 abs_ = { ABS_VOLUME };
33 keys_ = {
34 1, 28, 74, 78, 103, 105, 106, 108, 113, 114, 115, 116, 119, 128, 130, 131, 133, 134, 135, 136, 137, 138, 139,
35 140, 142, 144, 150, 152, 155, 156, 158, 159, 161, 163, 164, 165, 166, 167, 168, 169, 171, 172, 173, 174, 177,
36 178, 181, 206, 207, 208, 209, 210, 212, 216, 217, 219, 224, 225, 228, 229, 230, 234, 235, 240, 241, 244, 256,
37 353, 354, 358, 362, 366, 370, 372, 374, 375, 376, 377, 378, 379, 380, 381, 383, 384, 386, 387, 389, 392, 393,
38 396, 397, 398, 399, 400, 401, 402, 403, 405, 407, 408, 409, 410, 412, 416, 417, 418, 419, 420, 421, 422, 423,
39 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 439, 442, 576, 577, 578, 579, 580, 581, 582, 583, 592, 593
40 };
41 relBits_ = { REL_HWHEEL, REL_HWHEEL_HI_RES };
42 miscellaneous_ = { MSC_SCAN };
43
44 for (const auto &item : absInfos) {
45 SetAbsValue(item);
46 }
47 }
48 } // namespace MMI
49 } // namespace OHOS