Ads 468x60px

##EasyReadMore##

18 1月, 2018

ofonod 簡介及修改 support 新 module

ofonod 簡介:

  oFono 堆疊 (stack) 以開放源碼的 Linux 與高階 D-Bus 相互連通 API 為基礎,鎖定行動電話 (GSM/UMTS)  應用軟體開發。
oFono 技術以 GPLv2 授權釋出,包含了高階的 D-Bus (Desktop Bus)  API,可供採用各種不同授權的電話應用軟體使用。D-Bus 是由 FreeDesktop.org 所開發的開放源碼行程間通訊 (IPC) 技術,可以連接應用軟體至周邊服務。

image

OFono - 開放百科- 灰狐 - https://goo.gl/HnS5r2

ofono Test:

  Module        PID      type    use         ofonoTest
  MU609         1573    3G        RD            pass
  MU709        1c25     3.5G    板端測試        fail
  MU909         1573    4G        出貨            fail
  UC20         9003    3G        RD            FAIL

比較新的 module 不支援,所以需要改 oFono

source code path:

  /home/ray/QX2_Yocto/ecscombie1208/build/tmp/work/i586-nlp-32-poky-linux/ofono/1.18-r0/ofono-1.18

binary path:
  /home/ray/QX2_Yocto/ecscombie1208/build/tmp/work/i586-nlp-32-poky-linux/ofono/1.18-r0/build/src/ofonod

deploy path:
  cp ofonod /usr/sbin/

Module information:

  /usr/lib/ofono/test/list-modems
  [ /huawei_0 ]
    ............
    Manufacturer = Huawei Technologies Co., Ltd.
    Model = MU709s-2
     ..........
     SubscriberIdentity = 466977602515565

root@intel-quark:~# lsusb
  Bus 001 Device 005: ID 13d3:3410 IMC Networks
  Bus 001 Device 004: ID 12d1:1c25 Huawei Technologies Co., Ltd.
 
  得到 vid , pid:
  vid:12d1
  pid:1c25

執行 oFono 結果解說:

  ./ofonod -d -n
  -d:debug message
  -n:dont run at background

 ./ofonod -d -n
 -d:debug message
 -n:dont run at background
 
 ofonod[807]: oFono version 1.18
 .................
 ofonod[612]: ../ofono-1.18/plugins/udevng.c:check_usb_device() usb [13d3:3410]
 # vid pid 會在這邊看到
 ofonod[612]: ../ofono-1.18/plugins/udevng.c:check_usb_device() btusb [(null):(null)]
 ofonod[612]: ../ofono-1.18/plugins/udevng.c:check_usb_device() btusb [(null):(null)]
 ofonod[612]: ../ofono-1.18/plugins/udevng.c:check_usb_device() hub [(null):(null)]
 ofonod[612]: ../ofono-1.18/plugins/udevng.c:check_usb_device() hub [(null):(null)]
 ofonod[612]: ../ofono-1.18/plugins/udevng.c:create_modem() /sys/devices/pci0000:00/ 0000:00:14.3/usb1/1-2/1-2.1
 ofonod[612]: ../ofono-1.18/plugins/udevng.c:create_modem() driver=huawei
 ofonod[612]: ../ofono-1.18/src/modem.c:ofono_modem_create() name: (null), type: huawei
 ofonod[612]: ../ofono-1.18/plugins/udevng.c:setup_huawei() /sys/devices/pci0000:00/ 0000:00:14.3/usb1/1-2/1-2.1
 ofonod[612]: ../ofono-1.18/plugins/udevng.c:setup_huawei() /dev/ttyUSB0 255/3/1 02 (null)
 ofonod[612]: ../ofono-1.18/plugins/udevng.c:setup_huawei() modem info->interface= 255/3/1
 ofonod[612]: ../ofono-1.18/plugins/udevng.c:setup_huawei() /dev/ttyUSB1 255/3/3 03 (null)
 ofonod[612]: ../ofono-1.18/plugins/udevng.c:setup_huawei() diag info->interface= 255/3/3
 ofonod[612]: ../ofono-1.18/plugins/udevng.c:setup_huawei() /dev/ttyUSB2 255/3/2 04 (null)
 ofonod[612]: ../ofono-1.18/plugins/udevng.c:setup_huawei() pcui info->interface= 255/3/2
 ofonod[612]: ../ofono-1.18/plugins/udevng.c:setup_huawei() /dev/ttyUSB3 255/3/6 05 (null)
 # 255/3/6 :node ID,要新增裝置靠的是 node ID 
 ofonod[612]: ../ofono-1.18/plugins/udevng.c:setup_huawei() modem Modle= h mdm=/dev/ttyUSB0  pcui=/dev/ttyUSB2 diag=/dev/ttyUSB1 qmi=(null) net=(null)
 # mdm=/dev/ttyUSB0 pcui=/dev/ttyUSB2 diag=/dev/ttyUSB1 要辯識的到才會開始註冊
 modem Modle= h-
 ofonod[612]: ../ofono-1.18/src/modem.c:set_modem_property() modem 0x82d7340 property Model
 ofonod[612]: ../ofono-1.18/src/modem.c:set_modem_property() modem 0x82d7340 property Device
 ofonod[612]: ../ofono-1.18/src/modem.c:set_modem_property() modem 0x82d7340 property Modem
 ofonod[612]: ../ofono-1.18/src/modem.c:set_modem_property() modem 0x82d7340 property Pcui
 ofonod[612]: ../ofono-1.18/src/modem.c:set_modem_property() modem 0x82d7340 property Diag
 ofonod[612]: ../ofono-1.18/src/modem.c:set_modem_property() modem 0x82d7340 property  NetworkInterface
 ofonod[612]: ../ofono-1.18/src/modem.c:ofono_modem_register() 0x82d7340
 # 重點是有執行 ofono_modem_register ,/usr/lib/ofono/test/list-modems 才有資訊

add support patch 如下:

0001-add-MU709-MU909-support.patch

From 33c7394bde9d026f28e9c300993a3ac423032ae6 Mon Sep 17 00:00:00 2001
From: oknow23 
Date: Wed, 17 Jan 2018 14:59:38 +0800
Subject: [PATCH 1/2] add MU709 ,MU909 support

---
 drivers/atmodem/gprs-context.c |  4 +++-
 drivers/atmodem/vendor.h       |  2 ++
 plugins/huawei.c               | 14 +++++++++++---
 plugins/udevng.c               | 20 ++++++++++++++++++--
 4 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/drivers/atmodem/gprs-context.c b/drivers/atmodem/gprs-context.c
index f6e6c2e..9f37c32 100644
--- a/drivers/atmodem/gprs-context.c
+++ b/drivers/atmodem/gprs-context.c
@@ -210,7 +210,9 @@ static void at_cgdcont_cb(gboolean ok, GAtResult *result, gpointer user_data)
 		return;
 	}
 
-	if (gcd->vendor == OFONO_VENDOR_SIMCOM_SIM900)
+	if ((gcd->vendor == OFONO_VENDOR_SIMCOM_SIM900) ||
+			(gcd->vendor == OFONO_VENDOR_HUAWEI_MU709) ||
+			(gcd->vendor == OFONO_VENDOR_HUAWEI_MU909))		
 		sprintf(buf, "ATD*99***%u#", gcd->active_context);
 	else
 		sprintf(buf, "AT+CGDATA=\"PPP\",%u", gcd->active_context);
diff --git a/drivers/atmodem/vendor.h b/drivers/atmodem/vendor.h
index 71a9af7..adb38cb 100644
--- a/drivers/atmodem/vendor.h
+++ b/drivers/atmodem/vendor.h
@@ -30,6 +30,8 @@ enum ofono_vendor {
 	OFONO_VENDOR_OPTION_HSO,
 	OFONO_VENDOR_ZTE,
 	OFONO_VENDOR_HUAWEI,
+	OFONO_VENDOR_HUAWEI_MU709,
+	OFONO_VENDOR_HUAWEI_MU909,
 	OFONO_VENDOR_SIERRA,
 	OFONO_VENDOR_NOVATEL,
 	OFONO_VENDOR_WAVECOM,
diff --git a/plugins/huawei.c b/plugins/huawei.c
index 59995b3..379493f 100644
--- a/plugins/huawei.c
+++ b/plugins/huawei.c
@@ -25,6 +25,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -787,19 +788,26 @@ static void huawei_pre_sim(struct ofono_modem *modem)
 {
 	struct huawei_data *data = ofono_modem_get_data(modem);
 	struct ofono_sim *sim = NULL;
+	const char *model;
+	enum ofono_vendor vendor = OFONO_VENDOR_HUAWEI;
 
-	DBG("%p", modem);
+	DBG("modem name:%p", modem);
+	model = ofono_modem_get_string(modem, "Model");
+	if (model && strncmp(model, "MU709", 5) == 0)
+		vendor = OFONO_VENDOR_HUAWEI_MU709;
+	else if(model && strncmp(model, "MU909", 5) == 0)
+		vendor = OFONO_VENDOR_HUAWEI_MU909;
 
 	if (data->have_gsm == TRUE) {
 		ofono_devinfo_create(modem, 0, "atmodem", data->pcui);
-		sim = ofono_sim_create(modem, OFONO_VENDOR_HUAWEI,
+		sim = ofono_sim_create(modem, vendor,
 						"atmodem", data->pcui);
 	} else if (data->have_cdma == TRUE) {
 		ofono_devinfo_create(modem, 0, "cdmamodem", data->pcui);
 
 		/* Create SIM atom only if SIM is not embedded */
 		if (data->sim_state != SIM_STATE_ROMSIM)
-			sim = ofono_sim_create(modem, OFONO_VENDOR_HUAWEI,
+			sim = ofono_sim_create(modem, vendor,
 						"atmodem-noef", data->pcui);
 	}
 
diff --git a/plugins/udevng.c b/plugins/udevng.c
index 607e381..d1960f3 100644
--- a/plugins/udevng.c
+++ b/plugins/udevng.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -325,17 +326,26 @@ static gboolean setup_huawei(struct modem_info *modem)
 		if (g_strcmp0(info->label, "modem") == 0 ||
 				g_strcmp0(info->interface, "255/1/1") == 0 ||
 				g_strcmp0(info->interface, "255/2/1") == 0 ||
+				g_strcmp0(info->interface, "255/3/1") == 0 ||//MU709
+				g_strcmp0(info->interface, "255/1/16") == 0 ||//MU909
 				g_strcmp0(info->interface, "255/1/49") == 0) {
+			DBG("modem info->interface= %s\n",info->interface);
 			mdm = info->devnode;
 		} else if (g_strcmp0(info->label, "pcui") == 0 ||
 				g_strcmp0(info->interface, "255/1/2") == 0 ||
 				g_strcmp0(info->interface, "255/2/2") == 0 ||
+				g_strcmp0(info->interface, "255/3/2") == 0 ||//MU709
+				g_strcmp0(info->interface, "255/1/18") == 0 ||//MU909
 				g_strcmp0(info->interface, "255/1/50") == 0) {
+			DBG("pcui info->interface= %s\n",info->interface);
 			pcui = info->devnode;
 		} else if (g_strcmp0(info->label, "diag") == 0 ||
 				g_strcmp0(info->interface, "255/1/3") == 0 ||
 				g_strcmp0(info->interface, "255/2/3") == 0 ||
+				g_strcmp0(info->interface, "255/3/3") == 0 ||//MU709
+				g_strcmp0(info->interface, "255/1/19") == 0 ||//MU909
 				g_strcmp0(info->interface, "255/1/51") == 0) {
+			DBG("diag info->interface= %s\n",info->interface);
 			diag = info->devnode;
 		} else if (g_strcmp0(info->interface, "255/1/8") == 0 ||
 				g_strcmp0(info->interface, "255/1/56") == 0) {
@@ -366,8 +376,14 @@ static gboolean setup_huawei(struct modem_info *modem)
 		return FALSE;
 
 done:
-	DBG("mdm=%s pcui=%s diag=%s qmi=%s net=%s", mdm, pcui, diag, qmi, net);
-
+	DBG("modem Modle= %s mdm=%s pcui=%s diag=%s qmi=%s net=%s",modem->modem, mdm, pcui, diag, qmi, net);
+printf("modem Modle= %s\n",modem->modem);
+	if (g_strcmp0(modem->model, "1c25") == 0)
+		ofono_modem_set_string(modem->modem, "Model", "MU709s-2");
+	else if (g_strcmp0(modem->model, "1573") == 0)
+		ofono_modem_set_string(modem->modem, "Model", "MU909s120");
+	else if (g_strcmp0(modem->model, "9003") == 0)
+		ofono_modem_set_string(modem->modem, "Model", "UC20");
 	ofono_modem_set_string(modem->modem, "Device", qmi);
 	ofono_modem_set_string(modem->modem, "Modem", mdm);
 	ofono_modem_set_string(modem->modem, "Pcui", pcui);
-- 
2.8.1.windows.1


</oknow23@gmail.com>

0002-add-UC20-UC21-support.patch

From 32dcfcbb36a7abc05459d78d956af745c9f59935 Mon Sep 17 00:00:00 2001
From: oknow23 
Date: Wed, 17 Jan 2018 16:17:21 +0800
Subject: [PATCH 2/2] add UC20 ,UC21 support

---
 drivers/atmodem/vendor.h | 2 ++
 plugins/udevng.c         | 8 +++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/atmodem/vendor.h b/drivers/atmodem/vendor.h
index adb38cb..fa5a714 100644
--- a/drivers/atmodem/vendor.h
+++ b/drivers/atmodem/vendor.h
@@ -46,6 +46,8 @@ enum ofono_vendor {
 	OFONO_VENDOR_WAVECOM_Q2XXX,
 	OFONO_VENDOR_ALCATEL,
 	OFONO_VENDOR_QUECTEL,
+	OFONO_VENDOR_QUECTEL_UC20,
+	OFONO_VENDOR_QUECTEL_UC21,
 	OFONO_VENDOR_UBLOX,
 	OFONO_VENDOR_UBLOX_TOBY_L2,
 	OFONO_VENDOR_CINTERION,
diff --git a/plugins/udevng.c b/plugins/udevng.c
index d1960f3..81d388f 100644
--- a/plugins/udevng.c
+++ b/plugins/udevng.c
@@ -382,8 +382,6 @@ printf("modem Modle= %s\n",modem->modem);
 		ofono_modem_set_string(modem->modem, "Model", "MU709s-2");
 	else if (g_strcmp0(modem->model, "1573") == 0)
 		ofono_modem_set_string(modem->modem, "Model", "MU909s120");
-	else if (g_strcmp0(modem->model, "9003") == 0)
-		ofono_modem_set_string(modem->modem, "Model", "UC20");
 	ofono_modem_set_string(modem->modem, "Device", qmi);
 	ofono_modem_set_string(modem->modem, "Modem", mdm);
 	ofono_modem_set_string(modem->modem, "Pcui", pcui);
@@ -850,7 +848,9 @@ static gboolean setup_quectel(struct modem_info *modem)
 			mdm = info->devnode;
 			if (aux != NULL)
 				break;
-		} else if (g_strcmp0(info->interface, "255/255/255") == 0) {
+		} else if (g_strcmp0(info->interface, "255/255/255") == 0  //UC20
+		|| g_strcmp0(info->interface, "255/0/0") == 0) //UC21
+		{
 			if (g_strcmp0(info->number, "02") == 0)
 				aux = info->devnode;
 			else if (g_strcmp0(info->number, "03") == 0)
@@ -1190,6 +1190,8 @@ static struct {
 	{ "samsung",	"option",	"04e8", "6889"	},
 	{ "samsung",	"kalmia"			},
 	{ "quectel",	"option",	"05c6", "9090"	},
+	{ "quectel",	"option",	"05c6", "9003"	},//UC20
+	{ "quectel",	"option",	"2c7c", "0121"	},//UC21
 	{ "ublox",	"cdc_acm",	"1546", "1102"	},
 	{ "ublox",	"rndis_host",	"1546", "1146"	},
 	{ "ublox",	"cdc_acm",	"1546", "1146"	},
-- 
2.8.1.windows.1


</oknow23@gmail.com>

0 意見:

張貼留言

 
Blogger Templates