コード例 #1
0
ファイル: Dolphin.c プロジェクト: puskyer/mgetty
static int Dolphin_set_device (int device)
{
    reset_watchdog();

    switch (device)
    {
    case NO_DEVICE:

        if (voice_write("AT+VLS=0") != OK)
            return(FAIL);

        if (voice_command("", "AT+VLS=0|OK") == VMA_USER_1)
            voice_command("", "OK");

        return(OK);
    case DIALUP_LINE:
        voice_command("AT+VLS=2", "VCON");
        return(OK);
    case INTERNAL_SPEAKER:
        voice_command("AT+VLS=16", "VCON");
        return(OK);
    };

    lprintf(L_WARN, "%s: Unknown output device (%d)", voice_modem_name,
            device);
    return(FAIL);
}
コード例 #2
0
ファイル: Multitech_2834.c プロジェクト: Distrotech/mgetty
void Multitech_2834_fix_modem(int expect_error)
{
	char buffer[VOICE_BUF_LEN];
	int result = VMA_FAIL;

        if (!cvd.enable_command_echo.d.i) {
  	   /* Multitech 2834 ZDXV modem (ROM 0416A NORTH AMERICAN) 
            * -- [email protected]
            *    As I understand the problem -- some Multitech 2834 ZDXv
            *    modems garble the command echo at certain points. To counter
            *    this, a dummy command is sent at those points (just AT)
            *    and the echo is ignored: this is the purpose of
            *    Multitech_2834_fix_modem(). If echo is off, there is
            *    no need to prevent garbled commands echos, and thus no need
            *    for Multitech_2834_fix_modem() (in fact, it would fail).
            */

           return; 
        }

	/* my ZDXv with 0416A firmware seems to exhibit a bug here -
	 * if you send the modem 'AT', it echos 'TA'.  If you send it
	 * 'ATI', it echos 'TIA'!
	 */
	voice_write("AT");
	do {
		if (voice_read(buffer) != OK) {
			voice_flush(1);
			break;
		}

		result = voice_analyze(buffer, "AT", TRUE);

		if (result == VMA_FAIL) {
			voice_flush(1);
			break;
		}

		if (result == VMA_ERROR) {
			lprintf(L_WARN, "%s: Modem returned ERROR",
	        		program_name);
			voice_flush(1);
			break;
		}
	} while (result != VMA_USER_1);

	if (result == VMA_USER_1 && expect_error)
        	lprintf(L_WARN, "%s: Modem answered correctly - mail [email protected]",
        		program_name);
        if (result != VMA_USER_1 && !expect_error)
        	lprintf(L_WARN, "%s: Modem answered incorrectly - mail [email protected]",
			program_name); 
}
コード例 #3
0
ファイル: ISDN4Linux.c プロジェクト: OPSF/uClinux
static int ISDN4Linux_set_device(int device)
     {
     int result;
     reset_watchdog();

     switch (device)
          {
          case NO_DEVICE:
               voice_write("AT+VLS=0");
               result = voice_command("", "OK|NO CARRIER|AT+VLS=0");

               if (result == VMA_USER_3)
                    result = voice_command("", "OK|NO CARRIER");

               switch(result)
                    {
                    case VMA_USER_2:
                         queue_event(create_event(NO_CARRIER));
                         /* Fall through */
                    case VMA_USER_1:
                         return (OK);
                    }

               return(FAIL);
          case DIALUP_LINE:

               switch (voice_command("AT+VLS=2", "VCON|OK|NO CARRIER"))
                    {
                    case VMA_USER_3:
                         queue_event(create_event(NO_CARRIER));
                         /* Fall through */
                    case VMA_USER_1:
                    case VMA_USER_2:
                         return(OK);
                    }

               return(FAIL);
          }

     lprintf(L_WARN, "ISDN4Linux handle event: Unknown output device (%d)",
      device);
     return(FAIL);
     }