summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--BoardConfig.mk10
-rw-r--r--audio-ril-interface/Android.mk35
-rw-r--r--audio-ril-interface/audio-ril-interface.c231
-rwxr-xr-xaudio/ril_interface.h2
-rw-r--r--i9300.mk29
-rw-r--r--include/telephony/ril.h5394
-rw-r--r--libsamsung_symbols/samsung_ril.cpp21
-rw-r--r--libsensors/AccelSensor.cpp168
-rw-r--r--libsensors/AccelSensor.h72
-rw-r--r--libsensors/AkmSensor.cpp281
-rw-r--r--libsensors/AkmSensor.h63
-rw-r--r--libsensors/Android.mk69
-rw-r--r--libsensors/GyroSensor.cpp181
-rw-r--r--libsensors/GyroSensor.h55
-rw-r--r--libsensors/InputEventReader.cpp89
-rw-r--r--libsensors/InputEventReader.h47
-rw-r--r--libsensors/LightSensor.cpp152
-rw-r--r--libsensors/LightSensor.h55
-rw-r--r--libsensors/MODULE_LICENSE_APACHE20
-rw-r--r--libsensors/PressureSensor.cpp155
-rw-r--r--libsensors/PressureSensor.h54
-rw-r--r--libsensors/ProximitySensor.cpp154
-rw-r--r--libsensors/ProximitySensor.h55
-rw-r--r--libsensors/SensorBase.cpp141
-rw-r--r--libsensors/SensorBase.h70
-rw-r--r--libsensors/ak8973b.h51
-rw-r--r--libsensors/ak8975-reg.h48
-rw-r--r--libsensors/ak8975.h73
-rw-r--r--libsensors/akm8975.c612
-rw-r--r--libsensors/akmdfs/AK8975Driver.c318
-rw-r--r--libsensors/akmdfs/AK8975Driver.h102
-rw-r--r--libsensors/akmdfs/AKFS_APIs.c389
-rw-r--r--libsensors/akmdfs/AKFS_APIs.h69
-rw-r--r--libsensors/akmdfs/AKFS_APIs_8975/AKFS_AK8975.c44
-rw-r--r--libsensors/akmdfs/AKFS_APIs_8975/AKFS_AK8975.h50
-rw-r--r--libsensors/akmdfs/AKFS_APIs_8975/AKFS_AOC.c333
-rw-r--r--libsensors/akmdfs/AKFS_APIs_8975/AKFS_AOC.h53
-rw-r--r--libsensors/akmdfs/AKFS_APIs_8975/AKFS_Configure.h37
-rw-r--r--libsensors/akmdfs/AKFS_APIs_8975/AKFS_Device.c110
-rw-r--r--libsensors/akmdfs/AKFS_APIs_8975/AKFS_Device.h107
-rw-r--r--libsensors/akmdfs/AKFS_APIs_8975/AKFS_Direction.c133
-rw-r--r--libsensors/akmdfs/AKFS_APIs_8975/AKFS_Direction.h39
-rw-r--r--libsensors/akmdfs/AKFS_APIs_8975/AKFS_Math.h47
-rw-r--r--libsensors/akmdfs/AKFS_APIs_8975/AKFS_VNorm.c107
-rw-r--r--libsensors/akmdfs/AKFS_APIs_8975/AKFS_VNorm.h46
-rw-r--r--libsensors/akmdfs/AKFS_CSpec.h38
-rw-r--r--libsensors/akmdfs/AKFS_Common.h141
-rw-r--r--libsensors/akmdfs/AKFS_Compass.h84
-rw-r--r--libsensors/akmdfs/AKFS_Disp.c89
-rw-r--r--libsensors/akmdfs/AKFS_Disp.h52
-rw-r--r--libsensors/akmdfs/AKFS_FileIO.c130
-rw-r--r--libsensors/akmdfs/AKFS_FileIO.h39
-rw-r--r--libsensors/akmdfs/AKFS_Measure.c410
-rw-r--r--libsensors/akmdfs/AKFS_Measure.h70
-rw-r--r--libsensors/akmdfs/NOTICE202
-rw-r--r--libsensors/akmdfs/Version.txt31
-rw-r--r--libsensors/akmdfs/main.c293
-rw-r--r--libsensors/cm36651_light.c264
-rw-r--r--libsensors/cm36651_proximity.c213
-rw-r--r--libsensors/input.c336
-rw-r--r--libsensors/lps331ap.c244
-rw-r--r--libsensors/lsm330dlc_accel.h185
-rw-r--r--libsensors/lsm330dlc_acceleration.c390
-rw-r--r--libsensors/lsm330dlc_gyroscope.c256
-rw-r--r--libsensors/sensors.cpp395
-rw-r--r--libsensors/sensors.h112
-rw-r--r--libsensors/smdk4x12_sensors.c295
-rw-r--r--libsensors/smdk4x12_sensors.h102
-rw-r--r--lineage.mk7
-rw-r--r--mkbootimg.mk29
-rw-r--r--res/charger/LICENSE2
-rw-r--r--res/charger/battery_0.pngbin0 -> 6746 bytes
-rw-r--r--res/charger/battery_1.pngbin0 -> 6731 bytes
-rw-r--r--res/charger/battery_2.pngbin0 -> 6733 bytes
-rw-r--r--res/charger/battery_3.pngbin0 -> 6731 bytes
-rw-r--r--res/charger/battery_4.pngbin0 -> 6729 bytes
-rw-r--r--res/charger/battery_5.pngbin0 -> 6663 bytes
-rw-r--r--res/charger/battery_charge.pngbin0 -> 9146 bytes
-rw-r--r--res/charger/battery_fail.pngbin0 -> 9297 bytes
-rw-r--r--res/charger/charger.svg2418
-rw-r--r--ril-wrapper/Android.mk9
-rw-r--r--ril-wrapper/ril-wrapper.c99
-rw-r--r--ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java530
-rw-r--r--rootdir/init.target.rc24
-rw-r--r--selinux/cpboot-daemon.te25
-rw-r--r--selinux/file.te1
-rw-r--r--selinux/file_contexts1
-rw-r--r--selinux/init.te1
-rw-r--r--selinux/rild.te2
-rw-r--r--selinux/system_server.te4
-rw-r--r--system.prop2
-rw-r--r--usr/idc/melfas_ts.idc (renamed from libsamsung_symbols/Android.mk)24
-rw-r--r--usr/idc/sec_touchscreen.idc26
-rw-r--r--usr/keylayout/gpio-keys.kl4
-rw-r--r--usr/keylayout/sec_touchkey.kl2
-rw-r--r--usr/keylayout/sii9234_rcp.kl28
97 files changed, 9445 insertions, 8516 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b25c15b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*~
diff --git a/BoardConfig.mk b/BoardConfig.mk
index 6673884..51b4725 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -23,13 +23,13 @@
MALLOC_IMPL := dlmalloc
# RIL
-BOARD_PROVIDES_LIBRIL := true
BOARD_MODEM_TYPE := xmm6262
+
TARGET_SPECIFIC_HEADER_PATH := device/samsung/i9300/include
COMMON_GLOBAL_CFLAGS += -DDISABLE_ASHMEM_TRACKING
-# Graphics
-TARGET_REQUIRES_SYNCHRONOUS_SETSURFACE := true
+# enable llvmpipe
+BOARD_GPU_DRIVERS := swrast
# Bluetooth
BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/samsung/i9300/bluetooth
@@ -37,7 +37,6 @@ BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/samsung/i9300/bluetooth
# Kernel
TARGET_KERNEL_SOURCE := kernel/samsung/smdk4412
TARGET_KERNEL_CONFIG := lineageos_i9300_defconfig
-BOARD_RIL_CLASS := ../../../device/samsung/i9300/ril
# Recovery
TARGET_RECOVERY_FSTAB := device/samsung/i9300/rootdir/fstab.smdk4x12
@@ -51,6 +50,9 @@ TARGET_POWERHAL_VARIANT := pegasusq
BOARD_SEPOLICY_DIRS += \
device/samsung/i9300/selinux
+# Charging mode
+BOARD_CHARGER_RES := device/samsung/i9300/res/charger
+
# assert
TARGET_OTA_ASSERT_DEVICE := m0,i9300,GT-I9300
diff --git a/audio-ril-interface/Android.mk b/audio-ril-interface/Android.mk
new file mode 100644
index 0000000..28d366e
--- /dev/null
+++ b/audio-ril-interface/Android.mk
@@ -0,0 +1,35 @@
+#
+# Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := audio-ril-interface.c
+
+LOCAL_C_INCLUDES := \
+ hardware/ril/samsung-ril/include \
+ hardware/ril/samsung-ril/srs-client/include \
+ device/samsung/i9300/audio/
+
+LOCAL_SHARED_LIBRARIES := liblog libcutils libsrs-client
+LOCAL_PRELINK_MODULE := false
+
+LOCAL_MODULE := libaudio-ril-interface
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/audio-ril-interface/audio-ril-interface.c b/audio-ril-interface/audio-ril-interface.c
new file mode 100644
index 0000000..2c0f781
--- /dev/null
+++ b/audio-ril-interface/audio-ril-interface.c
@@ -0,0 +1,231 @@
+/*
+ * Copyright (C) 2013-2014 Paul Kocialkowski <contact@paulk.fr>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdlib.h>
+
+#define LOG_TAG "Audio-RIL-Interface"
+#include <cutils/log.h>
+
+#include <ril_interface.h>
+
+#include <samsung-ril-socket.h>
+#include <srs-client.h>
+
+void *OpenClient_RILD(void)
+{
+ struct srs_client *client = NULL;
+
+ ALOGD("%s()", __func__);
+
+ client = srs_client_create();
+ if (client == NULL) {
+ ALOGE("%s: Failed to create SRS client", __func__);
+ return NULL;
+ }
+
+ return (void *) client;
+}
+
+int Connect_RILD(void *data)
+{
+ struct srs_client *client;
+ int rc;
+
+ ALOGD("%s(%p)", __func__, data);
+
+ if (data == NULL)
+ return RIL_CLIENT_ERR_INVAL;
+
+ client = (struct srs_client *) data;
+
+ rc = srs_client_open(client);
+ if (rc < 0) {
+ ALOGE("%s: Failed to open SRS client", __func__);
+ return RIL_CLIENT_ERR_CONNECT;
+ }
+
+ rc = srs_ping(client);
+ if (rc < 0)
+ ALOGE("%s: Failed to ping SRS", __func__);
+
+ return RIL_CLIENT_ERR_SUCCESS;
+}
+
+int Disconnect_RILD(void *data)
+{
+ struct srs_client *client;
+ int rc;
+
+ ALOGD("%s(%p)", __func__, data);
+
+ if (data == NULL)
+ return RIL_CLIENT_ERR_INVAL;
+
+ client = (struct srs_client *) data;
+
+ rc = srs_client_close(client);
+ if (rc < 0) {
+ ALOGE("%s: Failed to close SRS client", __func__);
+ return RIL_CLIENT_ERR_INVAL;
+ }
+
+ return RIL_CLIENT_ERR_SUCCESS;
+}
+
+int CloseClient_RILD(void *data)
+{
+ struct srs_client *client;
+ int rc;
+
+ ALOGD("%s(%p)", __func__, data);
+
+ if (data == NULL)
+ return RIL_CLIENT_ERR_INVAL;
+
+ client = (struct srs_client *) data;
+
+ rc = srs_client_destroy(client);
+ if (rc < 0)
+ ALOGE("%s: Failed to destroy SRS client", __func__);
+
+ return RIL_CLIENT_ERR_SUCCESS;
+}
+
+int isConnected_RILD(void *data)
+{
+ struct srs_client *client;
+ int rc;
+
+ ALOGD("%s(%p)", __func__, data);
+
+ if (data == NULL)
+ return RIL_CLIENT_ERR_INVAL;
+
+ client = (struct srs_client *) data;
+
+ rc = srs_ping(client);
+ if (rc < 0) {
+ ALOGE("%s: Failed to ping SRS", __func__);
+ return 0;
+ }
+
+ return 1;
+}
+
+int SetCallVolume(void *data, enum ril_sound_type type, int level)
+{
+ struct srs_client *client;
+ struct srs_snd_call_volume_data call_volume;
+ int rc;
+
+ ALOGD("%s(%p, %d, %d)", __func__, data, type, level);
+
+ if (data == NULL)
+ return RIL_CLIENT_ERR_INVAL;
+
+ client = (struct srs_client *) data;
+
+ call_volume.type = (enum srs_snd_type) type;
+ call_volume.volume = level;
+
+ rc = srs_client_send(client, SRS_SND_SET_CALL_VOLUME, &call_volume, sizeof(call_volume));
+ if (rc < 0)
+ return RIL_CLIENT_ERR_UNKNOWN;
+
+ return RIL_CLIENT_ERR_SUCCESS;
+}
+
+
+int SetCallAudioPath(void *data, enum ril_audio_path path)
+{
+ struct srs_client *client;
+ struct srs_snd_call_audio_path_data call_audio_path;
+ int rc;
+
+ ALOGD("%s(%p, %d)", __func__, data, path);
+
+ if (data == NULL)
+ return RIL_CLIENT_ERR_INVAL;
+
+ client = (struct srs_client *) data;
+
+ call_audio_path.path = path;
+
+ rc = srs_client_send(client, SRS_SND_SET_CALL_AUDIO_PATH, &call_audio_path, sizeof(call_audio_path));
+ if (rc < 0)
+ return RIL_CLIENT_ERR_UNKNOWN;
+
+ return RIL_CLIENT_ERR_SUCCESS;
+}
+
+int SetMute(void *data, enum ril_mic_mute mute)
+{
+ struct srs_client *client;
+ struct srs_snd_mic_mute_data mic_mute_state;
+ int rc;
+
+ ALOGD("%s(%p, %d)", __func__, data, mute);
+
+ if (data == NULL)
+ return RIL_CLIENT_ERR_INVAL;
+
+ client = (struct srs_client *) data;
+
+ mic_mute_state.mute = mute;
+
+ rc = srs_client_send(client, SRS_SND_SET_MIC_MUTE, &mic_mute_state, sizeof(mic_mute_state));
+ if (rc < 0)
+ return RIL_CLIENT_ERR_UNKNOWN;
+
+ return RIL_CLIENT_ERR_SUCCESS;
+}
+
+int SetCallClockSync(void *data, enum ril_clock_state condition)
+{
+ struct srs_client *client;
+ struct srs_snd_call_clock_sync_data call_clock_sync;
+ int rc;
+
+ ALOGD("%s(%p, %d)", __func__, data, condition);
+
+ if (data == NULL)
+ return RIL_CLIENT_ERR_INVAL;
+
+ client = (struct srs_client *) data;
+
+ call_clock_sync.sync = condition;
+
+ rc = srs_client_send(client, SRS_SND_SET_CALL_CLOCK_SYNC, &call_clock_sync, sizeof(call_clock_sync));
+ if (rc < 0)
+ return RIL_CLIENT_ERR_UNKNOWN;
+
+ return RIL_CLIENT_ERR_SUCCESS;
+}
+
+int SetTwoMicControl(void *data, enum ril_two_mic_device device, enum ril_two_mic_state state)
+{
+ ALOGD("%s(%p, %d, %d)", __func__, data, device, state);
+
+ return RIL_CLIENT_ERR_SUCCESS;
+}
+
+int RegisterUnsolicitedHandler(void *data, int command, void *callback)
+{
+ ALOGD("%s(%p, %d, %p)", __func__, data, command, callback);
+
+ return RIL_CLIENT_ERR_SUCCESS;
+}
diff --git a/audio/ril_interface.h b/audio/ril_interface.h
index 7d4b87e..a5bf480 100755
--- a/audio/ril_interface.h
+++ b/audio/ril_interface.h
@@ -17,7 +17,7 @@
#ifndef RIL_INTERFACE_H
#define RIL_INTERFACE_H
-#define RIL_CLIENT_LIBPATH "libsecril-client.so"
+#define RIL_CLIENT_LIBPATH "libaudio-ril-interface.so"
#define RIL_CLIENT_ERR_SUCCESS 0
#define RIL_CLIENT_ERR_AGAIN 1
diff --git a/i9300.mk b/i9300.mk
index a0303d8..0fe4a51 100644
--- a/i9300.mk
+++ b/i9300.mk
@@ -31,7 +31,21 @@ PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/rootdir/fstab.smdk4x12:root/fstab.smdk4x12 \
$(LOCAL_PATH)/rootdir/init.target.rc:root/init.target.rc
+# Keylayout
+PRODUCT_COPY_FILES += \
+ $(LOCAL_PATH)/usr/keylayout/gpio-keys.kl:system/usr/keylayout/gpio-keys.kl \
+ $(LOCAL_PATH)/usr/keylayout/sec_touchkey.kl:system/usr/keylayout/sec_touchkey.kl \
+ $(LOCAL_PATH)/usr/keylayout/sii9234_rcp.kl:system/usr/keylayout/sii9234_rcp.kl
+
+# Idc
+PRODUCT_COPY_FILES += \
+ $(LOCAL_PATH)/usr/idc/melfas_ts.idc:system/usr/idc/melfas_ts.idc \
+ $(LOCAL_PATH)/usr/idc/sec_touchscreen.idc:system/usr/idc/sec_touchscreen.idc
+
# Audio
+PRODUCT_PACKAGES += \
+ libaudio-ril-interface
+
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/tiny_hw.xml:system/etc/sound/m0
@@ -50,19 +64,12 @@ PRODUCT_COPY_FILES += \
# Product specific Packages
PRODUCT_PACKAGES += \
- libsecril-client \
- libsecril-client-sap \
SamsungServiceMode \
tinyplay
-# RIL
-PRODUCT_PACKAGES += \
- libsamsung_symbols \
- ril-wrapper
-
# NFC
PRODUCT_PACKAGES += \
- nfc.exynos4 \
+ nfc.exynos4 \
libnfc \
libnfc_jni \
Nfc \
@@ -97,14 +104,16 @@ PRODUCT_PACKAGES += \
com.android.nfc_extras
# RIL
+PRODUCT_PACKAGES += \
+ libsamsung-ril
+
PRODUCT_PROPERTY_OVERRIDES += \
- ro.telephony.ril_class=SamsungExynos4RIL \
ro.telephony.call_ring.multiple=false \
ro.telephony.call_ring.delay=3000
# These are the hardware-specific features
PRODUCT_COPY_FILES += \
- frameworks/native/data/etc/handheld_core_hardware.xml:system/etc/permissions/handheld_core_hardware.xml \
+ frameworks/native/data/etc/handheld_core_hardware.xml:system/etc/permissions/handheld_core_hardware.xml \
frameworks/native/data/etc/android.hardware.telephony.gsm.xml:system/etc/permissions/android.hardware.telephony.gsm.xml
$(call inherit-product-if-exists, vendor/samsung/i9300/i9300-vendor.mk)
diff --git a/include/telephony/ril.h b/include/telephony/ril.h
deleted file mode 100644
index e13ad9f..0000000
--- a/include/telephony/ril.h
+++ /dev/null
@@ -1,5394 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_RIL_H
-#define ANDROID_RIL_H 1
-
-#include <stdlib.h>
-#include <stdint.h>
-#include <telephony/ril_cdma_sms.h>
-#include <telephony/ril_nv_items.h>
-#include <telephony/ril_msim.h>
-
-#ifndef FEATURE_UNIT_TEST
-#include <sys/time.h>
-#endif /* !FEATURE_UNIT_TEST */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#if defined(ANDROID_SIM_COUNT_2)
-#define SIM_COUNT 2
-#elif defined(ANDROID_SIM_COUNT_3)
-#define SIM_COUNT 3
-#elif defined(ANDROID_SIM_COUNT_4)
-#define SIM_COUNT 4
-#else
-#define SIM_COUNT 1
-#endif
-
-#ifndef ANDROID_MULTI_SIM
-#define SIM_COUNT 1
-#endif
-
-#define RIL_VERSION 11 /* Current version */
-#define RIL_VERSION_MIN 6 /* Minimum RIL_VERSION supported */
-
-#define CDMA_ALPHA_INFO_BUFFER_LENGTH 64
-#define CDMA_NUMBER_INFO_BUFFER_LENGTH 81
-
-#define MAX_RILDS 3
-#define MAX_SOCKET_NAME_LENGTH 6
-#define MAX_CLIENT_ID_LENGTH 2
-#define MAX_DEBUG_SOCKET_NAME_LENGTH 12
-#define MAX_QEMU_PIPE_NAME_LENGTH 11
-#define MAX_UUID_LENGTH 64
-
-
-typedef void * RIL_Token;
-
-typedef enum {
- RIL_SOCKET_1,
-#if (SIM_COUNT >= 2)
- RIL_SOCKET_2,
-#if (SIM_COUNT >= 3)
- RIL_SOCKET_3,
-#endif
-#if (SIM_COUNT >= 4)
- RIL_SOCKET_4,
-#endif
-#endif
- RIL_SOCKET_NUM
-} RIL_SOCKET_ID;
-
-
-typedef enum {
- RIL_E_SUCCESS = 0,
- RIL_E_RADIO_NOT_AVAILABLE = 1, /* If radio did not start or is resetting */
- RIL_E_GENERIC_FAILURE = 2,
- RIL_E_PASSWORD_INCORRECT = 3, /* for PIN/PIN2 methods only! */
- RIL_E_SIM_PIN2 = 4, /* Operation requires SIM PIN2 to be entered */
- RIL_E_SIM_PUK2 = 5, /* Operation requires SIM PIN2 to be entered */
- RIL_E_REQUEST_NOT_SUPPORTED = 6,
- RIL_E_CANCELLED = 7,
- RIL_E_OP_NOT_ALLOWED_DURING_VOICE_CALL = 8, /* data ops are not allowed during voice
- call on a Class C GPRS device */
- RIL_E_OP_NOT_ALLOWED_BEFORE_REG_TO_NW = 9, /* data ops are not allowed before device
- registers in network */
- RIL_E_SMS_SEND_FAIL_RETRY = 10, /* fail to send sms and need retry */
- RIL_E_SIM_ABSENT = 11, /* fail to set the location where CDMA subscription
- shall be retrieved because of SIM or RUIM
- card absent */
- RIL_E_SUBSCRIPTION_NOT_AVAILABLE = 12, /* fail to find CDMA subscription from specified
- location */
- RIL_E_MODE_NOT_SUPPORTED = 13, /* HW does not support preferred network type */
- RIL_E_FDN_CHECK_FAILURE = 14, /* command failed because recipient is not on FDN list */
- RIL_E_ILLEGAL_SIM_OR_ME = 15, /* network selection failed due to
- illegal SIM or ME */
- RIL_E_MISSING_RESOURCE = 16, /* no logical channel available */
- RIL_E_NO_SUCH_ELEMENT = 17, /* application not found on SIM */
- RIL_E_DIAL_MODIFIED_TO_USSD = 18, /* DIAL request modified to USSD */
- RIL_E_DIAL_MODIFIED_TO_SS = 19, /* DIAL request modified to SS */
- RIL_E_DIAL_MODIFIED_TO_DIAL = 20, /* DIAL request modified to DIAL with different
- data */
- RIL_E_USSD_MODIFIED_TO_DIAL = 21, /* USSD request modified to DIAL */
- RIL_E_USSD_MODIFIED_TO_SS = 22, /* USSD request modified to SS */
- RIL_E_USSD_MODIFIED_TO_USSD = 23, /* USSD request modified to different USSD
- request */
- RIL_E_SS_MODIFIED_TO_DIAL = 24, /* SS request modified to DIAL */
- RIL_E_SS_MODIFIED_TO_USSD = 25, /* SS request modified to USSD */
- RIL_E_SUBSCRIPTION_NOT_SUPPORTED = 26, /* Subscription not supported by RIL */
- RIL_E_SS_MODIFIED_TO_SS = 27 /* SS request modified to different SS request */
-
-
-} RIL_Errno;
-
-typedef enum {
- RIL_CALL_ACTIVE = 0,
- RIL_CALL_HOLDING = 1,
- RIL_CALL_DIALING = 2, /* MO call only */
- RIL_CALL_ALERTING = 3, /* MO call only */
- RIL_CALL_INCOMING = 4, /* MT call only */
- RIL_CALL_WAITING = 5 /* MT call only */
-} RIL_CallState;
-
-typedef enum {
- RADIO_STATE_OFF = 0, /* Radio explictly powered off (eg CFUN=0) */
- RADIO_STATE_UNAVAILABLE = 1, /* Radio unavailable (eg, resetting or not booted) */
- /* States 2-9 below are deprecated. Just leaving them here for backward compatibility. */
- RADIO_STATE_SIM_NOT_READY = 2, /* Radio is on, but the SIM interface is not ready */
- RADIO_STATE_SIM_LOCKED_OR_ABSENT = 3, /* SIM PIN locked, PUK required, network
- personalization locked, or SIM absent */
- RADIO_STATE_SIM_READY = 4, /* Radio is on and SIM interface is available */
- RADIO_STATE_RUIM_NOT_READY = 5, /* Radio is on, but the RUIM interface is not ready */
- RADIO_STATE_RUIM_READY = 6, /* Radio is on and the RUIM interface is available */
- RADIO_STATE_RUIM_LOCKED_OR_ABSENT = 7, /* RUIM PIN locked, PUK required, network
- personalization locked, or RUIM absent */
- RADIO_STATE_NV_NOT_READY = 8, /* Radio is on, but the NV interface is not available */
- RADIO_STATE_NV_READY = 9, /* Radio is on and the NV interface is available */
- RADIO_STATE_ON = 10 /* Radio is on */
-} RIL_RadioState;
-
-typedef enum {
- RADIO_TECH_UNKNOWN = 0,
- RADIO_TECH_GPRS = 1,
- RADIO_TECH_EDGE = 2,
- RADIO_TECH_UMTS = 3,
- RADIO_TECH_IS95A = 4,
- RADIO_TECH_IS95B = 5,
- RADIO_TECH_1xRTT = 6,
- RADIO_TECH_EVDO_0 = 7,
- RADIO_TECH_EVDO_A = 8,
- RADIO_TECH_HSDPA = 9,
- RADIO_TECH_HSUPA = 10,
- RADIO_TECH_HSPA = 11,
- RADIO_TECH_EVDO_B = 12,
- RADIO_TECH_EHRPD = 13,
- RADIO_TECH_LTE = 14,
- RADIO_TECH_HSPAP = 15, // HSPA+
- RADIO_TECH_GSM = 16, // Only supports voice
- RADIO_TECH_TD_SCDMA = 17,
- RADIO_TECH_IWLAN = 18
-} RIL_RadioTechnology;
-
-typedef enum {
- RAF_UNKNOWN = (1 << RADIO_TECH_UNKNOWN),
- RAF_GPRS = (1 << RADIO_TECH_GPRS),
- RAF_EDGE = (1 << RADIO_TECH_EDGE),
- RAF_UMTS = (1 << RADIO_TECH_UMTS),
- RAF_IS95A = (1 << RADIO_TECH_IS95A),
- RAF_IS95B = (1 << RADIO_TECH_IS95B),
- RAF_1xRTT = (1 << RADIO_TECH_1xRTT),
- RAF_EVDO_0 = (1 << RADIO_TECH_EVDO_0),
- RAF_EVDO_A = (1 << RADIO_TECH_EVDO_A),
- RAF_HSDPA = (1 << RADIO_TECH_HSDPA),
- RAF_HSUPA = (1 << RADIO_TECH_HSUPA),
- RAF_HSPA = (1 << RADIO_TECH_HSPA),
- RAF_EVDO_B = (1 << RADIO_TECH_EVDO_B),
- RAF_EHRPD = (1 << RADIO_TECH_EHRPD),
- RAF_LTE = (1 << RADIO_TECH_LTE),
- RAF_HSPAP = (1 << RADIO_TECH_HSPAP),
- RAF_GSM = (1 << RADIO_TECH_GSM),
- RAF_TD_SCDMA = (1 << RADIO_TECH_TD_SCDMA),
-} RIL_RadioAccessFamily;
-
-typedef enum {
- RC_PHASE_CONFIGURED = 0, // LM is configured is initial value and value after FINISH completes
- RC_PHASE_START = 1, // START is sent before Apply and indicates that an APPLY will be
- // forthcoming with these same parameters
- RC_PHASE_APPLY = 2, // APPLY is sent after all LM's receive START and returned
- // RIL_RadioCapability.status = 0, if any START's fail no
- // APPLY will be sent
- RC_PHASE_UNSOL_RSP = 3, // UNSOL_RSP is sent with RIL_UNSOL_RADIO_CAPABILITY
- RC_PHASE_FINISH = 4 // FINISH is sent after all commands have completed. If an error
- // occurs in any previous command the RIL_RadioAccessesFamily and
- // logicalModemUuid fields will be the prior configuration thus
- // restoring the configuration to the previous value. An error
- // returned by this command will generally be ignored or may
- // cause that logical modem to be removed from service.
-} RadioCapabilityPhase;
-
-typedef enum {
- RC_STATUS_NONE = 0, // This parameter has no meaning with RC_PHASE_START,
- // RC_PHASE_APPLY
- RC_STATUS_SUCCESS = 1, // Tell modem the action transaction of set radio
- // capability was success with RC_PHASE_FINISH
- RC_STATUS_FAIL = 2, // Tell modem the action transaction of set radio
- // capability is fail with RC_PHASE_FINISH.
-} RadioCapabilityStatus;
-
-#define RIL_RADIO_CAPABILITY_VERSION 1
-typedef struct {
- int version; // Version of structure, RIL_RADIO_CAPABILITY_VERSION
- int session; // Unique session value defined by framework returned in all "responses/unsol"
- int phase; // CONFIGURED, START, APPLY, FINISH
- int rat; // RIL_RadioAccessFamily for the radio
- char logicalModemUuid[MAX_UUID_LENGTH]; // A UUID typically "com.xxxx.lmX where X is the logical modem.
- int status; // Return status and an input parameter for RC_PHASE_FINISH
-} RIL_RadioCapability;
-
-// Do we want to split Data from Voice and the use
-// RIL_RadioTechnology for get/setPreferredVoice/Data ?
-typedef enum {
- PREF_NET_TYPE_GSM_WCDMA = 0, /* GSM/WCDMA (WCDMA preferred) */
- PREF_NET_TYPE_GSM_ONLY = 1, /* GSM only */
- PREF_NET_TYPE_WCDMA = 2, /* WCDMA */
- PREF_NET_TYPE_GSM_WCDMA_AUTO = 3, /* GSM/WCDMA (auto mode, according to PRL) */
- PREF_NET_TYPE_CDMA_EVDO_AUTO = 4, /* CDMA and EvDo (auto mode, according to PRL) */
- PREF_NET_TYPE_CDMA_ONLY = 5, /* CDMA only */
- PREF_NET_TYPE_EVDO_ONLY = 6, /* EvDo only */
- PREF_NET_TYPE_GSM_WCDMA_CDMA_EVDO_AUTO = 7, /* GSM/WCDMA, CDMA, and EvDo (auto mode, according to PRL) */
- PREF_NET_TYPE_LTE_CDMA_EVDO = 8, /* LTE, CDMA and EvDo */
- PREF_NET_TYPE_LTE_GSM_WCDMA = 9, /* LTE, GSM/WCDMA */
- PREF_NET_TYPE_LTE_CMDA_EVDO_GSM_WCDMA = 10, /* LTE, CDMA, EvDo, GSM/WCDMA */
- PREF_NET_TYPE_LTE_ONLY = 11, /* LTE only */
- PREF_NET_TYPE_LTE_WCDMA = 12 /* LTE/WCDMA */
-} RIL_PreferredNetworkType;
-
-/* Source for cdma subscription */
-typedef enum {
- CDMA_SUBSCRIPTION_SOURCE_RUIM_SIM = 0,
- CDMA_SUBSCRIPTION_SOURCE_NV = 1
-} RIL_CdmaSubscriptionSource;
-
-/* User-to-User signaling Info activation types derived from 3GPP 23.087 v8.0 */
-typedef enum {
- RIL_UUS_TYPE1_IMPLICIT = 0,
- RIL_UUS_TYPE1_REQUIRED = 1,
- RIL_UUS_TYPE1_NOT_REQUIRED = 2,
- RIL_UUS_TYPE2_REQUIRED = 3,
- RIL_UUS_TYPE2_NOT_REQUIRED = 4,
- RIL_UUS_TYPE3_REQUIRED = 5,
- RIL_UUS_TYPE3_NOT_REQUIRED = 6
-} RIL_UUS_Type;
-
-/* User-to-User Signaling Information data coding schemes. Possible values for
- * Octet 3 (Protocol Discriminator field) in the UUIE. The values have been
- * specified in section 10.5.4.25 of 3GPP TS 24.008 */
-typedef enum {
- RIL_UUS_DCS_USP = 0, /* User specified protocol */
- RIL_UUS_DCS_OSIHLP = 1, /* OSI higher layer protocol */
- RIL_UUS_DCS_X244 = 2, /* X.244 */
- RIL_UUS_DCS_RMCF = 3, /* Reserved for system mangement
- convergence function */
- RIL_UUS_DCS_IA5c = 4 /* IA5 characters */
-} RIL_UUS_DCS;
-
-/* User-to-User Signaling Information defined in 3GPP 23.087 v8.0
- * This data is passed in RIL_ExtensionRecord and rec contains this
- * structure when type is RIL_UUS_INFO_EXT_REC */
-typedef struct {
- RIL_UUS_Type uusType; /* UUS Type */
- RIL_UUS_DCS uusDcs; /* UUS Data Coding Scheme */
- int uusLength; /* Length of UUS Data */
- char * uusData; /* UUS Data */
-} RIL_UUS_Info;
-
-/* CDMA Signal Information Record as defined in C.S0005 section 3.7.5.5 */
-typedef struct {
- char isPresent; /* non-zero if signal information record is present */
- char signalType; /* as defined 3.7.5.5-1 */
- char alertPitch; /* as defined 3.7.5.5-2 */
- char signal; /* as defined 3.7.5.5-3, 3.7.5.5-4 or 3.7.5.5-5 */
-} RIL_CDMA_SignalInfoRecord;
-
-typedef struct {
- RIL_CallState state;
- int index; /* Connection Index for use with, eg, AT+CHLD */
- int toa; /* type of address, eg 145 = intl */
- char isMpty; /* nonzero if is mpty call */
- char isMT; /* nonzero if call is mobile terminated */
- char als; /* ALS line indicator if available
- (0 = line 1) */
- char isVoice; /* nonzero if this is is a voice call */
- char isVoicePrivacy; /* nonzero if CDMA voice privacy mode is active */
- char * number; /* Remote party number */
- int numberPresentation; /* 0=Allowed, 1=Restricted, 2=Not Specified/Unknown 3=Payphone */
- char * name; /* Remote party name */
- int namePresentation; /* 0=Allowed, 1=Restricted, 2=Not Specified/Unknown 3=Payphone */
- RIL_UUS_Info * uusInfo; /* NULL or Pointer to User-User Signaling Information */
-} RIL_Call;
-
-/* Deprecated, use RIL_Data_Call_Response_v6 */
-typedef struct {
- int cid; /* Context ID, uniquely identifies this call */
- int active; /* 0=inactive, 1=active/physical link down, 2=active/physical link up */
- char * type; /* One of the PDP_type values in TS 27.007 section 10.1.1.
- For example, "IP", "IPV6", "IPV4V6", or "PPP". */
- char * apn; /* ignored */
- char * address; /* An address, e.g., "192.0.1.3" or "2001:db8::1". */
-} RIL_Data_Call_Response_v4;
-
-/*
- * Returned by RIL_REQUEST_SETUP_DATA_CALL, RIL_REQUEST_DATA_CALL_LIST
- * and RIL_UNSOL_DATA_CALL_LIST_CHANGED, on error status != 0.
- */
-typedef struct {
- int status; /* A RIL_DataCallFailCause, 0 which is PDP_FAIL_NONE if no error */
- int suggestedRetryTime; /* If status != 0, this fields indicates the suggested retry
- back-off timer value RIL wants to override the one
- pre-configured in FW.
- The unit is miliseconds.
- The value < 0 means no value is suggested.
- The value 0 means retry should be done ASAP.
- The value of INT_MAX(0x7fffffff) means no retry. */
- int cid; /* Context ID, uniquely identifies this call */
- int active; /* 0=inactive, 1=active/physical link down, 2=active/physical link up */
- char * type; /* One of the PDP_type values in TS 27.007 section 10.1.1.
- For example, "IP", "IPV6", "IPV4V6", or "PPP". If status is
- PDP_FAIL_ONLY_SINGLE_BEARER_ALLOWED this is the type supported
- such as "IP" or "IPV6" */
- char * ifname; /* The network interface name */
- char * addresses; /* A space-delimited list of addresses with optional "/" prefix length,
- e.g., "192.0.1.3" or "192.0.1.11/16 2001:db8::1/64".
- May not be empty, typically 1 IPv4 or 1 IPv6 or
- one of each. If the prefix length is absent the addresses
- are assumed to be point to point with IPv4 having a prefix
- length of 32 and IPv6 128. */
- char * dnses; /* A space-delimited list of DNS server addresses,
- e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1".
- May be empty. */
- char * gateways; /* A space-delimited list of default gateway addresses,
- e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1".
- May be empty in which case the addresses represent point
- to point connections. */
-} RIL_Data_Call_Response_v6;
-
-typedef struct {
- int status; /* A RIL_DataCallFailCause, 0 which is PDP_FAIL_NONE if no error */
- int suggestedRetryTime; /* If status != 0, this fields indicates the suggested retry
- back-off timer value RIL wants to override the one
- pre-configured in FW.
- The unit is miliseconds.
- The value < 0 means no value is suggested.
- The value 0 means retry should be done ASAP.
- The value of INT_MAX(0x7fffffff) means no retry. */
- int cid; /* Context ID, uniquely identifies this call */
- int active; /* 0=inactive, 1=active/physical link down, 2=active/physical link up */
- char * type; /* One of the PDP_type values in TS 27.007 section 10.1.1.
- For example, "IP", "IPV6", "IPV4V6", or "PPP". If status is
- PDP_FAIL_ONLY_SINGLE_BEARER_ALLOWED this is the type supported
- such as "IP" or "IPV6" */
- char * ifname; /* The network interface name */
- char * addresses; /* A space-delimited list of addresses with optional "/" prefix length,
- e.g., "192.0.1.3" or "192.0.1.11/16 2001:db8::1/64".
- May not be empty, typically 1 IPv4 or 1 IPv6 or
- one of each. If the prefix length is absent the addresses
- are assumed to be point to point with IPv4 having a prefix
- length of 32 and IPv6 128. */
- char * dnses; /* A space-delimited list of DNS server addresses,
- e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1".
- May be empty. */
- char * gateways; /* A space-delimited list of default gateway addresses,
- e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1".
- May be empty in which case the addresses represent point
- to point connections. */
- char * pcscf; /* the Proxy Call State Control Function address
- via PCO(Protocol Configuration Option) for IMS client. */
-} RIL_Data_Call_Response_v9;
-
-typedef struct {
- int status; /* A RIL_DataCallFailCause, 0 which is PDP_FAIL_NONE if no error */
- int suggestedRetryTime; /* If status != 0, this fields indicates the suggested retry
- back-off timer value RIL wants to override the one
- pre-configured in FW.
- The unit is miliseconds.
- The value < 0 means no value is suggested.
- The value 0 means retry should be done ASAP.
- The value of INT_MAX(0x7fffffff) means no retry. */
- int cid; /* Context ID, uniquely identifies this call */
- int active; /* 0=inactive, 1=active/physical link down, 2=active/physical link up */
- char * type; /* One of the PDP_type values in TS 27.007 section 10.1.1.
- For example, "IP", "IPV6", "IPV4V6", or "PPP". If status is
- PDP_FAIL_ONLY_SINGLE_BEARER_ALLOWED this is the type supported
- such as "IP" or "IPV6" */
- char * ifname; /* The network interface name */
- char * addresses; /* A space-delimited list of addresses with optional "/" prefix length,
- e.g., "192.0.1.3" or "192.0.1.11/16 2001:db8::1/64".
- May not be empty, typically 1 IPv4 or 1 IPv6 or
- one of each. If the prefix length is absent the addresses
- are assumed to be point to point with IPv4 having a prefix
- length of 32 and IPv6 128. */
- char * dnses; /* A space-delimited list of DNS server addresses,
- e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1".
- May be empty. */
- char * gateways; /* A space-delimited list of default gateway addresses,
- e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1".
- May be empty in which case the addresses represent point
- to point connections. */
- char * pcscf; /* the Proxy Call State Control Function address
- via PCO(Protocol Configuration Option) for IMS client. */
- int mtu; /* MTU received from network
- Value <= 0 means network has either not sent a value or
- sent an invalid value */
-} RIL_Data_Call_Response_v11;
-
-typedef enum {
- RADIO_TECH_3GPP = 1, /* 3GPP Technologies - GSM, WCDMA */
- RADIO_TECH_3GPP2 = 2 /* 3GPP2 Technologies - CDMA */
-} RIL_RadioTechnologyFamily;
-
-typedef struct {
- RIL_RadioTechnologyFamily tech;
- unsigned char retry; /* 0 == not retry, nonzero == retry */
- int messageRef; /* Valid field if retry is set to nonzero.
- Contains messageRef from RIL_SMS_Response
- corresponding to failed MO SMS.
- */
-
- union {
- /* Valid field if tech is RADIO_TECH_3GPP2. See RIL_REQUEST_CDMA_SEND_SMS */
- RIL_CDMA_SMS_Message* cdmaMessage;
-
- /* Valid field if tech is RADIO_TECH_3GPP. See RIL_REQUEST_SEND_SMS */
- char** gsmMessage;
- } message;
-} RIL_IMS_SMS_Message;
-
-typedef struct {
- int messageRef; /* TP-Message-Reference for GSM,
- and BearerData MessageId for CDMA
- (See 3GPP2 C.S0015-B, v2.0, table 4.5-1). */
- char *ackPDU; /* or NULL if n/a */
- int errorCode; /* See 3GPP 27.005, 3.2.5 for GSM/UMTS,
- 3GPP2 N.S0005 (IS-41C) Table 171 for CDMA,
- -1 if unknown or not applicable*/
-} RIL_SMS_Response;
-
-/** Used by RIL_REQUEST_WRITE_SMS_TO_SIM */
-typedef struct {
- int status; /* Status of message. See TS 27.005 3.1, "<stat>": */
- /* 0 = "REC UNREAD" */
- /* 1 = "REC READ" */
- /* 2 = "STO UNSENT" */
- /* 3 = "STO SENT" */
- char * pdu; /* PDU of message to write, as an ASCII hex string less the SMSC address,
- the TP-layer length is "strlen(pdu)/2". */
- char * smsc; /* SMSC address in GSM BCD format prefixed by a length byte
- (as expected by TS 27.005) or NULL for default SMSC */
-} RIL_SMS_WriteArgs;
-
-/** Used by RIL_REQUEST_DIAL */
-typedef struct {
- char * address;
- int clir;
- /* (same as 'n' paremeter in TS 27.007 7.7 "+CLIR"
- * clir == 0 on "use subscription default value"
- * clir == 1 on "CLIR invocation" (restrict CLI presentation)
- * clir == 2 on "CLIR suppression" (allow CLI presentation)
- */
- RIL_UUS_Info * uusInfo; /* NULL or Pointer to User-User Signaling Information */
-} RIL_Dial;
-
-typedef struct {
- int command; /* one of the commands listed for TS 27.007 +CRSM*/
- int fileid; /* EF id */
- char *path; /* "pathid" from TS 27.007 +CRSM command.
- Path is in hex asciii format eg "7f205f70"
- Path must always be provided.
- */
- int p1;
- int p2;
- int p3;
- char *data; /* May be NULL*/
- char *pin2; /* May be NULL*/
-} RIL_SIM_IO_v5;
-
-typedef struct {
- int command; /* one of the commands listed for TS 27.007 +CRSM*/
- int fileid; /* EF id */
- char *path; /* "pathid" from TS 27.007 +CRSM command.
- Path is in hex asciii format eg "7f205f70"
- Path must always be provided.
- */
- int p1;
- int p2;
- int p3;
- char *data; /* May be NULL*/
- char *pin2; /* May be NULL*/
- char *aidPtr; /* AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value. */
-} RIL_SIM_IO_v6;
-
-/* Used by RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL and
- * RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC. */
-typedef struct {
- int sessionid; /* "sessionid" from TS 27.007 +CGLA command. Should be
- ignored for +CSIM command. */
-
- /* Following fields are used to derive the APDU ("command" and "length"
- values in TS 27.007 +CSIM and +CGLA commands). */
- int cla;
- int instruction;
- int p1;
- int p2;
- int p3; /* A negative P3 implies a 4 byte APDU. */
- char *data; /* May be NULL. In hex string format. */
-} RIL_SIM_APDU;
-
-typedef struct {
- int sw1;
- int sw2;
- char *simResponse; /* In hex string format ([a-fA-F0-9]*), except for SIM_AUTHENTICATION
- response for which it is in Base64 format, see 3GPP TS 31.102 7.1.2 */
-} RIL_SIM_IO_Response;
-
-/* See also com.android.internal.telephony.gsm.CallForwardInfo */
-
-typedef struct {
- int status; /*
- * For RIL_REQUEST_QUERY_CALL_FORWARD_STATUS
- * status 1 = active, 0 = not active
- *
- * For RIL_REQUEST_SET_CALL_FORWARD:
- * status is:
- * 0 = disable
- * 1 = enable
- * 2 = interrogate
- * 3 = registeration
- * 4 = erasure
- */
-
- int reason; /* from TS 27.007 7.11 "reason" */
- int serviceClass;/* From 27.007 +CCFC/+CLCK "class"
- See table for Android mapping from
- MMI service code
- 0 means user doesn't input class */
- int toa; /* "type" from TS 27.007 7.11 */
- char * number; /* "number" from TS 27.007 7.11. May be NULL */
- int timeSeconds; /* for CF no reply only */
-}RIL_CallForwardInfo;
-
-typedef struct {
- char * cid; /* Combination of LAC and Cell Id in 32 bits in GSM.
- * Upper 16 bits is LAC and lower 16 bits
- * is CID (as described in TS 27.005)
- * Primary Scrambling Code (as described in TS 25.331)
- * in 9 bits in UMTS
- * Valid values are hexadecimal 0x0000 - 0xffffffff.
- */
- int rssi; /* Received RSSI in GSM,
- * Level index of CPICH Received Signal Code Power in UMTS
- */
-} RIL_NeighboringCell;
-
-typedef struct {
- char lce_status; /* LCE service status:
- * -1 = not supported;
- * 0 = stopped;
- * 1 = active.
- */
- unsigned int actual_interval_ms; /* actual LCE reporting interval,
- * meaningful only if LCEStatus = 1.
- */
-} RIL_LceStatusInfo;
-
-typedef struct {
- unsigned int last_hop_capacity_kbps; /* last-hop cellular capacity: kilobits/second. */
- unsigned char confidence_level; /* capacity estimate confidence: 0-100 */
- unsigned char lce_suspended; /* LCE report going to be suspended? (e.g., radio
- * moves to inactive state or network type change)
- * 1 = suspended;
- * 0 = not suspended.
- */
-} RIL_LceDataInfo;
-
-/* See RIL_REQUEST_LAST_CALL_FAIL_CAUSE */
-typedef enum {
- CALL_FAIL_UNOBTAINABLE_NUMBER = 1,
- CALL_FAIL_NORMAL = 16,
- CALL_FAIL_BUSY = 17,
- CALL_FAIL_CONGESTION = 34,
- CALL_FAIL_ACM_LIMIT_EXCEEDED = 68,
- CALL_FAIL_CALL_BARRED = 240,
- CALL_FAIL_FDN_BLOCKED = 241,
- CALL_FAIL_IMSI_UNKNOWN_IN_VLR = 242,
- CALL_FAIL_IMEI_NOT_ACCEPTED = 243,
- CALL_FAIL_DIAL_MODIFIED_TO_USSD = 244, /* STK Call Control */
- CALL_FAIL_DIAL_MODIFIED_TO_SS = 245,
- CALL_FAIL_DIAL_MODIFIED_TO_DIAL = 246,
- CALL_FAIL_CDMA_LOCKED_UNTIL_POWER_CYCLE = 1000,
- CALL_FAIL_CDMA_DROP = 1001,
- CALL_FAIL_CDMA_INTERCEPT = 1002,
- CALL_FAIL_CDMA_REORDER = 1003,
- CALL_FAIL_CDMA_SO_REJECT = 1004,
- CALL_FAIL_CDMA_RETRY_ORDER = 1005,
- CALL_FAIL_CDMA_ACCESS_FAILURE = 1006,
- CALL_FAIL_CDMA_PREEMPTED = 1007,
- CALL_FAIL_CDMA_NOT_EMERGENCY = 1008, /* For non-emergency number dialed
- during emergency callback mode */
- CALL_FAIL_CDMA_ACCESS_BLOCKED = 1009, /* CDMA network access probes blocked */
- CALL_FAIL_ERROR_UNSPECIFIED = 0xffff
-} RIL_LastCallFailCause;
-
-typedef struct {
- RIL_LastCallFailCause cause_code;
- char * vendor_cause;
-} RIL_LastCallFailCauseInfo;
-
-/* See RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE */
-typedef enum {
- PDP_FAIL_NONE = 0, /* No error, connection ok */
-
- /* an integer cause code defined in TS 24.008
- section 6.1.3.1.3 or TS 24.301 Release 8+ Annex B.
- If the implementation does not have access to the exact cause codes,
- then it should return one of the following values,
- as the UI layer needs to distinguish these
- cases for error notification and potential retries. */
- PDP_FAIL_OPERATOR_BARRED = 0x08, /* no retry */
- PDP_FAIL_INSUFFICIENT_RESOURCES = 0x1A,
- PDP_FAIL_MISSING_UKNOWN_APN = 0x1B, /* no retry */
- PDP_FAIL_UNKNOWN_PDP_ADDRESS_TYPE = 0x1C, /* no retry */
- PDP_FAIL_USER_AUTHENTICATION = 0x1D, /* no retry */
- PDP_FAIL_ACTIVATION_REJECT_GGSN = 0x1E, /* no retry */
- PDP_FAIL_ACTIVATION_REJECT_UNSPECIFIED = 0x1F,
- PDP_FAIL_SERVICE_OPTION_NOT_SUPPORTED = 0x20, /* no retry */
- PDP_FAIL_SERVICE_OPTION_NOT_SUBSCRIBED = 0x21, /* no retry */
- PDP_FAIL_SERVICE_OPTION_OUT_OF_ORDER = 0x22,
- PDP_FAIL_NSAPI_IN_USE = 0x23, /* no retry */
- PDP_FAIL_REGULAR_DEACTIVATION = 0x24, /* possibly restart radio,
- based on framework config */
- PDP_FAIL_ONLY_IPV4_ALLOWED = 0x32, /* no retry */
- PDP_FAIL_ONLY_IPV6_ALLOWED = 0x33, /* no retry */
- PDP_FAIL_ONLY_SINGLE_BEARER_ALLOWED = 0x34,
- PDP_FAIL_PROTOCOL_ERRORS = 0x6F, /* no retry */
-
- /* Not mentioned in the specification */
- PDP_FAIL_VOICE_REGISTRATION_FAIL = -1,
- PDP_FAIL_DATA_REGISTRATION_FAIL = -2,
-
- /* reasons for data call drop - network/modem disconnect */
- PDP_FAIL_SIGNAL_LOST = -3,
- PDP_FAIL_PREF_RADIO_TECH_CHANGED = -4,/* preferred technology has changed, should retry
- with parameters appropriate for new technology */
- PDP_FAIL_RADIO_POWER_OFF = -5, /* data call was disconnected because radio was resetting,
- powered off - no retry */
- PDP_FAIL_TETHERED_CALL_ACTIVE = -6, /* data call was disconnected by modem because tethered
- mode was up on same APN/data profile - no retry until
- tethered call is off */
-
- PDP_FAIL_ERROR_UNSPECIFIED = 0xffff, /* retry silently */
-} RIL_DataCallFailCause;
-
-/* See RIL_REQUEST_SETUP_DATA_CALL */
-typedef enum {
- RIL_DATA_PROFILE_DEFAULT = 0,
- RIL_DATA_PROFILE_TETHERED = 1,
- RIL_DATA_PROFILE_IMS = 2,
- RIL_DATA_PROFILE_FOTA = 3,
- RIL_DATA_PROFILE_CBS = 4,
- RIL_DATA_PROFILE_OEM_BASE = 1000, /* Start of OEM-specific profiles */
- RIL_DATA_PROFILE_INVALID = 0xFFFFFFFF
-} RIL_DataProfile;
-
-/* Used by RIL_UNSOL_SUPP_SVC_NOTIFICATION */
-typedef struct {
- int notificationType; /*
- * 0 = MO intermediate result code
- * 1 = MT unsolicited result code
- */
- int code; /* See 27.007 7.17
- "code1" for MO
- "code2" for MT. */
- int index; /* CUG index. See 27.007 7.17. */
- int type; /* "type" from 27.007 7.17 (MT only). */
- char * number; /* "number" from 27.007 7.17
- (MT only, may be NULL). */
-} RIL_SuppSvcNotification;
-
-#define RIL_CARD_MAX_APPS 8
-
-typedef enum {
- RIL_CARDSTATE_ABSENT = 0,
- RIL_CARDSTATE_PRESENT = 1,
- RIL_CARDSTATE_ERROR = 2
-} RIL_CardState;
-
-typedef enum {
- RIL_PERSOSUBSTATE_UNKNOWN = 0, /* initial state */
- RIL_PERSOSUBSTATE_IN_PROGRESS = 1, /* in between each lock transition */
- RIL_PERSOSUBSTATE_READY = 2, /* when either SIM or RUIM Perso is finished
- since each app can only have 1 active perso
- involved */
- RIL_PERSOSUBSTATE_SIM_NETWORK = 3,
- RIL_PERSOSUBSTATE_SIM_NETWORK_SUBSET = 4,
- RIL_PERSOSUBSTATE_SIM_CORPORATE = 5,
- RIL_PERSOSUBSTATE_SIM_SERVICE_PROVIDER = 6,
- RIL_PERSOSUBSTATE_SIM_SIM = 7,
- RIL_PERSOSUBSTATE_SIM_NETWORK_PUK = 8, /* The corresponding perso lock is blocked */
- RIL_PERSOSUBSTATE_SIM_NETWORK_SUBSET_PUK = 9,
- RIL_PERSOSUBSTATE_SIM_CORPORATE_PUK = 10,
- RIL_PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK = 11,
- RIL_PERSOSUBSTATE_SIM_SIM_PUK = 12,
- RIL_PERSOSUBSTATE_RUIM_NETWORK1 = 13,
- RIL_PERSOSUBSTATE_RUIM_NETWORK2 = 14,
- RIL_PERSOSUBSTATE_RUIM_HRPD = 15,
- RIL_PERSOSUBSTATE_RUIM_CORPORATE = 16,
- RIL_PERSOSUBSTATE_RUIM_SERVICE_PROVIDER = 17,
- RIL_PERSOSUBSTATE_RUIM_RUIM = 18,
- RIL_PERSOSUBSTATE_RUIM_NETWORK1_PUK = 19, /* The corresponding perso lock is blocked */
- RIL_PERSOSUBSTATE_RUIM_NETWORK2_PUK = 20,
- RIL_PERSOSUBSTATE_RUIM_HRPD_PUK = 21,
- RIL_PERSOSUBSTATE_RUIM_CORPORATE_PUK = 22,
- RIL_PERSOSUBSTATE_RUIM_SERVICE_PROVIDER_PUK = 23,
- RIL_PERSOSUBSTATE_RUIM_RUIM_PUK = 24
-} RIL_PersoSubstate;
-
-typedef enum {
- RIL_APPSTATE_UNKNOWN = 0,
- RIL_APPSTATE_DETECTED = 1,
- RIL_APPSTATE_PIN = 2, /* If PIN1 or UPin is required */
- RIL_APPSTATE_PUK = 3, /* If PUK1 or Puk for UPin is required */
- RIL_APPSTATE_SUBSCRIPTION_PERSO = 4, /* perso_substate should be look at
- when app_state is assigned to this value */
- RIL_APPSTATE_READY = 5
-} RIL_AppState;
-
-typedef enum {
- RIL_PINSTATE_UNKNOWN = 0,
- RIL_PINSTATE_ENABLED_NOT_VERIFIED = 1,
- RIL_PINSTATE_ENABLED_VERIFIED = 2,
- RIL_PINSTATE_DISABLED = 3,
- RIL_PINSTATE_ENABLED_BLOCKED = 4,
- RIL_PINSTATE_ENABLED_PERM_BLOCKED = 5
-} RIL_PinState;
-
-typedef enum {
- RIL_APPTYPE_UNKNOWN = 0,
- RIL_APPTYPE_SIM = 1,
- RIL_APPTYPE_USIM = 2,
- RIL_APPTYPE_RUIM = 3,
- RIL_APPTYPE_CSIM = 4,
- RIL_APPTYPE_ISIM = 5
-} RIL_AppType;
-
-typedef struct
-{
- RIL_AppType app_type;
- RIL_AppState app_state;
- RIL_PersoSubstate perso_substate; /* applicable only if app_state ==
- RIL_APPSTATE_SUBSCRIPTION_PERSO */
- char *aid_ptr; /* null terminated string, e.g., from 0xA0, 0x00 -> 0x41,
- 0x30, 0x30, 0x30 */
- char *app_label_ptr; /* null terminated string */
- int pin1_replaced; /* applicable to USIM, CSIM & ISIM */
- RIL_PinState pin1;
- RIL_PinState pin2;
- int foo1; /* Samsung */
- int foo2; /* Samsung */
- int foo3; /* Samsung */
- int foo4; /* Samsung */
- int foo5; /* Samsung */
-} RIL_AppStatus;
-
-/* Deprecated, use RIL_CardStatus_v6 */
-typedef struct
-{
- RIL_CardState card_state;
- RIL_PinState universal_pin_state; /* applicable to USIM and CSIM: RIL_PINSTATE_xxx */
- int gsm_umts_subscription_app_index; /* value < RIL_CARD_MAX_APPS, -1 if none */
- int cdma_subscription_app_index; /* value < RIL_CARD_MAX_APPS, -1 if none */
- int num_applications; /* value <= RIL_CARD_MAX_APPS */
- RIL_AppStatus applications[RIL_CARD_MAX_APPS];
-} RIL_CardStatus_v5;
-
-typedef struct
-{
- RIL_CardState card_state;
- RIL_PinState universal_pin_state; /* applicable to USIM and CSIM: RIL_PINSTATE_xxx */
- int gsm_umts_subscription_app_index; /* value < RIL_CARD_MAX_APPS, -1 if none */
- int cdma_subscription_app_index; /* value < RIL_CARD_MAX_APPS, -1 if none */
- int ims_subscription_app_index; /* value < RIL_CARD_MAX_APPS, -1 if none */
- int num_applications; /* value <= RIL_CARD_MAX_APPS */
- RIL_AppStatus applications[RIL_CARD_MAX_APPS];
-} RIL_CardStatus_v6;
-
-/** The result of a SIM refresh, returned in data[0] of RIL_UNSOL_SIM_REFRESH
- * or as part of RIL_SimRefreshResponse_v7
- */
-typedef enum {
- /* A file on SIM has been updated. data[1] contains the EFID. */
- SIM_FILE_UPDATE = 0,
- /* SIM initialized. All files should be re-read. */
- SIM_INIT = 1,
- /* SIM reset. SIM power required, SIM may be locked and all files should be re-read. */
- SIM_RESET = 2
-} RIL_SimRefreshResult;
-
-typedef struct {
- RIL_SimRefreshResult result;
- int ef_id; /* is the EFID of the updated file if the result is */
- /* SIM_FILE_UPDATE or 0 for any other result. */
- char * aid; /* is AID(application ID) of the card application */
- /* See ETSI 102.221 8.1 and 101.220 4 */
- /* For SIM_FILE_UPDATE result it can be set to AID of */
- /* application in which updated EF resides or it can be */
- /* NULL if EF is outside of an application. */
- /* For SIM_INIT result this field is set to AID of */
- /* application that caused REFRESH */
- /* For SIM_RESET result it is NULL. */
-} RIL_SimRefreshResponse_v7;
-
-/* Deprecated, use RIL_CDMA_CallWaiting_v6 */
-typedef struct {
- char * number; /* Remote party number */
- int numberPresentation; /* 0=Allowed, 1=Restricted, 2=Not Specified/Unknown */
- char * name; /* Remote party name */
- RIL_CDMA_SignalInfoRecord signalInfoRecord;
-} RIL_CDMA_CallWaiting_v5;
-
-typedef struct {
- char * number; /* Remote party number */
- int numberPresentation; /* 0=Allowed, 1=Restricted, 2=Not Specified/Unknown */
- char * name; /* Remote party name */
- RIL_CDMA_SignalInfoRecord signalInfoRecord;
- /* Number type/Number plan required to support International Call Waiting */
- int number_type; /* 0=Unknown, 1=International, 2=National,
- 3=Network specific, 4=subscriber */
- int number_plan; /* 0=Unknown, 1=ISDN, 3=Data, 4=Telex, 8=Nat'l, 9=Private */
-} RIL_CDMA_CallWaiting_v6;
-
-/**
- * Which types of Cell Broadcast Message (CBM) are to be received by the ME
- *
- * uFromServiceID - uToServiceID defines a range of CBM message identifiers
- * whose value is 0x0000 - 0xFFFF as defined in TS 23.041 9.4.1.2.2 for GMS
- * and 9.4.4.2.2 for UMTS. All other values can be treated as empty
- * CBM message ID.
- *
- * uFromCodeScheme - uToCodeScheme defines a range of CBM data coding schemes
- * whose value is 0x00 - 0xFF as defined in TS 23.041 9.4.1.2.3 for GMS
- * and 9.4.4.2.3 for UMTS.
- * All other values can be treated as empty CBM data coding scheme.
- *
- * selected 0 means message types specified in <fromServiceId, toServiceId>
- * and <fromCodeScheme, toCodeScheme>are not accepted, while 1 means accepted.
- *
- * Used by RIL_REQUEST_GSM_GET_BROADCAST_CONFIG and
- * RIL_REQUEST_GSM_SET_BROADCAST_CONFIG.
- */
-typedef struct {
- int fromServiceId;
- int toServiceId;
- int fromCodeScheme;
- int toCodeScheme;
- unsigned char selected;
-} RIL_GSM_BroadcastSmsConfigInfo;
-
-/* No restriction at all including voice/SMS/USSD/SS/AV64 and packet data. */
-#define RIL_RESTRICTED_STATE_NONE 0x00
-/* Block emergency call due to restriction. But allow all normal voice/SMS/USSD/SS/AV64. */
-#define RIL_RESTRICTED_STATE_CS_EMERGENCY 0x01
-/* Block all normal voice/SMS/USSD/SS/AV64 due to restriction. Only Emergency call allowed. */
-#define RIL_RESTRICTED_STATE_CS_NORMAL 0x02
-/* Block all voice/SMS/USSD/SS/AV64 including emergency call due to restriction.*/
-#define RIL_RESTRICTED_STATE_CS_ALL 0x04
-/* Block packet data access due to restriction. */
-#define RIL_RESTRICTED_STATE_PS_ALL 0x10
-
-/* The status for an OTASP/OTAPA session */
-typedef enum {
- CDMA_OTA_PROVISION_STATUS_SPL_UNLOCKED,
- CDMA_OTA_PROVISION_STATUS_SPC_RETRIES_EXCEEDED,
- CDMA_OTA_PROVISION_STATUS_A_KEY_EXCHANGED,
- CDMA_OTA_PROVISION_STATUS_SSD_UPDATED,
- CDMA_OTA_PROVISION_STATUS_NAM_DOWNLOADED,
- CDMA_OTA_PROVISION_STATUS_MDN_DOWNLOADED,
- CDMA_OTA_PROVISION_STATUS_IMSI_DOWNLOADED,
- CDMA_OTA_PROVISION_STATUS_PRL_DOWNLOADED,
- CDMA_OTA_PROVISION_STATUS_COMMITTED,
- CDMA_OTA_PROVISION_STATUS_OTAPA_STARTED,
- CDMA_OTA_PROVISION_STATUS_OTAPA_STOPPED,
- CDMA_OTA_PROVISION_STATUS_OTAPA_ABORTED
-} RIL_CDMA_OTA_ProvisionStatus;
-
-typedef struct {
- int signalStrength; /* Valid values are (0-31, 99) as defined in TS 27.007 8.5 */
- int bitErrorRate; /* bit error rate (0-7, 99) as defined in TS 27.007 8.5 */
-} RIL_GW_SignalStrength;
-
-typedef struct {
- int signalStrength; /* Valid values are (0-31, 99) as defined in TS 27.007 8.5 */
- int bitErrorRate; /* bit error rate (0-7, 99) as defined in TS 27.007 8.5 */
-} RIL_SignalStrengthWcdma;
-
-typedef struct {
- int dbm; /* Valid values are positive integers. This value is the actual RSSI value
- * multiplied by -1. Example: If the actual RSSI is -75, then this response
- * value will be 75.
- */
- int ecio; /* Valid values are positive integers. This value is the actual Ec/Io multiplied
- * by -10. Example: If the actual Ec/Io is -12.5 dB, then this response value
- * will be 125.
- */
-} RIL_CDMA_SignalStrength;
-
-
-typedef struct {
- int dbm; /* Valid values are positive integers. This value is the actual RSSI value
- * multiplied by -1. Example: If the actual RSSI is -75, then this response
- * value will be 75.
- */
- int ecio; /* Valid values are positive integers. This value is the actual Ec/Io multiplied
- * by -10. Example: If the actual Ec/Io is -12.5 dB, then this response value
- * will be 125.
- */
- int signalNoiseRatio; /* Valid values are 0-8. 8 is the highest signal to noise ratio. */
-} RIL_EVDO_SignalStrength;
-
-typedef struct {
- int signalStrength; /* Valid values are (0-31, 99) as defined in TS 27.007 8.5 */
- int rsrp; /* The current Reference Signal Receive Power in dBm multipled by -1.
- * Range: 44 to 140 dBm
- * INT_MAX: 0x7FFFFFFF denotes invalid value.
- * Reference: 3GPP TS 36.133 9.1.4 */
- int rsrq; /* The current Reference Signal Receive Quality in dB multiplied by -1.
- * Range: 20 to 3 dB.
- * INT_MAX: 0x7FFFFFFF denotes invalid value.
- * Reference: 3GPP TS 36.133 9.1.7 */
- int rssnr; /* The current reference signal signal-to-noise ratio in 0.1 dB units.
- * Range: -200 to +300 (-200 = -20.0 dB, +300 = 30dB).
- * INT_MAX : 0x7FFFFFFF denotes invalid value.
- * Reference: 3GPP TS 36.101 8.1.1 */
- int cqi; /* The current Channel Quality Indicator.
- * Range: 0 to 15.
- * INT_MAX : 0x7FFFFFFF denotes invalid value.
- * Reference: 3GPP TS 36.101 9.2, 9.3, A.4 */
-} RIL_LTE_SignalStrength;
-
-typedef struct {
- int signalStrength; /* Valid values are (0-31, 99) as defined in TS 27.007 8.5 */
- int rsrp; /* The current Reference Signal Receive Power in dBm multipled by -1.
- * Range: 44 to 140 dBm
- * INT_MAX: 0x7FFFFFFF denotes invalid value.
- * Reference: 3GPP TS 36.133 9.1.4 */
- int rsrq; /* The current Reference Signal Receive Quality in dB multiplied by -1.
- * Range: 20 to 3 dB.
- * INT_MAX: 0x7FFFFFFF denotes invalid value.
- * Reference: 3GPP TS 36.133 9.1.7 */
- int rssnr; /* The current reference signal signal-to-noise ratio in 0.1 dB units.
- * Range: -200 to +300 (-200 = -20.0 dB, +300 = 30dB).
- * INT_MAX : 0x7FFFFFFF denotes invalid value.
- * Reference: 3GPP TS 36.101 8.1.1 */
- int cqi; /* The current Channel Quality Indicator.
- * Range: 0 to 15.
- * INT_MAX : 0x7FFFFFFF denotes invalid value.
- * Reference: 3GPP TS 36.101 9.2, 9.3, A.4 */
- int timingAdvance; /* timing advance in micro seconds for a one way trip from cell to device.
- * Approximate distance can be calculated using 300m/us * timingAdvance.
- * Range: 0 to 0x7FFFFFFE
- * INT_MAX : 0x7FFFFFFF denotes invalid value.
- * Reference: 3GPP 36.321 section 6.1.3.5
- * also: http://www.cellular-planningoptimization.com/2010/02/timing-advance-with-calculation.html */
-} RIL_LTE_SignalStrength_v8;
-
-typedef struct {
- int rscp; /* The Received Signal Code Power in dBm multipled by -1.
- * Range : 25 to 120
- * INT_MAX: 0x7FFFFFFF denotes invalid value.
- * Reference: 3GPP TS 25.123, section 9.1.1.1 */
-} RIL_TD_SCDMA_SignalStrength;
-
-/* Deprecated, use RIL_SignalStrength_v6 */
-typedef struct {
- RIL_GW_SignalStrength GW_SignalStrength;
- RIL_CDMA_SignalStrength CDMA_SignalStrength;
- RIL_EVDO_SignalStrength EVDO_SignalStrength;
-} RIL_SignalStrength_v5;
-
-typedef struct {
- RIL_GW_SignalStrength GW_SignalStrength;
- RIL_CDMA_SignalStrength CDMA_SignalStrength;
- RIL_EVDO_SignalStrength EVDO_SignalStrength;
- RIL_LTE_SignalStrength LTE_SignalStrength;
-} RIL_SignalStrength_v6;
-
-typedef struct {
- RIL_GW_SignalStrength GW_SignalStrength;
- RIL_CDMA_SignalStrength CDMA_SignalStrength;
- RIL_EVDO_SignalStrength EVDO_SignalStrength;
- RIL_LTE_SignalStrength_v8 LTE_SignalStrength;
-} RIL_SignalStrength_v8;
-
-typedef struct {
- RIL_GW_SignalStrength GW_SignalStrength;
- RIL_CDMA_SignalStrength CDMA_SignalStrength;
- RIL_EVDO_SignalStrength EVDO_SignalStrength;
- RIL_LTE_SignalStrength_v8 LTE_SignalStrength;
- RIL_TD_SCDMA_SignalStrength TD_SCDMA_SignalStrength;
-} RIL_SignalStrength_v10;
-
-/** RIL_CellIdentityGsm */
-typedef struct {
- int mcc; /* 3-digit Mobile Country Code, 0..999, INT_MAX if unknown */
- int mnc; /* 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if unknown */
- int lac; /* 16-bit Location Area Code, 0..65535, INT_MAX if unknown */
- int cid; /* 16-bit GSM Cell Identity described in TS 27.007, 0..65535, INT_MAX if unknown */
-} RIL_CellIdentityGsm;
-
-/** RIL_CellIdentityWcdma */
-typedef struct {
- int mcc; /* 3-digit Mobile Country Code, 0..999, INT_MAX if unknown */
- int mnc; /* 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if unknown */
- int lac; /* 16-bit Location Area Code, 0..65535, INT_MAX if unknown */
- int cid; /* 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown */
- int psc; /* 9-bit UMTS Primary Scrambling Code described in TS 25.331, 0..511, INT_MAX if unknown */
-} RIL_CellIdentityWcdma;
-
-/** RIL_CellIdentityCdma */
-typedef struct {
- int networkId; /* Network Id 0..65535, INT_MAX if unknown */
- int systemId; /* CDMA System Id 0..32767, INT_MAX if unknown */
- int basestationId; /* Base Station Id 0..65535, INT_MAX if unknown */
- int longitude; /* Longitude is a decimal number as specified in 3GPP2 C.S0005-A v6.0.
- * It is represented in units of 0.25 seconds and ranges from -2592000
- * to 2592000, both values inclusive (corresponding to a range of -180
- * to +180 degrees). INT_MAX if unknown */
-
- int latitude; /* Latitude is a decimal number as specified in 3GPP2 C.S0005-A v6.0.
- * It is represented in units of 0.25 seconds and ranges from -1296000
- * to 1296000, both values inclusive (corresponding to a range of -90
- * to +90 degrees). INT_MAX if unknown */
-} RIL_CellIdentityCdma;
-
-/** RIL_CellIdentityLte */
-typedef struct {
- int mcc; /* 3-digit Mobile Country Code, 0..999, INT_MAX if unknown */
- int mnc; /* 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if unknown */
- int ci; /* 28-bit Cell Identity described in TS ???, INT_MAX if unknown */
- int pci; /* physical cell id 0..503, INT_MAX if unknown */
- int tac; /* 16-bit tracking area code, INT_MAX if unknown */
-} RIL_CellIdentityLte;
-
-/** RIL_CellIdentityTdscdma */
-typedef struct {
- int mcc; /* 3-digit Mobile Country Code, 0..999, INT_MAX if unknown */
- int mnc; /* 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if unknown */
- int lac; /* 16-bit Location Area Code, 0..65535, INT_MAX if unknown */
- int cid; /* 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown */
- int cpid; /* 8-bit Cell Parameters ID described in TS 25.331, 0..127, INT_MAX if unknown */
-} RIL_CellIdentityTdscdma;
-
-/** RIL_CellInfoGsm */
-typedef struct {
- RIL_CellIdentityGsm cellIdentityGsm;
- RIL_GW_SignalStrength signalStrengthGsm;
-} RIL_CellInfoGsm;
-
-/** RIL_CellInfoWcdma */
-typedef struct {
- RIL_CellIdentityWcdma cellIdentityWcdma;
- RIL_SignalStrengthWcdma signalStrengthWcdma;
-} RIL_CellInfoWcdma;
-
-/** RIL_CellInfoCdma */
-typedef struct {
- RIL_CellIdentityCdma cellIdentityCdma;
- RIL_CDMA_SignalStrength signalStrengthCdma;
- RIL_EVDO_SignalStrength signalStrengthEvdo;
-} RIL_CellInfoCdma;
-
-/** RIL_CellInfoLte */
-typedef struct {
- RIL_CellIdentityLte cellIdentityLte;
- RIL_LTE_SignalStrength_v8 signalStrengthLte;
-} RIL_CellInfoLte;
-
-/** RIL_CellInfoTdscdma */
-typedef struct {
- RIL_CellIdentityTdscdma cellIdentityTdscdma;
- RIL_TD_SCDMA_SignalStrength signalStrengthTdscdma;
-} RIL_CellInfoTdscdma;
-
-// Must be the same as CellInfo.TYPE_XXX
-typedef enum {
- RIL_CELL_INFO_TYPE_GSM = 1,
- RIL_CELL_INFO_TYPE_CDMA = 2,
- RIL_CELL_INFO_TYPE_LTE = 3,
- RIL_CELL_INFO_TYPE_WCDMA = 4,
- RIL_CELL_INFO_TYPE_TD_SCDMA = 5
-} RIL_CellInfoType;
-
-// Must be the same as CellInfo.TIMESTAMP_TYPE_XXX
-typedef enum {
- RIL_TIMESTAMP_TYPE_UNKNOWN = 0,
- RIL_TIMESTAMP_TYPE_ANTENNA = 1,
- RIL_TIMESTAMP_TYPE_MODEM = 2,
- RIL_TIMESTAMP_TYPE_OEM_RIL = 3,
- RIL_TIMESTAMP_TYPE_JAVA_RIL = 4,
-} RIL_TimeStampType;
-
-typedef struct {
- RIL_CellInfoType cellInfoType; /* cell type for selecting from union CellInfo */
- int registered; /* !0 if this cell is registered 0 if not registered */
- RIL_TimeStampType timeStampType; /* type of time stamp represented by timeStamp */
- uint64_t timeStamp; /* Time in nanos as returned by ril_nano_time */
- union {
- RIL_CellInfoGsm gsm;
- RIL_CellInfoCdma cdma;
- RIL_CellInfoLte lte;
- RIL_CellInfoWcdma wcdma;
- RIL_CellInfoTdscdma tdscdma;
- } CellInfo;
-} RIL_CellInfo;
-
-/* Names of the CDMA info records (C.S0005 section 3.7.5) */
-typedef enum {
- RIL_CDMA_DISPLAY_INFO_REC,
- RIL_CDMA_CALLED_PARTY_NUMBER_INFO_REC,
- RIL_CDMA_CALLING_PARTY_NUMBER_INFO_REC,
- RIL_CDMA_CONNECTED_NUMBER_INFO_REC,
- RIL_CDMA_SIGNAL_INFO_REC,
- RIL_CDMA_REDIRECTING_NUMBER_INFO_REC,
- RIL_CDMA_LINE_CONTROL_INFO_REC,
- RIL_CDMA_EXTENDED_DISPLAY_INFO_REC,
- RIL_CDMA_T53_CLIR_INFO_REC,
- RIL_CDMA_T53_RELEASE_INFO_REC,
- RIL_CDMA_T53_AUDIO_CONTROL_INFO_REC
-} RIL_CDMA_InfoRecName;
-
-/* Display Info Rec as defined in C.S0005 section 3.7.5.1
- Extended Display Info Rec as defined in C.S0005 section 3.7.5.16
- Note: the Extended Display info rec contains multiple records of the
- form: display_tag, display_len, and display_len occurrences of the
- chari field if the display_tag is not 10000000 or 10000001.
- To save space, the records are stored consecutively in a byte buffer.
- The display_tag, display_len and chari fields are all 1 byte.
-*/
-
-typedef struct {
- char alpha_len;
- char alpha_buf[CDMA_ALPHA_INFO_BUFFER_LENGTH];
-} RIL_CDMA_DisplayInfoRecord;
-
-/* Called Party Number Info Rec as defined in C.S0005 section 3.7.5.2
- Calling Party Number Info Rec as defined in C.S0005 section 3.7.5.3
- Connected Number Info Rec as defined in C.S0005 section 3.7.5.4
-*/
-
-typedef struct {
- char len;
- char buf[CDMA_NUMBER_INFO_BUFFER_LENGTH];
- char number_type;
- char number_plan;
- char pi;
- char si;
-} RIL_CDMA_NumberInfoRecord;
-
-/* Redirecting Number Information Record as defined in C.S0005 section 3.7.5.11 */
-typedef enum {
- RIL_REDIRECTING_REASON_UNKNOWN = 0,
- RIL_REDIRECTING_REASON_CALL_FORWARDING_BUSY = 1,
- RIL_REDIRECTING_REASON_CALL_FORWARDING_NO_REPLY = 2,
- RIL_REDIRECTING_REASON_CALLED_DTE_OUT_OF_ORDER = 9,
- RIL_REDIRECTING_REASON_CALL_FORWARDING_BY_THE_CALLED_DTE = 10,
- RIL_REDIRECTING_REASON_CALL_FORWARDING_UNCONDITIONAL = 15,
- RIL_REDIRECTING_REASON_RESERVED
-} RIL_CDMA_RedirectingReason;
-
-typedef struct {
- RIL_CDMA_NumberInfoRecord redirectingNumber;
- /* redirectingReason is set to RIL_REDIRECTING_REASON_UNKNOWN if not included */
- RIL_CDMA_RedirectingReason redirectingReason;
-} RIL_CDMA_RedirectingNumberInfoRecord;
-
-/* Line Control Information Record as defined in C.S0005 section 3.7.5.15 */
-typedef struct {
- char lineCtrlPolarityIncluded;
- char lineCtrlToggle;
- char lineCtrlReverse;
- char lineCtrlPowerDenial;
-} RIL_CDMA_LineControlInfoRecord;
-
-/* T53 CLIR Information Record */
-typedef struct {
- char cause;
-} RIL_CDMA_T53_CLIRInfoRecord;
-
-/* T53 Audio Control Information Record */
-typedef struct {
- char upLink;
- char downLink;
-} RIL_CDMA_T53_AudioControlInfoRecord;
-
-typedef struct {
-
- RIL_CDMA_InfoRecName name;
-
- union {
- /* Display and Extended Display Info Rec */
- RIL_CDMA_DisplayInfoRecord display;
-
- /* Called Party Number, Calling Party Number, Connected Number Info Rec */
- RIL_CDMA_NumberInfoRecord number;
-
- /* Signal Info Rec */
- RIL_CDMA_SignalInfoRecord signal;
-
- /* Redirecting Number Info Rec */
- RIL_CDMA_RedirectingNumberInfoRecord redir;
-
- /* Line Control Info Rec */
- RIL_CDMA_LineControlInfoRecord lineCtrl;
-
- /* T53 CLIR Info Rec */
- RIL_CDMA_T53_CLIRInfoRecord clir;
-
- /* T53 Audio Control Info Rec */
- RIL_CDMA_T53_AudioControlInfoRecord audioCtrl;
- } rec;
-} RIL_CDMA_InformationRecord;
-
-#define RIL_CDMA_MAX_NUMBER_OF_INFO_RECS 10
-
-typedef struct {
- char numberOfInfoRecs;
- RIL_CDMA_InformationRecord infoRec[RIL_CDMA_MAX_NUMBER_OF_INFO_RECS];
-} RIL_CDMA_InformationRecords;
-
-/* See RIL_REQUEST_NV_READ_ITEM */
-typedef struct {
- RIL_NV_Item itemID;
-} RIL_NV_ReadItem;
-
-/* See RIL_REQUEST_NV_WRITE_ITEM */
-typedef struct {
- RIL_NV_Item itemID;
- char * value;
-} RIL_NV_WriteItem;
-
-typedef enum {
- HANDOVER_STARTED = 0,
- HANDOVER_COMPLETED = 1,
- HANDOVER_FAILED = 2,
- HANDOVER_CANCELED = 3
-} RIL_SrvccState;
-
-/* hardware configuration reported to RILJ. */
-typedef enum {
- RIL_HARDWARE_CONFIG_MODEM = 0,
- RIL_HARDWARE_CONFIG_SIM = 1,
-} RIL_HardwareConfig_Type;
-
-typedef enum {
- RIL_HARDWARE_CONFIG_STATE_ENABLED = 0,
- RIL_HARDWARE_CONFIG_STATE_STANDBY = 1,
- RIL_HARDWARE_CONFIG_STATE_DISABLED = 2,
-} RIL_HardwareConfig_State;
-
-typedef struct {
- int rilModel;
- uint32_t rat; /* bitset - ref. RIL_RadioTechnology. */
- int maxVoice;
- int maxData;
- int maxStandby;
-} RIL_HardwareConfig_Modem;
-
-typedef struct {
- char modemUuid[MAX_UUID_LENGTH];
-} RIL_HardwareConfig_Sim;
-
-typedef struct {
- RIL_HardwareConfig_Type type;
- char uuid[MAX_UUID_LENGTH];
- RIL_HardwareConfig_State state;
- union {
- RIL_HardwareConfig_Modem modem;
- RIL_HardwareConfig_Sim sim;
- } cfg;
-} RIL_HardwareConfig;
-
-typedef enum {
- SS_CFU,
- SS_CF_BUSY,
- SS_CF_NO_REPLY,
- SS_CF_NOT_REACHABLE,
- SS_CF_ALL,
- SS_CF_ALL_CONDITIONAL,
- SS_CLIP,
- SS_CLIR,
- SS_COLP,
- SS_COLR,
- SS_WAIT,
- SS_BAOC,
- SS_BAOIC,
- SS_BAOIC_EXC_HOME,
- SS_BAIC,
- SS_BAIC_ROAMING,
- SS_ALL_BARRING,
- SS_OUTGOING_BARRING,
- SS_INCOMING_BARRING
-} RIL_SsServiceType;
-
-typedef enum {
- SS_ACTIVATION,
- SS_DEACTIVATION,
- SS_INTERROGATION,
- SS_REGISTRATION,
- SS_ERASURE
-} RIL_SsRequestType;
-
-typedef enum {
- SS_ALL_TELE_AND_BEARER_SERVICES,
- SS_ALL_TELESEVICES,
- SS_TELEPHONY,
- SS_ALL_DATA_TELESERVICES,
- SS_SMS_SERVICES,
- SS_ALL_TELESERVICES_EXCEPT_SMS
-} RIL_SsTeleserviceType;
-
-#define SS_INFO_MAX 4
-#define NUM_SERVICE_CLASSES 7
-
-typedef struct {
- int numValidIndexes; /* This gives the number of valid values in cfInfo.
- For example if voice is forwarded to one number and data
- is forwarded to a different one then numValidIndexes will be
- 2 indicating total number of valid values in cfInfo.
- Similarly if all the services are forwarded to the same
- number then the value of numValidIndexes will be 1. */
-
- RIL_CallForwardInfo cfInfo[NUM_SERVICE_CLASSES]; /* This is the response data
- for SS request to query call
- forward status. see
- RIL_REQUEST_QUERY_CALL_FORWARD_STATUS */
-} RIL_CfData;
-
-typedef struct {
- RIL_SsServiceType serviceType;
- RIL_SsRequestType requestType;
- RIL_SsTeleserviceType teleserviceType;
- int serviceClass;
- RIL_Errno result;
-
- union {
- int ssInfo[SS_INFO_MAX]; /* This is the response data for most of the SS GET/SET
- RIL requests. E.g. RIL_REQUSET_GET_CLIR returns
- two ints, so first two values of ssInfo[] will be
- used for response if serviceType is SS_CLIR and
- requestType is SS_INTERROGATION */
-
- RIL_CfData cfData;
- };
-} RIL_StkCcUnsolSsResponse;
-
-/**
- * Data connection power state
- */
-typedef enum {
- RIL_DC_POWER_STATE_LOW = 1, // Low power state
- RIL_DC_POWER_STATE_MEDIUM = 2, // Medium power state
- RIL_DC_POWER_STATE_HIGH = 3, // High power state
- RIL_DC_POWER_STATE_UNKNOWN = INT32_MAX // Unknown state
-} RIL_DcPowerStates;
-
-/**
- * Data connection real time info
- */
-typedef struct {
- uint64_t time; // Time in nanos as returned by ril_nano_time
- RIL_DcPowerStates powerState; // Current power state
-} RIL_DcRtInfo;
-
-/**
- * Data profile to modem
- */
-typedef struct {
- /* id of the data profile */
- int profileId;
- /* the APN to connect to */
- char* apn;
- /** one of the PDP_type values in TS 27.007 section 10.1.1.
- * For example, "IP", "IPV6", "IPV4V6", or "PPP".
- */
- char* protocol;
- /** authentication protocol used for this PDP context
- * (None: 0, PAP: 1, CHAP: 2, PAP&CHAP: 3)
- */
- int authType;
- /* the username for APN, or NULL */
- char* user;
- /* the password for APN, or NULL */
- char* password;
- /* the profile type, TYPE_COMMON-0, TYPE_3GPP-1, TYPE_3GPP2-2 */
- int type;
- /* the period in seconds to limit the maximum connections */
- int maxConnsTime;
- /* the maximum connections during maxConnsTime */
- int maxConns;
- /** the required wait time in seconds after a successful UE initiated
- * disconnect of a given PDN connection before the device can send
- * a new PDN connection request for that given PDN
- */
- int waitTime;
- /* true to enable the profile, 0 to disable, 1 to enable */
- int enabled;
-} RIL_DataProfileInfo;
-
-/* Tx Power Levels */
-#define RIL_NUM_TX_POWER_LEVELS 5
-
-typedef struct {
-
- /* period (in ms) when modem is power collapsed */
- uint32_t sleep_mode_time_ms;
-
- /* period (in ms) when modem is awake and in idle mode*/
- uint32_t idle_mode_time_ms;
-
- /* period (in ms) for which Tx is active */
- uint32_t tx_mode_time_ms[RIL_NUM_TX_POWER_LEVELS];
-
- /* period (in ms) for which Rx is active */
- uint32_t rx_mode_time_ms;
-} RIL_ActivityStatsInfo;
-
-/**
- * RIL_REQUEST_GET_SIM_STATUS
- *
- * Requests status of the SIM interface and the SIM card
- *
- * "data" is NULL
- *
- * "response" is const RIL_CardStatus_v6 *
- *
- * Valid errors:
- * Must never fail
- */
-#define RIL_REQUEST_GET_SIM_STATUS 1
-
-/**
- * RIL_REQUEST_ENTER_SIM_PIN
- *
- * Supplies SIM PIN. Only called if RIL_CardStatus has RIL_APPSTATE_PIN state
- *
- * "data" is const char **
- * ((const char **)data)[0] is PIN value
- * ((const char **)data)[1] is AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value.
- *
- * "response" is int *
- * ((int *)response)[0] is the number of retries remaining, or -1 if unknown
- *
- * Valid errors:
- *
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- * PASSWORD_INCORRECT
- */
-
-#define RIL_REQUEST_ENTER_SIM_PIN 2
-
-/**
- * RIL_REQUEST_ENTER_SIM_PUK
- *
- * Supplies SIM PUK and new PIN.
- *
- * "data" is const char **
- * ((const char **)data)[0] is PUK value
- * ((const char **)data)[1] is new PIN value
- * ((const char **)data)[2] is AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value.
- *
- * "response" is int *
- * ((int *)response)[0] is the number of retries remaining, or -1 if unknown
- *
- * Valid errors:
- *
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- * PASSWORD_INCORRECT
- * (PUK is invalid)
- */
-
-#define RIL_REQUEST_ENTER_SIM_PUK 3
-
-/**
- * RIL_REQUEST_ENTER_SIM_PIN2
- *
- * Supplies SIM PIN2. Only called following operation where SIM_PIN2 was
- * returned as a a failure from a previous operation.
- *
- * "data" is const char **
- * ((const char **)data)[0] is PIN2 value
- * ((const char **)data)[1] is AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value.
- *
- * "response" is int *
- * ((int *)response)[0] is the number of retries remaining, or -1 if unknown
- *
- * Valid errors:
- *
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- * PASSWORD_INCORRECT
- */
-
-#define RIL_REQUEST_ENTER_SIM_PIN2 4
-
-/**
- * RIL_REQUEST_ENTER_SIM_PUK2
- *
- * Supplies SIM PUK2 and new PIN2.
- *
- * "data" is const char **
- * ((const char **)data)[0] is PUK2 value
- * ((const char **)data)[1] is new PIN2 value
- * ((const char **)data)[2] is AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value.
- *
- * "response" is int *
- * ((int *)response)[0] is the number of retries remaining, or -1 if unknown
- *
- * Valid errors:
- *
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- * PASSWORD_INCORRECT
- * (PUK2 is invalid)
- */
-
-#define RIL_REQUEST_ENTER_SIM_PUK2 5
-
-/**
- * RIL_REQUEST_CHANGE_SIM_PIN
- *
- * Supplies old SIM PIN and new PIN.
- *
- * "data" is const char **
- * ((const char **)data)[0] is old PIN value
- * ((const char **)data)[1] is new PIN value
- * ((const char **)data)[2] is AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value.
- *
- * "response" is int *
- * ((int *)response)[0] is the number of retries remaining, or -1 if unknown
- *
- * Valid errors:
- *
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- * PASSWORD_INCORRECT
- * (old PIN is invalid)
- *
- */
-
-#define RIL_REQUEST_CHANGE_SIM_PIN 6
-
-
-/**
- * RIL_REQUEST_CHANGE_SIM_PIN2
- *
- * Supplies old SIM PIN2 and new PIN2.
- *
- * "data" is const char **
- * ((const char **)data)[0] is old PIN2 value
- * ((const char **)data)[1] is new PIN2 value
- * ((const char **)data)[2] is AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value.
- *
- * "response" is int *
- * ((int *)response)[0] is the number of retries remaining, or -1 if unknown
- *
- * Valid errors:
- *
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- * PASSWORD_INCORRECT
- * (old PIN2 is invalid)
- *
- */
-
-#define RIL_REQUEST_CHANGE_SIM_PIN2 7
-
-/**
- * RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION
- *
- * Requests that network personlization be deactivated
- *
- * "data" is const char **
- * ((const char **)(data))[0]] is network depersonlization code
- *
- * "response" is int *
- * ((int *)response)[0] is the number of retries remaining, or -1 if unknown
- *
- * Valid errors:
- *
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- * PASSWORD_INCORRECT
- * (code is invalid)
- */
-
-#define RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION 8
-
-/**
- * RIL_REQUEST_GET_CURRENT_CALLS
- *
- * Requests current call list
- *
- * "data" is NULL
- *
- * "response" must be a "const RIL_Call **"
- *
- * Valid errors:
- *
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- * (request will be made again in a few hundred msec)
- */
-
-#define RIL_REQUEST_GET_CURRENT_CALLS 9
-
-
-/**
- * RIL_REQUEST_DIAL
- *
- * Initiate voice call
- *
- * "data" is const RIL_Dial *
- * "response" is NULL
- *
- * This method is never used for supplementary service codes
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * DIAL_MODIFIED_TO_USSD
- * DIAL_MODIFIED_TO_SS
- * DIAL_MODIFIED_TO_DIAL
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_DIAL 10
-
-/**
- * RIL_REQUEST_GET_IMSI
- *
- * Get the SIM IMSI
- *
- * Only valid when radio state is "RADIO_STATE_ON"
- *
- * "data" is const char **
- * ((const char **)data)[0] is AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value.
- * "response" is a const char * containing the IMSI
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- */
-
-#define RIL_REQUEST_GET_IMSI 11
-
-/**
- * RIL_REQUEST_HANGUP
- *
- * Hang up a specific line (like AT+CHLD=1x)
- *
- * After this HANGUP request returns, RIL should show the connection is NOT
- * active anymore in next RIL_REQUEST_GET_CURRENT_CALLS query.
- *
- * "data" is an int *
- * (int *)data)[0] contains Connection index (value of 'x' in CHLD above)
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- */
-
-#define RIL_REQUEST_HANGUP 12
-
-/**
- * RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND
- *
- * Hang up waiting or held (like AT+CHLD=0)
- *
- * After this HANGUP request returns, RIL should show the connection is NOT
- * active anymore in next RIL_REQUEST_GET_CURRENT_CALLS query.
- *
- * "data" is NULL
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- */
-
-#define RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND 13
-
-/**
- * RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND
- *
- * Hang up waiting or held (like AT+CHLD=1)
- *
- * After this HANGUP request returns, RIL should show the connection is NOT
- * active anymore in next RIL_REQUEST_GET_CURRENT_CALLS query.
- *
- * "data" is NULL
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- */
-
-#define RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND 14
-
-/**
- * RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE
- *
- * Switch waiting or holding call and active call (like AT+CHLD=2)
- *
- * State transitions should be is follows:
- *
- * If call 1 is waiting and call 2 is active, then if this re
- *
- * BEFORE AFTER
- * Call 1 Call 2 Call 1 Call 2
- * ACTIVE HOLDING HOLDING ACTIVE
- * ACTIVE WAITING HOLDING ACTIVE
- * HOLDING WAITING HOLDING ACTIVE
- * ACTIVE IDLE HOLDING IDLE
- * IDLE IDLE IDLE IDLE
- *
- * "data" is NULL
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- */
-
-#define RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE 15
-#define RIL_REQUEST_SWITCH_HOLDING_AND_ACTIVE 15
-
-/**
- * RIL_REQUEST_CONFERENCE
- *
- * Conference holding and active (like AT+CHLD=3)
-
- * "data" is NULL
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_CONFERENCE 16
-
-/**
- * RIL_REQUEST_UDUB
- *
- * Send UDUB (user determined used busy) to ringing or
- * waiting call answer)(RIL_BasicRequest r);
- *
- * "data" is NULL
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_UDUB 17
-
-/**
- * RIL_REQUEST_LAST_CALL_FAIL_CAUSE
- *
- * Requests the failure cause code for the most recently terminated call
- *
- * "data" is NULL
- * "response" is a "int *"
- * ((int *)response)[0] is RIL_LastCallFailCause. GSM failure reasons are
- * mapped to cause codes defined in TS 24.008 Annex H where possible. CDMA
- * failure reasons are derived from the possible call failure scenarios
- * described in the "CDMA IS-2000 Release A (C.S0005-A v6.0)" standard.
- *
- * The implementation should return CALL_FAIL_ERROR_UNSPECIFIED for blocked
- * MO calls by restricted state (See RIL_UNSOL_RESTRICTED_STATE_CHANGED)
- *
- * If the implementation does not have access to the exact cause codes,
- * then it should return one of the values listed in RIL_LastCallFailCause,
- * as the UI layer needs to distinguish these cases for tone generation or
- * error notification.
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- * See also: RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE
- */
-#define RIL_REQUEST_LAST_CALL_FAIL_CAUSE 18
-
-/**
- * RIL_REQUEST_SIGNAL_STRENGTH
- *
- * Requests current signal strength and associated information
- *
- * Must succeed if radio is on.
- *
- * "data" is NULL
- *
- * "response" is a const RIL_SignalStrength *
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- */
-#define RIL_REQUEST_SIGNAL_STRENGTH 19
-
-/**
- * RIL_REQUEST_VOICE_REGISTRATION_STATE
- *
- * Request current registration state
- *
- * "data" is NULL
- * "response" is a "char **"
- * ((const char **)response)[0] is registration state 0-6,
- * 0 - Not registered, MT is not currently searching
- * a new operator to register
- * 1 - Registered, home network
- * 2 - Not registered, but MT is currently searching
- * a new operator to register
- * 3 - Registration denied
- * 4 - Unknown
- * 5 - Registered, roaming
- * 10 - Same as 0, but indicates that emergency calls
- * are enabled.
- * 12 - Same as 2, but indicates that emergency calls
- * are enabled.
- * 13 - Same as 3, but indicates that emergency calls
- * are enabled.
- * 14 - Same as 4, but indicates that emergency calls
- * are enabled.
- *
- * ((const char **)response)[1] is LAC if registered on a GSM/WCDMA system or
- * NULL if not.Valid LAC are 0x0000 - 0xffff
- * ((const char **)response)[2] is CID if registered on a * GSM/WCDMA or
- * NULL if not.
- * Valid CID are 0x00000000 - 0xffffffff
- * In GSM, CID is Cell ID (see TS 27.007)
- * in 16 bits
- * In UMTS, CID is UMTS Cell Identity
- * (see TS 25.331) in 28 bits
- * ((const char **)response)[3] indicates the available voice radio technology,
- * valid values as defined by RIL_RadioTechnology.
- * ((const char **)response)[4] is Base Station ID if registered on a CDMA
- * system or NULL if not. Base Station ID in
- * decimal format
- * ((const char **)response)[5] is Base Station latitude if registered on a
- * CDMA system or NULL if not. Base Station
- * latitude is a decimal number as specified in
- * 3GPP2 C.S0005-A v6.0. It is represented in
- * units of 0.25 seconds and ranges from -1296000
- * to 1296000, both values inclusive (corresponding
- * to a range of -90 to +90 degrees).
- * ((const char **)response)[6] is Base Station longitude if registered on a
- * CDMA system or NULL if not. Base Station
- * longitude is a decimal number as specified in
- * 3GPP2 C.S0005-A v6.0. It is represented in
- * units of 0.25 seconds and ranges from -2592000
- * to 2592000, both values inclusive (corresponding
- * to a range of -180 to +180 degrees).
- * ((const char **)response)[7] is concurrent services support indicator if
- * registered on a CDMA system 0-1.
- * 0 - Concurrent services not supported,
- * 1 - Concurrent services supported
- * ((const char **)response)[8] is System ID if registered on a CDMA system or
- * NULL if not. Valid System ID are 0 - 32767
- * ((const char **)response)[9] is Network ID if registered on a CDMA system or
- * NULL if not. Valid System ID are 0 - 65535
- * ((const char **)response)[10] is the TSB-58 Roaming Indicator if registered
- * on a CDMA or EVDO system or NULL if not. Valid values
- * are 0-255.
- * ((const char **)response)[11] indicates whether the current system is in the
- * PRL if registered on a CDMA or EVDO system or NULL if
- * not. 0=not in the PRL, 1=in the PRL
- * ((const char **)response)[12] is the default Roaming Indicator from the PRL,
- * if registered on a CDMA or EVDO system or NULL if not.
- * Valid values are 0-255.
- * ((const char **)response)[13] if registration state is 3 (Registration
- * denied) this is an enumerated reason why
- * registration was denied. See 3GPP TS 24.008,
- * 10.5.3.6 and Annex G.
- * 0 - General
- * 1 - Authentication Failure
- * 2 - IMSI unknown in HLR
- * 3 - Illegal MS
- * 4 - Illegal ME
- * 5 - PLMN not allowed
- * 6 - Location area not allowed
- * 7 - Roaming not allowed
- * 8 - No Suitable Cells in this Location Area
- * 9 - Network failure
- * 10 - Persistent location update reject
- * 11 - PLMN not allowed
- * 12 - Location area not allowed
- * 13 - Roaming not allowed in this Location Area
- * 15 - No Suitable Cells in this Location Area
- * 17 - Network Failure
- * 20 - MAC Failure
- * 21 - Sync Failure
- * 22 - Congestion
- * 23 - GSM Authentication unacceptable
- * 25 - Not Authorized for this CSG
- * 32 - Service option not supported
- * 33 - Requested service option not subscribed
- * 34 - Service option temporarily out of order
- * 38 - Call cannot be identified
- * 48-63 - Retry upon entry into a new cell
- * 95 - Semantically incorrect message
- * 96 - Invalid mandatory information
- * 97 - Message type non-existent or not implemented
- * 98 - Message not compatible with protocol state
- * 99 - Information element non-existent or not implemented
- * 100 - Conditional IE error
- * 101 - Message not compatible with protocol state
- * 111 - Protocol error, unspecified
- * ((const char **)response)[14] is the Primary Scrambling Code of the current
- * cell as described in TS 25.331, in hexadecimal
- * format, or NULL if unknown or not registered
- * to a UMTS network.
- *
- * Please note that registration state 4 ("unknown") is treated
- * as "out of service" in the Android telephony system
- *
- * Registration state 3 can be returned if Location Update Reject
- * (with cause 17 - Network Failure) is received repeatedly from the network,
- * to facilitate "managed roaming"
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_VOICE_REGISTRATION_STATE 20
-
-/**
- * RIL_REQUEST_DATA_REGISTRATION_STATE
- *
- * Request current DATA registration state
- *
- * "data" is NULL
- * "response" is a "char **"
- * ((const char **)response)[0] is registration state 0-5 from TS 27.007 10.1.20 AT+CGREG
- * ((const char **)response)[1] is LAC if registered or NULL if not
- * ((const char **)response)[2] is CID if registered or NULL if not
- * ((const char **)response)[3] indicates the available data radio technology,
- * valid values as defined by RIL_RadioTechnology.
- * ((const char **)response)[4] if registration state is 3 (Registration
- * denied) this is an enumerated reason why
- * registration was denied. See 3GPP TS 24.008,
- * Annex G.6 "Additonal cause codes for GMM".
- * 7 == GPRS services not allowed
- * 8 == GPRS services and non-GPRS services not allowed
- * 9 == MS identity cannot be derived by the network
- * 10 == Implicitly detached
- * 14 == GPRS services not allowed in this PLMN
- * 16 == MSC temporarily not reachable
- * 40 == No PDP context activated
- * ((const char **)response)[5] The maximum number of simultaneous Data Calls that can be
- * established using RIL_REQUEST_SETUP_DATA_CALL.
- *
- * The values at offsets 6..10 are optional LTE location information in decimal.
- * If a value is unknown that value may be NULL. If all values are NULL,
- * none need to be present.
- * ((const char **)response)[6] is TAC, a 16-bit Tracking Area Code.
- * ((const char **)response)[7] is CID, a 0-503 Physical Cell Identifier.
- * ((const char **)response)[8] is ECI, a 28-bit E-UTRAN Cell Identifier.
- * ((const char **)response)[9] is CSGID, a 27-bit Closed Subscriber Group Identity.
- * ((const char **)response)[10] is TADV, a 6-bit timing advance value.
- *
- * LAC and CID are in hexadecimal format.
- * valid LAC are 0x0000 - 0xffff
- * valid CID are 0x00000000 - 0x0fffffff
- *
- * Please note that registration state 4 ("unknown") is treated
- * as "out of service" in the Android telephony system
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_DATA_REGISTRATION_STATE 21
-
-/**
- * RIL_REQUEST_OPERATOR
- *
- * Request current operator ONS or EONS
- *
- * "data" is NULL
- * "response" is a "const char **"
- * ((const char **)response)[0] is long alpha ONS or EONS
- * or NULL if unregistered
- *
- * ((const char **)response)[1] is short alpha ONS or EONS
- * or NULL if unregistered
- * ((const char **)response)[2] is 5 or 6 digit numeric code (MCC + MNC)
- * or NULL if unregistered
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_OPERATOR 22
-
-/**
- * RIL_REQUEST_RADIO_POWER
- *
- * Toggle radio on and off (for "airplane" mode)
- * If the radio is is turned off/on the radio modem subsystem
- * is expected return to an initialized state. For instance,
- * any voice and data calls will be terminated and all associated
- * lists emptied.
- *
- * "data" is int *
- * ((int *)data)[0] is > 0 for "Radio On"
- * ((int *)data)[0] is == 0 for "Radio Off"
- *
- * "response" is NULL
- *
- * Turn radio on if "on" > 0
- * Turn radio off if "on" == 0
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_RADIO_POWER 23
-
-/**
- * RIL_REQUEST_DTMF
- *
- * Send a DTMF tone
- *
- * If the implementation is currently playing a tone requested via
- * RIL_REQUEST_DTMF_START, that tone should be cancelled and the new tone
- * should be played instead
- *
- * "data" is a char * containing a single character with one of 12 values: 0-9,*,#
- * "response" is NULL
- *
- * FIXME should this block/mute microphone?
- * How does this interact with local DTMF feedback?
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- * See also: RIL_REQUEST_DTMF_STOP, RIL_REQUEST_DTMF_START
- *
- */
-#define RIL_REQUEST_DTMF 24
-
-/**
- * RIL_REQUEST_SEND_SMS
- *
- * Send an SMS message
- *
- * "data" is const char **
- * ((const char **)data)[0] is SMSC address in GSM BCD format prefixed
- * by a length byte (as expected by TS 27.005) or NULL for default SMSC
- * ((const char **)data)[1] is SMS in PDU format as an ASCII hex string
- * less the SMSC address
- * TP-Layer-Length is be "strlen(((const char **)data)[1])/2"
- *
- * "response" is a const RIL_SMS_Response *
- *
- * Based on the return error, caller decides to resend if sending sms
- * fails. SMS_SEND_FAIL_RETRY means retry (i.e. error cause is 332)
- * and GENERIC_FAILURE means no retry (i.e. error cause is 500)
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * SMS_SEND_FAIL_RETRY
- * FDN_CHECK_FAILURE
- * GENERIC_FAILURE
- *
- * FIXME how do we specify TP-Message-Reference if we need to resend?
- */
-#define RIL_REQUEST_SEND_SMS 25
-
-
-/**
- * RIL_REQUEST_SEND_SMS_EXPECT_MORE
- *
- * Send an SMS message. Identical to RIL_REQUEST_SEND_SMS,
- * except that more messages are expected to be sent soon. If possible,
- * keep SMS relay protocol link open (eg TS 27.005 AT+CMMS command)
- *
- * "data" is const char **
- * ((const char **)data)[0] is SMSC address in GSM BCD format prefixed
- * by a length byte (as expected by TS 27.005) or NULL for default SMSC
- * ((const char **)data)[1] is SMS in PDU format as an ASCII hex string
- * less the SMSC address
- * TP-Layer-Length is be "strlen(((const char **)data)[1])/2"
- *
- * "response" is a const RIL_SMS_Response *
- *
- * Based on the return error, caller decides to resend if sending sms
- * fails. SMS_SEND_FAIL_RETRY means retry (i.e. error cause is 332)
- * and GENERIC_FAILURE means no retry (i.e. error cause is 500)
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * SMS_SEND_FAIL_RETRY
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_SEND_SMS_EXPECT_MORE 26
-
-
-/**
- * RIL_REQUEST_SETUP_DATA_CALL
- *
- * Setup a packet data connection. If RIL_Data_Call_Response_v6.status
- * return success it is added to the list of data calls and a
- * RIL_UNSOL_DATA_CALL_LIST_CHANGED is sent. The call remains in the
- * list until RIL_REQUEST_DEACTIVATE_DATA_CALL is issued or the
- * radio is powered off/on. This list is returned by RIL_REQUEST_DATA_CALL_LIST
- * and RIL_UNSOL_DATA_CALL_LIST_CHANGED.
- *
- * The RIL is expected to:
- * - Create one data call context.
- * - Create and configure a dedicated interface for the context
- * - The interface must be point to point.
- * - The interface is configured with one or more addresses and
- * is capable of sending and receiving packets. The prefix length
- * of the addresses must be /32 for IPv4 and /128 for IPv6.
- * - Must NOT change the linux routing table.
- * - Support up to RIL_REQUEST_DATA_REGISTRATION_STATE response[5]
- * number of simultaneous data call contexts.
- *
- * "data" is a const char **
- * ((const char **)data)[0] Radio technology to use: 0-CDMA, 1-GSM/UMTS, 2...
- * for values above 2 this is RIL_RadioTechnology + 2.
- * ((const char **)data)[1] is a RIL_DataProfile (support is optional)
- * ((const char **)data)[2] is the APN to connect to if radio technology is GSM/UMTS. This APN will
- * override the one in the profile. NULL indicates no APN overrride.
- * ((const char **)data)[3] is the username for APN, or NULL
- * ((const char **)data)[4] is the password for APN, or NULL
- * ((const char **)data)[5] is the PAP / CHAP auth type. Values:
- * 0 => PAP and CHAP is never performed.
- * 1 => PAP may be performed; CHAP is never performed.
- * 2 => CHAP may be performed; PAP is never performed.
- * 3 => PAP / CHAP may be performed - baseband dependent.
- * ((const char **)data)[6] is the connection type to request must be one of the
- * PDP_type values in TS 27.007 section 10.1.1.
- * For example, "IP", "IPV6", "IPV4V6", or "PPP".
- * ((const char **)data)[7] Optional connection property parameters, format to be defined.
- *
- * "response" is a RIL_Data_Call_Response_v11
- *
- * FIXME may need way to configure QoS settings
- *
- * Valid errors:
- * SUCCESS should be returned on both success and failure of setup with
- * the RIL_Data_Call_Response_v6.status containing the actual status.
- * For all other errors the RIL_Data_Call_Resonse_v6 is ignored.
- *
- * Other errors could include:
- * RADIO_NOT_AVAILABLE, GENERIC_FAILURE, OP_NOT_ALLOWED_BEFORE_REG_TO_NW,
- * OP_NOT_ALLOWED_DURING_VOICE_CALL and REQUEST_NOT_SUPPORTED.
- *
- * See also: RIL_REQUEST_DEACTIVATE_DATA_CALL
- */
-#define RIL_REQUEST_SETUP_DATA_CALL 27
-
-
-/**
- * RIL_REQUEST_SIM_IO
- *
- * Request SIM I/O operation.
- * This is similar to the TS 27.007 "restricted SIM" operation
- * where it assumes all of the EF selection will be done by the
- * callee.
- *
- * "data" is a const RIL_SIM_IO_v6 *
- * Please note that RIL_SIM_IO has a "PIN2" field which may be NULL,
- * or may specify a PIN2 for operations that require a PIN2 (eg
- * updating FDN records)
- *
- * "response" is a const RIL_SIM_IO_Response *
- *
- * Arguments and responses that are unused for certain
- * values of "command" should be ignored or set to NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- * SIM_PIN2
- * SIM_PUK2
- */
-#define RIL_REQUEST_SIM_IO 28
-
-/**
- * RIL_REQUEST_SEND_USSD
- *
- * Send a USSD message
- *
- * If a USSD session already exists, the message should be sent in the
- * context of that session. Otherwise, a new session should be created.
- *
- * The network reply should be reported via RIL_UNSOL_ON_USSD
- *
- * Only one USSD session may exist at a time, and the session is assumed
- * to exist until:
- * a) The android system invokes RIL_REQUEST_CANCEL_USSD
- * b) The implementation sends a RIL_UNSOL_ON_USSD with a type code
- * of "0" (USSD-Notify/no further action) or "2" (session terminated)
- *
- * "data" is a const char * containing the USSD request in UTF-8 format
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * FDN_CHECK_FAILURE
- * USSD_MODIFIED_TO_DIAL
- * USSD_MODIFIED_TO_SS
- * USSD_MODIFIED_TO_USSD
- * GENERIC_FAILURE
- *
- * See also: RIL_REQUEST_CANCEL_USSD, RIL_UNSOL_ON_USSD
- */
-
-#define RIL_REQUEST_SEND_USSD 29
-
-/**
- * RIL_REQUEST_CANCEL_USSD
- *
- * Cancel the current USSD session if one exists
- *
- * "data" is null
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-
-#define RIL_REQUEST_CANCEL_USSD 30
-
-/**
- * RIL_REQUEST_GET_CLIR
- *
- * Gets current CLIR status
- * "data" is NULL
- * "response" is int *
- * ((int *)data)[0] is "n" parameter from TS 27.007 7.7
- * ((int *)data)[1] is "m" parameter from TS 27.007 7.7
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * SS_MODIFIED_TO_DIAL
- * SS_MODIFIED_TO_USSD
- * SS_MODIFIED_TO_SS
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_GET_CLIR 31
-
-/**
- * RIL_REQUEST_SET_CLIR
- *
- * "data" is int *
- * ((int *)data)[0] is "n" parameter from TS 27.007 7.7
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * SS_MODIFIED_TO_DIAL
- * SS_MODIFIED_TO_USSD
- * SS_MODIFIED_TO_SS
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_SET_CLIR 32
-
-/**
- * RIL_REQUEST_QUERY_CALL_FORWARD_STATUS
- *
- * "data" is const RIL_CallForwardInfo *
- *
- * "response" is const RIL_CallForwardInfo **
- * "response" points to an array of RIL_CallForwardInfo *'s, one for
- * each distinct registered phone number.
- *
- * For example, if data is forwarded to +18005551212 and voice is forwarded
- * to +18005559999, then two separate RIL_CallForwardInfo's should be returned
- *
- * If, however, both data and voice are forwarded to +18005551212, then
- * a single RIL_CallForwardInfo can be returned with the service class
- * set to "data + voice = 3")
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * SS_MODIFIED_TO_DIAL
- * SS_MODIFIED_TO_USSD
- * SS_MODIFIED_TO_SS
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_QUERY_CALL_FORWARD_STATUS 33
-
-
-/**
- * RIL_REQUEST_SET_CALL_FORWARD
- *
- * Configure call forward rule
- *
- * "data" is const RIL_CallForwardInfo *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * SS_MODIFIED_TO_DIAL
- * SS_MODIFIED_TO_USSD
- * SS_MODIFIED_TO_SS
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_SET_CALL_FORWARD 34
-
-
-/**
- * RIL_REQUEST_QUERY_CALL_WAITING
- *
- * Query current call waiting state
- *
- * "data" is const int *
- * ((const int *)data)[0] is the TS 27.007 service class to query.
- * "response" is a const int *
- * ((const int *)response)[0] is 0 for "disabled" and 1 for "enabled"
- *
- * If ((const int *)response)[0] is = 1, then ((const int *)response)[1]
- * must follow, with the TS 27.007 service class bit vector of services
- * for which call waiting is enabled.
- *
- * For example, if ((const int *)response)[0] is 1 and
- * ((const int *)response)[1] is 3, then call waiting is enabled for data
- * and voice and disabled for everything else
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * SS_MODIFIED_TO_DIAL
- * SS_MODIFIED_TO_USSD
- * SS_MODIFIED_TO_SS
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_QUERY_CALL_WAITING 35
-
-
-/**
- * RIL_REQUEST_SET_CALL_WAITING
- *
- * Configure current call waiting state
- *
- * "data" is const int *
- * ((const int *)data)[0] is 0 for "disabled" and 1 for "enabled"
- * ((const int *)data)[1] is the TS 27.007 service class bit vector of
- * services to modify
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * SS_MODIFIED_TO_DIAL
- * SS_MODIFIED_TO_USSD
- * SS_MODIFIED_TO_SS
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_SET_CALL_WAITING 36
-
-/**
- * RIL_REQUEST_SMS_ACKNOWLEDGE
- *
- * Acknowledge successful or failed receipt of SMS previously indicated
- * via RIL_UNSOL_RESPONSE_NEW_SMS
- *
- * "data" is int *
- * ((int *)data)[0] is 1 on successful receipt
- * (basically, AT+CNMA=1 from TS 27.005
- * is 0 on failed receipt
- * (basically, AT+CNMA=2 from TS 27.005)
- * ((int *)data)[1] if data[0] is 0, this contains the failure cause as defined
- * in TS 23.040, 9.2.3.22. Currently only 0xD3 (memory
- * capacity exceeded) and 0xFF (unspecified error) are
- * reported.
- *
- * "response" is NULL
- *
- * FIXME would like request that specified RP-ACK/RP-ERROR PDU
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_SMS_ACKNOWLEDGE 37
-
-/**
- * RIL_REQUEST_GET_IMEI - DEPRECATED
- *
- * Get the device IMEI, including check digit
- *
- * The request is DEPRECATED, use RIL_REQUEST_DEVICE_IDENTITY
- * Valid when RadioState is not RADIO_STATE_UNAVAILABLE
- *
- * "data" is NULL
- * "response" is a const char * containing the IMEI
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- */
-
-#define RIL_REQUEST_GET_IMEI 38
-
-/**
- * RIL_REQUEST_GET_IMEISV - DEPRECATED
- *
- * Get the device IMEISV, which should be two decimal digits
- *
- * The request is DEPRECATED, use RIL_REQUEST_DEVICE_IDENTITY
- * Valid when RadioState is not RADIO_STATE_UNAVAILABLE
- *
- * "data" is NULL
- * "response" is a const char * containing the IMEISV
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- */
-
-#define RIL_REQUEST_GET_IMEISV 39
-
-
-/**
- * RIL_REQUEST_ANSWER
- *
- * Answer incoming call
- *
- * Will not be called for WAITING calls.
- * RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE will be used in this case
- * instead
- *
- * "data" is NULL
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- */
-
-#define RIL_REQUEST_ANSWER 40
-
-/**
- * RIL_REQUEST_DEACTIVATE_DATA_CALL
- *
- * Deactivate packet data connection and remove from the
- * data call list if SUCCESS is returned. Any other return
- * values should also try to remove the call from the list,
- * but that may not be possible. In any event a
- * RIL_REQUEST_RADIO_POWER off/on must clear the list. An
- * RIL_UNSOL_DATA_CALL_LIST_CHANGED is not expected to be
- * issued because of an RIL_REQUEST_DEACTIVATE_DATA_CALL.
- *
- * "data" is const char **
- * ((char**)data)[0] indicating CID
- * ((char**)data)[1] indicating Disconnect Reason
- * 0 => No specific reason specified
- * 1 => Radio shutdown requested
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- * See also: RIL_REQUEST_SETUP_DATA_CALL
- */
-#define RIL_REQUEST_DEACTIVATE_DATA_CALL 41
-
-/**
- * RIL_REQUEST_QUERY_FACILITY_LOCK
- *
- * Query the status of a facility lock state
- *
- * "data" is const char **
- * ((const char **)data)[0] is the facility string code from TS 27.007 7.4
- * (eg "AO" for BAOC, "SC" for SIM lock)
- * ((const char **)data)[1] is the password, or "" if not required
- * ((const char **)data)[2] is the TS 27.007 service class bit vector of
- * services to query
- * ((const char **)data)[3] is AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value.
- * This is only applicable in the case of Fixed Dialing Numbers
- * (FDN) requests.
- *
- * "response" is an int *
- * ((const int *)response) 0 is the TS 27.007 service class bit vector of
- * services for which the specified barring facility
- * is active. "0" means "disabled for all"
- *
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * SS_MODIFIED_TO_DIAL
- * SS_MODIFIED_TO_USSD
- * SS_MODIFIED_TO_SS
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_QUERY_FACILITY_LOCK 42
-
-/**
- * RIL_REQUEST_SET_FACILITY_LOCK
- *
- * Enable/disable one facility lock
- *
- * "data" is const char **
- *
- * ((const char **)data)[0] = facility string code from TS 27.007 7.4
- * (eg "AO" for BAOC)
- * ((const char **)data)[1] = "0" for "unlock" and "1" for "lock"
- * ((const char **)data)[2] = password
- * ((const char **)data)[3] = string representation of decimal TS 27.007
- * service class bit vector. Eg, the string
- * "1" means "set this facility for voice services"
- * ((const char **)data)[4] = AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value.
- * This is only applicable in the case of Fixed Dialing Numbers
- * (FDN) requests.
- *
- * "response" is int *
- * ((int *)response)[0] is the number of retries remaining, or -1 if unknown
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * SS_MODIFIED_TO_DIAL
- * SS_MODIFIED_TO_USSD
- * SS_MODIFIED_TO_SS
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_SET_FACILITY_LOCK 43
-
-/**
- * RIL_REQUEST_CHANGE_BARRING_PASSWORD
- *
- * Change call barring facility password
- *
- * "data" is const char **
- *
- * ((const char **)data)[0] = facility string code from TS 27.007 7.4
- * (eg "AO" for BAOC)
- * ((const char **)data)[1] = old password
- * ((const char **)data)[2] = new password
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * SS_MODIFIED_TO_DIAL
- * SS_MODIFIED_TO_USSD
- * SS_MODIFIED_TO_SS
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_CHANGE_BARRING_PASSWORD 44
-
-/**
- * RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE
- *
- * Query current network selectin mode
- *
- * "data" is NULL
- *
- * "response" is int *
- * ((const int *)response)[0] is
- * 0 for automatic selection
- * 1 for manual selection
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE 45
-
-/**
- * RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC
- *
- * Specify that the network should be selected automatically
- *
- * "data" is NULL
- * "response" is NULL
- *
- * This request must not respond until the new operator is selected
- * and registered
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * ILLEGAL_SIM_OR_ME
- * GENERIC_FAILURE
- *
- * Note: Returns ILLEGAL_SIM_OR_ME when the failure is permanent and
- * no retries needed, such as illegal SIM or ME.
- * Returns GENERIC_FAILURE for all other causes that might be
- * fixed by retries.
- *
- */
-#define RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC 46
-
-/**
- * RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL
- *
- * Manually select a specified network.
- *
- * "data" is const char * specifying MCCMNC of network to select (eg "310170")
- * "response" is NULL
- *
- * This request must not respond until the new operator is selected
- * and registered
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * ILLEGAL_SIM_OR_ME
- * GENERIC_FAILURE
- *
- * Note: Returns ILLEGAL_SIM_OR_ME when the failure is permanent and
- * no retries needed, such as illegal SIM or ME.
- * Returns GENERIC_FAILURE for all other causes that might be
- * fixed by retries.
- *
- */
-#define RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL 47
-
-/**
- * RIL_REQUEST_QUERY_AVAILABLE_NETWORKS
- *
- * Scans for available networks
- *
- * "data" is NULL
- * "response" is const char ** that should be an array of n*4 strings, where
- * n is the number of available networks
- * For each available network:
- *
- * ((const char **)response)[n+0] is long alpha ONS or EONS
- * ((const char **)response)[n+1] is short alpha ONS or EONS
- * ((const char **)response)[n+2] is 5 or 6 digit numeric code (MCC + MNC)
- * ((const char **)response)[n+3] is a string value of the status:
- * "unknown"
- * "available"
- * "current"
- * "forbidden"
- *
- * This request must not respond until the new operator is selected
- * and registered
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_QUERY_AVAILABLE_NETWORKS 48
-
-/**
- * RIL_REQUEST_DTMF_START
- *
- * Start playing a DTMF tone. Continue playing DTMF tone until
- * RIL_REQUEST_DTMF_STOP is received
- *
- * If a RIL_REQUEST_DTMF_START is received while a tone is currently playing,
- * it should cancel the previous tone and play the new one.
- *
- * "data" is a char *
- * ((char *)data)[0] is a single character with one of 12 values: 0-9,*,#
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- * See also: RIL_REQUEST_DTMF, RIL_REQUEST_DTMF_STOP
- */
-#define RIL_REQUEST_DTMF_START 49
-
-/**
- * RIL_REQUEST_DTMF_STOP
- *
- * Stop playing a currently playing DTMF tone.
- *
- * "data" is NULL
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- * See also: RIL_REQUEST_DTMF, RIL_REQUEST_DTMF_START
- */
-#define RIL_REQUEST_DTMF_STOP 50
-
-/**
- * RIL_REQUEST_BASEBAND_VERSION
- *
- * Return string value indicating baseband version, eg
- * response from AT+CGMR
- *
- * "data" is NULL
- * "response" is const char * containing version string for log reporting
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_BASEBAND_VERSION 51
-
-/**
- * RIL_REQUEST_SEPARATE_CONNECTION
- *
- * Separate a party from a multiparty call placing the multiparty call
- * (less the specified party) on hold and leaving the specified party
- * as the only other member of the current (active) call
- *
- * Like AT+CHLD=2x
- *
- * See TS 22.084 1.3.8.2 (iii)
- * TS 22.030 6.5.5 "Entering "2X followed by send"
- * TS 27.007 "AT+CHLD=2x"
- *
- * "data" is an int *
- * (int *)data)[0] contains Connection index (value of 'x' in CHLD above) "response" is NULL
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_SEPARATE_CONNECTION 52
-
-
-/**
- * RIL_REQUEST_SET_MUTE
- *
- * Turn on or off uplink (microphone) mute.
- *
- * Will only be sent while voice call is active.
- * Will always be reset to "disable mute" when a new voice call is initiated
- *
- * "data" is an int *
- * (int *)data)[0] is 1 for "enable mute" and 0 for "disable mute"
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- */
-
-#define RIL_REQUEST_SET_MUTE 53
-
-/**
- * RIL_REQUEST_GET_MUTE
- *
- * Queries the current state of the uplink mute setting
- *
- * "data" is NULL
- * "response" is an int *
- * (int *)response)[0] is 1 for "mute enabled" and 0 for "mute disabled"
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * SS_MODIFIED_TO_DIAL
- * SS_MODIFIED_TO_USSD
- * SS_MODIFIED_TO_SS
- * GENERIC_FAILURE
- */
-
-#define RIL_REQUEST_GET_MUTE 54
-
-/**
- * RIL_REQUEST_QUERY_CLIP
- *
- * Queries the status of the CLIP supplementary service
- *
- * (for MMI code "*#30#")
- *
- * "data" is NULL
- * "response" is an int *
- * (int *)response)[0] is 1 for "CLIP provisioned"
- * and 0 for "CLIP not provisioned"
- * and 2 for "unknown, e.g. no network etc"
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- */
-
-#define RIL_REQUEST_QUERY_CLIP 55
-
-/**
- * RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE - Deprecated use the status
- * field in RIL_Data_Call_Response_v6.
- *
- * Requests the failure cause code for the most recently failed PDP
- * context or CDMA data connection active
- * replaces RIL_REQUEST_LAST_PDP_FAIL_CAUSE
- *
- * "data" is NULL
- *
- * "response" is a "int *"
- * ((int *)response)[0] is an integer cause code defined in TS 24.008
- * section 6.1.3.1.3 or close approximation
- *
- * If the implementation does not have access to the exact cause codes,
- * then it should return one of the values listed in
- * RIL_DataCallFailCause, as the UI layer needs to distinguish these
- * cases for error notification
- * and potential retries.
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- * See also: RIL_REQUEST_LAST_CALL_FAIL_CAUSE
- *
- * Deprecated use the status field in RIL_Data_Call_Response_v6.
- */
-
-#define RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE 56
-
-/**
- * RIL_REQUEST_DATA_CALL_LIST
- *
- * Returns the data call list. An entry is added when a
- * RIL_REQUEST_SETUP_DATA_CALL is issued and removed on a
- * RIL_REQUEST_DEACTIVATE_DATA_CALL. The list is emptied
- * when RIL_REQUEST_RADIO_POWER off/on is issued.
- *
- * "data" is NULL
- * "response" is an array of RIL_Data_Call_Response_v6
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- *
- * See also: RIL_UNSOL_DATA_CALL_LIST_CHANGED
- */
-
-#define RIL_REQUEST_DATA_CALL_LIST 57
-
-/**
- * RIL_REQUEST_RESET_RADIO - DEPRECATED
- *
- * Request a radio reset. The RIL implementation may postpone
- * the reset until after this request is responded to if the baseband
- * is presently busy.
- *
- * The request is DEPRECATED, use RIL_REQUEST_RADIO_POWER
- *
- * "data" is NULL
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- * REQUEST_NOT_SUPPORTED
- */
-
-#define RIL_REQUEST_RESET_RADIO 58
-
-/**
- * RIL_REQUEST_OEM_HOOK_RAW
- *
- * This request reserved for OEM-specific uses. It passes raw byte arrays
- * back and forth.
- *
- * It can be invoked on the Java side from
- * com.android.internal.telephony.Phone.invokeOemRilRequestRaw()
- *
- * "data" is a char * of bytes copied from the byte[] data argument in java
- * "response" is a char * of bytes that will returned via the
- * caller's "response" Message here:
- * (byte[])(((AsyncResult)response.obj).result)
- *
- * An error response here will result in
- * (((AsyncResult)response.obj).result) == null and
- * (((AsyncResult)response.obj).exception) being an instance of
- * com.android.internal.telephony.gsm.CommandException
- *
- * Valid errors:
- * All
- */
-
-#define RIL_REQUEST_OEM_HOOK_RAW 59
-
-/**
- * RIL_REQUEST_OEM_HOOK_STRINGS
- *
- * This request reserved for OEM-specific uses. It passes strings
- * back and forth.
- *
- * It can be invoked on the Java side from
- * com.android.internal.telephony.Phone.invokeOemRilRequestStrings()
- *
- * "data" is a const char **, representing an array of null-terminated UTF-8
- * strings copied from the "String[] strings" argument to
- * invokeOemRilRequestStrings()
- *
- * "response" is a const char **, representing an array of null-terminated UTF-8
- * stings that will be returned via the caller's response message here:
- *
- * (String[])(((AsyncResult)response.obj).result)
- *
- * An error response here will result in
- * (((AsyncResult)response.obj).result) == null and
- * (((AsyncResult)response.obj).exception) being an instance of
- * com.android.internal.telephony.gsm.CommandException
- *
- * Valid errors:
- * All
- */
-
-#define RIL_REQUEST_OEM_HOOK_STRINGS 60
-
-/**
- * RIL_REQUEST_SCREEN_STATE
- *
- * Indicates the current state of the screen. When the screen is off, the
- * RIL should notify the baseband to suppress certain notifications (eg,
- * signal strength and changes in LAC/CID or BID/SID/NID/latitude/longitude)
- * in an effort to conserve power. These notifications should resume when the
- * screen is on.
- *
- * "data" is int *
- * ((int *)data)[0] is == 1 for "Screen On"
- * ((int *)data)[0] is == 0 for "Screen Off"
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_SCREEN_STATE 61
-
-
-/**
- * RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION
- *
- * Enables/disables supplementary service related notifications
- * from the network.
- *
- * Notifications are reported via RIL_UNSOL_SUPP_SVC_NOTIFICATION.
- *
- * "data" is int *
- * ((int *)data)[0] is == 1 for notifications enabled
- * ((int *)data)[0] is == 0 for notifications disabled
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- * See also: RIL_UNSOL_SUPP_SVC_NOTIFICATION.
- */
-#define RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION 62
-
-/**
- * RIL_REQUEST_WRITE_SMS_TO_SIM
- *
- * Stores a SMS message to SIM memory.
- *
- * "data" is RIL_SMS_WriteArgs *
- *
- * "response" is int *
- * ((const int *)response)[0] is the record index where the message is stored.
- *
- * Valid errors:
- * SUCCESS
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_WRITE_SMS_TO_SIM 63
-
-/**
- * RIL_REQUEST_DELETE_SMS_ON_SIM
- *
- * Deletes a SMS message from SIM memory.
- *
- * "data" is int *
- * ((int *)data)[0] is the record index of the message to delete.
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_DELETE_SMS_ON_SIM 64
-
-/**
- * RIL_REQUEST_SET_BAND_MODE
- *
- * Assign a specified band for RF configuration.
- *
- * "data" is int *
- * ((int *)data)[0] is == 0 for "unspecified" (selected by baseband automatically)
- * ((int *)data)[0] is == 1 for "EURO band" (GSM-900 / DCS-1800 / WCDMA-IMT-2000)
- * ((int *)data)[0] is == 2 for "US band" (GSM-850 / PCS-1900 / WCDMA-850 / WCDMA-PCS-1900)
- * ((int *)data)[0] is == 3 for "JPN band" (WCDMA-800 / WCDMA-IMT-2000)
- * ((int *)data)[0] is == 4 for "AUS band" (GSM-900 / DCS-1800 / WCDMA-850 / WCDMA-IMT-2000)
- * ((int *)data)[0] is == 5 for "AUS band 2" (GSM-900 / DCS-1800 / WCDMA-850)
- * ((int *)data)[0] is == 6 for "Cellular (800-MHz Band)"
- * ((int *)data)[0] is == 7 for "PCS (1900-MHz Band)"
- * ((int *)data)[0] is == 8 for "Band Class 3 (JTACS Band)"
- * ((int *)data)[0] is == 9 for "Band Class 4 (Korean PCS Band)"
- * ((int *)data)[0] is == 10 for "Band Class 5 (450-MHz Band)"
- * ((int *)data)[0] is == 11 for "Band Class 6 (2-GMHz IMT2000 Band)"
- * ((int *)data)[0] is == 12 for "Band Class 7 (Upper 700-MHz Band)"
- * ((int *)data)[0] is == 13 for "Band Class 8 (1800-MHz Band)"
- * ((int *)data)[0] is == 14 for "Band Class 9 (900-MHz Band)"
- * ((int *)data)[0] is == 15 for "Band Class 10 (Secondary 800-MHz Band)"
- * ((int *)data)[0] is == 16 for "Band Class 11 (400-MHz European PAMR Band)"
- * ((int *)data)[0] is == 17 for "Band Class 15 (AWS Band)"
- * ((int *)data)[0] is == 18 for "Band Class 16 (US 2.5-GHz Band)"
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_SET_BAND_MODE 65
-
-/**
- * RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE
- *
- * Query the list of band mode supported by RF.
- *
- * "data" is NULL
- *
- * "response" is int *
- * "response" points to an array of int's, the int[0] is the size of array, reset is one for
- * each available band mode.
- *
- * 0 for "unspecified" (selected by baseband automatically)
- * 1 for "EURO band" (GSM-900 / DCS-1800 / WCDMA-IMT-2000)
- * 2 for "US band" (GSM-850 / PCS-1900 / WCDMA-850 / WCDMA-PCS-1900)
- * 3 for "JPN band" (WCDMA-800 / WCDMA-IMT-2000)
- * 4 for "AUS band" (GSM-900 / DCS-1800 / WCDMA-850 / WCDMA-IMT-2000)
- * 5 for "AUS band 2" (GSM-900 / DCS-1800 / WCDMA-850)
- * 6 for "Cellular (800-MHz Band)"
- * 7 for "PCS (1900-MHz Band)"
- * 8 for "Band Class 3 (JTACS Band)"
- * 9 for "Band Class 4 (Korean PCS Band)"
- * 10 for "Band Class 5 (450-MHz Band)"
- * 11 for "Band Class 6 (2-GMHz IMT2000 Band)"
- * 12 for "Band Class 7 (Upper 700-MHz Band)"
- * 13 for "Band Class 8 (1800-MHz Band)"
- * 14 for "Band Class 9 (900-MHz Band)"
- * 15 for "Band Class 10 (Secondary 800-MHz Band)"
- * 16 for "Band Class 11 (400-MHz European PAMR Band)"
- * 17 for "Band Class 15 (AWS Band)"
- * 18 for "Band Class 16 (US 2.5-GHz Band)"
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- * See also: RIL_REQUEST_SET_BAND_MODE
- */
-#define RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE 66
-
-/**
- * RIL_REQUEST_STK_GET_PROFILE
- *
- * Requests the profile of SIM tool kit.
- * The profile indicates the SAT/USAT features supported by ME.
- * The SAT/USAT features refer to 3GPP TS 11.14 and 3GPP TS 31.111
- *
- * "data" is NULL
- *
- * "response" is a const char * containing SAT/USAT profile
- * in hexadecimal format string starting with first byte of terminal profile
- *
- * Valid errors:
- * RIL_E_SUCCESS
- * RIL_E_RADIO_NOT_AVAILABLE (radio resetting)
- * RIL_E_GENERIC_FAILURE
- */
-#define RIL_REQUEST_STK_GET_PROFILE 67
-
-/**
- * RIL_REQUEST_STK_SET_PROFILE
- *
- * Download the STK terminal profile as part of SIM initialization
- * procedure
- *
- * "data" is a const char * containing SAT/USAT profile
- * in hexadecimal format string starting with first byte of terminal profile
- *
- * "response" is NULL
- *
- * Valid errors:
- * RIL_E_SUCCESS
- * RIL_E_RADIO_NOT_AVAILABLE (radio resetting)
- * RIL_E_GENERIC_FAILURE
- */
-#define RIL_REQUEST_STK_SET_PROFILE 68
-
-/**
- * RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND
- *
- * Requests to send a SAT/USAT envelope command to SIM.
- * The SAT/USAT envelope command refers to 3GPP TS 11.14 and 3GPP TS 31.111
- *
- * "data" is a const char * containing SAT/USAT command
- * in hexadecimal format string starting with command tag
- *
- * "response" is a const char * containing SAT/USAT response
- * in hexadecimal format string starting with first byte of response
- * (May be NULL)
- *
- * Valid errors:
- * RIL_E_SUCCESS
- * RIL_E_RADIO_NOT_AVAILABLE (radio resetting)
- * RIL_E_GENERIC_FAILURE
- */
-#define RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND 69
-
-/**
- * RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE
- *
- * Requests to send a terminal response to SIM for a received
- * proactive command
- *
- * "data" is a const char * containing SAT/USAT response
- * in hexadecimal format string starting with first byte of response data
- *
- * "response" is NULL
- *
- * Valid errors:
- * RIL_E_SUCCESS
- * RIL_E_RADIO_NOT_AVAILABLE (radio resetting)
- * RIL_E_GENERIC_FAILURE
- */
-#define RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE 70
-
-/**
- * RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM
- *
- * When STK application gets RIL_UNSOL_STK_CALL_SETUP, the call actually has
- * been initialized by ME already. (We could see the call has been in the 'call
- * list') So, STK application needs to accept/reject the call according as user
- * operations.
- *
- * "data" is int *
- * ((int *)data)[0] is > 0 for "accept" the call setup
- * ((int *)data)[0] is == 0 for "reject" the call setup
- *
- * "response" is NULL
- *
- * Valid errors:
- * RIL_E_SUCCESS
- * RIL_E_RADIO_NOT_AVAILABLE (radio resetting)
- * RIL_E_GENERIC_FAILURE
- */
-#define RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM 71
-
-/**
- * RIL_REQUEST_EXPLICIT_CALL_TRANSFER
- *
- * Connects the two calls and disconnects the subscriber from both calls.
- *
- * "data" is NULL
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_EXPLICIT_CALL_TRANSFER 72
-
-/**
- * RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE
- *
- * Requests to set the preferred network type for searching and registering
- * (CS/PS domain, RAT, and operation mode)
- *
- * "data" is int * which is RIL_PreferredNetworkType
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- * MODE_NOT_SUPPORTED
- */
-#define RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE 73
-
-/**
- * RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE
- *
- * Query the preferred network type (CS/PS domain, RAT, and operation mode)
- * for searching and registering
- *
- * "data" is NULL
- *
- * "response" is int *
- * ((int *)reponse)[0] is == RIL_PreferredNetworkType
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- * See also: RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE
- */
-#define RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE 74
-
-/**
- * RIL_REQUEST_NEIGHBORING_CELL_IDS
- *
- * Request neighboring cell id in GSM network
- *
- * "data" is NULL
- * "response" must be a " const RIL_NeighboringCell** "
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_GET_NEIGHBORING_CELL_IDS 75
-
-/**
- * RIL_REQUEST_SET_LOCATION_UPDATES
- *
- * Enables/disables network state change notifications due to changes in
- * LAC and/or CID (for GSM) or BID/SID/NID/latitude/longitude (for CDMA).
- * Basically +CREG=2 vs. +CREG=1 (TS 27.007).
- *
- * Note: The RIL implementation should default to "updates enabled"
- * when the screen is on and "updates disabled" when the screen is off.
- *
- * "data" is int *
- * ((int *)data)[0] is == 1 for updates enabled (+CREG=2)
- * ((int *)data)[0] is == 0 for updates disabled (+CREG=1)
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- * See also: RIL_REQUEST_SCREEN_STATE, RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED
- */
-#define RIL_REQUEST_SET_LOCATION_UPDATES 76
-
-/**
- * RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE
- *
- * Request to set the location where the CDMA subscription shall
- * be retrieved
- *
- * "data" is int *
- * ((int *)data)[0] is == RIL_CdmaSubscriptionSource
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- * SIM_ABSENT
- * SUBSCRIPTION_NOT_AVAILABLE
- *
- * See also: RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE
- */
-#define RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE 77
-
-/**
- * RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE
- *
- * Request to set the roaming preferences in CDMA
- *
- * "data" is int *
- * ((int *)data)[0] is == 0 for Home Networks only, as defined in PRL
- * ((int *)data)[0] is == 1 for Roaming on Affiliated networks, as defined in PRL
- * ((int *)data)[0] is == 2 for Roaming on Any Network, as defined in the PRL
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE 78
-
-/**
- * RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE
- *
- * Request the actual setting of the roaming preferences in CDMA in the modem
- *
- * "data" is NULL
- *
- * "response" is int *
- * ((int *)response)[0] is == 0 for Home Networks only, as defined in PRL
- * ((int *)response)[0] is == 1 for Roaming on Affiliated networks, as defined in PRL
- * ((int *)response)[0] is == 2 for Roaming on Any Network, as defined in the PRL
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE 79
-
-/**
- * RIL_REQUEST_SET_TTY_MODE
- *
- * Request to set the TTY mode
- *
- * "data" is int *
- * ((int *)data)[0] is == 0 for TTY off
- * ((int *)data)[0] is == 1 for TTY Full
- * ((int *)data)[0] is == 2 for TTY HCO (hearing carryover)
- * ((int *)data)[0] is == 3 for TTY VCO (voice carryover)
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_SET_TTY_MODE 80
-
-/**
- * RIL_REQUEST_QUERY_TTY_MODE
- *
- * Request the setting of TTY mode
- *
- * "data" is NULL
- *
- * "response" is int *
- * ((int *)response)[0] is == 0 for TTY off
- * ((int *)response)[0] is == 1 for TTY Full
- * ((int *)response)[0] is == 2 for TTY HCO (hearing carryover)
- * ((int *)response)[0] is == 3 for TTY VCO (voice carryover)
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_QUERY_TTY_MODE 81
-
-/**
- * RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE
- *
- * Request to set the preferred voice privacy mode used in voice
- * scrambling
- *
- * "data" is int *
- * ((int *)data)[0] is == 0 for Standard Privacy Mode (Public Long Code Mask)
- * ((int *)data)[0] is == 1 for Enhanced Privacy Mode (Private Long Code Mask)
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE 82
-
-/**
- * RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE
- *
- * Request the setting of preferred voice privacy mode
- *
- * "data" is NULL
- *
- * "response" is int *
- * ((int *)response)[0] is == 0 for Standard Privacy Mode (Public Long Code Mask)
- * ((int *)response)[0] is == 1 for Enhanced Privacy Mode (Private Long Code Mask)
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE 83
-
-/**
- * RIL_REQUEST_CDMA_FLASH
- *
- * Send FLASH
- *
- * "data" is const char *
- * ((const char *)data)[0] is a FLASH string
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_CDMA_FLASH 84
-
-/**
- * RIL_REQUEST_CDMA_BURST_DTMF
- *
- * Send DTMF string
- *
- * "data" is const char **
- * ((const char **)data)[0] is a DTMF string
- * ((const char **)data)[1] is the DTMF ON length in milliseconds, or 0 to use
- * default
- * ((const char **)data)[2] is the DTMF OFF length in milliseconds, or 0 to use
- * default
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_CDMA_BURST_DTMF 85
-
-/**
- * RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY
- *
- * Takes a 26 digit string (20 digit AKEY + 6 digit checksum).
- * If the checksum is valid the 20 digit AKEY is written to NV,
- * replacing the existing AKEY no matter what it was before.
- *
- * "data" is const char *
- * ((const char *)data)[0] is a 26 digit string (ASCII digits '0'-'9')
- * where the last 6 digits are a checksum of the
- * first 20, as specified in TR45.AHAG
- * "Common Cryptographic Algorithms, Revision D.1
- * Section 2.2"
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY 86
-
-/**
- * RIL_REQUEST_CDMA_SEND_SMS
- *
- * Send a CDMA SMS message
- *
- * "data" is const RIL_CDMA_SMS_Message *
- *
- * "response" is a const RIL_SMS_Response *
- *
- * Based on the return error, caller decides to resend if sending sms
- * fails. The CDMA error class is derived as follows,
- * SUCCESS is error class 0 (no error)
- * SMS_SEND_FAIL_RETRY is error class 2 (temporary failure)
- * and GENERIC_FAILURE is error class 3 (permanent and no retry)
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * SMS_SEND_FAIL_RETRY
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_CDMA_SEND_SMS 87
-
-/**
- * RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE
- *
- * Acknowledge the success or failure in the receipt of SMS
- * previously indicated via RIL_UNSOL_RESPONSE_CDMA_NEW_SMS
- *
- * "data" is const RIL_CDMA_SMS_Ack *
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE 88
-
-/**
- * RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG
- *
- * Request the setting of GSM/WCDMA Cell Broadcast SMS config.
- *
- * "data" is NULL
- *
- * "response" is a const RIL_GSM_BroadcastSmsConfigInfo **
- * "responselen" is count * sizeof (RIL_GSM_BroadcastSmsConfigInfo *)
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG 89
-
-/**
- * RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG
- *
- * Set GSM/WCDMA Cell Broadcast SMS config
- *
- * "data" is a const RIL_GSM_BroadcastSmsConfigInfo **
- * "datalen" is count * sizeof(RIL_GSM_BroadcastSmsConfigInfo *)
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG 90
-
-/**
- * RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION
- *
-* Enable or disable the reception of GSM/WCDMA Cell Broadcast SMS
- *
- * "data" is const int *
- * (const int *)data[0] indicates to activate or turn off the
- * reception of GSM/WCDMA Cell Broadcast SMS, 0-1,
- * 0 - Activate, 1 - Turn off
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION 91
-
-/**
- * RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG
- *
- * Request the setting of CDMA Broadcast SMS config
- *
- * "data" is NULL
- *
- * "response" is a const RIL_CDMA_BroadcastSmsConfigInfo **
- * "responselen" is count * sizeof (RIL_CDMA_BroadcastSmsConfigInfo *)
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG 92
-
-/**
- * RIL_REQUEST_CDMA_SET_BROADCAST_SMS_CONFIG
- *
- * Set CDMA Broadcast SMS config
- *
- * "data" is an const RIL_CDMA_BroadcastSmsConfigInfo **
- * "datalen" is count * sizeof(const RIL_CDMA_BroadcastSmsConfigInfo *)
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_CDMA_SET_BROADCAST_SMS_CONFIG 93
-
-/**
- * RIL_REQUEST_CDMA_SMS_BROADCAST_ACTIVATION
- *
- * Enable or disable the reception of CDMA Broadcast SMS
- *
- * "data" is const int *
- * (const int *)data[0] indicates to activate or turn off the
- * reception of CDMA Broadcast SMS, 0-1,
- * 0 - Activate, 1 - Turn off
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_CDMA_SMS_BROADCAST_ACTIVATION 94
-
-/**
- * RIL_REQUEST_CDMA_SUBSCRIPTION
- *
- * Request the device MDN / H_SID / H_NID.
- *
- * The request is only allowed when CDMA subscription is available. When CDMA
- * subscription is changed, application layer should re-issue the request to
- * update the subscription information.
- *
- * If a NULL value is returned for any of the device id, it means that error
- * accessing the device.
- *
- * "response" is const char **
- * ((const char **)response)[0] is MDN if CDMA subscription is available
- * ((const char **)response)[1] is a comma separated list of H_SID (Home SID) if
- * CDMA subscription is available, in decimal format
- * ((const char **)response)[2] is a comma separated list of H_NID (Home NID) if
- * CDMA subscription is available, in decimal format
- * ((const char **)response)[3] is MIN (10 digits, MIN2+MIN1) if CDMA subscription is available
- * ((const char **)response)[4] is PRL version if CDMA subscription is available
- *
- * Valid errors:
- * SUCCESS
- * RIL_E_SUBSCRIPTION_NOT_AVAILABLE
- */
-
-#define RIL_REQUEST_CDMA_SUBSCRIPTION 95
-
-/**
- * RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM
- *
- * Stores a CDMA SMS message to RUIM memory.
- *
- * "data" is RIL_CDMA_SMS_WriteArgs *
- *
- * "response" is int *
- * ((const int *)response)[0] is the record index where the message is stored.
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM 96
-
-/**
- * RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM
- *
- * Deletes a CDMA SMS message from RUIM memory.
- *
- * "data" is int *
- * ((int *)data)[0] is the record index of the message to delete.
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM 97
-
-/**
- * RIL_REQUEST_DEVICE_IDENTITY
- *
- * Request the device ESN / MEID / IMEI / IMEISV.
- *
- * The request is always allowed and contains GSM and CDMA device identity;
- * it substitutes the deprecated requests RIL_REQUEST_GET_IMEI and
- * RIL_REQUEST_GET_IMEISV.
- *
- * If a NULL value is returned for any of the device id, it means that error
- * accessing the device.
- *
- * When CDMA subscription is changed the ESN/MEID may change. The application
- * layer should re-issue the request to update the device identity in this case.
- *
- * "response" is const char **
- * ((const char **)response)[0] is IMEI if GSM subscription is available
- * ((const char **)response)[1] is IMEISV if GSM subscription is available
- * ((const char **)response)[2] is ESN if CDMA subscription is available
- * ((const char **)response)[3] is MEID if CDMA subscription is available
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_DEVICE_IDENTITY 98
-
-/**
- * RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE
- *
- * Request the radio's system selection module to exit emergency
- * callback mode. RIL will not respond with SUCCESS until the modem has
- * completely exited from Emergency Callback Mode.
- *
- * "data" is NULL
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE 99
-
-/**
- * RIL_REQUEST_GET_SMSC_ADDRESS
- *
- * Queries the default Short Message Service Center address on the device.
- *
- * "data" is NULL
- *
- * "response" is const char * containing the SMSC address.
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_GET_SMSC_ADDRESS 100
-
-/**
- * RIL_REQUEST_SET_SMSC_ADDRESS
- *
- * Sets the default Short Message Service Center address on the device.
- *
- * "data" is const char * containing the SMSC address.
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_SET_SMSC_ADDRESS 101
-
-/**
- * RIL_REQUEST_REPORT_SMS_MEMORY_STATUS
- *
- * Indicates whether there is storage available for new SMS messages.
- *
- * "data" is int *
- * ((int *)data)[0] is 1 if memory is available for storing new messages
- * is 0 if memory capacity is exceeded
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_REPORT_SMS_MEMORY_STATUS 102
-
-/**
- * RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING
- *
- * Indicates that the StkSerivce is running and is
- * ready to receive RIL_UNSOL_STK_XXXXX commands.
- *
- * "data" is NULL
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING 103
-
-/**
- * RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE
- *
- * Request to query the location where the CDMA subscription shall
- * be retrieved
- *
- * "data" is NULL
- *
- * "response" is int *
- * ((int *)data)[0] is == RIL_CdmaSubscriptionSource
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- * SUBSCRIPTION_NOT_AVAILABLE
- *
- * See also: RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE
- */
-#define RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE 104
-
-/**
- * RIL_REQUEST_ISIM_AUTHENTICATION
- *
- * Request the ISIM application on the UICC to perform AKA
- * challenge/response algorithm for IMS authentication
- *
- * "data" is a const char * containing the challenge string in Base64 format
- * "response" is a const char * containing the response in Base64 format
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_ISIM_AUTHENTICATION 105
-
-/**
- * RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU
- *
- * Acknowledge successful or failed receipt of SMS previously indicated
- * via RIL_UNSOL_RESPONSE_NEW_SMS, including acknowledgement TPDU to send
- * as the RP-User-Data element of the RP-ACK or RP-ERROR PDU.
- *
- * "data" is const char **
- * ((const char **)data)[0] is "1" on successful receipt (send RP-ACK)
- * is "0" on failed receipt (send RP-ERROR)
- * ((const char **)data)[1] is the acknowledgement TPDU in hexadecimal format
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU 106
-
-/**
- * RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS
- *
- * Requests to send a SAT/USAT envelope command to SIM.
- * The SAT/USAT envelope command refers to 3GPP TS 11.14 and 3GPP TS 31.111.
- *
- * This request has one difference from RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND:
- * the SW1 and SW2 status bytes from the UICC response are returned along with
- * the response data, using the same structure as RIL_REQUEST_SIM_IO.
- *
- * The RIL implementation shall perform the normal processing of a '91XX'
- * response in SW1/SW2 to retrieve the pending proactive command and send it
- * as an unsolicited response, as RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND does.
- *
- * "data" is a const char * containing the SAT/USAT command
- * in hexadecimal format starting with command tag
- *
- * "response" is a const RIL_SIM_IO_Response *
- *
- * Valid errors:
- * RIL_E_SUCCESS
- * RIL_E_RADIO_NOT_AVAILABLE (radio resetting)
- * RIL_E_GENERIC_FAILURE
- */
-#define RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS 107
-
-/**
- * RIL_REQUEST_VOICE_RADIO_TECH
- *
- * Query the radio technology type (3GPP/3GPP2) used for voice. Query is valid only
- * when radio state is RADIO_STATE_ON
- *
- * "data" is NULL
- * "response" is int *
- * ((int *) response)[0] is of type const RIL_RadioTechnology
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_VOICE_RADIO_TECH 108
-
-/**
- * RIL_REQUEST_GET_CELL_INFO_LIST
- *
- * Request all of the current cell information known to the radio. The radio
- * must a list of all current cells, including the neighboring cells. If for a particular
- * cell information isn't known then the appropriate unknown value will be returned.
- * This does not cause or change the rate of RIL_UNSOL_CELL_INFO_LIST.
- *
- * "data" is NULL
- *
- * "response" is an array of RIL_CellInfo.
- */
-#define RIL_REQUEST_GET_CELL_INFO_LIST 109
-
-/**
- * RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE
- *
- * Sets the minimum time between when RIL_UNSOL_CELL_INFO_LIST should be invoked.
- * A value of 0, means invoke RIL_UNSOL_CELL_INFO_LIST when any of the reported
- * information changes. Setting the value to INT_MAX(0x7fffffff) means never issue
- * a RIL_UNSOL_CELL_INFO_LIST.
- *
- * "data" is int *
- * ((int *)data)[0] is minimum time in milliseconds
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE 110
-
-/**
- * RIL_REQUEST_SET_INITIAL_ATTACH_APN
- *
- * Set an apn to initial attach network
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- * SUBSCRIPTION_NOT_AVAILABLE
- */
-#define RIL_REQUEST_SET_INITIAL_ATTACH_APN 111
-
-/**
- * RIL_REQUEST_IMS_REGISTRATION_STATE
- *
- * Request current IMS registration state
- *
- * "data" is NULL
- *
- * "response" is int *
- * ((int *)response)[0] is registration state:
- * 0 - Not registered
- * 1 - Registered
- *
- * If ((int*)response)[0] is = 1, then ((int *) response)[1]
- * must follow with IMS SMS format:
- *
- * ((int *) response)[1] is of type RIL_RadioTechnologyFamily
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_IMS_REGISTRATION_STATE 112
-
-/**
- * RIL_REQUEST_IMS_SEND_SMS
- *
- * Send a SMS message over IMS
- *
- * "data" is const RIL_IMS_SMS_Message *
- *
- * "response" is a const RIL_SMS_Response *
- *
- * Based on the return error, caller decides to resend if sending sms
- * fails. SMS_SEND_FAIL_RETRY means retry, and other errors means no retry.
- * In case of retry, data is encoded based on Voice Technology available.
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * SMS_SEND_FAIL_RETRY
- * FDN_CHECK_FAILURE
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_IMS_SEND_SMS 113
-
-/**
- * RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC
- *
- * Request APDU exchange on the basic channel. This command reflects TS 27.007
- * "generic SIM access" operation (+CSIM). The modem must ensure proper function
- * of GSM/CDMA, and filter commands appropriately. It should filter
- * channel management and SELECT by DF name commands.
- *
- * "data" is a const RIL_SIM_APDU *
- * "sessionid" field should be ignored.
- *
- * "response" is a const RIL_SIM_IO_Response *
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC 114
-
-/**
- * RIL_REQUEST_SIM_OPEN_CHANNEL
- *
- * Open a new logical channel and select the given application. This command
- * reflects TS 27.007 "open logical channel" operation (+CCHO).
- *
- * "data" is const char * and set to AID value, See ETSI 102.221 and 101.220.
- *
- * "response" is int *
- * ((int *)data)[0] contains the session id of the logical channel.
- * ((int *)data)[1] onwards may optionally contain the select response for the
- * open channel command with one byte per integer.
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- * MISSING_RESOURCE
- * NO_SUCH_ELEMENT
- */
-#define RIL_REQUEST_SIM_OPEN_CHANNEL 115
-
-/**
- * RIL_REQUEST_SIM_CLOSE_CHANNEL
- *
- * Close a previously opened logical channel. This command reflects TS 27.007
- * "close logical channel" operation (+CCHC).
- *
- * "data" is int *
- * ((int *)data)[0] is the session id of logical the channel to close.
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_SIM_CLOSE_CHANNEL 116
-
-/**
- * RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL
- *
- * Exchange APDUs with a UICC over a previously opened logical channel. This
- * command reflects TS 27.007 "generic logical channel access" operation
- * (+CGLA). The modem should filter channel management and SELECT by DF name
- * commands.
- *
- * "data" is a const RIL_SIM_APDU*
- *
- * "response" is a const RIL_SIM_IO_Response *
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL 117
-
-/**
- * RIL_REQUEST_NV_READ_ITEM
- *
- * Read one of the radio NV items defined in RadioNVItems.java / ril_nv_items.h.
- * This is used for device configuration by some CDMA operators.
- *
- * "data" is a const RIL_NV_ReadItem *
- *
- * "response" is const char * containing the contents of the NV item
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_NV_READ_ITEM 118
-
-/**
- * RIL_REQUEST_NV_WRITE_ITEM
- *
- * Write one of the radio NV items defined in RadioNVItems.java / ril_nv_items.h.
- * This is used for device configuration by some CDMA operators.
- *
- * "data" is a const RIL_NV_WriteItem *
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_NV_WRITE_ITEM 119
-
-/**
- * RIL_REQUEST_NV_WRITE_CDMA_PRL
- *
- * Update the CDMA Preferred Roaming List (PRL) in the radio NV storage.
- * This is used for device configuration by some CDMA operators.
- *
- * "data" is a const char * containing the PRL as a byte array
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_NV_WRITE_CDMA_PRL 120
-
-/**
- * RIL_REQUEST_NV_RESET_CONFIG
- *
- * Reset the radio NV configuration to the factory state.
- * This is used for device configuration by some CDMA operators.
- *
- * "data" is int *
- * ((int *)data)[0] is 1 to reload all NV items
- * ((int *)data)[0] is 2 for erase NV reset (SCRTN)
- * ((int *)data)[0] is 3 for factory reset (RTN)
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_NV_RESET_CONFIG 121
-
- /** RIL_REQUEST_SET_UICC_SUBSCRIPTION
- * FIXME This API needs to have more documentation.
- *
- * Selection/de-selection of a subscription from a SIM card
- * "data" is const RIL_SelectUiccSub*
-
- *
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- * SUBSCRIPTION_NOT_SUPPORTED
- *
- */
-#define RIL_REQUEST_SET_UICC_SUBSCRIPTION 122
-
-/**
- * RIL_REQUEST_ALLOW_DATA
- *
- * Tells the modem whether data calls are allowed or not
- *
- * "data" is int *
- * FIXME slotId and aid will be added.
- * ((int *)data)[0] is == 0 to allow data calls
- * ((int *)data)[0] is == 1 to disallow data calls
- *
- * "response" is NULL
- *
- * Valid errors:
- *
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- *
- */
-#define RIL_REQUEST_ALLOW_DATA 123
-
-/**
- * RIL_REQUEST_GET_HARDWARE_CONFIG
- *
- * Request all of the current hardware (modem and sim) associated
- * with the RIL.
- *
- * "data" is NULL
- *
- * "response" is an array of RIL_HardwareConfig.
- */
-#define RIL_REQUEST_GET_HARDWARE_CONFIG 124
-
-/**
- * RIL_REQUEST_SIM_AUTHENTICATION
- *
- * Returns the response of SIM Authentication through RIL to a
- * challenge request.
- *
- * "data" Base64 encoded string containing challenge:
- * int authContext; P2 value of authentication command, see P2 parameter in
- * 3GPP TS 31.102 7.1.2
- * char *authData; the challenge string in Base64 format, see 3GPP
- * TS 31.102 7.1.2
- * char *aid; AID value, See ETSI 102.221 8.1 and 101.220 4,
- * NULL if no value
- *
- * "response" Base64 encoded strings containing response:
- * int sw1; Status bytes per 3GPP TS 31.102 section 7.3
- * int sw2;
- * char *simResponse; Response in Base64 format, see 3GPP TS 31.102 7.1.2
- */
-#define RIL_REQUEST_SIM_AUTHENTICATION 125
-
-/**
- * RIL_REQUEST_GET_DC_RT_INFO
- *
- * The request is DEPRECATED, use RIL_REQUEST_GET_ACTIVITY_INFO
- * Requests the Data Connection Real Time Info
- *
- * "data" is NULL
- *
- * "response" is the most recent RIL_DcRtInfo
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- *
- * See also: RIL_UNSOL_DC_RT_INFO_CHANGED
- */
-#define RIL_REQUEST_GET_DC_RT_INFO 126
-
-/**
- * RIL_REQUEST_SET_DC_RT_INFO_RATE
- *
- * The request is DEPRECATED
- * This is the minimum number of milliseconds between successive
- * RIL_UNSOL_DC_RT_INFO_CHANGED messages and defines the highest rate
- * at which RIL_UNSOL_DC_RT_INFO_CHANGED's will be sent. A value of
- * 0 means send as fast as possible.
- *
- * "data" The number of milliseconds as an int
- *
- * "response" is null
- *
- * Valid errors:
- * SUCCESS must not fail
- */
-#define RIL_REQUEST_SET_DC_RT_INFO_RATE 127
-
-/**
- * RIL_REQUEST_SET_DATA_PROFILE
- *
- * Set data profile in modem
- * Modem should erase existed profiles from framework, and apply new profiles
- * "data" is an const RIL_DataProfileInfo **
- * "datalen" is count * sizeof(const RIL_DataProfileInfo *)
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- * SUBSCRIPTION_NOT_AVAILABLE
- */
-#define RIL_REQUEST_SET_DATA_PROFILE 128
-
-/**
- * RIL_REQUEST_SHUTDOWN
- *
- * Device is shutting down. All further commands are ignored
- * and RADIO_NOT_AVAILABLE must be returned.
- *
- * "data" is null
- * "response" is NULL
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_SHUTDOWN 129
-
-/**
- * RIL_REQUEST_GET_RADIO_CAPABILITY
- *
- * Used to get phone radio capablility.
- *
- * "data" is the RIL_RadioCapability structure
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_GET_RADIO_CAPABILITY 130
-
-/**
- * RIL_REQUEST_SET_RADIO_CAPABILITY
- *
- * Used to set the phones radio capability. Be VERY careful
- * using this request as it may cause some vendor modems to reset. Because
- * of the possible modem reset any RIL commands after this one may not be
- * processed.
- *
- * "data" is the RIL_RadioCapability structure
- *
- * "response" is the RIL_RadioCapability structure, used to feedback return status
- *
- * Valid errors:
- * SUCCESS means a RIL_UNSOL_RADIO_CAPABILITY will be sent within 30 seconds.
- * RADIO_NOT_AVAILABLE
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_SET_RADIO_CAPABILITY 131
-
- /**
- * RIL_REQUEST_START_LCE
- *
- * Start Link Capacity Estimate (LCE) service if supported by the radio.
- *
- * "data" is const int *
- * ((const int*)data)[0] specifies the desired reporting interval (ms).
- * ((const int*)data)[1] specifies the LCE service mode. 1: PULL; 0: PUSH.
- *
- * "response" is the RIL_LceStatusInfo.
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * LCE_NOT_SUPPORTED
- */
-#define RIL_REQUEST_START_LCE 132
-
-/**
- * RIL_REQUEST_STOP_LCE
- *
- * Stop Link Capacity Estimate (LCE) service, the STOP operation should be
- * idempotent for the radio modem.
- *
- * "response" is the RIL_LceStatusInfo.
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * LCE_NOT_SUPPORTED
- */
-#define RIL_REQUEST_STOP_LCE 133
-
-/**
- * RIL_REQUEST_PULL_LCEDATA
- *
- * Pull LCE service for capacity information.
- *
- * "response" is the RIL_LceDataInfo.
- *
- * Valid errors:
- * SUCCESS
- * RADIO_NOT_AVAILABLE
- * LCE_NOT_SUPPORTED
- */
-#define RIL_REQUEST_PULL_LCEDATA 134
- /**
- * RIL_REQUEST_GET_ACTIVITY_INFO
- *
- * Get modem activity statisitics info.
- *
- * There can be multiple RIL_REQUEST_GET_ACTIVITY_INFO calls to modem.
- * Once the response for the request is sent modem will clear
- * current statistics information.
- *
- * "data" is null
- * "response" is const RIL_ActivityStatsInfo *
- *
- * Valid errors:
- *
- * SUCCESS
- * RADIO_NOT_AVAILABLE (radio resetting)
- * GENERIC_FAILURE
- */
-#define RIL_REQUEST_GET_ACTIVITY_INFO 135
-
-
-/* SAMSUNG REQUESTS */
-#undef RIL_REQUEST_SIM_OPEN_CHANNEL
-#undef RIL_REQUEST_SIM_CLOSE_CHANNEL
-
-#define RIL_REQUEST_GET_CELL_BROADCAST_CONFIG 10002
-
-#define RIL_REQUEST_SEND_ENCODED_USSD 10005
-#define RIL_REQUEST_SET_PDA_MEMORY_STATUS 10006
-#define RIL_REQUEST_GET_PHONEBOOK_STORAGE_INFO 10007
-#define RIL_REQUEST_GET_PHONEBOOK_ENTRY 10008
-#define RIL_REQUEST_ACCESS_PHONEBOOK_ENTRY 10009
-#define RIL_REQUEST_DIAL_VIDEO_CALL 10010
-#define RIL_REQUEST_CALL_DEFLECTION 10011
-#define RIL_REQUEST_READ_SMS_FROM_SIM 10012
-#define RIL_REQUEST_USIM_PB_CAPA 10013
-#define RIL_REQUEST_LOCK_INFO 10014
-
-#define RIL_REQUEST_DIAL_EMERGENCY 10016
-#define RIL_REQUEST_GET_STOREAD_MSG_COUNT 10017
-#define RIL_REQUEST_STK_SIM_INIT_EVENT 10018
-#define RIL_REQUEST_GET_LINE_ID 10019
-#define RIL_REQUEST_SET_LINE_ID 10020
-#define RIL_REQUEST_GET_SERIAL_NUMBER 10021
-#define RIL_REQUEST_GET_MANUFACTURE_DATE_NUMBER 10022
-#define RIL_REQUEST_GET_BARCODE_NUMBER 10023
-#define RIL_REQUEST_UICC_GBA_AUTHENTICATE_BOOTSTRAP 10024
-#define RIL_REQUEST_UICC_GBA_AUTHENTICATE_NAF 10025
-#define RIL_REQUEST_SIM_TRANSMIT_BASIC 10026
-#define RIL_REQUEST_SIM_OPEN_CHANNEL 10027
-#define RIL_REQUEST_SIM_CLOSE_CHANNEL 10028
-#define RIL_REQUEST_SIM_TRANSMIT_CHANNEL 10029
-#define RIL_REQUEST_SIM_AUTH 10030
-#define RIL_REQUEST_PS_ATTACH 10031
-#define RIL_REQUEST_PS_DETACH 10032
-#define RIL_REQUEST_ACTIVATE_DATA_CALL 10033
-#define RIL_REQUEST_CHANGE_SIM_PERSO 10034
-#define RIL_REQUEST_ENTER_SIM_PERSO 10035
-#define RIL_REQUEST_GET_TIME_INFO 10036
-#define RIL_REQUEST_OMADM_SETUP_SESSION 10037
-#define RIL_REQUEST_OMADM_SERVER_START_SESSION 10038
-#define RIL_REQUEST_OMADM_CLIENT_START_SESSION 10039
-#define RIL_REQUEST_OMADM_SEND_DATA 10040
-#define RIL_REQUEST_CDMA_GET_DATAPROFILE 10041
-#define RIL_REQUEST_CDMA_SET_DATAPROFILE 10042
-#define RIL_REQUEST_CDMA_GET_SYSTEMPROPERTIES 10043
-#define RIL_REQUEST_CDMA_SET_SYSTEMPROPERTIES 10044
-#define RIL_REQUEST_SEND_SMS_COUNT 10045
-#define RIL_REQUEST_SEND_SMS_MSG 10046
-#define RIL_REQUEST_SEND_SMS_MSG_READ_STATUS 10047
-#define RIL_REQUEST_MODEM_HANGUP 10048
-#define RIL_REQUEST_SET_SIM_POWER 10049
-#define RIL_REQUEST_SET_PREFERRED_NETWORK_LIST 10050
-#define RIL_REQUEST_GET_PREFERRED_NETWORK_LIST 10051
-#define RIL_REQUEST_HANGUP_VT 10052
-
-
-/***********************************************************************/
-
-
-#define RIL_UNSOL_RESPONSE_BASE 1000
-
-/**
- * RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED
- *
- * Indicate when value of RIL_RadioState has changed.
- *
- * Callee will invoke RIL_RadioStateRequest method on main thread
- *
- * "data" is NULL
- */
-
-#define RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED 1000
-
-
-/**
- * RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED
- *
- * Indicate when call state has changed
- *
- * Callee will invoke RIL_REQUEST_GET_CURRENT_CALLS on main thread
- *
- * "data" is NULL
- *
- * Response should be invoked on, for example,
- * "RING", "BUSY", "NO CARRIER", and also call state
- * transitions (DIALING->ALERTING ALERTING->ACTIVE)
- *
- * Redundent or extraneous invocations are tolerated
- */
-#define RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED 1001
-
-
-/**
- * RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED
- *
- * Called when the voice network state changed
- *
- * Callee will invoke the following requests on main thread:
- *
- * RIL_REQUEST_VOICE_REGISTRATION_STATE
- * RIL_REQUEST_OPERATOR
- *
- * "data" is NULL
- *
- * FIXME should this happen when SIM records are loaded? (eg, for
- * EONS)
- */
-#define RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED 1002
-
-/**
- * RIL_UNSOL_RESPONSE_NEW_SMS
- *
- * Called when new SMS is received.
- *
- * "data" is const char *
- * This is a pointer to a string containing the PDU of an SMS-DELIVER
- * as an ascii string of hex digits. The PDU starts with the SMSC address
- * per TS 27.005 (+CMT:)
- *
- * Callee will subsequently confirm the receipt of thei SMS with a
- * RIL_REQUEST_SMS_ACKNOWLEDGE
- *
- * No new RIL_UNSOL_RESPONSE_NEW_SMS
- * or RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT messages should be sent until a
- * RIL_REQUEST_SMS_ACKNOWLEDGE has been received
- */
-
-#define RIL_UNSOL_RESPONSE_NEW_SMS 1003
-
-/**
- * RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT
- *
- * Called when new SMS Status Report is received.
- *
- * "data" is const char *
- * This is a pointer to a string containing the PDU of an SMS-STATUS-REPORT
- * as an ascii string of hex digits. The PDU starts with the SMSC address
- * per TS 27.005 (+CDS:).
- *
- * Callee will subsequently confirm the receipt of the SMS with a
- * RIL_REQUEST_SMS_ACKNOWLEDGE
- *
- * No new RIL_UNSOL_RESPONSE_NEW_SMS
- * or RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT messages should be sent until a
- * RIL_REQUEST_SMS_ACKNOWLEDGE has been received
- */
-
-#define RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT 1004
-
-/**
- * RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM
- *
- * Called when new SMS has been stored on SIM card
- *
- * "data" is const int *
- * ((const int *)data)[0] contains the slot index on the SIM that contains
- * the new message
- */
-
-#define RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM 1005
-
-/**
- * RIL_UNSOL_ON_USSD
- *
- * Called when a new USSD message is received.
- *
- * "data" is const char **
- * ((const char **)data)[0] points to a type code, which is
- * one of these string values:
- * "0" USSD-Notify -- text in ((const char **)data)[1]
- * "1" USSD-Request -- text in ((const char **)data)[1]
- * "2" Session terminated by network
- * "3" other local client (eg, SIM Toolkit) has responded
- * "4" Operation not supported
- * "5" Network timeout
- *
- * The USSD session is assumed to persist if the type code is "1", otherwise
- * the current session (if any) is assumed to have terminated.
- *
- * ((const char **)data)[1] points to a message string if applicable, which
- * should always be in UTF-8.
- */
-#define RIL_UNSOL_ON_USSD 1006
-/* Previously #define RIL_UNSOL_ON_USSD_NOTIFY 1006 */
-
-/**
- * RIL_UNSOL_ON_USSD_REQUEST
- *
- * Obsolete. Send via RIL_UNSOL_ON_USSD
- */
-#define RIL_UNSOL_ON_USSD_REQUEST 1007
-
-/**
- * RIL_UNSOL_NITZ_TIME_RECEIVED
- *
- * Called when radio has received a NITZ time message
- *
- * "data" is const char * pointing to NITZ time string
- * in the form "yy/mm/dd,hh:mm:ss(+/-)tz,dt"
- */
-#define RIL_UNSOL_NITZ_TIME_RECEIVED 1008
-
-/**
- * RIL_UNSOL_SIGNAL_STRENGTH
- *
- * Radio may report signal strength rather han have it polled.
- *
- * "data" is a const RIL_SignalStrength *
- */
-#define RIL_UNSOL_SIGNAL_STRENGTH 1009
-
-
-/**
- * RIL_UNSOL_DATA_CALL_LIST_CHANGED
- *
- * "data" is an array of RIL_Data_Call_Response_v6 identical to that
- * returned by RIL_REQUEST_DATA_CALL_LIST. It is the complete list
- * of current data contexts including new contexts that have been
- * activated. A data call is only removed from this list when the
- * framework sends a RIL_REQUEST_DEACTIVATE_DATA_CALL or the radio
- * is powered off/on.
- *
- * See also: RIL_REQUEST_DATA_CALL_LIST
- */
-
-#define RIL_UNSOL_DATA_CALL_LIST_CHANGED 1010
-
-/**
- * RIL_UNSOL_SUPP_SVC_NOTIFICATION
- *
- * Reports supplementary service related notification from the network.
- *
- * "data" is a const RIL_SuppSvcNotification *
- *
- */
-
-#define RIL_UNSOL_SUPP_SVC_NOTIFICATION 1011
-
-/**
- * RIL_UNSOL_STK_SESSION_END
- *
- * Indicate when STK session is terminated by SIM.
- *
- * "data" is NULL
- */
-#define RIL_UNSOL_STK_SESSION_END 1012
-
-/**
- * RIL_UNSOL_STK_PROACTIVE_COMMAND
- *
- * Indicate when SIM issue a STK proactive command to applications
- *
- * "data" is a const char * containing SAT/USAT proactive command
- * in hexadecimal format string starting with command tag
- *
- */
-#define RIL_UNSOL_STK_PROACTIVE_COMMAND 1013
-
-/**
- * RIL_UNSOL_STK_EVENT_NOTIFY
- *
- * Indicate when SIM notifies applcations some event happens.
- * Generally, application does not need to have any feedback to
- * SIM but shall be able to indicate appropriate messages to users.
- *
- * "data" is a const char * containing SAT/USAT commands or responses
- * sent by ME to SIM or commands handled by ME, in hexadecimal format string
- * starting with first byte of response data or command tag
- *
- */
-#define RIL_UNSOL_STK_EVENT_NOTIFY 1014
-
-/**
- * RIL_UNSOL_STK_CALL_SETUP
- *
- * Indicate when SIM wants application to setup a voice call.
- *
- * "data" is const int *
- * ((const int *)data)[0] contains timeout value (in milliseconds)
- */
-#define RIL_UNSOL_STK_CALL_SETUP 1015
-
-/**
- * RIL_UNSOL_SIM_SMS_STORAGE_FULL
- *
- * Indicates that SMS storage on the SIM is full. Sent when the network
- * attempts to deliver a new SMS message. Messages cannot be saved on the
- * SIM until space is freed. In particular, incoming Class 2 messages
- * cannot be stored.
- *
- * "data" is null
- *
- */
-#define RIL_UNSOL_SIM_SMS_STORAGE_FULL 1016
-
-/**
- * RIL_UNSOL_SIM_REFRESH
- *
- * Indicates that file(s) on the SIM have been updated, or the SIM
- * has been reinitialized.
- *
- * In the case where RIL is version 6 or older:
- * "data" is an int *
- * ((int *)data)[0] is a RIL_SimRefreshResult.
- * ((int *)data)[1] is the EFID of the updated file if the result is
- * SIM_FILE_UPDATE or NULL for any other result.
- *
- * In the case where RIL is version 7:
- * "data" is a RIL_SimRefreshResponse_v7 *
- *
- * Note: If the SIM state changes as a result of the SIM refresh (eg,
- * SIM_READY -> SIM_LOCKED_OR_ABSENT), RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED
- * should be sent.
- */
-#define RIL_UNSOL_SIM_REFRESH 1017
-
-/**
- * RIL_UNSOL_CALL_RING
- *
- * Ring indication for an incoming call (eg, RING or CRING event).
- * There must be at least one RIL_UNSOL_CALL_RING at the beginning
- * of a call and sending multiple is optional. If the system property
- * ro.telephony.call_ring.multiple is false then the upper layers
- * will generate the multiple events internally. Otherwise the vendor
- * ril must generate multiple RIL_UNSOL_CALL_RING if
- * ro.telephony.call_ring.multiple is true or if it is absent.
- *
- * The rate of these events is controlled by ro.telephony.call_ring.delay
- * and has a default value of 3000 (3 seconds) if absent.
- *
- * "data" is null for GSM
- * "data" is const RIL_CDMA_SignalInfoRecord * if CDMA
- */
-#define RIL_UNSOL_CALL_RING 1018
-
-/**
- * RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED
- *
- * Indicates that SIM state changes.
- *
- * Callee will invoke RIL_REQUEST_GET_SIM_STATUS on main thread
-
- * "data" is null
- */
-#define RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED 1019
-
-/**
- * RIL_UNSOL_RESPONSE_CDMA_NEW_SMS
- *
- * Called when new CDMA SMS is received
- *
- * "data" is const RIL_CDMA_SMS_Message *
- *
- * Callee will subsequently confirm the receipt of the SMS with
- * a RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE
- *
- * No new RIL_UNSOL_RESPONSE_CDMA_NEW_SMS should be sent until
- * RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE has been received
- *
- */
-#define RIL_UNSOL_RESPONSE_CDMA_NEW_SMS 1020
-
-/**
- * RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS
- *
- * Called when new Broadcast SMS is received
- *
- * "data" can be one of the following:
- * If received from GSM network, "data" is const char of 88 bytes
- * which indicates each page of a CBS Message sent to the MS by the
- * BTS as coded in 3GPP 23.041 Section 9.4.1.2.
- * If received from UMTS network, "data" is const char of 90 up to 1252
- * bytes which contain between 1 and 15 CBS Message pages sent as one
- * packet to the MS by the BTS as coded in 3GPP 23.041 Section 9.4.2.2.
- *
- */
-#define RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS 1021
-
-/**
- * RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL
- *
- * Indicates that SMS storage on the RUIM is full. Messages
- * cannot be saved on the RUIM until space is freed.
- *
- * "data" is null
- *
- */
-#define RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL 1022
-
-/**
- * RIL_UNSOL_RESTRICTED_STATE_CHANGED
- *
- * Indicates a restricted state change (eg, for Domain Specific Access Control).
- *
- * Radio need send this msg after radio off/on cycle no matter it is changed or not.
- *
- * "data" is an int *
- * ((int *)data)[0] contains a bitmask of RIL_RESTRICTED_STATE_* values.
- */
-#define RIL_UNSOL_RESTRICTED_STATE_CHANGED 1023
-
-/**
- * RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE
- *
- * Indicates that the radio system selection module has
- * autonomously entered emergency callback mode.
- *
- * "data" is null
- *
- */
-#define RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE 1024
-
-/**
- * RIL_UNSOL_CDMA_CALL_WAITING
- *
- * Called when CDMA radio receives a call waiting indication.
- *
- * "data" is const RIL_CDMA_CallWaiting *
- *
- */
-#define RIL_UNSOL_CDMA_CALL_WAITING 1025
-
-/**
- * RIL_UNSOL_CDMA_OTA_PROVISION_STATUS
- *
- * Called when CDMA radio receives an update of the progress of an
- * OTASP/OTAPA call.
- *
- * "data" is const int *
- * For CDMA this is an integer OTASP/OTAPA status listed in
- * RIL_CDMA_OTA_ProvisionStatus.
- *
- */
-#define RIL_UNSOL_CDMA_OTA_PROVISION_STATUS 1026
-
-/**
- * RIL_UNSOL_CDMA_INFO_REC
- *
- * Called when CDMA radio receives one or more info recs.
- *
- * "data" is const RIL_CDMA_InformationRecords *
- *
- */
-#define RIL_UNSOL_CDMA_INFO_REC 1027
-
-/**
- * RIL_UNSOL_OEM_HOOK_RAW
- *
- * This is for OEM specific use.
- *
- * "data" is a byte[]
- */
-#define RIL_UNSOL_OEM_HOOK_RAW 1028
-
-/**
- * RIL_UNSOL_RINGBACK_TONE
- *
- * Indicates that nework doesn't have in-band information, need to
- * play out-band tone.
- *
- * "data" is an int *
- * ((int *)data)[0] == 0 for stop play ringback tone.
- * ((int *)data)[0] == 1 for start play ringback tone.
- */
-#define RIL_UNSOL_RINGBACK_TONE 1029
-
-/**
- * RIL_UNSOL_RESEND_INCALL_MUTE
- *
- * Indicates that framework/application need reset the uplink mute state.
- *
- * There may be situations where the mute state becomes out of sync
- * between the application and device in some GSM infrastructures.
- *
- * "data" is null
- */
-#define RIL_UNSOL_RESEND_INCALL_MUTE 1030
-
-/**
- * RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED
- *
- * Called when CDMA subscription source changed.
- *
- * "data" is int *
- * ((int *)data)[0] is == RIL_CdmaSubscriptionSource
- */
-#define RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED 1031
-
-/**
- * RIL_UNSOL_CDMA_PRL_CHANGED
- *
- * Called when PRL (preferred roaming list) changes.
- *
- * "data" is int *
- * ((int *)data)[0] is PRL_VERSION as would be returned by RIL_REQUEST_CDMA_SUBSCRIPTION
- */
-#define RIL_UNSOL_CDMA_PRL_CHANGED 1032
-
-/**
- * RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE
- *
- * Called when Emergency Callback Mode Ends
- *
- * Indicates that the radio system selection module has
- * proactively exited emergency callback mode.
- *
- * "data" is NULL
- *
- */
-#define RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE 1033
-
-/**
- * RIL_UNSOL_RIL_CONNECTED
- *
- * Called the ril connects and returns the version
- *
- * "data" is int *
- * ((int *)data)[0] is RIL_VERSION
- */
-#define RIL_UNSOL_RIL_CONNECTED 1034
-
-/**
- * RIL_UNSOL_VOICE_RADIO_TECH_CHANGED
- *
- * Indicates that voice technology has changed. Contains new radio technology
- * as a data in the message.
- *
- * "data" is int *
- * ((int *)data)[0] is of type const RIL_RadioTechnology
- *
- */
-#define RIL_UNSOL_VOICE_RADIO_TECH_CHANGED 1035
-
-/**
- * RIL_UNSOL_CELL_INFO_LIST
- *
- * Same information as returned by RIL_REQUEST_GET_CELL_INFO_LIST, but returned
- * at the rate no greater than specified by RIL_REQUEST_SET_UNSOL_CELL_INFO_RATE.
- *
- * "data" is NULL
- *
- * "response" is an array of RIL_CellInfo.
- */
-#define RIL_UNSOL_CELL_INFO_LIST 1036
-
-/**
- * RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED
- *
- * Called when IMS registration state has changed
- *
- * To get IMS registration state and IMS SMS format, callee needs to invoke the
- * following request on main thread:
- *
- * RIL_REQUEST_IMS_REGISTRATION_STATE
- *
- * "data" is NULL
- *
- */
-#define RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED 1037
-
-/**
- * RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED
- *
- * Indicated when there is a change in subscription status.
- * This event will be sent in the following scenarios
- * - subscription readiness at modem, which was selected by telephony layer
- * - when subscription is deactivated by modem due to UICC card removal
- * - When network invalidates the subscription i.e. attach reject due to authentication reject
- *
- * "data" is const int *
- * ((const int *)data)[0] == 0 for Subscription Deactivated
- * ((const int *)data)[0] == 1 for Subscription Activated
- *
- */
-#define RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED 1038
-
-/**
- * RIL_UNSOL_SRVCC_STATE_NOTIFY
- *
- * Called when Single Radio Voice Call Continuity(SRVCC)
- * progress state has changed
- *
- * "data" is int *
- * ((int *)data)[0] is of type const RIL_SrvccState
- *
- */
-
-#define RIL_UNSOL_SRVCC_STATE_NOTIFY 1039
-
-/**
- * RIL_UNSOL_HARDWARE_CONFIG_CHANGED
- *
- * Called when the hardware configuration associated with the RILd changes
- *
- * "data" is an array of RIL_HardwareConfig
- *
- */
-#define RIL_UNSOL_HARDWARE_CONFIG_CHANGED 1040
-
-/**
- * RIL_UNSOL_DC_RT_INFO_CHANGED
- *
- * The message is DEPRECATED, use RIL_REQUEST_GET_ACTIVITY_INFO
- * Sent when the DC_RT_STATE changes but the time
- * between these messages must not be less than the
- * value set by RIL_REQUEST_SET_DC_RT_RATE.
- *
- * "data" is the most recent RIL_DcRtInfo
- *
- */
-#define RIL_UNSOL_DC_RT_INFO_CHANGED 1041
-
-/**
- * RIL_UNSOL_RADIO_CAPABILITY
- *
- * Sent when RIL_REQUEST_SET_RADIO_CAPABILITY completes.
- * Returns the phone radio capability exactly as
- * RIL_REQUEST_GET_RADIO_CAPABILITY and should be the
- * same set as sent by RIL_REQUEST_SET_RADIO_CAPABILITY.
- *
- * "data" is the RIL_RadioCapability structure
- */
-#define RIL_UNSOL_RADIO_CAPABILITY 1042
-
-/*
- * RIL_UNSOL_ON_SS
- *
- * Called when SS response is received when DIAL/USSD/SS is changed to SS by
- * call control.
- *
- * "data" is const RIL_StkCcUnsolSsResponse *
- *
- */
-#define RIL_UNSOL_ON_SS 1043
-
-/**
- * RIL_UNSOL_STK_CC_ALPHA_NOTIFY
- *
- * Called when there is an ALPHA from UICC during Call Control.
- *
- * "data" is const char * containing ALPHA string from UICC in UTF-8 format.
- *
- */
-#define RIL_UNSOL_STK_CC_ALPHA_NOTIFY 1044
-
- /**
- * RIL_UNSOL_LCEDATA_RECV
- *
- * Called when there is an incoming Link Capacity Estimate (LCE) info report.
- *
- * "data" is the RIL_LceDataInfo structure.
- *
- */
-#define RIL_UNSOL_LCEDATA_RECV 1045
-
-/* SAMSUNG RESPONSE */
-#define SAMSUNG_UNSOL_RESPONSE_BASE 11000
-
-#define RIL_UNSOL_RELEASE_COMPLETE_MESSAGE 11001
-#define RIL_UNSOL_STK_SEND_SMS_RESULT 11002
-#define RIL_UNSOL_STK_CALL_CONTROL_RESULT 11003
-#define RIL_UNSOL_DUN_CALL_STATUS 11004
-
-#define RIL_UNSOL_O2_HOME_ZONE_INFO 11007
-#define RIL_UNSOL_DEVICE_READY_NOTI 11008
-#define RIL_UNSOL_GPS_NOTI 11009
-#define RIL_UNSOL_AM 11010
-#define RIL_UNSOL_DUN_PIN_CONTROL_SIGNAL 11011
-#define RIL_UNSOL_DATA_SUSPEND_RESUME 11012
-#define RIL_UNSOL_SAP 11013
-
-#define RIL_UNSOL_SIM_SMS_STORAGE_AVAILALE 11015
-#define RIL_UNSOL_HSDPA_STATE_CHANGED 11016
-#define RIL_UNSOL_WB_AMR_STATE 11017
-#define RIL_UNSOL_TWO_MIC_STATE 11018
-#define RIL_UNSOL_DHA_STATE 11019
-#define RIL_UNSOL_UART 11020
-#define RIL_UNSOL_RESPONSE_HANDOVER 11021
-#define RIL_UNSOL_IPV6_ADDR 11022
-#define RIL_UNSOL_NWK_INIT_DISC_REQUEST 11023
-#define RIL_UNSOL_RTS_INDICATION 11024
-#define RIL_UNSOL_OMADM_SEND_DATA 11025
-#define RIL_UNSOL_DUN 11026
-#define RIL_UNSOL_SYSTEM_REBOOT 11027
-#define RIL_UNSOL_VOICE_PRIVACY_CHANGED 11028
-#define RIL_UNSOL_UTS_GETSMSCOUNT 11029
-#define RIL_UNSOL_UTS_GETSMSMSG 11030
-#define RIL_UNSOL_UTS_GET_UNREAD_SMS_STATUS 11031
-#define RIL_UNSOL_MIP_CONNECT_STATUS 11032
-
-/***********************************************************************/
-
-
-#if defined(ANDROID_MULTI_SIM)
-/**
- * RIL_Request Function pointer
- *
- * @param request is one of RIL_REQUEST_*
- * @param data is pointer to data defined for that RIL_REQUEST_*
- * data is owned by caller, and should not be modified or freed by callee
- * @param t should be used in subsequent call to RIL_onResponse
- * @param datalen the length of data
- *
- */
-typedef void (*RIL_RequestFunc) (int request, void *data,
- size_t datalen, RIL_Token t, RIL_SOCKET_ID socket_id);
-
-/**
- * This function should return the current radio state synchronously
- */
-typedef RIL_RadioState (*RIL_RadioStateRequest)(RIL_SOCKET_ID socket_id);
-
-#else
-/* Backward compatible */
-
-/**
- * RIL_Request Function pointer
- *
- * @param request is one of RIL_REQUEST_*
- * @param data is pointer to data defined for that RIL_REQUEST_*
- * data is owned by caller, and should not be modified or freed by callee
- * @param t should be used in subsequent call to RIL_onResponse
- * @param datalen the length of data
- *
- */
-typedef void (*RIL_RequestFunc) (int request, void *data,
- size_t datalen, RIL_Token t);
-
-/**
- * This function should return the current radio state synchronously
- */
-typedef RIL_RadioState (*RIL_RadioStateRequest)();
-
-#endif
-
-
-/**
- * This function returns "1" if the specified RIL_REQUEST code is
- * supported and 0 if it is not
- *
- * @param requestCode is one of RIL_REQUEST codes
- */
-
-typedef int (*RIL_Supports)(int requestCode);
-
-/**
- * This function is called from a separate thread--not the
- * thread that calls RIL_RequestFunc--and indicates that a pending
- * request should be cancelled.
- *
- * On cancel, the callee should do its best to abandon the request and
- * call RIL_onRequestComplete with RIL_Errno CANCELLED at some later point.
- *
- * Subsequent calls to RIL_onRequestComplete for this request with
- * other results will be tolerated but ignored. (That is, it is valid
- * to ignore the cancellation request)
- *
- * RIL_Cancel calls should return immediately, and not wait for cancellation
- *
- * Please see ITU v.250 5.6.1 for how one might implement this on a TS 27.007
- * interface
- *
- * @param t token wants to be canceled
- */
-
-typedef void (*RIL_Cancel)(RIL_Token t);
-
-typedef void (*RIL_TimedCallback) (void *param);
-
-/**
- * Return a version string for your RIL implementation
- */
-typedef const char * (*RIL_GetVersion) (void);
-
-typedef struct {
- int version; /* set to RIL_VERSION */
- RIL_RequestFunc onRequest;
- RIL_RadioStateRequest onStateRequest;
- RIL_Supports supports;
- RIL_Cancel onCancel;
- RIL_GetVersion getVersion;
-} RIL_RadioFunctions;
-
-typedef struct {
- char *apn;
- char *protocol;
- int authtype;
- char *username;
- char *password;
-} RIL_InitialAttachApn;
-
-typedef struct {
- int authContext; /* P2 value of authentication command, see P2 parameter in
- 3GPP TS 31.102 7.1.2 */
- char *authData; /* the challenge string in Base64 format, see 3GPP
- TS 31.102 7.1.2 */
- char *aid; /* AID value, See ETSI 102.221 8.1 and 101.220 4,
- NULL if no value. */
-} RIL_SimAuthentication;
-
-#ifdef RIL_SHLIB
-struct RIL_Env {
- /**
- * "t" is parameter passed in on previous call to RIL_Notification
- * routine.
- *
- * If "e" != SUCCESS, then response can be null/is ignored
- *
- * "response" is owned by caller, and should not be modified or
- * freed by callee
- *
- * RIL_onRequestComplete will return as soon as possible
- */
- void (*OnRequestComplete)(RIL_Token t, RIL_Errno e,
- void *response, size_t responselen);
-
-#if defined(ANDROID_MULTI_SIM)
- /**
- * "unsolResponse" is one of RIL_UNSOL_RESPONSE_*
- * "data" is pointer to data defined for that RIL_UNSOL_RESPONSE_*
- *
- * "data" is owned by caller, and should not be modified or freed by callee
- */
- void (*OnUnsolicitedResponse)(int unsolResponse, const void *data, size_t datalen, RIL_SOCKET_ID socket_id);
-#else
- /**
- * "unsolResponse" is one of RIL_UNSOL_RESPONSE_*
- * "data" is pointer to data defined for that RIL_UNSOL_RESPONSE_*
- *
- * "data" is owned by caller, and should not be modified or freed by callee
- */
- void (*OnUnsolicitedResponse)(int unsolResponse, const void *data, size_t datalen);
-#endif
- /**
- * Call user-specifed "callback" function on on the same thread that
- * RIL_RequestFunc is called. If "relativeTime" is specified, then it specifies
- * a relative time value at which the callback is invoked. If relativeTime is
- * NULL or points to a 0-filled structure, the callback will be invoked as
- * soon as possible
- */
-
- void (*RequestTimedCallback) (RIL_TimedCallback callback,
- void *param, const struct timeval *relativeTime);
-};
-
-
-/**
- * RIL implementations must defined RIL_Init
- * argc and argv will be command line arguments intended for the RIL implementation
- * Return NULL on error
- *
- * @param env is environment point defined as RIL_Env
- * @param argc number of arguments
- * @param argv list fo arguments
- *
- */
-const RIL_RadioFunctions *RIL_Init(const struct RIL_Env *env, int argc, char **argv);
-
-#else /* RIL_SHLIB */
-
-/**
- * Call this once at startup to register notification routine
- *
- * @param callbacks user-specifed callback function
- */
-void RIL_register (const RIL_RadioFunctions *callbacks);
-
-
-/**
- *
- * RIL_onRequestComplete will return as soon as possible
- *
- * @param t is parameter passed in on previous call to RIL_Notification
- * routine.
- * @param e error code
- * if "e" != SUCCESS, then response can be null/is ignored
- * @param response is owned by caller, and should not be modified or
- * freed by callee
- * @param responselen the length of response in byte
- */
-void RIL_onRequestComplete(RIL_Token t, RIL_Errno e,
- void *response, size_t responselen);
-
-#if defined(ANDROID_MULTI_SIM)
-/**
- * @param unsolResponse is one of RIL_UNSOL_RESPONSE_*
- * @param data is pointer to data defined for that RIL_UNSOL_RESPONSE_*
- * "data" is owned by caller, and should not be modified or freed by callee
- * @param datalen the length of data in byte
- */
-
-void RIL_onUnsolicitedResponse(int unsolResponse, const void *data,
- size_t datalen, RIL_SOCKET_ID socket_id);
-#else
-/**
- * @param unsolResponse is one of RIL_UNSOL_RESPONSE_*
- * @param data is pointer to data defined for that RIL_UNSOL_RESPONSE_*
- * "data" is owned by caller, and should not be modified or freed by callee
- * @param datalen the length of data in byte
- */
-
-void RIL_onUnsolicitedResponse(int unsolResponse, const void *data,
- size_t datalen);
-#endif
-
-/**
- * Call user-specifed "callback" function on on the same thread that
- * RIL_RequestFunc is called. If "relativeTime" is specified, then it specifies
- * a relative time value at which the callback is invoked. If relativeTime is
- * NULL or points to a 0-filled structure, the callback will be invoked as
- * soon as possible
- *
- * @param callback user-specifed callback function
- * @param param parameter list
- * @param relativeTime a relative time value at which the callback is invoked
- */
-
-void RIL_requestTimedCallback (RIL_TimedCallback callback,
- void *param, const struct timeval *relativeTime);
-
-
-#endif /* RIL_SHLIB */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*ANDROID_RIL_H*/
diff --git a/libsamsung_symbols/samsung_ril.cpp b/libsamsung_symbols/samsung_ril.cpp
deleted file mode 100644
index 404616d..0000000
--- a/libsamsung_symbols/samsung_ril.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 2015 The CyanogenMod Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* status_t Parcel::writeString16 */
-extern "C" int _ZN7android6Parcel13writeString16EPKDsj();
-extern "C" int _ZN7android6Parcel13writeString16EPKtj() {
- return _ZN7android6Parcel13writeString16EPKDsj();
-}
diff --git a/libsensors/AccelSensor.cpp b/libsensors/AccelSensor.cpp
deleted file mode 100644
index d5040c1..0000000
--- a/libsensors/AccelSensor.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <fcntl.h>
-#include <errno.h>
-#include <math.h>
-#include <poll.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <dirent.h>
-#include <sys/select.h>
-#include <linux/ioctl.h>
-#include <linux/types.h>
-#include <linux/uinput.h>
-#include <cutils/log.h>
-#include <cstring>
-
-
-#include "AccelSensor.h"
-
-#define LOGTAG "AccelerometerSensor"
-
-// ioctls
-#define LSM330DLC_ACCEL_IOCTL_BASE 'a'
-#define LSM330DLC_ACCEL_IOCTL_SET_ENABLE \
- _IOW(LSM330DLC_ACCEL_IOCTL_BASE, 9, int)
-
-
-/*****************************************************************************/
-AccelSensor::AccelSensor()
- : SensorBase("/dev/acceleration", "accelerometer_sensor"),
- mEnabled(0),
- mInputReader(4),
- mHasPendingEvent(false)
-{
-
- mPendingEvent.version = sizeof(sensors_event_t);
- mPendingEvent.sensor = ID_A;
- mPendingEvent.type = SENSOR_TYPE_ACCELEROMETER;
- memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data));
-
- if (data_fd) {
- strcpy(input_sysfs_path, "/sys/class/input/");
- strcat(input_sysfs_path, input_name);
- strcat(input_sysfs_path, "/device/");
- input_sysfs_path_len = strlen(input_sysfs_path);
- }
-}
-
-AccelSensor::~AccelSensor() {
-
- // ALOGD("AccelSensor::~AccelSensor()");
- if (mEnabled) {
- enable(0, 0);
- }
-}
-
-int AccelSensor::setInitialState() {
- return 0;
-}
-
-int AccelSensor::enable(int32_t handle, int en) {
- int flags = en ? 1 : 0;
- int fd;
- if (flags != mEnabled) {
- strcpy(&input_sysfs_path[input_sysfs_path_len], "enable");
- fd = open(input_sysfs_path, O_RDWR);
- if (fd >= 0) {
- write(fd, en == 1 ? "1" : "0", 2);
- close(fd);
- mEnabled = flags;
- setInitialState();
- return 0;
- }
- return -1;
- }
- return 0;
-}
-
-
-bool AccelSensor::hasPendingEvents() const {
- /* FIXME probably here should be returning mEnabled but instead
- mHasPendingEvents. It does not work, so we cheat.*/
- //ALOGD("AccelSensor::~hasPendingEvents %d", mHasPendingEvent ? 1 : 0 );
- return mHasPendingEvent;
-}
-
-
-int AccelSensor::setDelay(int32_t handle, int64_t ns)
-{
- int fd;
-
- if (ns < 10000000) {
- ns = 10000000; // Minimum on stock
- }
-
- strcpy(&input_sysfs_path[input_sysfs_path_len], "poll_delay");
- fd = open(input_sysfs_path, O_RDWR);
- if (fd >= 0) {
- char buf[80];
- sprintf(buf, "%lld", ns);
- write(fd, buf, strlen(buf)+1);
- close(fd);
- return 0;
- }
- return -1;
-}
-
-
-int AccelSensor::readEvents(sensors_event_t* data, int count)
-{
- if (count < 1)
- return -EINVAL;
-
- if (mHasPendingEvent) {
- mHasPendingEvent = false;
- mPendingEvent.timestamp = getTimestamp();
- *data = mPendingEvent;
- return mEnabled ? 1 : 0;
- }
-
- ssize_t n = mInputReader.fill(data_fd);
- if (n < 0)
- return n;
- int numEventReceived = 0;
- input_event const* event;
-
- while (count && mInputReader.readEvent(&event)) {
- int type = event->type;
- if (type == EV_REL) {
- float value = event->value;
- if (event->code == EVENT_TYPE_ACCEL_X) {
- mPendingEvent.acceleration.x = value * CONVERT_A_X;
- } else if (event->code == EVENT_TYPE_ACCEL_Y) {
- mPendingEvent.acceleration.y = value * CONVERT_A_Y;
- } else if (event->code == EVENT_TYPE_ACCEL_Z) {
- mPendingEvent.acceleration.z = value * CONVERT_A_Z;
- }
- } else if (type == EV_SYN) {
- mPendingEvent.timestamp = timevalToNano(event->time);
- if (mEnabled) {
- *data++ = mPendingEvent;
- count--;
- numEventReceived++;
- }
- } else {
- ALOGE("%s: unknown event (type=%d, code=%d)", LOGTAG,
- type, event->code);
- }
-
- mInputReader.next();
- }
- return numEventReceived++;
-
-}
diff --git a/libsensors/AccelSensor.h b/libsensors/AccelSensor.h
deleted file mode 100644
index 09508e9..0000000
--- a/libsensors/AccelSensor.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_SMB380_SENSOR_H
-#define ANDROID_SMB380_SENSOR_H
-
-#include <stdint.h>
-#include <errno.h>
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-#include "sensors.h"
-#include "SensorBase.h"
-#include "InputEventReader.h"
-
-/*****************************************************************************/
-
-
-struct smb380acc_t {
- short x, /**< holds x-axis acceleration data sign extended. Range -512 to 511. */
- y, /**< holds y-axis acceleration data sign extended. Range -512 to 511. */
- z; /**< holds z-axis acceleration data sign extended. Range -512 to 511. */
-} ;
-
-/* smb ioctl command label */
-#define IOCTL_SMB_GET_ACC_VALUE 0
-#define DCM_IOC_MAGIC 's'
-#define IOC_SET_ACCELEROMETER _IO (DCM_IOC_MAGIC, 0x64)
-#define BMA150_CALIBRATION _IOWR(DCM_IOC_MAGIC,48,short)
-
-#define SMB_POWER_OFF 0
-#define SMB_POWER_ON 1
-
-struct input_event;
-
-class AccelSensor : public SensorBase {
- int mEnabled;
- InputEventCircularReader mInputReader;
- sensors_event_t mPendingEvent;
- bool mHasPendingEvent;
- char input_sysfs_path[PATH_MAX];
- int input_sysfs_path_len;
-// int mUinputDevice;
-
- int setInitialState();
-
-public:
- AccelSensor();
- virtual ~AccelSensor();
-// virtual int createUinput();
- virtual int readEvents(sensors_event_t* data, int count);
- virtual bool hasPendingEvents() const;
- virtual int setDelay(int32_t handle, int64_t ns);
- virtual int enable(int32_t handle, int enabled);
-};
-
-/*****************************************************************************/
-
-#endif // ANDROID_GYRO_SENSOR_H
diff --git a/libsensors/AkmSensor.cpp b/libsensors/AkmSensor.cpp
deleted file mode 100644
index e7e0a4b..0000000
--- a/libsensors/AkmSensor.cpp
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <fcntl.h>
-#include <errno.h>
-#include <math.h>
-#include <poll.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <sys/select.h>
-#include <dlfcn.h>
-#include <cstring>
-
-#include "ak8973b.h"
-
-#include <cutils/log.h>
-#include "AkmSensor.h"
-
-
-/*****************************************************************************/
-
-int (*akm_is_sensor_enabled)(uint32_t sensor_type);
-int (*akm_enable_sensor)(uint32_t sensor_type);
-int (*akm_disable_sensor)(uint32_t sensor_type);
-int (*akm_set_delay)(uint32_t sensor_type, uint64_t delay);
-
-int stub_is_sensor_enabled(uint32_t sensor_type) {
- return 0;
-}
-
-int stub_enable_disable_sensor(uint32_t sensor_type) {
- return -ENODEV;
-}
-
-int stub_set_delay(uint32_t sensor_type, uint64_t delay) {
- return -ENODEV;
-}
-
-AkmSensor::AkmSensor()
-: SensorBase(NULL, NULL),
- mEnabled(0),
- mPendingMask(0),
- mInputReader(32)
-{
- /* Open the library before opening the input device. The library
- * creates a uinput device.
- */
- if (loadAKMLibrary() == 0) {
- data_name = "compass_sensor";
- data_fd = openInput("compass_sensor");
- }
-
- memset(mPendingEvents, 0, sizeof(mPendingEvents));
-
- mPendingEvents[Accelerometer].version = sizeof(sensors_event_t);
- mPendingEvents[Accelerometer].sensor = ID_A;
- mPendingEvents[Accelerometer].type = SENSOR_TYPE_ACCELEROMETER;
- mPendingEvents[Accelerometer].acceleration.status = SENSOR_STATUS_UNRELIABLE;
-
- mPendingEvents[MagneticField].version = sizeof(sensors_event_t);
- mPendingEvents[MagneticField].sensor = ID_M;
- mPendingEvents[MagneticField].type = SENSOR_TYPE_MAGNETIC_FIELD;
- mPendingEvents[MagneticField].magnetic.status = SENSOR_STATUS_UNRELIABLE;
-
- // read the actual value of all sensors if they're enabled already
- struct input_absinfo absinfo;
- short flags = 0;
-
- if (akm_is_sensor_enabled(SENSOR_TYPE_ACCELEROMETER)) {
- mEnabled |= 1<<Accelerometer;
- if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_ACCEL_X), &absinfo)) {
- mPendingEvents[Accelerometer].acceleration.x = absinfo.value * CONVERT_A_X;
- }
- if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_ACCEL_Y), &absinfo)) {
- mPendingEvents[Accelerometer].acceleration.y = absinfo.value * CONVERT_A_Y;
- }
- if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_ACCEL_Z), &absinfo)) {
- mPendingEvents[Accelerometer].acceleration.z = absinfo.value * CONVERT_A_Z;
- }
- }
- if (akm_is_sensor_enabled(SENSOR_TYPE_MAGNETIC_FIELD)) {
- mEnabled |= 1<<MagneticField;
- if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_MAGV_X), &absinfo)) {
- mPendingEvents[MagneticField].magnetic.x = absinfo.value * CONVERT_M_X;
- }
- if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_MAGV_Y), &absinfo)) {
- mPendingEvents[MagneticField].magnetic.y = absinfo.value * CONVERT_M_Y;
- }
- if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_MAGV_Z), &absinfo)) {
- mPendingEvents[MagneticField].magnetic.z = absinfo.value * CONVERT_M_Z;
- }
- }
-
- // disable temperature sensor, since it is not supported
- akm_disable_sensor(SENSOR_TYPE_TEMPERATURE);
-}
-
-AkmSensor::~AkmSensor()
-{
- if (mLibAKM) {
- unsigned ref = ::dlclose(mLibAKM);
- }
-}
-
-int AkmSensor::enable(int32_t handle, int en)
-{
- int what = -1;
-
- switch (handle) {
- case ID_A: what = Accelerometer; break;
- case ID_M: what = MagneticField; break;
- }
-
- if (uint32_t(what) >= numSensors)
- return -EINVAL;
-
- int newState = en ? 1 : 0;
- int err = 0;
-
- if ((uint32_t(newState)<<what) != (mEnabled & (1<<what))) {
- uint32_t sensor_type;
- switch (what) {
- case MagneticField: sensor_type = SENSOR_TYPE_MAGNETIC_FIELD; break;
- }
- short flags = newState;
- if (en)
- err = akm_enable_sensor(sensor_type);
- else
- err = akm_disable_sensor(sensor_type);
-
- ALOGE_IF(err, "Could not change sensor state (%s)", strerror(-err));
- if (!err) {
- mEnabled &= ~(1<<what);
- mEnabled |= (uint32_t(flags)<<what);
- }
- }
- return err;
-}
-
-int AkmSensor::setDelay(int32_t handle, int64_t ns)
-{
- int what = -1;
- uint32_t sensor_type = 0;
-
- if (ns < 0)
- return -EINVAL;
-
- switch (handle) {
- case ID_A: sensor_type = SENSOR_TYPE_ACCELEROMETER; break;
- case ID_M: sensor_type = SENSOR_TYPE_MAGNETIC_FIELD; break;
- }
-
- if (sensor_type == 0)
- return -EINVAL;
-
- mDelays[what] = ns;
- return update_delay();
-}
-
-int AkmSensor::update_delay()
-{
- if (mEnabled) {
- uint64_t wanted = -1LLU;
- for (int i=0 ; i<numSensors ; i++) {
- if (mEnabled & (1<<i)) {
- uint64_t ns = mDelays[i];
- wanted = wanted < ns ? wanted : ns;
- }
- }
- short delay = int64_t(wanted) / 1000000;
- if (ioctl(dev_fd, ECS_IOCTL_APP_SET_DELAY, &delay)) {
- return -errno;
- }
- }
- return 0;
-}
-
-
-int AkmSensor::loadAKMLibrary()
-{
- mLibAKM = dlopen("libakm.so", RTLD_NOW);
-
- if (!mLibAKM) {
- akm_is_sensor_enabled = stub_is_sensor_enabled;
- akm_enable_sensor = stub_enable_disable_sensor;
- akm_disable_sensor = stub_enable_disable_sensor;
- akm_set_delay = stub_set_delay;
- ALOGE("AkmSensor: unable to load AKM Library, %s", dlerror());
- return -ENOENT;
- }
-
- *(void **)&akm_is_sensor_enabled = dlsym(mLibAKM, "akm_is_sensor_enabled");
- *(void **)&akm_enable_sensor = dlsym(mLibAKM, "akm_enable_sensor");
- *(void **)&akm_disable_sensor = dlsym(mLibAKM, "akm_disable_sensor");
- *(void **)&akm_set_delay = dlsym(mLibAKM, "akm_set_delay");
-
- return 0;
-}
-
-int AkmSensor::readEvents(sensors_event_t* data, int count)
-{
- if (count < 1)
- return -EINVAL;
-
- ssize_t n = mInputReader.fill(data_fd);
- if (n < 0)
- return n;
-
- int numEventReceived = 0;
- input_event const* event;
-
- while (count && mInputReader.readEvent(&event)) {
- int type = event->type;
- if (type == EV_REL) {
- processEvent(event->code, event->value);
- mInputReader.next();
- } else if (type == EV_SYN) {
- int64_t time = timevalToNano(event->time);
- for (int j=0 ; count && mPendingMask && j<numSensors ; j++) {
- if (mPendingMask & (1<<j)) {
- mPendingMask &= ~(1<<j);
- mPendingEvents[j].timestamp = time;
- if (mEnabled & (1<<j)) {
- *data++ = mPendingEvents[j];
- count--;
- numEventReceived++;
- }
- }
- }
- if (!mPendingMask) {
- mInputReader.next();
- }
- } else {
- ALOGE("AkmSensor: unknown event (type=%d, code=%d)",
- type, event->code);
- mInputReader.next();
- }
- }
- return numEventReceived;
-}
-
-void AkmSensor::processEvent(int code, int value)
-{
- switch (code) {
- case EVENT_TYPE_MAGV_X:
- ALOGV("AkmSensor: MAGV_X =>%d", value);
- mPendingMask |= 1<<MagneticField;
- mPendingEvents[MagneticField].magnetic.x = (float)value * CONVERT_M_X;
- break;
- case EVENT_TYPE_MAGV_Y:
- ALOGV("AkmSensor: MAGV_Y =>%d", value);
- mPendingMask |= 1<<MagneticField;
- mPendingEvents[MagneticField].magnetic.y = (float)value * CONVERT_M_Y;
- break;
- case EVENT_TYPE_MAGV_Z:
- ALOGV("AkmSensor: MAGV_Z =>%d", value);
- mPendingMask |= 1<<MagneticField;
- mPendingEvents[MagneticField].magnetic.z = (float)value * CONVERT_M_Z;
- break;
- case EVENT_TYPE_MAGV_ACC:
- ALOGV("AkmSensor: MAGV_ACC=>%d", value);
- mPendingMask |= 1<<MagneticField;
- mPendingEvents[MagneticField].magnetic.status = value;
- default:
- ALOGV("AkmSensor: unkown REL event code=%d, value=%d", code, value);
- break;
- }
-}
diff --git a/libsensors/AkmSensor.h b/libsensors/AkmSensor.h
deleted file mode 100644
index 8df3930..0000000
--- a/libsensors/AkmSensor.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_AKM_SENSOR_H
-#define ANDROID_AKM_SENSOR_H
-
-#include <stdint.h>
-#include <errno.h>
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-
-#include "sensors.h"
-#include "SensorBase.h"
-#include "InputEventReader.h"
-
-/*****************************************************************************/
-
-struct input_event;
-
-class AkmSensor : public SensorBase {
-public:
- AkmSensor();
- virtual ~AkmSensor();
-
- enum {
- Accelerometer = 0,
- MagneticField = 1,
- numSensors
- };
-
- virtual int setDelay(int32_t handle, int64_t ns);
- virtual int enable(int32_t handle, int enabled);
- virtual int readEvents(sensors_event_t* data, int count);
- void processEvent(int code, int value);
-
-private:
- int loadAKMLibrary();
- int update_delay();
- void *mLibAKM;
- uint32_t mEnabled;
- uint32_t mPendingMask;
- InputEventCircularReader mInputReader;
- sensors_event_t mPendingEvents[numSensors];
- uint64_t mDelays[numSensors];
-};
-
-/*****************************************************************************/
-
-#endif // ANDROID_AKM_SENSOR_H
diff --git a/libsensors/Android.mk b/libsensors/Android.mk
index 636ad9d..8d15195 100644
--- a/libsensors/Android.mk
+++ b/libsensors/Android.mk
@@ -1,47 +1,48 @@
-# Copyright (C) 2008 The Android Open Source Project
+# Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
#
-# http://www.apache.org/licenses/LICENSE-2.0
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
LOCAL_PATH := $(call my-dir)
-ifneq ($(TARGET_SIMULATOR),true)
-
-# HAL module implemenation, not prelinked, and stored in
-# hw/<SENSORS_HARDWARE_MODULE_ID>.<ro.product.board>.so
include $(CLEAR_VARS)
-LOCAL_MODULE := sensors.$(TARGET_BOOTLOADER_BOARD_NAME)
+LOCAL_SRC_FILES := \
+ smdk4x12_sensors.c \
+ input.c \
+ akm8975.c \
+ akmdfs/AKFS_APIs_8975/AKFS_AK8975.c \
+ akmdfs/AKFS_APIs_8975/AKFS_AOC.c \
+ akmdfs/AKFS_APIs_8975/AKFS_Device.c \
+ akmdfs/AKFS_APIs_8975/AKFS_Direction.c \
+ akmdfs/AKFS_APIs_8975/AKFS_VNorm.c \
+ akmdfs/AKFS_FileIO.c \
+ cm36651_proximity.c \
+ cm36651_light.c \
+ lsm330dlc_acceleration.c \
+ lsm330dlc_gyroscope.c \
+ lps331ap.c
+
+LOCAL_C_INCLUDES := \
+ $(LOCAL_PATH)/akmdfs \
+ $(LOCAL_PATH)/akmdfs/AKFS_APIs_8975 \
+ $(LOCAL_PATH)
+
+LOCAL_SHARED_LIBRARIES := libutils libcutils liblog libhardware
+LOCAL_PRELINK_MODULE := false
+LOCAL_MODULE := sensors.$(TARGET_BOOTLOADER_BOARD_NAME)
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
-
LOCAL_MODULE_TAGS := optional
-LOCAL_CFLAGS := -DLOG_TAG=\"sensorscpp\"
-LOCAL_SRC_FILES := \
- sensors.cpp \
- SensorBase.cpp \
- LightSensor.cpp \
- ProximitySensor.cpp \
- AkmSensor.cpp \
- GyroSensor.cpp \
- InputEventReader.cpp \
- AccelSensor.cpp \
- PressureSensor.cpp
-
-LOCAL_SHARED_LIBRARIES := liblog libcutils libdl
-LOCAL_PRELINK_MODULE := false
-
include $(BUILD_SHARED_LIBRARY)
-
-endif # !TARGET_SIMULATOR
diff --git a/libsensors/GyroSensor.cpp b/libsensors/GyroSensor.cpp
deleted file mode 100644
index ceb7d9c..0000000
--- a/libsensors/GyroSensor.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <fcntl.h>
-#include <errno.h>
-#include <math.h>
-#include <poll.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <sys/select.h>
-#include <cutils/log.h>
-#include <cstring>
-
-#include "GyroSensor.h"
-
-#define LOGTAG "GyroSensor"
-
-#define FETCH_FULL_EVENT_BEFORE_RETURN 1
-#define IGNORE_EVENT_TIME 350000000
-/*****************************************************************************/
-
-GyroSensor::GyroSensor()
- : SensorBase(NULL, "gyro_sensor"),
- mEnabled(0),
- mInputReader(4),
- mHasPendingEvent(false),
- mEnabledTime(0)
-{
- mPendingEvent.version = sizeof(sensors_event_t);
- mPendingEvent.sensor = ID_GY;
- mPendingEvent.type = SENSOR_TYPE_GYROSCOPE;
- memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data));
-
- if (data_fd) {
- strcpy(input_sysfs_path, "/sys/class/input/");
- strcat(input_sysfs_path, input_name);
- strcat(input_sysfs_path, "/device/");
- input_sysfs_path_len = strlen(input_sysfs_path);
- enable(0, 1);
- }
-}
-
-GyroSensor::~GyroSensor() {
- if (mEnabled) {
- enable(0, 0);
- }
-}
-
-int GyroSensor::setInitialState() {
- struct input_absinfo absinfo_x;
- struct input_absinfo absinfo_y;
- struct input_absinfo absinfo_z;
- float value;
- if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_GYRO_X), &absinfo_x) &&
- !ioctl(data_fd, EVIOCGABS(EVENT_TYPE_GYRO_X), &absinfo_y) &&
- !ioctl(data_fd, EVIOCGABS(EVENT_TYPE_GYRO_X), &absinfo_z)) {
- value = absinfo_x.value;
- mPendingEvent.data[0] = value * CONVERT_GYRO_X;
- value = absinfo_x.value;
- mPendingEvent.data[1] = value * CONVERT_GYRO_Y;
- value = absinfo_x.value;
- mPendingEvent.data[2] = value * CONVERT_GYRO_Z;
- mHasPendingEvent = true;
- }
- return 0;
-}
-
-int GyroSensor::enable(int32_t handle, int en) {
- int flags = en ? 1 : 0;
- int fd;
- if (flags != mEnabled) {
- strcpy(&input_sysfs_path[input_sysfs_path_len], "enable");
- fd = open(input_sysfs_path, O_RDWR);
- if (fd >= 0){
- write(fd, en == 1 ? "1" : "0", 2);
- close(fd);
- mEnabled = flags;
- setInitialState();
-
- return 0;
- }
- return -1;
- }
- return 0;
-}
-
-bool GyroSensor::hasPendingEvents() const {
- return mHasPendingEvent;
-}
-
-int GyroSensor::setDelay(int32_t handle, int64_t ns)
-{
- int fd;
-
- strcpy(&input_sysfs_path[input_sysfs_path_len], "poll_delay");
- fd = open(input_sysfs_path, O_RDWR);
- if (fd >= 0) {
- char buf[80];
- sprintf(buf, "%lld", ns);
- write(fd, buf, strlen(buf)+1);
- close(fd);
- return 0;
- }
- return -1;
-}
-
-int GyroSensor::readEvents(sensors_event_t* data, int count)
-{
- if (count < 1)
- return -EINVAL;
-
- if (mHasPendingEvent) {
- mHasPendingEvent = false;
- mPendingEvent.timestamp = getTimestamp();
- *data = mPendingEvent;
- return mEnabled ? 1 : 0;
- }
-
- ssize_t n = mInputReader.fill(data_fd);
- if (n < 0)
- return n;
-
- int numEventReceived = 0;
- input_event const* event;
-
-#if FETCH_FULL_EVENT_BEFORE_RETURN
-again:
-#endif
- while (count && mInputReader.readEvent(&event)) {
- int type = event->type;
- if (type == EV_REL) {
- float value = event->value;
- if (event->code == EVENT_TYPE_GYRO_X) {
- mPendingEvent.data[0] = value * CONVERT_GYRO_X;
- } else if (event->code == EVENT_TYPE_GYRO_Y) {
- mPendingEvent.data[1] = value * CONVERT_GYRO_Y;
- } else if (event->code == EVENT_TYPE_GYRO_Z) {
- mPendingEvent.data[2] = value * CONVERT_GYRO_Z;
- }
- } else if (type == EV_SYN) {
- mPendingEvent.timestamp = timevalToNano(event->time);
- if (mEnabled) {
- if (mPendingEvent.timestamp >= mEnabledTime) {
- *data++ = mPendingEvent;
- numEventReceived++;
- }
- count--;
- }
- } else {
- ALOGE("%s: unknown event (type=%d, code=%d)", LOGTAG,
- type, event->code);
- }
- mInputReader.next();
- }
-
-#if FETCH_FULL_EVENT_BEFORE_RETURN
- /* if we didn't read a complete event, see if we can fill and
- try again instead of returning with nothing and redoing poll. */
- if (numEventReceived == 0 && mEnabled == 1) {
- n = mInputReader.fill(data_fd);
- if (n)
- goto again;
- }
-#endif
-
- return numEventReceived;
-}
-
diff --git a/libsensors/GyroSensor.h b/libsensors/GyroSensor.h
deleted file mode 100644
index e8997de..0000000
--- a/libsensors/GyroSensor.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_GYRO_SENSOR_H
-#define ANDROID_GYRO_SENSOR_H
-
-#include <stdint.h>
-#include <errno.h>
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-#include "sensors.h"
-#include "SensorBase.h"
-#include "InputEventReader.h"
-
-/*****************************************************************************/
-
-struct input_event;
-
-class GyroSensor : public SensorBase {
- int mEnabled;
- InputEventCircularReader mInputReader;
- sensors_event_t mPendingEvent;
- bool mHasPendingEvent;
- char input_sysfs_path[PATH_MAX];
- int input_sysfs_path_len;
- int64_t mEnabledTime;
-
- int setInitialState();
-
-public:
- GyroSensor();
- virtual ~GyroSensor();
- virtual int readEvents(sensors_event_t* data, int count);
- virtual bool hasPendingEvents() const;
- virtual int setDelay(int32_t handle, int64_t ns);
- virtual int enable(int32_t handle, int enabled);
-};
-
-/*****************************************************************************/
-
-#endif // ANDROID_GYRO_SENSOR_H
diff --git a/libsensors/InputEventReader.cpp b/libsensors/InputEventReader.cpp
deleted file mode 100644
index ab23a22..0000000
--- a/libsensors/InputEventReader.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdint.h>
-#include <errno.h>
-#include <unistd.h>
-#include <poll.h>
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <cstring>
-
-#include <linux/input.h>
-
-#include <cutils/log.h>
-
-#include "InputEventReader.h"
-
-/*****************************************************************************/
-
-struct input_event;
-
-InputEventCircularReader::InputEventCircularReader(size_t numEvents)
- : mBuffer(new input_event[numEvents * 2]),
- mBufferEnd(mBuffer + numEvents),
- mHead(mBuffer),
- mCurr(mBuffer),
- mFreeSpace(numEvents)
-{
-}
-
-InputEventCircularReader::~InputEventCircularReader()
-{
- delete [] mBuffer;
-}
-
-ssize_t InputEventCircularReader::fill(int fd)
-{
- size_t numEventsRead = 0;
- if (mFreeSpace) {
- const ssize_t nread = read(fd, mHead, mFreeSpace * sizeof(input_event));
- if (nread<0 || nread % sizeof(input_event)) {
- // we got a partial event!!
- return nread<0 ? -errno : -EINVAL;
- }
-
- numEventsRead = nread / sizeof(input_event);
- if (numEventsRead) {
- mHead += numEventsRead;
- mFreeSpace -= numEventsRead;
- if (mHead > mBufferEnd) {
- size_t s = mHead - mBufferEnd;
- memcpy(mBuffer, mBufferEnd, s * sizeof(input_event));
- mHead = mBuffer + s;
- }
- }
- }
-
- return numEventsRead;
-}
-
-ssize_t InputEventCircularReader::readEvent(input_event const** events)
-{
- *events = mCurr;
- ssize_t available = (mBufferEnd - mBuffer) - mFreeSpace;
- return available ? 1 : 0;
-}
-
-void InputEventCircularReader::next()
-{
- mCurr++;
- mFreeSpace++;
- if (mCurr >= mBufferEnd) {
- mCurr = mBuffer;
- }
-}
diff --git a/libsensors/InputEventReader.h b/libsensors/InputEventReader.h
deleted file mode 100644
index 180aade..0000000
--- a/libsensors/InputEventReader.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_INPUT_EVENT_READER_H
-#define ANDROID_INPUT_EVENT_READER_H
-
-#include <stdint.h>
-#include <errno.h>
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-/*****************************************************************************/
-
-struct input_event;
-
-class InputEventCircularReader
-{
- struct input_event* const mBuffer;
- struct input_event* const mBufferEnd;
- struct input_event* mHead;
- struct input_event* mCurr;
- ssize_t mFreeSpace;
-
-public:
- InputEventCircularReader(size_t numEvents);
- ~InputEventCircularReader();
- ssize_t fill(int fd);
- ssize_t readEvent(input_event const** events);
- void next();
-};
-
-/*****************************************************************************/
-
-#endif // ANDROID_INPUT_EVENT_READER_H
diff --git a/libsensors/LightSensor.cpp b/libsensors/LightSensor.cpp
deleted file mode 100644
index 405348f..0000000
--- a/libsensors/LightSensor.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <fcntl.h>
-#include <errno.h>
-#include <math.h>
-#include <poll.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <sys/select.h>
-#include <cstring>
-
-#include <cutils/log.h>
-
-#include "LightSensor.h"
-
-#define LOGTAG "LightSensor"
-
-// #define ALOG_NDEBUG 0
-
-/*****************************************************************************/
-
-LightSensor::LightSensor()
- : SensorBase(NULL, "light_sensor"),
- mEnabled(0),
- mInputReader(4),
- mHasPendingEvent(false)
-{
- mPendingEvent.version = sizeof(sensors_event_t);
- mPendingEvent.sensor = ID_L;
- mPendingEvent.type = SENSOR_TYPE_LIGHT;
- memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data));
-
- if (data_fd) {
- strcpy(input_sysfs_path, "/sys/class/input/");
- strcat(input_sysfs_path, input_name);
- strcat(input_sysfs_path, "/device/");
- input_sysfs_path_len = strlen(input_sysfs_path);
- enable(0, 1);
- }
-}
-
-LightSensor::~LightSensor() {
- if (mEnabled) {
- enable(0, 0);
- }
-}
-
-int LightSensor::setInitialState() {
- struct input_absinfo absinfo;
- if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_LIGHT), &absinfo)) {
- // make sure to report an event immediately
- mHasPendingEvent = true;
- mPendingEvent.light = absinfo.value;
- }
- return 0;
-}
-
-int LightSensor::setDelay(int32_t handle, int64_t ns)
-{
- int fd;
-
- strcpy(&input_sysfs_path[input_sysfs_path_len], "poll_delay");
- fd = open(input_sysfs_path, O_RDWR);
- if (fd >= 0) {
- char buf[80];
- sprintf(buf, "%lld", ns);
- write(fd, buf, strlen(buf)+1);
- close(fd);
- return 0;
- }
- return -1;
-}
-
-int LightSensor::enable(int32_t handle, int en)
-{
- int flags = en ? 1 : 0;
- int err;
- int fd;
- if (flags != mEnabled) {
- strcpy(&input_sysfs_path[input_sysfs_path_len], "enable");
- fd = open(input_sysfs_path, O_RDWR);
- if (fd >= 0) {
- write(fd, en == 1 ? "1" : "0", 2);
- close(fd);
- mEnabled = flags;
- setInitialState();
- return 0;
- }
- return -1;
- }
- return 0;
-}
-
-bool LightSensor::hasPendingEvents() const {
- return mHasPendingEvent;
-}
-
-int LightSensor::readEvents(sensors_event_t* data, int count)
-{
- if (count < 1)
- return -EINVAL;
-
- if (mHasPendingEvent) {
- mHasPendingEvent = false;
- mPendingEvent.timestamp = getTimestamp();
- *data = mPendingEvent;
- return mEnabled ? 1 : 0;
- }
-
- ssize_t n = mInputReader.fill(data_fd);
- if (n < 0)
- return n;
-
- int numEventReceived = 0;
- input_event const* event;
-
- while (count && mInputReader.readEvent(&event)) {
- int type = event->type;
- if (type == EV_REL) {
- if (event->code == EVENT_TYPE_LIGHT) {
- mPendingEvent.light = event->value;
- }
- } else if (type == EV_SYN) {
- mPendingEvent.timestamp = timevalToNano(event->time);
- if (mEnabled) {
- *data++ = mPendingEvent;
- count--;
- numEventReceived++;
- }
- } else {
- ALOGE("%s: unknown event (type=%d, code=%d)", LOGTAG,
- type, event->code);
- }
- mInputReader.next();
- }
-
- return numEventReceived;
-}
diff --git a/libsensors/LightSensor.h b/libsensors/LightSensor.h
deleted file mode 100644
index 85e65d9..0000000
--- a/libsensors/LightSensor.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_LIGHT_SENSOR_H
-#define ANDROID_LIGHT_SENSOR_H
-
-#include <stdint.h>
-#include <errno.h>
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-#include "sensors.h"
-#include "SensorBase.h"
-#include "InputEventReader.h"
-
-/*****************************************************************************/
-
-struct input_event;
-
-class LightSensor : public SensorBase {
- int mEnabled;
- InputEventCircularReader mInputReader;
- sensors_event_t mPendingEvent;
- bool mHasPendingEvent;
- char input_sysfs_path[PATH_MAX];
- int input_sysfs_path_len;
-
- float indexToValue(size_t index) const;
- int setInitialState();
-
-public:
- LightSensor();
- virtual ~LightSensor();
- virtual int readEvents(sensors_event_t* data, int count);
- virtual bool hasPendingEvents() const;
- virtual int setDelay(int32_t handle, int64_t ns);
- virtual int enable(int32_t handle, int enabled);
-};
-
-/*****************************************************************************/
-
-#endif // ANDROID_LIGHT_SENSOR_H
diff --git a/libsensors/MODULE_LICENSE_APACHE2 b/libsensors/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29..0000000
--- a/libsensors/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/libsensors/PressureSensor.cpp b/libsensors/PressureSensor.cpp
deleted file mode 100644
index 6539ce0..0000000
--- a/libsensors/PressureSensor.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <fcntl.h>
-#include <errno.h>
-#include <math.h>
-#include <poll.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <sys/select.h>
-#include <cstring>
-
-#include <cutils/log.h>
-
-#include "PressureSensor.h"
-
-#define LOGTAG "PressureSensor"
-
-#define PRESSURE_CONVERT(x) (x/4096.0f)
-
-/*****************************************************************************/
-
-PressureSensor::PressureSensor()
- : SensorBase(NULL, "barometer_sensor"),
- mEnabled(0),
- mInputReader(4),
- mHasPendingEvent(false)
-{
- mPendingEvent.version = sizeof(sensors_event_t);
- mPendingEvent.sensor = ID_PR;
- mPendingEvent.type = SENSOR_TYPE_PRESSURE;
- memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data));
-
- if (data_fd) {
- strcpy(input_sysfs_path, "/sys/class/input/");
- strcat(input_sysfs_path, input_name);
- strcat(input_sysfs_path, "/device/");
- input_sysfs_path_len = strlen(input_sysfs_path);
- enable(0, 1);
- }
-}
-
-PressureSensor::~PressureSensor() {
- if (mEnabled) {
- enable(0, 0);
- }
-}
-
-int PressureSensor::setInitialState() {
- struct input_absinfo absinfo;
- if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_PRESSURE), &absinfo)) {
- // make sure to report an event immediately
- mHasPendingEvent = true;
- mPendingEvent.pressure = PRESSURE_CONVERT(absinfo.value);
- }
- return 0;
-}
-
-int PressureSensor::enable(int32_t handle, int en) {
- int flags = en ? 1 : 0;
- int fd;
- if (flags != mEnabled) {
- strcpy(&input_sysfs_path[input_sysfs_path_len], "enable");
- fd = open(input_sysfs_path, O_RDWR);
- if (fd >= 0) {
- write(fd, flags == 1 ? "1" : "0", 2);
- close(fd);
- mEnabled = flags;
- setInitialState();
- return 0;
- }
-
- return -1;
- }
- return 0;
-}
-
-bool PressureSensor::hasPendingEvents() const {
- return mHasPendingEvent;
-}
-
-int PressureSensor::setDelay(int32_t handle, int64_t delay)
-{
- int fd;
- if (delay < 10000000)
- delay = 10;
- else
- delay = delay / 1000000;
- strcpy(&input_sysfs_path[input_sysfs_path_len], "poll_delay");
- fd = open(input_sysfs_path, O_RDWR);
- if (fd >= 0) {
- char buf[80];
- sprintf(buf, "%lld", delay);
- write(fd, buf, strlen(buf)+1);
- close(fd);
- return 0;
- }
- return -1;
-}
-
-
-int PressureSensor::readEvents(sensors_event_t* data, int count)
-{
- if (count < 1)
- return -EINVAL;
-
- if (mHasPendingEvent) {
- mHasPendingEvent = false;
- mPendingEvent.timestamp = getTimestamp();
- *data = mPendingEvent;
- return mEnabled ? 1 : 0;
- }
-
- ssize_t n = mInputReader.fill(data_fd);
- if (n < 0)
- return n;
-
- int numEventReceived = 0;
- input_event const* event;
-
- while (count && mInputReader.readEvent(&event)) {
- int type = event->type;
- if (type == EV_REL) {
- if (event->code == REL_X) {
- mPendingEvent.pressure = PRESSURE_CONVERT(event->value);
- }
- } else if (type == EV_SYN) {
- mPendingEvent.timestamp = timevalToNano(event->time);
- if (mEnabled) {
- *data++ = mPendingEvent;
- count--;
- numEventReceived++;
- }
- } else {
- ALOGE("%s: unknown event (type=%d, code=%d)", LOGTAG,
- type, event->code);
- }
- mInputReader.next();
- }
-
- return numEventReceived;
-}
diff --git a/libsensors/PressureSensor.h b/libsensors/PressureSensor.h
deleted file mode 100644
index 9333d44..0000000
--- a/libsensors/PressureSensor.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_PRESSURE_SENSOR_H
-#define ANDROID_PRESSURE_SENSOR_H
-
-#include <stdint.h>
-#include <errno.h>
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-#include "sensors.h"
-#include "SensorBase.h"
-#include "InputEventReader.h"
-
-/*****************************************************************************/
-
-struct input_event;
-
-class PressureSensor : public SensorBase {
- int mEnabled;
- InputEventCircularReader mInputReader;
- sensors_event_t mPendingEvent;
- bool mHasPendingEvent;
- char input_sysfs_path[PATH_MAX];
- int input_sysfs_path_len;
-
- int setInitialState();
-
-public:
- PressureSensor();
- virtual ~PressureSensor();
- virtual int readEvents(sensors_event_t* data, int count);
- virtual bool hasPendingEvents() const;
- virtual int enable(int32_t handle, int enabled);
- virtual int setDelay(int32_t handle, int64_t ns);
-};
-
-/*****************************************************************************/
-
-#endif // ANDROID_PRESSURE_SENSOR_H
diff --git a/libsensors/ProximitySensor.cpp b/libsensors/ProximitySensor.cpp
deleted file mode 100644
index 9e5d7d1..0000000
--- a/libsensors/ProximitySensor.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <fcntl.h>
-#include <errno.h>
-#include <math.h>
-#include <poll.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <sys/select.h>
-#include <stdio.h>
-#include <cstring>
-#define ALOG_NDEBUG 0
-#define LOG_NDEBUG 0
-#include <cutils/log.h>
-
-#include "ProximitySensor.h"
-#include "SensorBase.h"
-
-#define LOGTAG "ProximitySensor"
-
-/*****************************************************************************/
-
-ProximitySensor::ProximitySensor()
- : SensorBase(NULL, "proximity_sensor"),
- mEnabled(0),
- mInputReader(4),
- mHasPendingEvent(false)
-{
- mPendingEvent.version = sizeof(sensors_event_t);
- mPendingEvent.sensor = ID_P;
- mPendingEvent.type = SENSOR_TYPE_PROXIMITY;
- memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data));
-
- if (data_fd) {
- ALOGE("%s: got input_name %s", LOGTAG, input_name);
- strcpy(input_sysfs_path, "/sys/class/input/");
- strcat(input_sysfs_path, input_name);
- strcat(input_sysfs_path, "/device/");
- input_sysfs_path_len = strlen(input_sysfs_path);
- enable(0, 1);
- }
-}
-
-ProximitySensor::~ProximitySensor() {
- if (mEnabled) {
- enable(0, 0);
- }
-}
-
-int ProximitySensor::setInitialState() {
- struct input_absinfo absinfo;
- if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_PROXIMITY), &absinfo)) {
- // make sure to report an event immediately
- mHasPendingEvent = true;
- mPendingEvent.distance = indexToValue(absinfo.value);
- }
- return 0;
-}
-
-int ProximitySensor::setDelay(int32_t handle, int64_t ns)
-{
- // unsupported
- return 0;
-}
-
-int ProximitySensor::enable(int32_t handle, int en) {
- int fd;
- int flags = en ? 1 : 0;
- int err;
- ALOGD("%s: Enable: %i", __func__, en);
- if (flags != mEnabled) {
- strcpy(&input_sysfs_path[input_sysfs_path_len], "enable");
- fd = open(input_sysfs_path, O_RDWR);
- if (fd >= 0) {
- write(fd, en == 1 ? "1" : "0", 2);
- close(fd);
- mEnabled = flags;
- setInitialState();
- return 0;
- }
-
- return -1;
- }
- return 0;
-}
-
-bool ProximitySensor::hasPendingEvents() const {
- return mHasPendingEvent;
-}
-
-int ProximitySensor::readEvents(sensors_event_t* data, int count)
-{
- if (count < 1)
- return -EINVAL;
-
- if (mHasPendingEvent) {
- mHasPendingEvent = false;
- mPendingEvent.timestamp = getTimestamp();
- *data = mPendingEvent;
- return mEnabled ? 1 : 0;
- }
-
- ssize_t n = mInputReader.fill(data_fd);
- if (n < 0)
- return n;
-
- int numEventReceived = 0;
- input_event const* event;
-
- while (count && mInputReader.readEvent(&event)) {
- int type = event->type;
- if (type == EV_ABS) {
- if (event->code == EVENT_TYPE_PROXIMITY) {
- if (event->value != -1) {
- // FIXME: not sure why we're getting -1 sometimes
- mPendingEvent.distance = indexToValue(event->value);
- }
- }
- } else if (type == EV_SYN) {
- mPendingEvent.timestamp = timevalToNano(event->time);
- if (mEnabled) {
- *data++ = mPendingEvent;
- count--;
- numEventReceived++;
- }
- } else {
- ALOGE("%s: unknown event (type=%d, code=%d)",LOGTAG,
- type, event->code);
- }
- mInputReader.next();
- }
-
- return numEventReceived;
-}
-
-float ProximitySensor::indexToValue(size_t index) const
-{
- ALOGV("%s: Index = %zu",LOGTAG, index);
- return index * PROXIMITY_THRESHOLD_CM;
-}
diff --git a/libsensors/ProximitySensor.h b/libsensors/ProximitySensor.h
deleted file mode 100644
index a6aa851..0000000
--- a/libsensors/ProximitySensor.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_PROXIMITY_SENSOR_H
-#define ANDROID_PROXIMITY_SENSOR_H
-
-#include <stdint.h>
-#include <errno.h>
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-#include "sensors.h"
-#include "SensorBase.h"
-#include "InputEventReader.h"
-
-/*****************************************************************************/
-
-struct input_event;
-
-class ProximitySensor : public SensorBase {
- int mEnabled;
- InputEventCircularReader mInputReader;
- sensors_event_t mPendingEvent;
- bool mHasPendingEvent;
- char input_sysfs_path[PATH_MAX];
- int input_sysfs_path_len;
-
- int setInitialState();
- float indexToValue(size_t index) const;
-
-public:
- ProximitySensor();
- virtual ~ProximitySensor();
- virtual int readEvents(sensors_event_t* data, int count);
- virtual bool hasPendingEvents() const;
- virtual int enable(int32_t handle, int enabled);
- virtual int setDelay(int32_t handle, int64_t ns);
-};
-
-/*****************************************************************************/
-
-#endif // ANDROID_PROXIMITY_SENSOR_H
diff --git a/libsensors/SensorBase.cpp b/libsensors/SensorBase.cpp
deleted file mode 100644
index 3790f81..0000000
--- a/libsensors/SensorBase.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <fcntl.h>
-#include <errno.h>
-#include <math.h>
-#include <poll.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <sys/select.h>
-#include <pthread.h>
-#include <cstring>
-
-#include <cutils/log.h>
-
-#include <linux/input.h>
-
-#include "SensorBase.h"
-
-/*****************************************************************************/
-
-SensorBase::SensorBase(
- const char* dev_name,
- const char* data_name)
- : dev_name(dev_name), data_name(data_name),
- dev_fd(-1), data_fd(-1)
-{
- if (data_name) {
- data_fd = openInput(data_name);
- }
-}
-
-SensorBase::~SensorBase() {
- if (data_fd >= 0) {
- close(data_fd);
- }
- if (dev_fd >= 0) {
- close(dev_fd);
- }
-}
-
-int SensorBase::open_device() {
- if (dev_fd<0 && dev_name) {
- dev_fd = open(dev_name, O_RDONLY);
- ALOGE_IF(dev_fd<0, "Couldn't open %s (%s)", dev_name, strerror(errno));
- }
- return 0;
-}
-
-int SensorBase::close_device() {
- if (dev_fd >= 0) {
- close(dev_fd);
- dev_fd = -1;
- }
- return 0;
-}
-
-int SensorBase::getFd() const {
- if (!data_name) {
- return dev_fd;
- }
- return data_fd;
-}
-
-int SensorBase::setDelay(int32_t handle, int64_t ns) {
- return 0;
-}
-
-bool SensorBase::hasPendingEvents() const {
- return false;
-}
-
-int64_t SensorBase::getTimestamp() {
- struct timespec t;
- t.tv_sec = t.tv_nsec = 0;
- clock_gettime(CLOCK_BOOTTIME, &t);
- return int64_t(t.tv_sec)*1000000000LL + t.tv_nsec;
-}
-
-int SensorBase::openInput(const char* inputName) {
- int fd = -1;
- const char *dirname = "/dev/input";
- char devname[PATH_MAX];
- char *filename;
- DIR *dir;
- struct dirent *de;
- dir = opendir(dirname);
- if(dir == NULL)
- return -1;
- strcpy(devname, dirname);
- filename = devname + strlen(devname);
- *filename++ = '/';
- while((de = readdir(dir))) {
- if(de->d_name[0] == '.' &&
- (de->d_name[1] == '\0' ||
- (de->d_name[1] == '.' && de->d_name[2] == '\0')))
- continue;
- strcpy(filename, de->d_name);
- fd = open(devname, O_RDONLY);
- if (fd>=0) {
- char name[80];
- if (ioctl(fd, EVIOCGNAME(sizeof(name) - 1), &name) < 1) {
- name[0] = '\0';
- }
- if (!strcmp(name, inputName)) {
- strcpy(input_name, filename);
- break;
- } else {
- close(fd);
- fd = -1;
- }
- }
- }
- closedir(dir);
- ALOGE_IF(fd<0, "couldn't find '%s' input device", inputName);
-
- return fd;
-}
-
-int SensorBase::batch(int handle, int flags, int64_t period_ns, int64_t timeout)
-{
- return 0;
-}
-
-int SensorBase::flush(int handle)
-{
- return 0;
-}
diff --git a/libsensors/SensorBase.h b/libsensors/SensorBase.h
deleted file mode 100644
index 13a4ae6..0000000
--- a/libsensors/SensorBase.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_SENSOR_BASE_H
-#define ANDROID_SENSOR_BASE_H
-
-#include <stdint.h>
-#include <errno.h>
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-#include "sensors.h"
-
-
-/*****************************************************************************/
-
-struct sensors_event_t;
-
-class SensorBase {
-protected:
- const char* dev_name;
- const char* data_name;
- char input_name[PATH_MAX];
- int dev_fd;
- int data_fd;
-
- int openInput(const char* inputName);
- static int64_t getTimestamp();
-
-
- static int64_t timevalToNano(timeval const& t) {
- return t.tv_sec*1000000000LL + t.tv_usec*1000;
- }
-
- int open_device();
- int close_device();
-
-public:
- SensorBase(
- const char* dev_name,
- const char* data_name);
-
- virtual ~SensorBase();
-
- virtual int readEvents(sensors_event_t* data, int count) = 0;
- virtual bool hasPendingEvents() const;
- virtual int getFd() const;
- virtual int setDelay(int32_t handle, int64_t ns);
- virtual int enable(int32_t handle, int enabled) = 0;
- virtual int batch(int handle, int flags, int64_t period_ns, int64_t timeout);
- virtual int flush(int handle);
-
-};
-
-/*****************************************************************************/
-
-#endif // ANDROID_SENSOR_BASE_H
diff --git a/libsensors/ak8973b.h b/libsensors/ak8973b.h
deleted file mode 100644
index 9b7ab60..0000000
--- a/libsensors/ak8973b.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Definitions for akm8973 compass chip.
- */
-#ifndef AKM8973_H
-#define AKM8973_H
-
-#include <linux/ioctl.h>
-
-#define AKM8973_I2C_NAME "ak8973b"
-
-#define AKMIO 0xA1
-
-/* IOCTLs for AKM library */
-#define ECS_IOCTL_WRITE _IOW(AKMIO, 0x01, char*)
-#define ECS_IOCTL_READ _IOWR(AKMIO, 0x02, char*)
-#define ECS_IOCTL_RESET _IO(AKMIO, 0x03)
-#define ECS_IOCTL_SET_MODE _IOW(AKMIO, 0x04, short)
-#define ECS_IOCTL_GETDATA _IOR(AKMIO, 0x05, char[SENSOR_DATA_SIZE])
-#define ECS_IOCTL_SET_YPR _IOW(AKMIO, 0x06, short[12])
-#define ECS_IOCTL_GET_OPEN_STATUS _IOR(AKMIO, 0x07, int)
-#define ECS_IOCTL_GET_CLOSE_STATUS _IOR(AKMIO, 0x08, int)
-#define ECS_IOCTL_GET_DELAY _IOR(AKMIO, 0x30, int64_t)
-#define ECS_IOCTL_GET_PROJECT_NAME _IOR(AKMIO, 0x0D, char[64])
-#define ECS_IOCTL_GET_MATRIX _IOR(AKMIO, 0x0E, short [4][3][3])
-
-/* IOCTLs for APPs */
-#define ECS_IOCTL_APP_SET_MODE _IOW(AKMIO, 0x10, short)
-#define ECS_IOCTL_APP_SET_MFLAG _IOW(AKMIO, 0x11, short)
-#define ECS_IOCTL_APP_GET_MFLAG _IOW(AKMIO, 0x12, short)
-#define ECS_IOCTL_APP_SET_AFLAG _IOW(AKMIO, 0x13, short)
-#define ECS_IOCTL_APP_GET_AFLAG _IOR(AKMIO, 0x14, short)
-#define ECS_IOCTL_APP_SET_TFLAG _IOR(AKMIO, 0x15, short)
-#define ECS_IOCTL_APP_GET_TFLAG _IOR(AKMIO, 0x16, short)
-#define ECS_IOCTL_APP_RESET_PEDOMETER _IO(AKMIO, 0x17)
-#define ECS_IOCTL_APP_SET_DELAY _IOW(AKMIO, 0x18, int64_t)
-#define ECS_IOCTL_APP_GET_DELAY ECS_IOCTL_GET_DELAY
-
-/* Set raw magnetic vector flag */
-#define ECS_IOCTL_APP_SET_MVFLAG _IOW(AKMIO, 0x19, short)
-
-/* Get raw magnetic vector flag */
-#define ECS_IOCTL_APP_GET_MVFLAG _IOR(AKMIO, 0x1A, short)
-
-struct akm8973_platform_data {
- short layouts[4][3][3];
- char project_name[64];
- int gpio_RST;
- int gpio_INT;
-};
-
-#endif
diff --git a/libsensors/ak8975-reg.h b/libsensors/ak8975-reg.h
new file mode 100644
index 0000000..1a78a27
--- /dev/null
+++ b/libsensors/ak8975-reg.h
@@ -0,0 +1,48 @@
+/* linux/drivers/misc/ak8975-reg.h
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+#ifndef __AK8975_REG__
+#define __AK8975_REG__
+
+/* Compass device dependent definition */
+#define AK8975_MODE_SNG_MEASURE 0x01
+#define AK8975_MODE_SELF_TEST 0x08
+#define AK8975_MODE_FUSE_ACCESS 0x0F
+#define AK8975_MODE_POWER_DOWN 0x00
+
+/* Rx buffer size. i.e ST,TMPS,H1X,H1Y,H1Z*/
+#define SENSOR_DATA_SIZE 8
+
+/* Read/Write buffer size.*/
+#define RWBUF_SIZE 16
+
+/* AK8975 register address */
+#define AK8975_REG_WIA 0x00
+#define AK8975_REG_INFO 0x01
+#define AK8975_REG_ST1 0x02
+#define AK8975_REG_HXL 0x03
+#define AK8975_REG_HXH 0x04
+#define AK8975_REG_HYL 0x05
+#define AK8975_REG_HYH 0x06
+#define AK8975_REG_HZL 0x07
+#define AK8975_REG_HZH 0x08
+#define AK8975_REG_ST2 0x09
+#define AK8975_REG_CNTL 0x0A
+#define AK8975_REG_RSV 0x0B
+#define AK8975_REG_ASTC 0x0C
+#define AK8975_REG_TS1 0x0D
+#define AK8975_REG_TS2 0x0E
+#define AK8975_REG_I2CDIS 0x0F
+
+/* AK8975 fuse-rom address */
+#define AK8975_FUSE_ASAX 0x10
+#define AK8975_FUSE_ASAY 0x11
+#define AK8975_FUSE_ASAZ 0x12
+
+#endif /* __AK8975_REG__ */
diff --git a/libsensors/ak8975.h b/libsensors/ak8975.h
new file mode 100644
index 0000000..79a5de4
--- /dev/null
+++ b/libsensors/ak8975.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2010 Samsung Electronics. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#ifndef AKM8975_H
+#define AKM8975_H
+
+#include <linux/ioctl.h>
+
+#define AKM8975_I2C_NAME "ak8975"
+
+/* Rx buffer size, i.e from ST1 to ST2 */
+#define SENSOR_DATA_SIZE 8
+#define AKMIO 0xA1
+
+/* IOCTLs for AKM library */
+/* WRITE and READ sizes don't include data. On WRITE, the first value is data
+ * size plus one and the second value is the register address. On READ
+ * the first value is the data size and second value is the register
+ * address and the data is written back into the buffer starting at
+ * the second byte (the length is unchanged).
+ */
+#define ECS_IOCTL_WRITE _IOW(AKMIO, 0x01, char*)
+#define ECS_IOCTL_READ _IOWR(AKMIO, 0x02, char*)
+#define ECS_IOCTL_RESET _IO(AKMIO, 0x03)
+#define ECS_IOCTL_SET_MODE _IOW(AKMIO, 0x04, short)
+#define ECS_IOCTL_GETDATA _IOR(AKMIO, 0x05, \
+ char[SENSOR_DATA_SIZE])
+#define ECS_IOCTL_SET_YPR _IOW(AKMIO, 0x06, short[12])
+#define ECS_IOCTL_GET_OPEN_STATUS _IOR(AKMIO, 0x07, int)
+#define ECS_IOCTL_GET_CLOSE_STATUS _IOR(AKMIO, 0x08, int)
+#define ECS_IOCTL_GET_DELAY _IOR(AKMIO, 0x30, int64_t)
+#define ECS_IOCTL_GET_PROJECT_NAME _IOR(AKMIO, 0x0D, char[64])
+#define ECS_IOCTL_GET_MATRIX _IOR(AKMIO, 0x0E, short[4][3][3])
+
+/* IOCTLs for APPs */
+#define ECS_IOCTL_APP_SET_MODE _IOW(AKMIO, 0x10, short)
+#define ECS_IOCTL_APP_SET_MFLAG _IOW(AKMIO, 0x11, short)
+#define ECS_IOCTL_APP_GET_MFLAG _IOR(AKMIO, 0x12, short)
+#define ECS_IOCTL_APP_SET_AFLAG _IOW(AKMIO, 0x13, short)
+#define ECS_IOCTL_APP_GET_AFLAG _IOR(AKMIO, 0x14, short)
+#define ECS_IOCTL_APP_SET_TFLAG _IOW(AKMIO, 0x15, short)
+#define ECS_IOCTL_APP_GET_TFLAG _IOR(AKMIO, 0x16, short)
+#define ECS_IOCTL_APP_RESET_PEDOMETER _IO(AKMIO, 0x17)
+#define ECS_IOCTL_APP_SET_DELAY _IOW(AKMIO, 0x18, int64_t)
+#define ECS_IOCTL_APP_GET_DELAY ECS_IOCTL_GET_DELAY
+
+/* Set raw magnetic vector flag */
+#define ECS_IOCTL_APP_SET_MVFLAG _IOW(AKMIO, 0x19, short)
+
+/* Get raw magnetic vector flag */
+#define ECS_IOCTL_APP_GET_MVFLAG _IOR(AKMIO, 0x1A, short)
+
+#ifdef __KERNEL__
+struct akm8975_platform_data {
+ int gpio_data_ready_int;
+};
+#endif
+
+#endif
diff --git a/libsensors/akm8975.c b/libsensors/akm8975.c
new file mode 100644
index 0000000..47771fb
--- /dev/null
+++ b/libsensors/akm8975.c
@@ -0,0 +1,612 @@
+/*
+ * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#include <hardware/sensors.h>
+#include <hardware/hardware.h>
+
+#define LOG_TAG "smdk4x12_sensors"
+#include <utils/Log.h>
+
+#include "smdk4x12_sensors.h"
+#include "ak8975.h"
+#include "ak8975-reg.h"
+
+#include <AKFS_Compass.h>
+#include <AKFS_FileIO.h>
+
+#define AKFS_CONFIG_PATH "/data/misc/akfs.txt"
+#define AKFS_PAT PAT3
+
+struct akm8975_data {
+ AK8975PRMS akfs_params;
+ sensors_vec_t magnetic;
+
+ int64_t delay;
+ int device_fd;
+ int uinput_fd;
+
+ pthread_t thread;
+ pthread_mutex_t mutex;
+ int thread_continue;
+};
+
+int akfs_get_magnetic_field(struct akm8975_data *akm8975_data, short *magnetic_data)
+{
+ AK8975PRMS *params;
+ int rc, aocret;
+ float radius;
+
+ if (akm8975_data == NULL || magnetic_data == NULL)
+ return -EINVAL;
+
+ params = &akm8975_data->akfs_params;
+
+ // Decomposition
+ // Sensitivity adjustment, i.e. multiply ASA, is done in this function.
+ rc = AKFS_DecompAK8975(magnetic_data, 1, &params->mi_asa, AKFS_HDATA_SIZE, params->mfv_hdata);
+ if (rc == AKFS_ERROR) {
+ ALOGE("Failed to decomp!");
+ return -1;
+ }
+
+ // Adjust coordination
+ rc = AKFS_Rotate(params->m_hpat, &params->mfv_hdata[0]);
+ if (rc == AKFS_ERROR) {
+ ALOGE("Failed to rotate!");
+ return -1;
+ }
+
+ // AOC for magnetometer
+ // Offset estimation is done in this function
+ aocret = AKFS_AOC(&params->m_aocv, params->mfv_hdata, &params->mfv_ho);
+
+ // Subtract offset
+ // Then, a magnetic vector, the unit is uT, is stored in mfv_hvbuf.
+ rc = AKFS_VbNorm(AKFS_HDATA_SIZE, params->mfv_hdata, 1,
+ &params->mfv_ho, &params->mfv_hs, AK8975_HSENSE_TARGET,
+ AKFS_HDATA_SIZE, params->mfv_hvbuf);
+ if (rc == AKFS_ERROR) {
+ ALOGE("Failed to normalize!");
+ return -1;
+ }
+
+ // Averaging
+ rc = AKFS_VbAve(AKFS_HDATA_SIZE, params->mfv_hvbuf, CSPEC_HNAVE_V, &params->mfv_hvec);
+ if (rc == AKFS_ERROR) {
+ ALOGE("Failed to average!");
+ return -1;
+ }
+
+ // Check the size of magnetic vector
+ radius = sqrtf(
+ (params->mfv_hvec.u.x * params->mfv_hvec.u.x) +
+ (params->mfv_hvec.u.y * params->mfv_hvec.u.y) +
+ (params->mfv_hvec.u.z * params->mfv_hvec.u.z));
+
+ // Sanity check result and set accuracy
+ if ((radius > MAGNETIC_FIELD_EARTH_MAX + 10) || (radius < MAGNETIC_FIELD_EARTH_MIN - 10)) {
+ params->mi_hstatus = SENSOR_STATUS_UNRELIABLE;
+ } else if(params->mi_hstatus == SENSOR_STATUS_UNRELIABLE) {
+ params->mi_hstatus = SENSOR_STATUS_ACCURACY_MEDIUM;
+ } else if (aocret == AKFS_SUCCESS) {
+ params->mi_hstatus = SENSOR_STATUS_ACCURACY_HIGH;
+ }
+
+ akm8975_data->magnetic.x = params->mfv_hvec.u.x;
+ akm8975_data->magnetic.y = params->mfv_hvec.u.y;
+ akm8975_data->magnetic.z = params->mfv_hvec.u.z;
+ akm8975_data->magnetic.status = params->mi_hstatus;
+
+ return 0;
+}
+
+int akfs_init(struct akm8975_data *akm8975_data, char *asa, AKFS_PATNO pat)
+{
+ AK8975PRMS *params;
+
+ if (akm8975_data == NULL || asa == NULL)
+ return -EINVAL;
+
+ params = &akm8975_data->akfs_params;
+
+ memset(params, 0, sizeof(AK8975PRMS));
+
+ // Sensitivity
+ params->mfv_hs.u.x = AK8975_HSENSE_DEFAULT;
+ params->mfv_hs.u.y = AK8975_HSENSE_DEFAULT;
+ params->mfv_hs.u.z = AK8975_HSENSE_DEFAULT;
+ params->mfv_as.u.x = AK8975_ASENSE_DEFAULT;
+ params->mfv_as.u.y = AK8975_ASENSE_DEFAULT;
+ params->mfv_as.u.z = AK8975_ASENSE_DEFAULT;
+
+ // Initialize variables that initial value is not 0.
+ params->mi_hnaveV = CSPEC_HNAVE_V;
+ params->mi_hnaveD = CSPEC_HNAVE_D;
+ params->mi_anaveV = CSPEC_ANAVE_V;
+ params->mi_anaveD = CSPEC_ANAVE_D;
+
+ // Copy ASA values
+ params->mi_asa.u.x = asa[0];
+ params->mi_asa.u.y = asa[1];
+ params->mi_asa.u.z = asa[2];
+
+ // Copy layout pattern
+ params->m_hpat = pat;
+
+ return 0;
+}
+
+void *akm8975_thread(void *thread_data)
+{
+ struct smdk4x12_sensors_handlers *handlers = NULL;
+ struct akm8975_data *data = NULL;
+ struct input_event event;
+ struct timeval time;
+ char i2c_data[SENSOR_DATA_SIZE] = { 0 };
+ short magnetic_data[3];
+ short mode;
+ int64_t before, after;
+ int diff;
+ int device_fd;
+ int uinput_fd;
+ int rc;
+
+ if (thread_data == NULL)
+ return NULL;
+
+ handlers = (struct smdk4x12_sensors_handlers *) thread_data;
+ if (handlers->data == NULL)
+ return NULL;
+
+ data = (struct akm8975_data *) handlers->data;
+
+ device_fd = data->device_fd;
+ if (device_fd < 0)
+ return NULL;
+
+ uinput_fd = data->uinput_fd;
+ if (uinput_fd < 0)
+ return NULL;
+
+ while (data->thread_continue) {
+ pthread_mutex_lock(&data->mutex);
+ if (!data->thread_continue)
+ break;
+
+ while (handlers->activated) {
+ gettimeofday(&time, NULL);
+ before = timestamp(&time);
+
+ mode = AK8975_MODE_SNG_MEASURE;
+ rc = ioctl(device_fd, ECS_IOCTL_SET_MODE, &mode);
+ if (rc < 0) {
+ ALOGE("%s: Unable to set akm8975 mode", __func__);
+ return NULL;
+ }
+
+ memset(&i2c_data, 0, sizeof(i2c_data));
+ rc = ioctl(device_fd, ECS_IOCTL_GETDATA, &i2c_data);
+ if (rc < 0) {
+ ALOGE("%s: Unable to get akm8975 data", __func__);
+ return NULL;
+ }
+
+ if (!(i2c_data[0] & 0x01)) {
+ ALOGE("%s: akm8975 data is not ready", __func__);
+ continue;
+ }
+
+ if (i2c_data[7] & (1 << 2) || i2c_data[7] & (1 << 3)) {
+ ALOGE("%s: akm8975 data read error or overflow", __func__);
+ continue;
+ }
+
+ magnetic_data[0] = (short) (i2c_data[2] << 8) | (i2c_data[1]);
+ magnetic_data[1] = (short) (i2c_data[4] << 8) | (i2c_data[3]);
+ magnetic_data[2] = (short) (i2c_data[6] << 8) | (i2c_data[5]);
+
+ rc = akfs_get_magnetic_field(data, (short *) &magnetic_data);
+ if (rc < 0) {
+ ALOGE("%s: Unable to get AKFS magnetic field", __func__);
+ continue;
+ }
+
+ input_event_set(&event, EV_REL, REL_X, (int) (data->magnetic.x * 1000));
+ write(uinput_fd, &event, sizeof(event));
+ input_event_set(&event, EV_REL, REL_Y, (int) (data->magnetic.y * 1000));
+ write(uinput_fd, &event, sizeof(event));
+ input_event_set(&event, EV_REL, REL_Z, (int) (data->magnetic.z * 1000));
+ write(uinput_fd, &event, sizeof(event));
+ input_event_set(&event, EV_REL, REL_MISC, (int) data->magnetic.status);
+ write(uinput_fd, &event, sizeof(event));
+ input_event_set(&event, EV_SYN, 0, 0);
+ write(uinput_fd, &event, sizeof(event));
+
+ gettimeofday(&time, NULL);
+ after = timestamp(&time);
+
+ diff = (int) (data->delay - (after - before)) / 1000;
+ if (diff <= 0)
+ continue;
+
+ usleep(diff);
+ }
+ }
+ return NULL;
+}
+
+int akm8975_init(struct smdk4x12_sensors_handlers *handlers,
+ struct smdk4x12_sensors_device *device)
+{
+ struct akm8975_data *data = NULL;
+ pthread_attr_t thread_attr;
+ char i2c_data[RWBUF_SIZE] = { 0 };
+ short mode;
+ int device_fd = -1;
+ int uinput_fd = -1;
+ int input_fd = -1;
+ int rc;
+ int i;
+
+ ALOGD("%s(%p, %p)", __func__, handlers, device);
+
+ if (handlers == NULL || device == NULL)
+ return -EINVAL;
+
+ data = (struct akm8975_data *) calloc(1, sizeof(struct akm8975_data));
+
+ device_fd = open("/dev/akm8975", O_RDONLY);
+ if (device_fd < 0) {
+ ALOGE("%s: Unable to open device", __func__);
+ goto error;
+ }
+
+ mode = AK8975_MODE_POWER_DOWN;
+ rc = ioctl(device_fd, ECS_IOCTL_SET_MODE, &mode);
+ if (rc < 0) {
+ ALOGE("%s: Unable to set akm8975 mode", __func__);
+ goto error;
+ }
+
+ mode = AK8975_MODE_FUSE_ACCESS;
+ rc = ioctl(device_fd, ECS_IOCTL_SET_MODE, &mode);
+ if (rc < 0) {
+ ALOGE("%s: Unable to set akm8975 mode", __func__);
+ goto error;
+ }
+
+ i2c_data[0] = 3;
+ i2c_data[1] = AK8975_FUSE_ASAX;
+ rc = ioctl(device_fd, ECS_IOCTL_READ, &i2c_data);
+ if (rc < 0) {
+ ALOGE("%s: Unable to read akm8975 FUSE data", __func__);
+ goto error;
+ }
+
+ ALOGD("AKM8975 ASA (Sensitivity Adjustment) values are: (%d, %d, %d)",
+ i2c_data[1], i2c_data[2], i2c_data[3]);
+
+ rc = akfs_init(data, &i2c_data[1], AKFS_PAT);
+ if (rc < 0) {
+ ALOGE("%s: Unable to init AKFS", __func__);
+ goto error;
+ }
+
+ i2c_data[0] = 1;
+ i2c_data[1] = AK8975_REG_WIA;
+ rc = ioctl(device_fd, ECS_IOCTL_READ, &i2c_data);
+ if (rc < 0) {
+ ALOGE("%s: Unable to read akm8975 WIA data", __func__);
+ goto error;
+ }
+
+ ALOGD("AKM8975 WIA (Device ID) value is: 0x%x", i2c_data[1]);
+
+ mode = AK8975_MODE_POWER_DOWN;
+ rc = ioctl(device_fd, ECS_IOCTL_SET_MODE, &mode);
+ if (rc < 0) {
+ ALOGE("%s: Unable to set akm8975 mode", __func__);
+ goto error;
+ }
+
+ uinput_fd = uinput_rel_create("magnetic");
+ if (uinput_fd < 0) {
+ ALOGD("%s: Unable to create uinput", __func__);
+ goto error;
+ }
+
+ input_fd = input_open("magnetic");
+ if (input_fd < 0) {
+ ALOGE("%s: Unable to open magnetic input", __func__);
+ goto error;
+ }
+
+ data->thread_continue = 1;
+
+ pthread_mutex_init(&data->mutex, NULL);
+ pthread_mutex_lock(&data->mutex);
+
+ pthread_attr_init(&thread_attr);
+ pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED);
+
+ rc = pthread_create(&data->thread, &thread_attr, akm8975_thread, (void *) handlers);
+ if (rc < 0) {
+ ALOGE("%s: Unable to create akm8975 thread", __func__);
+ pthread_mutex_destroy(&data->mutex);
+ goto error;
+ }
+
+ data->device_fd = device_fd;
+ data->uinput_fd = uinput_fd;
+ handlers->poll_fd = input_fd;
+ handlers->data = (void *) data;
+
+ return 0;
+
+error:
+ if (data != NULL)
+ free(data);
+
+ if (uinput_fd >= 0)
+ close(uinput_fd);
+
+ if (input_fd >= 0)
+ close(input_fd);
+
+ if (device_fd >= 0)
+ close(device_fd);
+
+ handlers->poll_fd = -1;
+ handlers->data = NULL;
+
+ return -1;
+}
+
+int akm8975_deinit(struct smdk4x12_sensors_handlers *handlers)
+{
+ struct akm8975_data *data = NULL;
+ short mode;
+ int rc;
+
+ ALOGD("%s(%p)", __func__, handlers);
+
+ if (handlers == NULL || handlers->data == NULL)
+ return -EINVAL;
+
+ data = (struct akm8975_data *) handlers->data;
+
+ handlers->activated = 0;
+ data->thread_continue = 0;
+ pthread_mutex_unlock(&data->mutex);
+
+ pthread_mutex_destroy(&data->mutex);
+
+ if (data->uinput_fd >= 0) {
+ uinput_destroy(data->uinput_fd);
+ close(data->uinput_fd);
+ }
+ data->uinput_fd = -1;
+
+ if (handlers->poll_fd >= 0)
+ close(handlers->poll_fd);
+ handlers->poll_fd = -1;
+
+ mode = AK8975_MODE_POWER_DOWN;
+ rc = ioctl(data->device_fd, ECS_IOCTL_SET_MODE, &mode);
+ if (rc < 0)
+ ALOGE("%s: Unable to set akm8975 mode", __func__);
+
+ if (data->device_fd >= 0)
+ close(data->device_fd);
+ data->device_fd = -1;
+
+ free(handlers->data);
+ handlers->data = NULL;
+
+ return 0;
+}
+
+int akm8975_activate(struct smdk4x12_sensors_handlers *handlers)
+{
+ struct akm8975_data *data;
+ AK8975PRMS *akfs_params;
+ int rc;
+
+ ALOGD("%s(%p)", __func__, handlers);
+
+ if (handlers == NULL || handlers->data == NULL)
+ return -EINVAL;
+
+ data = (struct akm8975_data *) handlers->data;
+ akfs_params = &data->akfs_params;
+
+ // Read settings from a file
+ rc = AKFS_LoadParameters(akfs_params, AKFS_CONFIG_PATH);
+ if (rc != AKM_SUCCESS) {
+ ALOGE("%s: Unable to read AKFS HO parameters", __func__);
+ akfs_params->mfv_ho.u.x = 0.0f;
+ akfs_params->mfv_ho.u.y = 0.0f;
+ akfs_params->mfv_ho.u.z = 0.0f;
+ } else {
+ ALOGD("AKM8975 HO (Offset Adjustment) parameters read are: (%f, %f, %f)",
+ akfs_params->mfv_ho.u.x, akfs_params->mfv_ho.u.y, akfs_params->mfv_ho.u.z);
+ }
+
+ // Initialize buffer
+ AKFS_InitBuffer(AKFS_HDATA_SIZE, akfs_params->mfv_hdata);
+ AKFS_InitBuffer(AKFS_HDATA_SIZE, akfs_params->mfv_hvbuf);
+ AKFS_InitBuffer(AKFS_ADATA_SIZE, akfs_params->mfv_adata);
+ AKFS_InitBuffer(AKFS_ADATA_SIZE, akfs_params->mfv_avbuf);
+
+ // Initialize for AOC
+ AKFS_InitAOC(&akfs_params->m_aocv);
+ // Initialize magnetic status
+ akfs_params->mi_hstatus = SENSOR_STATUS_UNRELIABLE;
+
+ handlers->activated = 1;
+ pthread_mutex_unlock(&data->mutex);
+
+ return 0;
+}
+
+int akm8975_deactivate(struct smdk4x12_sensors_handlers *handlers)
+{
+ struct akm8975_data *data;
+ AK8975PRMS *akfs_params;
+ int device_fd;
+ short mode;
+ int empty;
+ int rc;
+ int i;
+
+ ALOGD("%s(%p)", __func__, handlers);
+
+ if (handlers == NULL || handlers->data == NULL)
+ return -EINVAL;
+
+ data = (struct akm8975_data *) handlers->data;
+ akfs_params = &data->akfs_params;
+
+ device_fd = data->device_fd;
+ if (device_fd < 0)
+ return -1;
+
+ empty = 1;
+
+ if ((akfs_params->mfv_ho.u.x != 0.0f) || (akfs_params->mfv_ho.u.y != 0.0f) ||
+ (akfs_params->mfv_ho.u.z != 0.0f)) {
+ empty = 0;
+ }
+
+ if (!empty) {
+ // Write settings to a file
+ rc = AKFS_SaveParameters(akfs_params, AKFS_CONFIG_PATH);
+ if (rc != AKM_SUCCESS) {
+ ALOGE("%s: Unable to write AKFS HO parameters", __func__);
+ } else {
+ ALOGD("AKM8975 HO (Offset Adjustment) parameters written are: (%f, %f, %f)",
+ akfs_params->mfv_ho.u.x, akfs_params->mfv_ho.u.y, akfs_params->mfv_ho.u.z);
+ }
+ }
+
+ mode = AK8975_MODE_POWER_DOWN;
+ rc = ioctl(device_fd, ECS_IOCTL_SET_MODE, &mode);
+ if (rc < 0)
+ ALOGE("%s: Unable to set akm8975 mode", __func__);
+
+ handlers->activated = 0;
+
+ return 0;
+}
+
+int akm8975_set_delay(struct smdk4x12_sensors_handlers *handlers, int64_t delay)
+{
+ struct akm8975_data *data;
+
+ ALOGD("%s(%p, %" PRId64 ")", __func__, handlers, delay);
+
+ if (handlers == NULL || handlers->data == NULL)
+ return -EINVAL;
+
+ data = (struct akm8975_data *) handlers->data;
+
+ data->delay = delay;
+
+ return 0;
+}
+
+float akm8975_convert(int value)
+{
+ return (float) value / 1000.0f;
+}
+
+int akm8975_get_data(struct smdk4x12_sensors_handlers *handlers,
+ struct sensors_event_t *event)
+{
+ struct akm8975_data *data;
+ struct input_event input_event;
+ int input_fd;
+ int rc;
+
+// ALOGD("%s(%p, %p)", __func__, handlers, event);
+
+ if (handlers == NULL || handlers->data == NULL || event == NULL)
+ return -EINVAL;
+
+ data = (struct akm8975_data *) handlers->data;
+
+ input_fd = handlers->poll_fd;
+ if (input_fd < 0)
+ return -1;
+
+ memset(event, 0, sizeof(struct sensors_event_t));
+ event->version = sizeof(struct sensors_event_t);
+ event->sensor = handlers->handle;
+ event->type = handlers->handle;
+
+ do {
+ rc = read(input_fd, &input_event, sizeof(input_event));
+ if (rc < (int) sizeof(input_event))
+ break;
+
+ if (input_event.type == EV_REL) {
+ switch (input_event.code) {
+ case REL_X:
+ event->magnetic.x = akm8975_convert(input_event.value);
+ break;
+ case REL_Y:
+ event->magnetic.y = akm8975_convert(input_event.value);
+ break;
+ case REL_Z:
+ event->magnetic.z = akm8975_convert(input_event.value);
+ break;
+ case REL_MISC:
+ event->magnetic.status = input_event.value;
+ break;
+ default:
+ continue;
+ }
+ } else if (input_event.type == EV_SYN) {
+ if (input_event.code == SYN_REPORT)
+ event->timestamp = input_timestamp(&input_event);
+ }
+ } while (input_event.type != EV_SYN);
+
+ return 0;
+}
+
+struct smdk4x12_sensors_handlers akm8975 = {
+ .name = "AKM8975",
+ .handle = SENSOR_TYPE_MAGNETIC_FIELD,
+ .init = akm8975_init,
+ .deinit = akm8975_deinit,
+ .activate = akm8975_activate,
+ .deactivate = akm8975_deactivate,
+ .set_delay = akm8975_set_delay,
+ .get_data = akm8975_get_data,
+ .activated = 0,
+ .needed = 0,
+ .poll_fd = -1,
+ .data = NULL,
+};
diff --git a/libsensors/akmdfs/AK8975Driver.c b/libsensors/akmdfs/AK8975Driver.c
new file mode 100644
index 0000000..003c8d2
--- /dev/null
+++ b/libsensors/akmdfs/AK8975Driver.c
@@ -0,0 +1,318 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#include <fcntl.h>
+#include "AKFS_Common.h"
+#include "AK8975Driver.h"
+
+#define MSENSOR_NAME "/dev/akm8975_dev"
+
+static int s_fdDev = -1;
+
+/*!
+ Open device driver.
+ This function opens both device drivers of magnetic sensor and acceleration
+ sensor. Additionally, some initial hardware settings are done, such as
+ measurement range, built-in filter function and etc.
+ @return If this function succeeds, the return value is #AKD_SUCCESS.
+ Otherwise the return value is #AKD_FAIL.
+ */
+int16_t AKD_InitDevice(void)
+{
+ if (s_fdDev < 0) {
+ /* Open magnetic sensor's device driver. */
+ if ((s_fdDev = open(MSENSOR_NAME, O_RDWR)) < 0) {
+ AKMERROR_STR("open");
+ return AKD_FAIL;
+ }
+ }
+
+ return AKD_SUCCESS;
+}
+
+/*!
+ Close device driver.
+ This function closes both device drivers of magnetic sensor and acceleration
+ sensor.
+ */
+void AKD_DeinitDevice(void)
+{
+ if (s_fdDev >= 0) {
+ close(s_fdDev);
+ s_fdDev = -1;
+ }
+}
+
+/*!
+ Writes data to a register of the AK8975. When more than one byte of data is
+ specified, the data is written in contiguous locations starting at an address
+ specified in \a address.
+ @return If this function succeeds, the return value is #AKD_SUCCESS. Otherwise
+ the return value is #AKD_FAIL.
+ @param[in] address Specify the address of a register in which data is to be
+ written.
+ @param[in] data Specify data to write or a pointer to a data array containing
+ the data. When specifying more than one byte of data, specify the starting
+ address of the array.
+ @param[in] numberOfBytesToWrite Specify the number of bytes that make up the
+ data to write. When a pointer to an array is specified in data, this argument
+ equals the number of elements of the array.
+ */
+int16_t AKD_TxData(
+ const BYTE address,
+ const BYTE * data,
+ const uint16_t numberOfBytesToWrite)
+{
+ int i;
+ char buf[RWBUF_SIZE];
+
+ if (s_fdDev < 0) {
+ ALOGE("%s: Device file is not opened.", __FUNCTION__);
+ return AKD_FAIL;
+ }
+ if (numberOfBytesToWrite > (RWBUF_SIZE-2)) {
+ ALOGE("%s: Tx size is too large.", __FUNCTION__);
+ return AKD_FAIL;
+ }
+
+ buf[0] = numberOfBytesToWrite + 1;
+ buf[1] = address;
+
+ for (i = 0; i < numberOfBytesToWrite; i++) {
+ buf[i + 2] = data[i];
+ }
+ if (ioctl(s_fdDev, ECS_IOCTL_WRITE, buf) < 0) {
+ AKMERROR_STR("ioctl");
+ return AKD_FAIL;
+ } else {
+
+#if ENABLE_AKMDEBUG
+ AKMDATA(AKMDATA_DRV, "addr(HEX)=%02x data(HEX)=", address);
+ for (i = 0; i < numberOfBytesToWrite; i++) {
+ AKMDATA(AKMDATA_DRV, " %02x", data[i]);
+ }
+ AKMDATA(AKMDATA_DRV, "\n");
+#endif
+ return AKD_SUCCESS;
+ }
+}
+
+/*!
+ Acquires data from a register or the EEPROM of the AK8975.
+ @return If this function succeeds, the return value is #AKD_SUCCESS. Otherwise
+ the return value is #AKD_FAIL.
+ @param[in] address Specify the address of a register from which data is to be
+ read.
+ @param[out] data Specify a pointer to a data array which the read data are
+ stored.
+ @param[in] numberOfBytesToRead Specify the number of bytes that make up the
+ data to read. When a pointer to an array is specified in data, this argument
+ equals the number of elements of the array.
+ */
+int16_t AKD_RxData(
+ const BYTE address,
+ BYTE * data,
+ const uint16_t numberOfBytesToRead)
+{
+ int i;
+ char buf[RWBUF_SIZE];
+
+ memset(data, 0, numberOfBytesToRead);
+
+ if (s_fdDev < 0) {
+ ALOGE("%s: Device file is not opened.", __FUNCTION__);
+ return AKD_FAIL;
+ }
+ if (numberOfBytesToRead > (RWBUF_SIZE-1)) {
+ ALOGE("%s: Rx size is too large.", __FUNCTION__);
+ return AKD_FAIL;
+ }
+
+ buf[0] = numberOfBytesToRead;
+ buf[1] = address;
+
+ if (ioctl(s_fdDev, ECS_IOCTL_READ, buf) < 0) {
+ AKMERROR_STR("ioctl");
+ return AKD_FAIL;
+ } else {
+ for (i = 0; i < numberOfBytesToRead; i++) {
+ data[i] = buf[i + 1];
+ }
+#if ENABLE_AKMDEBUG
+ AKMDATA(AKMDATA_DRV, "addr(HEX)=%02x len=%d data(HEX)=",
+ address, numberOfBytesToRead);
+ for (i = 0; i < numberOfBytesToRead; i++) {
+ AKMDATA(AKMDATA_DRV, " %02x", data[i]);
+ }
+ AKMDATA(AKMDATA_DRV, "\n");
+#endif
+ return AKD_SUCCESS;
+ }
+}
+
+/*!
+ Acquire magnetic data from AK8975. If measurement is not done, this function
+ waits until measurement completion.
+ @return If this function succeeds, the return value is #AKD_SUCCESS. Otherwise
+ the return value is #AKD_FAIL.
+ @param[out] data A magnetic data array. The size should be larger than #SENSOR_DATA_SIZE.
+ */
+int16_t AKD_GetMagneticData(BYTE data[SENSOR_DATA_SIZE])
+{
+ memset(data, 0, SENSOR_DATA_SIZE);
+
+ if (s_fdDev < 0) {
+ ALOGE("%s: Device file is not opened.", __FUNCTION__);
+ return AKD_FAIL;
+ }
+
+ if (ioctl(s_fdDev, ECS_IOCTL_GETDATA, data) < 0) {
+ AKMERROR_STR("ioctl");
+ return AKD_FAIL;
+ }
+
+ AKMDATA(AKMDATA_DRV,
+ "bdata(HEX)= %02x %02x %02x %02x %02x %02x %02x %02x\n",
+ data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
+
+ return AKD_SUCCESS;
+}
+
+/*!
+ Set calculated data to device driver.
+ @param[in] buf The order of input data depends on driver's specification.
+ */
+void AKD_SetYPR(const int buf[YPR_DATA_SIZE])
+{
+ if (s_fdDev < 0) {
+ ALOGE("%s: Device file is not opened.", __FUNCTION__);
+ } else {
+ if (ioctl(s_fdDev, ECS_IOCTL_SET_YPR, buf) < 0) {
+ AKMERROR_STR("ioctl");
+ }
+ }
+}
+
+/*!
+ */
+int AKD_GetOpenStatus(int* status)
+{
+ if (s_fdDev < 0) {
+ ALOGE("%s: Device file is not opened.", __FUNCTION__);
+ return AKD_FAIL;
+ }
+ if (ioctl(s_fdDev, ECS_IOCTL_GET_OPEN_STATUS, status) < 0) {
+ AKMERROR_STR("ioctl");
+ return AKD_FAIL;
+ }
+ return AKD_SUCCESS;
+}
+
+/*!
+ */
+int AKD_GetCloseStatus(int* status)
+{
+ if (s_fdDev < 0) {
+ ALOGE("%s: Device file is not opened.", __FUNCTION__);
+ return AKD_FAIL;
+ }
+ if (ioctl(s_fdDev, ECS_IOCTL_GET_CLOSE_STATUS, status) < 0) {
+ AKMERROR_STR("ioctl");
+ return AKD_FAIL;
+ }
+ return AKD_SUCCESS;
+}
+
+/*!
+ Set AK8975 to the specific mode.
+ @return If this function succeeds, the return value is #AKD_SUCCESS. Otherwise
+ the return value is #AKD_FAIL.
+ @param[in] mode This value should be one of the AK8975_Mode which is defined in
+ akm8975.h file.
+ */
+int16_t AKD_SetMode(const BYTE mode)
+{
+ if (s_fdDev < 0) {
+ ALOGE("%s: Device file is not opened.", __FUNCTION__);
+ return AKD_FAIL;
+ }
+
+ if (ioctl(s_fdDev, ECS_IOCTL_SET_MODE, &mode) < 0) {
+ AKMERROR_STR("ioctl");
+ return AKD_FAIL;
+ }
+
+ return AKD_SUCCESS;
+}
+
+/*!
+ Acquire delay
+ @return If this function succeeds, the return value is #AKD_SUCCESS. Otherwise
+ the return value is #AKD_FAIL.
+ @param[out] delay A delay in nanosecond.
+ */
+int16_t AKD_GetDelay(int64_t delay[AKM_NUM_SENSORS])
+{
+ if (s_fdDev < 0) {
+ ALOGE("%s: Device file is not opened.\n", __FUNCTION__);
+ return AKD_FAIL;
+ }
+ if (ioctl(s_fdDev, ECS_IOCTL_GET_DELAY, delay) < 0) {
+ AKMERROR_STR("ioctl");
+ return AKD_FAIL;
+ }
+ return AKD_SUCCESS;
+}
+
+/*!
+ Get layout information from device driver, i.e. platform data.
+ */
+int16_t AKD_GetLayout(int16_t* layout)
+{
+ char tmp;
+
+ if (s_fdDev < 0) {
+ ALOGE("%s: Device file is not opened.", __FUNCTION__);
+ return AKD_FAIL;
+ }
+
+ if (ioctl(s_fdDev, ECS_IOCTL_GET_LAYOUT, &tmp) < 0) {
+ AKMERROR_STR("ioctl");
+ return AKD_FAIL;
+ }
+
+ *layout = tmp;
+ return AKD_SUCCESS;
+}
+
+/* Get acceleration data. */
+int16_t AKD_GetAccelerationData(int16_t data[3])
+{
+ if (s_fdDev < 0) {
+ ALOGE("%s: Device file is not opened.", __FUNCTION__);
+ return AKD_FAIL;
+ }
+ if (ioctl(s_fdDev, ECS_IOCTL_GET_ACCEL, data) < 0) {
+ AKMERROR_STR("ioctl");
+ return AKD_FAIL;
+ }
+
+ AKMDATA(AKMDATA_DRV, "%s: acc=%d, %d, %d\n",
+ __FUNCTION__, data[0], data[1], data[2]);
+
+ return AKD_SUCCESS;
+}
diff --git a/libsensors/akmdfs/AK8975Driver.h b/libsensors/akmdfs/AK8975Driver.h
new file mode 100644
index 0000000..731210d
--- /dev/null
+++ b/libsensors/akmdfs/AK8975Driver.h
@@ -0,0 +1,102 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#ifndef AKMD_INC_AK8975DRIVER_H
+#define AKMD_INC_AK8975DRIVER_H
+
+#include <linux/akm8975.h> /* Device driver */
+#include <stdint.h> /* int8_t, int16_t etc. */
+
+/*** Constant definition ******************************************************/
+#define AKD_TRUE 1 /*!< Represents true */
+#define AKD_FALSE 0 /*!< Represents false */
+#define AKD_SUCCESS 1 /*!< Represents success.*/
+#define AKD_FAIL 0 /*!< Represents fail. */
+#define AKD_ERROR -1 /*!< Represents error. */
+
+/*! 0:Don't Output data, 1:Output data */
+#define AKD_DBG_DATA 0
+/*! Typical interval in ns */
+#define AK8975_MEASUREMENT_TIME_NS ((AK8975_MEASUREMENT_TIME_US) * 1000)
+/*! 720 LSG = 1G = 9.8 m/s2 */
+#define LSG 720
+
+
+/*** Type declaration *********************************************************/
+typedef unsigned char BYTE;
+
+/*!
+ Open device driver.
+ This function opens device driver of acceleration sensor.
+ @return If this function succeeds, the return value is #AKD_SUCCESS. Otherwise
+ the return value is #AKD_FAIL.
+ */
+typedef int16_t(*ACCFNC_INITDEVICE)(void);
+
+/*!
+ Close device driver.
+ This function closes device drivers of acceleration sensor.
+ */
+typedef void(*ACCFNC_DEINITDEVICE)(void);
+
+/*!
+ Acquire acceleration data from acceleration sensor and convert it to Android
+ coordinate system.
+ @return If this function succeeds, the return value is #AKD_SUCCESS. Otherwise
+ the return value is #AKD_FAIL.
+ @param[out] data A acceleration data array. The coordinate system of the
+ acquired data follows the definition of Android. Unit is SmartCompass.
+ */
+typedef int16_t(*ACCFNC_GETACCDATA)(short data[3]);
+
+
+/*** Global variables *********************************************************/
+
+/*** Prototype of Function ***************************************************/
+
+int16_t AKD_InitDevice(void);
+
+void AKD_DeinitDevice(void);
+
+int16_t AKD_TxData(
+ const BYTE address,
+ const BYTE* data,
+ const uint16_t numberOfBytesToWrite);
+
+int16_t AKD_RxData(
+ const BYTE address,
+ BYTE* data,
+ const uint16_t numberOfBytesToRead);
+
+int16_t AKD_GetMagneticData(BYTE data[SENSOR_DATA_SIZE]);
+
+void AKD_SetYPR(const int buf[YPR_DATA_SIZE]);
+
+int AKD_GetOpenStatus(int* status);
+
+int AKD_GetCloseStatus(int* status);
+
+int16_t AKD_SetMode(const BYTE mode);
+
+int16_t AKD_GetDelay(int64_t delay[AKM_NUM_SENSORS]);
+
+int16_t AKD_GetLayout(int16_t* layout);
+
+int16_t AKD_GetAccelerationData(int16_t data[3]);
+
+#endif /* AKMD_INC_AK8975DRIVER_H */
+
diff --git a/libsensors/akmdfs/AKFS_APIs.c b/libsensors/akmdfs/AKFS_APIs.c
new file mode 100644
index 0000000..ace9bc1
--- /dev/null
+++ b/libsensors/akmdfs/AKFS_APIs.c
@@ -0,0 +1,389 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#include "AKFS_Common.h"
+#include "AKFS_Disp.h"
+#include "AKFS_FileIO.h"
+#include "AKFS_APIs.h"
+
+#ifdef WIN32
+#include "AK8975_LinuxDriver.h"
+#endif
+
+static AK8975PRMS g_prms;
+
+/*!
+ Initialize library. At first, 0 is set to all parameters. After that, some
+ parameters, which should not be 0, are set to specific value. Some of initial
+ values can be customized by editing the file \c "AKFS_CSpec.h".
+ @return The return value is #AKM_SUCCESS.
+ @param[in] hpat Specify a layout pattern number. The number is determined
+ according to the mount orientation of the magnetometer.
+ @param[in] regs[3] Specify the ASA values which are read out from
+ fuse ROM. regs[0] is ASAX, regs[1] is ASAY, regs[2] is ASAZ.
+ */
+int16 AKFS_Init(
+ const AKFS_PATNO hpat,
+ const uint8 regs[]
+)
+{
+ AKMDATA(AKMDATA_DUMP, "%s: hpat=%d, r[0]=0x%02X, r[1]=0x%02X, r[2]=0x%02X\n",
+ __FUNCTION__, hpat, regs[0], regs[1], regs[2]);
+
+ /* Set 0 to the AK8975 structure. */
+ memset(&g_prms, 0, sizeof(AK8975PRMS));
+
+ /* Sensitivity */
+ g_prms.mfv_hs.u.x = AK8975_HSENSE_DEFAULT;
+ g_prms.mfv_hs.u.y = AK8975_HSENSE_DEFAULT;
+ g_prms.mfv_hs.u.z = AK8975_HSENSE_DEFAULT;
+ g_prms.mfv_as.u.x = AK8975_ASENSE_DEFAULT;
+ g_prms.mfv_as.u.y = AK8975_ASENSE_DEFAULT;
+ g_prms.mfv_as.u.z = AK8975_ASENSE_DEFAULT;
+
+ /* Initialize variables that initial value is not 0. */
+ g_prms.mi_hnaveV = CSPEC_HNAVE_V;
+ g_prms.mi_hnaveD = CSPEC_HNAVE_D;
+ g_prms.mi_anaveV = CSPEC_ANAVE_V;
+ g_prms.mi_anaveD = CSPEC_ANAVE_D;
+
+ /* Copy ASA values */
+ g_prms.mi_asa.u.x = regs[0];
+ g_prms.mi_asa.u.y = regs[1];
+ g_prms.mi_asa.u.z = regs[2];
+
+ /* Copy layout pattern */
+ g_prms.m_hpat = hpat;
+
+ return AKM_SUCCESS;
+}
+
+/*!
+ Release resources. This function is for future expansion.
+ @return The return value is #AKM_SUCCESS.
+ */
+int16 AKFS_Release(void)
+{
+ return AKM_SUCCESS;
+}
+
+/*
+ This function is called just before a measurement sequence starts.
+ This function reads parameters from file, then initializes algorithm
+ parameters.
+ @return The return value is #AKM_SUCCESS.
+ @param[in] path Specify a path to the settings file.
+ */
+int16 AKFS_Start(
+ const char* path
+)
+{
+ AKMDATA(AKMDATA_DUMP, "%s: path=%s\n", __FUNCTION__, path);
+
+ /* Read setting files from a file */
+ if (AKFS_LoadParameters(&g_prms, path) != AKM_SUCCESS) {
+ AKMERROR_STR("AKFS_Load");
+ }
+
+ /* Initialize buffer */
+ AKFS_InitBuffer(AKFS_HDATA_SIZE, g_prms.mfv_hdata);
+ AKFS_InitBuffer(AKFS_HDATA_SIZE, g_prms.mfv_hvbuf);
+ AKFS_InitBuffer(AKFS_ADATA_SIZE, g_prms.mfv_adata);
+ AKFS_InitBuffer(AKFS_ADATA_SIZE, g_prms.mfv_avbuf);
+
+ /* Initialize for AOC */
+ AKFS_InitAOC(&g_prms.m_aocv);
+ /* Initialize magnetic status */
+ g_prms.mi_hstatus = 0;
+
+ return AKM_SUCCESS;
+}
+
+/*!
+ This function is called when a measurement sequence is done.
+ This fucntion writes parameters to file.
+ @return The return value is #AKM_SUCCESS.
+ @param[in] path Specify a path to the settings file.
+ */
+int16 AKFS_Stop(
+ const char* path
+)
+{
+ AKMDATA(AKMDATA_DUMP, "%s: path=%s\n", __FUNCTION__, path);
+
+ /* Write setting files to a file */
+ if (AKFS_SaveParameters(&g_prms, path) != AKM_SUCCESS) {
+ AKMERROR_STR("AKFS_Save");
+ }
+
+ return AKM_SUCCESS;
+}
+
+/*!
+ This function is called when new magnetometer data is available. The output
+ vector format and coordination system follow the Android definition.
+ @return The return value is #AKM_SUCCESS.
+ Otherwise the return value is #AKM_FAIL.
+ @param[in] mag A set of measurement data from magnetometer. X axis value
+ should be in mag[0], Y axis value should be in mag[1], Z axis value should be
+ in mag[2].
+ @param[in] status A status of magnetometer. This status indicates the result
+ of measurement data, i.e. overflow, success or fail, etc.
+ @param[out] vx X axis value of magnetic field vector.
+ @param[out] vy Y axis value of magnetic field vector.
+ @param[out] vz Z axis value of magnetic field vector.
+ @param[out] accuracy Accuracy of magnetic field vector.
+ */
+int16 AKFS_Get_MAGNETIC_FIELD(
+ const int16 mag[3],
+ const int16 status,
+ AKFLOAT* vx,
+ AKFLOAT* vy,
+ AKFLOAT* vz,
+ int16* accuracy
+)
+{
+ int16 akret;
+ int16 aocret;
+ AKFLOAT radius;
+
+ AKMDATA(AKMDATA_DUMP, "%s: m[0]=%d, m[1]=%d, m[2]=%d, st=%d\n",
+ __FUNCTION__, mag[0], mag[1], mag[2], status);
+
+ /* Decomposition */
+ /* Sensitivity adjustment, i.e. multiply ASA, is done in this function. */
+ akret = AKFS_DecompAK8975(
+ mag,
+ status,
+ &g_prms.mi_asa,
+ AKFS_HDATA_SIZE,
+ g_prms.mfv_hdata
+ );
+ if(akret == AKFS_ERROR) {
+ AKMERROR;
+ return AKM_FAIL;
+ }
+
+ /* Adjust coordination */
+ akret = AKFS_Rotate(
+ g_prms.m_hpat,
+ &g_prms.mfv_hdata[0]
+ );
+ if (akret == AKFS_ERROR) {
+ AKMERROR;
+ return AKM_FAIL;
+ }
+
+ /* AOC for magnetometer */
+ /* Offset estimation is done in this function */
+ aocret = AKFS_AOC(
+ &g_prms.m_aocv,
+ g_prms.mfv_hdata,
+ &g_prms.mfv_ho
+ );
+
+ /* Subtract offset */
+ /* Then, a magnetic vector, the unit is uT, is stored in mfv_hvbuf. */
+ akret = AKFS_VbNorm(
+ AKFS_HDATA_SIZE,
+ g_prms.mfv_hdata,
+ 1,
+ &g_prms.mfv_ho,
+ &g_prms.mfv_hs,
+ AK8975_HSENSE_TARGET,
+ AKFS_HDATA_SIZE,
+ g_prms.mfv_hvbuf
+ );
+ if(akret == AKFS_ERROR) {
+ AKMERROR;
+ return AKM_FAIL;
+ }
+
+ /* Averaging */
+ akret = AKFS_VbAve(
+ AKFS_HDATA_SIZE,
+ g_prms.mfv_hvbuf,
+ CSPEC_HNAVE_V,
+ &g_prms.mfv_hvec
+ );
+ if (akret == AKFS_ERROR) {
+ AKMERROR;
+ return AKM_FAIL;
+ }
+
+ /* Check the size of magnetic vector */
+ radius = AKFS_SQRT(
+ (g_prms.mfv_hvec.u.x * g_prms.mfv_hvec.u.x) +
+ (g_prms.mfv_hvec.u.y * g_prms.mfv_hvec.u.y) +
+ (g_prms.mfv_hvec.u.z * g_prms.mfv_hvec.u.z));
+
+ if (radius > AKFS_GEOMAG_MAX) {
+ g_prms.mi_hstatus = 0;
+ } else {
+ if (aocret) {
+ g_prms.mi_hstatus = 3;
+ }
+ }
+
+ *vx = g_prms.mfv_hvec.u.x;
+ *vy = g_prms.mfv_hvec.u.y;
+ *vz = g_prms.mfv_hvec.u.z;
+ *accuracy = g_prms.mi_hstatus;
+
+ /* Debug output */
+ AKMDATA(AKMDATA_MAG, "Mag(%d):%8.2f, %8.2f, %8.2f\n",
+ *accuracy, *vx, *vy, *vz);
+
+ return AKM_SUCCESS;
+}
+
+/*!
+ This function is called when new accelerometer data is available. The output
+ vector format and coordination system follow the Android definition.
+ @return The return value is #AKM_SUCCESS when function succeeds. Otherwise
+ the return value is #AKM_FAIL.
+ @param[in] acc A set of measurement data from accelerometer. X axis value
+ should be in acc[0], Y axis value should be in acc[1], Z axis value should be
+ in acc[2].
+ @param[in] status A status of accelerometer. This status indicates the result
+ of acceleration data, i.e. overflow, success or fail, etc.
+ @param[out] vx X axis value of acceleration vector.
+ @param[out] vy Y axis value of acceleration vector.
+ @param[out] vz Z axis value of acceleration vector.
+ @param[out] accuracy Accuracy of acceleration vector.
+ This value is always 3.
+ */
+int16 AKFS_Get_ACCELEROMETER(
+ const int16 acc[3],
+ const int16 status,
+ AKFLOAT* vx,
+ AKFLOAT* vy,
+ AKFLOAT* vz,
+ int16* accuracy
+)
+{
+ int16 akret;
+
+ AKMDATA(AKMDATA_DUMP, "%s: a[0]=%d, a[1]=%d, a[2]=%d, st=%d\n",
+ __FUNCTION__, acc[0], acc[1], acc[2], status);
+
+ /* Save data to buffer */
+ AKFS_BufShift(
+ AKFS_ADATA_SIZE,
+ 1,
+ g_prms.mfv_adata
+ );
+ g_prms.mfv_adata[0].u.x = acc[0];
+ g_prms.mfv_adata[0].u.y = acc[1];
+ g_prms.mfv_adata[0].u.z = acc[2];
+
+ /* Subtract offset, adjust sensitivity */
+ /* As a result, a unit of acceleration data in mfv_avbuf is '1G = 9.8' */
+ akret = AKFS_VbNorm(
+ AKFS_ADATA_SIZE,
+ g_prms.mfv_adata,
+ 1,
+ &g_prms.mfv_ao,
+ &g_prms.mfv_as,
+ AK8975_ASENSE_TARGET,
+ AKFS_ADATA_SIZE,
+ g_prms.mfv_avbuf
+ );
+ if(akret == AKFS_ERROR) {
+ AKMERROR;
+ return AKM_FAIL;
+ }
+
+ /* Averaging */
+ akret = AKFS_VbAve(
+ AKFS_ADATA_SIZE,
+ g_prms.mfv_avbuf,
+ CSPEC_ANAVE_V,
+ &g_prms.mfv_avec
+ );
+ if (akret == AKFS_ERROR) {
+ AKMERROR;
+ return AKM_FAIL;
+ }
+
+ /* Adjust coordination */
+ /* It is not needed. Because, the data from AK8975 driver is already
+ follows Android coordinate system. */
+
+ *vx = g_prms.mfv_avec.u.x;
+ *vy = g_prms.mfv_avec.u.y;
+ *vz = g_prms.mfv_avec.u.z;
+ *accuracy = 3;
+
+ /* Debug output */
+ AKMDATA(AKMDATA_ACC, "Acc(%d):%8.2f, %8.2f, %8.2f\n",
+ *accuracy, *vx, *vy, *vz);
+
+ return AKM_SUCCESS;
+}
+
+/*!
+ Get orientation sensor's elements. The vector format and coordination system
+ follow the Android definition. Before this function is called, magnetic
+ field vector and acceleration vector should be stored in the buffer by
+ calling #AKFS_Get_MAGNETIC_FIELD and #AKFS_Get_ACCELEROMETER.
+ @return The return value is #AKM_SUCCESS when function succeeds. Otherwise
+ the return value is #AKM_FAIL.
+ @param[out] azimuth Azimuthal angle in degree.
+ @param[out] pitch Pitch angle in degree.
+ @param[out] roll Roll angle in degree.
+ @param[out] accuracy Accuracy of orientation sensor.
+ */
+int16 AKFS_Get_ORIENTATION(
+ AKFLOAT* azimuth,
+ AKFLOAT* pitch,
+ AKFLOAT* roll,
+ int16* accuracy
+)
+{
+ int16 akret;
+
+ /* Azimuth calculation */
+ /* Coordination system follows the Android coordination. */
+ akret = AKFS_Direction(
+ AKFS_HDATA_SIZE,
+ g_prms.mfv_hvbuf,
+ CSPEC_HNAVE_D,
+ AKFS_ADATA_SIZE,
+ g_prms.mfv_avbuf,
+ CSPEC_ANAVE_D,
+ &g_prms.mf_azimuth,
+ &g_prms.mf_pitch,
+ &g_prms.mf_roll
+ );
+
+ if(akret == AKFS_ERROR) {
+ AKMERROR;
+ return AKM_FAIL;
+ }
+ *azimuth = g_prms.mf_azimuth;
+ *pitch = g_prms.mf_pitch;
+ *roll = g_prms.mf_roll;
+ *accuracy = g_prms.mi_hstatus;
+
+ /* Debug output */
+ AKMDATA(AKMDATA_ORI, "Ori(%d):%8.2f, %8.2f, %8.2f\n",
+ *accuracy, *azimuth, *pitch, *roll);
+
+ return AKM_SUCCESS;
+}
+
diff --git a/libsensors/akmdfs/AKFS_APIs.h b/libsensors/akmdfs/AKFS_APIs.h
new file mode 100644
index 0000000..e4d1e48
--- /dev/null
+++ b/libsensors/akmdfs/AKFS_APIs.h
@@ -0,0 +1,69 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#ifndef AKFS_INC_APIS_H
+#define AKFS_INC_APIS_H
+
+/* Include files for AK8975 library. */
+#include "AKFS_Compass.h"
+
+/*** Constant definition ******************************************************/
+#define AKFS_GEOMAG_MAX 70
+
+/*** Type declaration *********************************************************/
+
+/*** Global variables *********************************************************/
+
+/*** Prototype of function ****************************************************/
+int16 AKFS_Init(
+ const AKFS_PATNO hpat,
+ const uint8 regs[]
+);
+
+int16 AKFS_Release(void);
+
+int16 AKFS_Start(const char* path);
+
+int16 AKFS_Stop(const char* path);
+
+int16 AKFS_Get_MAGNETIC_FIELD(
+ const int16 mag[3],
+ const int16 status,
+ AKFLOAT* vx,
+ AKFLOAT* vy,
+ AKFLOAT* vz,
+ int16* accuracy
+);
+
+int16 AKFS_Get_ACCELEROMETER(
+ const int16 acc[3],
+ const int16 status,
+ AKFLOAT* vx,
+ AKFLOAT* vy,
+ AKFLOAT* vz,
+ int16* accuracy
+);
+
+int16 AKFS_Get_ORIENTATION(
+ AKFLOAT* azimuth,
+ AKFLOAT* pitch,
+ AKFLOAT* roll,
+ int16* accuracy
+);
+
+#endif
+
diff --git a/libsensors/akmdfs/AKFS_APIs_8975/AKFS_AK8975.c b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_AK8975.c
new file mode 100644
index 0000000..7bac9a1
--- /dev/null
+++ b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_AK8975.c
@@ -0,0 +1,44 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#include "AKFS_AK8975.h"
+#include "AKFS_Device.h"
+
+/*!
+ */
+int16 AKFS_DecompAK8975(
+ const int16 mag[3],
+ const int16 status,
+ const uint8vec* asa,
+ const int16 nhdata,
+ AKFVEC hdata[]
+)
+{
+ /* put st1 and st2 value */
+ if (AK8975_ST_ERROR(status)) {
+ return AKFS_ERROR;
+ }
+
+ /* magnetic */
+ AKFS_BufShift(nhdata, 1, hdata);
+ hdata[0].u.x = mag[0] * (((asa->u.x)/256.0f) + 0.5f);
+ hdata[0].u.y = mag[1] * (((asa->u.y)/256.0f) + 0.5f);
+ hdata[0].u.z = mag[2] * (((asa->u.z)/256.0f) + 0.5f);
+
+ return AKFS_SUCCESS;
+}
+
diff --git a/libsensors/akmdfs/AKFS_APIs_8975/AKFS_AK8975.h b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_AK8975.h
new file mode 100644
index 0000000..25459e3
--- /dev/null
+++ b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_AK8975.h
@@ -0,0 +1,50 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#ifndef AKFS_INC_AK8975_H
+#define AKFS_INC_AK8975_H
+
+#include "AKFS_Device.h"
+
+/***** Constant definition ****************************************************/
+#define AK8975_BDATA_SIZE 8
+
+#define AK8975_HSENSE_DEFAULT 1
+#define AK8975_HSENSE_TARGET 0.3f
+#define AK8975_ASENSE_DEFAULT 720
+#define AK8975_ASENSE_TARGET 9.80665f
+
+#define AK8975_HDATA_CONVERTER(hi, low, asa) \
+ (AKFLOAT)((int16)((((uint16)(hi))<<8)+(uint16)(low))*(((asa)/256.0f) + 0.5f))
+
+#define AK8975_ST_ERROR(st) (((st)&0x09) != 0x01)
+
+/***** Type declaration *******************************************************/
+
+/***** Prototype of function **************************************************/
+AKLIB_C_API_START
+int16 AKFS_DecompAK8975(
+ const int16 mag[3],
+ const int16 status,
+ const uint8vec* asa,
+ const int16 nhdata,
+ AKFVEC hdata[]
+);
+AKLIB_C_API_END
+
+#endif
+
diff --git a/libsensors/akmdfs/AKFS_APIs_8975/AKFS_AOC.c b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_AOC.c
new file mode 100644
index 0000000..62b2361
--- /dev/null
+++ b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_AOC.c
@@ -0,0 +1,333 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#include "AKFS_AOC.h"
+#include "AKFS_Math.h"
+
+/*
+ * CalcR
+ */
+static AKFLOAT CalcR(
+ const AKFVEC* x,
+ const AKFVEC* y
+){
+ int16 i;
+ AKFLOAT r;
+
+ r = 0.0;
+ for(i = 0; i < 3; i++){
+ r += (x->v[i]-y->v[i]) * (x->v[i]-y->v[i]);
+ }
+ r = sqrt(r);
+
+ return r;
+}
+
+/*
+ * From4Points2Sphere()
+ */
+static int16 From4Points2Sphere(
+ const AKFVEC points[], /*! (i/o) : input vectors */
+ AKFVEC* center, /*! (o) : center of sphere */
+ AKFLOAT* r /*! (i) : add/subtract value */
+){
+ AKFLOAT dif[3][3];
+ AKFLOAT r2[3];
+
+ AKFLOAT A;
+ AKFLOAT B;
+ AKFLOAT C;
+ AKFLOAT D;
+ AKFLOAT E;
+ AKFLOAT F;
+ AKFLOAT G;
+
+ AKFLOAT OU;
+ AKFLOAT OD;
+
+ int16 i, j;
+
+ for(i = 0; i < 3; i++){
+ r2[i] = 0.0;
+ for(j = 0; j < 3; j++){
+ dif[i][j] = points[i].v[j] - points[3].v[j];
+ r2[i] += (points[i].v[j]*points[i].v[j]
+ - points[3].v[j]*points[3].v[j]);
+ }
+ r2[i] *= 0.5;
+ }
+
+ A = dif[0][0]*dif[2][2] - dif[0][2]*dif[2][0];
+ B = dif[0][1]*dif[2][0] - dif[0][0]*dif[2][1];
+ C = dif[0][0]*dif[2][1] - dif[0][1]*dif[2][0];
+ D = dif[0][0]*r2[2] - dif[2][0]*r2[0];
+ E = dif[0][0]*dif[1][1] - dif[0][1]*dif[1][0];
+ F = dif[1][0]*dif[0][2] - dif[0][0]*dif[1][2];
+ G = dif[0][0]*r2[1] - dif[1][0]*r2[0];
+
+ OU = D*E + B*G;
+ OD = C*F + A*E;
+
+ if(fabs(OD) < AKFS_EPSILON){
+ return -1;
+ }
+
+ center->v[2] = OU / OD;
+
+ OU = F*center->v[2] + G;
+ OD = E;
+
+ if(fabs(OD) < AKFS_EPSILON){
+ return -1;
+ }
+
+ center->v[1] = OU / OD;
+
+ OU = r2[0] - dif[0][1]*center->v[1] - dif[0][2]*center->v[2];
+ OD = dif[0][0];
+
+ if(fabs(OD) < AKFS_EPSILON){
+ return -1;
+ }
+
+ center->v[0] = OU / OD;
+
+ *r = CalcR(&points[0], center);
+
+ return 0;
+
+}
+
+/*
+ * MeanVar
+ */
+static void MeanVar(
+ const AKFVEC v[], /*!< (i) : input vectors */
+ const int16 n, /*!< (i) : number of vectors */
+ AKFVEC* mean, /*!< (o) : (max+min)/2 */
+ AKFVEC* var /*!< (o) : variation in vectors */
+){
+ int16 i;
+ int16 j;
+ AKFVEC max;
+ AKFVEC min;
+
+ for(j = 0; j < 3; j++){
+ min.v[j] = v[0].v[j];
+ max.v[j] = v[0].v[j];
+ for(i = 1; i < n; i++){
+ if(v[i].v[j] < min.v[j]){
+ min.v[j] = v[i].v[j];
+ }
+ if(v[i].v[j] > max.v[j]){
+ max.v[j] = v[i].v[j];
+ }
+ }
+ mean->v[j] = (max.v[j] + min.v[j]) / 2.0; /*mean */
+ var->v[j] = max.v[j] - min.v[j]; /*var */
+ }
+}
+
+/*
+ * Get4points
+ */
+static void Get4points(
+ const AKFVEC v[], /*!< (i) : input vectors */
+ const int16 n, /*!< (i) : number of vectors */
+ AKFVEC out[] /*!< (o) : */
+){
+ int16 i, j;
+ AKFLOAT temp;
+ AKFLOAT d;
+
+ AKFVEC dv[AKFS_HBUF_SIZE];
+ AKFVEC cross;
+ AKFVEC tempv;
+
+ /* out 0 */
+ out[0] = v[0];
+
+ /* out 1 */
+ d = 0.0;
+ for(i = 1; i < n; i++){
+ temp = CalcR(&v[i], &out[0]);
+ if(d < temp){
+ d = temp;
+ out[1] = v[i];
+ }
+ }
+
+ /* out 2 */
+ d = 0.0;
+ for(j = 0; j < 3; j++){
+ dv[0].v[j] = out[1].v[j] - out[0].v[j];
+ }
+ for(i = 1; i < n; i++){
+ for(j = 0; j < 3; j++){
+ dv[i].v[j] = v[i].v[j] - out[0].v[j];
+ }
+ tempv.v[0] = dv[0].v[1]*dv[i].v[2] - dv[0].v[2]*dv[i].v[1];
+ tempv.v[1] = dv[0].v[2]*dv[i].v[0] - dv[0].v[0]*dv[i].v[2];
+ tempv.v[2] = dv[0].v[0]*dv[i].v[1] - dv[0].v[1]*dv[i].v[0];
+ temp = tempv.u.x * tempv.u.x
+ + tempv.u.y * tempv.u.y
+ + tempv.u.z * tempv.u.z;
+ if(d < temp){
+ d = temp;
+ out[2] = v[i];
+ cross = tempv;
+ }
+ }
+
+ /* out 3 */
+ d = 0.0;
+ for(i = 1; i < n; i++){
+ temp = dv[i].u.x * cross.u.x
+ + dv[i].u.y * cross.u.y
+ + dv[i].u.z * cross.u.z;
+ temp = fabs(temp);
+ if(d < temp){
+ d = temp;
+ out[3] = v[i];
+ }
+ }
+}
+
+/*
+ * CheckInitFvec
+ */
+static int16 CheckInitFvec(
+ const AKFVEC *v /*!< [in] vector */
+){
+ int16 i;
+
+ for(i = 0; i < 3; i++){
+ if(AKFS_FMAX <= v->v[i]){
+ return 1; /* initvalue */
+ }
+ }
+
+ return 0; /* not initvalue */
+}
+
+/*
+ * AKFS_AOC
+ */
+int16 AKFS_AOC( /*!< (o) : calibration success(1), failure(0) */
+ AKFS_AOC_VAR* haocv, /*!< (i/o) : a set of variables */
+ const AKFVEC* hdata, /*!< (i) : vectors of data */
+ AKFVEC* ho /*!< (i/o) : offset */
+){
+ int16 i, j;
+ int16 num;
+ AKFLOAT tempf;
+ AKFVEC tempho;
+
+ AKFVEC fourpoints[4];
+
+ AKFVEC var;
+ AKFVEC mean;
+
+ /* buffer new data */
+ for(i = 1; i < AKFS_HBUF_SIZE; i++){
+ haocv->hbuf[AKFS_HBUF_SIZE-i] = haocv->hbuf[AKFS_HBUF_SIZE-i-1];
+ }
+ haocv->hbuf[0] = *hdata;
+
+ /* Check Init */
+ num = 0;
+ for(i = AKFS_HBUF_SIZE; 3 < i; i--){
+ if(CheckInitFvec(&haocv->hbuf[i-1]) == 0){
+ num = i;
+ break;
+ }
+ }
+ if(num < 4){
+ return AKFS_ERROR;
+ }
+
+ /* get 4 points */
+ Get4points(haocv->hbuf, num, fourpoints);
+
+ /* estimate offset */
+ if(0 != From4Points2Sphere(fourpoints, &tempho, &haocv->hraoc)){
+ return AKFS_ERROR;
+ }
+
+ /* check distance */
+ for(i = 0; i < 4; i++){
+ for(j = (i+1); j < 4; j++){
+ tempf = CalcR(&fourpoints[i], &fourpoints[j]);
+ if((tempf < haocv->hraoc)||(tempf < AKFS_HR_TH)){
+ return AKFS_ERROR;
+ }
+ }
+ }
+
+ /* update offset buffer */
+ for(i = 1; i < AKFS_HOBUF_SIZE; i++){
+ haocv->hobuf[AKFS_HOBUF_SIZE-i] = haocv->hobuf[AKFS_HOBUF_SIZE-i-1];
+ }
+ haocv->hobuf[0] = tempho;
+
+ /* clear hbuf */
+ for(i = (AKFS_HBUF_SIZE>>1); i < AKFS_HBUF_SIZE; i++) {
+ for(j = 0; j < 3; j++) {
+ haocv->hbuf[i].v[j]= AKFS_FMAX;
+ }
+ }
+
+ /* Check Init */
+ if(CheckInitFvec(&haocv->hobuf[AKFS_HOBUF_SIZE-1]) == 1){
+ return AKFS_ERROR;
+ }
+
+ /* Check ovar */
+ tempf = haocv->hraoc * AKFS_HO_TH;
+ MeanVar(haocv->hobuf, AKFS_HOBUF_SIZE, &mean, &var);
+ if ((var.u.x >= tempf) || (var.u.y >= tempf) || (var.u.z >= tempf)){
+ return AKFS_ERROR;
+ }
+
+ *ho = mean;
+
+ return AKFS_SUCCESS;
+}
+
+/*
+ * AKFS_InitAOC
+ */
+void AKFS_InitAOC(
+ AKFS_AOC_VAR* haocv
+){
+ int16 i, j;
+
+ /* Initialize buffer */
+ for(i = 0; i < AKFS_HBUF_SIZE; i++) {
+ for(j = 0; j < 3; j++) {
+ haocv->hbuf[i].v[j]= AKFS_FMAX;
+ }
+ }
+ for(i = 0; i < AKFS_HOBUF_SIZE; i++) {
+ for(j = 0; j < 3; j++) {
+ haocv->hobuf[i].v[j]= AKFS_FMAX;
+ }
+ }
+
+ haocv->hraoc = 0.0;
+}
+
diff --git a/libsensors/akmdfs/AKFS_APIs_8975/AKFS_AOC.h b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_AOC.h
new file mode 100644
index 0000000..ffaaa88
--- /dev/null
+++ b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_AOC.h
@@ -0,0 +1,53 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#ifndef AKFS_INC_AOC_H
+#define AKFS_INC_AOC_H
+
+#include "AKFS_Device.h"
+
+/***** Constant definition ****************************************************/
+#define AKFS_HBUF_SIZE 20
+#define AKFS_HOBUF_SIZE 4
+#define AKFS_HR_TH 10
+#define AKFS_HO_TH 0.15
+
+/***** Macro definition *******************************************************/
+
+/***** Type declaration *******************************************************/
+typedef struct _AKFS_AOC_VAR{
+ AKFVEC hbuf[AKFS_HBUF_SIZE];
+ AKFVEC hobuf[AKFS_HOBUF_SIZE];
+ AKFLOAT hraoc;
+} AKFS_AOC_VAR;
+
+/***** Prototype of function **************************************************/
+AKLIB_C_API_START
+int16 AKFS_AOC(
+ AKFS_AOC_VAR* haocv,
+ const AKFVEC* hdata,
+ AKFVEC* ho
+);
+
+void AKFS_InitAOC(
+ AKFS_AOC_VAR* haocv
+);
+
+AKLIB_C_API_END
+
+#endif
+
diff --git a/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Configure.h b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Configure.h
new file mode 100644
index 0000000..1f80f48
--- /dev/null
+++ b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Configure.h
@@ -0,0 +1,37 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#ifndef AKFS_INC_CONFIG_H
+#define AKFS_INC_CONFIG_H
+
+/***** Language configuration *************************************************/
+#if defined(__cplusplus)
+#define AKLIB_C_API_START extern "C" {
+#define AKLIB_C_API_END }
+#else
+#define AKLIB_C_API_START
+#define AKLIB_C_API_END
+#endif
+
+/*! If following line is commented in, double type is used for floating point
+ calculation */
+/*
+#define AKFS_PRECISION_DOUBLE
+*/
+
+#endif
+
diff --git a/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Device.c b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Device.c
new file mode 100644
index 0000000..3d99ab1
--- /dev/null
+++ b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Device.c
@@ -0,0 +1,110 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#include "AKFS_Device.h"
+
+int16 AKFS_InitBuffer(
+ const int16 ndata, /*!< Size of vector buffer */
+ AKFVEC vdata[] /*!< Vector buffer */
+)
+{
+ int i;
+
+ /* size check */
+ if (ndata <= 0) {
+ return AKFS_ERROR;
+ }
+
+ for (i=0; i<ndata; i++) {
+ vdata[i].u.x = AKFS_INIT_VALUE_F;
+ vdata[i].u.y = AKFS_INIT_VALUE_F;
+ vdata[i].u.z = AKFS_INIT_VALUE_F;
+ }
+
+ return AKFS_SUCCESS;
+}
+
+int16 AKFS_BufShift(
+ const int16 len, /*!< size of buffer */
+ const int16 shift, /*!< shift size */
+ AKFVEC v[] /*!< buffer */
+)
+{
+ int16 i;
+
+ if((shift < 1) || (len < shift)) {
+ return AKFS_ERROR;
+ }
+ for (i = len-1; i >= shift; i--) {
+ v[i] = v[i-shift];
+ }
+ return AKFS_SUCCESS;
+}
+
+int16 AKFS_Rotate(
+ const AKFS_PATNO pat,
+ AKFVEC* vec
+)
+{
+ AKFLOAT tmp;
+ switch(pat){
+ /* Obverse */
+ case PAT1:
+ /* This is Android default */
+ break;
+ case PAT2:
+ tmp = vec->u.x;
+ vec->u.x = vec->u.y;
+ vec->u.y = -tmp;
+ break;
+ case PAT3:
+ vec->u.x = -(vec->u.x);
+ vec->u.y = -(vec->u.y);
+ break;
+ case PAT4:
+ tmp = vec->u.x;
+ vec->u.x = -(vec->u.y);
+ vec->u.y = tmp;
+ break;
+ /* Reverse */
+ case PAT5:
+ vec->u.x = -(vec->u.x);
+ vec->u.z = -(vec->u.z);
+ break;
+ case PAT6:
+ tmp = vec->u.x;
+ vec->u.x = vec->u.y;
+ vec->u.y = tmp;
+ vec->u.z = -(vec->u.z);
+ break;
+ case PAT7:
+ vec->u.y = -(vec->u.y);
+ vec->u.z = -(vec->u.z);
+ break;
+ case PAT8:
+ tmp = vec->u.x;
+ vec->u.x = -(vec->u.y);
+ vec->u.y = -tmp;
+ vec->u.z = -(vec->u.z);
+ break;
+ default:
+ return AKFS_ERROR;
+ }
+
+ return AKFS_SUCCESS;
+}
+
diff --git a/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Device.h b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Device.h
new file mode 100644
index 0000000..0292d54
--- /dev/null
+++ b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Device.h
@@ -0,0 +1,107 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#ifndef AKFS_INC_DEVICE_H
+#define AKFS_INC_DEVICE_H
+
+#include <float.h>
+#include "AKFS_Configure.h"
+
+/***** Constant definition ****************************************************/
+#define AKFS_ERROR 0
+#define AKFS_SUCCESS 1
+
+#define AKFS_HDATA_SIZE 32
+#define AKFS_ADATA_SIZE 32
+
+/***** Type declaration *******************************************************/
+typedef signed char int8;
+typedef signed short int16;
+typedef unsigned char uint8;
+typedef unsigned short uint16;
+
+
+#ifdef AKFS_PRECISION_DOUBLE
+typedef double AKFLOAT;
+#define AKFS_EPSILON DBL_EPSILON
+#define AKFS_FMAX DBL_MAX
+#define AKFS_FMIN DBL_MIN
+
+#else
+typedef float AKFLOAT;
+#define AKFS_EPSILON FLT_EPSILON
+#define AKFS_FMAX FLT_MAX
+#define AKFS_FMIN FLT_MIN
+
+#endif
+
+/* Treat maximum value as initial value */
+#define AKFS_INIT_VALUE_F AKFS_FMAX
+
+/***** Vector *****/
+typedef union _uint8vec{
+ struct {
+ uint8 x;
+ uint8 y;
+ uint8 z;
+ }u;
+ uint8 v[3];
+} uint8vec;
+
+typedef union _AKFVEC{
+ struct {
+ AKFLOAT x;
+ AKFLOAT y;
+ AKFLOAT z;
+ }u;
+ AKFLOAT v[3];
+} AKFVEC;
+
+/***** Layout pattern *****/
+typedef enum _AKFS_PATNO {
+ PAT_INVALID = 0,
+ PAT1, /* obverse: 1st pin is right down */
+ PAT2, /* obverse: 1st pin is left down */
+ PAT3, /* obverse: 1st pin is left top */
+ PAT4, /* obverse: 1st pin is right top */
+ PAT5, /* reverse: 1st pin is left down (from top view) */
+ PAT6, /* reverse: 1st pin is left top (from top view) */
+ PAT7, /* reverse: 1st pin is right top (from top view) */
+ PAT8 /* reverse: 1st pin is right down (from top view) */
+} AKFS_PATNO;
+
+/***** Prototype of function **************************************************/
+AKLIB_C_API_START
+int16 AKFS_InitBuffer(
+ const int16 ndata, /*!< Size of raw vector buffer */
+ AKFVEC vdata[] /*!< Raw vector buffer */
+);
+
+int16 AKFS_BufShift(
+ const int16 len,
+ const int16 shift,
+ AKFVEC v[]
+);
+
+int16 AKFS_Rotate(
+ const AKFS_PATNO pat,
+ AKFVEC* vec
+);
+AKLIB_C_API_END
+
+#endif
+
diff --git a/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Direction.c b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Direction.c
new file mode 100644
index 0000000..f47e930
--- /dev/null
+++ b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Direction.c
@@ -0,0 +1,133 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#include "AKFS_Direction.h"
+#include "AKFS_VNorm.h"
+#include "AKFS_Math.h"
+
+/*
+ Coordinate system is right-handed.
+ X-Axis: from left to right.
+ Y-Axis: from bottom to top.
+ Z-Axis: from reverse to obverse.
+
+ azimuth: Rotaion around Z axis, with positive values
+ when y-axis moves toward the x-axis.
+ pitch: Rotation around X axis, with positive values
+ when z-axis moves toward the y-axis.
+ roll: Rotation around Y axis, with positive values
+ when x-axis moves toward the z-axis.
+*/
+
+/*
+ This function is used internaly, so output is RADIAN!
+ */
+static void AKFS_Angle(
+ const AKFVEC* avec,
+ AKFLOAT* pitch, /* radian */
+ AKFLOAT* roll /* radian */
+)
+{
+ AKFLOAT av; /* Size of vector */
+
+ av = AKFS_SQRT((avec->u.x)*(avec->u.x) + (avec->u.y)*(avec->u.y) + (avec->u.z)*(avec->u.z));
+
+ *pitch = AKFS_ASIN(-(avec->u.y) / av);
+ *roll = AKFS_ASIN((avec->u.x) / av);
+}
+
+/*
+ This function is used internaly, so output is RADIAN!
+ */
+static void AKFS_Azimuth(
+ const AKFVEC* hvec,
+ const AKFLOAT pitch, /* radian */
+ const AKFLOAT roll, /* radian */
+ AKFLOAT* azimuth /* radian */
+)
+{
+ AKFLOAT sinP; /* sin value of pitch angle */
+ AKFLOAT cosP; /* cos value of pitch angle */
+ AKFLOAT sinR; /* sin value of roll angle */
+ AKFLOAT cosR; /* cos value of roll angle */
+ AKFLOAT Xh; /* X axis element of vector which is projected to horizontal plane */
+ AKFLOAT Yh; /* Y axis element of vector which is projected to horizontal plane */
+
+ sinP = AKFS_SIN(pitch);
+ cosP = AKFS_COS(pitch);
+ sinR = AKFS_SIN(roll);
+ cosR = AKFS_COS(roll);
+
+ Yh = -(hvec->u.x)*cosR + (hvec->u.z)*sinR;
+ Xh = (hvec->u.x)*sinP*sinR + (hvec->u.y)*cosP + (hvec->u.z)*sinP*cosR;
+
+ /* atan2(y, x) -> divisor and dividend is opposite from mathematical equation. */
+ *azimuth = AKFS_ATAN2(Yh, Xh);
+}
+
+int16 AKFS_Direction(
+ const int16 nhvec,
+ const AKFVEC hvec[],
+ const int16 hnave,
+ const int16 navec,
+ const AKFVEC avec[],
+ const int16 anave,
+ AKFLOAT* azimuth,
+ AKFLOAT* pitch,
+ AKFLOAT* roll
+)
+{
+ AKFVEC have, aave;
+ AKFLOAT azimuthRad;
+ AKFLOAT pitchRad;
+ AKFLOAT rollRad;
+
+ /* arguments check */
+ if ((nhvec <= 0) || (navec <= 0) || (hnave <= 0) || (anave <= 0)) {
+ return AKFS_ERROR;
+ }
+ if ((nhvec < hnave) || (navec < anave)) {
+ return AKFS_ERROR;
+ }
+
+ /* average */
+ if (AKFS_VbAve(nhvec, hvec, hnave, &have) != AKFS_SUCCESS) {
+ return AKFS_ERROR;
+ }
+ if (AKFS_VbAve(navec, avec, anave, &aave) != AKFS_SUCCESS) {
+ return AKFS_ERROR;
+ }
+
+ /* calculate pitch and roll */
+ AKFS_Angle(&aave, &pitchRad, &rollRad);
+
+ /* calculate azimuth */
+ AKFS_Azimuth(&have, pitchRad, rollRad, &azimuthRad);
+
+ *azimuth = RAD2DEG(azimuthRad);
+ *pitch = RAD2DEG(pitchRad);
+ *roll = RAD2DEG(rollRad);
+
+ /* Adjust range of azimuth */
+ if (*azimuth < 0) {
+ *azimuth += 360.0f;
+ }
+
+ return AKFS_SUCCESS;
+}
+
+
diff --git a/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Direction.h b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Direction.h
new file mode 100644
index 0000000..c08338d
--- /dev/null
+++ b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Direction.h
@@ -0,0 +1,39 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#ifndef AKFS_INC_DIRECTION_H
+#define AKFS_INC_DIRECTION_H
+
+#include "AKFS_Device.h"
+
+/***** Prototype of function **************************************************/
+AKLIB_C_API_START
+int16 AKFS_Direction(
+ const int16 nhvec,
+ const AKFVEC hvec[],
+ const int16 hnave,
+ const int16 navec,
+ const AKFVEC avec[],
+ const int16 anave,
+ AKFLOAT* azimuth,
+ AKFLOAT* pitch,
+ AKFLOAT* roll
+);
+AKLIB_C_API_END
+
+#endif
+
diff --git a/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Math.h b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Math.h
new file mode 100644
index 0000000..dfe48b3
--- /dev/null
+++ b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Math.h
@@ -0,0 +1,47 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#ifndef AKFS_INC_MATH_H
+#define AKFS_INC_MATH_H
+
+#include <math.h>
+#include "AKFS_Configure.h"
+
+/***** Constant definition ****************************************************/
+#define AKFS_PI 3.141592654f
+#define RAD2DEG(rad) ((rad)*180.0f/AKFS_PI)
+
+/***** Macro definition *******************************************************/
+
+#ifdef AKFS_PRECISION_DOUBLE
+#define AKFS_SIN(x) sin(x)
+#define AKFS_COS(x) cos(x)
+#define AKFS_ASIN(x) asin(x)
+#define AKFS_ACOS(x) acos(x)
+#define AKFS_ATAN2(y, x) atan2((y), (x))
+#define AKFS_SQRT(x) sqrt(x)
+#else
+#define AKFS_SIN(x) sinf(x)
+#define AKFS_COS(x) cosf(x)
+#define AKFS_ASIN(x) asinf(x)
+#define AKFS_ACOS(x) acosf(x)
+#define AKFS_ATAN2(y, x) atan2f((y), (x))
+#define AKFS_SQRT(x) sqrtf(x)
+#endif
+
+#endif
+
diff --git a/libsensors/akmdfs/AKFS_APIs_8975/AKFS_VNorm.c b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_VNorm.c
new file mode 100644
index 0000000..ffa934a
--- /dev/null
+++ b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_VNorm.c
@@ -0,0 +1,107 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#include "AKFS_VNorm.h"
+#include "AKFS_Device.h"
+
+/*!
+ */
+int16 AKFS_VbNorm(
+ const int16 ndata, /*!< Size of raw vector buffer */
+ const AKFVEC vdata[], /*!< Raw vector buffer */
+ const int16 nbuf, /*!< Size of data to be buffered */
+ const AKFVEC* o, /*!< Offset */
+ const AKFVEC* s, /*!< Sensitivity */
+ const AKFLOAT tgt, /*!< Target sensitivity */
+ const int16 nvec, /*!< Size of normalized vector buffer */
+ AKFVEC vvec[] /*!< Normalized vector buffer */
+)
+{
+ int i;
+
+ /* size check */
+ if ((ndata <= 0) || (nvec <= 0) || (nbuf <= 0)) {
+ return AKFS_ERROR;
+ }
+ /* dependency check */
+ if ((nbuf < 1) || (ndata < nbuf) || (nvec < nbuf)) {
+ return AKFS_ERROR;
+ }
+ /* sensitivity check */
+ if ((s->u.x <= AKFS_EPSILON) ||
+ (s->u.y <= AKFS_EPSILON) ||
+ (s->u.z <= AKFS_EPSILON) ||
+ (tgt <= 0)) {
+ return AKFS_ERROR;
+ }
+
+ /* calculate and store data to buffer */
+ if (AKFS_BufShift(nvec, nbuf, vvec) != AKFS_SUCCESS) {
+ return AKFS_ERROR;
+ }
+ for (i=0; i<nbuf; i++) {
+ vvec[i].u.x = ((vdata[i].u.x - o->u.x) / (s->u.x) * (AKFLOAT)tgt);
+ vvec[i].u.y = ((vdata[i].u.y - o->u.y) / (s->u.y) * (AKFLOAT)tgt);
+ vvec[i].u.z = ((vdata[i].u.z - o->u.z) / (s->u.z) * (AKFLOAT)tgt);
+ }
+
+ return AKFS_SUCCESS;
+}
+
+/*!
+ */
+int16 AKFS_VbAve(
+ const int16 nvec, /*!< Size of normalized vector buffer */
+ const AKFVEC vvec[], /*!< Normalized vector buffer */
+ const int16 nave, /*!< Number of averaeg */
+ AKFVEC* vave /*!< Averaged vector */
+)
+{
+ int i;
+
+ /* arguments check */
+ if ((nave <= 0) || (nvec <= 0) || (nvec < nave)) {
+ return AKFS_ERROR;
+ }
+
+ /* calculate average */
+ vave->u.x = 0;
+ vave->u.y = 0;
+ vave->u.z = 0;
+ for (i=0; i<nave; i++) {
+ if ((vvec[i].u.x == AKFS_INIT_VALUE_F) ||
+ (vvec[i].u.y == AKFS_INIT_VALUE_F) ||
+ (vvec[i].u.z == AKFS_INIT_VALUE_F)) {
+ break;
+ }
+ vave->u.x += vvec[i].u.x;
+ vave->u.y += vvec[i].u.y;
+ vave->u.z += vvec[i].u.z;
+ }
+ if (i == 0) {
+ vave->u.x = 0;
+ vave->u.y = 0;
+ vave->u.z = 0;
+ } else {
+ vave->u.x /= i;
+ vave->u.y /= i;
+ vave->u.z /= i;
+ }
+ return AKFS_SUCCESS;
+}
+
+
diff --git a/libsensors/akmdfs/AKFS_APIs_8975/AKFS_VNorm.h b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_VNorm.h
new file mode 100644
index 0000000..c3c9bed
--- /dev/null
+++ b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_VNorm.h
@@ -0,0 +1,46 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#ifndef AKFS_INC_VNORM_H
+#define AKFS_INC_VNORM_H
+
+#include "AKFS_Device.h"
+
+/***** Prototype of function **************************************************/
+AKLIB_C_API_START
+int16 AKFS_VbNorm(
+ const int16 ndata, /*!< Size of raw vector buffer */
+ const AKFVEC vdata[], /*!< Raw vector buffer */
+ const int16 nbuf, /*!< Size of data to be buffered */
+ const AKFVEC* o, /*!< Offset */
+ const AKFVEC* s, /*!< Sensitivity */
+ const AKFLOAT tgt, /*!< Target sensitivity */
+ const int16 nvec, /*!< Size of normalized vector buffer */
+ AKFVEC vvec[] /*!< Normalized vector buffer */
+);
+
+int16 AKFS_VbAve(
+ const int16 nvec, /*!< Size of normalized vector buffer */
+ const AKFVEC vvec[], /*!< Normalized vector buffer */
+ const int16 nave, /*!< Number of averaeg */
+ AKFVEC* vave /*!< Averaged vector */
+);
+
+AKLIB_C_API_END
+
+#endif
+
diff --git a/libsensors/akmdfs/AKFS_CSpec.h b/libsensors/akmdfs/AKFS_CSpec.h
new file mode 100644
index 0000000..380f06f
--- /dev/null
+++ b/libsensors/akmdfs/AKFS_CSpec.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#ifndef AKFS_INC_CSPEC_H
+#define AKFS_INC_CSPEC_H
+
+/*******************************************************************************
+ User defines parameters.
+ ******************************************************************************/
+/* Parameters for Average */
+/* The number of magnetic/acceleration data to be averaged. */
+#define CSPEC_HNAVE_D 4
+#define CSPEC_ANAVE_D 4
+#define CSPEC_HNAVE_V 8
+#define CSPEC_ANAVE_V 8
+
+#ifdef WIN32
+#define CSPEC_SETTING_FILE "akmdfs.txt"
+#else
+#define CSPEC_SETTING_FILE "/data/misc/akmdfs.txt"
+#endif
+
+#endif
+
diff --git a/libsensors/akmdfs/AKFS_Common.h b/libsensors/akmdfs/AKFS_Common.h
new file mode 100644
index 0000000..7780801
--- /dev/null
+++ b/libsensors/akmdfs/AKFS_Common.h
@@ -0,0 +1,141 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#ifndef AKFS_INC_COMMON_H
+#define AKFS_INC_COMMON_H
+
+#ifdef WIN32
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0501
+#endif
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <conio.h>
+#include <stdarg.h>
+#include <crtdbg.h>
+#include "Android.h"
+
+#define DBG_LEVEL DBG_LEVEL4
+#define ENABLE_AKMDEBUG 1
+
+#else
+#include <stdio.h> /* frpintf */
+#include <stdlib.h> /* atoi */
+#include <string.h> /* memset */
+#include <unistd.h>
+#include <stdarg.h> /* va_list */
+#include <utils/Log.h> /* ALOGV */
+#include <errno.h> /* errno */
+
+#endif
+
+/*** Constant definition ******************************************************/
+#define AKM_TRUE 1 /*!< Represents true */
+#define AKM_FALSE 0 /*!< Represents false */
+#define AKM_SUCCESS 1 /*!< Represents success */
+#define AKM_FAIL 0 /*!< Represents fail */
+
+#define DBG_LEVEL0 0 /* Critical */
+#define DBG_LEVEL1 1 /* Notice */
+#define DBG_LEVEL2 2 /* Information */
+#define DBG_LEVEL3 3 /* Debug */
+#define DBG_LEVEL4 4 /* Verbose */
+
+#ifndef DBG_LEVEL
+#define DBG_LEVEL DBG_LEVEL0
+#endif
+
+#define DATA_AREA01 0x0001
+#define DATA_AREA02 0x0002
+#define DATA_AREA03 0x0004
+#define DATA_AREA04 0x0008
+#define DATA_AREA05 0x0010
+#define DATA_AREA06 0x0020
+#define DATA_AREA07 0x0040
+#define DATA_AREA08 0x0080
+#define DATA_AREA09 0x0100
+#define DATA_AREA10 0x0200
+#define DATA_AREA11 0x0400
+#define DATA_AREA12 0x0800
+#define DATA_AREA13 0x1000
+#define DATA_AREA14 0x2000
+#define DATA_AREA15 0x4000
+#define DATA_AREA16 0x8000
+
+
+/* Debug area definition */
+#define AKMDATA_DUMP DATA_AREA01 /*<! Dump data */
+#define AKMDATA_BDATA DATA_AREA02 /*<! BDATA */
+#define AKMDATA_MAG DATA_AREA03 /*<! Magnetic Field */
+#define AKMDATA_ACC DATA_AREA04 /*<! Accelerometer */
+#define AKMDATA_ORI DATA_AREA05 /*<! Orientation */
+#define AKMDATA_GETINTERVAL DATA_AREA06
+#define AKMDATA_LOOP DATA_AREA07
+#define AKMDATA_DRV DATA_AREA08
+
+#ifndef ENABLE_AKMDEBUG
+#define ENABLE_AKMDEBUG 0 /* Eanble debug output when it is 1. */
+#endif
+
+#define OPMODE_CONSOLE 0x01
+#define OPMODE_FST 0x02
+
+/***** Debug Level Output *************************************/
+#if ENABLE_AKMDEBUG
+#define AKMDEBUG(level, format, ...) \
+ (((level) <= DBG_LEVEL) \
+ ? (fprintf(stdout, (format), ##__VA_ARGS__)) \
+ : ((void)0))
+#else
+#define AKMDEBUG(level, format, ...)
+#endif
+
+/***** Dbg Zone Output ***************************************/
+#if ENABLE_AKMDEBUG
+#define AKMDATA(flag, format, ...) \
+ ((((int)flag) & g_dbgzone) \
+ ? (fprintf(stdout, (format), ##__VA_ARGS__)) \
+ : ((void)0))
+#else
+#define AKMDATA(flag, format, ...)
+#endif
+
+/***** Log output ********************************************/
+#ifdef AKM_LOG_ENABLE
+#define AKM_LOG(format, ...) ALOGD((format), ##__VA_ARGS__)
+#else
+#define AKM_LOG(format, ...)
+#endif
+
+/***** Error output *******************************************/
+#define AKMERROR \
+ ALOGE("%s:%d Error.", __FUNCTION__, __LINE__)
+
+#define AKMERROR_STR(api) \
+ ALOGE("%s:%d %s Error (%s).", \
+ __FUNCTION__, __LINE__, (api), strerror(errno))
+
+/*** Type declaration *********************************************************/
+
+/*** Global variables *********************************************************/
+
+/*** Prototype of function ****************************************************/
+
+#endif /* AKMD_INC_AKCOMMON_H */
+
diff --git a/libsensors/akmdfs/AKFS_Compass.h b/libsensors/akmdfs/AKFS_Compass.h
new file mode 100644
index 0000000..aa59285
--- /dev/null
+++ b/libsensors/akmdfs/AKFS_Compass.h
@@ -0,0 +1,84 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#ifndef AKFS_INC_COMPASS_H
+#define AKFS_INC_COMPASS_H
+
+#include "AKFS_Common.h"
+#include "AKFS_CSpec.h"
+
+/****************************************/
+/* Include files for AK8975 library. */
+/****************************************/
+#include "AKFS_AK8975.h"
+#include "AKFS_Configure.h"
+#include "AKFS_AOC.h"
+#include "AKFS_Device.h"
+#include "AKFS_Direction.h"
+#include "AKFS_Math.h"
+#include "AKFS_VNorm.h"
+
+/*** Constant definition ******************************************************/
+
+/*** Type declaration *********************************************************/
+typedef struct _AKSENSOR_DATA{
+ AKFLOAT x;
+ AKFLOAT y;
+ AKFLOAT z;
+ int8 status;
+} AKSENSOR_DATA;
+
+/*! A parameter structure. */
+typedef struct _AK8975PRMS{
+ /* Variables for Decomp8975. */
+ AKFVEC mfv_hdata[AKFS_HDATA_SIZE];
+ uint8vec mi_asa;
+ uint8 mi_st;
+
+ /* Variables forAOC. */
+ AKFS_AOC_VAR m_aocv;
+
+ /* Variables for Magnetometer buffer. */
+ AKFVEC mfv_hvbuf[AKFS_HDATA_SIZE];
+ AKFVEC mfv_ho;
+ AKFVEC mfv_hs;
+ AKFS_PATNO m_hpat;
+
+ /* Variables for Accelerometer buffer. */
+ AKFVEC mfv_adata[AKFS_ADATA_SIZE];
+ AKFVEC mfv_avbuf[AKFS_ADATA_SIZE];
+ AKFVEC mfv_ao;
+ AKFVEC mfv_as;
+
+ /* Variables for Direction. */
+ int16 mi_hnaveD;
+ int16 mi_anaveD;
+ AKFLOAT mf_azimuth;
+ AKFLOAT mf_pitch;
+ AKFLOAT mf_roll;
+
+ /* Variables for vector output */
+ int16 mi_hnaveV;
+ int16 mi_anaveV;
+ AKFVEC mfv_hvec;
+ AKFVEC mfv_avec;
+ int16 mi_hstatus;
+
+} AK8975PRMS;
+
+#endif
+
diff --git a/libsensors/akmdfs/AKFS_Disp.c b/libsensors/akmdfs/AKFS_Disp.c
new file mode 100644
index 0000000..4e7c501
--- /dev/null
+++ b/libsensors/akmdfs/AKFS_Disp.c
@@ -0,0 +1,89 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#include "AKFS_Disp.h"
+#include "AKFS_Common.h"
+
+/*!
+ Print startup message to Android Log daemon.
+ */
+void Disp_StartMessage(void)
+{
+ ALOGI("AK8975 Daemon for Open Source v20120329.");
+ ALOGI("Debug: %s", ((ENABLE_AKMDEBUG)?("ON"):("OFF")));
+ ALOGI("Debug level: %d", DBG_LEVEL);
+}
+
+/*!
+ Print ending message to Android Log daemon.
+ */
+void Disp_EndMessage(int ret)
+{
+ ALOGI("AK8975 for Android end (%d).", ret);
+}
+
+/*!
+ Print result
+ */
+void Disp_Result(int buf[YPR_DATA_SIZE])
+{
+ AKMDEBUG(DBG_LEVEL1,
+ "Flag=%d\n", buf[0]);
+ AKMDEBUG(DBG_LEVEL1,
+ "Acc(%d):%8.2f, %8.2f, %8.2f\n",
+ buf[4], REVERT_ACC(buf[1]), REVERT_ACC(buf[2]), REVERT_ACC(buf[3]));
+ AKMDEBUG(DBG_LEVEL1,
+ "Mag(%d):%8.2f, %8.2f, %8.2f\n",
+ buf[8], REVERT_MAG(buf[5]), REVERT_MAG(buf[6]), REVERT_MAG(buf[7]));
+ AKMDEBUG(DBG_LEVEL1,
+ "Ori(%d)=%8.2f, %8.2f, %8.2f\n",
+ buf[8], REVERT_ORI(buf[9]), REVERT_ORI(buf[10]), REVERT_ORI(buf[11]));
+}
+
+/*!
+ Output main menu to stdout and wait for user input from stdin.
+ @return Selected mode.
+ */
+MODE Menu_Main(void)
+{
+ char msg[20];
+ memset(msg, 0, sizeof(msg));
+
+ AKMDEBUG(DBG_LEVEL1,
+ " -------------------- AK8975 Console Application -------------------- \n"
+ " 1. Start measurement. \n"
+ " 2. Self-test. \n"
+ " Q. Quit application. \n"
+ " --------------------------------------------------------------------- \n"
+ " Please select a number.\n"
+ " ---> ");
+ fgets(msg, 10, stdin);
+ AKMDEBUG(DBG_LEVEL1, "\n");
+
+ /* BUG : If 2-digits number is input, */
+ /* only the first character is compared. */
+ if (!strncmp(msg, "1", 1)) {
+ return MODE_Measure;
+ } else if (!strncmp(msg, "2", 1)) {
+ return MODE_SelfTest;
+ } else if (strncmp(msg, "Q", 1) == 0 || strncmp(msg, "q", 1) == 0) {
+ return MODE_Quit;
+ } else {
+ return MODE_ERROR;
+ }
+}
+
diff --git a/libsensors/akmdfs/AKFS_Disp.h b/libsensors/akmdfs/AKFS_Disp.h
new file mode 100644
index 0000000..4769e3c
--- /dev/null
+++ b/libsensors/akmdfs/AKFS_Disp.h
@@ -0,0 +1,52 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#ifndef AKFS_INC_DISP_H
+#define AKFS_INC_DISP_H
+
+/* Include file for AK8975 library. */
+#include "AKFS_Compass.h"
+
+/*** Constant definition ******************************************************/
+#define REVERT_ACC(a) ((float)((a) * 9.8f / 720.0f))
+#define REVERT_MAG(m) ((float)((m) * 0.06f))
+#define REVERT_ORI(o) ((float)((o) / 64.0f))
+
+/*** Type declaration *********************************************************/
+
+/*! These defined types represents the current mode. */
+typedef enum _MODE {
+ MODE_ERROR, /*!< Error */
+ MODE_Measure, /*!< Measurement */
+ MODE_SelfTest, /*!< Self-test */
+ MODE_Quit /*!< Quit */
+} MODE;
+
+/*** Prototype of function ****************************************************/
+/*
+ Disp_ : Display messages.
+ Menu_ : Display menu (two or more selection) and wait for user input.
+ */
+
+void Disp_StartMessage(void);
+void Disp_EndMessage(int ret);
+void Disp_Result(int buf[YPR_DATA_SIZE]);
+
+MODE Menu_Main(void);
+
+#endif
+
diff --git a/libsensors/akmdfs/AKFS_FileIO.c b/libsensors/akmdfs/AKFS_FileIO.c
new file mode 100644
index 0000000..92c2ce9
--- /dev/null
+++ b/libsensors/akmdfs/AKFS_FileIO.c
@@ -0,0 +1,130 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#include "AKFS_FileIO.h"
+
+/*** Constant definition ******************************************************/
+#ifdef AKFS_PRECISION_DOUBLE
+#define AKFS_SCANF_FORMAT "%63s = %lf"
+#else
+#define AKFS_SCANF_FORMAT "%63s = %f"
+#endif
+#define AKFS_PRINTF_FORMAT "%s = %f\n"
+#define LOAD_BUF_SIZE 64
+
+/*!
+ Load parameters from file which is specified with #path. This function reads
+ data from a beginning of the file line by line, and check parameter name
+ sequentially. In otherword, this function depends on the order of eache
+ parameter described in the file.
+ @return If function fails, the return value is #AKM_FAIL. When function fails,
+ the output is undefined. Therefore, parameters which are possibly overwritten
+ by this function should be initialized again. If function succeeds, the
+ return value is #AKM_SUCCESS.
+ @param[out] prms A pointer to #AK8975PRMS structure. Loaded parameter is
+ stored to the member of this structure.
+ @param[in] path A path to the setting file.
+ */
+int16 AKFS_LoadParameters(AK8975PRMS * prms, const char* path)
+{
+ int16 ret;
+ char buf[LOAD_BUF_SIZE];
+ FILE *fp = NULL;
+
+ /* Open setting file for read. */
+ if ((fp = fopen(path, "r")) == NULL) {
+ AKMERROR_STR("fopen");
+ return AKM_FAIL;
+ }
+
+ ret = 1;
+
+ /* Load data to HO */
+ if (fscanf(fp, AKFS_SCANF_FORMAT, buf, &prms->mfv_ho.u.x) != 2) {
+ ret = 0;
+ } else {
+ if (strncmp(buf, "HO.x", sizeof(buf)) != 0) {
+ ret = 0;
+ }
+ }
+ if (fscanf(fp, AKFS_SCANF_FORMAT, buf, &prms->mfv_ho.u.y) != 2) {
+ ret = 0;
+ } else {
+ if (strncmp(buf, "HO.y", sizeof(buf)) != 0) {
+ ret = 0;
+ }
+ }
+ if (fscanf(fp, AKFS_SCANF_FORMAT, buf, &prms->mfv_ho.u.z) != 2) {
+ ret = 0;
+ } else {
+ if (strncmp(buf, "HO.z", sizeof(buf)) != 0) {
+ ret = 0;
+ }
+ }
+
+ if (fclose(fp) != 0) {
+ AKMERROR_STR("fclose");
+ ret = 0;
+ }
+
+ if (ret == 0) {
+ AKMERROR;
+ return AKM_FAIL;
+ }
+
+ return AKM_SUCCESS;
+}
+
+/*!
+ Save parameters to file which is specified with #path. This function saves
+ variables when the offsets of magnetic sensor estimated successfully.
+ @return If function fails, the return value is #AKM_FAIL. When function fails,
+ the parameter file may collapsed. Therefore, the parameters file should be
+ discarded. If function succeeds, the return value is #AKM_SUCCESS.
+ @param[out] prms A pointer to #AK8975PRMS structure. Member variables are
+ saved to the parameter file.
+ @param[in] path A path to the setting file.
+ */
+int16 AKFS_SaveParameters(AK8975PRMS *prms, const char* path)
+{
+ int16 ret = 1;
+ FILE *fp;
+
+ /*Open setting file for write. */
+ if ((fp = fopen(path, "w")) == NULL) {
+ AKMERROR_STR("fopen");
+ return AKM_FAIL;
+ }
+
+ /* Save data to HO */
+ if (fprintf(fp, AKFS_PRINTF_FORMAT, "HO.x", prms->mfv_ho.u.x) < 0) { ret = 0; }
+ if (fprintf(fp, AKFS_PRINTF_FORMAT, "HO.y", prms->mfv_ho.u.y) < 0) { ret = 0; }
+ if (fprintf(fp, AKFS_PRINTF_FORMAT, "HO.z", prms->mfv_ho.u.z) < 0) { ret = 0; }
+
+ if (fclose(fp) != 0) {
+ AKMERROR_STR("fclose");
+ ret = 0;
+ }
+
+ if (ret == 0) {
+ AKMERROR;
+ return AKM_FAIL;
+ }
+
+ return AKM_SUCCESS;
+}
+
diff --git a/libsensors/akmdfs/AKFS_FileIO.h b/libsensors/akmdfs/AKFS_FileIO.h
new file mode 100644
index 0000000..62f6e77
--- /dev/null
+++ b/libsensors/akmdfs/AKFS_FileIO.h
@@ -0,0 +1,39 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#ifndef AKFS_INC_FILEIO_H
+#define AKFS_INC_FILEIO_H
+
+/* Common include files. */
+#include "AKFS_Common.h"
+
+/* Include file for AK8975 library. */
+#include "AKFS_Compass.h"
+
+/*** Constant definition ******************************************************/
+
+/*** Type declaration *********************************************************/
+
+/*** Global variables *********************************************************/
+
+/*** Prototype of function ****************************************************/
+int16 AKFS_LoadParameters(AK8975PRMS *prms, const char* path);
+
+int16 AKFS_SaveParameters(AK8975PRMS* prms, const char* path);
+
+#endif
+
diff --git a/libsensors/akmdfs/AKFS_Measure.c b/libsensors/akmdfs/AKFS_Measure.c
new file mode 100644
index 0000000..84c0843
--- /dev/null
+++ b/libsensors/akmdfs/AKFS_Measure.c
@@ -0,0 +1,410 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#ifdef WIN32
+#include "AK8975_LinuxDriver.h"
+#else
+#include "AK8975Driver.h"
+#endif
+
+#include "AKFS_Measure.h"
+#include "AKFS_Disp.h"
+#include "AKFS_APIs.h"
+
+/*!
+ Read sensitivity adjustment data from fuse ROM.
+ @return If data are read successfully, the return value is #AKM_SUCCESS.
+ Otherwise the return value is #AKM_FAIL.
+ @param[out] regs The read ASA values. When this function succeeds, ASAX value
+ is saved in regs[0], ASAY is saved in regs[1], ASAZ is saved in regs[2].
+ */
+int16 AKFS_ReadAK8975FUSEROM(
+ uint8 regs[3]
+)
+{
+ /* Set to FUSE ROM access mode */
+ if (AKD_SetMode(AK8975_MODE_FUSE_ACCESS) != AKD_SUCCESS) {
+ AKMERROR;
+ return AKM_FAIL;
+ }
+
+ /* Read values. ASAX, ASAY, ASAZ */
+ if (AKD_RxData(AK8975_FUSE_ASAX, regs, 3) != AKD_SUCCESS) {
+ AKMERROR;
+ return AKM_FAIL;
+ }
+
+ /* Set to PowerDown mode */
+ if (AKD_SetMode(AK8975_MODE_POWERDOWN) != AKD_SUCCESS) {
+ AKMERROR;
+ return AKM_FAIL;
+ }
+
+ AKMDEBUG(DBG_LEVEL2, "%s: asa(dec)=%d,%d,%d\n",
+ __FUNCTION__, regs[0], regs[1], regs[2]);
+
+ return AKM_SUCCESS;
+}
+
+/*!
+ Carry out self-test.
+ @return If this function succeeds, the return value is #AKM_SUCCESS.
+ Otherwise the return value is #AKM_FAIL.
+ */
+int16 AKFS_SelfTest(void)
+{
+ BYTE i2cData[SENSOR_DATA_SIZE];
+ BYTE asa[3];
+ AKFLOAT hdata[3];
+ int16 ret;
+
+ /* Set to FUSE ROM access mode */
+ if (AKD_SetMode(AK8975_MODE_FUSE_ACCESS) != AKD_SUCCESS) {
+ AKMERROR;
+ return AKM_FAIL;
+ }
+
+ /* Read values from ASAX to ASAZ */
+ if (AKD_RxData(AK8975_FUSE_ASAX, asa, 3) != AKD_SUCCESS) {
+ AKMERROR;
+ return AKM_FAIL;
+ }
+
+ /* Set to PowerDown mode */
+ if (AKD_SetMode(AK8975_MODE_POWERDOWN) != AKD_SUCCESS) {
+ AKMERROR;
+ return AKM_FAIL;
+ }
+
+ /* Set to self-test mode */
+ i2cData[0] = 0x40;
+ if (AKD_TxData(AK8975_REG_ASTC, i2cData, 1) != AKD_SUCCESS) {
+ AKMERROR;
+ return AKM_FAIL;
+ }
+
+ /* Set to Self-test mode */
+ if (AKD_SetMode(AK8975_MODE_SELF_TEST) != AKD_SUCCESS) {
+ AKMERROR;
+ return AKM_FAIL;
+ }
+
+ /*
+ Wait for DRDY pin changes to HIGH.
+ Get measurement data from AK8975
+ */
+ if (AKD_GetMagneticData(i2cData) != AKD_SUCCESS) {
+ AKMERROR;
+ return AKM_FAIL;
+ }
+
+ hdata[0] = AK8975_HDATA_CONVERTER(i2cData[2], i2cData[1], asa[0]);
+ hdata[1] = AK8975_HDATA_CONVERTER(i2cData[4], i2cData[3], asa[1]);
+ hdata[2] = AK8975_HDATA_CONVERTER(i2cData[6], i2cData[5], asa[2]);
+
+ /* Test */
+ ret = 1;
+ if ((hdata[0] < AK8975_SELFTEST_MIN_X) ||
+ (AK8975_SELFTEST_MAX_X < hdata[0])) {
+ ret = 0;
+ }
+ if ((hdata[1] < AK8975_SELFTEST_MIN_Y) ||
+ (AK8975_SELFTEST_MAX_Y < hdata[1])) {
+ ret = 0;
+ }
+ if ((hdata[2] < AK8975_SELFTEST_MIN_Z) ||
+ (AK8975_SELFTEST_MAX_Z < hdata[2])) {
+ ret = 0;
+ }
+
+ AKMDEBUG(DBG_LEVEL2, "Test(%s):%8.2f, %8.2f, %8.2f\n",
+ (ret ? "Success" : "fail"), hdata[0], hdata[1], hdata[2]);
+
+ if (ret) {
+ return AKM_SUCCESS;
+ } else {
+ return AKM_FAIL;
+ }
+}
+
+/*!
+ This function calculate the duration of sleep for maintaining
+ the loop keep the period.
+ This function calculates "minimum - (end - start)".
+ @return The result of above equation in nanosecond.
+ @param end The time of after execution.
+ @param start The time of before execution.
+ @param minimum Loop period of each execution.
+ */
+struct timespec AKFS_CalcSleep(
+ const struct timespec* end,
+ const struct timespec* start,
+ const int64_t minimum
+)
+{
+ int64_t endL;
+ int64_t startL;
+ int64_t diff;
+
+ struct timespec ret;
+
+ endL = (end->tv_sec * 1000000000) + end->tv_nsec;
+ startL = (start->tv_sec * 1000000000) + start->tv_nsec;
+ diff = minimum;
+
+ diff -= (endL - startL);
+
+ /* Don't allow negative value */
+ if (diff < 0) {
+ diff = 0;
+ }
+
+ /* Convert to timespec */
+ if (diff > 1000000000) {
+ ret.tv_sec = diff / 1000000000;
+ ret.tv_nsec = diff % 1000000000;
+ } else {
+ ret.tv_sec = 0;
+ ret.tv_nsec = diff;
+ }
+ return ret;
+}
+
+/*!
+ Get interval of each sensors from device driver.
+ @return If this function succeeds, the return value is #AKM_SUCCESS.
+ Otherwise the return value is #AKM_FAIL.
+ @param flag This variable indicates what sensor frequency is updated.
+ @param minimum This value show the minimum loop period in all sensors.
+ */
+int16 AKFS_GetInterval(
+ uint16* flag,
+ int64_t* minimum
+)
+{
+ /* Accelerometer, Magnetometer, Orientation */
+ /* Delay is in nano second unit. */
+ /* Negative value means the sensor is disabled.*/
+ int64_t delay[AKM_NUM_SENSORS];
+ int i;
+
+ if (AKD_GetDelay(delay) < 0) {
+ AKMERROR;
+ return AKM_FAIL;
+ }
+ AKMDATA(AKMDATA_GETINTERVAL,"delay[A,M,O]=%lld,%lld,%lld\n",
+ delay[0], delay[1], delay[2]);
+
+ /* update */
+ *minimum = 1000000000;
+ *flag = 0;
+ for (i=0; i<AKM_NUM_SENSORS; i++) {
+ /* Set flag */
+ if (delay[i] >= 0) {
+ *flag |= 1 << i;
+ if (*minimum > delay[i]) {
+ *minimum = delay[i];
+ }
+ }
+ }
+ return AKM_SUCCESS;
+}
+
+/*!
+ If this program run as console mode, measurement result will be displayed
+ on console terminal.
+ @return If this function succeeds, the return value is #AKM_SUCCESS.
+ Otherwise the return value is #AKM_FAIL.
+ */
+void AKFS_OutputResult(
+ const uint16 flag,
+ const AKSENSOR_DATA* acc,
+ const AKSENSOR_DATA* mag,
+ const AKSENSOR_DATA* ori
+)
+{
+ int buf[YPR_DATA_SIZE];
+
+ /* Store to buffer */
+ buf[0] = flag; /* Data flag */
+ buf[1] = CONVERT_ACC(acc->x); /* Ax */
+ buf[2] = CONVERT_ACC(acc->y); /* Ay */
+ buf[3] = CONVERT_ACC(acc->z); /* Az */
+ buf[4] = acc->status; /* Acc status */
+ buf[5] = CONVERT_MAG(mag->x); /* Mx */
+ buf[6] = CONVERT_MAG(mag->y); /* My */
+ buf[7] = CONVERT_MAG(mag->z); /* Mz */
+ buf[8] = mag->status; /* Mag status */
+ buf[9] = CONVERT_ORI(ori->x); /* yaw */
+ buf[10] = CONVERT_ORI(ori->y); /* pitch */
+ buf[11] = CONVERT_ORI(ori->z); /* roll */
+
+ if (g_opmode & OPMODE_CONSOLE) {
+ /* Console mode */
+ Disp_Result(buf);
+ }
+
+ /* Set result to driver */
+ AKD_SetYPR(buf);
+}
+
+/*!
+ This is the main routine of measurement.
+ */
+void AKFS_MeasureLoop(void)
+{
+ BYTE i2cData[SENSOR_DATA_SIZE]; /* ST1 ~ ST2 */
+ int16 mag[3];
+ int16 mstat;
+ int16 acc[3];
+ struct timespec tsstart= {0, 0};
+ struct timespec tsend = {0, 0};
+ struct timespec doze;
+ int64_t minimum;
+ uint16 flag;
+ AKSENSOR_DATA sv_acc;
+ AKSENSOR_DATA sv_mag;
+ AKSENSOR_DATA sv_ori;
+ AKFLOAT tmpx, tmpy, tmpz;
+ int16 tmp_accuracy;
+
+ minimum = -1;
+
+#ifdef WIN32
+ clock_init_time();
+#endif
+
+ /* Initialize library functions and device */
+ if (AKFS_Start(CSPEC_SETTING_FILE) != AKM_SUCCESS) {
+ AKMERROR;
+ goto MEASURE_END;
+ }
+
+ while (g_stopRequest != AKM_TRUE) {
+ /* Beginning time */
+ if (clock_gettime(CLOCK_MONOTONIC, &tsstart) < 0) {
+ AKMERROR;
+ goto MEASURE_END;
+ }
+
+ /* Get interval */
+ if (AKFS_GetInterval(&flag, &minimum) != AKM_SUCCESS) {
+ AKMERROR;
+ goto MEASURE_END;
+ }
+
+ if ((flag & ACC_DATA_READY) || (flag & ORI_DATA_READY)) {
+ /* Get accelerometer */
+ if (AKD_GetAccelerationData(acc) != AKD_SUCCESS) {
+ AKMERROR;
+ goto MEASURE_END;
+ }
+
+ /* Calculate accelerometer vector */
+ if (AKFS_Get_ACCELEROMETER(acc, 0, &tmpx, &tmpy, &tmpz, &tmp_accuracy) == AKM_SUCCESS) {
+ sv_acc.x = tmpx;
+ sv_acc.y = tmpy;
+ sv_acc.z = tmpz;
+ sv_acc.status = tmp_accuracy;
+ } else {
+ flag &= ~ACC_DATA_READY;
+ flag &= ~ORI_DATA_READY;
+ }
+ }
+
+ if ((flag & MAG_DATA_READY) || (flag & ORI_DATA_READY)) {
+ /* Set to measurement mode */
+ if (AKD_SetMode(AK8975_MODE_SNG_MEASURE) != AKD_SUCCESS) {
+ AKMERROR;
+ goto MEASURE_END;
+ }
+
+ /* Wait for DRDY and get data from device */
+ if (AKD_GetMagneticData(i2cData) != AKD_SUCCESS) {
+ AKMERROR;
+ goto MEASURE_END;
+ }
+ /* raw data to x,y,z value */
+ mag[0] = (int)((int16_t)(i2cData[2]<<8)+((int16_t)i2cData[1]));
+ mag[1] = (int)((int16_t)(i2cData[4]<<8)+((int16_t)i2cData[3]));
+ mag[2] = (int)((int16_t)(i2cData[6]<<8)+((int16_t)i2cData[5]));
+ mstat = i2cData[0] | i2cData[7];
+
+ AKMDATA(AKMDATA_BDATA,
+ "bData=%02X,%02X,%02X,%02X,%02X,%02X,%02X,%02X\n",
+ i2cData[0], i2cData[1], i2cData[2], i2cData[3],
+ i2cData[4], i2cData[5], i2cData[6], i2cData[7]);
+
+ /* Calculate magnetic field vector */
+ if (AKFS_Get_MAGNETIC_FIELD(mag, mstat, &tmpx, &tmpy, &tmpz, &tmp_accuracy) == AKM_SUCCESS) {
+ sv_mag.x = tmpx;
+ sv_mag.y = tmpy;
+ sv_mag.z = tmpz;
+ sv_mag.status = tmp_accuracy;
+ } else {
+ flag &= ~MAG_DATA_READY;
+ flag &= ~ORI_DATA_READY;
+ }
+ }
+
+ if (flag & ORI_DATA_READY) {
+ if (AKFS_Get_ORIENTATION(&tmpx, &tmpy, &tmpz, &tmp_accuracy) == AKM_SUCCESS) {
+ sv_ori.x = tmpx;
+ sv_ori.y = tmpy;
+ sv_ori.z = tmpz;
+ sv_ori.status = tmp_accuracy;
+ } else {
+ flag &= ~ORI_DATA_READY;
+ }
+ }
+
+ /* Output result */
+ AKFS_OutputResult(flag, &sv_acc, &sv_mag, &sv_ori);
+
+ /* Ending time */
+ if (clock_gettime(CLOCK_MONOTONIC, &tsend) < 0) {
+ AKMERROR;
+ goto MEASURE_END;
+ }
+
+ /* Calculate duration */
+ doze = AKFS_CalcSleep(&tsend, &tsstart, minimum);
+ AKMDATA(AKMDATA_LOOP, "Sleep: %6.2f msec\n", (doze.tv_nsec/1000000.0f));
+ nanosleep(&doze, NULL);
+
+#ifdef WIN32
+ if (_kbhit()) {
+ _getch();
+ break;
+ }
+#endif
+ }
+
+MEASURE_END:
+ /* Set to PowerDown mode */
+ if (AKD_SetMode(AK8975_MODE_POWERDOWN) != AKD_SUCCESS) {
+ AKMERROR;
+ return;
+ }
+
+ /* Save parameters */
+ if (AKFS_Stop(CSPEC_SETTING_FILE) != AKM_SUCCESS) {
+ AKMERROR;
+ }
+}
+
+
diff --git a/libsensors/akmdfs/AKFS_Measure.h b/libsensors/akmdfs/AKFS_Measure.h
new file mode 100644
index 0000000..d156b95
--- /dev/null
+++ b/libsensors/akmdfs/AKFS_Measure.h
@@ -0,0 +1,70 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#ifndef AKFS_INC_MEASURE_H
+#define AKFS_INC_MEASURE_H
+
+/* Include files for AK8975 library. */
+#include "AKFS_Compass.h"
+
+/*** Constant definition ******************************************************/
+#define AK8975_SELFTEST_MIN_X -100
+#define AK8975_SELFTEST_MAX_X 100
+
+#define AK8975_SELFTEST_MIN_Y -100
+#define AK8975_SELFTEST_MAX_Y 100
+
+#define AK8975_SELFTEST_MIN_Z -1000
+#define AK8975_SELFTEST_MAX_Z -300
+
+#define CONVERT_ACC(a) ((int)((a) * 720 / 9.8f))
+#define CONVERT_MAG(m) ((int)((m) / 0.06f))
+#define CONVERT_ORI(o) ((int)((o) * 64))
+
+/*** Type declaration *********************************************************/
+
+/*** Global variables *********************************************************/
+
+/*** Prototype of function ****************************************************/
+int16 AKFS_ReadAK8975FUSEROM(
+ uint8 regs[3]
+);
+
+int16 AKFS_SelfTest(void);
+
+struct timespec AKFS_CalcSleep(
+ const struct timespec* end,
+ const struct timespec* start,
+ const int64_t minimum
+);
+
+int16 AKFS_GetInterval(
+ uint16* flag,
+ int64_t* minimum
+);
+
+void AKFS_OutputResult(
+ const uint16 flag,
+ const AKSENSOR_DATA* acc,
+ const AKSENSOR_DATA* mag,
+ const AKSENSOR_DATA* ori
+);
+
+void AKFS_MeasureLoop(void);
+
+#endif
+
diff --git a/libsensors/akmdfs/NOTICE b/libsensors/akmdfs/NOTICE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/libsensors/akmdfs/NOTICE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/libsensors/akmdfs/Version.txt b/libsensors/akmdfs/Version.txt
new file mode 100644
index 0000000..3d56b30
--- /dev/null
+++ b/libsensors/akmdfs/Version.txt
@@ -0,0 +1,31 @@
+Version
+ * Console Version 20120329
+ 570 AK8975Driver.c
+ 496 AK8975Driver.h
+ 579 AKFS_APIs.c
+ 572 AKFS_APIs.h
+ 580 AKFS_APIs_8975/AKFS_AK8975.c
+ 580 AKFS_APIs_8975/AKFS_AK8975.h
+ 580 AKFS_APIs_8975/AKFS_AOC.c
+ 580 AKFS_APIs_8975/AKFS_AOC.h
+ 580 AKFS_APIs_8975/AKFS_Configure.h
+ 580 AKFS_APIs_8975/AKFS_Device.c
+ 580 AKFS_APIs_8975/AKFS_Device.h
+ 580 AKFS_APIs_8975/AKFS_Direction.c
+ 580 AKFS_APIs_8975/AKFS_Direction.h
+ 580 AKFS_APIs_8975/AKFS_Math.h
+ 580 AKFS_APIs_8975/AKFS_VNorm.c
+ 580 AKFS_APIs_8975/AKFS_VNorm.h
+ 568 AKFS_CSpec.h
+ 573 AKFS_Common.h
+ 572 AKFS_Compass.h
+ 579 AKFS_Disp.c
+ 568 AKFS_Disp.h
+ 568 AKFS_FileIO.c
+ 549 AKFS_FileIO.h
+ 573 AKFS_Measure.c
+ 568 AKFS_Measure.h
+ 574 Android.mk
+ 575 NOTICE
+ 579 main.c
+
diff --git a/libsensors/akmdfs/main.c b/libsensors/akmdfs/main.c
new file mode 100644
index 0000000..a3df0bc
--- /dev/null
+++ b/libsensors/akmdfs/main.c
@@ -0,0 +1,293 @@
+/******************************************************************************
+ *
+ * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+#include "AKFS_Common.h"
+#include "AKFS_Compass.h"
+#include "AKFS_Disp.h"
+#include "AKFS_FileIO.h"
+#include "AKFS_Measure.h"
+#include "AKFS_APIs.h"
+
+#ifndef WIN32
+#include <sched.h>
+#include <pthread.h>
+#include <linux/input.h>
+#endif
+
+#define ERROR_INITDEVICE (-1)
+#define ERROR_OPTPARSE (-2)
+#define ERROR_SELF_TEST (-3)
+#define ERROR_READ_FUSE (-4)
+#define ERROR_INIT (-5)
+#define ERROR_GETOPEN_STAT (-6)
+#define ERROR_STARTCLONE (-7)
+#define ERROR_GETCLOSE_STAT (-8)
+
+/* Global variable. See AKFS_Common.h file. */
+int g_stopRequest = 0;
+int g_opmode = 0;
+int g_dbgzone = 0;
+int g_mainQuit = AKD_FALSE;
+
+/* Static variable. */
+static pthread_t s_thread; /*!< Thread handle */
+
+/*!
+ A thread function which is raised when measurement is started.
+ @param[in] args This parameter is not used currently.
+ */
+static void* thread_main(void* args)
+{
+ AKFS_MeasureLoop();
+ return ((void*)0);
+}
+
+/*!
+ Signal handler. This should be used only in DEBUG mode.
+ @param[in] sig Event
+ */
+static void signal_handler(int sig)
+{
+ if (sig == SIGINT) {
+ ALOGE("SIGINT signal");
+ g_stopRequest = 1;
+ g_mainQuit = AKD_TRUE;
+ }
+}
+
+/*!
+ Starts new thread.
+ @return If this function succeeds, the return value is 1. Otherwise,
+ the return value is 0.
+ */
+static int startClone(void)
+{
+ pthread_attr_t attr;
+
+ pthread_attr_init(&attr);
+ g_stopRequest = 0;
+ if (pthread_create(&s_thread, &attr, thread_main, NULL) == 0) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+/*!
+ This function parse the option.
+ @retval 1 Parse succeeds.
+ @retval 0 Parse failed.
+ @param[in] argc Argument count
+ @param[in] argv Argument vector
+ @param[out] layout_patno
+ */
+int OptParse(
+ int argc,
+ char* argv[],
+ AKFS_PATNO* layout_patno)
+{
+#ifdef WIN32
+ /* Static */
+#if defined(AKFS_WIN32_PAT1)
+ *layout_patno = PAT1;
+#elif defined(AKFS_WIN32_PAT2)
+ *layout_patno = PAT2;
+#elif defined(AKFS_WIN32_PAT3)
+ *layout_patno = PAT3;
+#elif defined(AKFS_WIN32_PAT4)
+ *layout_patno = PAT4;
+#elif defined(AKFS_WIN32_PAT5)
+ *layout_patno = PAT5;
+#else
+ *layout_patno = PAT1;
+#endif
+ g_opmode = OPMODE_CONSOLE;
+ /*g_opmode = 0;*/
+ g_dbgzone = AKMDATA_LOOP | AKMDATA_TEST;
+#else
+ int opt;
+ char optVal;
+
+ *layout_patno = PAT_INVALID;
+
+ while ((opt = getopt(argc, argv, "sm:z:")) != -1) {
+ switch(opt){
+ case 'm':
+ optVal = (char)(optarg[0] - '0');
+ if ((PAT1 <= optVal) && (optVal <= PAT8)) {
+ *layout_patno = (AKFS_PATNO)optVal;
+ AKMDEBUG(DBG_LEVEL2, "%s: Layout=%d\n", __FUNCTION__, optVal);
+ }
+ break;
+ case 's':
+ g_opmode |= OPMODE_CONSOLE;
+ break;
+ case 'z':
+ /* If error detected, hopefully 0 is returned. */
+ errno = 0;
+ g_dbgzone = (int)strtol(optarg, (char**)NULL, 0);
+ AKMDEBUG(DBG_LEVEL2, "%s: Dbg Zone=%d\n", __FUNCTION__, g_dbgzone);
+ break;
+ default:
+ ALOGE("%s: Invalid argument", argv[0]);
+ return 0;
+ }
+ }
+
+ /* If layout is not specified with argument, get parameter from driver */
+ if (*layout_patno == PAT_INVALID) {
+ int16_t n;
+ if (AKD_GetLayout(&n) == AKM_SUCCESS) {
+ if ((PAT1 <= n) && (n <= PAT8)) {
+ *layout_patno = (AKFS_PATNO)n;
+ }
+ }
+ }
+ /* Error */
+ if (*layout_patno == PAT_INVALID) {
+ ALOGE("No layout is specified.");
+ return 0;
+ }
+#endif
+
+ return 1;
+}
+
+void ConsoleMode(void)
+{
+ /*** Console Mode *********************************************/
+ while (AKD_TRUE) {
+ /* Select operation */
+ switch (Menu_Main()) {
+ case MODE_SelfTest:
+ AKFS_SelfTest();
+ break;
+ case MODE_Measure:
+ /* Reset flag */
+ g_stopRequest = 0;
+ /* Measurement routine */
+ AKFS_MeasureLoop();
+ break;
+
+ case MODE_Quit:
+ return;
+
+ default:
+ AKMDEBUG(DBG_LEVEL0, "Unknown operation mode.\n");
+ break;
+ }
+ }
+}
+
+int main(int argc, char **argv)
+{
+ int retValue = 0;
+ AKFS_PATNO pat;
+ uint8 regs[3];
+
+ /* Show the version info of this software. */
+ Disp_StartMessage();
+
+#if ENABLE_AKMDEBUG
+ /* Register signal handler */
+ signal(SIGINT, signal_handler);
+#endif
+
+ /* Open device driver */
+ if(AKD_InitDevice() != AKD_SUCCESS) {
+ retValue = ERROR_INITDEVICE;
+ goto MAIN_QUIT;
+ }
+
+ /* Parse command-line options */
+ /* This function calls device driver function to get layout */
+ if (OptParse(argc, argv, &pat) == 0) {
+ retValue = ERROR_OPTPARSE;
+ goto MAIN_QUIT;
+ }
+
+ /* Self Test */
+ if (g_opmode & OPMODE_FST){
+ if (AKFS_SelfTest() != AKD_SUCCESS) {
+ retValue = ERROR_SELF_TEST;
+ goto MAIN_QUIT;
+ }
+ }
+
+ /* OK, then start */
+ if (AKFS_ReadAK8975FUSEROM(regs) != AKM_SUCCESS) {
+ retValue = ERROR_READ_FUSE;
+ goto MAIN_QUIT;
+ }
+
+ /* Initialize library. */
+ if (AKFS_Init(pat, regs) != AKM_SUCCESS) {
+ retValue = ERROR_INIT;
+ goto MAIN_QUIT;
+ }
+
+ /* Start console mode */
+ if (g_opmode & OPMODE_CONSOLE) {
+ ConsoleMode();
+ goto MAIN_QUIT;
+ }
+
+ /*** Start Daemon ********************************************/
+ while (g_mainQuit == AKD_FALSE) {
+ int st = 0;
+ /* Wait until device driver is opened. */
+ if (AKD_GetOpenStatus(&st) != AKD_SUCCESS) {
+ retValue = ERROR_GETOPEN_STAT;
+ goto MAIN_QUIT;
+ }
+ if (st == 0) {
+ ALOGI("Suspended.");
+ } else {
+ ALOGI("Compass Opened.");
+ /* Reset flag */
+ g_stopRequest = 0;
+ /* Start measurement thread. */
+ if (startClone() == 0) {
+ retValue = ERROR_STARTCLONE;
+ goto MAIN_QUIT;
+ }
+
+ /* Wait until device driver is closed. */
+ if (AKD_GetCloseStatus(&st) != AKD_SUCCESS) {
+ retValue = ERROR_GETCLOSE_STAT;
+ g_mainQuit = AKD_TRUE;
+ }
+ /* Wait thread completion. */
+ g_stopRequest = 1;
+ pthread_join(s_thread, NULL);
+ ALOGI("Compass Closed.");
+ }
+ }
+
+MAIN_QUIT:
+
+ /* Release library */
+ AKFS_Release();
+ /* Close device driver. */
+ AKD_DeinitDevice();
+ /* Show the last message. */
+ Disp_EndMessage(retValue);
+
+ return retValue;
+}
+
+
diff --git a/libsensors/cm36651_light.c b/libsensors/cm36651_light.c
new file mode 100644
index 0000000..6781797
--- /dev/null
+++ b/libsensors/cm36651_light.c
@@ -0,0 +1,264 @@
+/*
+ * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <math.h>
+#include <sys/types.h>
+#include <linux/ioctl.h>
+#include <linux/input.h>
+
+#include <hardware/sensors.h>
+#include <hardware/hardware.h>
+
+#define LOG_TAG "smdk4x12_sensors"
+#include <utils/Log.h>
+
+#include "smdk4x12_sensors.h"
+
+struct cm36651_light_data {
+ char path_enable[PATH_MAX];
+ char path_delay[PATH_MAX];
+};
+
+int cm36651_light_init(struct smdk4x12_sensors_handlers *handlers,
+ struct smdk4x12_sensors_device *device)
+{
+ struct cm36651_light_data *data = NULL;
+ char path[PATH_MAX] = { 0 };
+ int input_fd = -1;
+ int rc;
+
+ ALOGD("%s(%p, %p)", __func__, handlers, device);
+
+ if (handlers == NULL)
+ return -EINVAL;
+
+ data = (struct cm36651_light_data *) calloc(1, sizeof(struct cm36651_light_data));
+
+ input_fd = input_open("light_sensor");
+ if (input_fd < 0) {
+ ALOGE("%s: Unable to open input", __func__);
+ goto error;
+ }
+
+ rc = sysfs_path_prefix("light_sensor", (char *) &path);
+ if (rc < 0 || path[0] == '\0') {
+ ALOGE("%s: Unable to open sysfs", __func__);
+ goto error;
+ }
+
+ snprintf(data->path_enable, PATH_MAX, "%s/enable", path);
+ snprintf(data->path_delay, PATH_MAX, "%s/poll_delay", path);
+
+ handlers->poll_fd = input_fd;
+ handlers->data = (void *) data;
+
+ return 0;
+
+error:
+ if (data != NULL)
+ free(data);
+
+ if (input_fd >= 0)
+ close(input_fd);
+
+ handlers->poll_fd = -1;
+ handlers->data = NULL;
+
+ return -1;
+}
+
+int cm36651_light_deinit(struct smdk4x12_sensors_handlers *handlers)
+{
+ ALOGD("%s(%p)", __func__, handlers);
+
+ if (handlers == NULL)
+ return -EINVAL;
+
+ if (handlers->poll_fd >= 0)
+ close(handlers->poll_fd);
+ handlers->poll_fd = -1;
+
+ if (handlers->data != NULL)
+ free(handlers->data);
+ handlers->data = NULL;
+
+ return 0;
+}
+
+int cm36651_light_activate(struct smdk4x12_sensors_handlers *handlers)
+{
+ struct cm36651_light_data *data;
+ int rc;
+
+ ALOGD("%s(%p)", __func__, handlers);
+
+ if (handlers == NULL || handlers->data == NULL)
+ return -EINVAL;
+
+ data = (struct cm36651_light_data *) handlers->data;
+
+ rc = sysfs_value_write(data->path_enable, 1);
+ if (rc < 0) {
+ ALOGE("%s: Unable to write sysfs value", __func__);
+ return -1;
+ }
+
+ handlers->activated = 1;
+
+ return 0;
+}
+
+int cm36651_light_deactivate(struct smdk4x12_sensors_handlers *handlers)
+{
+ struct cm36651_light_data *data;
+ int rc;
+
+ ALOGD("%s(%p)", __func__, handlers);
+
+ if (handlers == NULL || handlers->data == NULL)
+ return -EINVAL;
+
+ data = (struct cm36651_light_data *) handlers->data;
+
+ rc = sysfs_value_write(data->path_enable, 0);
+ if (rc < 0) {
+ ALOGE("%s: Unable to write sysfs value", __func__);
+ return -1;
+ }
+
+ handlers->activated = 1;
+
+ return 0;
+}
+
+int cm36651_light_set_delay(struct smdk4x12_sensors_handlers *handlers, int64_t delay)
+{
+ struct cm36651_light_data *data;
+ int rc;
+
+ ALOGD("%s(%p, %" PRId64 ")", __func__, handlers, delay);
+
+ if (handlers == NULL || handlers->data == NULL)
+ return -EINVAL;
+
+ data = (struct cm36651_light_data *) handlers->data;
+
+ rc = sysfs_value_write(data->path_delay, delay);
+ if (rc < 0) {
+ ALOGE("%s: Unable to write sysfs value", __func__);
+ return -1;
+ }
+
+ return 0;
+}
+
+float cm36651_light_convert(int white, int green)
+{
+ float gwrel = 1.0f;
+ float aux;
+ float r1, r2, r3, r4;
+
+ if (green <= 4)
+ return 0.0f;
+ else {
+ if (white > 0)
+ gwrel = (float) green / (float) white;
+
+ r1 = floorf( (float) (pow((double) green, 1.3341) * 0.0258) );
+
+ aux = floorf( ((float) green * 0.18f * 9.44f) / gwrel);
+ r2 = aux;
+ r3 = aux * 0.77f;
+
+ r4 = floorf( (float) green * ( (gwrel * 1.546) - 0.46) );
+
+ if (gwrel <= 0.5f) {
+ return r1;
+ } else if (gwrel >= 0.9f) {
+ if (white <= 5999)
+ return r2;
+ else
+ return r3;
+ } else {
+ return r4;
+ }
+ }
+}
+
+int cm36651_light_get_data(struct smdk4x12_sensors_handlers *handlers,
+ struct sensors_event_t *event)
+{
+ struct input_event input_event;
+ int input_fd;
+ int green = 0;
+ int white = 0;
+ int rc;
+
+// ALOGD("%s(%p, %p)", __func__, handlers, event);
+
+ if (handlers == NULL || event == NULL)
+ return -EINVAL;
+
+ input_fd = handlers->poll_fd;
+ if (input_fd < 0)
+ return -EINVAL;
+
+ memset(event, 0, sizeof(struct sensors_event_t));
+ event->version = sizeof(struct sensors_event_t);
+ event->sensor = handlers->handle;
+ event->type = handlers->handle;
+
+ do {
+ rc = read(input_fd, &input_event, sizeof(input_event));
+ if (rc < (int) sizeof(input_event))
+ break;
+
+ if (input_event.type == EV_REL) {
+ if (input_event.code == REL_Y)
+ green = input_event.value;
+ if (input_event.code == REL_MISC)
+ white = input_event.value;
+ } else if (input_event.type == EV_SYN) {
+ if (input_event.code == SYN_REPORT)
+ event->timestamp = input_timestamp(&input_event);
+ }
+ } while (input_event.type != EV_SYN);
+
+ event->light = cm36651_light_convert(white, green);
+
+ return 0;
+}
+
+struct smdk4x12_sensors_handlers cm36651_light = {
+ .name = "CM36651 Light",
+ .handle = SENSOR_TYPE_LIGHT,
+ .init = cm36651_light_init,
+ .deinit = cm36651_light_deinit,
+ .activate = cm36651_light_activate,
+ .deactivate = cm36651_light_deactivate,
+ .set_delay = cm36651_light_set_delay,
+ .get_data = cm36651_light_get_data,
+ .activated = 0,
+ .needed = 0,
+ .poll_fd = -1,
+ .data = NULL,
+};
diff --git a/libsensors/cm36651_proximity.c b/libsensors/cm36651_proximity.c
new file mode 100644
index 0000000..6529543
--- /dev/null
+++ b/libsensors/cm36651_proximity.c
@@ -0,0 +1,213 @@
+/*
+ * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <linux/ioctl.h>
+#include <linux/input.h>
+
+#include <hardware/sensors.h>
+#include <hardware/hardware.h>
+
+#define LOG_TAG "smdk4x12_sensors"
+#include <utils/Log.h>
+
+#include "smdk4x12_sensors.h"
+
+struct cm36651_proximity_data {
+ char path_enable[PATH_MAX];
+};
+
+int cm36651_proximity_init(struct smdk4x12_sensors_handlers *handlers,
+ struct smdk4x12_sensors_device *device)
+{
+ struct cm36651_proximity_data *data = NULL;
+ char path[PATH_MAX] = { 0 };
+ int input_fd = -1;
+ int rc;
+
+ ALOGD("%s(%p, %p)", __func__, handlers, device);
+
+ if (handlers == NULL)
+ return -EINVAL;
+
+ data = (struct cm36651_proximity_data *) calloc(1, sizeof(struct cm36651_proximity_data));
+
+ input_fd = input_open("proximity_sensor");
+ if (input_fd < 0) {
+ ALOGE("%s: Unable to open input", __func__);
+ goto error;
+ }
+
+ rc = sysfs_path_prefix("proximity_sensor", (char *) &path);
+ if (rc < 0 || path[0] == '\0') {
+ ALOGE("%s: Unable to open sysfs", __func__);
+ goto error;
+ }
+
+ snprintf(data->path_enable, PATH_MAX, "%s/enable", path);
+
+ handlers->poll_fd = input_fd;
+ handlers->data = (void *) data;
+
+ return 0;
+
+error:
+ if (data != NULL)
+ free(data);
+
+ if (input_fd >= 0)
+ close(input_fd);
+
+ handlers->poll_fd = -1;
+ handlers->data = NULL;
+
+ return -1;
+}
+
+int cm36651_proximity_deinit(struct smdk4x12_sensors_handlers *handlers)
+{
+ ALOGD("%s(%p)", __func__, handlers);
+
+ if (handlers == NULL)
+ return -EINVAL;
+
+ if (handlers->poll_fd >= 0)
+ close(handlers->poll_fd);
+ handlers->poll_fd = -1;
+
+ if (handlers->data != NULL)
+ free(handlers->data);
+ handlers->data = NULL;
+
+ return 0;
+}
+
+int cm36651_proximity_activate(struct smdk4x12_sensors_handlers *handlers)
+{
+ struct cm36651_proximity_data *data;
+ int rc;
+
+ ALOGD("%s(%p)", __func__, handlers);
+
+ if (handlers == NULL || handlers->data == NULL)
+ return -EINVAL;
+
+ data = (struct cm36651_proximity_data *) handlers->data;
+
+ rc = sysfs_value_write(data->path_enable, 1);
+ if (rc < 0) {
+ ALOGE("%s: Unable to write sysfs value", __func__);
+ return -1;
+ }
+
+ handlers->activated = 1;
+
+ return 0;
+}
+
+int cm36651_proximity_deactivate(struct smdk4x12_sensors_handlers *handlers)
+{
+ struct cm36651_proximity_data *data;
+ int rc;
+
+ ALOGD("%s(%p)", __func__, handlers);
+
+ if (handlers == NULL || handlers->data == NULL)
+ return -EINVAL;
+
+ data = (struct cm36651_proximity_data *) handlers->data;
+
+ rc = sysfs_value_write(data->path_enable, 0);
+ if (rc < 0) {
+ ALOGE("%s: Unable to write sysfs value", __func__);
+ return -1;
+ }
+
+ handlers->activated = 1;
+
+ return 0;
+}
+
+int cm36651_proximity_set_delay(struct smdk4x12_sensors_handlers *handlers, int64_t delay)
+{
+ ALOGD("%s(%p, %" PRId64 ")", __func__, handlers, delay);
+
+ return 0;
+}
+
+float cm36651_proximity_convert(int value)
+{
+ return (float) value * 6.0f;
+}
+
+int cm36651_proximity_get_data(struct smdk4x12_sensors_handlers *handlers,
+ struct sensors_event_t *event)
+{
+ struct input_event input_event;
+ int input_fd;
+ int rc;
+
+// ALOGD("%s(%p, %p)", __func__, handlers, event);
+
+ if (handlers == NULL || event == NULL)
+ return -EINVAL;
+
+ input_fd = handlers->poll_fd;
+ if (input_fd < 0)
+ return -EINVAL;
+
+ memset(event, 0, sizeof(struct sensors_event_t));
+ event->version = sizeof(struct sensors_event_t);
+ event->sensor = handlers->handle;
+ event->type = handlers->handle;
+
+ do {
+ rc = read(input_fd, &input_event, sizeof(input_event));
+ if (rc < (int) sizeof(input_event))
+ break;
+
+ if (input_event.type == EV_ABS) {
+ if (input_event.code == ABS_DISTANCE)
+ event->distance = cm36651_proximity_convert(input_event.value);
+ } else if (input_event.type == EV_SYN) {
+ if (input_event.code == SYN_REPORT)
+ event->timestamp = input_timestamp(&input_event);
+ }
+ } while (input_event.type != EV_SYN);
+
+ return 0;
+}
+
+struct smdk4x12_sensors_handlers cm36651_proximity = {
+ .name = "CM36651 Proximity",
+ .handle = SENSOR_TYPE_PROXIMITY,
+ .init = cm36651_proximity_init,
+ .deinit = cm36651_proximity_deinit,
+ .activate = cm36651_proximity_activate,
+ .deactivate = cm36651_proximity_deactivate,
+ .set_delay = cm36651_proximity_set_delay,
+ .get_data = cm36651_proximity_get_data,
+ .activated = 0,
+ .needed = 0,
+ .poll_fd = -1,
+ .data = NULL,
+};
diff --git a/libsensors/input.c b/libsensors/input.c
new file mode 100644
index 0000000..da3d6d7
--- /dev/null
+++ b/libsensors/input.c
@@ -0,0 +1,336 @@
+/*
+ * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <dirent.h>
+#include <linux/ioctl.h>
+#include <linux/input.h>
+#include <linux/uinput.h>
+
+#define LOG_TAG "smdk4x12_sensors"
+#include <utils/Log.h>
+
+#include "smdk4x12_sensors.h"
+
+void input_event_set(struct input_event *event, int type, int code, int value)
+{
+ if (event == NULL)
+ return;
+
+ memset(event, 0, sizeof(struct input_event));
+
+ event->type = type,
+ event->code = code;
+ event->value = value;
+
+ gettimeofday(&event->time, NULL);
+}
+
+int64_t timestamp(struct timeval *time)
+{
+ if (time == NULL)
+ return -1;
+
+ return time->tv_sec * 1000000000LL + time->tv_usec * 1000;
+}
+
+int64_t input_timestamp(struct input_event *event)
+{
+ if (event == NULL)
+ return -1;
+
+ return timestamp(&event->time);
+}
+
+int uinput_rel_create(const char *name)
+{
+ struct uinput_user_dev uinput_dev;
+ int uinput_fd;
+ int rc;
+
+ if (name == NULL)
+ return -1;
+
+ uinput_fd = open("/dev/uinput", O_WRONLY | O_NONBLOCK);
+ if (uinput_fd < 0) {
+ ALOGE("%s: Unable to open uinput device", __func__);
+ goto error;
+ }
+
+ memset(&uinput_dev, 0, sizeof(uinput_dev));
+
+ strncpy(uinput_dev.name, name, sizeof(uinput_dev.name));
+ uinput_dev.id.bustype = BUS_I2C;
+ uinput_dev.id.vendor = 0;
+ uinput_dev.id.product = 0;
+ uinput_dev.id.version = 0;
+
+ rc = 0;
+ rc |= ioctl(uinput_fd, UI_SET_EVBIT, EV_REL);
+ rc |= ioctl(uinput_fd, UI_SET_RELBIT, REL_X);
+ rc |= ioctl(uinput_fd, UI_SET_RELBIT, REL_Y);
+ rc |= ioctl(uinput_fd, UI_SET_RELBIT, REL_Z);
+ rc |= ioctl(uinput_fd, UI_SET_RELBIT, REL_MISC);
+ rc |= ioctl(uinput_fd, UI_SET_EVBIT, EV_SYN);
+
+ if (rc < 0) {
+ ALOGE("%s: Unable to set uinput bits", __func__);
+ goto error;
+ }
+
+ rc = write(uinput_fd, &uinput_dev, sizeof(uinput_dev));
+ if (rc < 0) {
+ ALOGE("%s: Unable to write uinput device", __func__);
+ goto error;
+ }
+
+ rc = ioctl(uinput_fd, UI_DEV_CREATE);
+ if (rc < 0) {
+ ALOGE("%s: Unable to create uinput device", __func__);
+ goto error;
+ }
+
+ usleep(3000);
+
+ return uinput_fd;
+
+error:
+ if (uinput_fd >= 0)
+ close(uinput_fd);
+
+ return -1;
+}
+
+void uinput_destroy(int uinput_fd)
+{
+ if (uinput_fd < 0)
+ return;
+
+ ioctl(uinput_fd, UI_DEV_DESTROY);
+}
+
+int input_open(char *name)
+{
+ DIR *d;
+ struct dirent *di;
+
+ char input_name[80] = { 0 };
+ char path[PATH_MAX];
+ char *c;
+ int fd;
+ int rc;
+
+ if (name == NULL)
+ return -EINVAL;
+
+ d = opendir("/dev/input");
+ if (d == NULL)
+ return -1;
+
+ while ((di = readdir(d))) {
+ if (di == NULL || strcmp(di->d_name, ".") == 0 || strcmp(di->d_name, "..") == 0)
+ continue;
+
+ snprintf(path, PATH_MAX, "/dev/input/%s", di->d_name);
+ fd = open(path, O_RDONLY | O_NONBLOCK);
+ if (fd < 0)
+ continue;
+
+ rc = ioctl(fd, EVIOCGNAME(sizeof(input_name) - 1), &input_name);
+ if (rc < 0)
+ continue;
+
+ c = strstr((char *) &input_name, "\n");
+ if (c != NULL)
+ *c = '\0';
+
+ if (strcmp(input_name, name) == 0)
+ return fd;
+ else
+ close(fd);
+ }
+
+ return -1;
+}
+
+int sysfs_path_prefix(char *name, char *path_prefix)
+{
+ DIR *d;
+ struct dirent *di;
+
+ char input_name[80] = { 0 };
+ char path[PATH_MAX];
+ char *c;
+ int fd;
+
+ if (name == NULL || path_prefix == NULL)
+ return -EINVAL;
+
+ d = opendir("/sys/class/input");
+ if (d == NULL)
+ return -1;
+
+ while ((di = readdir(d))) {
+ if (di == NULL || strcmp(di->d_name, ".") == 0 || strcmp(di->d_name, "..") == 0)
+ continue;
+
+ snprintf(path, PATH_MAX, "/sys/class/input/%s/name", di->d_name);
+
+ fd = open(path, O_RDONLY);
+ if (fd < 0)
+ continue;
+
+ read(fd, &input_name, sizeof(input_name));
+ close(fd);
+
+ c = strstr((char *) &input_name, "\n");
+ if (c != NULL)
+ *c = '\0';
+
+ if (strcmp(input_name, name) == 0) {
+ snprintf(path_prefix, PATH_MAX, "/sys/class/input/%s", di->d_name);
+ return 0;
+ }
+ }
+
+ return -1;
+}
+
+int64_t sysfs_value_read(char *path)
+{
+ char buffer[100];
+ int64_t value;
+ int fd = -1;
+ int rc;
+
+ if (path == NULL)
+ return -1;
+
+ fd = open(path, O_RDONLY);
+ if (fd < 0)
+ goto error;
+
+ rc = read(fd, &buffer, sizeof(buffer));
+ if (rc <= 0)
+ goto error;
+
+ value = (int64_t)strtoimax(buffer, NULL, 10);
+ goto complete;
+
+error:
+ value = -1;
+
+complete:
+ if (fd >= 0)
+ close(fd);
+
+ return value;
+}
+
+int sysfs_value_write(char *path, int64_t value)
+{
+ char buffer[100];
+ int fd = -1;
+ int rc;
+
+ if (path == NULL)
+ return -1;
+
+ fd = open(path, O_WRONLY);
+ if (fd < 0)
+ goto error;
+
+ snprintf((char *) &buffer, sizeof(buffer), "%" PRId64 "\n", value);
+
+ rc = write(fd, buffer, strlen(buffer));
+ if (rc < (int) strlen(buffer))
+ goto error;
+
+ rc = 0;
+ goto complete;
+
+error:
+ rc = -1;
+
+complete:
+ if (fd >= 0)
+ close(fd);
+
+ return rc;
+}
+
+int sysfs_string_read(char *path, char *buffer, size_t length)
+{
+ int fd = -1;
+ int rc;
+
+ if (path == NULL || buffer == NULL || length == 0)
+ return -1;
+
+ fd = open(path, O_RDONLY);
+ if (fd < 0)
+ goto error;
+
+ rc = read(fd, buffer, length);
+ if (rc <= 0)
+ goto error;
+
+ rc = 0;
+ goto complete;
+
+error:
+ rc = -1;
+
+complete:
+ if (fd >= 0)
+ close(fd);
+
+ return rc;
+}
+
+int sysfs_string_write(char *path, char *buffer, size_t length)
+{
+ int fd = -1;
+ int rc;
+
+ if (path == NULL || buffer == NULL || length == 0)
+ return -1;
+
+ fd = open(path, O_WRONLY);
+ if (fd < 0)
+ goto error;
+
+ rc = write(fd, buffer, length);
+ if (rc <= 0)
+ goto error;
+
+ rc = 0;
+ goto complete;
+
+error:
+ rc = -1;
+
+complete:
+ if (fd >= 0)
+ close(fd);
+
+ return rc;
+}
diff --git a/libsensors/lps331ap.c b/libsensors/lps331ap.c
new file mode 100644
index 0000000..a8ef55a
--- /dev/null
+++ b/libsensors/lps331ap.c
@@ -0,0 +1,244 @@
+/*
+ * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <math.h>
+#include <sys/types.h>
+#include <linux/ioctl.h>
+#include <linux/input.h>
+
+#include <hardware/sensors.h>
+#include <hardware/hardware.h>
+
+#define LOG_TAG "smdk4x12_sensors"
+#include <utils/Log.h>
+
+#include "smdk4x12_sensors.h"
+
+struct lps331ap_data {
+ char path_enable[PATH_MAX];
+ char path_delay[PATH_MAX];
+};
+
+int lps331ap_init(struct smdk4x12_sensors_handlers *handlers,
+ struct smdk4x12_sensors_device *device)
+{
+ struct lps331ap_data *data = NULL;
+ char path[PATH_MAX] = { 0 };
+ int input_fd = -1;
+ int rc;
+
+ ALOGD("%s(%p, %p)", __func__, handlers, device);
+
+ if (handlers == NULL)
+ return -EINVAL;
+
+ data = (struct lps331ap_data *) calloc(1, sizeof(struct lps331ap_data));
+
+ input_fd = input_open("barometer_sensor");
+ if (input_fd < 0) {
+ ALOGE("%s: Unable to open input", __func__);
+ goto error;
+ }
+
+ rc = sysfs_path_prefix("barometer_sensor", (char *) &path);
+ if (rc < 0 || path[0] == '\0') {
+ ALOGE("%s: Unable to open sysfs", __func__);
+ goto error;
+ }
+
+ snprintf(data->path_enable, PATH_MAX, "%s/enable", path);
+ snprintf(data->path_delay, PATH_MAX, "%s/poll_delay", path);
+
+ handlers->poll_fd = input_fd;
+ handlers->data = (void *) data;
+
+ return 0;
+
+error:
+ if (data != NULL)
+ free(data);
+
+ if (input_fd >= 0)
+ close(input_fd);
+
+ handlers->poll_fd = -1;
+ handlers->data = NULL;
+
+ return -1;
+}
+
+int lps331ap_deinit(struct smdk4x12_sensors_handlers *handlers)
+{
+ ALOGD("%s(%p)", __func__, handlers);
+
+ if (handlers == NULL)
+ return -EINVAL;
+
+ if (handlers->poll_fd >= 0)
+ close(handlers->poll_fd);
+ handlers->poll_fd = -1;
+
+ if (handlers->data != NULL)
+ free(handlers->data);
+ handlers->data = NULL;
+
+ return 0;
+}
+
+int lps331ap_activate(struct smdk4x12_sensors_handlers *handlers)
+{
+ struct lps331ap_data *data;
+ int rc;
+
+ ALOGD("%s(%p)", __func__, handlers);
+
+ if (handlers == NULL || handlers->data == NULL)
+ return -EINVAL;
+
+ data = (struct lps331ap_data *) handlers->data;
+
+ rc = sysfs_value_write(data->path_enable, 1);
+ if (rc < 0) {
+ ALOGE("%s: Unable to write sysfs value", __func__);
+ return -1;
+ }
+
+ handlers->activated = 1;
+
+ return 0;
+}
+
+int lps331ap_deactivate(struct smdk4x12_sensors_handlers *handlers)
+{
+ struct lps331ap_data *data;
+ int rc;
+
+ ALOGD("%s(%p)", __func__, handlers);
+
+ if (handlers == NULL || handlers->data == NULL)
+ return -EINVAL;
+
+ data = (struct lps331ap_data *) handlers->data;
+
+ rc = sysfs_value_write(data->path_enable, 0);
+ if (rc < 0) {
+ ALOGE("%s: Unable to write sysfs value", __func__);
+ return -1;
+ }
+
+ handlers->activated = 1;
+
+ return 0;
+}
+
+int lps331ap_set_delay(struct smdk4x12_sensors_handlers *handlers, int64_t delay)
+{
+ struct lps331ap_data *data;
+ int rc;
+
+ ALOGD("%s(%p, %" PRId64 ")", __func__, handlers, delay);
+
+ if (handlers == NULL || handlers->data == NULL)
+ return -EINVAL;
+
+ data = (struct lps331ap_data *) handlers->data;
+
+ if (delay < 10000000)
+ delay = 10;
+ else
+ delay = delay / 1000000;
+
+ rc = sysfs_value_write(data->path_delay, delay);
+ if (rc < 0) {
+ ALOGE("%s: Unable to write sysfs value", __func__);
+ return -1;
+ }
+
+ return 0;
+}
+
+float lps331ap_convert(int value)
+{
+ return value / 4096.0f;
+}
+
+int lps331ap_get_data(struct smdk4x12_sensors_handlers *handlers,
+ struct sensors_event_t *event)
+{
+ struct input_event input_event;
+ int input_fd;
+ int rc;
+
+// ALOGD("%s(%p, %p)", __func__, handlers, event);
+
+ if (handlers == NULL || event == NULL)
+ return -EINVAL;
+
+ input_fd = handlers->poll_fd;
+ if (input_fd < 0)
+ return -EINVAL;
+
+ memset(event, 0, sizeof(struct sensors_event_t));
+ event->version = sizeof(struct sensors_event_t);
+ event->sensor = handlers->handle;
+ event->type = handlers->handle;
+
+ do {
+ rc = read(input_fd, &input_event, sizeof(input_event));
+ if (rc < (int) sizeof(input_event))
+ break;
+
+ if (input_event.type == EV_REL) {
+ switch (input_event.code) {
+ case REL_X:
+ event->pressure = lps331ap_convert(input_event.value);
+ break;
+ default:
+ continue;
+ }
+ } else if (input_event.type == EV_SYN) {
+ if (input_event.code == SYN_REPORT && event->pressure != 0) {
+ event->timestamp = input_timestamp(&input_event);
+ break;
+ } else {
+ return -1;
+ }
+ }
+ } while (1);
+
+ return 0;
+}
+
+struct smdk4x12_sensors_handlers lps331ap = {
+ .name = "LPS331AP",
+ .handle = SENSOR_TYPE_PRESSURE,
+ .init = lps331ap_init,
+ .deinit = lps331ap_deinit,
+ .activate = lps331ap_activate,
+ .deactivate = lps331ap_deactivate,
+ .set_delay = lps331ap_set_delay,
+ .get_data = lps331ap_get_data,
+ .activated = 0,
+ .needed = 0,
+ .poll_fd = -1,
+ .data = NULL,
+};
diff --git a/libsensors/lsm330dlc_accel.h b/libsensors/lsm330dlc_accel.h
new file mode 100644
index 0000000..ff5f666
--- /dev/null
+++ b/libsensors/lsm330dlc_accel.h
@@ -0,0 +1,185 @@
+/*
+ * Copyright (C) 2011, Samsung Electronics Co. Ltd. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __LSM330DLC_ACCEL_HEADER__
+#define __LSM330DLC_ACCEL_HEADER__
+
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+/*lsm330dlc_accel registers */
+#define STATUS_AUX 0x07
+#define OUT_1_L 0x08
+#define OUT_1_H 0x09
+#define OUT_2_L 0x0A
+#define OUT_2_H 0x0B
+#define OUT_3_L 0x0C
+#define OUT_3_H 0x0D
+#define INT_COUNTER 0x0E
+#define WHO_AM_I 0x0F
+#define TEMP_CFG_REG 0x1F
+#define CTRL_REG1 0x20 /* power control reg */
+#define CTRL_REG2 0x21 /* power control reg */
+#define CTRL_REG3 0x22 /* power control reg */
+#define CTRL_REG4 0x23 /* interrupt control reg */
+#define CTRL_REG5 0x24 /* interrupt control reg */
+#define CTRL_REG6 0x25
+#define REFERENCE 0x26
+#define STATUS_REG 0x27
+#define OUT_X_L 0x28
+#define OUT_X_H 0x29
+#define OUT_Y_L 0x2A
+#define OUT_Y_H 0x2B
+#define OUT_Z_L 0x2C
+#define OUT_Z_H 0x2D
+#define FIFO_CTRL_REG 0x2E
+#define FIFO_SRC_REG 0x2F
+#define INT1_CFG 0x30
+#define INT1_SRC 0x31
+#define INT1_THS 0x32
+#define INT1_DURATION 0x33
+#define INT2_CFG 0x34
+#define INT2_SRC 0x35
+#define INT2_THS 0x36
+#define INT2_DURATION 0x37
+#define CLICK_CFG 0x38
+#define CLICK_SRC 0x39
+#define CLICK_THS 0x3A
+#define TIME_LIMIT 0x3B
+#define TIME_LATENCY 0x3C
+#define TIME_WINDOW 0x3D
+
+/* CTRL_REG1 */
+#define CTRL_REG1_ODR3 (1 << 7)
+#define CTRL_REG1_ODR2 (1 << 6)
+#define CTRL_REG1_ODR1 (1 << 5)
+#define CTRL_REG1_ODR0 (1 << 4)
+#define CTRL_REG1_LPEN (1 << 3)
+#define CTRL_REG1_Zen (1 << 2)
+#define CTRL_REG1_Yen (1 << 1)
+#define CTRL_REG1_Xen (1 << 0)
+
+#define PM_OFF 0x00
+#define LOW_PWR_MODE 0x4F /* 50HZ */
+#define FASTEST_MODE 0x9F /* 1344Hz */
+#define ENABLE_ALL_AXES 0x07
+
+#define ODR1 0x10 /* 1Hz output data rate */
+#define ODR10 0x20 /* 10Hz output data rate */
+#define ODR25 0x30 /* 25Hz output data rate */
+#define ODR50 0x40 /* 50Hz output data rate */
+#define ODR100 0x50 /* 100Hz output data rate */
+#define ODR200 0x60 /* 100Hz output data rate */
+#define ODR400 0x70 /* 400Hz output data rate */
+#define ODR1344 0x90 /* 1344Hz output data rate */
+#define ODR_MASK 0xf0
+
+/* CTRL_REG2 */
+#define CTRL_REG2_HPM1 (1 << 7)
+#define CTRL_REG2_HPM0 (1 << 6)
+#define CTRL_REG2_HPCF2 (1 << 5)
+#define CTRL_REG2_HPCF1 (1 << 4)
+#define CTRL_REG2_FDS (1 << 3)
+#define CTRL_REG2_HPPCLICK (1 << 2)
+#define CTRL_REG2_HPIS2 (1 << 1)
+#define CTRL_REG2_HPIS1 (1 << 0)
+
+#define HPM_Normal (CTRL_REG2_HPM1)
+#define HPM_Filter (CTRL_REG2_HPM0)
+
+/* CTRL_REG3 */
+#define I1_CLICK (1 << 7)
+#define I1_AOI1 (1 << 6)
+#define I1_AOI2 (1 << 5)
+#define I1_DRDY1 (1 << 4)
+#define I1_DRDY2 (1 << 3)
+#define I1_WTM (1 << 2)
+#define I1_OVERRUN (1 << 1)
+
+/* CTRL_REG4 */
+#define CTRL_REG4_BLE (1 << 6)
+#define CTRL_REG4_FS1 (1 << 5)
+#define CTRL_REG4_FS0 (1 << 4)
+#define CTRL_REG4_HR (1 << 3)
+#define CTRL_REG4_ST1 (1 << 2)
+#define CTRL_REG4_ST0 (1 << 1)
+#define CTRL_REG4_SIM (1 << 0)
+
+#define FS2g 0x00
+#define FS4g (CTRL_REG4_FS0)
+#define FS8g (CTRL_REG4_FS1)
+#define FS16g (CTRL_REG4_FS1|CTRL_REG4_FS0)
+
+/* CTRL_REG5 */
+#define BOOT (1 << 7)
+#define FIFO_EN (1 << 6)
+#define LIR_INT1 (1 << 3)
+#define D4D_INT1 (1 << 2)
+
+/* STATUS_REG */
+#define ZYXOR (1 << 7)
+#define ZOR (1 << 6)
+#define YOR (1 << 5)
+#define XOR (1 << 4)
+#define ZYXDA (1 << 3)
+#define ZDA (1 << 2)
+#define YDA (1 << 1)
+#define XDA (1 << 0)
+
+/* INT1_CFG */
+#define INT_CFG_AOI (1 << 7)
+#define INT_CFG_6D (1 << 6)
+#define INT_CFG_ZHIE (1 << 5)
+#define INT_CFG_ZLIE (1 << 4)
+#define INT_CFG_YHIE (1 << 3)
+#define INT_CFG_YLIE (1 << 2)
+#define INT_CFG_XHIE (1 << 1)
+#define INT_CFG_XLIE (1 << 0)
+
+/* INT1_SRC */
+#define IA (1 << 6)
+#define ZH (1 << 5)
+#define ZL (1 << 4)
+#define YH (1 << 3)
+#define YL (1 << 2)
+#define XH (1 << 1)
+#define XL (1 << 0)
+
+/* Register Auto-increase */
+#define AC (1 << 7)
+
+/* dev info */
+#define ACC_DEV_NAME "accelerometer"
+
+struct lsm330dlc_acc {
+ __s16 x;
+ __s16 y;
+ __s16 z;
+};
+
+/* For movement recognition*/
+#define USES_MOVEMENT_RECOGNITION
+
+/* LSM330DLC_ACCEL ioctl command label */
+#define LSM330DLC_ACCEL_IOCTL_BASE 'a'
+#define LSM330DLC_ACCEL_IOCTL_SET_DELAY \
+ _IOW(LSM330DLC_ACCEL_IOCTL_BASE, 0, int64_t)
+#define LSM330DLC_ACCEL_IOCTL_GET_DELAY \
+ _IOR(LSM330DLC_ACCEL_IOCTL_BASE, 1, int64_t)
+#define LSM330DLC_ACCEL_IOCTL_READ_XYZ\
+ _IOR(LSM330DLC_ACCEL_IOCTL_BASE, 8, struct lsm330dlc_acc)
+#define LSM330DLC_ACCEL_IOCTL_SET_ENABLE \
+ _IOW(LSM330DLC_ACCEL_IOCTL_BASE, 9, int)
+#endif
diff --git a/libsensors/lsm330dlc_acceleration.c b/libsensors/lsm330dlc_acceleration.c
new file mode 100644
index 0000000..7f6985b
--- /dev/null
+++ b/libsensors/lsm330dlc_acceleration.c
@@ -0,0 +1,390 @@
+/*
+ * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#include <hardware/sensors.h>
+#include <hardware/hardware.h>
+
+#define LOG_TAG "smdk4x12_sensors"
+#include <utils/Log.h>
+
+#include "smdk4x12_sensors.h"
+#include "lsm330dlc_accel.h"
+
+struct lsm330dlc_acceleration_data {
+ int64_t delay;
+ int device_fd;
+ int uinput_fd;
+
+ pthread_t thread;
+ pthread_mutex_t mutex;
+ int thread_continue;
+};
+
+void *lsm330dlc_acceleration_thread(void *thread_data)
+{
+ struct smdk4x12_sensors_handlers *handlers = NULL;
+ struct lsm330dlc_acceleration_data *data = NULL;
+ struct input_event event;
+ struct timeval time;
+ struct lsm330dlc_acc acceleration_data;
+ int64_t before, after;
+ int diff;
+ int device_fd;
+ int uinput_fd;
+ int rc;
+
+ if (thread_data == NULL)
+ return NULL;
+
+ handlers = (struct smdk4x12_sensors_handlers *) thread_data;
+ if (handlers->data == NULL)
+ return NULL;
+
+ data = (struct lsm330dlc_acceleration_data *) handlers->data;
+
+ device_fd = data->device_fd;
+ if (device_fd < 0)
+ return NULL;
+
+ uinput_fd = data->uinput_fd;
+ if (uinput_fd < 0)
+ return NULL;
+
+ while (data->thread_continue) {
+ pthread_mutex_lock(&data->mutex);
+ if (!data->thread_continue)
+ break;
+
+ while (handlers->activated) {
+ gettimeofday(&time, NULL);
+ before = timestamp(&time);
+
+ memset(&acceleration_data, 0, sizeof(acceleration_data));
+
+ rc = ioctl(device_fd, LSM330DLC_ACCEL_IOCTL_READ_XYZ, &acceleration_data);
+ if (rc < 0) {
+ ALOGE("%s: Unable to get lsm330dlc acceleration data", __func__);
+ return NULL;
+ }
+
+ input_event_set(&event, EV_REL, REL_X, (int) (acceleration_data.x * 1000));
+ write(uinput_fd, &event, sizeof(event));
+ input_event_set(&event, EV_REL, REL_Y, (int) (acceleration_data.y * 1000));
+ write(uinput_fd, &event, sizeof(event));
+ input_event_set(&event, EV_REL, REL_Z, (int) (acceleration_data.z * 1000));
+ write(uinput_fd, &event, sizeof(event));
+ input_event_set(&event, EV_SYN, 0, 0);
+ write(uinput_fd, &event, sizeof(event));
+
+next:
+ gettimeofday(&time, NULL);
+ after = timestamp(&time);
+
+ diff = (int) (data->delay - (after - before)) / 1000;
+ if (diff <= 0)
+ continue;
+
+ usleep(diff);
+ }
+ }
+ return NULL;
+}
+
+int lsm330dlc_acceleration_init(struct smdk4x12_sensors_handlers *handlers,
+ struct smdk4x12_sensors_device *device)
+{
+ struct lsm330dlc_acceleration_data *data = NULL;
+ pthread_attr_t thread_attr;
+ int device_fd = -1;
+ int uinput_fd = -1;
+ int input_fd = -1;
+ int rc;
+ int i;
+
+ ALOGD("%s(%p, %p)", __func__, handlers, device);
+
+ if (handlers == NULL || device == NULL)
+ return -EINVAL;
+
+ data = (struct lsm330dlc_acceleration_data *) calloc(1, sizeof(struct lsm330dlc_acceleration_data));
+
+ device_fd = open("/dev/accelerometer", O_RDONLY);
+ if (device_fd < 0) {
+ ALOGE("%s: Unable to open device", __func__);
+ goto error;
+ }
+
+ uinput_fd = uinput_rel_create("acceleration");
+ if (uinput_fd < 0) {
+ ALOGD("%s: Unable to create uinput", __func__);
+ goto error;
+ }
+
+ input_fd = input_open("acceleration");
+ if (input_fd < 0) {
+ ALOGE("%s: Unable to open acceleration input", __func__);
+ goto error;
+ }
+
+ data->thread_continue = 1;
+
+ pthread_mutex_init(&data->mutex, NULL);
+ pthread_mutex_lock(&data->mutex);
+
+ pthread_attr_init(&thread_attr);
+ pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED);
+
+ rc = pthread_create(&data->thread, &thread_attr, lsm330dlc_acceleration_thread, (void *) handlers);
+ if (rc < 0) {
+ ALOGE("%s: Unable to create lsm330dlc acceleration thread", __func__);
+ pthread_mutex_destroy(&data->mutex);
+ goto error;
+ }
+
+ data->device_fd = device_fd;
+ data->uinput_fd = uinput_fd;
+ handlers->poll_fd = input_fd;
+ handlers->data = (void *) data;
+
+ return 0;
+
+error:
+ if (data != NULL)
+ free(data);
+
+ if (uinput_fd >= 0)
+ close(uinput_fd);
+
+ if (input_fd >= 0)
+ close(input_fd);
+
+ if (device_fd >= 0)
+ close(device_fd);
+
+ handlers->poll_fd = -1;
+ handlers->data = NULL;
+
+ return -1;
+}
+
+int lsm330dlc_acceleration_deinit(struct smdk4x12_sensors_handlers *handlers)
+{
+ struct lsm330dlc_acceleration_data *data = NULL;
+
+ ALOGD("%s(%p)", __func__, handlers);
+
+ if (handlers == NULL || handlers->data == NULL)
+ return -EINVAL;
+
+ data = (struct lsm330dlc_acceleration_data *) handlers->data;
+
+ handlers->activated = 0;
+ data->thread_continue = 0;
+ pthread_mutex_unlock(&data->mutex);
+
+ pthread_mutex_destroy(&data->mutex);
+
+ if (data->uinput_fd >= 0) {
+ uinput_destroy(data->uinput_fd);
+ close(data->uinput_fd);
+ }
+ data->uinput_fd = -1;
+
+ if (handlers->poll_fd >= 0)
+ close(handlers->poll_fd);
+ handlers->poll_fd = -1;
+
+ if (data->device_fd >= 0)
+ close(data->device_fd);
+ data->device_fd = -1;
+
+ free(handlers->data);
+ handlers->data = NULL;
+
+ return 0;
+}
+
+int lsm330dlc_acceleration_activate(struct smdk4x12_sensors_handlers *handlers)
+{
+ struct lsm330dlc_acceleration_data *data;
+ int device_fd;
+ int enable;
+ int rc;
+
+ ALOGD("%s(%p)", __func__, handlers);
+
+ if (handlers == NULL || handlers->data == NULL)
+ return -EINVAL;
+
+ data = (struct lsm330dlc_acceleration_data *) handlers->data;
+
+ device_fd = data->device_fd;
+ if (device_fd < 0)
+ return -1;
+
+ enable = 1;
+ rc = ioctl(device_fd, LSM330DLC_ACCEL_IOCTL_SET_ENABLE, &enable);
+ if (rc < 0) {
+ ALOGE("%s: Unable to set lsm330dlc acceleration enable", __func__);
+ return -1;
+ }
+
+ handlers->activated = 1;
+ pthread_mutex_unlock(&data->mutex);
+
+ return 0;
+}
+
+int lsm330dlc_acceleration_deactivate(struct smdk4x12_sensors_handlers *handlers)
+{
+ struct lsm330dlc_acceleration_data *data;
+ int device_fd;
+ int enable;
+ int rc;
+
+ ALOGD("%s(%p)", __func__, handlers);
+
+ if (handlers == NULL || handlers->data == NULL)
+ return -EINVAL;
+
+ data = (struct lsm330dlc_acceleration_data *) handlers->data;
+
+ device_fd = data->device_fd;
+ if (device_fd < 0)
+ return -1;
+
+ enable = 0;
+ rc = ioctl(device_fd, LSM330DLC_ACCEL_IOCTL_SET_ENABLE, &enable);
+ if (rc < 0) {
+ ALOGE("%s: Unable to set lsm330dlc acceleration enable", __func__);
+ return -1;
+ }
+
+ handlers->activated = 0;
+
+ return 0;
+}
+
+int lsm330dlc_acceleration_set_delay(struct smdk4x12_sensors_handlers *handlers, int64_t delay)
+{
+ struct lsm330dlc_acceleration_data *data;
+ int64_t d;
+ int device_fd;
+ int rc;
+
+ ALOGD("%s(%p, %" PRId64 ")", __func__, handlers, delay);
+
+ if (handlers == NULL || handlers->data == NULL)
+ return -EINVAL;
+
+ data = (struct lsm330dlc_acceleration_data *) handlers->data;
+
+ device_fd = data->device_fd;
+ if (device_fd < 0)
+ return -1;
+
+ d = (int64_t) delay;
+ rc = ioctl(device_fd, LSM330DLC_ACCEL_IOCTL_SET_DELAY, &d);
+ if (rc < 0) {
+ ALOGE("%s: Unable to set lsm330dlc acceleration delay", __func__);
+ return -1;
+ }
+
+ data->delay = delay;
+
+ return 0;
+}
+
+float lsm330dlc_acceleration_convert(int value)
+{
+ return (float) (value / 1000.f) * (GRAVITY_EARTH / 1024.0f);
+}
+
+int lsm330dlc_acceleration_get_data(struct smdk4x12_sensors_handlers *handlers,
+ struct sensors_event_t *event)
+{
+ struct lsm330dlc_acceleration_data *data;
+ struct input_event input_event;
+ int input_fd;
+ int rc;
+
+// ALOGD("%s(%p, %p)", __func__, handlers, event);
+
+ if (handlers == NULL || handlers->data == NULL || event == NULL)
+ return -EINVAL;
+
+ data = (struct lsm330dlc_acceleration_data *) handlers->data;
+
+ input_fd = handlers->poll_fd;
+ if (input_fd < 0)
+ return -1;
+
+ memset(event, 0, sizeof(struct sensors_event_t));
+ event->version = sizeof(struct sensors_event_t);
+ event->sensor = handlers->handle;
+ event->type = handlers->handle;
+
+ event->acceleration.status = SENSOR_STATUS_ACCURACY_MEDIUM;
+
+ do {
+ rc = read(input_fd, &input_event, sizeof(input_event));
+ if (rc < (int) sizeof(input_event))
+ break;
+
+ if (input_event.type == EV_REL) {
+ switch (input_event.code) {
+ case REL_X:
+ event->acceleration.x = lsm330dlc_acceleration_convert(input_event.value);
+ break;
+ case REL_Y:
+ event->acceleration.y = lsm330dlc_acceleration_convert(input_event.value);
+ break;
+ case REL_Z:
+ event->acceleration.z = lsm330dlc_acceleration_convert(input_event.value);
+ break;
+ default:
+ continue;
+ }
+ } else if (input_event.type == EV_SYN) {
+ if (input_event.code == SYN_REPORT)
+ event->timestamp = input_timestamp(&input_event);
+ }
+ } while (input_event.type != EV_SYN);
+
+ return 0;
+}
+
+struct smdk4x12_sensors_handlers lsm330dlc_acceleration = {
+ .name = "LSM330DLC Acceleration",
+ .handle = SENSOR_TYPE_ACCELEROMETER,
+ .init = lsm330dlc_acceleration_init,
+ .deinit = lsm330dlc_acceleration_deinit,
+ .activate = lsm330dlc_acceleration_activate,
+ .deactivate = lsm330dlc_acceleration_deactivate,
+ .set_delay = lsm330dlc_acceleration_set_delay,
+ .get_data = lsm330dlc_acceleration_get_data,
+ .activated = 0,
+ .needed = 0,
+ .poll_fd = -1,
+ .data = NULL,
+};
diff --git a/libsensors/lsm330dlc_gyroscope.c b/libsensors/lsm330dlc_gyroscope.c
new file mode 100644
index 0000000..b91b433
--- /dev/null
+++ b/libsensors/lsm330dlc_gyroscope.c
@@ -0,0 +1,256 @@
+/*
+ * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <math.h>
+#include <sys/types.h>
+#include <linux/ioctl.h>
+#include <linux/input.h>
+
+#include <hardware/sensors.h>
+#include <hardware/hardware.h>
+
+#define LOG_TAG "smdk4x12_sensors"
+#include <utils/Log.h>
+
+#include "smdk4x12_sensors.h"
+
+struct lsm330dlc_gyroscope_data {
+ char path_enable[PATH_MAX];
+ char path_delay[PATH_MAX];
+
+ sensors_vec_t gyro;
+};
+
+int lsm330dlc_gyroscope_init(struct smdk4x12_sensors_handlers *handlers,
+ struct smdk4x12_sensors_device *device)
+{
+ struct lsm330dlc_gyroscope_data *data = NULL;
+ char path[PATH_MAX] = { 0 };
+ int input_fd = -1;
+ int rc;
+
+ ALOGD("%s(%p, %p)", __func__, handlers, device);
+
+ if (handlers == NULL)
+ return -EINVAL;
+
+ data = (struct lsm330dlc_gyroscope_data *) calloc(1, sizeof(struct lsm330dlc_gyroscope_data));
+
+ input_fd = input_open("gyro_sensor");
+ if (input_fd < 0) {
+ ALOGE("%s: Unable to open input", __func__);
+ goto error;
+ }
+
+ rc = sysfs_path_prefix("gyro_sensor", (char *) &path);
+ if (rc < 0 || path[0] == '\0') {
+ ALOGE("%s: Unable to open sysfs", __func__);
+ goto error;
+ }
+
+ snprintf(data->path_enable, PATH_MAX, "%s/enable", path);
+ snprintf(data->path_delay, PATH_MAX, "%s/poll_delay", path);
+
+ handlers->poll_fd = input_fd;
+ handlers->data = (void *) data;
+
+ return 0;
+
+error:
+ if (data != NULL)
+ free(data);
+
+ if (input_fd >= 0)
+ close(input_fd);
+
+ handlers->poll_fd = -1;
+ handlers->data = NULL;
+
+ return -1;
+}
+
+int lsm330dlc_gyroscope_deinit(struct smdk4x12_sensors_handlers *handlers)
+{
+ ALOGD("%s(%p)", __func__, handlers);
+
+ if (handlers == NULL)
+ return -EINVAL;
+
+ if (handlers->poll_fd >= 0)
+ close(handlers->poll_fd);
+ handlers->poll_fd = -1;
+
+ if (handlers->data != NULL)
+ free(handlers->data);
+ handlers->data = NULL;
+
+ return 0;
+}
+
+int lsm330dlc_gyroscope_activate(struct smdk4x12_sensors_handlers *handlers)
+{
+ struct lsm330dlc_gyroscope_data *data;
+ int rc;
+
+ ALOGD("%s(%p)", __func__, handlers);
+
+ if (handlers == NULL || handlers->data == NULL)
+ return -EINVAL;
+
+ data = (struct lsm330dlc_gyroscope_data *) handlers->data;
+
+ rc = sysfs_value_write(data->path_enable, 1);
+ if (rc < 0) {
+ ALOGE("%s: Unable to write sysfs value", __func__);
+ return -1;
+ }
+
+ handlers->activated = 1;
+
+ return 0;
+}
+
+int lsm330dlc_gyroscope_deactivate(struct smdk4x12_sensors_handlers *handlers)
+{
+ struct lsm330dlc_gyroscope_data *data;
+ int rc;
+
+ ALOGD("%s(%p)", __func__, handlers);
+
+ if (handlers == NULL || handlers->data == NULL)
+ return -EINVAL;
+
+ data = (struct lsm330dlc_gyroscope_data *) handlers->data;
+
+ rc = sysfs_value_write(data->path_enable, 0);
+ if (rc < 0) {
+ ALOGE("%s: Unable to write sysfs value", __func__);
+ return -1;
+ }
+
+ handlers->activated = 1;
+
+ return 0;
+}
+
+int lsm330dlc_gyroscope_set_delay(struct smdk4x12_sensors_handlers *handlers, int64_t delay)
+{
+ struct lsm330dlc_gyroscope_data *data;
+ int rc;
+
+ ALOGD("%s(%p, %" PRId64 ")", __func__, handlers, delay);
+
+ if (handlers == NULL || handlers->data == NULL)
+ return -EINVAL;
+
+ data = (struct lsm330dlc_gyroscope_data *) handlers->data;
+
+ rc = sysfs_value_write(data->path_delay, delay);
+ if (rc < 0) {
+ ALOGE("%s: Unable to write sysfs value", __func__);
+ return -1;
+ }
+
+ return 0;
+}
+
+float lsm330dlc_gyroscope_convert(int value)
+{
+ return value * (70.0f / 4000.0f) * (3.1415926535f / 180.0f);
+}
+
+int lsm330dlc_gyroscope_get_data(struct smdk4x12_sensors_handlers *handlers,
+ struct sensors_event_t *event)
+{
+ struct lsm330dlc_gyroscope_data *data;
+ struct input_event input_event;
+ int input_fd;
+ int rc;
+
+// ALOGD("%s(%p, %p)", __func__, handlers, event);
+
+ if (handlers == NULL || handlers->data == NULL || event == NULL)
+ return -EINVAL;
+
+ data = (struct lsm330dlc_gyroscope_data *) handlers->data;
+
+ input_fd = handlers->poll_fd;
+ if (input_fd < 0)
+ return -EINVAL;
+
+ memset(event, 0, sizeof(struct sensors_event_t));
+ event->version = sizeof(struct sensors_event_t);
+ event->sensor = handlers->handle;
+ event->type = handlers->handle;
+
+ event->gyro.x = data->gyro.x;
+ event->gyro.y = data->gyro.y;
+ event->gyro.z = data->gyro.z;
+
+ event->gyro.status = SENSOR_STATUS_ACCURACY_MEDIUM;
+
+ do {
+ rc = read(input_fd, &input_event, sizeof(input_event));
+ if (rc < (int) sizeof(input_event))
+ break;
+
+ if (input_event.type == EV_REL) {
+ switch (input_event.code) {
+ case REL_RX:
+ event->gyro.x = lsm330dlc_gyroscope_convert(input_event.value);
+ break;
+ case REL_RY:
+ event->gyro.y = lsm330dlc_gyroscope_convert(input_event.value);
+ break;
+ case REL_RZ:
+ event->gyro.z = lsm330dlc_gyroscope_convert(input_event.value);
+ break;
+ default:
+ continue;
+ }
+ } else if (input_event.type == EV_SYN) {
+ if (input_event.code == SYN_REPORT)
+ event->timestamp = input_timestamp(&input_event);
+ }
+ } while (input_event.type != EV_SYN);
+
+ data->gyro.x = event->gyro.x;
+ data->gyro.y = event->gyro.y;
+ data->gyro.z = event->gyro.z;
+
+ return 0;
+}
+
+struct smdk4x12_sensors_handlers lsm330dlc_gyroscope = {
+ .name = "LSM330DLC Gyroscope",
+ .handle = SENSOR_TYPE_GYROSCOPE,
+ .init = lsm330dlc_gyroscope_init,
+ .deinit = lsm330dlc_gyroscope_deinit,
+ .activate = lsm330dlc_gyroscope_activate,
+ .deactivate = lsm330dlc_gyroscope_deactivate,
+ .set_delay = lsm330dlc_gyroscope_set_delay,
+ .get_data = lsm330dlc_gyroscope_get_data,
+ .activated = 0,
+ .needed = 0,
+ .poll_fd = -1,
+ .data = NULL,
+};
diff --git a/libsensors/sensors.cpp b/libsensors/sensors.cpp
deleted file mode 100644
index 74b7f21..0000000
--- a/libsensors/sensors.cpp
+++ /dev/null
@@ -1,395 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define ALOG_TAG "Sensors"
-
-#include <hardware/sensors.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <dirent.h>
-#include <math.h>
-#include <poll.h>
-#include <pthread.h>
-#include <stdlib.h>
-#include <cstring>
-
-#include <linux/input.h>
-
-#include <utils/Atomic.h>
-#include <utils/Log.h>
-
-#include "sensors.h"
-
-#include "LightSensor.h"
-#include "ProximitySensor.h"
-#include "AkmSensor.h"
-#include "GyroSensor.h"
-#include "AccelSensor.h"
-#include "PressureSensor.h"
-
-/*****************************************************************************/
-
-#define DELAY_OUT_TIME 0x7FFFFFFF
-
-#define LIGHT_SENSOR_POLLTIME 2000000000
-
-
-#define SENSORS_ACCELERATION (1<<ID_A)
-#define SENSORS_MAGNETIC_FIELD (1<<ID_M)
-#define SENSORS_ORIENTATION (1<<ID_O)
-#define SENSORS_LIGHT (1<<ID_L)
-#define SENSORS_PROXIMITY (1<<ID_P)
-#define SENSORS_GYROSCOPE (1<<ID_GY)
-#define SENSORY_PRESSURE (1<<ID_PR)
-
-#define SENSORS_ACCELERATION_HANDLE 0
-#define SENSORS_MAGNETIC_FIELD_HANDLE 1
-#define SENSORS_ORIENTATION_HANDLE 2
-#define SENSORS_LIGHT_HANDLE 3
-#define SENSORS_PROXIMITY_HANDLE 4
-#define SENSORS_GYROSCOPE_HANDLE 5
-#define SENSORS_PRESSURE_HANDLE 6
-
-#define AKM_FTRACE 0
-#define AKM_DEBUG 0
-#define AKM_DATA 0
-
-/*****************************************************************************/
-
-/* The SENSORS Module */
-static const struct sensor_t sSensorList[] = {
- { "LSM330DLC Acceleration Sensor",
- "STMicroelectronics",
- 1, SENSORS_ACCELERATION_HANDLE,
- SENSOR_TYPE_ACCELEROMETER, RANGE_A, 0.0096f, 0.23f, 10000, 0, 0,
- SENSOR_STRING_TYPE_ACCELEROMETER, "", 0, SENSOR_FLAG_CONTINUOUS_MODE, { } },
- { "AK8975C Magnetic field Sensor",
- "Asahi Kasei Microdevices",
- 1, SENSORS_MAGNETIC_FIELD_HANDLE,
- SENSOR_TYPE_MAGNETIC_FIELD, 2000.0f, CONVERT_M, 6.8f, 10000, 0, 0,
- SENSOR_STRING_TYPE_MAGNETIC_FIELD, "", 0, SENSOR_FLAG_CONTINUOUS_MODE, { } },
- { "LSM330DLC Gyroscope Sensor",
- "STMicroelectronics",
- 1, SENSORS_GYROSCOPE_HANDLE,
- SENSOR_TYPE_GYROSCOPE, RANGE_GYRO, CONVERT_GYRO, 6.1f, 5000, 0, 0,
- SENSOR_STRING_TYPE_GYROSCOPE, "", 0, SENSOR_FLAG_CONTINUOUS_MODE, { } },
- { "LPS331AP Pressure sensor",
- "STMicroelectronics",
- 1, SENSORS_PRESSURE_HANDLE,
- SENSOR_TYPE_PRESSURE, 1260.0f, 1.0f / 4096, 0.045f, 40000, 0, 0,
- SENSOR_STRING_TYPE_PRESSURE, "", 20000, SENSOR_FLAG_CONTINUOUS_MODE, { } },
- { "CM36651 Proximity Sensor",
- "Capella Microsystems",
- 1, SENSORS_PROXIMITY_HANDLE,
- SENSOR_TYPE_PROXIMITY, 6.0f, 6.0f, 1.3f, 0, 0, 0,
- SENSOR_STRING_TYPE_PROXIMITY, "", 0, SENSOR_FLAG_WAKE_UP | SENSOR_FLAG_ON_CHANGE_MODE, { } },
- { "CM36651 Light Sensor",
- "Capella Microsystems",
- 1, SENSORS_LIGHT_HANDLE,
- SENSOR_TYPE_LIGHT, 121240.0f, 1.0f, 0.2f, 0, 0, 0,
- SENSOR_STRING_TYPE_LIGHT, "", 0, SENSOR_FLAG_ON_CHANGE_MODE, { } },
-};
-
-
-static int open_sensors(const struct hw_module_t* module, const char* id,
- struct hw_device_t** device);
-
-
-static int sensors__get_sensors_list(struct sensors_module_t* module,
- struct sensor_t const** list)
-{
- *list = sSensorList;
- return ARRAY_SIZE(sSensorList);
-}
-
-static struct hw_module_methods_t sensors_module_methods = {
- open: open_sensors
-};
-
-struct sensors_module_t HAL_MODULE_INFO_SYM = {
- common: {
- tag: HARDWARE_MODULE_TAG,
- version_major: 1,
- version_minor: 0,
- id: SENSORS_HARDWARE_MODULE_ID,
- name: "Samsung Sensor module",
- author: "Samsung Electronic Company",
- methods: &sensors_module_methods,
- },
- get_sensors_list: sensors__get_sensors_list,
-};
-
-struct sensors_poll_context_t {
- sensors_poll_device_1_t device; // must be first
-
- sensors_poll_context_t();
- ~sensors_poll_context_t();
- int activate(int handle, int enabled);
- int setDelay(int handle, int64_t ns);
- int pollEvents(sensors_event_t* data, int count);
- int batch(int handle, int flags, int64_t period_ns, int64_t timeout);
-
- // return true if the constructor is completed
- bool isValid() { return mInitialized; };
- int flush(int handle);
-
-private:
- enum {
- light = 0,
- proximity = 1,
- akm = 2,
- gyro = 3,
- accel = 4,
- pressure = 5,
- numSensorDrivers,
- numFds,
- };
-
- static const size_t wake = numFds - 1;
- static const char WAKE_MESSAGE = 'W';
- struct pollfd mPollFds[numFds];
- int mWritePipeFd;
- SensorBase* mSensors[numSensorDrivers];
- // return true if the constructor is completed
- bool mInitialized;
-
- int handleToDriver(int handle) const {
- switch (handle) {
- case ID_A:
- return accel;
- case ID_M:
- case ID_O:
- return akm;
- case ID_P:
- return proximity;
- case ID_L:
- return light;
- case ID_GY:
- return gyro;
- case ID_PR:
- return pressure;
- }
- return -EINVAL;
- }
-};
-
-/*****************************************************************************/
-
-sensors_poll_context_t::sensors_poll_context_t()
-{
- mSensors[light] = new LightSensor();
- mPollFds[light].fd = mSensors[light]->getFd();
- mPollFds[light].events = POLLIN;
- mPollFds[light].revents = 0;
-
- mSensors[proximity] = new ProximitySensor();
- mPollFds[proximity].fd = mSensors[proximity]->getFd();
- mPollFds[proximity].events = POLLIN;
- mPollFds[proximity].revents = 0;
-
- mSensors[akm] = new AkmSensor();
- mPollFds[akm].fd = mSensors[akm]->getFd();
- mPollFds[akm].events = POLLIN;
- mPollFds[akm].revents = 0;
-
- mSensors[gyro] = new GyroSensor();
- mPollFds[gyro].fd = mSensors[gyro]->getFd();
- mPollFds[gyro].events = POLLIN;
- mPollFds[gyro].revents = 0;
-
- mSensors[accel] = new AccelSensor();
- mPollFds[accel].fd = mSensors[accel]->getFd();
- mPollFds[accel].events = POLLIN;
- mPollFds[accel].revents = 0;
-
- mSensors[pressure] = new PressureSensor();
- mPollFds[pressure].fd = mSensors[pressure]->getFd();
- mPollFds[pressure].events = POLLIN;
- mPollFds[pressure].revents = 0;
-
- int wakeFds[2];
- int result = pipe(wakeFds);
- ALOGE_IF(result<0, "error creating wake pipe (%s)", strerror(errno));
- fcntl(wakeFds[0], F_SETFL, O_NONBLOCK);
- fcntl(wakeFds[1], F_SETFL, O_NONBLOCK);
- mWritePipeFd = wakeFds[1];
-
- mPollFds[wake].fd = wakeFds[0];
- mPollFds[wake].events = POLLIN;
- mPollFds[wake].revents = 0;
- mInitialized = true;
-}
-
-sensors_poll_context_t::~sensors_poll_context_t() {
- for (int i=0 ; i<numSensorDrivers ; i++) {
- delete mSensors[i];
- }
- close(mPollFds[wake].fd);
- close(mWritePipeFd);
- mInitialized = false;
-}
-
-int sensors_poll_context_t::activate(int handle, int enabled) {
- if (!mInitialized) return -EINVAL;
- int index = handleToDriver(handle);
- //ALOGI("Sensors: handle: %i", handle);
- if (index < 0) return index;
- int err = mSensors[index]->enable(handle, enabled);
- if (enabled && !err) {
- const char wakeMessage(WAKE_MESSAGE);
- int result = write(mWritePipeFd, &wakeMessage, 1);
- ALOGE_IF(result<0, "error sending wake message (%s)", strerror(errno));
- }
- return err;
-}
-
-int sensors_poll_context_t::setDelay(int handle, int64_t ns) {
-
- int index = handleToDriver(handle);
- if (index < 0) return index;
- return mSensors[index]->setDelay(handle, ns);
-}
-
-int sensors_poll_context_t::pollEvents(sensors_event_t* data, int count)
-{
- int nbEvents = 0;
- int n = 0;
-
- do {
- // see if we have some leftover from the last poll()
- for (int i=0 ; count && i<numSensorDrivers ; i++) {
- SensorBase* const sensor(mSensors[i]);
- if ((mPollFds[i].revents & POLLIN) || (sensor->hasPendingEvents())) {
- int nb = sensor->readEvents(data, count);
- if (nb < count) {
- // no more data for this sensor
- mPollFds[i].revents = 0;
- }
- count -= nb;
- nbEvents += nb;
- data += nb;
- }
- }
-
- if (count) {
- // we still have some room, so try to see if we can get
- // some events immediately or just wait if we don't have
- // anything to return
- n = poll(mPollFds, numFds, nbEvents ? 0 : -1);
- if (n<0) {
- ALOGE("poll() failed (%s)", strerror(errno));
- return -errno;
- }
- if (mPollFds[wake].revents & POLLIN) {
- char msg;
- int result = read(mPollFds[wake].fd, &msg, 1);
- ALOGE_IF(result<0, "error reading from wake pipe (%s)", strerror(errno));
- ALOGE_IF(msg != WAKE_MESSAGE, "unknown message on wake queue (0x%02x)", int(msg));
- mPollFds[wake].revents = 0;
- }
- }
- // if we have events and space, go read them
- } while (n && count);
-
- return nbEvents;
-}
-
-int sensors_poll_context_t::batch(int handle, int flags, int64_t period_ns, int64_t timeout)
-{
- int index = handleToDriver(handle);
- if (index < 0) return index;
- return mSensors[index]->batch(handle, flags, period_ns, timeout);
-}
-
-int sensors_poll_context_t::flush(int handle)
-{
- int index = handleToDriver(handle);
- if (index < 0) return index;
- return mSensors[index]->flush(handle);
-}
-
-/*****************************************************************************/
-
-static int poll__close(struct hw_device_t *dev)
-{
- sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev;
- if (ctx) {
- delete ctx;
- }
- return 0;
-}
-
-static int poll__activate(struct sensors_poll_device_t *dev,
- int handle, int enabled) {
- sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev;
- return ctx->activate(handle, enabled);
-}
-
-static int poll__setDelay(struct sensors_poll_device_t *dev,
- int handle, int64_t ns) {
- sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev;
- return ctx->setDelay(handle, ns);
-}
-
-static int poll__poll(struct sensors_poll_device_t *dev,
- sensors_event_t* data, int count) {
- sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev;
- return ctx->pollEvents(data, count);
-}
-
-static int poll__batch(struct sensors_poll_device_1 *dev,
- int handle, int flags, int64_t period_ns, int64_t timeout)
-{
- sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev;
- return ctx->batch(handle, flags, period_ns, timeout);
-}
-
-static int poll__flush(struct sensors_poll_device_1 *dev,
- int handle)
-{
- sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev;
- return ctx->flush(handle);
-}
-
-/*****************************************************************************/
-
-/** Open a new instance of a sensor device using name */
-static int open_sensors(const struct hw_module_t* module, const char* id,
- struct hw_device_t** device)
-{
- int status = -EINVAL;
- sensors_poll_context_t *dev = new sensors_poll_context_t();
-
- memset(&dev->device, 0, sizeof(sensors_poll_device_1));
-
- dev->device.common.tag = HARDWARE_DEVICE_TAG;
- dev->device.common.version = SENSORS_DEVICE_API_VERSION_1_0;
- dev->device.common.module = const_cast<hw_module_t*>(module);
- dev->device.common.close = poll__close;
- dev->device.activate = poll__activate;
- dev->device.setDelay = poll__setDelay;
- dev->device.poll = poll__poll;
-
- /* Batch processing */
- dev->device.batch = poll__batch;
- dev->device.flush = poll__flush;
-
- *device = &dev->device.common;
- status = 0;
-
- return status;
-}
-
diff --git a/libsensors/sensors.h b/libsensors/sensors.h
deleted file mode 100644
index 0d61ac2..0000000
--- a/libsensors/sensors.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_SENSORS_H
-#define ANDROID_SENSORS_H
-
-#include <stdint.h>
-#include <errno.h>
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-#include <linux/input.h>
-
-#include <hardware/hardware.h>
-#include <hardware/sensors.h>
-
-__BEGIN_DECLS
-
-/*****************************************************************************/
-
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
-
-#define LOG_TAG "sensorscpp"
-
-#define ID_A (0)
-#define ID_M (1)
-#define ID_O (2)
-#define ID_L (3)
-#define ID_P (4)
-#define ID_GY (5)
-#define ID_PR (6)
-
-/*****************************************************************************/
-
-/*
- * The SENSORS Module
- */
-
-/* the CM3663 is a binary proximity sensor that triggers around 6 cm on
- * this hardware */
-#define PROXIMITY_THRESHOLD_CM 6.0f
-
-/*****************************************************************************/
-
-#define EVENT_TYPE_ACCEL_X ABS_X //1
-#define EVENT_TYPE_ACCEL_Y ABS_Y //0
-#define EVENT_TYPE_ACCEL_Z ABS_Z //2
-
-#define EVENT_TYPE_YAW ABS_RX //3
-#define EVENT_TYPE_PITCH ABS_RY //4
-#define EVENT_TYPE_ROLL ABS_RZ //5
-#define EVENT_TYPE_ORIENT_STATUS ABS_WHEEL //8
-
-#define EVENT_TYPE_MAGV_X ABS_THROTTLE // 6
-#define EVENT_TYPE_MAGV_Y ABS_RUDDER // 7
-#define EVENT_TYPE_MAGV_Z ABS_GAS // 9
-#define EVENT_TYPE_MAGV_ACC ABS_WHEEL // 8
-
-#define EVENT_TYPE_TEMPERATURE ABS_THROTTLE
-#define EVENT_TYPE_STEP_COUNT ABS_GAS
-#define EVENT_TYPE_PROXIMITY ABS_DISTANCE
-#define EVENT_TYPE_LIGHT REL_MISC
-
-#define EVENT_TYPE_GYRO_X REL_RX
-#define EVENT_TYPE_GYRO_Y REL_RY
-#define EVENT_TYPE_GYRO_Z REL_RZ
-
-#define EVENT_TYPE_PRESSURE REL_X
-
-#define LSG (1000.0f)
-
-// conversion of acceleration data to SI units (m/s^2)
-#define RANGE_A (2*GRAVITY_EARTH)
-#define RESOLUTION_A (GRAVITY_EARTH / LSG)
-#define CONVERT_A (GRAVITY_EARTH / LSG)
-#define CONVERT_A_X (CONVERT_A)
-#define CONVERT_A_Y (CONVERT_A)
-#define CONVERT_A_Z (CONVERT_A)
-
-// conversion of magnetic data to uT units
-#define CONVERT_M (1.0f/16.0f)
-#define CONVERT_M_X (-CONVERT_M)
-#define CONVERT_M_Y (-CONVERT_M)
-#define CONVERT_M_Z (CONVERT_M)
-
-// conversion of gyro data to SI units (radian/sec)
-#define RANGE_GYRO (500.0f*(float)M_PI/180.0f)
-#define CONVERT_GYRO ((70.0f / 4000.0f) * ((float)M_PI / 180.0f))
-#define CONVERT_GYRO_X (CONVERT_GYRO)
-#define CONVERT_GYRO_Y (CONVERT_GYRO)
-#define CONVERT_GYRO_Z (CONVERT_GYRO)
-
-#define SENSOR_STATE_MASK (0x7FFF)
-
-/*****************************************************************************/
-
-__END_DECLS
-
-#endif // ANDROID_SENSORS_H
diff --git a/libsensors/smdk4x12_sensors.c b/libsensors/smdk4x12_sensors.c
new file mode 100644
index 0000000..4cbc7c2
--- /dev/null
+++ b/libsensors/smdk4x12_sensors.c
@@ -0,0 +1,295 @@
+/*
+ * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <poll.h>
+#include <sys/select.h>
+#include <hardware/sensors.h>
+#include <hardware/hardware.h>
+
+#define LOG_TAG "smdk4x12_sensors"
+#include <utils/Log.h>
+
+#include "smdk4x12_sensors.h"
+
+/*
+ * Sensors list
+ */
+
+struct sensor_t smdk4x12_sensors[] = {
+ { "LSM330DLC 3-Axis Accelerometer", "STMicroelectronics", 1, SENSOR_TYPE_ACCELEROMETER,
+ SENSOR_TYPE_ACCELEROMETER, 2 * GRAVITY_EARTH, 0.0096f, 0.23f, 10000, 0, 0, SENSOR_STRING_TYPE_ACCELEROMETER, 0, 0,
+ SENSOR_FLAG_CONTINUOUS_MODE, {}, },
+ { "AKM8975C 3-Axis Magnetic Sensor", "Asahi Kasei", 1, SENSOR_TYPE_MAGNETIC_FIELD,
+ SENSOR_TYPE_MAGNETIC_FIELD, 2000.0f, 1.0f / 16, 6.8f, 10000, 0, 0, SENSOR_STRING_TYPE_MAGNETIC_FIELD, 0, 0,
+ SENSOR_FLAG_CONTINUOUS_MODE, {}, },
+ { "CM36651 Light Sensor", "Capella", 1, SENSOR_TYPE_LIGHT,
+ SENSOR_TYPE_LIGHT, 121240.0f, 1.0f, 0.2f, 0, 0, 0, SENSOR_STRING_TYPE_LIGHT, 0, 0,
+ SENSOR_FLAG_ON_CHANGE_MODE, {}, },
+ { "CM36651 Proximity Sensor", "Capella", 1, SENSOR_TYPE_PROXIMITY,
+ SENSOR_TYPE_PROXIMITY, 8.0f, 8.0f, 1.3f, 0, 0, 0, SENSOR_STRING_TYPE_PROXIMITY, 0, 0,
+ SENSOR_FLAG_WAKE_UP | SENSOR_FLAG_ON_CHANGE_MODE, {}, },
+ { "LSM330DLC Gyroscope Sensor", "STMicroelectronics", 1, SENSOR_TYPE_GYROSCOPE,
+ SENSOR_TYPE_GYROSCOPE, 500.0f * (3.1415926535f / 180.0f), (70.0f / 4000.0f) * (3.1415926535f / 180.0f), 6.1f, 5000, 0, 0, SENSOR_STRING_TYPE_GYROSCOPE, 0, 0,
+ SENSOR_FLAG_CONTINUOUS_MODE, {}, },
+ { "LPS331AP Pressure Sensor", "STMicroelectronics", 1, SENSOR_TYPE_PRESSURE,
+ SENSOR_TYPE_PRESSURE, 1260.0f, 1.0f / 4096, 0.045f, 40000, 0, 0, SENSOR_STRING_TYPE_PRESSURE, 0, 20000,
+ SENSOR_FLAG_CONTINUOUS_MODE, {}, },
+};
+
+int smdk4x12_sensors_count = sizeof(smdk4x12_sensors) / sizeof(struct sensor_t);
+
+struct smdk4x12_sensors_handlers *smdk4x12_sensors_handlers[] = {
+ &lsm330dlc_acceleration,
+ &akm8975,
+ &cm36651_proximity,
+ &cm36651_light,
+ &lsm330dlc_gyroscope,
+ &lps331ap,
+};
+
+int smdk4x12_sensors_handlers_count = sizeof(smdk4x12_sensors_handlers) /
+ sizeof(struct smdk4x12_sensors_handlers *);
+
+/*
+ * SMDK4x12 Sensors
+ */
+
+int smdk4x12_sensors_activate(struct sensors_poll_device_t *dev, int handle,
+ int enabled)
+{
+ struct smdk4x12_sensors_device *device;
+ int i;
+
+ ALOGD("%s(%p, %d, %d)", __func__, dev, handle, enabled);
+
+ if (dev == NULL)
+ return -EINVAL;
+
+ device = (struct smdk4x12_sensors_device *) dev;
+
+ if (device->handlers == NULL || device->handlers_count <= 0)
+ return -EINVAL;
+
+ for (i = 0; i < device->handlers_count; i++) {
+ if (device->handlers[i] == NULL)
+ continue;
+
+ if (device->handlers[i]->handle == handle) {
+ if (enabled && device->handlers[i]->activate != NULL) {
+ device->handlers[i]->needed |= SMDK4x12_SENSORS_NEEDED_API;
+ if (device->handlers[i]->needed == SMDK4x12_SENSORS_NEEDED_API)
+ return device->handlers[i]->activate(device->handlers[i]);
+ else
+ return 0;
+ } else if (!enabled && device->handlers[i]->deactivate != NULL) {
+ device->handlers[i]->needed &= ~SMDK4x12_SENSORS_NEEDED_API;
+ if (device->handlers[i]->needed == 0)
+ return device->handlers[i]->deactivate(device->handlers[i]);
+ else
+ return 0;
+ }
+ }
+ }
+
+ return -1;
+}
+
+int smdk4x12_sensors_set_delay(struct sensors_poll_device_t *dev, int handle,
+ int64_t ns)
+{
+ struct smdk4x12_sensors_device *device;
+ int i;
+
+ ALOGD("%s(%p, %d, %" PRId64 ")", __func__, dev, handle, ns);
+
+ if (dev == NULL)
+ return -EINVAL;
+
+ device = (struct smdk4x12_sensors_device *) dev;
+
+ if (device->handlers == NULL || device->handlers_count <= 0)
+ return -EINVAL;
+
+ for (i = 0; i < device->handlers_count; i++) {
+ if (device->handlers[i] == NULL)
+ continue;
+
+ if (device->handlers[i]->handle == handle && device->handlers[i]->set_delay != NULL)
+ return device->handlers[i]->set_delay(device->handlers[i], ns);
+ }
+
+ return 0;
+}
+
+int smdk4x12_sensors_poll(struct sensors_poll_device_t *dev,
+ struct sensors_event_t* data, int count)
+{
+ struct smdk4x12_sensors_device *device;
+ int i, j;
+ int c, n;
+ int poll_rc, rc;
+
+// ALOGD("%s(%p, %p, %d)", __func__, dev, data, count);
+
+ if (dev == NULL)
+ return -EINVAL;
+
+ device = (struct smdk4x12_sensors_device *) dev;
+
+ if (device->handlers == NULL || device->handlers_count <= 0 ||
+ device->poll_fds == NULL || device->poll_fds_count <= 0)
+ return -EINVAL;
+
+ n = 0;
+
+ do {
+ poll_rc = poll(device->poll_fds, device->poll_fds_count, n > 0 ? 0 : -1);
+ if (poll_rc < 0)
+ return -1;
+
+ for (i = 0; i < device->poll_fds_count; i++) {
+ if (!(device->poll_fds[i].revents & POLLIN))
+ continue;
+
+ for (j = 0; j < device->handlers_count; j++) {
+ if (device->handlers[j] == NULL || device->handlers[j]->poll_fd != device->poll_fds[i].fd || device->handlers[j]->get_data == NULL)
+ continue;
+
+ rc = device->handlers[j]->get_data(device->handlers[j], &data[n]);
+ if (rc < 0) {
+ device->poll_fds[i].revents = 0;
+ poll_rc = -1;
+ } else {
+ n++;
+ count--;
+ }
+ }
+ }
+ } while ((poll_rc > 0 || n < 1) && count > 0);
+
+ return n;
+}
+
+/*
+ * Interface
+ */
+
+int smdk4x12_sensors_close(hw_device_t *device)
+{
+ struct smdk4x12_sensors_device *smdk4x12_sensors_device;
+ int i;
+
+ ALOGD("%s(%p)", __func__, device);
+
+ if (device == NULL)
+ return -EINVAL;
+
+ smdk4x12_sensors_device = (struct smdk4x12_sensors_device *) device;
+
+ if (smdk4x12_sensors_device->poll_fds != NULL)
+ free(smdk4x12_sensors_device->poll_fds);
+
+ for (i = 0; i < smdk4x12_sensors_device->handlers_count; i++) {
+ if (smdk4x12_sensors_device->handlers[i] == NULL || smdk4x12_sensors_device->handlers[i]->deinit == NULL)
+ continue;
+
+ smdk4x12_sensors_device->handlers[i]->deinit(smdk4x12_sensors_device->handlers[i]);
+ }
+
+ free(device);
+
+ return 0;
+}
+
+int smdk4x12_sensors_open(const struct hw_module_t* module, const char *id,
+ struct hw_device_t** device)
+{
+ struct smdk4x12_sensors_device *smdk4x12_sensors_device;
+ int p, i;
+
+ ALOGD("%s(%p, %s, %p)", __func__, module, id, device);
+
+ if (module == NULL || device == NULL)
+ return -EINVAL;
+
+ smdk4x12_sensors_device = (struct smdk4x12_sensors_device *)
+ calloc(1, sizeof(struct smdk4x12_sensors_device));
+ smdk4x12_sensors_device->device.common.tag = HARDWARE_DEVICE_TAG;
+ smdk4x12_sensors_device->device.common.version = 0;
+ smdk4x12_sensors_device->device.common.module = (struct hw_module_t *) module;
+ smdk4x12_sensors_device->device.common.close = smdk4x12_sensors_close;
+ smdk4x12_sensors_device->device.activate = smdk4x12_sensors_activate;
+ smdk4x12_sensors_device->device.setDelay = smdk4x12_sensors_set_delay;
+ smdk4x12_sensors_device->device.poll = smdk4x12_sensors_poll;
+ smdk4x12_sensors_device->handlers = smdk4x12_sensors_handlers;
+ smdk4x12_sensors_device->handlers_count = smdk4x12_sensors_handlers_count;
+ smdk4x12_sensors_device->poll_fds = (struct pollfd *)
+ calloc(1, smdk4x12_sensors_handlers_count * sizeof(struct pollfd));
+
+ p = 0;
+ for (i = 0; i < smdk4x12_sensors_handlers_count; i++) {
+ if (smdk4x12_sensors_handlers[i] == NULL || smdk4x12_sensors_handlers[i]->init == NULL)
+ continue;
+
+ smdk4x12_sensors_handlers[i]->init(smdk4x12_sensors_handlers[i], smdk4x12_sensors_device);
+ if (smdk4x12_sensors_handlers[i]->poll_fd >= 0) {
+ smdk4x12_sensors_device->poll_fds[p].fd = smdk4x12_sensors_handlers[i]->poll_fd;
+ smdk4x12_sensors_device->poll_fds[p].events = POLLIN;
+ p++;
+ }
+ }
+
+ smdk4x12_sensors_device->poll_fds_count = p;
+
+ *device = &(smdk4x12_sensors_device->device.common);
+
+ return 0;
+}
+
+int smdk4x12_sensors_get_sensors_list(struct sensors_module_t* module,
+ const struct sensor_t **sensors_p)
+{
+ ALOGD("%s(%p, %p)", __func__, module, sensors_p);
+
+ if (sensors_p == NULL)
+ return -EINVAL;
+
+ *sensors_p = smdk4x12_sensors;
+ return smdk4x12_sensors_count;
+}
+
+struct hw_module_methods_t smdk4x12_sensors_module_methods = {
+ .open = smdk4x12_sensors_open,
+};
+
+struct sensors_module_t HAL_MODULE_INFO_SYM = {
+ .common = {
+ .tag = HARDWARE_MODULE_TAG,
+ .version_major = 1,
+ .version_minor = 0,
+ .id = SENSORS_HARDWARE_MODULE_ID,
+ .name = "SMDK4x12 Sensors",
+ .author = "Paul Kocialkowski",
+ .methods = &smdk4x12_sensors_module_methods,
+ },
+ .get_sensors_list = smdk4x12_sensors_get_sensors_list,
+};
diff --git a/libsensors/smdk4x12_sensors.h b/libsensors/smdk4x12_sensors.h
new file mode 100644
index 0000000..7100334
--- /dev/null
+++ b/libsensors/smdk4x12_sensors.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdint.h>
+#include <poll.h>
+#include <linux/input.h>
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
+
+#include <hardware/sensors.h>
+#include <hardware/hardware.h>
+
+#ifndef _SMDK4x12_SENSORS_H_
+#define _SMDK4x12_SENSORS_H_
+
+#define SMDK4x12_SENSORS_NEEDED_API (1 << 0)
+
+struct smdk4x12_sensors_device;
+
+struct smdk4x12_sensors_handlers {
+ char *name;
+ int handle;
+
+ int (*init)(struct smdk4x12_sensors_handlers *handlers,
+ struct smdk4x12_sensors_device *device);
+ int (*deinit)(struct smdk4x12_sensors_handlers *handlers);
+ int (*activate)(struct smdk4x12_sensors_handlers *handlers);
+ int (*deactivate)(struct smdk4x12_sensors_handlers *handlers);
+ int (*set_delay)(struct smdk4x12_sensors_handlers *handlers,
+ int64_t delay);
+ int (*get_data)(struct smdk4x12_sensors_handlers *handlers,
+ struct sensors_event_t *event);
+
+ int activated;
+ int needed;
+ int poll_fd;
+
+ void *data;
+};
+
+struct smdk4x12_sensors_device {
+ struct sensors_poll_device_t device;
+
+ struct smdk4x12_sensors_handlers **handlers;
+ int handlers_count;
+
+ struct pollfd *poll_fds;
+ int poll_fds_count;
+};
+
+extern struct smdk4x12_sensors_handlers *smdk4x12_sensors_handlers[];
+extern int smdk4x12_sensors_handlers_count;
+
+int smdk4x12_sensors_activate(struct sensors_poll_device_t *dev, int handle,
+ int enabled);
+int smdk4x12_sensors_set_delay(struct sensors_poll_device_t *dev, int handle,
+ int64_t ns);
+int smdk4x12_sensors_poll(struct sensors_poll_device_t *dev,
+ struct sensors_event_t* data, int count);
+
+/*
+ * Input
+ */
+
+void input_event_set(struct input_event *event, int type, int code, int value);
+int64_t timestamp(struct timeval *time);
+int64_t input_timestamp(struct input_event *event);
+int uinput_rel_create(const char *name);
+void uinput_destroy(int uinput_fd);
+int input_open(char *name);
+int sysfs_path_prefix(char *name, char *path_prefix);
+int64_t sysfs_value_read(char *path);
+int sysfs_value_write(char *path, int64_t value);
+int sysfs_string_read(char *path, char *buffer, size_t length);
+int sysfs_string_write(char *path, char *buffer, size_t length);
+
+/*
+ * Sensors
+ */
+
+extern struct smdk4x12_sensors_handlers lsm330dlc_acceleration;
+extern struct smdk4x12_sensors_handlers akm8975;
+extern struct smdk4x12_sensors_handlers cm36651_proximity;
+extern struct smdk4x12_sensors_handlers cm36651_light;
+extern struct smdk4x12_sensors_handlers lsm330dlc_gyroscope;
+extern struct smdk4x12_sensors_handlers lps331ap;
+
+#endif
diff --git a/lineage.mk b/lineage.mk
index 3aebf8e..116268c 100644
--- a/lineage.mk
+++ b/lineage.mk
@@ -2,18 +2,17 @@
PRODUCT_RELEASE_NAME := i9300
# Boot animation
-TARGET_SCREEN_HEIGHT := 1280
-TARGET_SCREEN_WIDTH := 720
+TARGET_BOOTANIMATION_NAME := vertical-720x1280
# Inherit some common stuff.
-$(call inherit-product, vendor/cm/config/common_full_phone.mk)
+$(call inherit-product, vendor/replicant/config/common_full_phone.mk)
# Inherit device configuration
$(call inherit-product, device/samsung/i9300/full_i9300.mk)
# Device identifier. This must come after all inclusions
PRODUCT_DEVICE := i9300
-PRODUCT_NAME := lineage_i9300
+PRODUCT_NAME := replicant_i9300
PRODUCT_BRAND := samsung
PRODUCT_MODEL := GT-I9300
PRODUCT_MANUFACTURER := samsung
diff --git a/mkbootimg.mk b/mkbootimg.mk
new file mode 100644
index 0000000..5211cce
--- /dev/null
+++ b/mkbootimg.mk
@@ -0,0 +1,29 @@
+LOCAL_PATH := $(call my-dir)
+
+DTB_FILE = $(KERNEL_OUT)/arch/arm/boot/dts/exynos4412-trats2.dtb
+KERNEL_ZIMG = $(KERNEL_OUT)/arch/arm/boot/zImage
+KERNEL_ZIMG_DTB = $(KERNEL_ZIMG)-dtb
+KERNEL_APP = $(OUT)/kernel
+
+$(KERNEL_ZIMG_DTB): $(KERNEL_APP)
+ cat $(KERNEL_ZIMG) $(DTB_FILE) > $(KERNEL_ZIMG_DTB);
+ rm -f $(KERNEL_APP);
+ cp $(KERNEL_ZIMG_DTB) $(KERNEL_APP);
+
+## Overload bootimg generation: Same as the original, except use appended dtb kernel
+$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(KERNEL_ZIMG_DTB)
+ $(call pretty,"Target boot image: $@")
+ $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
+ $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE),raw)
+ @echo -e ${CL_CYN}"Made boot image: $@"${CL_RST}
+
+## Overload recoveryimg generation: Same as the original, except use appended dtb kernel
+$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTIMG) \
+ $(recovery_ramdisk) \
+ $(recovery_kernel) \
+ $(KERNEL_ZIMG_DTB)
+ @echo -e ${CL_CYN}"----- Making recovery image ------"${CL_RST}
+ $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
+ $(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE),raw)
+ @echo -e ${CL_CYN}"Made recovery image: $@"${CL_RST}
+
diff --git a/res/charger/LICENSE b/res/charger/LICENSE
new file mode 100644
index 0000000..732945d
--- /dev/null
+++ b/res/charger/LICENSE
@@ -0,0 +1,2 @@
+Copyright: Copyright (C) 2012-2013 Paul Kocialkowski <contact@paulk.fr>
+License: Creative Commons BY-SA 3.0 <http://creativecommons.org/licenses/by-sa/3.0/>
diff --git a/res/charger/battery_0.png b/res/charger/battery_0.png
new file mode 100644
index 0000000..a204975
--- /dev/null
+++ b/res/charger/battery_0.png
Binary files differ
diff --git a/res/charger/battery_1.png b/res/charger/battery_1.png
new file mode 100644
index 0000000..659f30c
--- /dev/null
+++ b/res/charger/battery_1.png
Binary files differ
diff --git a/res/charger/battery_2.png b/res/charger/battery_2.png
new file mode 100644
index 0000000..c6f9da1
--- /dev/null
+++ b/res/charger/battery_2.png
Binary files differ
diff --git a/res/charger/battery_3.png b/res/charger/battery_3.png
new file mode 100644
index 0000000..4dbdc22
--- /dev/null
+++ b/res/charger/battery_3.png
Binary files differ
diff --git a/res/charger/battery_4.png b/res/charger/battery_4.png
new file mode 100644
index 0000000..3af128a
--- /dev/null
+++ b/res/charger/battery_4.png
Binary files differ
diff --git a/res/charger/battery_5.png b/res/charger/battery_5.png
new file mode 100644
index 0000000..45f83d1
--- /dev/null
+++ b/res/charger/battery_5.png
Binary files differ
diff --git a/res/charger/battery_charge.png b/res/charger/battery_charge.png
new file mode 100644
index 0000000..fa1657f
--- /dev/null
+++ b/res/charger/battery_charge.png
Binary files differ
diff --git a/res/charger/battery_fail.png b/res/charger/battery_fail.png
new file mode 100644
index 0000000..5f0bbe5
--- /dev/null
+++ b/res/charger/battery_fail.png
Binary files differ
diff --git a/res/charger/charger.svg b/res/charger/charger.svg
new file mode 100644
index 0000000..6196388
--- /dev/null
+++ b/res/charger/charger.svg
@@ -0,0 +1,2418 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="187"
+ height="564"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.48.3.1 r9886"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"
+ sodipodi:docname="charger.svg">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3876">
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="0"
+ id="stop3878" />
+ <stop
+ id="stop3880"
+ offset="0.62347519"
+ style="stop-color:#4d4d4d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#353535;stop-opacity:1;"
+ offset="1"
+ id="stop3882" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2"
+ id="radialGradient4013-0"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,-9.214312,24.642857,0,-14153.154,1325.5074)"
+ cx="94.016861"
+ cy="589.05499"
+ fx="94.016861"
+ fy="589.05499"
+ r="4" />
+ <linearGradient
+ id="linearGradient3845-2">
+ <stop
+ style="stop-color:#4d4d4d;stop-opacity:1;"
+ offset="0"
+ id="stop3847-0" />
+ <stop
+ id="stop3849-4"
+ offset="0.89999998"
+ style="stop-color:#141718;stop-opacity:1;" />
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="1"
+ id="stop3851-5" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3861-3"
+ id="radialGradient4016-5"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.45000156,-25.35364,17.785385,0.31567267,-10088.447,2350.2101)"
+ cx="94.009636"
+ cy="584.68146"
+ fx="94.009636"
+ fy="584.68146"
+ r="4" />
+ <linearGradient
+ id="linearGradient3861-3">
+ <stop
+ id="stop3863-1"
+ offset="0"
+ style="stop-color:#4d4d4d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#353535;stop-opacity:1;"
+ offset="0.3948195"
+ id="stop3865-9" />
+ <stop
+ id="stop3867-6"
+ offset="1"
+ style="stop-color:#353535;stop-opacity:1;" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2"
+ id="radialGradient4019-4"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.07087723,9.2140394,-23.214285,0.17857142,13930.878,-799.18847)"
+ cx="93.842445"
+ cy="584.81299"
+ fx="93.842445"
+ fy="584.81299"
+ r="4" />
+ <linearGradient
+ id="linearGradient4096">
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="0"
+ id="stop4098" />
+ <stop
+ id="stop4100"
+ offset="0.89999998"
+ style="stop-color:#4d4d4d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#353535;stop-opacity:1;"
+ offset="1"
+ id="stop4102" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3804-7"
+ id="linearGradient4022-1"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(480,270)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <linearGradient
+ id="linearGradient3804-7">
+ <stop
+ id="stop3806-8"
+ offset="0"
+ style="stop-color:#141718;stop-opacity:1;" />
+ <stop
+ style="stop-color:#4d4d4d;stop-opacity:1;"
+ offset="0.47889951"
+ id="stop3808-4" />
+ <stop
+ id="stop3810-9"
+ offset="1"
+ style="stop-color:#353535;stop-opacity:1;" />
+ </linearGradient>
+ <linearGradient
+ y2="524.50104"
+ x2="398"
+ y1="649.9967"
+ x1="398"
+ gradientTransform="matrix(0.93333333,0,0,1.496,-546.82888,-517.44568)"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient4113"
+ xlink:href="#linearGradient3876"
+ inkscape:collect="always" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3948-8"
+ id="linearGradient4005-6"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.6,0,0,1.0399999,323.2,-1594.6988)"
+ x1="253.34712"
+ y1="646.96625"
+ x2="253.34712"
+ y2="523.0683" />
+ <linearGradient
+ id="linearGradient3948-8">
+ <stop
+ style="stop-color:#000000;stop-opacity:0.39215687;"
+ offset="0"
+ id="stop3950-1" />
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="1"
+ id="stop3952-6" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3948-8-2"
+ id="linearGradient4005-6-5"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.6,0,0,1.0399999,323.2,-1594.6988)"
+ x1="253.34712"
+ y1="646.96625"
+ x2="253.34712"
+ y2="523.0683" />
+ <linearGradient
+ id="linearGradient3948-8-2">
+ <stop
+ style="stop-color:#000000;stop-opacity:0.39215687;"
+ offset="0"
+ id="stop3950-1-4" />
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="1"
+ id="stop3952-6-1" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2"
+ id="radialGradient4080"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,9.214312,-24.642857,0,14874.154,-398.82369)"
+ cx="94.016861"
+ cy="589.05499"
+ fx="94.016861"
+ fy="589.05499"
+ r="4" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3876"
+ id="linearGradient4089"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,0.93333333,-1.496,0,1238.4457,607.49265)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3948-8-2"
+ id="linearGradient4094"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.62333333,0,0,-2.6966499,205.91708,2214.1956)"
+ x1="253.34712"
+ y1="646.05676"
+ x2="253.34712"
+ y2="610.20563" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3876"
+ id="linearGradient4200"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.93333333,0,0,1.496,-546.82888,-517.44568)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2"
+ id="radialGradient4202"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.07087723,9.2140394,-23.214285,0.17857142,13930.878,-799.18847)"
+ cx="93.842445"
+ cy="584.81299"
+ fx="93.842445"
+ fy="584.81299"
+ r="4" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3861-3"
+ id="radialGradient4204"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.45000156,-25.35364,17.785385,0.31567267,-10088.447,2350.2101)"
+ cx="94.009636"
+ cy="584.68146"
+ fx="94.009636"
+ fy="584.68146"
+ r="4" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2"
+ id="radialGradient4206"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,-9.214312,24.642857,0,-14153.154,1325.5074)"
+ cx="94.016861"
+ cy="589.05499"
+ fx="94.016861"
+ fy="589.05499"
+ r="4" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3876"
+ id="linearGradient4208"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,0.93333333,-1.496,0,1238.4457,607.49265)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2"
+ id="radialGradient4210"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,9.214312,-24.642857,0,14874.154,-398.82369)"
+ cx="94.016861"
+ cy="589.05499"
+ fx="94.016861"
+ fy="589.05499"
+ r="4" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3948-8-2"
+ id="linearGradient4212"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.62333333,0,0,-2.6966499,205.91708,2214.1956)"
+ x1="253.34712"
+ y1="646.05676"
+ x2="253.34712"
+ y2="610.20563" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3948-8-2"
+ id="linearGradient4215"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.62333333,0,0,-2.6966499,205.41706,2214.1956)"
+ x1="253.34712"
+ y1="646.05676"
+ x2="253.34712"
+ y2="610.20563" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2"
+ id="radialGradient4218"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,9.214312,-24.642857,0,14873.654,-398.82369)"
+ cx="94.016861"
+ cy="589.05499"
+ fx="94.016861"
+ fy="589.05499"
+ r="4" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3876"
+ id="linearGradient4221"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,0.93333333,-1.496,0,1237.9457,379.85483)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3876"
+ id="linearGradient4325"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.93333333,0,0,1.496,-546.82888,-517.44568)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2"
+ id="radialGradient4327"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.07087723,9.2140394,-23.214285,0.17857142,13930.878,-799.18847)"
+ cx="93.842445"
+ cy="584.81299"
+ fx="93.842445"
+ fy="584.81299"
+ r="4" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3861-3"
+ id="radialGradient4329"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.45000156,-25.35364,17.785385,0.31567267,-10088.447,2350.2101)"
+ cx="94.009636"
+ cy="584.68146"
+ fx="94.009636"
+ fy="584.68146"
+ r="4" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2"
+ id="radialGradient4331"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,-9.214312,24.642857,0,-14153.154,1325.5074)"
+ cx="94.016861"
+ cy="589.05499"
+ fx="94.016861"
+ fy="589.05499"
+ r="4" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3876"
+ id="linearGradient4333"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,0.93333333,-1.496,0,1237.9457,379.85483)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2"
+ id="radialGradient4335"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,9.214312,-24.642857,0,14873.654,-398.82369)"
+ cx="94.016861"
+ cy="589.05499"
+ fx="94.016861"
+ fy="589.05499"
+ r="4" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3948-8-2"
+ id="linearGradient4337"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.62333333,0,0,-2.6966499,205.41706,2214.1956)"
+ x1="253.34712"
+ y1="646.05676"
+ x2="253.34712"
+ y2="610.20563" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3948-8-2"
+ id="linearGradient4341"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.62333333,0,0,-2.6966499,205.41706,2214.1956)"
+ x1="253.34712"
+ y1="646.05676"
+ x2="253.34712"
+ y2="610.20563" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2"
+ id="radialGradient4344"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,9.214312,-24.642857,0,14873.654,-398.82369)"
+ cx="94.016861"
+ cy="589.05499"
+ fx="94.016861"
+ fy="589.05499"
+ r="4" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3876"
+ id="linearGradient4347"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,0.93333333,-1.496,0,1237.9457,379.85483)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3948-8-2-9"
+ id="linearGradient4447-8"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.62333333,0,0,-2.6966499,312.91708,2572.1557)"
+ x1="253.34712"
+ y1="646.05676"
+ x2="253.34712"
+ y2="610.20563" />
+ <linearGradient
+ id="linearGradient3948-8-2-9">
+ <stop
+ style="stop-color:#000000;stop-opacity:0.39215687;"
+ offset="0"
+ id="stop3950-1-4-6" />
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="1"
+ id="stop3952-6-1-1" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2-2"
+ id="radialGradient4450-6"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,9.214312,-24.642857,0,14981.154,-40.863723)"
+ cx="94.016861"
+ cy="589.05499"
+ fx="94.016861"
+ fy="589.05499"
+ r="4" />
+ <linearGradient
+ id="linearGradient3845-2-2">
+ <stop
+ style="stop-color:#4d4d4d;stop-opacity:1;"
+ offset="0"
+ id="stop3847-0-3" />
+ <stop
+ id="stop3849-4-9"
+ offset="0.89999998"
+ style="stop-color:#141718;stop-opacity:1;" />
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="1"
+ id="stop3851-5-6" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3876-2"
+ id="linearGradient4453-4"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,0.93333333,-1.496,0,1345.4457,737.8148)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <linearGradient
+ id="linearGradient3876-2">
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="0"
+ id="stop3878-8" />
+ <stop
+ id="stop3880-1"
+ offset="0.62347519"
+ style="stop-color:#4d4d4d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#353535;stop-opacity:1;"
+ offset="1"
+ id="stop3882-3" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2-2"
+ id="radialGradient4478-2"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,-9.214312,24.642857,0,-14046.154,1683.4675)"
+ cx="94.016861"
+ cy="589.05499"
+ fx="94.016861"
+ fy="589.05499"
+ r="4" />
+ <linearGradient
+ id="linearGradient4580">
+ <stop
+ style="stop-color:#4d4d4d;stop-opacity:1;"
+ offset="0"
+ id="stop4582" />
+ <stop
+ id="stop4584"
+ offset="0.89999998"
+ style="stop-color:#141718;stop-opacity:1;" />
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="1"
+ id="stop4586" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3861-3-2"
+ id="radialGradient4481-5"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.45000156,-25.35364,17.785385,0.31567267,-9981.447,2708.1702)"
+ cx="94.009636"
+ cy="584.68146"
+ fx="94.009636"
+ fy="584.68146"
+ r="4" />
+ <linearGradient
+ id="linearGradient3861-3-2">
+ <stop
+ id="stop3863-1-7"
+ offset="0"
+ style="stop-color:#4d4d4d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#353535;stop-opacity:1;"
+ offset="0.3948195"
+ id="stop3865-9-4" />
+ <stop
+ id="stop3867-6-7"
+ offset="1"
+ style="stop-color:#353535;stop-opacity:1;" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2-2"
+ id="radialGradient4484-3"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.07087723,9.2140394,-23.214285,0.17857142,14037.878,-441.2285)"
+ cx="93.842445"
+ cy="584.81299"
+ fx="93.842445"
+ fy="584.81299"
+ r="4" />
+ <linearGradient
+ id="linearGradient4594">
+ <stop
+ style="stop-color:#4d4d4d;stop-opacity:1;"
+ offset="0"
+ id="stop4596" />
+ <stop
+ id="stop4598"
+ offset="0.89999998"
+ style="stop-color:#141718;stop-opacity:1;" />
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="1"
+ id="stop4600" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3876-2"
+ id="linearGradient4487-4"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.93333333,0,0,1.496,-904.78885,-410.44568)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <linearGradient
+ id="linearGradient4603">
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="0"
+ id="stop4605" />
+ <stop
+ id="stop4607"
+ offset="0.62347519"
+ style="stop-color:#4d4d4d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#353535;stop-opacity:1;"
+ offset="1"
+ id="stop4609" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3860-9"
+ id="linearGradient3944-3"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.3,0,0,1,1238.6,270)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <linearGradient
+ id="linearGradient3860-9">
+ <stop
+ style="stop-color:#1e9d00;stop-opacity:1;"
+ offset="0"
+ id="stop3862-4" />
+ <stop
+ id="stop3864-2"
+ offset="0.47889951"
+ style="stop-color:#55d400;stop-opacity:1;" />
+ <stop
+ style="stop-color:#6dec18;stop-opacity:1;"
+ offset="1"
+ id="stop3866-3" />
+ </linearGradient>
+ <linearGradient
+ y2="524.50104"
+ x2="398"
+ y1="649.9967"
+ x1="398"
+ gradientTransform="matrix(0.3,0,0,1.496,693.96215,-1345.4458)"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient4259"
+ xlink:href="#linearGradient3860-9"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient3860-9-6">
+ <stop
+ style="stop-color:#1e9d00;stop-opacity:1;"
+ offset="0"
+ id="stop3862-4-4" />
+ <stop
+ id="stop3864-2-5"
+ offset="0.47889951"
+ style="stop-color:#55d400;stop-opacity:1;" />
+ <stop
+ style="stop-color:#6dec18;stop-opacity:1;"
+ offset="1"
+ id="stop3866-3-3" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3948-8-2-9-0"
+ id="linearGradient4447-8-2"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.62333333,0,0,-2.6966499,125.91709,2572.1557)"
+ x1="253.34712"
+ y1="646.05676"
+ x2="253.34712"
+ y2="610.20563" />
+ <linearGradient
+ id="linearGradient3948-8-2-9-0">
+ <stop
+ style="stop-color:#000000;stop-opacity:0.39215687;"
+ offset="0"
+ id="stop3950-1-4-6-4" />
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="1"
+ id="stop3952-6-1-1-5" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2-2-2"
+ id="radialGradient4450-6-9"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,9.214312,-24.642857,0,14794.154,-40.863727)"
+ cx="94.016861"
+ cy="589.05499"
+ fx="94.016861"
+ fy="589.05499"
+ r="4" />
+ <linearGradient
+ id="linearGradient3845-2-2-2">
+ <stop
+ style="stop-color:#4d4d4d;stop-opacity:1;"
+ offset="0"
+ id="stop3847-0-3-4" />
+ <stop
+ id="stop3849-4-9-4"
+ offset="0.89999998"
+ style="stop-color:#141718;stop-opacity:1;" />
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="1"
+ id="stop3851-5-6-7" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3876-2-8"
+ id="linearGradient4453-4-9"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,0.93333333,-1.496,0,1158.4457,737.81479)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <linearGradient
+ id="linearGradient3876-2-8">
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="0"
+ id="stop3878-8-4" />
+ <stop
+ id="stop3880-1-0"
+ offset="0.62347519"
+ style="stop-color:#4d4d4d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#353535;stop-opacity:1;"
+ offset="1"
+ id="stop3882-3-8" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2-2-2"
+ id="radialGradient4478-2-2"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,-9.214312,24.642857,0,-14233.154,1683.4675)"
+ cx="94.016861"
+ cy="589.05499"
+ fx="94.016861"
+ fy="589.05499"
+ r="4" />
+ <linearGradient
+ id="linearGradient5149">
+ <stop
+ style="stop-color:#4d4d4d;stop-opacity:1;"
+ offset="0"
+ id="stop5151" />
+ <stop
+ id="stop5153"
+ offset="0.89999998"
+ style="stop-color:#141718;stop-opacity:1;" />
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="1"
+ id="stop5155" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3861-3-2-9"
+ id="radialGradient4481-5-0"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.45000156,-25.35364,17.785385,0.31567267,-10168.447,2708.1702)"
+ cx="94.009636"
+ cy="584.68146"
+ fx="94.009636"
+ fy="584.68146"
+ r="4" />
+ <linearGradient
+ id="linearGradient3861-3-2-9">
+ <stop
+ id="stop3863-1-7-7"
+ offset="0"
+ style="stop-color:#4d4d4d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#353535;stop-opacity:1;"
+ offset="0.3948195"
+ id="stop3865-9-4-9" />
+ <stop
+ id="stop3867-6-7-0"
+ offset="1"
+ style="stop-color:#353535;stop-opacity:1;" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2-2-2"
+ id="radialGradient4484-3-7"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.07087723,9.2140394,-23.214285,0.17857142,13850.878,-441.22851)"
+ cx="93.842445"
+ cy="584.81299"
+ fx="93.842445"
+ fy="584.81299"
+ r="4" />
+ <linearGradient
+ id="linearGradient5163">
+ <stop
+ style="stop-color:#4d4d4d;stop-opacity:1;"
+ offset="0"
+ id="stop5165" />
+ <stop
+ id="stop5167"
+ offset="0.89999998"
+ style="stop-color:#141718;stop-opacity:1;" />
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="1"
+ id="stop5169" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3876-2-8"
+ id="linearGradient4487-4-0"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.93333333,0,0,1.496,-904.78884,-597.44567)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <linearGradient
+ id="linearGradient5172">
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="0"
+ id="stop5174" />
+ <stop
+ id="stop5176"
+ offset="0.62347519"
+ style="stop-color:#4d4d4d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#353535;stop-opacity:1;"
+ offset="1"
+ id="stop5178" />
+ </linearGradient>
+ <linearGradient
+ y2="524.50104"
+ x2="398"
+ y1="649.9967"
+ x1="398"
+ gradientTransform="matrix(0.46666665,0,0,1.496,627.62882,-1532.4458)"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient4259-3"
+ xlink:href="#linearGradient3860-9-4"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient3860-9-4">
+ <stop
+ style="stop-color:#1e9d00;stop-opacity:1;"
+ offset="0"
+ id="stop3862-4-7" />
+ <stop
+ id="stop3864-2-7"
+ offset="0.47889951"
+ style="stop-color:#55d400;stop-opacity:1;" />
+ <stop
+ style="stop-color:#6dec18;stop-opacity:1;"
+ offset="1"
+ id="stop3866-3-7" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3948-8-2-9-1"
+ id="linearGradient4447-8-1"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.62333333,0,0,-2.6966499,499.91708,2572.1557)"
+ x1="253.34712"
+ y1="646.05676"
+ x2="253.34712"
+ y2="610.20563" />
+ <linearGradient
+ id="linearGradient3948-8-2-9-1">
+ <stop
+ style="stop-color:#000000;stop-opacity:0.39215687;"
+ offset="0"
+ id="stop3950-1-4-6-43" />
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="1"
+ id="stop3952-6-1-1-2" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2-2-9"
+ id="radialGradient4450-6-2"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,9.214312,-24.642857,0,15168.154,-40.863704)"
+ cx="94.016861"
+ cy="589.05499"
+ fx="94.016861"
+ fy="589.05499"
+ r="4" />
+ <linearGradient
+ id="linearGradient3845-2-2-9">
+ <stop
+ style="stop-color:#4d4d4d;stop-opacity:1;"
+ offset="0"
+ id="stop3847-0-3-5" />
+ <stop
+ id="stop3849-4-9-49"
+ offset="0.89999998"
+ style="stop-color:#141718;stop-opacity:1;" />
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="1"
+ id="stop3851-5-6-3" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3876-2-7"
+ id="linearGradient4453-4-5"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,0.93333333,-1.496,0,1532.4457,737.81482)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <linearGradient
+ id="linearGradient3876-2-7">
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="0"
+ id="stop3878-8-8" />
+ <stop
+ id="stop3880-1-03"
+ offset="0.62347519"
+ style="stop-color:#4d4d4d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#353535;stop-opacity:1;"
+ offset="1"
+ id="stop3882-3-3" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2-2-9"
+ id="radialGradient4478-2-7"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,-9.214312,24.642857,0,-13859.154,1683.4675)"
+ cx="94.016861"
+ cy="589.05499"
+ fx="94.016861"
+ fy="589.05499"
+ r="4" />
+ <linearGradient
+ id="linearGradient5390">
+ <stop
+ style="stop-color:#4d4d4d;stop-opacity:1;"
+ offset="0"
+ id="stop5392" />
+ <stop
+ id="stop5394"
+ offset="0.89999998"
+ style="stop-color:#141718;stop-opacity:1;" />
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="1"
+ id="stop5396" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3861-3-2-7"
+ id="radialGradient4481-5-6"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.45000156,-25.35364,17.785385,0.31567267,-9794.447,2708.1702)"
+ cx="94.009636"
+ cy="584.68146"
+ fx="94.009636"
+ fy="584.68146"
+ r="4" />
+ <linearGradient
+ id="linearGradient3861-3-2-7">
+ <stop
+ id="stop3863-1-7-9"
+ offset="0"
+ style="stop-color:#4d4d4d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#353535;stop-opacity:1;"
+ offset="0.3948195"
+ id="stop3865-9-4-8" />
+ <stop
+ id="stop3867-6-7-6"
+ offset="1"
+ style="stop-color:#353535;stop-opacity:1;" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2-2-9"
+ id="radialGradient4484-3-5"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.07087723,9.2140394,-23.214285,0.17857142,14224.878,-441.22848)"
+ cx="93.842445"
+ cy="584.81299"
+ fx="93.842445"
+ fy="584.81299"
+ r="4" />
+ <linearGradient
+ id="linearGradient5404">
+ <stop
+ style="stop-color:#4d4d4d;stop-opacity:1;"
+ offset="0"
+ id="stop5406" />
+ <stop
+ id="stop5408"
+ offset="0.89999998"
+ style="stop-color:#141718;stop-opacity:1;" />
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="1"
+ id="stop5410" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3876-2-7"
+ id="linearGradient4487-4-9"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.93333333,0,0,1.496,-904.78884,-223.44568)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <linearGradient
+ id="linearGradient5413">
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="0"
+ id="stop5415" />
+ <stop
+ id="stop5417"
+ offset="0.62347519"
+ style="stop-color:#4d4d4d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#353535;stop-opacity:1;"
+ offset="1"
+ id="stop5419" />
+ </linearGradient>
+ <linearGradient
+ y2="524.50104"
+ x2="398"
+ y1="649.9967"
+ x1="398"
+ gradientTransform="matrix(0.6333333,0,0,1.496,561.2955,-1719.4458)"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient4259-3-7"
+ xlink:href="#linearGradient3860-9-4-6"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient3860-9-4-6">
+ <stop
+ style="stop-color:#1e9d00;stop-opacity:1;"
+ offset="0"
+ id="stop3862-4-7-9" />
+ <stop
+ id="stop3864-2-7-0"
+ offset="0.47889951"
+ style="stop-color:#55d400;stop-opacity:1;" />
+ <stop
+ style="stop-color:#6dec18;stop-opacity:1;"
+ offset="1"
+ id="stop3866-3-7-0" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3948-8-2-9-1-4"
+ id="linearGradient4447-8-1-2"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.62333333,0,0,-2.6966499,686.91709,2572.1558)"
+ x1="253.34712"
+ y1="646.05676"
+ x2="253.34712"
+ y2="610.20563" />
+ <linearGradient
+ id="linearGradient3948-8-2-9-1-4">
+ <stop
+ style="stop-color:#000000;stop-opacity:0.39215687;"
+ offset="0"
+ id="stop3950-1-4-6-43-3" />
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="1"
+ id="stop3952-6-1-1-2-0" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2-2-9-0"
+ id="radialGradient4450-6-2-7"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,9.214312,-24.642857,0,15355.154,-40.863701)"
+ cx="94.016861"
+ cy="589.05499"
+ fx="94.016861"
+ fy="589.05499"
+ r="4" />
+ <linearGradient
+ id="linearGradient3845-2-2-9-0">
+ <stop
+ style="stop-color:#4d4d4d;stop-opacity:1;"
+ offset="0"
+ id="stop3847-0-3-5-5" />
+ <stop
+ id="stop3849-4-9-49-0"
+ offset="0.89999998"
+ style="stop-color:#141718;stop-opacity:1;" />
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="1"
+ id="stop3851-5-6-3-6" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3876-2-7-3"
+ id="linearGradient4453-4-5-7"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,0.93333333,-1.496,0,1719.4457,737.81482)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <linearGradient
+ id="linearGradient3876-2-7-3">
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="0"
+ id="stop3878-8-8-0" />
+ <stop
+ id="stop3880-1-03-8"
+ offset="0.62347519"
+ style="stop-color:#4d4d4d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#353535;stop-opacity:1;"
+ offset="1"
+ id="stop3882-3-3-6" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2-2-9-0"
+ id="radialGradient4478-2-7-7"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,-9.214312,24.642857,0,-13672.154,1683.4676)"
+ cx="94.016861"
+ cy="589.05499"
+ fx="94.016861"
+ fy="589.05499"
+ r="4" />
+ <linearGradient
+ id="linearGradient5911">
+ <stop
+ style="stop-color:#4d4d4d;stop-opacity:1;"
+ offset="0"
+ id="stop5913" />
+ <stop
+ id="stop5915"
+ offset="0.89999998"
+ style="stop-color:#141718;stop-opacity:1;" />
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="1"
+ id="stop5917" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3861-3-2-7-2"
+ id="radialGradient4481-5-6-8"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.45000156,-25.35364,17.785385,0.31567267,-9607.4465,2708.1703)"
+ cx="94.009636"
+ cy="584.68146"
+ fx="94.009636"
+ fy="584.68146"
+ r="4" />
+ <linearGradient
+ id="linearGradient3861-3-2-7-2">
+ <stop
+ id="stop3863-1-7-9-9"
+ offset="0"
+ style="stop-color:#4d4d4d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#353535;stop-opacity:1;"
+ offset="0.3948195"
+ id="stop3865-9-4-8-5" />
+ <stop
+ id="stop3867-6-7-6-8"
+ offset="1"
+ style="stop-color:#353535;stop-opacity:1;" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2-2-9-0"
+ id="radialGradient4484-3-5-2"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.07087723,9.2140394,-23.214285,0.17857142,14411.878,-441.22851)"
+ cx="93.842445"
+ cy="584.81299"
+ fx="93.842445"
+ fy="584.81299"
+ r="4" />
+ <linearGradient
+ id="linearGradient5925">
+ <stop
+ style="stop-color:#4d4d4d;stop-opacity:1;"
+ offset="0"
+ id="stop5927" />
+ <stop
+ id="stop5929"
+ offset="0.89999998"
+ style="stop-color:#141718;stop-opacity:1;" />
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="1"
+ id="stop5931" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3876-2-7-3"
+ id="linearGradient4487-4-9-7"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.93333333,0,0,1.496,-904.78884,-36.445668)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <linearGradient
+ id="linearGradient5934">
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="0"
+ id="stop5936" />
+ <stop
+ id="stop5938"
+ offset="0.62347519"
+ style="stop-color:#4d4d4d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#353535;stop-opacity:1;"
+ offset="1"
+ id="stop5940" />
+ </linearGradient>
+ <linearGradient
+ y2="524.50104"
+ x2="398"
+ y1="649.9967"
+ x1="398"
+ gradientTransform="matrix(0.79999996,0,0,1.496,494.96216,-1906.4458)"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient4259-3-7-8"
+ xlink:href="#linearGradient3860-9-4-6-1"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient3860-9-4-6-1">
+ <stop
+ style="stop-color:#1e9d00;stop-opacity:1;"
+ offset="0"
+ id="stop3862-4-7-9-0" />
+ <stop
+ id="stop3864-2-7-0-1"
+ offset="0.47889951"
+ style="stop-color:#55d400;stop-opacity:1;" />
+ <stop
+ style="stop-color:#6dec18;stop-opacity:1;"
+ offset="1"
+ id="stop3866-3-7-0-8" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3948-8-2-9-1-4-9"
+ id="linearGradient4447-8-1-2-9"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.62333333,0,0,-2.6966499,873.9171,2572.1559)"
+ x1="253.34712"
+ y1="646.05676"
+ x2="253.34712"
+ y2="610.20563" />
+ <linearGradient
+ id="linearGradient3948-8-2-9-1-4-9">
+ <stop
+ style="stop-color:#000000;stop-opacity:0.39215687;"
+ offset="0"
+ id="stop3950-1-4-6-43-3-4" />
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="1"
+ id="stop3952-6-1-1-2-0-4" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2-2-9-0-4"
+ id="radialGradient4450-6-2-7-1"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,9.214312,-24.642857,0,15542.154,-40.863702)"
+ cx="94.016861"
+ cy="589.05499"
+ fx="94.016861"
+ fy="589.05499"
+ r="4" />
+ <linearGradient
+ id="linearGradient3845-2-2-9-0-4">
+ <stop
+ style="stop-color:#4d4d4d;stop-opacity:1;"
+ offset="0"
+ id="stop3847-0-3-5-5-4" />
+ <stop
+ id="stop3849-4-9-49-0-8"
+ offset="0.89999998"
+ style="stop-color:#141718;stop-opacity:1;" />
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="1"
+ id="stop3851-5-6-3-6-8" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3876-2-7-3-6"
+ id="linearGradient4453-4-5-7-7"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,0.93333333,-1.496,0,1906.4457,737.81482)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <linearGradient
+ id="linearGradient3876-2-7-3-6">
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="0"
+ id="stop3878-8-8-0-8" />
+ <stop
+ id="stop3880-1-03-8-6"
+ offset="0.62347519"
+ style="stop-color:#4d4d4d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#353535;stop-opacity:1;"
+ offset="1"
+ id="stop3882-3-3-6-5" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2-2-9-0-4"
+ id="radialGradient4478-2-7-7-1"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,-9.214312,24.642857,0,-13485.154,1683.4677)"
+ cx="94.016861"
+ cy="589.05499"
+ fx="94.016861"
+ fy="589.05499"
+ r="4" />
+ <linearGradient
+ id="linearGradient6152">
+ <stop
+ style="stop-color:#4d4d4d;stop-opacity:1;"
+ offset="0"
+ id="stop6154" />
+ <stop
+ id="stop6156"
+ offset="0.89999998"
+ style="stop-color:#141718;stop-opacity:1;" />
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="1"
+ id="stop6158" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3861-3-2-7-2-7"
+ id="radialGradient4481-5-6-8-2"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.45000156,-25.35364,17.785385,0.31567267,-9420.447,2708.1704)"
+ cx="94.009636"
+ cy="584.68146"
+ fx="94.009636"
+ fy="584.68146"
+ r="4" />
+ <linearGradient
+ id="linearGradient3861-3-2-7-2-7">
+ <stop
+ id="stop3863-1-7-9-9-0"
+ offset="0"
+ style="stop-color:#4d4d4d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#353535;stop-opacity:1;"
+ offset="0.3948195"
+ id="stop3865-9-4-8-5-5" />
+ <stop
+ id="stop3867-6-7-6-8-0"
+ offset="1"
+ style="stop-color:#353535;stop-opacity:1;" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2-2-9-0-4"
+ id="radialGradient4484-3-5-2-0"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.07087723,9.2140394,-23.214285,0.17857142,14598.878,-441.22851)"
+ cx="93.842445"
+ cy="584.81299"
+ fx="93.842445"
+ fy="584.81299"
+ r="4" />
+ <linearGradient
+ id="linearGradient6166">
+ <stop
+ style="stop-color:#4d4d4d;stop-opacity:1;"
+ offset="0"
+ id="stop6168" />
+ <stop
+ id="stop6170"
+ offset="0.89999998"
+ style="stop-color:#141718;stop-opacity:1;" />
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="1"
+ id="stop6172" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3876-2-7-3-6"
+ id="linearGradient4487-4-9-7-0"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.93333333,0,0,1.496,-904.78884,150.5543)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <linearGradient
+ id="linearGradient6175">
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="0"
+ id="stop6177" />
+ <stop
+ id="stop6179"
+ offset="0.62347519"
+ style="stop-color:#4d4d4d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#353535;stop-opacity:1;"
+ offset="1"
+ id="stop6181" />
+ </linearGradient>
+ <linearGradient
+ y2="524.50104"
+ x2="398"
+ y1="649.9967"
+ x1="398"
+ gradientTransform="matrix(0.93333329,0,0,1.496,441.89548,-2093.4458)"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient4259-3-7-8-8"
+ xlink:href="#linearGradient3860-9-4-6-1-9"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient3860-9-4-6-1-9">
+ <stop
+ style="stop-color:#1e9d00;stop-opacity:1;"
+ offset="0"
+ id="stop3862-4-7-9-0-9" />
+ <stop
+ id="stop3864-2-7-0-1-7"
+ offset="0.47889951"
+ style="stop-color:#55d400;stop-opacity:1;" />
+ <stop
+ style="stop-color:#6dec18;stop-opacity:1;"
+ offset="1"
+ id="stop3866-3-7-0-8-4" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3948-8-2-9-1-4-9-6"
+ id="linearGradient4447-8-1-2-9-7"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.62333333,0,0,-2.6966499,1060.9171,2572.1559)"
+ x1="253.34712"
+ y1="646.05676"
+ x2="253.34712"
+ y2="610.20563" />
+ <linearGradient
+ id="linearGradient3948-8-2-9-1-4-9-6">
+ <stop
+ style="stop-color:#000000;stop-opacity:0.39215687;"
+ offset="0"
+ id="stop3950-1-4-6-43-3-4-1" />
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="1"
+ id="stop3952-6-1-1-2-0-4-1" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2-2-9-0-4-7"
+ id="radialGradient4450-6-2-7-1-2"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,9.214312,-24.642857,0,15729.154,-40.863709)"
+ cx="94.016861"
+ cy="589.05499"
+ fx="94.016861"
+ fy="589.05499"
+ r="4" />
+ <linearGradient
+ id="linearGradient3845-2-2-9-0-4-7">
+ <stop
+ style="stop-color:#4d4d4d;stop-opacity:1;"
+ offset="0"
+ id="stop3847-0-3-5-5-4-9" />
+ <stop
+ id="stop3849-4-9-49-0-8-7"
+ offset="0.89999998"
+ style="stop-color:#141718;stop-opacity:1;" />
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="1"
+ id="stop3851-5-6-3-6-8-6" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3876-2-7-3-6-9"
+ id="linearGradient4453-4-5-7-7-3"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,0.93333333,-1.496,0,2093.4457,737.81481)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <linearGradient
+ id="linearGradient3876-2-7-3-6-9">
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="0"
+ id="stop3878-8-8-0-8-4" />
+ <stop
+ id="stop3880-1-03-8-6-8"
+ offset="0.62347519"
+ style="stop-color:#4d4d4d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#353535;stop-opacity:1;"
+ offset="1"
+ id="stop3882-3-3-6-5-3" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2-2-9-0-4-7"
+ id="radialGradient4478-2-7-7-1-3"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,-9.214312,24.642857,0,-13298.154,1683.4677)"
+ cx="94.016861"
+ cy="589.05499"
+ fx="94.016861"
+ fy="589.05499"
+ r="4" />
+ <linearGradient
+ id="linearGradient6393">
+ <stop
+ style="stop-color:#4d4d4d;stop-opacity:1;"
+ offset="0"
+ id="stop6395" />
+ <stop
+ id="stop6397"
+ offset="0.89999998"
+ style="stop-color:#141718;stop-opacity:1;" />
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="1"
+ id="stop6399" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3861-3-2-7-2-7-1"
+ id="radialGradient4481-5-6-8-2-5"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.45000156,-25.35364,17.785385,0.31567267,-9233.447,2708.1704)"
+ cx="94.009636"
+ cy="584.68146"
+ fx="94.009636"
+ fy="584.68146"
+ r="4" />
+ <linearGradient
+ id="linearGradient3861-3-2-7-2-7-1">
+ <stop
+ id="stop3863-1-7-9-9-0-7"
+ offset="0"
+ style="stop-color:#4d4d4d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#353535;stop-opacity:1;"
+ offset="0.3948195"
+ id="stop3865-9-4-8-5-5-9" />
+ <stop
+ id="stop3867-6-7-6-8-0-6"
+ offset="1"
+ style="stop-color:#353535;stop-opacity:1;" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2-2-9-0-4-7"
+ id="radialGradient4484-3-5-2-0-6"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.07087723,9.2140394,-23.214285,0.17857142,14785.878,-441.22852)"
+ cx="93.842445"
+ cy="584.81299"
+ fx="93.842445"
+ fy="584.81299"
+ r="4" />
+ <linearGradient
+ id="linearGradient6407">
+ <stop
+ style="stop-color:#4d4d4d;stop-opacity:1;"
+ offset="0"
+ id="stop6409" />
+ <stop
+ id="stop6411"
+ offset="0.89999998"
+ style="stop-color:#141718;stop-opacity:1;" />
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="1"
+ id="stop6413" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3876-2-7-3-6-9"
+ id="linearGradient4487-4-9-7-0-8"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.93333333,0,0,1.496,-904.78883,337.55435)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <linearGradient
+ id="linearGradient6416">
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="0"
+ id="stop6418" />
+ <stop
+ id="stop6420"
+ offset="0.62347519"
+ style="stop-color:#4d4d4d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#353535;stop-opacity:1;"
+ offset="1"
+ id="stop6422" />
+ </linearGradient>
+ <linearGradient
+ y2="524.50104"
+ x2="398"
+ y1="649.9967"
+ x1="398"
+ gradientTransform="matrix(0.93333329,0,0,1.496,441.89548,-2280.4458)"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient4259-3-7-8-8-0"
+ xlink:href="#linearGradient3860-9-4-6-1-9-3"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient3860-9-4-6-1-9-3">
+ <stop
+ style="stop-color:#1e9d00;stop-opacity:1;"
+ offset="0"
+ id="stop3862-4-7-9-0-9-7" />
+ <stop
+ id="stop3864-2-7-0-1-7-9"
+ offset="0.47889951"
+ style="stop-color:#55d400;stop-opacity:1;" />
+ <stop
+ style="stop-color:#6dec18;stop-opacity:1;"
+ offset="1"
+ id="stop3866-3-7-0-8-4-0" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3948-8-2-9-1-4-9-6-2"
+ id="linearGradient4447-8-1-2-9-7-9"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.62333333,0,0,-2.6966499,1247.9171,2572.1559)"
+ x1="253.34712"
+ y1="646.05676"
+ x2="253.34712"
+ y2="610.20563" />
+ <linearGradient
+ id="linearGradient3948-8-2-9-1-4-9-6-2">
+ <stop
+ style="stop-color:#000000;stop-opacity:0.39215687;"
+ offset="0"
+ id="stop3950-1-4-6-43-3-4-1-8" />
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="1"
+ id="stop3952-6-1-1-2-0-4-1-1" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2-2-9-0-4-7-0"
+ id="radialGradient4450-6-2-7-1-2-1"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,9.214312,-24.642857,0,15916.154,-40.863709)"
+ cx="94.016861"
+ cy="589.05499"
+ fx="94.016861"
+ fy="589.05499"
+ r="4" />
+ <linearGradient
+ id="linearGradient3845-2-2-9-0-4-7-0">
+ <stop
+ style="stop-color:#4d4d4d;stop-opacity:1;"
+ offset="0"
+ id="stop3847-0-3-5-5-4-9-8" />
+ <stop
+ id="stop3849-4-9-49-0-8-7-3"
+ offset="0.89999998"
+ style="stop-color:#141718;stop-opacity:1;" />
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="1"
+ id="stop3851-5-6-3-6-8-6-8" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3876-2-7-3-6-9-1"
+ id="linearGradient4453-4-5-7-7-3-6"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,0.93333333,-1.496,0,2280.4457,737.81481)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <linearGradient
+ id="linearGradient3876-2-7-3-6-9-1">
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="0"
+ id="stop3878-8-8-0-8-4-3" />
+ <stop
+ id="stop3880-1-03-8-6-8-1"
+ offset="0.62347519"
+ style="stop-color:#4d4d4d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#353535;stop-opacity:1;"
+ offset="1"
+ id="stop3882-3-3-6-5-3-5" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2-2-9-0-4-7-0"
+ id="radialGradient4478-2-7-7-1-3-5"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,-9.214312,24.642857,0,-13111.154,1683.4677)"
+ cx="94.016861"
+ cy="589.05499"
+ fx="94.016861"
+ fy="589.05499"
+ r="4" />
+ <linearGradient
+ id="linearGradient6774">
+ <stop
+ style="stop-color:#4d4d4d;stop-opacity:1;"
+ offset="0"
+ id="stop6776" />
+ <stop
+ id="stop6778"
+ offset="0.89999998"
+ style="stop-color:#141718;stop-opacity:1;" />
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="1"
+ id="stop6780" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3861-3-2-7-2-7-1-4"
+ id="radialGradient4481-5-6-8-2-5-3"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.45000156,-25.35364,17.785385,0.31567267,-9046.447,2708.1704)"
+ cx="94.009636"
+ cy="584.68146"
+ fx="94.009636"
+ fy="584.68146"
+ r="4" />
+ <linearGradient
+ id="linearGradient3861-3-2-7-2-7-1-4">
+ <stop
+ id="stop3863-1-7-9-9-0-7-0"
+ offset="0"
+ style="stop-color:#4d4d4d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#353535;stop-opacity:1;"
+ offset="0.3948195"
+ id="stop3865-9-4-8-5-5-9-8" />
+ <stop
+ id="stop3867-6-7-6-8-0-6-6"
+ offset="1"
+ style="stop-color:#353535;stop-opacity:1;" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2-2-9-0-4-7-0"
+ id="radialGradient4484-3-5-2-0-6-2"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.07087723,9.2140394,-23.214285,0.17857142,14972.878,-441.22848)"
+ cx="93.842445"
+ cy="584.81299"
+ fx="93.842445"
+ fy="584.81299"
+ r="4" />
+ <linearGradient
+ id="linearGradient6788">
+ <stop
+ style="stop-color:#4d4d4d;stop-opacity:1;"
+ offset="0"
+ id="stop6790" />
+ <stop
+ id="stop6792"
+ offset="0.89999998"
+ style="stop-color:#141718;stop-opacity:1;" />
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="1"
+ id="stop6794" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3876-2-7-3-6-9-1"
+ id="linearGradient4487-4-9-7-0-8-1"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.93333333,0,0,1.496,-904.78883,524.55435)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <linearGradient
+ id="linearGradient6797">
+ <stop
+ style="stop-color:#141718;stop-opacity:1;"
+ offset="0"
+ id="stop6799" />
+ <stop
+ id="stop6801"
+ offset="0.62347519"
+ style="stop-color:#4d4d4d;stop-opacity:1;" />
+ <stop
+ style="stop-color:#353535;stop-opacity:1;"
+ offset="1"
+ id="stop6803" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3876"
+ id="linearGradient6922"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.93333333,0,0,1.496,-904.78888,-784.44568)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2"
+ id="radialGradient6924"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.07087723,9.2140394,-23.214285,0.17857142,13663.878,-441.22847)"
+ cx="93.842445"
+ cy="584.81299"
+ fx="93.842445"
+ fy="584.81299"
+ r="4" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3861-3"
+ id="radialGradient6926"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.45000156,-25.35364,17.785385,0.31567267,-10355.447,2708.1701)"
+ cx="94.009636"
+ cy="584.68146"
+ fx="94.009636"
+ fy="584.68146"
+ r="4" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2"
+ id="radialGradient6928"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,-9.214312,24.642857,0,-14420.154,1683.4674)"
+ cx="94.016861"
+ cy="589.05499"
+ fx="94.016861"
+ fy="589.05499"
+ r="4" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3876"
+ id="linearGradient6930"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,0.93333333,-1.496,0,971.44572,737.81483)"
+ x1="398"
+ y1="649.9967"
+ x2="398"
+ y2="524.50104" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3845-2"
+ id="radialGradient6932"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,9.214312,-24.642857,0,14607.154,-40.86369)"
+ cx="94.016861"
+ cy="589.05499"
+ fx="94.016861"
+ fy="589.05499"
+ r="4" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3948-8-2"
+ id="linearGradient6934"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.62333333,0,0,-2.6966499,-61.08292,2572.1556)"
+ x1="253.34712"
+ y1="646.05676"
+ x2="253.34712"
+ y2="610.20563" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.7"
+ inkscape:cx="258.39315"
+ inkscape:cy="339.90853"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1680"
+ inkscape:window-height="1000"
+ inkscape:window-x="0"
+ inkscape:window-y="25"
+ inkscape:window-maximized="1" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-488.36218)">
+ <g
+ id="g4621">
+ <rect
+ y="488.36218"
+ x="0"
+ height="564"
+ width="187"
+ id="rect4007"
+ style="fill:#000000;stroke:none" />
+ <rect
+ transform="matrix(0,-1,1,0,0,0)"
+ y="3.0517578e-05"
+ x="-813.32214"
+ height="187"
+ width="280"
+ id="rect5069-3"
+ style="fill:url(#linearGradient6922);fill-opacity:1;stroke:none" />
+ <path
+ sodipodi:nodetypes="sccssss"
+ inkscape:connector-curvature="0"
+ id="path5071-6"
+ d="m 187,523.16373 0,10.15843 c -11.86534,0 -184.22986,0 -187,0 l 0,-10.15843 c 0,-1.574 1.26711,-2.8411 2.84105,-2.8411 l 181.31795,0 c 1.57395,0 2.841,1.2671 2.841,2.8411 z"
+ style="fill:url(#radialGradient6924);fill-opacity:1;stroke:none" />
+ <path
+ sodipodi:nodetypes="ccccssc"
+ inkscape:connector-curvature="0"
+ id="path5073-6"
+ d="m 132.04061,496.36283 c 0,6.64737 0,19.83235 0,23.95935 l -78.08122,0 c 0,-4.9106 0,-17.13315 0,-23.95935 0,-4.477 3.60422,-8.0813 8.08122,-8.0813 l 61.91878,0 c 4.47699,0 8.08122,3.6043 8.08122,8.0813 z"
+ style="fill:url(#radialGradient6926);fill-opacity:1;stroke:none" />
+ <path
+ style="fill:url(#radialGradient6928);fill-opacity:1;stroke:none"
+ d="m 0,818.48118 0,-5.159 c 12.12743,0 184.22986,0 187,0 l 0,5.159 c 0,1.5739 -1.26706,2.841 -2.841,2.841 l -181.31794,0 C 1.26711,821.32218 0,820.05508 0,818.48118 z"
+ id="path5075-1"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="sccssss" />
+ <path
+ id="rect3972"
+ d="m 0,829.29093 0,133.875 187,0 0,-133.875 -187,0 z"
+ style="fill:url(#linearGradient6930);fill-opacity:1;stroke:none"
+ inkscape:connector-curvature="0" />
+ <path
+ sodipodi:nodetypes="sccssss"
+ inkscape:connector-curvature="0"
+ id="path3978"
+ d="m 187.00003,824.12253 0,5.159 c -12.12743,0 -184.22986,0 -187,0 l 0,-5.159 c 0,-1.5739 1.26706,-2.841 2.841,-2.841 l 181.31794,0 c 1.57395,0 2.84106,1.2671 2.84106,2.841 z"
+ style="fill:url(#radialGradient6932);fill-opacity:1;stroke:none" />
+ <path
+ inkscape:connector-curvature="0"
+ id="rect5087-3"
+ d="m 0,821.04118 0,142.125 187,0 0,-142.125 -187,0 z"
+ style="fill:url(#linearGradient6934);fill-opacity:1;stroke:none" />
+ <text
+ sodipodi:linespacing="125%"
+ id="text4116"
+ y="731.16248"
+ x="60.005154"
+ style="font-size:65.17578125px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#cccccc;fill-opacity:1;stroke:none;font-family:Sans"
+ xml:space="preserve"><tspan
+ style="font-size:162.93945312px;fill:#cccccc"
+ y="731.16248"
+ x="60.005154"
+ id="tspan4118"
+ sodipodi:role="line">?</tspan></text>
+ </g>
+ <rect
+ style="fill:#000000;stroke:none"
+ id="rect4007-4"
+ width="187"
+ height="564"
+ x="374"
+ y="488.36218" />
+ <rect
+ style="fill:url(#linearGradient4487-4);fill-opacity:1;stroke:none"
+ id="rect5069-3-7"
+ width="280"
+ height="187"
+ x="-813.32208"
+ y="374.00003"
+ transform="matrix(0,-1,1,0,0,0)" />
+ <path
+ style="fill:url(#radialGradient4484-3);fill-opacity:1;stroke:none"
+ d="m 561,523.1637 0,10.15843 c -11.86534,0 -184.22986,0 -187,0 l 0,-10.15843 c 0,-1.574 1.26711,-2.8411 2.84105,-2.8411 l 181.31795,0 c 1.57395,0 2.841,1.2671 2.841,2.8411 z"
+ id="path5071-6-1"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="sccssss" />
+ <path
+ style="fill:url(#radialGradient4481-5);fill-opacity:1;stroke:none"
+ d="m 506.04061,496.3628 c 0,6.64737 0,19.83235 0,23.95935 l -78.08122,0 c 0,-4.9106 0,-17.13315 0,-23.95935 0,-4.477 3.60422,-8.0813 8.08122,-8.0813 l 61.91878,0 c 4.47699,0 8.08122,3.6043 8.08122,8.0813 z"
+ id="path5073-6-7"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccssc" />
+ <path
+ sodipodi:nodetypes="sccssss"
+ inkscape:connector-curvature="0"
+ id="path5075-1-3"
+ d="m 374,818.48115 0,-5.159 c 12.12743,0 184.22986,0 187,0 l 0,5.159 c 0,1.5739 -1.26706,2.841 -2.841,2.841 l -181.31794,0 c -1.57395,0 -2.84106,-1.2671 -2.84106,-2.841 z"
+ style="fill:url(#radialGradient4478-2);fill-opacity:1;stroke:none" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:url(#linearGradient4453-4);fill-opacity:1;stroke:none"
+ d="m 374,829.29085 0,133.875 187,0 0,-133.875 -187,0 z"
+ id="rect3972-8" />
+ <path
+ style="fill:url(#radialGradient4450-6);fill-opacity:1;stroke:none"
+ d="m 561.00003,824.12245 0,5.159 c -12.12743,0 -184.22986,0 -187,0 l 0,-5.159 c 0,-1.5739 1.26706,-2.841 2.841,-2.841 l 181.31794,0 c 1.57395,0 2.84106,1.2671 2.84106,2.841 z"
+ id="path3978-6"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="sccssss" />
+ <path
+ style="fill:url(#linearGradient4447-8);fill-opacity:1;stroke:none"
+ d="m 374,821.04115 0,142.125 187,0 0,-142.125 -187,0 z"
+ id="rect5087-3-1"
+ inkscape:connector-curvature="0" />
+ <rect
+ y="-561"
+ x="723.36218"
+ height="187"
+ width="90"
+ id="rect4499-2"
+ style="fill:url(#linearGradient4259);fill-opacity:1;stroke:none"
+ transform="matrix(0,1,-1,0,0,0)"
+ inkscape:transform-center-x="-517.18858"
+ inkscape:transform-center-y="-354.28571" />
+ <rect
+ style="fill:#000000;stroke:none"
+ id="rect4007-4-3"
+ width="187"
+ height="564"
+ x="187"
+ y="488.36218" />
+ <rect
+ style="fill:url(#linearGradient4487-4-0);fill-opacity:1;stroke:none"
+ id="rect5069-3-7-9"
+ width="280"
+ height="187"
+ x="-813.32208"
+ y="187.00003"
+ transform="matrix(0,-1,1,0,0,0)" />
+ <path
+ style="fill:url(#radialGradient4484-3-7);fill-opacity:1;stroke:none"
+ d="m 374.00001,523.16369 0,10.15843 c -11.86534,0 -184.22986,0 -187,0 l 0,-10.15843 c 0,-1.574 1.26711,-2.8411 2.84105,-2.8411 l 181.31795,0 c 1.57395,0 2.841,1.2671 2.841,2.8411 z"
+ id="path5071-6-1-3"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="sccssss" />
+ <path
+ style="fill:url(#radialGradient4481-5-0);fill-opacity:1;stroke:none"
+ d="m 319.04062,496.36279 c 0,6.64737 0,19.83235 0,23.95935 l -78.08122,0 c 0,-4.9106 0,-17.13315 0,-23.95935 0,-4.477 3.60422,-8.0813 8.08122,-8.0813 l 61.91878,0 c 4.47699,0 8.08122,3.6043 8.08122,8.0813 z"
+ id="path5073-6-7-0"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccssc" />
+ <path
+ sodipodi:nodetypes="sccssss"
+ inkscape:connector-curvature="0"
+ id="path5075-1-3-1"
+ d="m 187.00001,818.48114 0,-5.159 c 12.12743,0 184.22986,0 187,0 l 0,5.159 c 0,1.5739 -1.26706,2.841 -2.841,2.841 l -181.31794,0 c -1.57395,0 -2.84106,-1.2671 -2.84106,-2.841 z"
+ style="fill:url(#radialGradient4478-2-2);fill-opacity:1;stroke:none" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:url(#linearGradient4453-4-9);fill-opacity:1;stroke:none"
+ d="m 187.00001,829.29084 0,133.875 187,0 0,-133.875 -187,0 z"
+ id="rect3972-8-9" />
+ <path
+ style="fill:url(#radialGradient4450-6-9);fill-opacity:1;stroke:none"
+ d="m 374.00004,824.12244 0,5.159 c -12.12743,0 -184.22986,0 -187,0 l 0,-5.159 c 0,-1.5739 1.26706,-2.841 2.841,-2.841 l 181.31794,0 c 1.57395,0 2.84106,1.2671 2.84106,2.841 z"
+ id="path3978-6-4"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="sccssss" />
+ <path
+ style="fill:url(#linearGradient4447-8-2);fill-opacity:1;stroke:none"
+ d="m 187.00001,821.04114 0,142.125 187,0 0,-142.125 -187,0 z"
+ id="rect5087-3-1-6"
+ inkscape:connector-curvature="0" />
+ <rect
+ style="fill:#000000;stroke:none"
+ id="rect4007-4-2"
+ width="187"
+ height="564"
+ x="561"
+ y="488.36218" />
+ <rect
+ style="fill:url(#linearGradient4487-4-9);fill-opacity:1;stroke:none"
+ id="rect5069-3-7-0"
+ width="280"
+ height="187"
+ x="-813.32208"
+ y="561.00006"
+ transform="matrix(0,-1,1,0,0,0)" />
+ <path
+ style="fill:url(#radialGradient4484-3-5);fill-opacity:1;stroke:none"
+ d="m 748,523.16372 0,10.15843 c -11.86534,0 -184.22986,0 -187,0 l 0,-10.15843 c 0,-1.574 1.26711,-2.8411 2.84105,-2.8411 l 181.31795,0 c 1.57395,0 2.841,1.2671 2.841,2.8411 z"
+ id="path5071-6-1-32"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="sccssss" />
+ <path
+ style="fill:url(#radialGradient4481-5-6);fill-opacity:1;stroke:none"
+ d="m 693.04061,496.36282 c 0,6.64737 0,19.83235 0,23.95935 l -78.08122,0 c 0,-4.9106 0,-17.13315 0,-23.95935 0,-4.477 3.60422,-8.0813 8.08122,-8.0813 l 61.91878,0 c 4.47699,0 8.08122,3.6043 8.08122,8.0813 z"
+ id="path5073-6-7-7"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccssc" />
+ <path
+ sodipodi:nodetypes="sccssss"
+ inkscape:connector-curvature="0"
+ id="path5075-1-3-2"
+ d="m 561,818.48117 0,-5.159 c 12.12743,0 184.22986,0 187,0 l 0,5.159 c 0,1.5739 -1.26706,2.841 -2.841,2.841 l -181.31794,0 c -1.57395,0 -2.84106,-1.2671 -2.84106,-2.841 z"
+ style="fill:url(#radialGradient4478-2-7);fill-opacity:1;stroke:none" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:url(#linearGradient4453-4-5);fill-opacity:1;stroke:none"
+ d="m 561,829.29084 0,133.875 187,0 0,-133.875 -187,0 z"
+ id="rect3972-8-3" />
+ <path
+ style="fill:url(#radialGradient4450-6-2);fill-opacity:1;stroke:none"
+ d="m 748.00003,824.12247 0,5.15897 c -12.12743,0 -184.22986,0 -187,0 l 0,-5.15897 c 0,-1.5739 1.26706,-2.841 2.841,-2.841 l 181.31794,0 c 1.57395,0 2.84106,1.2671 2.84106,2.841 z"
+ id="path3978-6-0"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="sccssss" />
+ <path
+ style="fill:url(#linearGradient4447-8-1);fill-opacity:1;stroke:none"
+ d="m 561,821.04117 0,142.12497 187,0 0,-142.12497 -187,0 z"
+ id="rect5087-3-1-66"
+ inkscape:connector-curvature="0" />
+ <rect
+ y="-748"
+ x="673.36218"
+ height="187"
+ width="140"
+ id="rect4499-2-3"
+ style="fill:url(#linearGradient4259-3);fill-opacity:1;stroke:none"
+ transform="matrix(0,1,-1,0,0,0)"
+ inkscape:transform-center-x="-517.18858"
+ inkscape:transform-center-y="-551.11111" />
+ <rect
+ style="fill:#000000;stroke:none"
+ id="rect4007-4-2-6"
+ width="187"
+ height="564"
+ x="748"
+ y="488.36218" />
+ <rect
+ style="fill:url(#linearGradient4487-4-9-7);fill-opacity:1;stroke:none"
+ id="rect5069-3-7-0-3"
+ width="280"
+ height="187"
+ x="-813.32202"
+ y="748.00006"
+ transform="matrix(0,-1,1,0,0,0)" />
+ <path
+ style="fill:url(#radialGradient4484-3-5-2);fill-opacity:1;stroke:none"
+ d="m 935.00001,523.16372 0,10.15843 c -11.86534,0 -184.22986,0 -187,0 l 0,-10.15843 c 0,-1.574 1.26711,-2.8411 2.84105,-2.8411 l 181.31795,0 c 1.57395,0 2.841,1.2671 2.841,2.8411 z"
+ id="path5071-6-1-32-3"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="sccssss" />
+ <path
+ style="fill:url(#radialGradient4481-5-6-8);fill-opacity:1;stroke:none"
+ d="m 880.04062,496.36282 c 0,6.64737 0,19.83235 0,23.95935 l -78.08122,0 c 0,-4.9106 0,-17.13315 0,-23.95935 0,-4.477 3.60422,-8.0813 8.08122,-8.0813 l 61.91878,0 c 4.47699,0 8.08122,3.6043 8.08122,8.0813 z"
+ id="path5073-6-7-7-9"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccssc" />
+ <path
+ sodipodi:nodetypes="sccssss"
+ inkscape:connector-curvature="0"
+ id="path5075-1-3-2-0"
+ d="m 748.00001,818.48117 0,-5.159 c 12.12743,0 184.22986,0 187,0 l 0,5.159 c 0,1.5739 -1.26706,2.841 -2.841,2.841 l -181.31794,0 c -1.57395,0 -2.84106,-1.2671 -2.84106,-2.841 z"
+ style="fill:url(#radialGradient4478-2-7-7);fill-opacity:1;stroke:none" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:url(#linearGradient4453-4-5-7);fill-opacity:1;stroke:none"
+ d="m 748.00001,829.29084 0,133.875 187,0 0,-133.875 -187,0 z"
+ id="rect3972-8-3-9" />
+ <path
+ style="fill:url(#radialGradient4450-6-2-7);fill-opacity:1;stroke:none"
+ d="m 935.00004,824.12247 0,5.15897 c -12.12743,0 -184.22986,0 -187,0 l 0,-5.15897 c 0,-1.5739 1.26706,-2.841 2.841,-2.841 l 181.31794,0 c 1.57395,0 2.84106,1.2671 2.84106,2.841 z"
+ id="path3978-6-0-8"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="sccssss" />
+ <path
+ style="fill:url(#linearGradient4447-8-1-2);fill-opacity:1;stroke:none"
+ d="m 748.00001,821.04117 0,142.12497 187,0 0,-142.12497 -187,0 z"
+ id="rect5087-3-1-66-2"
+ inkscape:connector-curvature="0" />
+ <rect
+ y="-935"
+ x="623.36224"
+ height="187"
+ width="190"
+ id="rect4499-2-3-0"
+ style="fill:url(#linearGradient4259-3-7);fill-opacity:1;stroke:none"
+ transform="matrix(0,1,-1,0,0,0)"
+ inkscape:transform-center-x="-517.18858"
+ inkscape:transform-center-y="-747.9364" />
+ <rect
+ style="fill:#000000;stroke:none"
+ id="rect4007-4-2-6-9"
+ width="187"
+ height="564"
+ x="935"
+ y="488.36218" />
+ <rect
+ style="fill:url(#linearGradient4487-4-9-7-0);fill-opacity:1;stroke:none"
+ id="rect5069-3-7-0-3-0"
+ width="280"
+ height="187"
+ x="-813.32196"
+ y="935"
+ transform="matrix(0,-1,1,0,0,0)" />
+ <path
+ style="fill:url(#radialGradient4484-3-5-2-0);fill-opacity:1;stroke:none"
+ d="m 1122,523.16372 0,10.15843 c -11.8653,0 -184.2299,0 -187,0 l 0,-10.15843 c 0,-1.574 1.2671,-2.8411 2.841,-2.8411 l 181.318,0 c 1.5739,0 2.841,1.2671 2.841,2.8411 z"
+ id="path5071-6-1-32-3-8"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="sccssss" />
+ <path
+ style="fill:url(#radialGradient4481-5-6-8-2);fill-opacity:1;stroke:none"
+ d="m 1067.0406,496.36282 c 0,6.64737 0,19.83235 0,23.95935 l -78.0812,0 c 0,-4.9106 0,-17.13315 0,-23.95935 0,-4.477 3.6042,-8.0813 8.0812,-8.0813 l 61.9188,0 c 4.477,0 8.0812,3.6043 8.0812,8.0813 z"
+ id="path5073-6-7-7-9-8"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccssc" />
+ <path
+ sodipodi:nodetypes="sccssss"
+ inkscape:connector-curvature="0"
+ id="path5075-1-3-2-0-8"
+ d="m 935,818.48117 0,-5.159 c 12.1274,0 184.2299,0 187,0 l 0,5.159 c 0,1.5739 -1.2671,2.841 -2.841,2.841 l -181.3179,0 c -1.574,0 -2.8411,-1.2671 -2.8411,-2.841 z"
+ style="fill:url(#radialGradient4478-2-7-7-1);fill-opacity:1;stroke:none" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:url(#linearGradient4453-4-5-7-7);fill-opacity:1;stroke:none"
+ d="m 935,829.29084 0,133.875 187,0 0,-133.875 -187,0 z"
+ id="rect3972-8-3-9-9" />
+ <path
+ style="fill:url(#radialGradient4450-6-2-7-1);fill-opacity:1;stroke:none"
+ d="m 1122,824.12247 0,5.15897 c -12.1274,0 -184.2298,0 -187,0 l 0,-5.15897 c 0,-1.5739 1.2671,-2.841 2.841,-2.841 l 181.318,0 c 1.5739,0 2.841,1.2671 2.841,2.841 z"
+ id="path3978-6-0-8-8"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="sccssss" />
+ <path
+ style="fill:url(#linearGradient4447-8-1-2-9);fill-opacity:1;stroke:none"
+ d="m 935,821.04117 0,142.12497 187,0 0,-142.12497 -187,0 z"
+ id="rect5087-3-1-66-2-1"
+ inkscape:connector-curvature="0" />
+ <rect
+ y="-1122"
+ x="573.36218"
+ height="187"
+ width="240"
+ id="rect4499-2-3-0-8"
+ style="fill:url(#linearGradient4259-3-7-8);fill-opacity:1;stroke:none"
+ transform="matrix(0,1,-1,0,0,0)"
+ inkscape:transform-center-x="-517.18858"
+ inkscape:transform-center-y="-944.76177" />
+ <rect
+ style="fill:#000000;stroke:none"
+ id="rect4007-4-2-6-9-0"
+ width="187"
+ height="564"
+ x="1122"
+ y="488.36218" />
+ <rect
+ style="fill:url(#linearGradient4487-4-9-7-0-8);fill-opacity:1;stroke:none"
+ id="rect5069-3-7-0-3-0-6"
+ width="280"
+ height="187"
+ x="-813.3219"
+ y="1122"
+ transform="matrix(0,-1,1,0,0,0)" />
+ <path
+ style="fill:url(#radialGradient4484-3-5-2-0-6);fill-opacity:1;stroke:none"
+ d="m 1309,523.16371 0,10.15843 c -11.8653,0 -184.2299,0 -187,0 l 0,-10.15843 c 0,-1.574 1.2671,-2.8411 2.841,-2.8411 l 181.318,0 c 1.5739,0 2.841,1.2671 2.841,2.8411 z"
+ id="path5071-6-1-32-3-8-7"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="sccssss" />
+ <path
+ style="fill:url(#radialGradient4481-5-6-8-2-5);fill-opacity:1;stroke:none"
+ d="m 1254.0406,496.36281 c 0,6.64737 0,19.83235 0,23.95935 l -78.0812,0 c 0,-4.9106 0,-17.13315 0,-23.95935 0,-4.477 3.6042,-8.0813 8.0812,-8.0813 l 61.9188,0 c 4.477,0 8.0812,3.6043 8.0812,8.0813 z"
+ id="path5073-6-7-7-9-8-6"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccssc" />
+ <path
+ sodipodi:nodetypes="sccssss"
+ inkscape:connector-curvature="0"
+ id="path5075-1-3-2-0-8-7"
+ d="m 1122,818.48116 0,-5.159 c 12.1274,0 184.2299,0 187,0 l 0,5.159 c 0,1.5739 -1.2671,2.841 -2.841,2.841 l -181.3179,0 c -1.574,0 -2.8411,-1.2671 -2.8411,-2.841 z"
+ style="fill:url(#radialGradient4478-2-7-7-1-3);fill-opacity:1;stroke:none" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:url(#linearGradient4453-4-5-7-7-3);fill-opacity:1;stroke:none"
+ d="m 1122,829.29083 0,133.875 187,0 0,-133.875 -187,0 z"
+ id="rect3972-8-3-9-9-9" />
+ <path
+ style="fill:url(#radialGradient4450-6-2-7-1-2);fill-opacity:1;stroke:none"
+ d="m 1309,824.12246 0,5.15897 c -12.1274,0 -184.2298,0 -187,0 l 0,-5.15897 c 0,-1.5739 1.2671,-2.841 2.841,-2.841 l 181.318,0 c 1.5739,0 2.841,1.2671 2.841,2.841 z"
+ id="path3978-6-0-8-8-7"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="sccssss" />
+ <path
+ style="fill:url(#linearGradient4447-8-1-2-9-7);fill-opacity:1;stroke:none"
+ d="m 1122,821.04116 0,142.12497 187,0 0,-142.12497 -187,0 z"
+ id="rect5087-3-1-66-2-1-4"
+ inkscape:connector-curvature="0" />
+ <rect
+ y="-1309"
+ x="533.36218"
+ height="187"
+ width="280"
+ id="rect4499-2-3-0-8-5"
+ style="fill:url(#linearGradient4259-3-7-8-8);fill-opacity:1;stroke:none"
+ transform="matrix(0,1,-1,0,0,0)"
+ inkscape:transform-center-x="-517.18858"
+ inkscape:transform-center-y="-1102.222" />
+ <rect
+ style="fill:#000000;stroke:none"
+ id="rect4007-4-2-6-9-0-4"
+ width="187"
+ height="564"
+ x="1309"
+ y="488.36218" />
+ <rect
+ style="fill:url(#linearGradient4487-4-9-7-0-8-1);fill-opacity:1;stroke:none"
+ id="rect5069-3-7-0-3-0-6-7"
+ width="280"
+ height="187"
+ x="-813.32184"
+ y="1309"
+ transform="matrix(0,-1,1,0,0,0)" />
+ <path
+ style="fill:url(#radialGradient4484-3-5-2-0-6-2);fill-opacity:1;stroke:none"
+ d="m 1496,523.16371 0,10.15843 c -11.8653,0 -184.2299,0 -187,0 l 0,-10.15843 c 0,-1.574 1.2671,-2.8411 2.841,-2.8411 l 181.318,0 c 1.5739,0 2.841,1.2671 2.841,2.8411 z"
+ id="path5071-6-1-32-3-8-7-0"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="sccssss" />
+ <path
+ style="fill:url(#radialGradient4481-5-6-8-2-5-3);fill-opacity:1;stroke:none"
+ d="m 1441.0406,496.36281 c 0,6.64737 0,19.83235 0,23.95935 l -78.0812,0 c 0,-4.9106 0,-17.13315 0,-23.95935 0,-4.477 3.6042,-8.0813 8.0812,-8.0813 l 61.9188,0 c 4.477,0 8.0812,3.6043 8.0812,8.0813 z"
+ id="path5073-6-7-7-9-8-6-9"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccssc" />
+ <path
+ sodipodi:nodetypes="sccssss"
+ inkscape:connector-curvature="0"
+ id="path5075-1-3-2-0-8-7-0"
+ d="m 1309,818.48116 0,-5.159 c 12.1274,0 184.2299,0 187,0 l 0,5.159 c 0,1.5739 -1.2671,2.841 -2.841,2.841 l -181.3179,0 c -1.574,0 -2.8411,-1.2671 -2.8411,-2.841 z"
+ style="fill:url(#radialGradient4478-2-7-7-1-3-5);fill-opacity:1;stroke:none" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:url(#linearGradient4453-4-5-7-7-3-6);fill-opacity:1;stroke:none"
+ d="m 1309,829.29083 0,133.875 187,0 0,-133.875 -187,0 z"
+ id="rect3972-8-3-9-9-9-5" />
+ <path
+ style="fill:url(#radialGradient4450-6-2-7-1-2-1);fill-opacity:1;stroke:none"
+ d="m 1496,824.12246 0,5.15897 c -12.1274,0 -184.2298,0 -187,0 l 0,-5.15897 c 0,-1.5739 1.2671,-2.841 2.841,-2.841 l 181.318,0 c 1.5739,0 2.841,1.2671 2.841,2.841 z"
+ id="path3978-6-0-8-8-7-6"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="sccssss" />
+ <path
+ style="fill:url(#linearGradient4447-8-1-2-9-7-9);fill-opacity:1;stroke:none"
+ d="m 1309,821.04116 0,142.12497 187,0 0,-142.12497 -187,0 z"
+ id="rect5087-3-1-66-2-1-4-9"
+ inkscape:connector-curvature="0" />
+ <rect
+ y="-1496"
+ x="533.36218"
+ height="187"
+ width="280"
+ id="rect4499-2-3-0-8-5-7"
+ style="fill:url(#linearGradient4259-3-7-8-8-0);fill-opacity:1;stroke:none"
+ transform="matrix(0,1,-1,0,0,0)"
+ inkscape:transform-center-x="-517.18858"
+ inkscape:transform-center-y="-1102.222" />
+ <path
+ style="fill:#cccccc;fill-opacity:1;stroke:none"
+ d="m 1382.7474,592.70831 55.6977,0 -25.1063,59.57758 34.2311,0 -72.0485,101.73016 17.7749,-68.1223 -35.8662,0 z"
+ id="rect9748"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cccccccc" />
+ </g>
+</svg>
diff --git a/ril-wrapper/Android.mk b/ril-wrapper/Android.mk
deleted file mode 100644
index 698e1d3..0000000
--- a/ril-wrapper/Android.mk
+++ /dev/null
@@ -1,9 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= ril-wrapper.c
-LOCAL_SHARED_LIBRARIES := liblog libbinder
-LOCAL_MODULE:= ril-wrapper
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/ril-wrapper/ril-wrapper.c b/ril-wrapper/ril-wrapper.c
deleted file mode 100644
index 886cb34..0000000
--- a/ril-wrapper/ril-wrapper.c
+++ /dev/null
@@ -1,99 +0,0 @@
-#define LOG_TAG "RilWrapper"
-#define RIL_SHLIB
-#include <telephony/ril_cdma_sms.h>
-#include <sys/system_properties.h>
-#include <telephony/librilutils.h>
-#include <cutils/sockets.h>
-#include <telephony/ril.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/cdefs.h>
-#include <utils/Log.h>
-#include <sys/stat.h>
-#include <pthread.h>
-#include <termios.h>
-#include <alloca.h>
-#include <assert.h>
-#include <getopt.h>
-#include <string.h>
-#include <unistd.h>
-#include <dlfcn.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-
-#define REAL_RIL_NAME "/system/lib/libsec-ril.so"
-
-
-static RIL_RadioFunctions const *mRealRadioFuncs;
-static const struct RIL_Env *mEnv;
-
-static void rilOnRequest(int request, void *data, size_t datalen, RIL_Token t)
-{
- switch (request) {
- case RIL_REQUEST_GET_RADIO_CAPABILITY:
- RLOGW("Returning NOT_SUPPORTED on GET_RADIO_CAPABILITY");
- mEnv->OnRequestComplete(t, RIL_E_REQUEST_NOT_SUPPORTED, NULL, 0);
- break;
- default:
- mRealRadioFuncs->onRequest(request, data, datalen, t);
- }
-}
-
-const RIL_RadioFunctions* RIL_Init(const struct RIL_Env *env, int argc, char **argv)
-{
- RIL_RadioFunctions const* (*fRealRilInit)(const struct RIL_Env *env, int argc, char **argv);
- static RIL_RadioFunctions rilInfo;
- void *realRilLibHandle;
- int i;
-
-
- //save the env;
- mEnv = env;
-
- //get the real RIL
- realRilLibHandle = dlopen(REAL_RIL_NAME, RTLD_LOCAL);
- if (!realRilLibHandle) {
- RLOGE("Failed to load the real RIL '" REAL_RIL_NAME "': %s\n", dlerror());
- return NULL;
- }
-
- //remove "-c" command line as Samsung's RIL does not understand it - it just barfs instead
- for (i = 0; i < argc; i++) {
- if (!strcmp(argv[i], "-c") && i != argc -1) { //found it
- memcpy(argv + i, argv + i + 2, sizeof(char*[argc - i - 2]));
- argc -= 2;
- }
- }
-
- //load the real RIL
- fRealRilInit = dlsym(realRilLibHandle, "RIL_Init");
- if (!fRealRilInit) {
- RLOGE("Failed to find the real RIL's entry point\n");
- goto out_fail;
- }
-
- RLOGD("Calling the real RIL's entry point with %u args\n", argc);
- for (i = 0; i < argc; i++)
- RLOGD(" argv[%2d] = '%s'\n", i, argv[i]);
-
- //try to init the real ril
- mRealRadioFuncs = fRealRilInit(env, argc, argv);
- if (!mRealRadioFuncs) {
- RLOGE("The real RIL's entry point failed\n");
- goto out_fail;
- }
-
- //copy the real RIL's info struct, then replace the onRequest pointer with our own
- rilInfo = *mRealRadioFuncs;
- rilInfo.onRequest = rilOnRequest;
-
- RLOGD("Wrapped RIL version is '%s'\n", mRealRadioFuncs->getVersion());
-
- //we're all good - return to caller
- return &rilInfo;
-
-out_fail:
- dlclose(realRilLibHandle);
- return NULL;
-}
diff --git a/ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java b/ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java
deleted file mode 100644
index 8aaca62..0000000
--- a/ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java
+++ /dev/null
@@ -1,530 +0,0 @@
-/*
- * Copyright (C) 2011 The CyanogenMod Project <http://www.cyanogenmod.org>
- * Copyright (C) 2014 The OmniROM Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.telephony;
-
-import static com.android.internal.telephony.RILConstants.*;
-
-import android.content.Context;
-import android.os.AsyncResult;
-import android.os.Handler;
-import android.os.Message;
-import android.os.Parcel;
-import android.os.Registrant;
-import android.telephony.ModemActivityInfo;
-import android.telephony.Rlog;
-
-import android.telephony.PhoneNumberUtils;
-
-public class SamsungExynos4RIL extends RIL implements CommandsInterface {
-
- //SAMSUNG STATES
- static final int RIL_REQUEST_GET_CELL_BROADCAST_CONFIG = 10002;
-
- static final int RIL_REQUEST_SEND_ENCODED_USSD = 10005;
- static final int RIL_REQUEST_SET_PDA_MEMORY_STATUS = 10006;
- static final int RIL_REQUEST_GET_PHONEBOOK_STORAGE_INFO = 10007;
- static final int RIL_REQUEST_GET_PHONEBOOK_ENTRY = 10008;
- static final int RIL_REQUEST_ACCESS_PHONEBOOK_ENTRY = 10009;
- static final int RIL_REQUEST_DIAL_VIDEO_CALL = 10010;
- static final int RIL_REQUEST_CALL_DEFLECTION = 10011;
- static final int RIL_REQUEST_READ_SMS_FROM_SIM = 10012;
- static final int RIL_REQUEST_USIM_PB_CAPA = 10013;
- static final int RIL_REQUEST_LOCK_INFO = 10014;
-
- static final int RIL_REQUEST_DIAL_EMERGENCY = 10016;
- static final int RIL_REQUEST_GET_STOREAD_MSG_COUNT = 10017;
- static final int RIL_REQUEST_STK_SIM_INIT_EVENT = 10018;
- static final int RIL_REQUEST_GET_LINE_ID = 10019;
- static final int RIL_REQUEST_SET_LINE_ID = 10020;
- static final int RIL_REQUEST_GET_SERIAL_NUMBER = 10021;
- static final int RIL_REQUEST_GET_MANUFACTURE_DATE_NUMBER = 10022;
- static final int RIL_REQUEST_GET_BARCODE_NUMBER = 10023;
- static final int RIL_REQUEST_UICC_GBA_AUTHENTICATE_BOOTSTRAP = 10024;
- static final int RIL_REQUEST_UICC_GBA_AUTHENTICATE_NAF = 10025;
- static final int RIL_REQUEST_SIM_TRANSMIT_BASIC = 10026;
- static final int RIL_REQUEST_SIM_OPEN_CHANNEL = 10027;
- static final int RIL_REQUEST_SIM_CLOSE_CHANNEL = 10028;
- static final int RIL_REQUEST_SIM_TRANSMIT_CHANNEL = 10029;
- static final int RIL_REQUEST_SIM_AUTH = 10030;
- static final int RIL_REQUEST_PS_ATTACH = 10031;
- static final int RIL_REQUEST_PS_DETACH = 10032;
- static final int RIL_REQUEST_ACTIVATE_DATA_CALL = 10033;
- static final int RIL_REQUEST_CHANGE_SIM_PERSO = 10034;
- static final int RIL_REQUEST_ENTER_SIM_PERSO = 10035;
- static final int RIL_REQUEST_GET_TIME_INFO = 10036;
- static final int RIL_REQUEST_OMADM_SETUP_SESSION = 10037;
- static final int RIL_REQUEST_OMADM_SERVER_START_SESSION = 10038;
- static final int RIL_REQUEST_OMADM_CLIENT_START_SESSION = 10039;
- static final int RIL_REQUEST_OMADM_SEND_DATA = 10040;
- static final int RIL_REQUEST_CDMA_GET_DATAPROFILE = 10041;
- static final int RIL_REQUEST_CDMA_SET_DATAPROFILE = 10042;
- static final int RIL_REQUEST_CDMA_GET_SYSTEMPROPERTIES = 10043;
- static final int RIL_REQUEST_CDMA_SET_SYSTEMPROPERTIES = 10044;
- static final int RIL_REQUEST_SEND_SMS_COUNT = 10045;
- static final int RIL_REQUEST_SEND_SMS_MSG = 10046;
- static final int RIL_REQUEST_SEND_SMS_MSG_READ_STATUS = 10047;
- static final int RIL_REQUEST_MODEM_HANGUP = 10048;
- static final int RIL_REQUEST_SET_SIM_POWER = 10049;
- static final int RIL_REQUEST_SET_PREFERRED_NETWORK_LIST = 10050;
- static final int RIL_REQUEST_GET_PREFERRED_NETWORK_LIST = 10051;
- static final int RIL_REQUEST_HANGUP_VT = 10052;
-
- static final int RIL_UNSOL_RELEASE_COMPLETE_MESSAGE = 11001;
- static final int RIL_UNSOL_STK_SEND_SMS_RESULT = 11002;
- static final int RIL_UNSOL_STK_CALL_CONTROL_RESULT = 11003;
- static final int RIL_UNSOL_DUN_CALL_STATUS = 11004;
-
- static final int RIL_UNSOL_O2_HOME_ZONE_INFO = 11007;
- static final int RIL_UNSOL_DEVICE_READY_NOTI = 11008;
- static final int RIL_UNSOL_GPS_NOTI = 11009;
- static final int RIL_UNSOL_AM = 11010;
- static final int RIL_UNSOL_DUN_PIN_CONTROL_SIGNAL = 11011;
- static final int RIL_UNSOL_DATA_SUSPEND_RESUME = 11012;
- static final int RIL_UNSOL_SAP = 11013;
-
- static final int RIL_UNSOL_SIM_SMS_STORAGE_AVAILALE = 11015;
- static final int RIL_UNSOL_HSDPA_STATE_CHANGED = 11016;
- static final int RIL_UNSOL_WB_AMR_STATE = 11017;
- static final int RIL_UNSOL_TWO_MIC_STATE = 11018;
- static final int RIL_UNSOL_DHA_STATE = 11019;
- static final int RIL_UNSOL_UART = 11020;
- static final int RIL_UNSOL_RESPONSE_HANDOVER = 11021;
- static final int RIL_UNSOL_IPV6_ADDR = 11022;
- static final int RIL_UNSOL_NWK_INIT_DISC_REQUEST = 11023;
- static final int RIL_UNSOL_RTS_INDICATION = 11024;
- static final int RIL_UNSOL_OMADM_SEND_DATA = 11025;
- static final int RIL_UNSOL_DUN = 11026;
- static final int RIL_UNSOL_SYSTEM_REBOOT = 11027;
- static final int RIL_UNSOL_VOICE_PRIVACY_CHANGED = 11028;
- static final int RIL_UNSOL_UTS_GETSMSCOUNT = 11029;
- static final int RIL_UNSOL_UTS_GETSMSMSG = 11030;
- static final int RIL_UNSOL_UTS_GET_UNREAD_SMS_STATUS = 11031;
- static final int RIL_UNSOL_MIP_CONNECT_STATUS = 11032;
-
- private Object mCatProCmdBuffer;
- /* private Message mPendingGetSimStatus; */
-
- public SamsungExynos4RIL(Context context, int networkMode, int cdmaSubscription, Integer instanceId) {
- super(context, networkMode, cdmaSubscription, instanceId);
- }
-
- static String
- requestToString(int request) {
- switch (request) {
- case RIL_REQUEST_DIAL_EMERGENCY: return "DIAL_EMERGENCY";
- default: return RIL.requestToString(request);
- }
- }
-
- static String
- responseToString(int response) {
- switch (response) {
- case RIL_UNSOL_STK_SEND_SMS_RESULT: return "RIL_UNSOL_STK_SEND_SMS_RESULT";
- default: return RIL.responseToString(response);
- }
- }
-
-
- @Override
- protected RILRequest processSolicited (Parcel p) {
- int serial, error;
- boolean found = false;
-
- serial = p.readInt();
- error = p.readInt();
-
- RILRequest rr;
-
- rr = findAndRemoveRequestFromList(serial);
-
- if (rr == null) {
- Rlog.w(RILJ_LOG_TAG, "Unexpected solicited response! sn: "
- + serial + " error: " + error);
- return null;
- }
-
- Object ret = null;
-
- if (error == 0 || p.dataAvail() > 0) {
- // either command succeeds or command fails but with data payload
- try {switch (rr.mRequest) {
- /*
- cat libs/telephony/ril_commands.h \
- | egrep "^ *{RIL_" \
- | sed -re 's/\{([^,]+),[^,]+,([^}]+).+/case \1: ret = \2(p); break;/'
- */
- case RIL_REQUEST_GET_SIM_STATUS: ret = responseIccCardStatus(p); break;
- case RIL_REQUEST_ENTER_SIM_PIN: ret = responseInts(p); break;
- case RIL_REQUEST_ENTER_SIM_PUK: ret = responseInts(p); break;
- case RIL_REQUEST_ENTER_SIM_PIN2: ret = responseInts(p); break;
- case RIL_REQUEST_ENTER_SIM_PUK2: ret = responseInts(p); break;
- case RIL_REQUEST_CHANGE_SIM_PIN: ret = responseInts(p); break;
- case RIL_REQUEST_CHANGE_SIM_PIN2: ret = responseInts(p); break;
- case RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION: ret = responseInts(p); break;
- case RIL_REQUEST_GET_CURRENT_CALLS: ret = responseCallList(p); break;
- case RIL_REQUEST_DIAL: ret = responseVoid(p); break;
- case RIL_REQUEST_DIAL_EMERGENCY: ret = responseVoid(p); break;
- case RIL_REQUEST_GET_IMSI: ret = responseString(p); break;
- case RIL_REQUEST_HANGUP: ret = responseVoid(p); break;
- case RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND: ret = responseVoid(p); break;
- case RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND: {
- if (mTestingEmergencyCall.getAndSet(false)) {
- if (mEmergencyCallbackModeRegistrant != null) {
- riljLog("testing emergency call, notify ECM Registrants");
- mEmergencyCallbackModeRegistrant.notifyRegistrant();
- }
- }
- ret = responseVoid(p);
- break;
- }
- case RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE: ret = responseVoid(p); break;
- case RIL_REQUEST_CONFERENCE: ret = responseVoid(p); break;
- case RIL_REQUEST_UDUB: ret = responseVoid(p); break;
- case RIL_REQUEST_LAST_CALL_FAIL_CAUSE: ret = responseFailCause(p); break;
- case RIL_REQUEST_SIGNAL_STRENGTH: ret = responseSignalStrength(p); break;
- case RIL_REQUEST_VOICE_REGISTRATION_STATE: ret = responseStrings(p); break;
- case RIL_REQUEST_DATA_REGISTRATION_STATE: ret = responseStrings(p); break;
- case RIL_REQUEST_OPERATOR: ret = responseStrings(p); break;
- case RIL_REQUEST_RADIO_POWER: ret = responseVoid(p); break;
- case RIL_REQUEST_DTMF: ret = responseVoid(p); break;
- case RIL_REQUEST_SEND_SMS: ret = responseSMS(p); break;
- case RIL_REQUEST_SEND_SMS_EXPECT_MORE: ret = responseSMS(p); break;
- case RIL_REQUEST_SETUP_DATA_CALL: ret = responseSetupDataCall(p); break;
- case RIL_REQUEST_SIM_IO: ret = responseICC_IO(p); break;
- case RIL_REQUEST_SEND_USSD: ret = responseVoid(p); break;
- case RIL_REQUEST_CANCEL_USSD: ret = responseVoid(p); break;
- case RIL_REQUEST_GET_CLIR: ret = responseInts(p); break;
- case RIL_REQUEST_SET_CLIR: ret = responseVoid(p); break;
- case RIL_REQUEST_QUERY_CALL_FORWARD_STATUS: ret = responseCallForward(p); break;
- case RIL_REQUEST_SET_CALL_FORWARD: ret = responseVoid(p); break;
- case RIL_REQUEST_QUERY_CALL_WAITING: ret = responseInts(p); break;
- case RIL_REQUEST_SET_CALL_WAITING: ret = responseVoid(p); break;
- case RIL_REQUEST_SMS_ACKNOWLEDGE: ret = responseVoid(p); break;
- case RIL_REQUEST_GET_IMEI: ret = responseString(p); break;
- case RIL_REQUEST_GET_IMEISV: ret = responseString(p); break;
- case RIL_REQUEST_ANSWER: ret = responseVoid(p); break;
- case RIL_REQUEST_DEACTIVATE_DATA_CALL: ret = responseVoid(p); break;
- case RIL_REQUEST_QUERY_FACILITY_LOCK: ret = responseInts(p); break;
- case RIL_REQUEST_SET_FACILITY_LOCK: ret = responseInts(p); break;
- case RIL_REQUEST_CHANGE_BARRING_PASSWORD: ret = responseVoid(p); break;
- case RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE: ret = responseInts(p); break;
- case RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC: ret = responseVoid(p); break;
- case RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL: ret = responseVoid(p); break;
- case RIL_REQUEST_QUERY_AVAILABLE_NETWORKS : ret = responseOperatorInfos(p); break;
- case RIL_REQUEST_DTMF_START: ret = responseVoid(p); break;
- case RIL_REQUEST_DTMF_STOP: ret = responseVoid(p); break;
- case RIL_REQUEST_BASEBAND_VERSION: ret = responseString(p); break;
- case RIL_REQUEST_SEPARATE_CONNECTION: ret = responseVoid(p); break;
- case RIL_REQUEST_SET_MUTE: ret = responseVoid(p); break;
- case RIL_REQUEST_GET_MUTE: ret = responseInts(p); break;
- case RIL_REQUEST_QUERY_CLIP: ret = responseInts(p); break;
- case RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE: ret = responseInts(p); break;
- case RIL_REQUEST_DATA_CALL_LIST: ret = responseDataCallList(p); break;
- case RIL_REQUEST_RESET_RADIO: ret = responseVoid(p); break;
- case RIL_REQUEST_OEM_HOOK_RAW: ret = responseRaw(p); break;
- case RIL_REQUEST_OEM_HOOK_STRINGS: ret = responseStrings(p); break;
- case RIL_REQUEST_SCREEN_STATE: ret = responseVoid(p); break;
- case RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION: ret = responseVoid(p); break;
- case RIL_REQUEST_WRITE_SMS_TO_SIM: ret = responseInts(p); break;
- case RIL_REQUEST_DELETE_SMS_ON_SIM: ret = responseVoid(p); break;
- case RIL_REQUEST_SET_BAND_MODE: ret = responseVoid(p); break;
- case RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE: ret = responseInts(p); break;
- case RIL_REQUEST_STK_GET_PROFILE: ret = responseString(p); break;
- case RIL_REQUEST_STK_SET_PROFILE: ret = responseVoid(p); break;
- case RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND: ret = responseString(p); break;
- case RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE: ret = responseVoid(p); break;
- case RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM: ret = responseInts(p); break;
- case RIL_REQUEST_EXPLICIT_CALL_TRANSFER: ret = responseVoid(p); break;
- case RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE: ret = responseVoid(p); break;
- case RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE: ret = responseGetPreferredNetworkType(p); break;
- case RIL_REQUEST_GET_NEIGHBORING_CELL_IDS: ret = responseCellList(p); break;
- case RIL_REQUEST_SET_LOCATION_UPDATES: ret = responseVoid(p); break;
- case RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE: ret = responseVoid(p); break;
- case RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE: ret = responseVoid(p); break;
- case RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE: ret = responseInts(p); break;
- case RIL_REQUEST_SET_TTY_MODE: ret = responseVoid(p); break;
- case RIL_REQUEST_QUERY_TTY_MODE: ret = responseInts(p); break;
- case RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE: ret = responseVoid(p); break;
- case RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE: ret = responseInts(p); break;
- case RIL_REQUEST_CDMA_FLASH: ret = responseVoid(p); break;
- case RIL_REQUEST_CDMA_BURST_DTMF: ret = responseVoid(p); break;
- case RIL_REQUEST_CDMA_SEND_SMS: ret = responseSMS(p); break;
- case RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE: ret = responseVoid(p); break;
- case RIL_REQUEST_GSM_GET_BROADCAST_CONFIG: ret = responseGmsBroadcastConfig(p); break;
- case RIL_REQUEST_GSM_SET_BROADCAST_CONFIG: ret = responseVoid(p); break;
- case RIL_REQUEST_GSM_BROADCAST_ACTIVATION: ret = responseVoid(p); break;
- case RIL_REQUEST_CDMA_GET_BROADCAST_CONFIG: ret = responseCdmaBroadcastConfig(p); break;
- case RIL_REQUEST_CDMA_SET_BROADCAST_CONFIG: ret = responseVoid(p); break;
- case RIL_REQUEST_CDMA_BROADCAST_ACTIVATION: ret = responseVoid(p); break;
- case RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY: ret = responseVoid(p); break;
- case RIL_REQUEST_CDMA_SUBSCRIPTION: ret = responseStrings(p); break;
- case RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM: ret = responseInts(p); break;
- case RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM: ret = responseVoid(p); break;
- case RIL_REQUEST_DEVICE_IDENTITY: ret = responseStrings(p); break;
- case RIL_REQUEST_GET_SMSC_ADDRESS: ret = responseString(p); break;
- case RIL_REQUEST_SET_SMSC_ADDRESS: ret = responseVoid(p); break;
- case RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE: ret = responseVoid(p); break;
- case RIL_REQUEST_REPORT_SMS_MEMORY_STATUS: ret = responseVoid(p); break;
- case RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING: ret = responseVoid(p); break;
- case RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE: ret = responseInts(p); break;
- case RIL_REQUEST_ISIM_AUTHENTICATION: ret = responseString(p); break;
- case RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU: ret = responseVoid(p); break;
- case RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS: ret = responseICC_IO(p); break;
- case RIL_REQUEST_VOICE_RADIO_TECH: ret = responseInts(p); break;
- case RIL_REQUEST_GET_CELL_INFO_LIST: ret = responseCellInfoList(p); break;
- case RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE: ret = responseVoid(p); break;
- case RIL_REQUEST_SET_INITIAL_ATTACH_APN: ret = responseVoid(p); break;
- case RIL_REQUEST_SET_DATA_PROFILE: ret = responseVoid(p); break;
- case RIL_REQUEST_IMS_REGISTRATION_STATE: ret = responseInts(p); break;
- case RIL_REQUEST_IMS_SEND_SMS: ret = responseSMS(p); break;
- case RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC: ret = responseICC_IO(p); break;
- case RIL_REQUEST_SIM_OPEN_CHANNEL: ret = responseInts(p); break;
- case RIL_REQUEST_SIM_CLOSE_CHANNEL: ret = responseVoid(p); break;
- case RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL: ret = responseICC_IO(p); break;
- case RIL_REQUEST_SIM_GET_ATR: ret = responseString(p); break;
- case RIL_REQUEST_NV_READ_ITEM: ret = responseString(p); break;
- case RIL_REQUEST_NV_WRITE_ITEM: ret = responseVoid(p); break;
- case RIL_REQUEST_NV_WRITE_CDMA_PRL: ret = responseVoid(p); break;
- case RIL_REQUEST_NV_RESET_CONFIG: ret = responseVoid(p); break;
- case RIL_REQUEST_SET_UICC_SUBSCRIPTION: ret = responseVoid(p); break;
- case RIL_REQUEST_ALLOW_DATA: ret = responseVoid(p); break;
- case RIL_REQUEST_GET_HARDWARE_CONFIG: ret = responseHardwareConfig(p); break;
- case RIL_REQUEST_SIM_AUTHENTICATION: ret = responseICC_IOBase64(p); break;
- case RIL_REQUEST_SHUTDOWN: ret = responseVoid(p); break;
- case RIL_REQUEST_GET_RADIO_CAPABILITY: ret = responseRadioCapability(p); break;
- case RIL_REQUEST_SET_RADIO_CAPABILITY: ret = responseRadioCapability(p); break;
- case RIL_REQUEST_START_LCE: ret = responseLceStatus(p); break;
- case RIL_REQUEST_STOP_LCE: ret = responseLceStatus(p); break;
- case RIL_REQUEST_PULL_LCEDATA: ret = responseLceData(p); break;
- case RIL_REQUEST_GET_ACTIVITY_INFO: ret = responseActivityData(p); break;
- default:
- throw new RuntimeException("Unrecognized solicited response: " + rr.mRequest);
- //break;
- }} catch (Throwable tr) {
- // Exceptions here usually mean invalid RIL responses
-
- Rlog.w(RILJ_LOG_TAG, rr.serialString() + "< "
- + requestToString(rr.mRequest)
- + " exception, possible invalid RIL response", tr);
-
- if (rr.mResult != null) {
- AsyncResult.forMessage(rr.mResult, null, tr);
- rr.mResult.sendToTarget();
- }
- return rr;
- }
- }
-
- if (rr.mRequest == RIL_REQUEST_SHUTDOWN) {
- // Set RADIO_STATE to RADIO_UNAVAILABLE to continue shutdown process
- // regardless of error code to continue shutdown procedure.
- riljLog("Response to RIL_REQUEST_SHUTDOWN received. Error is " +
- error + " Setting Radio State to Unavailable regardless of error.");
- setRadioState(RadioState.RADIO_UNAVAILABLE);
- }
-
- // Here and below fake RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED, see b/7255789.
- // This is needed otherwise we don't automatically transition to the main lock
- // screen when the pin or puk is entered incorrectly.
- switch (rr.mRequest) {
- case RIL_REQUEST_ENTER_SIM_PUK:
- case RIL_REQUEST_ENTER_SIM_PUK2:
- if (mIccStatusChangedRegistrants != null) {
- if (RILJ_LOGD) {
- riljLog("ON enter sim puk fakeSimStatusChanged: reg count="
- + mIccStatusChangedRegistrants.size());
- }
- mIccStatusChangedRegistrants.notifyRegistrants();
- }
- break;
- }
-
- if (error != 0) {
- switch (rr.mRequest) {
- case RIL_REQUEST_ENTER_SIM_PIN:
- case RIL_REQUEST_ENTER_SIM_PIN2:
- case RIL_REQUEST_CHANGE_SIM_PIN:
- case RIL_REQUEST_CHANGE_SIM_PIN2:
- case RIL_REQUEST_SET_FACILITY_LOCK:
- if (mIccStatusChangedRegistrants != null) {
- if (RILJ_LOGD) {
- riljLog("ON some errors fakeSimStatusChanged: reg count="
- + mIccStatusChangedRegistrants.size());
- }
- mIccStatusChangedRegistrants.notifyRegistrants();
- }
- break;
- case RIL_REQUEST_GET_RADIO_CAPABILITY: {
- // Ideally RIL's would support this or at least give NOT_SUPPORTED
- // but the hammerhead RIL reports GENERIC :(
- // TODO - remove GENERIC_FAILURE catching: b/21079604
- if (REQUEST_NOT_SUPPORTED == error ||
- GENERIC_FAILURE == error) {
- // we should construct the RAF bitmask the radio
- // supports based on preferred network bitmasks
- ret = makeStaticRadioCapability();
- error = 0;
- }
- break;
- }
- case RIL_REQUEST_GET_ACTIVITY_INFO:
- ret = new ModemActivityInfo(0, 0, 0,
- new int [ModemActivityInfo.TX_POWER_LEVELS], 0, 0);
- error = 0;
- break;
- }
-
- if (error != 0) rr.onError(error, ret);
- }
- if (error == 0) {
- if (RILJ_LOGD) riljLog(rr.serialString() + "< " + requestToString(rr.mRequest)
- + " " + retToString(rr.mRequest, ret));
-
- if (rr.mResult != null) {
- AsyncResult.forMessage(rr.mResult, ret, null);
- rr.mResult.sendToTarget();
- }
- }
-
- return rr;
- }
-
- @Override
- public void
- dial(String address, int clirMode, UUSInfo uusInfo, Message result) {
- if (PhoneNumberUtils.isEmergencyNumber(address)) {
- dialEmergencyCall(address, clirMode, result);
- return;
- }
-
- RILRequest rr = RILRequest.obtain(RIL_REQUEST_DIAL, result);
- rr.mParcel.writeString(address);
- rr.mParcel.writeInt(clirMode);
-
- if (uusInfo == null) {
- rr.mParcel.writeInt(0); // UUS information is absent
- } else {
- rr.mParcel.writeInt(1); // UUS information is present
- rr.mParcel.writeInt(uusInfo.getType());
- rr.mParcel.writeInt(uusInfo.getDcs());
- rr.mParcel.writeByteArray(uusInfo.getUserData());
- }
-
- if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
-
- send(rr);
- }
-
- public void
- dialEmergencyCall(String address, int clirMode, Message result) {
- Rlog.v(RILJ_LOG_TAG, "Emergency dial: " + address);
-
- RILRequest rr = RILRequest.obtain(RIL_REQUEST_DIAL_EMERGENCY, result);
- rr.mParcel.writeString(address + "/");
- rr.mParcel.writeInt(clirMode);
- rr.mParcel.writeInt(0); // UUS information is absent
-
- if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
-
- send(rr);
- }
-
- @Override
- protected void
- processUnsolicited (Parcel p) {
- int dataPosition = p.dataPosition();
- int response = p.readInt();
- Object ret;
-
- try{switch(response) {
- case RIL_UNSOL_STK_PROACTIVE_COMMAND: ret = responseString(p); break;
- case RIL_UNSOL_STK_SEND_SMS_RESULT: ret = responseInts(p); break; // Samsung STK
- default:
- // Rewind the Parcel
- p.setDataPosition(dataPosition);
-
- // Forward responses that we are not overriding to the super class
- super.processUnsolicited(p);
- return;
- }} catch (Throwable tr) {
- Rlog.e(RILJ_LOG_TAG, "Exception processing unsol response: " + response +
- " Exception: " + tr.toString());
- return;
- }
-
- switch(response) {
- case RIL_UNSOL_STK_PROACTIVE_COMMAND:
- if (RILJ_LOGD) unsljLogRet(response, ret);
-
- if (mCatProCmdRegistrant != null) {
- mCatProCmdRegistrant.notifyRegistrant(
- new AsyncResult (null, ret, null));
- } else {
- // The RIL will send a CAT proactive command before the
- // registrant is registered. Buffer it to make sure it
- // does not get ignored (and breaks CatService).
- mCatProCmdBuffer = ret;
- }
- break;
- case RIL_UNSOL_STK_SEND_SMS_RESULT:
- if (RILJ_LOGD) unsljLogRet(response, ret);
-
- if (mCatSendSmsResultRegistrant != null) {
- mCatSendSmsResultRegistrant.notifyRegistrant(
- new AsyncResult (null, ret, null));
- }
- break;
- }
-
- }
-
- @Override
- public void setOnCatProactiveCmd(Handler h, int what, Object obj) {
- mCatProCmdRegistrant = new Registrant (h, what, obj);
- if (mCatProCmdBuffer != null) {
- mCatProCmdRegistrant.notifyRegistrant(
- new AsyncResult (null, mCatProCmdBuffer, null));
- mCatProCmdBuffer = null;
- }
- }
-
- private void
- constructGsmSendSmsRilRequest (RILRequest rr, String smscPDU, String pdu) {
- rr.mParcel.writeInt(2);
- rr.mParcel.writeString(smscPDU);
- rr.mParcel.writeString(pdu);
- }
-
- /**
- * The RIL can't handle the RIL_REQUEST_SEND_SMS_EXPECT_MORE
- * request properly, so we use RIL_REQUEST_SEND_SMS instead.
- */
- @Override
- public void
- sendSMSExpectMore (String smscPDU, String pdu, Message result) {
- RILRequest rr
- = RILRequest.obtain(RIL_REQUEST_SEND_SMS, result);
-
- constructGsmSendSmsRilRequest(rr, smscPDU, pdu);
-
- if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
-
- send(rr);
- }
-
-}
diff --git a/rootdir/init.target.rc b/rootdir/init.target.rc
index 55c7369..4fcf34d 100644
--- a/rootdir/init.target.rc
+++ b/rootdir/init.target.rc
@@ -1,5 +1,4 @@
on init
- export LD_SHIM_LIBS /system/lib/libsec-ril.so|libsamsung_symbols.so
# ko files for FM Radio
insmod /system/lib/modules/Si4709_driver.ko
chown system system /sys/devices/system/cpu/cpufreq/pegasusq
@@ -54,6 +53,7 @@ on boot
# increase read-ahead value to 256 kb
write /sys/block/mmcblk0/queue/read_ahead_kb 256
+
on post-fs-data
# icd
exec icd_check
@@ -93,19 +9