How to porting a MediaTek GPS module?

464 views
Skip to first unread message

shm

unread,
Jan 12, 2012, 9:41:49 PM1/12/12
to android-porting
I am a real beginner with Android.
Would you tell me the steps to porting a GPS module?
I am using a MediaTek module, which is controlled by UART I/F and
several ports (such as power).

Thank you!

Chaitanya

unread,
Jan 15, 2012, 6:45:14 AM1/15/12
to android-porting
You should start by building a shared library implementing the
standard interface defined by Android for GPS. Since it's primary
interface is UART no further config required.
See this for details :- http://www.kandroid.org/online-pdk/guide/gps.html
Then under your product's makefile edit it to build the library.
Report the presence of GPS to android.
Edit the initialisation script to suit your needs.

Since you are using a MEDIATEK module, from my knowledge almost ALL
China Shanzai Phones running Android use this same module. So pick up
the binaries from them if you can.

shm

unread,
Jan 18, 2012, 12:34:38 AM1/18/12
to android-porting
Thank you, Chaitanya!

You comment gives me a bird-view of the whole work.
So, the most important thing is to implement the GPS I/F as defined in
gps.h.
Do you know where I can find some sample codes?
Actually, I found one provided by Qualcom, at hardware\qcom\gps in the
android source package.
But, I am not sure if it is useful in my case.

Best regard
----
shm



On 1月15日, 午後8:45, Chaitanya <chaitanya.nom...@gmail.com> wrote:
> You should start by building a shared library implementing the
> standard interface defined by Android for GPS. Since it's primary
> interface is UART no further config required.
> See this for details :-http://www.kandroid.org/online-pdk/guide/gps.html
> Then under your product's makefile edit it to build the library.
> Report the presence of GPS to android.
> Edit the initialisation script to suit your needs.
>
> Since you are using aMEDIATEKmodule, from my knowledge almost ALL
> China Shanzai Phones running Android use this same module. So pick up
> the binaries from them if you can.
>
> On Jan 13, 7:41 am, shm <shmhi...@gmail.com> wrote:
>
>
>
>
>
>
>
> > I am a real beginner with Android.
> > Would you tell me the steps to porting a GPS module?
> > I am using aMediaTekmodule, which is controlled by UART I/F and

Chaitanya

unread,
Jan 20, 2012, 3:55:38 AM1/20/12
to android-porting
Qualcomm has a lot of proprietary stuff. You may not want to start
with that.
For sample code you can simply refer the emulator stub :- qps_qemu.c.
You will need to tweek it a little for your module. But beware it will
be compiled into the libhardware_legacy.so. Modify the make file to
generate a seperate lib.
This is a real life application of it ,it extends the above stub :-
http://gitorious.org/android-on-freerunner/freerunner_platform_hardware_hw/blobs/master/gps/gps_freerunner.c
You will want to start with that.
Then edit the BoardConfig.mk file to mention the file you are building

Chih-Wei Huang

unread,
Jan 22, 2012, 1:38:35 PM1/22/12
to android...@googlegroups.com
GPS hal for UART:

http://git.android-x86.org/?p=platform/hardware/gps.git;a=summary

shm於 2012年1月18日星期三UTC+8下午1時34分38秒寫道:

shm

unread,
Jan 24, 2012, 3:54:59 AM1/24/12
to android-porting
Thank you, Chaitanya and Huang,
You gave me the great advice!

shm

unread,
Feb 21, 2012, 3:04:19 AM2/21/12
to android-porting
Hello,

I found these functions (defined in the freerunner sample code) are
not called from anywhere, neither inside the file itself nor from
anywhere in the android project.
static void gps_dev_init(int fd);
static void gps_dev_deinit(int fd);
static void gps_dev_start(int fd);
static void gps_dev_stop(int fd);

Are they really necessarily?

Best regards,
--------
shm

Ivan Savygin

unread,
Feb 23, 2012, 2:12:43 AM2/23/12
to shmh...@gmail.com, android-porting

This functions are used in gps_state_thread function and used to send necessary commands in accordance with commands from gps location service.


Ivan Savygin

unread,
Feb 23, 2012, 2:15:38 AM2/23/12
to shmh...@gmail.com, android-porting
Used to send necessary commands to device through serial port

Chaitanya

unread,
Feb 23, 2012, 6:03:42 AM2/23/12
to android-porting
Yes you will need them. They power up and initialization the device.
They do get called. Check line 995 and 1036.

shm

unread,
Feb 23, 2012, 9:33:15 AM2/23/12
to android-porting
Thank you for the comments.
But, I really cannot find any reference to these functions.

Am I referencing a wrong sample code?
http://git.android-x86.org/?p=platform/hardware/gps.git;a=summary

Sorry, another link (as below) provided by Chaitanya seems broken.
http://gitorious.org/android-on-freerunner/freerunner_platform_hardware_hw/blobs/master/gps/gps_freerunner.c
Though I have been able to access it.

Have a nice day,
shm

Chaitanya

unread,
Feb 24, 2012, 6:49:22 AM2/24/12
to android-porting
The x86 version doesNOT use them. The free runner does. Your module
may or may not need them. but it's better to have them.

On Feb 23, 7:33 pm, shm <shmhi...@gmail.com> wrote:
> Thank you for the comments.
> But, I really cannot find any reference to these functions.
>
> Am I referencing a wrong sample code?http://git.android-x86.org/?p=platform/hardware/gps.git;a=summary
>
> Sorry, another link (as below) provided by Chaitanya seems broken.http://gitorious.org/android-on-freerunner/freerunner_platform_hardwa...
Reply all
Reply to author
Forward
0 new messages