2

Is it possible to prevent a kernel driver from loading for a specific USB device?

One approach is to use modprobe.conf and assign the USB device to a dummy module but this doesn't appear to work. The Linux distribution I'm using is for an embedded system and has the driver I'm looking to disable compiled directly and NOT compiled as a module.

It looks like you can blacklist the initcall as a kernel boot parameter (initcall_blacklist=xx) but that also doesn't appear to work or I'm using the wrong method name.

I'm trying to black mt76x2u so I've tried:

init_blacklist=mt76x2_drv_init

SofaKng
  • 323
  • Alternatively you can in user-mode, tell the system to ignore the device. – ctrl-alt-delor Oct 19 '20 at 20:20
  • can you provide more information on that? I need the USB device to be accessible by libusb (and not have the kernel driver attempt to communicate with it). – SofaKng Oct 19 '20 at 20:27
  • Sorry not my area of expertise. Just something I read about, and had to do one while following instructions. I don't know if it will be good enough. But maybe. – ctrl-alt-delor Oct 19 '20 at 20:30

1 Answers1

1

Try this:

initcall_blacklist=mt76pci_probe,mt76x2u_probe

Source: the Linux kernel source code.

initcall_blacklist requires CONFIG_KALLSYMS

  • I'll give that a try. Thanks! Is it normal that the mt76 driver code doesn't appear to have a module_init() or module_exit() methods? – SofaKng Oct 20 '20 at 00:24
  • I'm not sure how it all works. @StephenKit might have an answer. He originally offered a init_blacklist solution only nowadays it's called differently. – Artem S. Tashkinov Oct 20 '20 at 01:27