Skip to contentSkip to conversation

Add support of Huawei EM770 modem

PATCH In review Yang Gu 3 participants 3 messages Mar 16, 2010 Kbuild

lore
Share & tools
lore

Yang Gu

author
#0 lore raw

PATCH 1/1 Add support of Huawei EM770 modem

Comparing with general Huawei modem, EM770 is a full feature modem that supports voicecall, phonebook, call forwarding, call barring, etc.

---
 Makefile.am            |    3 +
 plugins/huawei-em770.c |  226 ++++++++++++++++++++++++++++++++++++++++++++++++
 plugins/ofono.rules    |    1 +
 plugins/udev.c         |   27 ++++++
 4 files changed, 257 insertions(+), 0 deletions(-)
 create mode 100644 plugins/huawei-em770.c
Makefile.am +3 -0
index 93d4f67..ee3e9e0 100644
@@ -195,6 +195,9 @@ builtin_sources += plugins/hso.c
 builtin_modules += huawei
 builtin_sources += plugins/huawei.c
 
+builtin_modules += huawei_em770
+builtin_sources += plugins/huawei-em770.c
+
 builtin_modules += novatel
 builtin_sources += plugins/novatel.c
 
plugins/huawei-em770.c new file +226 -0

226 lines not on this page · raw message

plugins/ofono.rules +1 -0
index 3db0cf4..eeaa3c5 100644
@@ -6,6 +6,7 @@ ENV{DEVTYPE}!="usb_device", GOTO="ofono_end"
 
 # HUAWEI Technology
 ATTRS{idVendor}=="12d1", ENV{OFONO_DRIVER}="huawei"
+ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1404", ENV{OFONO_DRIVER}="huawei_em770"
 
 # Novatel Wireless
 ATTRS{idVendor}=="1410", ENV{OFONO_DRIVER}="novatel"
plugins/udev.c +27 -0
index 455bef3..93a4c92 100644
@@ -28,6 +28,7 @@
 #include <libudev.h>
 
 #include <glib.h>
+#include <string.h>
 
 #define OFONO_API_SUBJECT_TO_CHANGE
 #include <ofono/plugin.h>
@@ -208,6 +209,30 @@ static void add_huawei(struct ofono_modem *modem,
 	ofono_modem_register(modem);
 }
 
+static void add_huawei_em770(struct ofono_modem *modem,
+					struct udev_device *udev_device)
+{
+	const char *devnode, *intf_number;
+	int registered;
+	struct udev_device *parent;
+
+	registered = ofono_modem_get_integer(modem, "Registered");
+	if (registered != 0)
+		return;
+
+	parent = udev_device_get_parent(udev_device);
+	parent = udev_device_get_parent(parent);
+	intf_number = udev_device_get_sysattr_value(parent, "bInterfaceNumber");
+
+	if (!strcmp(intf_number, "02")) {
+		devnode = udev_device_get_devnode(udev_device);
+		ofono_modem_set_string(modem, "Device", devnode);
+
+		ofono_modem_set_integer(modem, "Registered", 1);
+		ofono_modem_register(modem);
+	}
+}
+
 static void add_novatel(struct ofono_modem *modem,
 					struct udev_device *udev_device)
 {
@@ -271,6 +296,8 @@ static void add_modem(struct udev_device *udev_device)
 		add_hso(modem, udev_device);
 	else if (g_strcmp0(driver, "huawei") == 0)
 		add_huawei(modem, udev_device);
+	else if (g_strcmp0(driver, "huawei_em770") == 0)
+		add_huawei_em770(modem, udev_device);
 	else if (g_strcmp0(driver, "novatel") == 0)
 		add_novatel(modem, udev_device);
 }
Signature · 1 line
1.6.3.3
#1 lore raw

Hi Yang,

Quoted 9 lines

Comparing with general Huawei modem, EM770 is a full feature modem that supports voicecall, phonebook, call forwarding, call barring, etc.

---
 Makefile.am            |    3 +
 plugins/huawei-em770.c |  226 ++++++++++++++++++++++++++++++++++++++++++++++++
 plugins/ofono.rules    |    1 +
 plugins/udev.c         |   27 ++++++
 4 files changed, 257 insertions(+), 0 deletions(-)
 create mode 100644 plugins/huawei-em770.c

for simplicity just let call it em770.c and everything where you have huawei_em770 just use em770. We do similar things for G1 etc.

Regards

Marcel

#2 lore raw
Quoted 15 lines

-----Original Message-----
From: ofono-bounces(a)ofono.org [mailto:ofono-bounces(a)ofono.org] On Behalf Of Marcel Holtmann
Sent: Tuesday, March 16, 2010 2:45 PM
To: ofono(a)ofono.org
Subject: Re: [PATCH] Add support of Huawei EM770 modem

Hi Yang,

Quoted 5 lines

Comparing with general Huawei modem, EM770 is a full feature modem that supports voicecall, phonebook, call forwarding, call barring, etc.

---
 Makefile.am            |    3 +
 plugins/huawei-em770.c |  226
Quoted 8 lines

++++++++++++++++++++++++++++++++++++++++++++++++

Quoted 4 lines
 plugins/ofono.rules    |    1 +
 plugins/udev.c         |   27 ++++++
 4 files changed, 257 insertions(+), 0 deletions(-)
 create mode 100644 plugins/huawei-em770.c

for simplicity just let call it em770.c and everything where you have huawei_em770 just use em770. We do similar things for G1 etc.

I added the prefix "huawei" on purpose so that other users may not confuse about what kind of modem it belongs. Anyway, I will remove it soon.

Quoted 10 lines

Regards

Marcel

_______________________________________________
ofono mailing list
ofono(a)ofono.org
http://lists.ofono.org/listinfo/ofono