曾幾何時在android2.1下除錯3g模組,曾幾何時模組廠商提供的庫不能用,曾幾何時只能用自己的庫痛苦地除錯...這一切的一切都已成往事,昔日的成功在毫無保留下成為浮雲,該忘了忘記了,該記得也跟著忘記了。現如今再次調3g模組,卻不知道以前如何除錯,看來還是要記下來。
我採用的是華為em770w模組,支援wcdma網路,由於華為提供的庫只支援android2.2,所以用android2.1就需要自己修改庫原始碼。
1.修改linux核心
(1)make menuconfig:
device drivers --->
<*> ohci hcd support
[*] network device support --->
<*> ppp (point-to-point protocol) support
[*] ppp multilink support (experimental)
[*] ppp filtering
<*> ppp support for async serial ports
<*> ppp support for sync tty ports
<*> ppp deflate compression
<*> ppp bsd-compress compression
<*> ppp mppe compression (encryption) (experimental)
<*> ppp over ethernet (experimental)
<*> ppp over l2tp (experimental)
[*] usb support --->
<*> usb serial converter support --->
<*> usb driver for gsm and cdma modems
(2)增加em770w的vid和pid
修改驅動檔案drivers/usb/serial/option.c,增加以下**
#define em770w_option_vendor_id 0x12d1
#define em770w_option_product_colt 0x1001
static struct usb_device_id option_ids = ,…,
} 驅動修改後插上3g模組,kernel執行後可在/dev下出現ttyusb0、ttyusb1 、ttyusb2、ttyusb3、ttyusb4、ttyusb5和ppp裝置檔案
2.修改ril**
(1)在ril/reference-ril/android.mk新增一行:
local_cflags += -dhuawei_em770w
(2)在ril/reference-ril/atchannel.c中增加的** #
include
static
int urc_fd =
-1;/* fd of the urc channel */
static
char s_urcbuffer[max_at_response+1]
;static
char
*s_urcbuffercur = s_urcbuffer;
static
pthread_t s_tid_reader_urc;
static
const
char
*urc_readline(
)else
}while
(p_eol =
=null)do
while
(count
< 0 &
&errno
== eintr);if
(count
> 0)
elseif(
count
<
= 0)
else
return
null;}
}ret = s_urcbuffercur;
*p_eol =
'\0'
;s_urcbuffercur = p_eol + 1;
logd(
"at< %s\n"
, ret)
;return ret;
}static
void
*urc_readerloop(
void
*arg)if
(issmsunsolicited(
line))
if(s_unsolhandler !
=null
)free
(line1);}
else
}onreaderclosed();
return
null;}
(3)修改ril/reference-ril/atchannel.c中的at_open函式,增加huawei_em770w巨集控制的**
pthread_attr_init
(&attr)
;pthread_attr_setdetachstate
(&attr,
pthread_create_detached);
#ifdef huawei_em770w
int fd2 =
-1;while
(fd2 < 0)}if
(fd2 > 0)
ret =
pthread_create
(&s_tid_reader_urc,
&attr, urc_readerloop,
&attr);if
(ret < 0)
#endif
ret =
pthread_create
(&s_tid_reader,
&attr, readerloop,
&attr);
(4)在ril/reference-ril/reference-ril.c中修改的** +
#include
-#define ppp_tty_path "/dev/omap_csmi_tty1"+#
define ppp_tty_path "/dev/ppp0"
-/* not muted */
- at_send_command(
"at+cmut=0"
,null);
+/* set muted */
+ at_send_command(
"at+cmut=1"
,null);
-if( fd >
= 0 &&!
memcmp
( s_device_path,
"/dev/ttys"
, 9 ))*/
+ property_set(
"ctl.start"
,"pppd_gprs");
ril_onrequestcomplete(t, ril_e_success, response,
sizeof
(response));
at_response_free(p_response);
(5)在ril/rild/rild.c中修改的**+#
if 0
/* special override when in the emulator */-#
if 1
{static
char
* arg_overrides[3]
;static
char arg_device[32]
;//switchuser();
Android2 1下除錯3G模組(二
前面講到了如何讓修改kernel驅動和ril層 接下來還需要增加ppp撥號以及裝置檔案和服務屬性。1.修改init.gprs pppd屬性 對應檔案 system core include private android filesystem config.h 在static struct fs p...
WinCE下3G模組的除錯
這兩天在wince6.0上除錯了下3g模組,華為的em730,它支援gprs和wcdma。雖然沒有涉及到驅動的移植 沒有源 但除錯過程還是幾經周折,記下來以便後用。em730是mini pci介面的,也支援usb。於是先請硬體工程師幫忙飛了一堆線,在pc上測試了一下,工作完全正常,證明模組本身沒有問...
WinCE下3G模組的除錯
這兩天在wince6.0上除錯了下3g模組,華為的em730,它支援gprs和wcdma。雖然沒有涉及到驅動的移植 沒有源 但除錯過程還是幾經周折,記下來以便後用。em730是mini pci介面的,也支援usb。於是先請硬體工程師幫忙飛了一堆線,在pc上測試了一下,工作完全正常,證明模組本身沒有問...