HylaFAX The world's most advanced open source fax server

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

Re: Re: egetty and vgetty



Dear Matthias and Camdem,

I am afraid that trying to clarify, and due to my lack of 
understanding I introduced some confusion. First, thanks Camdem for 
the clarification, now I know what the dup2 statements are doing. 

1) The business of closing the modem fd is what I was told by the 
author of the patch. When I checked the code that was not what he was 
doing (probably his memory failed). (See my previous email on the 
subject)

2) The problem seems to be that in Linux, for whatever the reason, 
when egetty returns control to the parent process, the output from 
the modem gets lost (as you saw in the strace file I sent you). There 
is also a write(fd, ...) errno 5 reported. And Hylafax hangs up the 
call without answering in fax mode (when returning calltype_fax).

3) This problem can be easily corrected by having hylafax issue the 
ata command after egetty returns.

A question, would anybody explain to me why in Gettt.c++ it is not 
necessary to dup2 the stdin file descriptor and only the stdout and 
etderr??? to redirect the standard input and output to the fd of the 
modem.

Thanks in advance,

Julio

> From:          Matthias.Apitz@SOFTCON.de
> Subject:       Re: flexfax: Re: egetty and vgetty
> To:            cclarke@inconceivable.com (Camden Clarke)
> Date:          Thu, 30 Oct 1997 09:58:18 +0100 (MEZ)
> Cc:            flexfax@sgi.com,
>                Julio C Spinelli <spine001@gold.tc.umn.edu> (Julio C Spinelli)
> Reply-to:      Matthias.Apitz@SOFTCON.de (Matthias Apitz)

> Camden Clarke wrote:
>     
>     
>     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
> 
> You're pretty much correct and my code below was only a small
> and dirty example (which works on my system too). I added this
> re-open because Julio has a patch for HylaFAX which closes the
> modem-Fd before handing the modem over to the child. Don't know
> why someone did this patch and at the moment I think this
> is not the way the things should changed, Julio?
> 
> 	matthias
>      
>     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);
>     >}
> 
> 




Project hosted by iFAX Solutions