I am trying to write a kernel module which loads upon detection of USB Mouse. I am new to this stuff, I googled for this issue but couldn't find any appropriate solution.
can anyone please explain flow of this?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityI am trying to write a kernel module which loads upon detection of USB Mouse. I am new to this stuff, I googled for this issue but couldn't find any appropriate solution.
can anyone please explain flow of this?
Very generic question, so very superficial answer:
The USB events bubble up to the part of the kernel that deals with new USB devices. This talks to the part of the kernel that can load modules on demand. This in turn looks for modules with an alias
that fit the USB vendor and product id (or other USB fields). It may also make the decision by USB class.
Many USB mice are HID (human interface device) standard USB devices. In that case, the HID layer kicks in, the kernel will read the HID descriptor for the mouse, and interpret the HID events accordingly.
So if you could include information in your question about what kind of USB mouse it is (via lsusb -v
), and why it doesn't work with the available drivers, that would be helpful...