青岛黄岛区做网站设计的免费推广
屏规格书:
dts配置:
首先要确保CONFIG_I2C_HID宏打开,i2c-hid-core.c 文件才能编译进去代码。规格书vendor product 分别为0x2d1f 和0x0165 来区别,不至于影响到整体的hid其他设备。
+ i2c-hid-dev@10 {+ compatible = "hid-over-i2c";+ reg = <0x10>;+ hid-descr-addr = <0x0001>;+ interrupt-parent = <&gpio0>;+ interrupts = <6 0x0>;+ post-power-on-delay-ms = <70>;+ vdd = "vdd-supply";+ status ="okay";+ };
hid-input.c 文件里面根据实际情况,是否实际需要x,y坐标是否需要反,或x , 或y 反,或x,y都反。
hidinput_configure_usage函数。这里面x,y需要对调,而且x,还需要最大变最小,最小变最大逻辑 20320-value
static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_field *field,struct hid_usage *usage)
{+if((device->vendor==0x2d1f)&&(device->product==0x0123))+{+ if(b==20320)+ {+ b=15240;+ }+ else if(b==15240){+ b= 20320;+ }+}if (field->application == HID_GD_GAMEPAD || field->application == HID_GD_JOYSTICK)input_set_abs_params(input, usage->code, a, b, (b - a) >> 8, (b - a) >> 4);else input_set_abs_params(input, usage->code, a, b, 0, 0);(!test_bit(usage->code, input->key)) == value)input_event(input, EV_MSC, MSC_SCAN, usage->hid);input_event(input, usage->type, usage->code, value);//input_event(input, usage->type, usage->code, value);+ if((hid->vendor==0x2d1f)&&(hid->product==0x0123))+ {+ if(usage->code == ABS_X)+ input_event(input, usage->type, ABS_Y, value);+ else if(usage->code == ABS_Y)+ input_event(input, usage->type, ABS_X, 20320-value);+ else+ input_event(input, usage->type, usage->code, value);+ }+ else+ {+ input_event(input, usage->type, usage->code, value);+ }if ((field->flags & HID_MAIN_ITEM_RELATIVE) &&usage->type == EV_KEY && value) {}
frameworks/base/data/keyboards/Vendor_2d1f_Product_0165.idc 添加此文件
# Copyright (C) 2010 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.#
# Emulator keyboard configuration file #1.
#
#touch.orientationAware touch x ytouch.deviceType = touchScreen
touch.orientationAware = 1keyboard.layout = qwerty
keyboard.characterMap = qwerty
keyboard.orientationAware = 1
keyboard.builtIn = 1cursor.mode = navigation
cursor.orientationAware = 1
屏规格书