Re: /dev/input/mice doesn't work in test9?

From: Andrey Borzenkov
Date: Sun Nov 02 2003 - 13:57:10 EST


On Sunday 02 November 2003 15:08, DervishD wrote:
[...]
>
> > You have input built-in which means there is no reason for kernel
> > to try autoload driver for char-13 as it is already available.
>
> But not char-major-13-32, for example.
>

for kernel device == major. It is assumed that complete major is handled by
single driver. In exception cases when there are different drivers either you
have one acting like dispatcher (input case) or one that simply requests more
specific driver (misc case). But again, mousedev is using range of minors and
there is currently no established way to construct aliases for that. Short of
defining

alias char-major-13-32 mousedev
alias char-major-13-33 mousedev
...
alias char-major-13-63 mousedev

looks rather weird.

> > You may add explicit per-minor autoloading to input.c, see
> > drivers/input/input.c:input_open_file()
>
> But that code works with the 'input_table', and the
> input_handlers. The handlers are registered by the modules when they
> are already loaded. Do you mean that I should modify input_open_file
> in order to autoload the appropriate module in the case of the
> handler not being present?

yes with the caveats above.

[...]
>
> > If you are using hotplug, both should be loaded by hotplug. IMHO it is
> > also the right way to go.
>
> The problem is that hotplug doesn't work for me in this case. I
> mean, with hotplug in *this particular case*, since the mouse is
> always connected, the modules will be loaded on bootup and unloaded
> on shutdown, not when the mouse device is opened and closed,
> respectively.
>

that is what coldplug is for. Hotplug comes with initscript that (if enabled)
looks for devices already connected and emulates "connect" event for them. I
use it between other things to load mousedev for PS/2 mouse that is always
connected ... but I am running 2.6 in the first place (it won't work on 2.4)
and modified hotplug package that supports input handlers. So when it finds
any driver for input devices it automatically loads input handler for events
generated by those devices.

> I've tested with hotplug (well, I don't have hotplug utilities
> installed, just a shell script that tells me if someone is calling
> /sbin/hotplug and logs the parameters), and /sbin/hotplug is not
> called when I try to open /dev/mouse (c 13 32).
>

of course not. It works differently. When you plug in USB mouse (or when
hotplug initscript emulates plugging in USB mouse) hotplug calls USB agent.
USB agent checks USB device ID and finds which modules to load. It is
possible that it finds several modules. One of them is hardcoded - it is
mousedev. Another one is hid that declares itself as driver for USB mouse.
That simple.

[...]
>
> Yes, I'm going to build in hid, but, should I do the same with
> mousedev (or event, joystick, etc...) or will it work with hid loaded
> when doing 'cat /dev/mouse'?
>

yes you should build it in. Or ensure it is loaded together with hid.

-andrey

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/