I.MX6 GPS Android HAL Framework 调试
一、参考文章:
android4. GPS定位问题
http://blog.****.net/bzw073/article/details/44341943
二、修改GPS配置文件:
. myzr@myzr:~/myandroid/device$ grep ttymxc2 * -R
......
fsl/imx6/etc/ueventd.freescale.rc:/dev/ttymxc2 system gps
fsl/sabresd_6dq/init.rc: symlink /dev/ttymxc2 /dev/gpsdevice
fsl/imx5x/ueventd.freescale.rc:/dev/ttymxc2 bluetooth bluetooth
fsl/imx53_smd/init.freescale.rc:#service hciattach /system/bin/logwrapper /system/bin/hciattach -n -s /dev/ttymxc2 ath3k flow sleep
fsl-proprietary/gps/Orion.ini:;ReceiverComPortName=/dev/ttymxc2
......
. cat fsl/imx6/etc/ueventd.freescale.rc
......
/dev/ttymxc1 system gps <----- zengjf modified
/dev/ttya0 system gps
/dev/ptya0 system gps
/dev/ttya1 system gps
/dev/ptya1 system gps
......
. cat fsl/sabresd_6dq/init.rc
......
# Set GPS serial and reset GPIO pin
setprop ro.kernel.android.gps /dev/ttymxc1 <----- zengjf modified
setprop persist.gps.oacmode @f
symlink /dev/ttymxc1 /dev/gpsdevice <----- zengjf modified
write /sys/class/gpio/export
write /sys/class/gpio/gpio60/direction "out"
write /sys/class/gpio/gpio60/value
......
. cat fsl-proprietary/gps/Orion.ini
......
; GPS Receiver COM Port Baud Rate for boot, , , , , or custom
ReceiverComPortBootSpeed= <----- zengjf modified
ReceiverComPortName=/dev/ttymxc1 <----- zengjf modified
......
三、修改Atheros GPS HAL代码:
. 代码位置:/home/myzr/myandroid/hardware/imx/libgps/athr_gps.c
. GPS调试,当然要打开调试功能了:
......
#define GPS_DEBUG
/* #undef GPS_DEBUG_TOKEN */ /* print out NMEA tokens */
#define GPS_DEBUG_TOKEN /* print out NMEA tokens */
......
. 修改tty 串口默认通信波特率:
int gps_opentty(GpsState *state)
{
......
// disable echo on serial lines
if ( isatty( state->fd ) ) {
struct termios ios;
tcgetattr( state->fd, &ios );
bzero(&ios, sizeof(ios));
//ios.c_cflag = B115200 | CS8 | CLOCAL | CREAD;
ios.c_cflag = B9600 | CS8 | CLOCAL | CREAD; <----- zengjf modified
ios.c_iflag = IGNPAR;
ios.c_oflag = ;
ios.c_lflag = ; /* disable ECHO, ICANON, etc... */
tcsetattr( state->fd, TCSANOW, &ios );
tcflush(state->fd,TCIOFLUSH);
}
......
}
四、修改GPS LocationManagerService代码:
. 代码位置:/home/myzr/myandroid/frameworks/base/services/java/com/android/server/LocationManagerService.java
. 具体原因请参考《参考文章》
@Override
public void reportLocation(Location location, boolean passive) {
checkCallerIsProvider();
// 2015-11-2 zengjf modify for GPS module
/*
if (!location.isComplete()) {
Log.w(TAG, "Dropping incomplete location: " + location);
return;
}
*/
......
}
五、打开开发板GPS编译:
. 代码位置:/home/myzr/myandroid/device/fsl/sabresd_6dq/BoardConfig.mk
. 参考代码如下,没有任何修改:
BOARD_HAVE_HARDWARE_GPS := true
USE_ATHR_GPS_HARDWARE := true
USE_QEMU_GPS_HARDWARE := false