Binding a mouse to a custom Character Device driver instead of the generic HID one
0
votes
1
answer
563
views
I am trying to write a simple Linux USB mouse driver, and I've run into a problem with actually getting the information from the mouse to the module.
Right now I have a kernel module that can be successfully loaded into the kernel. The module is a character device, and I can access this device via the
/dev/mymodule
file, writing and reading from it calls the functions I implemented.
However, I don't understand how to feed the data coming from my mouse to this character driver. The mouse has a separate file in /dev/input
that I can read from, and, when looking at the mouse's entry at /sys/bus/hid/devices/
I can see that the mouse uses the -generic
driver (and works like an actual mouse).
How can I make the mouse use the character device driver? (preferably this exact mouse and not any others connected to my PC). I feel like I'm misunderstanding something fundamental.
Things I've tried that didn't work:
* Adding (/modalias>)
to the module source.
* Adding
as follows:
static struct hid_device_id mod_table [] = {
{HID_USB_DEVICE(1532, 0043)},
{}
};
MODULE_DEVICE_TABLE(hid, mod_table);
In both cases aliases appeared in the .alias
after
, but they don't seem to do anything.
Another thing I tried is
ing the generic driver, but I don't know what to bind the mouse to for my character driver. Do I need to implement something else for this case?
Any help would be appreciated.
Asked by TheOwlk
(3 rep)
Jan 21, 2023, 01:18 AM
Last activity: Jan 24, 2023, 11:38 AM
Last activity: Jan 24, 2023, 11:38 AM