如何usb 触摸设备不识别为usb mouse

一、获取输入设备name。有一下两种方法

1、使用 cat /proc/bus/input/devices 可以查看 输入设备信息


I: Bus=0018 Vendor=0000 Product=0000 Version=0000
N: Name="generic ft5x06 (79)"
P: Phys=
S: Sysfs=/devices/platform/soc@0/30800000.bus/30a50000.i2c/i2c-3/3-0038/input/input4
U: Uniq=
H: Handlers=event3 
B: PROP=2
B: EV=b
B: KEY=400 0 0 0 0 0
B: ABS=260800000000003

I: Bus=0003 Vendor=10c4 Product=8108 Version=0111
N: Name="YSPRINGTECH USB OPTICAL MOUSE"
P: Phys=usb-xhci-hcd.0.auto-1.2/input0
S: Sysfs=/devices/platform/32f10108.usb/38200000.dwc3/xhci-hcd.0.auto/usb1/1-1/1-1.2/1-1.2:1.0/0003:10C4:8108.0005/input/input9
U: Uniq=
H: Handlers=event4 
B: PROP=0
B: EV=17
B: KEY=70000 0 0 0 0
B: REL=903
B: MSC=10

其中 name 为 input_dev->name。Vendor=10c4 Product=8108 为usb设备id

2.  cat /sys/class/input/event4/device/name
    YSPRINGTECH USB OPTICAL MOUSE

二 、修改内核代码 drivers/input/mousedev.c 添加

        if(dev->name == "YSPRINGTECH USB OPTICAL MOUSE")
                return 0;

如果 name为YSPRINGTECH USB OPTICAL MOUSE 。退出不生成usb mouse

static int mousedev_connect(struct input_handler *handler,
                            struct input_dev *dev,
                            const struct input_device_id *id)
{
        struct mousedev *mousedev;
        int error;
        if(dev->name == "YSPRINGTECH USB OPTICAL MOUSE")
                return 0;
        mousedev = mousedev_create(dev, handler, false);
        if (IS_ERR(mousedev))
                return PTR_ERR(mousedev);

        error = mixdev_add_device(mousedev);
        if (error) {
                mousedev_destroy(mousedev);
                return error;
        }

        return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
连接到HUB的USB设备的KERNELS路径通常可以通过以下步骤找到: 1. 运行`lsusb`命令,查看USB设备的Vendor ID和Product ID。例如,假设我们要查找连接到HUB上的USB鼠标设备,可以运行以下命令: ``` $ lsusb Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 006: ID 046d:c077 Logitech, Inc. M105 Optical Mouse Bus 001 Device 005: ID 05e3:0612 Genesys Logic, Inc. Hub Bus 001 Device 004: ID 05e3:0745 Genesys Logic, Inc. Logilink CR0012 Bus 001 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub ``` 从输出中可以看到,该鼠标设备的Vendor ID为046d,Product ID为c077。 2. 进入/sys/bus/usb/devices目录,查找对应的USB设备节点。例如,在上面的输出中,该鼠标设备连接到了Bus 001的Device 006,因此我们可以进入/sys/bus/usb/devices/1-3目录,查看该设备的KERNELS路径: ``` $ cd /sys/bus/usb/devices/1-3 $ ls -l total 0 drwxr-xr-x. 4 root root 0 Apr 20 17:20 1-3:1.0 lrwxrwxrwx. 1 root root 0 Apr 20 17:20 bDeviceClass -> ../../../../../../../class/input/ lrwxrwxrwx. 1 root root 0 Apr 20 17:20 bDeviceProtocol -> ../../../../../../../class/input/mouse0/protocol lrwxrwxrwx. 1 root root 0 Apr 20 17:20 bDeviceSubClass -> ../../../../../../../class/input/ lrwxrwxrwx. 1 root root 0 Apr 20 17:20 bcdDevice -> ../../../../../../../class/input/mouse0/version lrwxrwxrwx. 1 root root 0 Apr 20 17:20 bus -> ../../../../../../../bus/usb/ lrwxrwxrwx. 1 root root 0 Apr 20 17:20 configuration -> ../../../../../../../usb1/1-3/1-3:1.0/configuration -rw-r--r--. 1 root root 4.0K Apr 20 17:20 descriptors -rw-r--r--. 1 root root 4.0K Apr 20 17:20 devnum lrwxrwxrwx. 1 root root 0 Apr 20 17:20 device -> ../../../../../../../usb1/1-3/ -rw-r--r--. 1 root root 4.0K Apr 20 17:20 idProduct -rw-r--r--. 1 root root 4.0K Apr 20 17:20 idVendor -rw-r--r--. 1 root root 4.0K Apr 20 17:20 maxchild drwxr-xr-x. 2 root root 0 Apr 20 17:20 power lrwxrwxrwx. 1 root root 0 Apr 20 17:20 product -> ../../../../../../../usb1/1-3/1-3:1.0/product -r--r--r--. 1 root root 4.0K Apr 20 17:20 quirks -rw-r--r--. 1 root root 4.0K Apr 20 17:20 speed lrwxrwxrwx. 1 root root 0 Apr 20 17:20 subsystem -> ../../../../../../../bus/usb/ -rw-r--r--. 1 root root 4.0K Apr 20 17:20 uevent lrwxrwxrwx. 1 root root 0 Apr 20 17:20 usb_device -> ../../../../../../../usb1/1-3/ ``` 从输出中可以看到,该鼠标设备的KERNELS路径为1-3:1.0。 因此,连接到HUB的USB设备的KERNELS路径通常是/sys/bus/usb/devices/<Bus>-<Device>:<Interface>,其中Bus和Device是通过`lsusb`命令获得的,Interface通常为0或1。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值