Skip to contentSkip to conversation

Add support of Huawei EM770 modem

PATCH In review Yang Gu 2 participants 2 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/em770.c     |  226 +++++++++++++++++++++++++++++++++++++++++++++++++++
 plugins/ofono.rules |    1 +
 plugins/udev.c      |   27 ++++++
 4 files changed, 257 insertions(+), 0 deletions(-)
 create mode 100644 plugins/em770.c
Makefile.am +3 -0
index 93d4f67..eca8eee 100644
@@ -195,6 +195,9 @@ builtin_sources += plugins/hso.c
 builtin_modules += huawei
 builtin_sources += plugins/huawei.c
 
+builtin_modules += em770
+builtin_sources += plugins/em770.c
+
 builtin_modules += novatel
 builtin_sources += plugins/novatel.c
 
plugins/em770.c new file +226 -0

226 lines not on this page · raw message

plugins/ofono.rules +1 -0
index 3db0cf4..a6202f9 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}="em770"
 
 # Novatel Wireless
 ATTRS{idVendor}=="1410", ENV{OFONO_DRIVER}="novatel"
plugins/udev.c +27 -0
index 455bef3..9c4f2c8 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_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, "em770") == 0)
+		add_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/em770.c     |  226 +++++++++++++++++++++++++++++++++++++++++++++++++++
 plugins/ofono.rules |    1 +
 plugins/udev.c      |   27 ++++++
 4 files changed, 257 insertions(+), 0 deletions(-)
 create mode 100644 plugins/em770.c

patch has been applied. Thanks.

Regards

Marcel