Open Source Telephony
 help / color / mirror / Atom feed
From: Amit Mendapara <mendapara.amit@gmail.com>
To: ofono@ofono.org
Subject: [PATCH 2/3] udev: Handle Linktop data card
Date: Thu, 10 Feb 2011 10:45:39 +0530	[thread overview]
Message-ID: <1297314940-4315-2-git-send-email-mendapara.amit@gmail.com> (raw)
In-Reply-To: <1297314940-4315-1-git-send-email-mendapara.amit@gmail.com>

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

Signed-off-by: Amit Mendapara <mendapara.amit@gmail.com>
---
 plugins/udev.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/plugins/udev.c b/plugins/udev.c
index ce1efe6..84478d7 100644
--- a/plugins/udev.c
+++ b/plugins/udev.c
@@ -552,6 +552,36 @@ static void add_nokiacdma(struct ofono_modem *modem,
 	ofono_modem_register(modem);
 }
 
+static void add_linktop(struct ofono_modem *modem,
+					struct udev_device *udev_device)
+{
+	const char *devnode, *intfnum;
+	struct udev_device *parent;
+	int registered;
+
+	DBG("modem %p", modem);
+
+	registered = ofono_modem_get_integer(modem, "Registered");
+	if (registered != 0)
+		return;
+
+	parent = udev_device_get_parent(udev_device);
+	intfnum = udev_device_get_sysattr_value(parent, "bInterfaceNumber");
+
+	DBG("intfnum %s", intfnum);
+
+	if (g_strcmp0(intfnum, "01") == 0) {
+		devnode = udev_device_get_devnode(udev_device);
+		ofono_modem_set_string(modem, "Modem", devnode);
+	} else if (g_strcmp0(intfnum, "03") == 0) {
+		devnode = udev_device_get_devnode(udev_device);
+		ofono_modem_set_string(modem, "Control", devnode);
+
+		ofono_modem_set_integer(modem, "Registered", 1);
+		ofono_modem_register(modem);
+	}
+}
+
 static void add_modem(struct udev_device *udev_device)
 {
 	struct ofono_modem *modem;
@@ -646,6 +676,8 @@ done:
 		add_tc65(modem, udev_device);
 	else if (g_strcmp0(driver, "nokiacdma") == 0)
 		add_nokiacdma(modem, udev_device);
+        else if (g_strcmp0(driver, "linktop") == 0)
+		add_linktop(modem, udev_device);
 }
 
 static gboolean devpath_remove(gpointer key, gpointer value, gpointer user_data)
-- 
1.7.1


  reply	other threads:[~2011-02-10  5:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-10  5:15 [PATCH 1/3] plugin: Add plugin for Linktop LW27x data cards Amit Mendapara
2011-02-10  5:15 ` Amit Mendapara [this message]
2011-02-14 19:55   ` [PATCH 2/3] udev: Handle Linktop data card Denis Kenzior
2011-02-10  5:15 ` [PATCH 3/3] udev: Add Teracom (Linktop/LW27x) device detection Amit Mendapara
2011-02-14 19:56   ` Denis Kenzior
2011-02-14 19:54 ` [PATCH 1/3] plugin: Add plugin for Linktop LW27x data cards Denis Kenzior
  -- strict thread matches above, loose matches on Subject: below --
2011-02-07  3:22 Amit Mendapara
2011-02-07  3:22 ` [PATCH 2/3] udev: Handle Linktop data card Amit Mendapara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1297314940-4315-2-git-send-email-mendapara.amit@gmail.com \
    --to=mendapara.amit@gmail.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox