Android 4.22 GPS移植实战总结
2013-09-02 13:46
183 查看
7月刚学完嵌入式,找了一个月的工作,最后还是在老师的推荐下进了现在的公司,老板交代要移植gps,感觉“亚历山大”,话说这应该属于安卓底层,可是我们学的主要是嵌入式 linux c编程,底层只是讲了三天而已呀!
果不其然,GPS都搞了一个月了,虽然有了一些进展,但是距离目标还相差甚远。。。。
首先介绍下安卓下gps的调用层次结构吧,具体看了下面这张图我想就清楚多了
相关目录及文件
头文件 hardware/libhardware/include/hardware/gps.h
framework层 frameworks/base/services/java/com/android/server/location/GpsLocationProvider.java
JNI层 frameworks/base/services/jni/com_android_server_location_GpsLocationProvider.cpp
Z:\android4.2\hardware\libhardware\modules\gps
CONFIG_BT_RFCOMM=y
CONFIG_BT_RFCOMM_TTY=y
CONFIG_BT_BNEP=y
CONFIG_BT_BNEP_MC_FILTER=y
CONFIG_BT_BNEP_PROTO_FILTER=y
CONFIG_BT_HIDP=y
Wing-k70
Z:\android4.2\device\softwinner\wing-k70\BoardConfig.mk
Boardconfig.mk
#BOARD_HAVE_BLUETOOTH := true
#BOARD_HAVE_BLUETOOTH_BCM := true
固件位置 lichee/tools/pack/sun7i_android_wing-k70.img
Adb Logcat>c:\logcat.txt
提示:生成的gps.default.so最终会在out/target/product/generic/system/lib/hw目录下,如果该目录下同时还有gps.goldfish.so文件,必须先把gps.goldfish.so文件删除,然后再打包镜像文件。
果不其然,GPS都搞了一个月了,虽然有了一些进展,但是距离目标还相差甚远。。。。
首先介绍下安卓下gps的调用层次结构吧,具体看了下面这张图我想就清楚多了
相关目录及文件
头文件 hardware/libhardware/include/hardware/gps.h
framework层 frameworks/base/services/java/com/android/server/location/GpsLocationProvider.java
JNI层 frameworks/base/services/jni/com_android_server_location_GpsLocationProvider.cpp
HAL层 /android4.2/device/softwinner/common/hardware/libhardware/gps/gps.c.
static void
gps_state_init( GpsState* state, GpsCallbacks* callbacks )
{
state->init = 1;
state->control[0] = -1;
state->control[1] = -1;
state->fd = -1;
ALOGD("gps_state_init");
//state->fd = qemud_channel_open(QEMU_CHANNEL_NAME);
state->fd = open(GPS_Serial_Name, O_RDWR|O_NOCTTY|O_NDELAY );
if (state->fd < 0) {
D("no gps emulation detected");
return;
}
if ( isatty( state->fd ) ) {
struct termios ios;
tcgetattr( state->fd, &ios );
ios.c_lflag = 0; /* disable ECHO, ICANON, etc... */
ios.c_oflag &= (~ONLCR); /* Stop \n -> \r\n translation on output */
ios.c_iflag &= (~(ICRNL | INLCR)); /* Stop \r -> \n & \n -> \r translation on input */
ios.c_iflag |= (IGNCR | IXOFF); /* Ignore \r & XON/XOFF on input */
cfsetispeed(&ios, B9600);
cfsetospeed(&ios, B9600);
tcsetattr( state->fd, TCSANOW, &ios );
}
ALOGD("gps emulation will read from '%s' qemud channel", GPS_Serial_Name );
if ( socketpair( AF_LOCAL, SOCK_STREAM, 0, state->control ) < 0 ) {
ALOGE("could not create thread control socket pair: %s", strerror(errno));
goto Fail;
}
state->thread = callbacks->create_thread_cb( "gps_state_thread", gps_state_thread, state );
if ( !state->thread ) {
ALOGE("could not create gps thread: %s", strerror(errno));
goto Fail;
}
state->callbacks = *callbacks;
ALOGD("gps state initialized");
return;
Fail:
gps_state_done( state );
}
用的蓝牙管脚 PI20 PI21
串口对应关系 UART7 -》 ttyS1Z:\android4.2\hardware\libhardware\modules\gps
“注释蓝牙”
内核 Z:\lichee\linux-3.3\.Config
CONFIG_BT=yCONFIG_BT_RFCOMM=y
CONFIG_BT_RFCOMM_TTY=y
CONFIG_BT_BNEP=y
CONFIG_BT_BNEP_MC_FILTER=y
CONFIG_BT_BNEP_PROTO_FILTER=y
CONFIG_BT_HIDP=y
Wing-k70
Z:\android4.2\device\softwinner\wing-k70\BoardConfig.mk
Boardconfig.mk
#BOARD_HAVE_BLUETOOTH := true
#BOARD_HAVE_BLUETOOTH_BCM := true
Fex
Z:\lichee\tools\pack\chips\sun7i\configs\android\wing-k70\sys_config.fex固件位置 lichee/tools/pack/sun7i_android_wing-k70.img
Adb Logcat>c:\logcat.txt
提示:生成的gps.default.so最终会在out/target/product/generic/system/lib/hw目录下,如果该目录下同时还有gps.goldfish.so文件,必须先把gps.goldfish.so文件删除,然后再打包镜像文件。
相关文章推荐
- android 2.3 GPS 移植实战 一
- android 2.3 GPS 移植实战 二
- android 2.3 GPS 移植实战 一
- android 2.3 GPS 移植实战
- android 2.3 GPS 移植实战 二
- 安卓Android ROM定制、移植,安卓软件反编译、汉化实战教程第五篇:厨房的使用教程(G15实例)
- Android上Sensor移植的总结
- Android上Sensor移植的总结
- ReactNative For Android 项目实战总结
- android JAVA 层API GPS 研究总结
- 我的 Android 开发实战经验总结
- Realm实战总结---Android
- Android 开发实战经验总结
- 我的 Android 开发实战经验总结
- 高通MSM8255 GPS 调试分析&&Android系统之Broadcom GPS 移植
- 基于Android2.3的车载导航---andorid GPS HAL的移植与分析(by liukun321咕唧咕唧)
- Android实战经验之图像处理及特效处理的集锦(总结版)
- 北京Android各招聘公司面试实战总结2
- Android 实战开发总结(widget篇)