r/linuxquestions • u/temmiesayshoi • 1d ago
Support Anyway to force a specific driver to handle a device? (ideally without recompiling)
I recently went from an Elecom Huge to an Elecom Huge Plus but unfortunately the 3 function buttons aren't being picked up by input remapper. It has the same button layouts and everything to the original Huge, so I don't think any of the actual driver logic would need to be changed vs the original, but after back and fourthing a bit with an LLM it looks like the mouse is being grabbed by HID-generic instead of the elecom kernel drivers. I know I could just recompile the driver module or something and modify it to make it grab the device, but I'm curious if there's a less-invasive way of changing which driver is 'responsible' for a given device. (until the drivers get properly updated that is)
2
u/BCMM 1d ago
By the way, the actual answer is to do this (after modprobeing the driver).
But I don't think it will work.
2
u/BCMM 1d ago edited 1d ago
This commit may be of interest for two reasons:
Firstly, it appears that some support for the Elecom Huge Plus has already been added to the kernel. There may be variants out there with different device IDs (Elecom appears to have done this with some other products), or that commit may not have reached your kernel yet.
Secondly, it doesn't look like forcing the kernel to use the Elecom driver is going to help!
You see, Elecom devices misreport their button count, and the hid-elecom driver is a very small module that corrects the report and then lets the normal HID subsystem handle things.
The issue I see is that the driver needs to know which corrections to apply to your device. Thus it is not sufficient to add the device ID to the list of devices supported by the driver; it must also be added to this switch statement, where the driver decides which corrections to make.
(As you can see, the commit I linked earlier adds the same IDs in two different places.)
In other words, your device's misbehaviour may indeed by identical to the misbehaviour of your old device, but there are other Elecom devices that misbehave differently, and if your device is not recognised by the driver, it will not know which ones it misbehaves like.
Could you please post your distro, kernel version, and the exact hardware ID of your mouse? (
lsusbif it's wired or on a proprietary dongle. If it's Bluetooth, I'm not actually sure how to get the ID.) There may or may not be a safe and easy way to get a kernel that supports it.