Questions about the USB HID device drivers

Specifically, I'm interested in how the USB keyboard & mouse drivers publish their nodes. I've been combing through the sources of both drivers in an attempt to understand a) how they make available the data from their devices, b) how they publish their device nodes, and c) where all of the code that implements both sets of sequences is stored at in the source tree. I currently see the ukb & ums driver sources. Beyond that, I'm not sure where to look in order to follow the path between those drivers & /dev. Can anyone help me understand this?
 
I'm not sure if this is what you mean, but keyboards are usually attached to (and managed by) the keyboard multiplexer kbdmux(4), while mice are managed by sysmouse(4).

This is exactly what I'm looking for. However, I'm having difficulty with pinpointing exactly how keyboards talk to kbdmux & how mice talk to sysmouse, especially because ums & ukbd don't publish their own device nodes.
 
I think I might've made a break through. It seems that moused has to be configured to listen to specific device nodes for mouse data. I now see that one of the nodes that it's specifically setup to listen to is /dev/ums. I also see that kbdcontrol has to be configured to attach specific keyboards to the console, so it's setup to attach /dev/ukbd. Now that I understand this, my next question is more about usb device nodes. Is there a specific reason that ukbd and ums publish their nodes directly into /dev, instead of publishing into something like /dev/input? Is that a hard constraint of the usb system, or is it a default spot?
 
I'm not sure if this is what you mean, but keyboards are usually attached to (and managed by) the keyboard multiplexer kbdmux(4), while mice are managed by sysmouse(4).
I completely understand that it goes against basic Unix philosophy, however desktop usage would probably be better served by a single input solution that receives input from ALL input devices. Having 2 separate setups for the mouse & keyboard feels wrong to me. Though, that would probably be very difficult to accomplish considering the fact that there's absolutely no standard for publishing device nodes in /dev (besides each node having a unique name & a unique unit number). I wonder how well-received a proposal/patch for automatically publishing device nodes by a pre-established set of categories would be. For instance:

/dev/audio
/dev/bus
/dev/graphics
/dev/input

...and so on.
 
Back
Top