18 January 2015

(Android) gps.confの書き換えで効果があるのか…

AndroidのGPS受信感度をgps.confを書き換えることで向上させられるのか、試してみた

検証環境

・SONY Xperia M , C1904
・Android 4.1.2
・ルート化済み

gps.confの書き換え方法

/systemディレクトリを読み書き可で再マウントするため、『(Android) mount -o rwmount,rw /system で強制再起動を防ぐ』の記事に書いたように、/sbin/ricデーモンを一時的に無効化する。

その後、/systemを読み書き可で再マウントし、gps.confを編集

# mount -o remount,rw /system
# vi /system/etc/gps.conf

gps.conf書き換えポイント

赤字の部分を変更・追加、青字の部分をコメントアウトしている

変更ポイントは、NTPを日本国内のものに、AGPSデータ受信サーバをGoogleのものに、GPS電波受信が出来ない屋内などでWifiや3G基地局のデータで補完するモードを有効にしている。また、ログレベルをdebugからinfoに変更している。

/system/etc/gps.conf
#Test
#NTP_SERVER=time.gpsonextra.net
#Asia
#NTP_SERVER=asia.pool.ntp.org
#Europe
# NTP_SERVER=europe.pool.ntp.org
#North America
# NTP_SERVER=north-america.pool.ntp.org
 
#Japan
NTP_SERVER=ntp.nict.jp
NTP_SERVER=jp.pool.ntp.org
NTP_SERVER=europe.pool.ntp.org
 
XTRA_SERVER_1=http://xtra1.gpsonextra.net/xtra.bin
XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra.bin
XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra.bin
 
# DEBUG LEVELS: 0 - none, 1 - Error, 2 - Warning, 3 - Info
#               4 - Debug, 5 - Verbose
DEBUG_LEVEL = 3
 
# Intermediate position report, 1=enable, 0=disable
INTERMEDIATE_POS=0
 
# supl version 1.0
SUPL_VER=0x10000
 
# Error Estimate
# _SET = 1
# _CLEAR = 0
ERR_ESTIMATE=0
 
# GPS Capabilities bit mask
# SCHEDULING = 1
# MSB = 2
# MSA = 4
# ULP = 0x20
# default = MSA | MSB | SCHEDULING | ULP
CAPABILITIES=0x7
 
# Accuracy threshold for intermediate positions
# less accurate positions are ignored, 0 for passing all positions
# ACCURACY_THRES=5000
 
################################
##### AGPS server settings #####
################################
 
# FOR SUPL SUPPORT, set the following
SUPL_HOST=supl.google.com
SUPL_PORT=7276
#SUPL_HOST=supl.sonyericsson.com
#SUPL_PORT=7275
 
# FOR C2K PDE SUPPORT, set the following
# C2K_HOST=c2k.pde.com or IP
# C2K_PORT=1234
 
################################
# Sensor Settings
################################
 
# Needs to be set explicitly based on sensor
# There is no default value.
#GYRO_BIAS_RANDOM_WALK=
 
# Sensor Sampling Rate Parameters for Low-Data Rate Filter (should be greater than 0)
SENSOR_ACCEL_BATCHES_PER_SEC=2
SENSOR_ACCEL_SAMPLES_PER_BATCH=5
SENSOR_GYRO_BATCHES_PER_SEC=2
SENSOR_GYRO_SAMPLES_PER_BATCH=5
# Sensor Sampling Rate Parameters for High-Data Rate Filter (should be greater than 0)
SENSOR_ACCEL_BATCHES_PER_SEC_HIGH=4
SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH=25
SENSOR_GYRO_BATCHES_PER_SEC_HIGH=4
SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH=25
 
# Sensor Control Mode (0=AUTO, 1=FORCE_ON)
SENSOR_CONTROL_MODE=0
 
# Enable or Disable Sensors for GPS use (0=Enable, 1=Disable)
SENSOR_USAGE=0
 
# Choose GSIFF sensor provider (1=DSPS, 2=Android NDK)
SENSOR_PROVIDER=1
 
################################
# Indoor Positioning Settings
################################
# 0: QUIPC disabled, 1: QUIPC enabled, 2: forced QUIPC only
QUIPC_ENABLED = 1
 
################################
# EXTRA SETTINGS
################################
# Enable or Disable Wiper (1=Enable, 0=Disable)
ENABLE_WIPER=1
 
####################################
#  LTE Positioning Profile Settings
####################################
# 0: Enable RRLP on LTE(Default) 1: Enable LPP_User_Plane on LTE
LPP_PROFILE = 0
 
###Customer's Requirement Start###
#LC_DEBUG_NOTIFICATIONS=true
#LC_DEBUG_USE_TEST_HOST=true
#LC_DEBUG_LOG_ENABLE=true
###Customer's Requiremnet End#####

結果

私の環境では、ほとんど効果は認められない。

ENABLE_WIPER=1ENABLE_WIPER=1 は、Android上のアプリケーションには影響を与えず、設定画面の『Google位置情報サービス』のON/OFFでのみ影響を受けた。

20150118-locationman.jpg

gps.confのデフォルト値は?

AndroidのGitリポジトリにソースコードによれば

gps.conf
#Uncommenting these urls would only enable
#the power up auto injection and force injection(test case).
#XTRA_SERVER_1=http://xtra1.gpsonextra.net/xtra.bin
#XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra.bin
#XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra.bin
 
# Error Estimate
# _SET = 1
# _CLEAR = 0
ERR_ESTIMATE=0
 
#Test
NTP_SERVER=time.gpsonextra.net
#Asia
# NTP_SERVER=asia.pool.ntp.org
#Europe
# NTP_SERVER=europe.pool.ntp.org
#North America
# NTP_SERVER=north-america.pool.ntp.org
 
# DEBUG LEVELS: 0 - none, 1 - Error, 2 - Warning, 3 - Info
# 4 - Debug, 5 - Verbose
# If DEBUG_LEVEL is commented, Android's logging levels will be used
DEBUG_LEVEL = 3
 
# Intermediate position report, 1=enable, 0=disable
INTERMEDIATE_POS=0
 
# Below bit mask configures how GPS functionalities
# should be locked when user turns off GPS on Settings
# Set bit 0x1 if MO GPS functionalities are to be locked
# Set bit 0x2 if NI GPS functionalities are to be locked
# default - non is locked for backward compatibility
#GPS_LOCK = 0
 
# supl version 1.0
SUPL_VER=0x10000
 
# Emergency SUPL, 1=enable, 0=disable
SUPL_ES=1
 
# GPS Capabilities bit mask
# SCHEDULING = 0x01
# MSB = 0x02
# MSA = 0x04
# ON_DEMAND_TIME = 0x10
# GEOFENCE = 0x20
# default = ON_DEMAND_TIME | MSA | MSB | SCHEDULING | GEOFENCE
CAPABILITIES=0x37
 
# Accuracy threshold for intermediate positions
# less accurate positions are ignored, 0 for passing all positions
# ACCURACY_THRES=5000
 
################################
##### AGPS server settings #####
################################
# FOR SUPL SUPPORT, set the following
# SUPL_HOST=supl.host.com or IP
# SUPL_PORT=1234
SUPL_HOST=supl.google.com
SUPL_PORT=7276
 
# FOR C2K PDE SUPPORT, set the following
# C2K_HOST=c2k.pde.com or IP
# C2K_PORT=1234
 
# Bitmask of slots that are available
# for write/install to, where 1s indicate writable,
# and the default value is 0 where no slots
# are writable. For example, AGPS_CERT_WRITABLE_MASK
# of b1000001010 makes 3 slots available
# for installation (slots 2, 4, and 10)
# and the remaining 7 slots unwritable.
#AGPS_CERT_WRITABLE_MASK=0
 
####################################
# LTE Positioning Profile Settings
####################################
# 0: Enable RRLP on LTE(Default)
# 1: Enable LPP_User_Plane on LTE
# 2: Enable LPP_Control_Plane
# 3: Enable both LPP_User_Plane and LPP_Control_Plane
LPP_PROFILE = 0
 
################################
# EXTRA SETTINGS
################################
# NMEA provider (1=Modem Processor, 0=Application Processor)
NMEA_PROVIDER=0
 
# Mark if it is a SGLTE target (1=SGLTE, 0=nonSGLTE)
SGLTE_TARGET=0
 
##################################################
# Select Positioning Protocol on A-GLONASS system
##################################################
# 0x1: RRC CPlane
# 0x2: RRLP UPlane
# 0x4: LLP Uplane
A_GLONASS_POS_PROTOCOL_SELECT = 0

また、ここに書かれた以外の変数の初期値などはこちらに書かれていたり…

loc_eng.cpp
static void loc_default_parameters(void)
{
    /* defaults */
    gps_conf.INTERMEDIATE_POS = 0;
    gps_conf.ACCURACY_THRES = 0;
    gps_conf.NMEA_PROVIDER = 0;
    gps_conf.SUPL_VER = 0x10000;
    gps_conf.CAPABILITIES = 0x7;
    
    sap_conf.GYRO_BIAS_RANDOM_WALK = 0;
    sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC = 2;
    sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH = 5;
    sap_conf.SENSOR_GYRO_BATCHES_PER_SEC = 2;
    sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH = 5;
    sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH = 4;
    sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH = 25;
    sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH = 4;
    sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH = 25;
    sap_conf.SENSOR_CONTROL_MODE = 0; /* AUTO */
    sap_conf.SENSOR_USAGE = 0; /* Enabled */
    sap_conf.SENSOR_ALGORITHM_CONFIG_MASK = 0; /* INS Disabled = FALSE*/
    
    /* Values MUST be set by OEMs in configuration for sensor-assisted
    navigation to work. There are NO default values */
    sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY = 0;
    sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY = 0;
    sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY = 0;
    sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY = 0;
    
    sap_conf.GYRO_BIAS_RANDOM_WALK_VALID = 0;
    sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
    sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
    sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
    sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
    
    /* LTE Positioning Profile configuration is disable by default*/
    gps_conf.LPP_PROFILE = 0;
    
    /*By default no positioning protocol is selected on A-GLONASS system*/
    gps_conf.A_GLONASS_POS_PROTOCOL_SELECT = 0;
    
    /* default provider is SSC */
    sap_conf.SENSOR_PROVIDER = 1;
    
    /* None of the 10 slots for agps certificates are writable by default */
    gps_conf.AGPS_CERT_WRITABLE_MASK = 0;
}