Hylafax Mailing List Archives

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: egetty



Sorry that it took so long for me to follow on on this subject, but I 
have been very busy at work.

After thorough investigation I found that the problem in Linux 2.0.29 
is that when Getty:run does a dup2 to duplicate the modem file 
descriptor into the standard output, in the child process, this destroys the file 
descriptor that point to the modem in the parent process. Why does 
this happens, it escapes me totally. I may look into the kernel 
source during my vacations (may be not...)

Whenever the dup2 is executed in the child the parent process can not 
read or write to the modem when the child exits.

The only way I managed to make it work for Linux is to have the 
egetty have uid 0 and open and close the modem itself. By doing this 
the only change needed in Getty.c++ is an additional if statement 
that does not do any dup2 is done when egetty is called.

Matthias, are you interested in this for the pl2?
> 
> You don't actually have to open the modem in your egetty program; HylaFAX
> will leave you with stdin and stdout setup to the modem.  This is intentional,
> so that egetty doesn't have to know where to find the modem, or deal
> with opening it correctly for shared access (e.g. Suns).
>                 -Cam Clarke
>  
> In astatos.flex-fax you write:
>  
> >Julio C Spinelli wrote:
> >
> >    Thanks for the info. egetty is nothing, it does not exist at all. The
> >    only meaning of the string egetty is that if EGettyArgs is defined as
> >    a non nul string and AnswerRotary is set to "extern". Hylafax will
> >    call a program /bin/egetty. If that program does not exist...
> >
> >    It is the user/system developer's responsibility to write that
> >    program. This program's job is to answer the incoming call, determine
> >    its type and then exit with a CALLTYPE_XXX (FAX, DATA, DONE, ERROR,
> >    VOICE) code. Hylafax will then proceed as if it itself would have
> >    determined the type of call.
> >
> >    The issue I have is that when I do this I get a modem write error
> >    after calling the sys::write(fd,......   call and as I don't fully
> >    understand the inheritance rules that Sam applies and neither have I
> >    been able to understand the Dispatch class. I am at a loss in trying
> >    to guess what is going wrong.
> >
> >    This is why I am looking for any working example for simple and bare
> >    bones it is.
> >
> >    Thanks for your help,
> >
> >    Julio
> >
> >    Note: I hope this clarifies what egetty is.
>  
> >Try this small example. It works for me (don't blame me about
> >this C-code, it's not the way I'm writing real code :-))
> >It works for me and faxgetty(1M) receives the fax fine (see the log).
>  
> >   matthias
>  
>  
> >/* change this define to the real device on your system */
> >#define LINE "/dev/ttyFN02"
> >main()
> >{
> >   int fd;
> >   fd = open(LINE, 2);
> >   if(fd < 0)
> >       exit(0);
> >   write(fd, "ATA\r", 4);   /* time to pick up the call */
> >   close(fd);
> >   exit(2);
> >}
> 
> 



Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services