All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] Gobi: Enable SIM driver forcing
  2016-05-02 15:20 [PATCH 3/3] Add support for Sierra MC73xx QMI modems Denis Kenzior
@ 2016-05-02 16:33 ` Martin Chaplet
  2016-05-03  3:21   ` Denis Kenzior
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Chaplet @ 2016-05-02 16:33 UTC (permalink / raw)
  To: ofono

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

Let modem detect part overload default SIM driver by using an additional
property named "ForceSimLegacy" (boolean).

Signed-off-by: Martin Chaplet <m.chaplet@kerlink.fr>
---
 plugins/gobi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/gobi.c b/plugins/gobi.c
index 4daa459..aad423d 100644
--- a/plugins/gobi.c
+++ b/plugins/gobi.c
@@ -418,7 +418,7 @@ static void gobi_pre_sim(struct ofono_modem *modem)
 
 	ofono_devinfo_create(modem, 0, "qmimodem", data->device);
 
-	if (data->features & GOBI_UIM)
+	if ( (data->features & GOBI_UIM) && !ofono_modem_get_boolean(modem, "ForceSimLegacy") )
 		ofono_sim_create(modem, 0, "qmimodem", data->device);
 	else if (data->features & GOBI_DMS)
 		ofono_sim_create(modem, 0, "qmimodem-legacy", data->device);
-- 
1.9.1


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

* Re: [PATCH 1/3] Gobi: Enable SIM driver forcing
  2016-05-02 16:33 ` [PATCH 1/3] Gobi: Enable SIM driver forcing Martin Chaplet
@ 2016-05-03  3:21   ` Denis Kenzior
  0 siblings, 0 replies; 6+ messages in thread
From: Denis Kenzior @ 2016-05-03  3:21 UTC (permalink / raw)
  To: ofono

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

Hi Martin,

On 05/02/2016 11:33 AM, Martin Chaplet wrote:
> Let modem detect part overload default SIM driver by using an additional
> property named "ForceSimLegacy" (boolean).
>
> Signed-off-by: Martin Chaplet <m.chaplet@kerlink.fr>

No Signed-off-by please.

> ---
>   plugins/gobi.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/plugins/gobi.c b/plugins/gobi.c
> index 4daa459..aad423d 100644
> --- a/plugins/gobi.c
> +++ b/plugins/gobi.c
> @@ -418,7 +418,7 @@ static void gobi_pre_sim(struct ofono_modem *modem)
>
>   	ofono_devinfo_create(modem, 0, "qmimodem", data->device);
>
> -	if (data->features & GOBI_UIM)
> +	if ( (data->features & GOBI_UIM) && !ofono_modem_get_boolean(modem, "ForceSimLegacy") )

Not our style.  Also the logic would be cleaner if we do something like:

const char *sim_driver;

if (data->features & GOBI_UIM)
	sim_driver = "qmimodem";
else if (data->features & GOBI_DMS)
	sim_driver = "qmimodem-legacy";

if (ofono_modem_get_boolean(modem, "ForceSimLegacy"))
	sim_driver = "qmimodem-legacy";

ofono_sim_create(...);

>   		ofono_sim_create(modem, 0, "qmimodem", data->device);
>   	else if (data->features & GOBI_DMS)
>   		ofono_sim_create(modem, 0, "qmimodem-legacy", data->device);
>

Regards,
-Denis

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

* [PATCH 1/3] Gobi: Enable SIM driver forcing
@ 2016-05-03  8:44 Martin Chaplet
  2016-05-03  8:44 ` [PATCH 2/3] Udevng: Improve modem properties detection Martin Chaplet
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Martin Chaplet @ 2016-05-03  8:44 UTC (permalink / raw)
  To: ofono

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

Let modem detect part overload default SIM driver by using an additional
property named "ForceSimLegacy" (boolean).
---
 plugins/gobi.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/plugins/gobi.c b/plugins/gobi.c
index 061ee04..8850904 100644
--- a/plugins/gobi.c
+++ b/plugins/gobi.c
@@ -414,15 +414,21 @@ error:
 static void gobi_pre_sim(struct ofono_modem *modem)
 {
 	struct gobi_data *data = ofono_modem_get_data(modem);
+	const char *sim_driver;
 
 	DBG("%p", modem);
 
 	ofono_devinfo_create(modem, 0, "qmimodem", data->device);
 
 	if (data->features & GOBI_UIM)
-		ofono_sim_create(modem, 0, "qmimodem", data->device);
+		sim_driver = "qmimodem";
 	else if (data->features & GOBI_DMS)
-		ofono_sim_create(modem, 0, "qmimodem-legacy", data->device);
+		sim_driver = "qmimodem-legacy";
+
+	if (ofono_modem_get_boolean(modem, "ForceSimLegacy"))
+		sim_driver = "qmimodem-legacy";
+
+	ofono_sim_create(modem, 0, sim_driver, data->device);
 
 	if (data->features & GOBI_VOICE)
 		ofono_voicecall_create(modem, 0, "qmimodem", data->device);
-- 
1.9.1


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

* [PATCH 2/3] Udevng: Improve modem properties detection
  2016-05-03  8:44 [PATCH 1/3] Gobi: Enable SIM driver forcing Martin Chaplet
@ 2016-05-03  8:44 ` Martin Chaplet
  2016-05-03  8:44 ` [PATCH 3/3] Add support for Sierra MC73xx QMI modems Martin Chaplet
  2016-05-03 16:12 ` [PATCH 1/3] Gobi: Enable SIM driver forcing Denis Kenzior
  2 siblings, 0 replies; 6+ messages in thread
From: Martin Chaplet @ 2016-05-03  8:44 UTC (permalink / raw)
  To: ofono

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

 * Add driver's subsystem information (net, usb, tty, ...)
 * Improve interface number extraction by scanning also device and
 parent attributes
---
 plugins/udevng.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/plugins/udevng.c b/plugins/udevng.c
index cc1ac55..e5dc725 100644
--- a/plugins/udevng.c
+++ b/plugins/udevng.c
@@ -55,6 +55,7 @@ struct device_info {
 	char *number;
 	char *label;
 	char *sysattr;
+	char *subsystem;
 };
 
 static gboolean setup_isi(struct modem_info *modem)
@@ -958,6 +959,7 @@ static void destroy_modem(gpointer data)
 		g_free(info->number);
 		g_free(info->label);
 		g_free(info->sysattr);
+		g_free(info->subsystem);
 		g_free(info);
 
 		list->data = NULL;
@@ -1016,9 +1018,10 @@ static void add_device(const char *syspath, const char *devname,
 			const char *model, struct udev_device *device)
 {
 	struct udev_device *intf;
-	const char *devpath, *devnode, *interface, *number, *label, *sysattr;
+	const char *devpath, *devnode, *interface, *number, *label, *sysattr, *subsystem;
 	struct modem_info *modem;
 	struct device_info *info;
+	struct udev_device *parent;
 
 	devpath = udev_device_get_syspath(device);
 	if (devpath == NULL)
@@ -1056,7 +1059,17 @@ static void add_device(const char *syspath, const char *devname,
 	interface = udev_device_get_property_value(intf, "INTERFACE");
 	number = udev_device_get_property_value(device, "ID_USB_INTERFACE_NUM");
 
+	/* If environment variable is not set, get value from attributes (or parent's ones) */
+	if(number == NULL) {
+		number = udev_device_get_sysattr_value(device, "bInterfaceNumber");
+		if(number == NULL) {
+			parent = udev_device_get_parent(device);
+			number = udev_device_get_sysattr_value(parent, "bInterfaceNumber");
+		}
+	}
+
 	label = udev_device_get_property_value(device, "OFONO_LABEL");
+	subsystem = udev_device_get_subsystem(device);
 
 	if (modem->sysattr != NULL)
 		sysattr = udev_device_get_sysattr_value(device, modem->sysattr);
@@ -1078,6 +1091,7 @@ static void add_device(const char *syspath, const char *devname,
 	info->number = g_strdup(number);
 	info->label = g_strdup(label);
 	info->sysattr = g_strdup(sysattr);
+	info->subsystem = g_strdup(subsystem);
 
 	modem->devices = g_slist_insert_sorted(modem->devices, info,
 							compare_device);
-- 
1.9.1


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

* [PATCH 3/3] Add support for Sierra MC73xx QMI modems
  2016-05-03  8:44 [PATCH 1/3] Gobi: Enable SIM driver forcing Martin Chaplet
  2016-05-03  8:44 ` [PATCH 2/3] Udevng: Improve modem properties detection Martin Chaplet
@ 2016-05-03  8:44 ` Martin Chaplet
  2016-05-03 16:12 ` [PATCH 1/3] Gobi: Enable SIM driver forcing Denis Kenzior
  2 siblings, 0 replies; 6+ messages in thread
From: Martin Chaplet @ 2016-05-03  8:44 UTC (permalink / raw)
  To: ofono

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

Udevng layer is changed in order to support Sierra QMI modems like
MC73cxx.
Identically to Huawei modems, these modems are parsed by setup_sierra.
If QMI interface is detected, the Gobi modem driver is selected.

Unfortunately, MC73xx chips seem to have a broken QMI UIM interface.
The qmimodem-legacy is so forced in setup function.
---
 plugins/udevng.c | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/plugins/udevng.c b/plugins/udevng.c
index e5dc725..8a5f6fd 100644
--- a/plugins/udevng.c
+++ b/plugins/udevng.c
@@ -220,7 +220,7 @@ static gboolean setup_gobi(struct modem_info *modem)
 
 static gboolean setup_sierra(struct modem_info *modem)
 {
-	const char *mdm = NULL, *app = NULL, *net = NULL, *diag = NULL;
+	const char *mdm = NULL, *app = NULL, *net = NULL, *diag = NULL, *qmi = NULL;
 	GSList *list;
 
 	DBG("%s", modem->syspath);
@@ -228,8 +228,8 @@ static gboolean setup_sierra(struct modem_info *modem)
 	for (list = modem->devices; list; list = list->next) {
 		struct device_info *info = list->data;
 
-		DBG("%s %s %s %s", info->devnode, info->interface,
-						info->number, info->label);
+		DBG("%s %s %s %s %s", info->devnode, info->interface,
+						info->number, info->label, info->subsystem);
 
 		if (g_strcmp0(info->interface, "255/255/255") == 0) {
 			if (g_strcmp0(info->number, "01") == 0)
@@ -240,14 +240,29 @@ static gboolean setup_sierra(struct modem_info *modem)
 				app = info->devnode;
 			else if (g_strcmp0(info->number, "07") == 0)
 				net = info->devnode;
+			else if (g_strcmp0(info->number, "0a") == 0) {
+				if (g_strcmp0(info->subsystem, "net") == 0)
+					net = info->devnode;
+				else if (g_strcmp0(info->subsystem, "usbmisc") == 0)
+					qmi = info->devnode;
+			}
 		}
 	}
 
+	if (qmi != NULL && net != NULL) {
+		ofono_modem_set_driver(modem->modem, "gobi");
+		/* Fixup SIM interface for Sierra QMI devices */
+		ofono_modem_set_boolean(modem->modem, "ForceSimLegacy", TRUE);
+		goto done;
+	}
+
 	if (mdm == NULL || net == NULL)
 		return FALSE;
 
-	DBG("modem=%s app=%s net=%s diag=%s", mdm, app, net, diag);
+done:
+	DBG("modem=%s app=%s net=%s diag=%s qmi=%s", mdm, app, net, diag, qmi);
 
+	ofono_modem_set_string(modem->modem, "Device", qmi);
 	ofono_modem_set_string(modem->modem, "Modem", mdm);
 	ofono_modem_set_string(modem->modem, "App", app);
 	ofono_modem_set_string(modem->modem, "Diag", diag);
@@ -1129,6 +1144,8 @@ static struct {
 	{ "hso",	"hso"				},
 	{ "gobi",	"qmi_wwan"			},
 	{ "gobi",	"qcserial"			},
+	{ "sierra",	"qmi_wwan",	"1199"		},
+	{ "sierra",	"qcserial",	"1199"		},
 	{ "sierra",	"sierra"			},
 	{ "sierra",	"sierra_net"			},
 	{ "option",	"option",	"0af0"		},
-- 
1.9.1


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

* Re: [PATCH 1/3] Gobi: Enable SIM driver forcing
  2016-05-03  8:44 [PATCH 1/3] Gobi: Enable SIM driver forcing Martin Chaplet
  2016-05-03  8:44 ` [PATCH 2/3] Udevng: Improve modem properties detection Martin Chaplet
  2016-05-03  8:44 ` [PATCH 3/3] Add support for Sierra MC73xx QMI modems Martin Chaplet
@ 2016-05-03 16:12 ` Denis Kenzior
  2 siblings, 0 replies; 6+ messages in thread
From: Denis Kenzior @ 2016-05-03 16:12 UTC (permalink / raw)
  To: ofono

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

Hi Martin,

On 05/03/2016 03:44 AM, Martin Chaplet wrote:
> Let modem detect part overload default SIM driver by using an additional
> property named "ForceSimLegacy" (boolean).
> ---
>   plugins/gobi.c | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
>

All three applied, thanks.

Regards,
-Denis


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

end of thread, other threads:[~2016-05-03 16:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-03  8:44 [PATCH 1/3] Gobi: Enable SIM driver forcing Martin Chaplet
2016-05-03  8:44 ` [PATCH 2/3] Udevng: Improve modem properties detection Martin Chaplet
2016-05-03  8:44 ` [PATCH 3/3] Add support for Sierra MC73xx QMI modems Martin Chaplet
2016-05-03 16:12 ` [PATCH 1/3] Gobi: Enable SIM driver forcing Denis Kenzior
  -- strict thread matches above, loose matches on Subject: below --
2016-05-02 15:20 [PATCH 3/3] Add support for Sierra MC73xx QMI modems Denis Kenzior
2016-05-02 16:33 ` [PATCH 1/3] Gobi: Enable SIM driver forcing Martin Chaplet
2016-05-03  3:21   ` Denis Kenzior

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.