All of lore.kernel.org
 help / color / mirror / Atom feed
* RE: How to handle pins?
       [not found] <20100421061402.GA10199@gumpy.localdomain>
@ 2010-04-22  0:54 ` Xu, Martin
  2010-04-23 13:56   ` Daniel Wagner
  0 siblings, 1 reply; 6+ messages in thread
From: Xu, Martin @ 2010-04-22  0:54 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 7195 bytes --]

> -----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
> 
> 
> 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. 

> 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. ;-)

> 
> I'm not sure if I'm going the right road. What is the great master
> plan to handle this?
> 
> cheers,
> daniel
> 
> ps: btw here is the current hack:
> 
> diff --git a/plugins/ofono.c b/plugins/ofono.c
> index d0f358e..bd443f1 100644
> --- a/plugins/ofono.c
> +++ b/plugins/ofono.c
> @@ -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);
>  		return;
> @@ -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;
>  	DBusMessage *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:
>  	dbus_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)
>  {
>  	DBusMessageIter entry;
> @@ -1055,6 +1061,7 @@ static gboolean modem_has_gprs(DBusMessageIter
> *array)
> 
>  	return FALSE;
>  }
> +*/
> 
>  static void modem_properties_reply(DBusPendingCall *call, void *user_data)
>  {
> @@ -1093,8 +1100,7 @@ static void
> modem_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);
>  		}
> 
>  		dbus_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);
>  	}
> 
> diff --git a/src/device.c b/src/device.c
> index 619fe5e..146ed40 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -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);
> 
>  	return 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);
>  	}
> 
>  	return connman_element_set_string(&device->element, key, value);
> @@ -1315,6 +1335,8 @@ const char *connman_device_get_string(struct
> connman_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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to handle pins?
  2010-04-22  0:54 ` How to handle pins? Xu, Martin
@ 2010-04-23 13:56   ` Daniel Wagner
  2010-04-23 14:29     ` Pekka Pessi
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Wagner @ 2010-04-23 13:56 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 839 bytes --]

Hi Martin,

On Thu, Apr 22, 2010 at 02:54:38AM +0200, Xu, Martin wrote:

> > 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to handle pins?
  2010-04-23 13:56   ` Daniel Wagner
@ 2010-04-23 14:29     ` Pekka Pessi
  2010-04-23 15:25       ` Daniel Wagner
  0 siblings, 1 reply; 6+ messages in thread
From: Pekka Pessi @ 2010-04-23 14:29 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 428 bytes --]

2010/4/23 Daniel Wagner <daniel.wagner@bmw-carit.de>:
>> 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.

-- 
Pekka.Pessi mail at nokia.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to handle pins?
  2010-04-23 14:29     ` Pekka Pessi
@ 2010-04-23 15:25       ` Daniel Wagner
  2010-04-23 15:32         ` Denis Kenzior
  2010-04-23 15:33         ` Marcel Holtmann
  0 siblings, 2 replies; 6+ messages in thread
From: Daniel Wagner @ 2010-04-23 15:25 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 780 bytes --]

On Fri, Apr 23, 2010 at 04:29:23PM +0200, Pekka Pessi wrote:
> 2010/4/23 Daniel Wagner <daniel.wagner@bmw-carit.de>:
> >> 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.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to handle pins?
  2010-04-23 15:25       ` Daniel Wagner
@ 2010-04-23 15:32         ` Denis Kenzior
  2010-04-23 15:33         ` Marcel Holtmann
  1 sibling, 0 replies; 6+ messages in thread
From: Denis Kenzior @ 2010-04-23 15:32 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 984 bytes --]

Hi Daniel,

> On Fri, Apr 23, 2010 at 04:29:23PM +0200, Pekka Pessi wrote:
> > 2010/4/23 Daniel Wagner <daniel.wagner@bmw-carit.de>:
> > >> 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.
> 
> 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.

> 
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to handle pins?
  2010-04-23 15:25       ` Daniel Wagner
  2010-04-23 15:32         ` Denis Kenzior
@ 2010-04-23 15:33         ` Marcel Holtmann
  1 sibling, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2010-04-23 15:33 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 889 bytes --]

Hi Daniel,

> > >> 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.
> 
> 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



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-04-23 15:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20100421061402.GA10199@gumpy.localdomain>
2010-04-22  0:54 ` How to handle pins? Xu, Martin
2010-04-23 13:56   ` Daniel Wagner
2010-04-23 14:29     ` Pekka Pessi
2010-04-23 15:25       ` Daniel Wagner
2010-04-23 15:32         ` Denis Kenzior
2010-04-23 15:33         ` Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.