[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
at-emulator.c has ASCII values of CR and LF swapped
From: |
Daniele Forsi |
Subject: |
at-emulator.c has ASCII values of CR and LF swapped |
Date: |
Mon, 20 Jun 2005 23:21:17 +0200 |
User-agent: |
KMail/1.4.3 |
I found that ASCII values for CR and LF are swapped.
The enclosed patch changes this and all strings to have a trailing \r\n,
except a couple of error strings and a couple of other strings which do need
it at the beginning.
With this patch gnokiid starts to be compatible with gnokii configured with
port = /dev/gnokii and model = AT :-) so that gnokii --identify at least
prints something useful (I'm going to submit another patch for this and other
things in the next days)
Daniele
Index: common/data/at-emulator.c
===================================================================
RCS file: /cvsroot/gnokii/gnokii/common/data/at-emulator.c,v
retrieving revision 1.42
diff -r1.42 at-emulator.c
180,181c180,181
< ModemRegisters[REG_CR] = 10;
< ModemRegisters[REG_LF] = 13;
---
> ModemRegisters[REG_CR] = 13;
> ModemRegisters[REG_LF] = 10;
256c256
< snprintf(buf, sizeof(buf), "DATE = %02d%02d\n\r", now->tm_mon +
1,
now->tm_mday);
---
> snprintf(buf, sizeof(buf), "DATE = %02d%02d\r\n", now->tm_mon +
> 1,
now->tm_mday);
259c259
< snprintf(buf, sizeof(buf), "TIME = %02d%02d\n\r", now->tm_hour,
now->tm_min);
---
> snprintf(buf, sizeof(buf), "TIME = %02d%02d\r\n", now->tm_hour,
now->tm_min);
265c265
< gn_atem_string_out("\n\rNAME = ");
---
> gn_atem_string_out("\r\nNAME = ");
267c267
< gn_atem_string_out("\n\r");
---
> gn_atem_string_out("\r\n");
294c294
< if (buffer[count] == ModemRegisters[REG_LF] &&
---
> if (buffer[count] == ModemRegisters[REG_CR] &&
303a304,305
> at_dprintf("read: ", CmdBuffer[CurrentCmdBuffer],
CurrentCmdBufferIndex);
>
614c616
< _("\n\rDate/time: %d/%d/%d %d:%02d:%02d Sender: %s Msg
Center:
%s\n\rText: %s\n\r"),
---
> _("\r\nDate/time: %d/%d/%d %d:%02d:%02d Sender: %s Msg
> Center:
%s\r\nText: %s\r\n"),
623c625
<
_("\"%s\",\"%s\",,\"%02d/%02d/%02d,%02d:%02d:%02d+%02d\"\n\r%s"),
---
>
> _("\"%s\",\"%s\",,\"%02d/%02d/%02d,%02d:%02d:%02d+%02d\"\r\n%s"),
631c633
<
_("\"%s\",\"%s\",,\"%02d/%02d/%02d,%02d:%02d:%02d+%02d\"\n\r%s"),
---
>
> _("\"%s\",\"%s\",,\"%02d/%02d/%02d,%02d:%02d:%02d+%02d\"\r\n%s"),
663c665
< gsprintf(buffer, MAX_LINE_LENGTH, _("\n\rNo message under
number %d\n\r"),
SMSNumber);
---
> gsprintf(buffer, MAX_LINE_LENGTH, _("\r\nNo message under
> number %d\r\n"),
SMSNumber);
674,677c676,679
< gn_atem_string_out(_("\n\rThe following commands work...\n\r"));
< gn_atem_string_out("DIR\n\r");
< gn_atem_string_out("EXIT\n\r");
< gn_atem_string_out("HELP\n\r");
---
> gn_atem_string_out(_("\r\nThe following commands work...\r\n"));
> gn_atem_string_out("DIR\r\n");
> gn_atem_string_out("EXIT\r\n");
> gn_atem_string_out("HELP\r\n");
750c752
< gsprintf(buffer, MAX_LINE_LENGTH, "\n\r+CMGS:
%d", data.sms->number);
---
> gsprintf(buffer, MAX_LINE_LENGTH, "+CMGS:
> %d\r\n", data.sms->number);
773c775
< gn_atem_string_out("\n\r> ");
---
> gn_atem_string_out("\r\n> ");
792c794
< gsprintf(buffer, MAX_LINE_LENGTH, "\n\r+CSQ: %0.0f,
99",
*(data.rf_level));
---
> gsprintf(buffer, MAX_LINE_LENGTH, "+CSQ: %0.0f,
> 99\r\n",
*(data.rf_level));
804c806
< gn_atem_string_out(_("\n\rNokia Mobile Phones"));
---
> gn_atem_string_out(_("Nokia Mobile Phones\r\n"));
813c815
< gsprintf(buffer, MAX_LINE_LENGTH, "\n\r%s", data.imei);
---
> gsprintf(buffer, MAX_LINE_LENGTH, "%s\r\n", data.imei);
826c828
< gsprintf(buffer, MAX_LINE_LENGTH, "\n\r%s",
data.revision);
---
> gsprintf(buffer, MAX_LINE_LENGTH, "%s\r\n",
> data.revision);
839c841
< gsprintf(buffer, MAX_LINE_LENGTH, "\n\r%s", data.model);
---
> gsprintf(buffer, MAX_LINE_LENGTH, "%s\r\n", data.model);
864c866
< gsprintf(buffer, MAX_LINE_LENGTH, "\n\r+CMS
ERROR: %d\n\r", error);
---
> gsprintf(buffer, MAX_LINE_LENGTH, "\r\n+CMS
> ERROR: %d\r\n", error);
896c898
< gsprintf(buffer, MAX_LINE_LENGTH, "\n\r+CMGF: %d",
MessageFormat);
---
> gsprintf(buffer, MAX_LINE_LENGTH, "+CMGF: %d\r\n",
> MessageFormat);
921c923
< gsprintf(buffer, MAX_LINE_LENGTH, "\n\r+CMGR:
%s", buffer2);
---
> gsprintf(buffer, MAX_LINE_LENGTH, "+CMGR:
> %s\r\n", buffer2);
925c927
< gsprintf(buffer, MAX_LINE_LENGTH, "\n\r+CMS
ERROR: %d\n\r", error);
---
> gsprintf(buffer, MAX_LINE_LENGTH, "\r\n+CMS
> ERROR: %d\r\n", error);
945c947
< gn_atem_string_out("\n\r> ");
---
> gn_atem_string_out("\r\n> ");
995c997
< gsprintf(buffer,
MAX_LINE_LENGTH, "\n\r+CMGL: %d,%s", index, buffer2);
---
> gsprintf(buffer,
> MAX_LINE_LENGTH, "+CMGL: %d,%s\r\n", index, buffer2);
1004c1006
< gsprintf(buffer, MAX_LINE_LENGTH,
"\n\r+CMS ERROR: %d\n\r", error);
---
> gsprintf(buffer, MAX_LINE_LENGTH,
> "\r\n+CMS ERROR: %d\r\n", error);
1028c1030
< gn_atem_string_out(_("\n\rHugh Blemings, Pavel Janik ml. and
others..."));
---
> gn_atem_string_out(_("Hugh Blemings, Pavel Janik ml. and
> others...\r\n"));
1035c1037
< gsprintf(buffer, MAX_LINE_LENGTH, "\n\r%s %s %s", VERSION,
__TIME__,
__DATE__);
---
> gsprintf(buffer, MAX_LINE_LENGTH, "%s %s %s\r\n", VERSION,
> __TIME__,
__DATE__);
1045c1047
< gsprintf(buffer, MAX_LINE_LENGTH, _("\n\rgnokii configured on
%s for
models %s"), sm->config.port_device, sm->driver.phone.models);
---
> gsprintf(buffer, MAX_LINE_LENGTH, _("gnokii configured on %s
> for models
%s\r\n"), sm->config.port_device, sm->driver.phone.models);
1054c1056
< gsprintf(buffer, MAX_LINE_LENGTH, _("\n\rnone built in, choose
your
own"));
---
> gsprintf(buffer, MAX_LINE_LENGTH, _("none built in, choose your
own\r\n"));
1073c1075
< gsprintf(buffer, MAX_LINE_LENGTH, "%d\n\r",
CallerIDMode);
---
> gsprintf(buffer, MAX_LINE_LENGTH, "%d\r\n",
> CallerIDMode);
1080c1082
< gn_atem_string_out("0,1\n\r");
---
> gn_atem_string_out("0,1\r\n");
1102c1104
< sprintf(buffer, "%d\n\r", code);
---
> sprintf(buffer, "%d\r\n", code);
1107c1109
< gn_atem_string_out("OK\n\r");
---
> gn_atem_string_out("OK\r\n");
1111c1113
< gn_atem_string_out("ERROR\n\r");
---
> gn_atem_string_out("ERROR\r\n");
1115c1117
< gn_atem_string_out("CARRIER\n\r");
---
> gn_atem_string_out("CARRIER\r\n");
1119c1121
< gn_atem_string_out("CONNECT\n\r");
---
> gn_atem_string_out("CONNECT\r\n");
1123c1125
< gn_atem_string_out("NO CARRIER\n\r");
---
> gn_atem_string_out("NO CARRIER\r\n");
1126c1128
< gn_atem_string_out("RING\n\r");
---
> gn_atem_string_out("RING\r\n");
1129c1131
< gn_atem_string_out(_("\n\rUnknown
Result Code!\n\r"));
---
> gn_atem_string_out(_("\r\nUnknown
> Result Code!\r\n"));
1157a1160,1161
> at_dprintf("write: ", buffer, strlen(buffer));
>
- at-emulator.c has ASCII values of CR and LF swapped,
Daniele Forsi <=