当前位置: 技术问答>linux和unix
如何禁止内核抢先加载已知USB驱动?
来源: 互联网 发布时间:2016-10-03
本文导语: make&insmod,然后插入北通的游戏手柄,dmesg输出: usb 5-1.4: new low speed USB device using uhci_hcd and address 6 usb 5-1.4: New USB device found, idVendor=0e8f, idProduct=0002 usb 5-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=...
make&insmod,然后插入北通的游戏手柄,dmesg输出:
usb 5-1.4: new low speed USB device using uhci_hcd and address 6
usb 5-1.4: New USB device found, idVendor=0e8f, idProduct=0002
usb 5-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 5-1.4: Product: BETOP USB GAMEPAD
usb 5-1.4: Manufacturer: GreenAsia Inc.
input: GreenAsia Inc. BETOP USB GAMEPAD as /devices/pci0000:00/0000:00:1d.0/usb5/5-1/5-1.4/5-1.4:1.0/input/input12
generic-usb 0003:0E8F:0002.0004: input,hidraw1: USB HID v1.10 Joystick [GreenAsia Inc. BETOP USB GAMEPAD] on usb-0000:00:1d.0-1.4/input0
但是我自己写的驱动的probe函数没有被调用
把VendorID和ProductID改为工行U盾对应的值,重新make&insmod,然后插入U盾,这个时候probe函数被调用了,dmesg:
usb 5-1.1: new low speed USB device using uhci_hcd and address 7
usb 5-1.1: New USB device found, idVendor=096e, idProduct=0010
usb 5-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 5-1.1: Product: Giesecke & Devrient StarKey
usb 5-1.1: Manufacturer: STMicroelectronic
我的猜测是对于游戏手柄内核已经有相应的驱动,所以直接启用原有驱动,不会加载我自己写的驱动,而对于工行U盾内核没有对应的驱动,所以匹配到我的驱动了,如果是这样又怎样禁止内核抢先加载USB驱动?
usb 5-1.4: new low speed USB device using uhci_hcd and address 6
usb 5-1.4: New USB device found, idVendor=0e8f, idProduct=0002
usb 5-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 5-1.4: Product: BETOP USB GAMEPAD
usb 5-1.4: Manufacturer: GreenAsia Inc.
input: GreenAsia Inc. BETOP USB GAMEPAD as /devices/pci0000:00/0000:00:1d.0/usb5/5-1/5-1.4/5-1.4:1.0/input/input12
generic-usb 0003:0E8F:0002.0004: input,hidraw1: USB HID v1.10 Joystick [GreenAsia Inc. BETOP USB GAMEPAD] on usb-0000:00:1d.0-1.4/input0
但是我自己写的驱动的probe函数没有被调用
把VendorID和ProductID改为工行U盾对应的值,重新make&insmod,然后插入U盾,这个时候probe函数被调用了,dmesg:
usb 5-1.1: new low speed USB device using uhci_hcd and address 7
usb 5-1.1: New USB device found, idVendor=096e, idProduct=0010
usb 5-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 5-1.1: Product: Giesecke & Devrient StarKey
usb 5-1.1: Manufacturer: STMicroelectronic
我的猜测是对于游戏手柄内核已经有相应的驱动,所以直接启用原有驱动,不会加载我自己写的驱动,而对于工行U盾内核没有对应的驱动,所以匹配到我的驱动了,如果是这样又怎样禁止内核抢先加载USB驱动?
|
你只要找到内核原有的驱动,把它禁用掉即可
http://hi.baidu.com/deep_pro/blog/item/415ec217bdead20c4b90a77d.html
http://hi.baidu.com/deep_pro/blog/item/415ec217bdead20c4b90a77d.html
|
preempt这个字段可以禁止内核抢占