How to handle pins?
A message that is not in the archive (sent off-list or not yet received): [email protected]
Xu
Quoted 29 lines
-----Original Message-----
From: connman-bounces(a)connman.net [mailto:connman-bounces(a)connman.net] On Behalf Of Daniel Wagner
Sent: Wednesday, April 21, 2010 2:14 PM
To: connman(a)connman.net
Subject: How to handle pins?Hi,
I was able to get connman with ofono working with my Option modem. Though one of the problem I had to workaround was the pin entering. When the device is attached to the computer, ofono identifies it as:
$ ./list-modems [ /hso0 ] Powered = 1 Interfaces = org.ofono.SimManager Model = GlobeTrotter HSUPA Modem Manufacturer = Option N.V. Serial = 351721030157214,PK29997020 Revision = 2.12.0.0Hd (Date: Oct 29 2009, Time: 09:56:48) [ org.ofono.SimManager ] SubscriberNumbers = LockedPins = pin PinRequired = pin Present = 1
Quoted 2 lines
connman ignores this device until the GPRS interface shows up. This wont happend until the pin is entered. In my ignorance I have tried
I think maybe pin can be handled at ofono side.
Quoted 6 lines
modify connmand that way, that it shows the modem as device (with a new property "PinRequired") even when the GPRS interface is not yet available. Though I had to hackaround with the IMSI (which is used as unique identifier for the dbus paths) is only available after the pin has been entered. Maybe the serial number could be used instead of the IMSI instead?
I am afraid that IMSI is the best identifier, and serial number is implemented by manufacturer, and sometime not unique. Anyway it is the issue we need to resolve. So I also copy it to oFono maillist for comments. ;-)
Quoted 182 lines
I'm not sure if I'm going the right road. What is the great master plan to handle this?
cheers,
danielps: btw here is the current hack:
plugins/ofono.c +3
-1@@ -843,7 +843,7 @@ done: }static void add_device (const char *path,const char *imsi, -unsigned char mnc_length) +unsigned char mnc_length,const char *pin_required) {struct modem_data *modem;struct connman_device *device;@@ -877,6 +877,8 @@ static void add_device(const char *path, const char *imsi,g_free (mcc_mnc); } +connman_device_set_string (device,"PinRequired" , pin_required); +if (connman_device_register (device) <0 ) {connman_device_unref (device);plugins/ofono.c +2
-1return ;@@ -890,7 +892,8 @@ static void add_device(const char *path, const char *imsi, static void sim_properties_reply(DBusPendingCall *call, void *user_data) {const char *path = user_data; -const char *imsi; +char *imsi ="foo" ; +char *pin_required ="" ;/* If MobileNetworkCodeLength is not provided, mnc_length is 0 */ unsigned char mnc_length =0 ;plugins/ofono.c +3
-1DBusMessage *reply;@@ -923,11 +926,13 @@ static void sim_properties_reply(DBusPendingCall *call, void *user_data) else if (g_str_equal(key, "MobileNetworkCodeLength") == TRUE)dbus_message_iter_get_basic (&value, (void *) &mnc_length); +else if (g_str_equal (key,"PinRequired" ) == TRUE) +dbus_message_iter_get_basic (&value, &pin_required);dbus_message_iter_next (&dict); } -add_device (path, imsi, mnc_length); +add_device (path, imsi, mnc_length, pin_required); done:plugins/ofono.c +2
-1dbus_message_unref (reply);@@ -935,7 +940,7 @@ done:dbus_pending_call_unref (call); } -static void get_imsi (const char *path) +static void get_sim_properties (const char *path) {DBusMessage *message;DBusPendingCall *call;@@ -1036,6 +1041,7 @@ static struct modem_data *add_modem(const char *path)return modem; } +/* static gboolean modem_has_gprs(DBusMessageIter *array) { plugins/ofono.c +1
-0DBusMessageIter entry;@@ -1055,6 +1061,7 @@ static gboolean modem_has_gprs(DBusMessageIter*array) return FALSE; } +*/ static void modem_properties_reply (DBusPendingCall *call,void *user_data){
plugins/ofono.c +1
-2@@ -1093,8 +1100,7 @@ static voidmodem_properties_reply (DBusPendingCall *call, void *user_data) break; } }else if (g_str_equal (key,"Interfaces" ) == TRUE) { -if (modem_has_gprs (&value) == TRUE) -get_imsi (path); +get_sim_properties (path); }plugins/ofono.c +3
-4dbus_message_iter_next (&dict);@@ -1333,10 +1339,9 @@ static gboolean modem_changed(DBusConnection *connection, DBusMessage *message,modem_remove_device (modem); }else if (g_str_equal (key,"Interfaces" ) == TRUE) { -if (modem_has_gprs (&value) == TRUE) { -if (modem->device ==NULL ) -get_imsi (modem->path); - }else if (modem->device !=NULL ) +if (modem->device ==NULL ) +get_sim_properties (modem->path); +else if (modem->device !=NULL )modem_remove_device (modem); }src/device.c +16
-0@@ -66,6 +66,8 @@ struct connman_device {DBusMessage *pending;guint timeout; + +char *pin_required; };static gboolean device_scan_trigger (gpointer user_data)@@ -324,6 +326,20 @@ static DBusMessage *get_properties(DBusConnection *conn, break; } +switch (device->type) { +case CONNMAN_DEVICE_TYPE_UNKNOWN : +case CONNMAN_DEVICE_TYPE_VENDOR : +case CONNMAN_DEVICE_TYPE_ETHERNET : +case CONNMAN_DEVICE_TYPE_WIFI : +case CONNMAN_DEVICE_TYPE_WIMAX : +case CONNMAN_DEVICE_TYPE_BLUETOOTH : +case CONNMAN_DEVICE_TYPE_GPS : +break ; +case CONNMAN_DEVICE_TYPE_CELLULAR : +connman_dbus_dict_append_basic (&dict,"PinRequired" , +DBUS_TYPE_STRING , &device->pin_required); + } +connman_dbus_dict_close (&array, &dict);src/device.c +4
-0return reply;@@ -682,6 +698,7 @@ static void device_destruct(struct connman_element *element)g_free (device->address);g_free (device->control);g_free (device->interface); +g_free (device->pin_required);g_free (device->last_network);@@ -1292,6 +1309,9 @@ int connman_device_set_string(struct connman_device *device, }else if (g_str_equal (key,"Node" ) == TRUE) {g_free (device->node); device->node =g_strdup (value); + }else if (g_str_equal (key,"PinRequired" ) == TRUE) { +g_free (device->pin_required); + device->pin_required =g_strdup (value); }src/device.c +2
-0return connman_element_set_string (&device->element, key, value);@@ -1315,6 +1335,8 @@ const char *connman_device_get_string(structconnman_device *device, return device->name; else if (g_str_equal(key, "Node") == TRUE) return device->node; + else if (g_str_equal(key, "PinRequired") == TRUE) + return device->pin_required;return connman_element_get_string (&device->element, key);}
_______________________________________________
connman mailing list
connman(a)connman.net
http://lists.connman.net/listinfo/connman
Hi Martin,
Quoted 8 lines · Martin
Quoted 6 lines
modify connmand that way, that it shows the modem as device (with a new property "PinRequired") even when the GPRS interface is not yet available. Though I had to hackaround with the IMSI (which is used as unique identifier for the dbus paths) is only available after the pin has been entered. Maybe the serial number could be used instead of the IMSI instead?
I am afraid that IMSI is the best identifier, and serial number is implemented by manufacturer, and sometime not unique. Anyway it is the issue we need to resolve. So I also copy it to oFono maillist for comments. ;-)
Okay. Is there a proper way to identify a SIM when it is still locked? I guess this can only be done by some guessworking.
cheers,
daniel
2010/4/23 Daniel Wagner <[email protected]>:
Quoted 4 lines
Quoted 1 line
Anyway it is the issue we need to resolve. So I also copy it to oFono maillist for comments. ;-)
Okay. Is there a proper way to identify a SIM when it is still locked? I guess this can only be done by some guessworking.
The EF_ICCID should be always available. It is either an E.118 number or 10 bytes of opaque data.
Signature · 1 line
Pekka.Pessi mail at nokia.com
Quoted 8 lines · Pekka Pessi
2010/4/23 Daniel Wagner <[email protected]>:
Quoted 4 lines
Quoted 1 line
Anyway it is the issue we need to resolve. So I also copy it to oFono maillist for comments. ;-)
Okay. Is there a proper way to identify a SIM when it is still locked? I guess this can only be done by some guessworking.
The
EF_ICCIDshould be always available. It is either an E.118 number or 10 bytes of opaque data.
I have scanned through the ofono code and didn't find any references to ICCID. So there is no code reading that information out of the sim. Is that right?
Sorry for my complete ignorance on this topic. I was even unable to download the right document from 3gpp.org which describes this part.
daniel
Hi Daniel,
Quoted 8 lines · Pekka Pessi
Quoted 7 lines
2010/4/23 Daniel Wagner <[email protected]>:
Quoted 5 lines
Quoted 2 lines
Anyway it is the issue we need to resolve. So I also copy it to oFono maillist for comments. ;-)
Okay. Is there a proper way to identify a SIM when it is still locked? I guess this can only be done by some guessworking.
Quoted 6 lines
Quoted 2 lines
The
EF_ICCIDshould be always available. It is either an E.118 number or 10 bytes of opaque data.I have scanned through the ofono code and didn't find any references to ICCID. So there is no code reading that information out of the sim. Is that right?
oFono does not read the ICCID, it only reads the IMSI which is available after PIN has been unlocked.
Quoted 3 lines
Sorry for my complete ignorance on this topic. I was even unable to download the right document from 3gpp.org which describes this part.
3GPP 11.11 or ETSI TS 102.221
Regards,
-Denis
Hi Daniel,
Quoted 11 lines
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Anyway it is the issue we need to resolve. So I also copy it to oFono maillist for comments. ;-)
Okay. Is there a proper way to identify a SIM when it is still locked? I guess this can only be done by some guessworking.
The
EF_ICCIDshould be always available. It is either an E.118 number or 10 bytes of opaque data.I have scanned through the ofono code and didn't find any references to ICCID. So there is no code reading that information out of the sim. Is that right?
maybe we are just missing that information. Feel free to read these details from the SIM card. Having the ICCID available is not a bad idea since some providers use these as identification codes. At least it happened to me once reading the ICCID from the iPhone menu was enough to prove that it is my SIM card.
Regards
Marcel