All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v5] udev: add initial telit udev support
  2011-06-14 15:58 [PATCH v5] udev: add initial telit udev support Bernhard.Guillon
@ 2011-06-13 11:07 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2011-06-13 11:07 UTC (permalink / raw)
  To: ofono

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

Hi Bernhard,

On 06/14/2011 10:58 AM, Bernhard.Guillon(a)hale.at wrote:
> From: Bernhard Guillon <Bernhard.Guillon@hale.at>
> 
> ---
>  plugins/ofono.rules |    8 ++++++++
>  plugins/udev.c      |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 56 insertions(+), 0 deletions(-)
> 
> diff --git a/plugins/ofono.rules b/plugins/ofono.rules
> index 268b327..7124143 100644
> --- a/plugins/ofono.rules
> +++ b/plugins/ofono.rules
> @@ -344,6 +344,11 @@ ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1485", ENV{OFONO_IFACE_NUM}=="02", E
>  ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1486", ENV{OFONO_IFACE_NUM}=="00", ENV{OFONO_HUAWEI_TYPE}="Modem"
>  ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1486", ENV{OFONO_IFACE_NUM}=="02", ENV{OFONO_HUAWEI_TYPE}="Pcui"
>  
> +#Telit UC864-G
> +ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1004", ENV{OFONO_IFACE_NUM}=="00", ENV{OFONO_TELIT_TYPE}="Modem"
> +ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1004", ENV{OFONO_IFACE_NUM}=="02", ENV{OFONO_TELIT_TYPE}="GPS"
> +ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1004", ENV{OFONO_IFACE_NUM}=="03", ENV{OFONO_TELIT_TYPE}="Data"
> +
>  LABEL="ofono_tty_end"
>  
>  # ISI/Phonet drivers
> @@ -459,4 +464,7 @@ ATTRS{idVendor}=="0421", ATTRS{idProduct}=="00b6", ENV{OFONO_DRIVER}="nokiacdma"
>  # Teracom (Linktop/LW27x) 3G Data Card
>  ATTRS{idVendor}=="230d", ATTRS{idProduct}=="0001", ENV{OFONO_DRIVER}="linktop"
>  
> +# Telit
> +ATTRS{idVendor}=="1bc7", ENV{OFONO_DRIVER}="telit"
> +
>  LABEL="ofono_end"
> diff --git a/plugins/udev.c b/plugins/udev.c
> index 0234fc0..380e968 100644
> --- a/plugins/udev.c
> +++ b/plugins/udev.c
> @@ -587,6 +587,52 @@ static void add_linktop(struct ofono_modem *modem,
>  	}
>  }
>  
> +static void add_telit(struct ofono_modem *modem,
> +					struct udev_device *udev_device)
> +{
> +	struct udev_list_entry *entry;
> +	const char *devnode, *type;
> +	int registered;
> +
> +	DBG("modem %p", modem);
> +
> +	registered = ofono_modem_get_integer(modem, "Registered");
> +
> +	if (registered == 1)
> +		return;

You don't want to check this at the beginning, since you might receive
the Modem and Data ports, register, but then receive the GPS node.

> +
> +	entry = udev_device_get_properties_list_entry(udev_device);
> +	while (entry) {
> +		const char *name = udev_list_entry_get_name(entry);
> +		type = udev_list_entry_get_value(entry);
> +
> +		if (g_str_equal(name, "OFONO_TELIT_TYPE") != TRUE) {
> +			entry = udev_list_entry_get_next(entry);
> +			continue;
> +		}
> +
> +		if (g_str_equal(type, "Modem") == TRUE) {
> +			devnode = udev_device_get_devnode(udev_device);
> +			ofono_modem_set_string(modem, "Modem", devnode);

instead do if (registered && g_str_equal(...) here

> +		} else if (g_str_equal(type, "GPS") == TRUE) {
> +			devnode = udev_device_get_devnode(udev_device);
> +			ofono_modem_set_string(modem, "GPS", devnode);
> +		} else if (g_str_equal(type, "Data") == TRUE) {

and here

> +			devnode = udev_device_get_devnode(udev_device);
> +			ofono_modem_set_string(modem, "Data", devnode);
> +		}
> +
> +		break;
> +	}
> +

And move the if (registered == 1) statement from above down to here

> +	if ((ofono_modem_get_string(modem, "Modem") != NULL) &&
> +			(ofono_modem_get_string(modem, "Data") != NULL)) {
> +		ofono_modem_set_integer(modem, "Registered", 1);
> +		ofono_modem_register(modem);
> +	}
> +
> +}
> +
>  static void add_modem(struct udev_device *udev_device)
>  {
>  	struct ofono_modem *modem;
> @@ -681,6 +727,8 @@ done:
>  		add_calypso(modem, udev_device);
>  	else if (g_strcmp0(driver, "tc65") == 0)
>  		add_tc65(modem, udev_device);
> +	else if (g_strcmp0(driver, "telit") == 0)
> +		add_telit(modem, udev_device);
>  	else if (g_strcmp0(driver, "nokiacdma") == 0)
>  		add_nokiacdma(modem, udev_device);
>          else if (g_strcmp0(driver, "linktop") == 0)

Otherwise this looks good.

Regards,
-Denis

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

* [PATCH v5] udev: add initial telit udev support
@ 2011-06-14 15:58 Bernhard.Guillon
  2011-06-13 11:07 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Bernhard.Guillon @ 2011-06-14 15:58 UTC (permalink / raw)
  To: ofono

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

From: Bernhard Guillon <Bernhard.Guillon@hale.at>

---
 plugins/ofono.rules |    8 ++++++++
 plugins/udev.c      |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/plugins/ofono.rules b/plugins/ofono.rules
index 268b327..7124143 100644
--- a/plugins/ofono.rules
+++ b/plugins/ofono.rules
@@ -344,6 +344,11 @@ ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1485", ENV{OFONO_IFACE_NUM}=="02", E
 ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1486", ENV{OFONO_IFACE_NUM}=="00", ENV{OFONO_HUAWEI_TYPE}="Modem"
 ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1486", ENV{OFONO_IFACE_NUM}=="02", ENV{OFONO_HUAWEI_TYPE}="Pcui"
 
+#Telit UC864-G
+ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1004", ENV{OFONO_IFACE_NUM}=="00", ENV{OFONO_TELIT_TYPE}="Modem"
+ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1004", ENV{OFONO_IFACE_NUM}=="02", ENV{OFONO_TELIT_TYPE}="GPS"
+ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1004", ENV{OFONO_IFACE_NUM}=="03", ENV{OFONO_TELIT_TYPE}="Data"
+
 LABEL="ofono_tty_end"
 
 # ISI/Phonet drivers
@@ -459,4 +464,7 @@ ATTRS{idVendor}=="0421", ATTRS{idProduct}=="00b6", ENV{OFONO_DRIVER}="nokiacdma"
 # Teracom (Linktop/LW27x) 3G Data Card
 ATTRS{idVendor}=="230d", ATTRS{idProduct}=="0001", ENV{OFONO_DRIVER}="linktop"
 
+# Telit
+ATTRS{idVendor}=="1bc7", ENV{OFONO_DRIVER}="telit"
+
 LABEL="ofono_end"
diff --git a/plugins/udev.c b/plugins/udev.c
index 0234fc0..380e968 100644
--- a/plugins/udev.c
+++ b/plugins/udev.c
@@ -587,6 +587,52 @@ static void add_linktop(struct ofono_modem *modem,
 	}
 }
 
+static void add_telit(struct ofono_modem *modem,
+					struct udev_device *udev_device)
+{
+	struct udev_list_entry *entry;
+	const char *devnode, *type;
+	int registered;
+
+	DBG("modem %p", modem);
+
+	registered = ofono_modem_get_integer(modem, "Registered");
+
+	if (registered == 1)
+		return;
+
+	entry = udev_device_get_properties_list_entry(udev_device);
+	while (entry) {
+		const char *name = udev_list_entry_get_name(entry);
+		type = udev_list_entry_get_value(entry);
+
+		if (g_str_equal(name, "OFONO_TELIT_TYPE") != TRUE) {
+			entry = udev_list_entry_get_next(entry);
+			continue;
+		}
+
+		if (g_str_equal(type, "Modem") == TRUE) {
+			devnode = udev_device_get_devnode(udev_device);
+			ofono_modem_set_string(modem, "Modem", devnode);
+		} else if (g_str_equal(type, "GPS") == TRUE) {
+			devnode = udev_device_get_devnode(udev_device);
+			ofono_modem_set_string(modem, "GPS", devnode);
+		} else if (g_str_equal(type, "Data") == TRUE) {
+			devnode = udev_device_get_devnode(udev_device);
+			ofono_modem_set_string(modem, "Data", devnode);
+		}
+
+		break;
+	}
+
+	if ((ofono_modem_get_string(modem, "Modem") != NULL) &&
+			(ofono_modem_get_string(modem, "Data") != NULL)) {
+		ofono_modem_set_integer(modem, "Registered", 1);
+		ofono_modem_register(modem);
+	}
+
+}
+
 static void add_modem(struct udev_device *udev_device)
 {
 	struct ofono_modem *modem;
@@ -681,6 +727,8 @@ done:
 		add_calypso(modem, udev_device);
 	else if (g_strcmp0(driver, "tc65") == 0)
 		add_tc65(modem, udev_device);
+	else if (g_strcmp0(driver, "telit") == 0)
+		add_telit(modem, udev_device);
 	else if (g_strcmp0(driver, "nokiacdma") == 0)
 		add_nokiacdma(modem, udev_device);
         else if (g_strcmp0(driver, "linktop") == 0)
-- 
1.7.0.4



--
Scanned by MailScanner.


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

end of thread, other threads:[~2011-06-14 15:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-14 15:58 [PATCH v5] udev: add initial telit udev support Bernhard.Guillon
2011-06-13 11:07 ` 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.