--- Begin Message ---
Subject: |
[PATCH] When processing incoming phone book messages, skip unrelated errors. |
Date: |
Sun, 8 Jul 2007 21:32:55 -0700 |
I think this is a kludge-around for stale messages getting processed at the
wrong time -- messages related to previous GetPhonebook requests are
delivered during WritePhonebook processing and confusing things. This patch
just skips messages unrelated to the most recent request.
---
common/phones/nk6510.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/common/phones/nk6510.c b/common/phones/nk6510.c
index bbc1727..58135f4 100644
--- a/common/phones/nk6510.c
+++ b/common/phones/nk6510.c
@@ -2005,6 +2005,7 @@ static gn_error NK6510_IncomingPhonebook(int messagetype,
unsigned char *message
{
unsigned char blocks;
int memtype;
+ char *req = state->last_msg;
switch (message[3]) {
case 0x04: /* Get status response */
@@ -2020,6 +2021,10 @@ static gn_error NK6510_IncomingPhonebook(int
messagetype, unsigned char *message
}
break;
case 0x08: /* Read Memory response */
+ if (req && req[3] != 0x7) {
+ fprintf (stderr, "Got read memory response back at
unexpected time\n");
+ return GN_ERR_UNSOLICITED;
+ }
if (data->phonebook_entry) {
data->phonebook_entry->empty = true;
data->phonebook_entry->caller_group = 5; /* no group */
@@ -2071,6 +2076,18 @@ static gn_error NK6510_IncomingPhonebook(int
messagetype, unsigned char *message
case 0x0c: /* Write memory location */
if (message[6] == 0x0f) {
+ fprintf (stderr, "Failed to write memory location error
0x%x\n", message[10]);
+ if (data->phonebook_entry) {
+ gn_phonebook_entry *entry =
data->phonebook_entry;
+ int i;
+ fprintf (stderr, "\tmem_type: %d location: %d
name: %s\n",
+ entry->memory_type, entry->location,
entry->name);
+ for (i = 0; i < entry->subentries_count; i++)
+ fprintf (stderr, "\tentry_type: %d
number_type: %d number: %s\n",
+
entry->subentries[i].entry_type,
+
entry->subentries[i].number_type,
+
entry->subentries[i].data.number);
+ }
switch (message[10]) {
case 0x0f: return GN_ERR_WRONGDATAFORMAT; /* I got this
when sending incorrect
block
(with 0 length) */
@@ -2086,6 +2103,7 @@ static gn_error NK6510_IncomingPhonebook(int messagetype,
unsigned char *message
break;
case 0x10:
if (message[6] == 0x0f) {
+ printf ("response 0x10 error 0x%x\n", message[10]);
switch (message[10]) {
case 0x33: return GN_ERR_WRONGDATAFORMAT;
case 0x34: return GN_ERR_INVALIDLOCATION;
--
1.5.2.2
--- End Message ---
--- Begin Message ---
Subject: |
confirm 94e02935fc1929b6c01dc6fa11774c97e48f7a61 |
If you reply to this message, keeping the Subject: header intact,
Mailman will discard the held message. Do this if the message is
spam. If you reply to this message and include an Approved: header
with the list password in it, the message will be approved for posting
to the list. The Approved: header can also appear in the first line
of the body of the reply.
--- End Message ---