diff -ru gnokii-0.5.10-orig/common/phones/atgen.c gnokii-0.5.10/common/phones/atgen.c --- gnokii-0.5.10-orig/common/phones/atgen.c 2004-02-01 17:59:32.000000000 +0200 +++ gnokii-0.5.10/common/phones/atgen.c 2004-08-31 00:29:15.000000000 +0300 @@ -668,6 +668,7 @@ unsigned char req[10240], req2[5120]; gn_error error; unsigned int length, tmp, offset = 0; + at_driver_instance *drvinst = AT_DRVINST(state); if (!data->raw_sms) return GN_ERR_INTERNALERROR; @@ -680,10 +681,14 @@ dprintf("PDU mode set\n"); /* Prepare the message and count the size */ - memcpy(req2, data->raw_sms->message_center, - data->raw_sms->message_center[0] + 1); - offset += data->raw_sms->message_center[0]; - + if(drvinst->no_smsc) { + /* not even a length byte included */ + offset--; + } else { + memcpy(req2, data->raw_sms->message_center, + data->raw_sms->message_center[0] + 1); + offset += data->raw_sms->message_center[0]; + } /* Validity period in relative format */ req2[offset + 1] = 0x01 | 0x10; if (data->raw_sms->reject_duplicates) req2[offset + 1] |= 0x04; @@ -709,7 +714,11 @@ /* Length in AT mode is the length of the full message minus * SMSC field length */ - sprintf(req, "AT+%s=%d\r", cmd, length - data->raw_sms->message_center[0] - 1); + if(drvinst->no_smsc) { + sprintf(req, "AT+%s=%d\r", cmd, length); + } else { + sprintf(req, "AT+%s=%d\r", cmd, length - data->raw_sms->message_center[0] - 1); + } dprintf("Sending initial sequence\n"); if (sm_message_send(strlen(req), GN_OP_AT_Prompt, req, state)) return GN_ERR_NOTREADY; @@ -736,6 +745,14 @@ gn_error err = AT_SetSMSMemoryType(data->raw_sms->memory_type, state); if (err) return err; + + err = state->driver.functions(GN_OP_AT_SetPDUMode, data, state); + if (err) { + dprintf("PDU mode not supported\n"); + return err; + } + dprintf("PDU mode set\n"); + sprintf(req, "AT+CMGR=%d\r", data->raw_sms->number); dprintf("%s", req); if (sm_message_send(strlen(req), GN_OP_GetSMS, req, state)) @@ -1124,6 +1141,7 @@ gn_error ret = GN_ERR_NONE; unsigned int sms_len, l, offset = 0; char *tmp; + at_driver_instance *drvinst = AT_DRVINST(state); if (buffer[0] != GN_AT_OK) return GN_ERR_INTERNALERROR; @@ -1143,14 +1161,18 @@ } dprintf("%s\n", buf.line3); hex2bin(tmp, buf.line3, sms_len); - l = tmp[offset] + 1; - if (l > sms_len || l > GN_SMS_SMSC_NUMBER_MAX_LENGTH) { - dprintf("Invalid message center length (%d)\n", l); - ret = GN_ERR_INTERNALERROR; - goto out; + + if(!drvinst->no_smsc) { + l = tmp[offset] + 1; + if (l > sms_len || l > GN_SMS_SMSC_NUMBER_MAX_LENGTH) { + dprintf("Invalid message center length (%d)\n", l); + ret = GN_ERR_INTERNALERROR; + goto out; + } + memcpy(data->raw_sms->message_center, tmp, l); + offset += l; } - memcpy(data->raw_sms->message_center, tmp, l); - offset += l; + data->raw_sms->type = (tmp[offset] & 0x03) << 1; data->raw_sms->udh_indicator = tmp[offset]; data->raw_sms->more_messages = tmp[offset]; @@ -1387,6 +1409,7 @@ drvinst->smsmemorytype = GN_MT_XX; drvinst->defaultcharset = AT_CHAR_UNKNOWN; drvinst->charset = AT_CHAR_UNKNOWN; + drvinst->no_smsc = 0; drvinst->if_pos = 0; for (i = 0; i < GN_OP_AT_Max; i++) { diff -ru gnokii-0.5.10-orig/common/phones/atnok.c gnokii-0.5.10/common/phones/atnok.c --- gnokii-0.5.10-orig/common/phones/atnok.c 2004-02-01 17:59:32.000000000 +0200 +++ gnokii-0.5.10/common/phones/atnok.c 2004-08-31 00:31:36.000000000 +0300 @@ -60,4 +60,9 @@ /* information will be lost. */ if (strncasecmp("8210", foundmodel, 4)) writephonebook = at_insert_send_function(GN_OP_WritePhonebook, WritePhonebook, state); + + /* premicell does not want sms centers in PDU packets (send & */ + /* receive) */ + if (!strncasecmp("0301", foundmodel, 4)) + AT_DRVINST(state)->no_smsc = 1; } diff -ru gnokii-0.5.10-orig/include/phones/atgen.h gnokii-0.5.10/include/phones/atgen.h --- gnokii-0.5.10-orig/include/phones/atgen.h 2004-02-01 17:59:32.000000000 +0200 +++ gnokii-0.5.10/include/phones/atgen.h 2004-08-31 00:25:43.000000000 +0300 @@ -61,6 +61,7 @@ at_send_function_type functions[GN_OP_AT_Max]; gn_incoming_function_type incoming_functions[GN_OP_AT_Max]; int if_pos; + int no_smsc; gn_memory_type memorytype; gn_memory_type smsmemorytype;