jancona / android-on-freerunner

Automatically exported from code.google.com/p/android-on-freerunner
1 stars 1 forks source link

contacts not loaded from SIM #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. select Contacts
2. press menu > import contacts
3. interface indicates that there are no contacts on the SIM

Every other distro loads contacts flawlessly so I know that they're there.
Android has never been able to load my contacts.

What version of the product are you using? On what operating system?
0.1.1

Original issue reported on code.google.com by zucarit...@gmail.com on 23 Sep 2009 at 5:07

GoogleCodeExporter commented 9 years ago
I just tried with and it worked for me.  (I only had 1 contact on my SIM.)  
Using
cupcake 0.1.1.  I used the exact steps you provided.

Original comment by mvzaa...@gmail.com on 23 Sep 2009 at 7:04

GoogleCodeExporter commented 9 years ago
I think this is sim specific. I got a friend that go the same problem. 
zucaritony you
got a new or old sim?

My friend with the same problem got a really old sim.

Original comment by larlin...@gmail.com on 23 Sep 2009 at 7:35

GoogleCodeExporter commented 9 years ago
I've a 128k sim, not too old, and i've the same problem.

Original comment by samuele....@gmail.com on 24 Sep 2009 at 5:00

GoogleCodeExporter commented 9 years ago
Perhaps I should have added that I only have one contact on my SIM.  Could that 
be
the difference?

Original comment by mvzaa...@gmail.com on 24 Sep 2009 at 7:14

GoogleCodeExporter commented 9 years ago
Hi,
  Well, I have a year old sim. While every other distribution has been able to load
sms's and contacts from my sim, android has never been able to.
  This is definitely sim specific - but definitely not a one off case. There seem to
be some types of sim cards that ril/android has not been able to read since the 
very
first beta release.
  For such users, this is a major show stopper.

Original comment by cchan...@gmail.com on 25 Sep 2009 at 4:11

GoogleCodeExporter commented 9 years ago
My SIM card came from an AT&T store not a year ago. I've never had problems 
with it.

Original comment by zucarit...@gmail.com on 27 Sep 2009 at 9:08

GoogleCodeExporter commented 9 years ago
Hi,

I have the same issue. I have about 80-90 contacts on my SIM card, and it is 
read
properly in QtMoko and SHR but Android was never able to read it (neither the 
Koolu
images nor the A-on-F 0.1.1). But I tried the same SIM card on HTC-Sapphire 
(with
Android 1.5) a few days ago and it could easily read all the contacts. 

I'm willing to dig further into this issue, any pointer on where to start?

Original comment by shanka.mns on 28 Sep 2009 at 7:20

GoogleCodeExporter commented 9 years ago
You could start to run logcat via adb while trying to import contacts. If there 
are
any notices you could post them here. If that doesn't work I think you would 
need to
start digging into to the relevant code. It's really hard for someone with a 
working
SIM to work on this. So if you want to take a shot it would be appreciated by a 
lot
of people.

This problem could be anywhere in the stack of software that handles sim card
communication. Which means anything from the android java code to some part of 
the
Linux system below that.

Original comment by larlin...@gmail.com on 28 Sep 2009 at 7:35

GoogleCodeExporter commented 9 years ago
This is the relevant part of the log when trying to import the SIM Contacts:

I/ActivityManager(  828): Starting activity: Intent {
action=android.intent.action.VIEW type=vnd.android.cursor.item/sim-contact
comp={com.android.phone/com.android.phone.SimContacts} }
D/PhoneWindow(  893): couldn't save which view has focus because the focused 
view
com.android.internal.policy.impl.PhoneWindow$DecorView@436b4200 has no id.
I/ActivityManager(  828): Displayed activity com.android.phone/.SimContacts: 
421 ms
W/SimProvider(  887): Cannot load ADN records

I currently have only the official cupcake (from google) in my system. So I 
don't
think I can get to the bottom of this issue. Tonight I will get the latest code 
from
git and look into it.

Will keep you all posted.

Original comment by shanka.mns on 28 Sep 2009 at 9:25

GoogleCodeExporter commented 9 years ago
Is it possible to read the ATR with FreeRunner ? 
And, will it be helpful to know ATR's of SIM cards that are not working ?

Original comment by teodor.r...@gmail.com on 28 Sep 2009 at 5:05

GoogleCodeExporter commented 9 years ago
Android use generic command to access to the SIM. The other distribuition use
specific command to do that.

Original comment by michaelt...@gmail.com on 28 Sep 2009 at 9:25

GoogleCodeExporter commented 9 years ago
We must intercept this command:

AT+CRSM=192,28474,0,0,15

and change it with the specific one to read sim contact, and format them. The 
same
thing is the import of sim sms

Original comment by michaelt...@gmail.com on 28 Sep 2009 at 10:03

GoogleCodeExporter commented 9 years ago

Original comment by michaelt...@gmail.com on 29 Sep 2009 at 6:45

GoogleCodeExporter commented 9 years ago
I add you as owner too michael

Original comment by larlin...@gmail.com on 29 Sep 2009 at 9:42

GoogleCodeExporter commented 9 years ago
I fix the issue I can inport the contact from sim card and the sms too.

This is the change of the affected function:

@@ -1757,11 +1757,59 @@ static void  requestSIM_IO(void *data, size_t datalen,
RIL_Token t)
     p_args = (RIL_SIM_IO *)data;

     /* FIXME handle pin2 */
-
     if (p_args->data == NULL) {
+#ifdef HAVE_TI_CALYPSO
+        /* Select command. */
+        if ((p_args->fileid == 28474 || p_args->fileid == 28476)
+            && p_args->command == 192) {
+            char *tmp;
+            int len;
+            at_send_command_singleline(ATch_primary,
+                                       "AT+CSIM=14,\"A0A40000027F10\"",
+                                       "+CSIM:", NULL);
+            asprintf(&cmd, "AT+CSIM=14,\"A0A4000002%04x\"", p_args->fileid);
+            at_send_command_singleline(ATch_primary, cmd, "+CSIM:", NULL);
+            free(cmd);
+            asprintf(&cmd, "AT+CSIM=10,\"A0%02x%02x%02x%02x\"", 
p_args->command,
+                     p_args->p1, p_args->p2, p_args->p3);
+
+            err = at_send_command_singleline(ATch_primary, cmd,
+                                             "+CSIM:", &p_response);
+
+            if (err < 0 || p_response->success == 0) {
+                goto parse_error;
+            }
+
+            line = p_response->p_intermediates->line;
+
+            err = at_tok_start(&line);
+            if (err < 0) goto error;
+
+            err = at_tok_nextint(&line, &len);
+            if (err < 0) goto parse_error;
+
+            tmp =  strndup(line, len);
+
+            sr.simResponse = tmp;
+            sr.sw1 = 0x90;
+            sr.sw2 = 0;
+
+            RIL_onRequestComplete(t, RIL_E_SUCCESS, &sr, sizeof(sr));
+            at_response_free(p_response);
+            free(tmp);
+            free(cmd);
+            return;
+parse_error:
+            RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0);
+            at_response_free(p_response);
+            free(tmp);
+            free(cmd);
+            return;
+         } else
+#endif
         asprintf(&cmd, "AT+CRSM=%d,%d,%d,%d,%d",
-                    p_args->command, p_args->fileid,
-                    p_args->p1, p_args->p2, p_args->p3);
+                 p_args->command, p_args->fileid,
+                 p_args->p1, p_args->p2, p_args->p3);
     } else {
         asprintf(&cmd, "AT+CRSM=%d,%d,%d,%d,%d,%s",
                     p_args->command, p_args->fileid,

I will provide a better patch.

Original comment by michaelt...@gmail.com on 29 Sep 2009 at 4:53

GoogleCodeExporter commented 9 years ago
Just a note. The user must update the gsm firmware to the latest one.

Original comment by michaelt...@gmail.com on 29 Sep 2009 at 8:35

GoogleCodeExporter commented 9 years ago
Patch applied and pushed to Gitorious

Original comment by scarhill on 30 Sep 2009 at 2:26

GoogleCodeExporter commented 9 years ago
Does'nt work even after updating the firmware. Any idea?

Original comment by amitabhi...@gmail.com on 22 Oct 2009 at 10:33

GoogleCodeExporter commented 9 years ago
amitabhishek1978

What version of android-on-freerunner do you use? In what way does it fail and 
have
you verified that the firmware upgrade worked?

If you are sure this is a bug in a recent version of android-on-freerunner can 
you
please attach a logcat when you try to import contacts.

Original comment by larlin...@gmail.com on 22 Oct 2009 at 11:08