Hi Guys,
      There is a bug in ril in Koolu's cupcake  1.5 alpha1. The bug is that 
users often lose/miss several characters in the end of the received SMS. That’s 
because the length of the received SMS is not calculated correctly.
      I sent this patch yesterday.No response. Now send it again.               
                          
_________________________________________________________________
MSN 表情魔法书,改变你的对话时代!
http://im.live.cn/emoticons/
project hardware/ril/
diff --git a/muxgsm-ril/atchannel.c b/muxgsm-ril/atchannel.c
index 6094e74..59fe222 100644
--- a/muxgsm-ril/atchannel.c
+++ b/muxgsm-ril/atchannel.c
@@ -628,9 +628,24 @@ static int handleControl (unsigned char *frame, int length)
     return 0;
 }
 
+int convertHexStringtoI(char c)
+{
+    if (c >= 'A' && c<='F') {
+        return c -'A' + 10;
+    }
+    else if (c >= 'a' && c<= 'f') {
+        return c - 'a' + 10;
+    }
+    else if (c >= '0' && c <= '9') {
+        return c - '0';
+    }
+    return -1;
+}
 
 static int handleCommand (int channel, char *buf)
 {
+    int pduDataLength = 0;
+    int pduSMSCLength = 0;
     do {
         /* Isolate the line
          */
@@ -656,7 +671,9 @@ static int handleCommand (int channel, char *buf)
             LOGD("MUX SMS: hasCRLF=%d, text len=%d, sms len=%d",
                  hasCRLF, strlen(smsText), s_chanData[channel].lenSMS);
 
-            if (strlen(smsText) >= s_chanData[channel].lenSMS) {
+            pduSMSCLength = convertHexStringtoI(smsText[0]) * 16 + 
convertHexStringtoI(smsText[1]) + 1;
+            pduDataLength = strlen(smsText) - pduSMSCLength * 2;
+            if (pduDataLength >= s_chanData[channel].lenSMS) {
                 if (s_unsolHandler)
                     s_unsolHandler (channel, s_chanData[channel].cmdSMS, 
smsText);
                 free(s_chanData[channel].cmdSMS);
_______________________________________________
android-freerunner mailing list
[email protected]
http://android.koolu.org/listinfo.cgi/android-freerunner-koolu.org

Reply via email to