I.MX6 GPS Android HAL Framework 调试 一、参考文章: android4.3 GPS定位问题 http://blog.csdn.net/bzw073/article/details/44341943 二、修改GPS配置文件: 1. myzr@myzr:~/myandroid/device$ grep ttymxc2 * -R ...... fsl/imx6/etc/ueventd.freescale.rc:/dev/ttymxc2 0660 system gps fsl/sabresd_6dq/init.rc: symlink /dev/ttymxc2 /dev/gpsdevice fsl/imx5x/ueventd.freescale.rc:/dev/ttymxc2 0600 bluetooth bluetooth fsl/imx53_smd/init.freescale.rc:#service hciattach /system/bin/logwrapper /system/bin/hciattach -n -s 115200 /dev/ttymxc2 ath3k 3000000 flow sleep fsl-proprietary/gps/Orion.ini:;ReceiverComPortName=/dev/ttymxc2 ...... 2. cat fsl/imx6/etc/ueventd.freescale.rc ...... /dev/ttymxc1 0660 system gps <----- zengjf modified /dev/ttya0 0660 system gps /dev/ptya0 0660 system gps /dev/ttya1 0660 system gps /dev/ptya1 0660 system gps ...... 3. 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 60 write /sys/class/gpio/gpio60/direction "out" write /sys/class/gpio/gpio60/value 1 ...... 4. cat fsl-proprietary/gps/Orion.ini ...... ; GPS Receiver COM Port Baud Rate for boot, 115200, 230400, 460800, 921600, or custom ReceiverComPortBootSpeed=9600 <----- zengjf modified ReceiverComPortName=/dev/ttymxc1 <----- zengjf modified ...... 三、修改Atheros GPS HAL代码: 1. 代码位置:/home/myzr/myandroid/hardware/imx/libgps/athr_gps.c 2. GPS调试,当然要打开调试功能了: ...... #define GPS_DEBUG /* #undef GPS_DEBUG_TOKEN */ /* print out NMEA tokens */ #define GPS_DEBUG_TOKEN /* print out NMEA tokens */ ...... 3. 修改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 = 0; ios.c_lflag = 0; /* disable ECHO, ICANON, etc... */ tcsetattr( state->fd, TCSANOW, &ios ); tcflush(state->fd,TCIOFLUSH); } ...... } 四、修改GPS LocationManagerService代码: 1. 代码位置:/home/myzr/myandroid/frameworks/base/services/java/com/android/server/LocationManagerService.java 2. 具体原因请参考《参考文章》 @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编译: 1. 代码位置:/home/myzr/myandroid/device/fsl/sabresd_6dq/BoardConfig.mk 2. 参考代码如下,没有任何修改: BOARD_HAVE_HARDWARE_GPS := true USE_ATHR_GPS_HARDWARE := true USE_QEMU_GPS_HARDWARE := false
时间: 2024-10-23 01:25:02