[systemd-devel] systemd unit review requested

Peter Hutterer peter.hutterer at who-t.net
Tue Dec 10 18:34:54 PST 2013


On Tue, Dec 10, 2013 at 08:20:17PM +0100, Lennart Poettering wrote:
> 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.

ok, after spending half the day going down the most likely wrong track: are
we talking about auto-loading the module once inputattach is launched, or
dropping the need for inputattach?

because if it's the former then yes, I can confirm that works and the module
is loaded correctly so the modalias seems to work here. we can drop the kmod
from the udev rule.

if it's the latter, I've got nfi how to get there.  it's a maze of
callbacks and somewhere something is missing or I'm just not understanding
the approach correctly. that'll take more time to figure out than I want to
spend on it (wacom serial devices are discontinued, and not particularly
plentyful to begin with).

> > 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?

sorry, I wasn't clear enough. inputattach does the above and then just sits
with a 0-byte read() to keep the line open. as soon as inputattach finishes
the device will revert back to just being a serial device.
so it's definitely not a one-shot, we need it to sit there.

Cheers,
   Peter



More information about the systemd-devel mailing list