On Mon, Feb 13, 2023 at 5:16 PM Giuseppe Sacco <giuseppe@xxxxxxxxx> wrote:
Hello Mantas,
Il giorno lun, 13/02/2023 alle 14.32 +0100, Giuseppe Sacco ha scritto:
> Il giorno lun, 13/02/2023 alle 15.25 +0200, Mantas Mikulėnas ha scritto:
> > On Mon, Feb 13, 2023 at 3:21 PM Giuseppe Sacco <giuseppe@xxxxxxxxx>
> > wrote:
> > > [...]
> > > In this scenario, the ptys are created by software like iaxmodem
> > > (that uses
> > > asterisk) when its daemon starts. Some more information is available
> > > at
> > > Debian bug 1031200 (http://bugs.debian.org/1031200) and a suggested
> > > solution is to change the unit and depend on the pty daemon service
> > > and
> > > on
> > > the a file system link in /dev that points to the real device in
> > > /dev/pty/
> > > (the link being created by the pty service at startup time).
> > >
> > > Something like:
> > >
> > > [Unit]
> > > Description=HylaFAX faxgetty %I
> > > Wants=iaxmodem.service dev-%i.device
> >
> > I can't see how that would work. Udev doesn't issue events for symlinks
> > –
> > a symlink to something that's not a "device" is still not a device.
>
> Yes, that's my point of view too. That's way I am asking here.
>
> > Would it be enough to order faxgetty After=iaxmodem.service, i.e. wait
> > until it has created *all* of the ptys that it was set up to create?
> > Are
> > they preconfigured or do they show up dynamically?
>
> I don't know. I am going to check.
The link in /dev is created by the iaxmodem service when it starts, and
deleted when it stops. I think you may configure more than one line in
iaxmodem, so you will have many links, like /dev/ttyIAX0 and /dev/ttyIAX1.
BTW, this seems to be working: the dev-%i.device listed in Wants, even if
it only refers to a link, seems to be working.
If you mean the service starts, then it's only working as in "it does nothing at all" – Wants= does not imply After=, and a plain Wants= without After= just becomes a no-op if it refers to an nonexistent unit. It might as well be "Wants=dev-foobar.device".
Wants= *with* After= would wait for the .device to appear even if it
doesn't exist (I think that's special-cased for .device and .mount dependencies), but if you tried to use a symlink to a non-device you'd likely get a "Timed out waiting for dev-ttyFOO.device".
--
Mantas Mikulėnas