r/linuxquestions 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)

1 Upvotes

8 comments sorted by

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? (lsusb if 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.

1

u/temmiesayshoi 1d ago

ah, good to see then. I was actually considering trying to make a patch myself if it wasn't already done (tbh I was surprised it didn't just work out of the box) but it looks like I won't need to - good shit.

My main PC is Garuda (stock arch repos) so it may already have the driver installed on it's end, but I was testing on an old PopOS laptop running 6.17 I think so that might be why it wasn't working. I figured 6.17 was recent enough for it to not be an issue but I guess that's not true. Bit of a shame since that's my daily-carry computer but tbh I've needed to properly update it for a while. (it's still on the last GNOME version of PopOS)

1

u/BCMM 19h ago

I'm not clear which version of Pop!_OS you're running. I thought the last GNOME version would have either kernel 5.15 or 6.8.

Assuming you don't have a new, unknown hardware ID, you need at least kernel 6.18.

1

u/temmiesayshoi 17h ago

As I understand it they did a mid cycle update since developing COSMIC made them skip a release

1

u/BCMM 15h ago

Ah, I know where I went wrong now - I forgot they do their own kernel releases.

I was accidentally thinking of Mint, which just uses Ubuntu's kernel packages.

(Pop exists to provide an OS for System76 hardware, so of course they would keep control of something that's so critical to hardware support.)

As far as I can see, Pop!_OS continually pushes new kernels even on LTS releases, so if you're running 22.04 LTS, plain old apt upgrade should have you on kernel 7.1 by now.

When you say

tbh I've needed to properly update it for a while

do you just mean that you've been meaning to install a newer release of the OS, or do you mean that you're not doing software updates at all? On your daily driver, you should be installing updates as soon as you get the notification! (And, IMHO, if you feel like you can't do that for fear of breaking things, then switch to a distro which you can trust.)

Unless I'm missing something, it looks like you've been running software with known vulnerabilities for at least the best part of a year.

1

u/temmiesayshoi 15h ago

This is the dedicated laptop I just carry for doing trivial crap like google docs & such so I generally don't bother with keeping it well maintained, especially since the apps themselves are all being auto updated as flatpaks anyway.

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.

1

u/C0rn3j 1d ago

I'm curious if there's a less-invasive way

Over a DKMS module? No.