Re: autoloading module when matching device

From: Warner Losh <imp_at_bsdimp.com>
Date: Sat, 10 Dec 2022 05:31:50 UTC
On Fri, Dec 9, 2022 at 12:50 PM Fernando Apesteguía <fernape@freebsd.org>
wrote:

> Forwarding from developers@ by indication of Hans,
>
> Maybe a devd(8) can do this?
>
> Just to be clear, the keyboard works nicely, but it would be better if
> it was detected during the hotplug :-)
>

Usually the USB devices that are keyboards autoload the right driver(s).

So, sure, you could use a hack in devd to do this (it was how we did all
the matching before devmatch harvested the matches from the .ko files),
but maybe a better question is why aren't the driver(s) automatically loaded
when the NOMATCH event gets generated when the device is plugged in?

Warner


> Thanks!
> ---------- Forwarded message ---------
> From: Hans Petter Selasky <hps@selasky.org>
> Date: Fri, Dec 9, 2022 at 8:34 PM
> Subject: Re: autoloading module when matching device
> To: Fernando Apesteguía <fernape@freebsd.org>, developers
> <developers@freebsd.org>
>
>
> On 12/9/22 19:57, Fernando Apesteguía wrote:
> > Hi all,
> >
> > I have a new usb keyboard that uses the ums(4) driver. However I need
> > to add it to kld_list to preload it since the module is not autoloaded
> > when the keyboard is plugged in. The keyboard I want to replace is
> > properly detected when plugged in, though. I thought there would be
> > some place where I could add some device id and map it to ums(4), but
> > I can't find it. I've had a look at devmatch(8) but I can't find any
> > related config files.
> >
> > Where do I need to look?
> >
> > Thanks!
>
> Hi Fernando,
>
> There is no such quirk yet. There are only quirks via usbconfig to
> prevent attach of ums or ukbd.
>
> However, this is a perfect question for freebsd-usb@freebsd.org . Let's
> continue there!
>
> --HPS
>
>