[systemd-devel] systemd unit review requested
Lennart Poettering
lennart at poettering.net
Tue Dec 10 11:20:17 PST 2013
On Mon, 09.12.13 12:18, Peter Hutterer (peter.hutterer at who-t.net) wrote:
>
> On Fri, Dec 06, 2013 at 04:10:02PM +0100, Kay Sievers wrote:
> > On Fri, Dec 6, 2013 at 7:20 AM, Peter Hutterer <peter.hutterer at who-t.net> wrote:
> >
> > >> >It also depends on the wacom_w8001 and how it reacts when it's loaded
> > >> >and no hardware is present.
> > >> >
> > >> >Peter, couldn't this module be autoloaded?
> > >
> > > the module just sits there, it needs to be triggered by
> > > inputattach to actually hook onto the device. there's a small number of
> > > devices only that need it, so unconditionally modprobing it seems a bit
> > > wasteful.
> >
> > Just curious:
> >
> > There is one auto-loading alias in the module for the serio bus:
> > $ modinfo wacom_w8001 | grep alias
> > alias: serio:ty02pr39id*ex*
> >
> > Does that work? For all devices or only a few?
> > Can the serial device be detected that way?
> > Does inputattach talk to the device to find out what it is?
>
> tbh, I'm not sure how to answer these questions, it's not something I've had
> to deal with in the past so I've got little to no knowledge of this.
If a module exposes those alias lines then the module is auto-loaded by
udev as soon as matching hardware shows up. That's the preferable way to
load kernel modules these days, instead of loading them explicitly they
way you are doing it.
Of course, what's behind an rs232 port is generally not automatically
discoverable, that's why Kay was asking whether the modalias line is
insufficient.
> inputattach does not talk to the device, it merely sets various fields as
> provided by the user, hence the --w8001 flag. other than that, it's pretty
> much down to four commands:
> open(dev/ttyS0)
> setline(fd, CS8, baudrate)
> ioctl(fd, TIOSETD, N_MOUSE)
> ioctl(fd, SPIOCSTYPE, SERIO_W8001)
>
> That's why we need the udev rule to match the pnpid, because inputattach
> doesn't do any matching and we need to provide the right arguments already.
> afaik the only way to detect the device is to search for e.g. WACf in
> the pnpid.
It sounds like a good idea to get rid of the explicit module loading and
simply rely on the modalias stuff for that. Then, if your program really
only does what you list above (i.e. nothing that can block for longer or
that needs to stay around during runtime), then you could just do this
synchronously as part of an udev rule, no?
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list