|
本帖最后由 jiangdou 于 2015-1-4 20:14 编辑
调试说明:1, gps.c //open("/dev/ttyS_x",)失败,,参考init.sun7i.rc chmod /dev/ttyS_x 权限问题
2, 注意输出错误的log
3, 已经编译过的android ,请先make clean 再修改以下部分,后再编译android,
modify: for gps device
1,device/softwinner/common/hardware/libhardware/gps/Android.mk
LOCAL_PATH := $(call my-dir)
ifeq ($(BOARD_USES_GPS_TYPE),simulator)
# HAL module implemenation, not prelinked and stored in
# hw/<GPS_HARDWARE_MODULE_ID>.<ro.hardware>.so
include $(CLEAR_VARS)
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_CFLAGS += -DHAVE_GPS_HARDWARE //modify for gps!!!!!!!!!
LOCAL_SHARED_LIBRARIES := liblog libcutils libhardware libc libutils //modify gps !!!!!!!!!!
LOCAL_SRC_FILES := gps.c
LOCAL_MODULE := gps.exDroid
LOCAL_MODULE_TAGS := eng //modify
include $(BUILD_SHARED_LIBRARY)
endif
ifeq ($(BOARD_USES_GPS_TYPE),haiweixun)
include $(CLEAR_VARS)
LOCAL_MODULE := gps.exDroid.so
LOCAL_MODULE_TAGS := eng
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/hw/
LOCAL_SRC_FILES := /haiweixun/gps.exDroid.so
include $(BUILD_PREBUILT)
endif
2,device/softwinner/wing-common/BoardConfigCommon.mk
....(略)
#add for gps
BOARD_USES_GPS_TYPE := simulator //编译选择gps.c
....(略)
3,device/softwinner/wing-common/tablet_core_hardware.xml
<permissions>
<feature name="android.hardware.location" />
<feature name="android.hardware.location.network" />
<feature name="android.hardware.sensor.compass" />
<feature name="android.hardware.sensor.accelerometer" />
<feature name="android.hardware.bluetooth" />
<feature name="android.hardware.touchscreen" />
<feature name="android.hardware.touchscreen.multitouch" />
<feature name="android.hardware.touchscreen.multitouch.distinct" />
<feature name="android.hardware.microphone" />
<feature name="android.hardware.screen.portrait" />
<feature name="android.hardware.screen.landscape" />
<feature name="android.hardware.location.gps" /> //add modify for gps
<!-- devices with GPS must include android.hardware.location.gps.xml -->
<!-- devices with a rear-facing camera must include one of these as appropriate:
android.hardware.camera.xml or
android.hardware.camera.autofocus.xml or
android.hardware.camera.autofocus-flash.xml -->
<!-- devices with a front facing camera must include
android.hardware.camera.front.xml -->
<!-- devices with WiFi must also include android.hardware.wifi.xml -->
<!-- devices with an ambient light sensor must also include
android.hardware.sensor.light.xml -->
<!-- devices with a proximity sensor must also include
android.hardware.sensor.proximity.xml -->
<!-- devices with a barometer must also include
android.hardware.sensor.barometer.xml -->
<!-- devices with a gyroscope must also include
android.hardware.sensor.gyroscope.xml -->
<!-- GSM phones must also include android.hardware.telephony.gsm.xml -->
<!-- CDMA phones must also include android.hardware.telephony.cdma.xml -->
</permissions>
4,device/softwinner/sugar-standard/sugar_cubieboard.mk,,,,或者sugar_cubietruck.mk
PRODUCT_PACKAGES += \
TvdLauncher \
gps.exDroid //add for make gps .so
5,packages/apps/Settings/src/com/android/settings/LocationSettings.java
....(略)//禁止setting检测
//modify by jiangdou 20141218
//mGps.setChecked(gpsEnabled);
....(略)
6,packages/apps/Settings/res/xml/location_settings.xml
....(略)注释掉此处!!
<!-- modify by jiangdou for gps
<CheckBoxPreference
android:key="location_gps"
android:title="@string/location_gps"
android:summary="@string/location_street_level"
android:dependency="location_toggle"
android:persistent="false" />
-->
<com.android.settings.WrappingCheckBoxPreference
android:key="location_network"
android:title="@string/location_network_based"
android:summary="@string/location_neighborhood_level"
android:dependency="location_toggle"
android:persistent="false" />
....(略)
7,device/softwinner/sugar-cubieboard/init.sun7i.rc,,,,或者sugar-cubietruck
....(略)修改权限问题
chmod /dev/ttyS_x
....(略)
推荐 chmod 777 /dev/ttyS5
8,device/softwinner/common/hardware/libhardware/gps/gps.c
修改的源码参考附件!!!!
gps.c.tar.gz
(8.23 KB, 下载次数: 35)
9,gps测试APK
参考附件
gpstest.tar.gz
(913.59 KB, 下载次数: 43)
|
|