How to force linux kernel to load my custom module instead of default one ? There is a file:

/lib/modules/$(uname -r)/modules.order

Seems like it is responsible to load modules in specific order. How it can be generated to prioritize my module or maybe it is enough to place it in /etc/modules-load.d for loading during boot and create udev rule binding hardware by productID and vendorID to this custom module ?


usbhid module is used for mouse and keyboard. I want my mouse uses my custom module instead of usbhid.

  • 1
    Why not just give it a different name?
    – Bib
    Aug 29, 2021 at 15:19
  • Remove the existing one? Use insmod instead? Aug 29, 2021 at 15:21
  • @Bib It will not change anything. Default module will still be loaded and binded e.g. usbhid module will be loaded instead of my custom mouse module (with different name).
    – EdiD
    Aug 29, 2021 at 15:21
  • 1
    Have you read the man page? insmod is not modprobe and it's not automatic module loading. Aug 29, 2021 at 15:46
  • 1
    You're changing your question on the fly. That sucks a lot. Please think it through first next time. OK, normally it's not possible unless the particular module allows to blacklist devices or you need to patch the module so that it ignored certain devices. usbhid has this: parm: quirks:Add/modify USB HID quirks by specifying quirks=vendorID:productID:quirks where vendorID, productID, and quirks are all in 0x-prefixed hex (array of charp). Aug 29, 2021 at 16:45


You must log in to answer this question.

Browse other questions tagged .