Android获取input设备的相关信息(VID、PID等)

1.通过查询proc/bus/input/devices文件

# cat proc/bus/input/devices

I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="ff420030.pwm"
P: Phys=gpio-keys/remotectl
S: Sysfs=/devices/platform/ff420030.pwm/input/input0
U: Uniq=
H: Handlers=event0 cpufreq dmcfreq keychord 
B: PROP=0
B: EV=3
B: KEY=10000000000 40408800 1c16c000000000 0

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="Typec_Headphone"
P: Phys=fusb302/typec
S: Sysfs=/devices/platform/ff3d0000.i2c/i2c-4/4-0022/input/input1
U: Uniq=
H: Handlers=event1 
B: PROP=0
B: EV=21
B: SW=4

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="rockchip,rt5640-codec Headphone Jack"
P: Phys=ALSA
S: Sysfs=/devices/platform/rt5640-sound/sound/card1/input2
U: Uniq=
H: Handlers=event2 
B: PROP=0
B: EV=21
B: SW=4

2. 使用getevent命令

# getevent -i

add device 1: /dev/input/event6
  bus:      0019
  vendor    0001
  product   0001
  version   0100
  name:     "rk29-keypad"
  location: "gpio-keys/input0"
  id:       ""
  version:  1.0.1
  events:
    KEY (0001): 0071  0074  008f 
  input props:
    <none>
add device 2: /dev/input/event1
  bus:      0000
  vendor    0000
  product   0000
  version   0000
  name:     "Typec_Headphone"
  location: "fusb302/typec"
  id:       ""
  version:  1.0.1
  events:
    SW  (0005): 0002 
  input props:
    <none>
add device 3: /dev/input/event5
  bus:      0003
  vendor    1a81
  product   1708
  version   0111
  name:     "Wireless Dongle Wireless Dongle"
  location: "usb-fe380000.usb-1.2/input1"
  id:       ""
  version:  1.0.1
  events:
    KEY (0001): 0001  001c  004a  004e  0067  0069  006a  006c 
                0071  0072  0073  0074  0077  0080  0082  0083 
                0085  0086  0087  0088  0089  008a  008b  008c 
                008e  008f  0090  0096  0098  009b  009c  009e 
                009f  00a1  00a3  00a4  00a5  00a6  00a7  00a8 
                00a9  00ab  00ac  00ad  00ae  00b1  00b2  00b5 
                00ce  00cf  00d0  00d1  00d2  00d4  00d8  00d9 
                00db  00e0  00e1  00e4  00ea  00eb  00f0  00f1 
                00f4  0100  0110  0111  0112  0113  0114  0161 
                0162  0166  016a  016e  0172  0174  0176  0178 
                0179  017a  017b  017c  017d  017f  0180  0182 
                0183  0185  0188  0189  018c  018d  018e  018f 
                0190  0191  0192  0193  0195  0197  0198  0199 
                019a  019c  01a0  01a1  01a2  01a3  01a4  01a5 
                01a6  01a7  01a8  01a9  01aa  01ab  01ac  01ad 
                01ae  01af  01b0  01b1  01b7  01ba  0240  0241 
                0242  0243  0244  0245  0246  0250  0251 
    REL (0002): 0000  0001  0006  0007  0008 
    ABS (0003): 0020  : value 0, min 0, max 572, fuzz 0, flat 0, resolution 0
    MSC (0004): 0004 
  input props:
    <none>
add device 4: /dev/input/event4
  bus:      0003
  vendor    1a81
  product   1708
  version   0111
  name:     "Wireless Dongle Wireless Dongle"
  location: "usb-fe380000.usb-1.2/input0"
  id:       ""
  version:  1.0.1
  events:
    KEY (0001): 0001  0002  0003  0004  0005  0006  0007  0008 
                0009  000a  000b  000c  000d  000e  000f  0010 
                0011  0012  0013  0014  0015  0016  0017  0018 
                0019  001a  001b  001c  001d  001e  001f  0020 
                0021  0022  0023  0024  0025  0026  0027  0028 
                0029  002a  002b  002c  002d  002e  002f  0030 
                0031  0032  0033  0034  0035  0036  0037  0038 
                0039  003a  003b  003c  003d  003e  003f  0040 
                0041  0042  0043  0044  0045  0046  0047  0048 
                0049  004a  004b  004c  004d  004e  004f  0050 
                0051  0052  0053  0055  0056  0057  0058  0059 
                005a  005b  005c  005d  005e  005f  0060  0061 
                0062  0063  0064  0066  0067  0068  0069  006a 
                006b  006c  006d  006e  006f  0071  0072  0073 
                0074  0075  0077  0079  007a  007b  007c  007d 
                007e  007f  0080  0081  0082  0083  0084  0085 
                0086  0087  0088  0089  008a  00b7  00b8  00b9 
                00ba  00bb  00bc  00bd  00be  00bf  00c0  00c1 
                00c2  00f0 
    MSC (0004): 0004 
    LED (0011): 0000  0001  0002  0003  0004 
  input props:
    <none>
add device 5: /dev/input/event3
  bus:      0000
  vendor    0000
  product   0000
  version   0000
  name:     "rockchip-cdndp-sound DP Jack"
  location: "ALSA"
  id:       ""
  version:  1.0.1
  events:
    SW  (0005): 0006 
  input props:
    <none>
add device 6: /dev/input/event0
  bus:      0019
  vendor    0001
  product   0001
  version   0100
  name:     "ff420030.pwm"
  location: "gpio-keys/remotectl"
  id:       ""
  version:  1.0.1
  events:
    KEY (0001): 0066  0067  0069  006a  006c  0072  0073  0074 
                008b  008f  0096  009e  00e8 
  input props:
    <none>
add device 7: /dev/input/event2
  bus:      0000
  vendor    0000
  product   0000
  version   0000
  name:     "rockchip,rt5640-codec Headphone Jack"
  location: "ALSA"
  id:       ""
  version:  1.0.1
  events:
    SW  (0005): 0002 
  input props:
    <none>

3. 使用dumpsys input命令

# dumpsys input

INPUT MANAGER (dumpsys input)

Input Manager State:
  Interactive: true
  System UI Visibility: 0x8708
  Pointer Speed: 0
  Pointer Gestures Enabled: true
  Show Touches: false

Event Hub State:
  BuiltInKeyboardId: 1
  Devices:
    -1: Virtual
      Classes: 0x40000023
      Path: <virtual>
      Descriptor: a718a782d34bc767f4689c232d64d527998ea7fd
      Location: 
      ControllerNumber: 0
      UniqueId: <virtual>
      Identifier: bus=0x0000, vendor=0x0000, product=0x0000, version=0x0000
      KeyLayoutFile: /system/usr/keylayout/Generic.kl
      KeyCharacterMapFile: /system/usr/keychars/Virtual.kcm
      ConfigurationFile: 
      HaveKeyboardLayoutOverlay: false
    1: rk29-keypad (aka device 0 - built-in keyboard)
      Classes: 0x00000401
      Path: /dev/input/event6
      Descriptor: 485d69228e24f5e46da1598745890b214130dbc4
      Location: gpio-keys/input0
      ControllerNumber: 0
      UniqueId: 
      Identifier: bus=0x0019, vendor=0x0001, product=0x0001, version=0x0100
      KeyLayoutFile: /system/usr/keylayout/rk29-keypad.kl
      KeyCharacterMapFile: /system/usr/keychars/Generic.kcm
      ConfigurationFile: 
      HaveKeyboardLayoutOverlay: false
    2: Typec_Headphone
      Classes: 0x00000080
      Path: /dev/input/event1
      Descriptor: 3990618530014a31d3b2a76666ba62af7d3e6d58
      Location: fusb302/typec
      ControllerNumber: 0
      UniqueId: 
      Identifier: bus=0x0000, vendor=0x0000, product=0x0000, version=0x0000
      KeyLayoutFile: 
      KeyCharacterMapFile: 
      ConfigurationFile: 
      HaveKeyboardLayoutOverlay: false
    3: Wireless Dongle Wireless Dongle
      Classes: 0x80000529
      Path: /dev/input/event5
      Descriptor: ccaa8714b7e29840a46b0cd798080cdfd8af9aa5
      Location: usb-fe380000.usb-1.2/input1
      ControllerNumber: 0
      UniqueId: 
      Identifier: bus=0x0003, vendor=0x1a81, product=0x1708, version=0x0111
      KeyLayoutFile: /system/usr/keylayout/Generic.kl
      KeyCharacterMapFile: /system/usr/keychars/Generic.kcm
      ConfigurationFile: 
      HaveKeyboardLayoutOverlay: false
    4: Wireless Dongle Wireless Dongle
      Classes: 0x80000403
      Path: /dev/input/event4
      Descriptor: c45b6e64e9926d9f35247077439c613b8b7e45c9
      Location: usb-fe380000.usb-1.2/input0
      ControllerNumber: 0
      UniqueId: 
      Identifier: bus=0x0003, vendor=0x1a81, product=0x1708, version=0x0111
      KeyLayoutFile: /system/usr/keylayout/Generic.kl
      KeyCharacterMapFile: /system/usr/keychars/Generic.kcm
      ConfigurationFile: 
      HaveKeyboardLayoutOverlay: false
    5: rockchip-cdndp-sound DP Jack
      Classes: 0x00000080
      Path: /dev/input/event3
      Descriptor: 23317a5b4c4d5423860903fd285bf549717af875
      Location: ALSA
      ControllerNumber: 0
      UniqueId: 
      Identifier: bus=0x0000, vendor=0x0000, product=0x0000, version=0x0000
      KeyLayoutFile: 
      KeyCharacterMapFile: 
      ConfigurationFile: 
      HaveKeyboardLayoutOverlay: false
    6: ff420030.pwm
      Classes: 0x00000421
      Path: /dev/input/event0
      Descriptor: d2c52ff0f656fac4cd7b7a118d575e0109a9fe1c
      Location: gpio-keys/remotectl
      ControllerNumber: 0
      UniqueId: 
      Identifier: bus=0x0019, vendor=0x0001, product=0x0001, version=0x0100
      KeyLayoutFile: /system/usr/keylayout/ff420030_pwm.kl
      KeyCharacterMapFile: /system/usr/keychars/Generic.kcm
      ConfigurationFile: 
      HaveKeyboardLayoutOverlay: false
    7: rockchip,rt5640-codec Headphone Jack
      Classes: 0x00000080
      Path: /dev/input/event2
      Descriptor: 91a2e159684d109b18f61ebd65a13015ec12ac48
      Location: ALSA
      ControllerNumber: 0
      UniqueId: 
      Identifier: bus=0x0000, vendor=0x0000, product=0x0000, version=0x0000
      KeyLayoutFile: 
      KeyCharacterMapFile: 
      ConfigurationFile: 
      HaveKeyboardLayoutOverlay: false
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值