Re: [android-developers] GPRS in my Android doesn't work .....

63 views
Skip to first unread message

David Turner

unread,
Nov 11, 2008, 4:24:22 AM11/11/08
to android...@googlegroups.com
-cc android-developers +cc android-porting

what about using strace to see what the problem might be ?

On Mon, Nov 10, 2008 at 9:18 AM, Wang Xiaoguang <wxiao...@gmail.com> wrote:
I have successfully created a GPRS connection to my ISP,

# busybox ifconfig ppp0
ppp0      Link encap:Point-to-Point Protocol
          inet addr:10.8.232.45  P-t-P:10.8.232.45  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:11 errors:1 dropped:0 overruns:0 frame:0
          TX packets:24 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:510 (510.0 B)  TX bytes:1386 (1.3 KiB)

# busybox route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         10.8.232.45     0.0.0.0         UG    0      0        0 ppp0


But I can not connect to remote hosts, eg:
busybox wget http://202.108.22.5/
(Never succeed)

When I am trying to make a TCP connection, both the "RX packets" and "TX packets" of ppp0 increases.


I have tried these commands in my Linux on PC and they worked correctly.

How can I get GPRS worked in my Android ?





WANG Xiaoguang

unread,
Nov 13, 2008, 9:22:08 AM11/13/08
to android-porting
Finally I resolved this problem.

It seems a bug in kernel, which is caused by using 'enum' in a struct
in Linux's kernel.

Different compilers use different data types on 'enum' (maybe 'char'
or 'int')

In my android, the kernel's 'enum' size is 4, while the size of 'enum'
in ELF binarys is 1.
Then some options in kernel is incorrect.

It's really a bad idea to use 'enum' in a struct, especially whichwill
be used by other applications outside the module which defines it,
but unfortunately there are still some misuses in Linux's kernel.


On 11月11日, 下午5时24分, "David Turner" <di...@android.com> wrote:
> -cc android-developers +cc android-porting
>
> what about using strace to see what the problem might be ?
>
> On Mon, Nov 10, 2008 at 9:18 AM, Wang Xiaoguang <wxiaogu...@gmail.com>wrote:
>
>
>
> > I have successfully created a GPRS connection to my ISP,
>
> > # busybox ifconfig ppp0
> > ppp0 Link encap:Point-to-Point Protocol
> > inet addr:10.8.232.45 P-t-P:10.8.232.45 Mask:255.255.255.255
> > UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
> > RX packets:11 errors:1 dropped:0 overruns:0 frame:0
> > TX packets:24 errors:0 dropped:0 overruns:0 carrier:0
> > collisions:0 txqueuelen:3
> > RX bytes:510 (510.0 B) TX bytes:1386 (1.3 KiB)
>
> > # busybox route
> > Kernel IP routing table
> > Destination Gateway Genmask Flags Metric Ref Use
> > Iface
> > default 10.8.232.45 0.0.0.0 UG 0 0 0
> > ppp0
>
> > But I can not connect to remote hosts, eg:
> > busybox wgethttp://202.108.22.5/&
> > (Never succeed)
>
> > When I am trying to make a TCP connection, both the "RX packets" and "TX
> > packets" of ppp0 increases.
>
> > I have tried these commands in my Linux on PC and they worked correctly.
>
> > How can I get GPRS worked in my Android ?- 隐藏被引用文字 -
>
> - 显示引用的文字 -

koba

unread,
Nov 13, 2008, 8:58:24 PM11/13/08
to android-porting
Hi

Could you share which enum cause problem?

I am fighting some strange android behavior in my board.
Your information might help me.

Wang Xiaoguang

unread,
Nov 13, 2008, 9:50:09 PM11/13/08
to android...@googlegroups.com
include/linux/if_ppp.h

 91 struct npioctl {
 92         int             protocol;       /* PPP protocol, e.g. PPP_IP */
 93         enum NPmode     mode;
 94 };


I hate enum in struct ............  it wasted me a whole week. 

I am sure a patch must be submitted to the kernel to prevent others from experiencing my pain.



If you think you meet my problem, the best way to test is to compile all your 
source codes in the same compiler, and the same optimizing options, which will not cause this problem




2008/11/14 koba <tetsu...@gmail.com>

jyukon

unread,
Nov 13, 2008, 10:06:41 PM11/13/08
to android-porting
Hi,

I had the same issues when I implemented UVC camera support. In my
case,
struct v4l2_requestbuffers in linux/videodev2.h is the problem. I
settled it using android toolchain with CONFIG_CC_OPTIMIZE_FOR_SIZE
option.

koba

unread,
Nov 13, 2008, 11:10:48 PM11/13/08
to android-porting
Thank you.
I will check on my environment.

Misael Lopez

unread,
Nov 14, 2008, 3:28:00 AM11/14/08
to android...@googlegroups.com
Don't you think the enum problem is more related to "short enums"?

Have you tried to compile your code also with -fno-short-enums cflag?

Misa

2008/11/13 jyukon <jyu...@gmail.com>:

Ulrik Bech Hald

unread,
Dec 3, 2008, 4:20:25 PM12/3/08
to android-porting
We're facing a similar problem as WANG Xiaoguang, refer to
http://groups.google.com/group/android-porting/browse_thread/thread/5031fb191f2f1a14

Our ppp0 interface is up but connections to the outside network won't
go through.

What are the changes you did to the enum to make it work?

Do you think the problems are caused by the enum in the npioctl struct
or the fact that pppd was ported to android, and perhaps then modified
to directly use the ioctl interface w/ enums?

Thanks,
Ulrik

Ulrik Bech Hald

unread,
Dec 8, 2008, 1:57:57 PM12/8/08
to android-porting, m...@ti.com
Okay, tried the solution suggested by Misael. Changed the ../external/
ppp/pppd/Android.mk to include the following:

# To force sizeof(enum) = 4
ifneq ($(TARGET_SIMULATOR),true)
LOCAL_CFLAGS += -mabi=aapcs-linux
endif

This will prevent the Android compiler from using short enums when
compiling pppd.

..And it works! Finally able to browse using the PPP-GPRS connection.

Ulrik




On 3 Dec., 15:20, Ulrik Bech Hald <u...@ti.com> wrote:
> We're facing a similar problem as WANG Xiaoguang, refer tohttp://groups.google.com/group/android-porting/browse_thread/thread/5...

john wang

unread,
Dec 8, 2008, 8:30:15 PM12/8/08
to android...@googlegroups.com
The real way is:
LOCAL_CFLAGS += -fno-short-enums
Android compiler default setting is 1 byte for enum type. 
2008/12/9 Ulrik Bech Hald <u...@ti.com>

Maxime Petazzoni

unread,
Dec 9, 2008, 6:10:36 PM12/9/08
to android-porting
Hi,

Could you explain what steps you had to go through to get GPRS working
on your Android port? From what I understand, one needs at least:
- a SIM card to a wireless provider with a data plan (of course)
- a working libhardware_ril ?
- what else ?

I'm trying to understand what are the components involved here, and
I'm most likely missing most of them. Any clarification on the subject
would help :)

Thank you in advance,
- Maxime

David Turner

unread,
Dec 9, 2008, 6:23:17 PM12/9/08
to android...@googlegroups.com
On Tue, Dec 9, 2008 at 3:10 PM, Maxime Petazzoni <maxime.p...@gmail.com> wrote:

Hi,

Could you explain what steps you had to go through to get GPRS working
on your Android port? From what I understand, one needs at least:
 - a SIM card to a wireless provider with a data plan (of course)
 - a working libhardware_ril ?
 - what else ?

there is alreadya reference ril library available in the open source tree that can be
used to talk with some hardware. the name is reference-ril

it should be easy to modify for many platforms.

Maxime Petazzoni

unread,
Dec 10, 2008, 1:45:17 PM12/10/08
to android-porting
Hi,

On Dec 9, 3:23 pm, "David Turner" <di...@android.com> wrote:

> there is alreadya reference ril library available in the open source tree
> that can be
> used to talk with some hardware. the name is reference-ril
>
> it should be easy to modify for many platforms.

Nice. What else is needed? How does Android accesses the SIM card for
example? Does that need a specific kernel driver?

Thanks,
- Maxime

David Turner

unread,
Dec 10, 2008, 3:11:37 PM12/10/08
to android...@googlegroups.com
the SIM Card is accessed through the AT command channel, i.e. through the RIL.
normally, there is no need for a specific kernel driver, or additionnal code.

Herb

unread,
Dec 23, 2008, 3:09:19 AM12/23/08
to android-porting
Hi John:

Do u mean modify /external/ppp/pppd/Android.mk to include
"LOCAL_CFLAGS += -fno-short-enums" ?
I have tried both 2 ways but the connection still didn't go through~
Do I missed anything?

Herb.
Reply all
Reply to author
Forward
0 new messages