How to handle incompatible modems?
Klaus Weidner (klaus@snarc.greenie.muc.de)
Sat, 5 Mar 1994 16:06:00 +0100
nelson@crynwr.com (Russell Nelson) wrote:
> I want to add support to mgetty+sendfax for modems based on the Cirrus
> MD9624 chipset. It's possible to automatically identify what modem is
> being used via the ATIn command. So I would say that the different
> commands/code should be hidden behind variables and pointers to
> functions (as opposed to ifdefs). Any suggestions on how I should do
> this?
This is something which I will have to do myself to support the
Rockwell voice commands in vgetty. I was thinking about two
separate steps:
- modularize the routines further, I would like to have no
explicit modem commands in routines like voice_send_file
if possible.
- create a structure which contains modem-specific settings.
This could contain a variety of stuff, i.e. booleans
to indicate if a feature is available, numeric codes
(i.e. maximum speaker volume), init strings, etc.
I'm thinking about putting in function pointers too, this
way you could replace one of the bottom-level functions
entirely without having to add tons of conditionals.
I.e., create a rockwell_do_beep() and zyxel_do_beep()
and initialize the structures appropiately. This might
be more readable than having to search through the
structure initializations to find out what exactly is
being sent to the modem.
It would be elegant if a new function, identify_modem(),
could reliably detect the modem type and initialize the
structure appropiately. That way, you wouldn't even
need to mess around with config files for this.
Klaus
--
\ klaus@snarc.greenie.muc.de--kweidner@physik.tu-muenchen.de--2:246/55.4
\ .signature error -- quote dumped