m7wls: inherit 8960 common, clean up.

Change-Id: I07df81bc84060bbb7130bbac9577fbeba66af375
diff --git a/BoardConfig.mk b/BoardConfig.mk
index 118b298..4996326 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -24,104 +24,24 @@
 # variant, so that it gets overwritten by the parent (which goes
 # against the traditional rules of inheritance).
 
-BOARD_VENDOR := htc
-
-# inherit from the proprietary version
--include vendor/htc/m7wls/BoardConfigVendor.mk
-
-# Flags
-TARGET_GLOBAL_CFLAGS += -mfpu=neon -mfloat-abi=softfp
-TARGET_GLOBAL_CPPFLAGS += -mfpu=neon -mfloat-abi=softfp
-COMMON_GLOBAL_CFLAGS += -DQCOM_HARDWARE
-
-# QCOM hardware
-BOARD_USES_QCOM_HARDWARE := true
-
-# Platform
-TARGET_BOARD_PLATFORM := msm8960
-TARGET_BOARD_PLATFORM_GPU := qcom-adreno200
-
-# Architecture
-TARGET_ARCH := arm
-TARGET_ARCH_VARIANT := armv7-a-neon
-TARGET_ARCH_VARIANT_CPU := cortex-a9
-TARGET_CPU_ABI := armeabi-v7a
-TARGET_CPU_ABI2 := armeabi
-TARGET_CPU_SMP := true
+# inherit from common msm8960
+-include device/htc/msm8960-common/BoardConfigCommon.mk
 
 # Bootloader
-TARGET_NO_BOOTLOADER := true
+TARGET_BOOTLOADER_BOARD_NAME := m7wls
 
 # Kernel
-BOARD_KERNEL_CMDLINE := console=ttyHSL0,115200,n8 androidboot.hardware=m7 user_debug=31
-BOARD_KERNEL_BASE := 0x80600000
-BOARD_KERNEL_PAGESIZE := 2048
-BOARD_MKBOOTIMG_ARGS := --ramdisk_offset 0x01400000
-TARGET_KERNEL_VERSION := 3.4
 TARGET_KERNEL_CONFIG := m7wls_defconfig
-TARGET_KERNEL_SOURCE := kernel/htc/msm8960
-
-# Audio
-BOARD_USES_ALSA_AUDIO:= true
-BOARD_USES_FLUENCE_INCALL := true
-BOARD_USES_SEPERATED_AUDIO_INPUT := true
-TARGET_QCOM_AUDIO_VARIANT := caf
 
 # Bluetooth
-BOARD_HAVE_BLUETOOTH := true
-BOARD_HAVE_BLUETOOTH_QCOM := true
-BLUETOOTH_HCI_USE_MCT := true
 BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/htc/m7wls/bluetooth
 
-# Camera
-TARGET_PROVIDES_CAMERA_HAL := false
-USE_CAMERA_STUB := true
-
-# Ril
-BOARD_RIL_CLASS := "../../../device/htc/m7wls/libril/"
-BOARD_PROVIDES_LIBRIL := true
-
 # HTClog
 COMMON_GLOBAL_CFLAGS += -DHTCLOG
 
-# Graphics
-USE_OPENGL_RENDERER := true
-TARGET_USES_C2D_COMPOSITION := true
-TARGET_USES_ION := true
-TARGET_QCOM_DISPLAY_VARIANT := caf
-BOARD_HAVE_OLD_ION_API := true
-BOARD_EGL_CFG := device/htc/m7wls/configs/egl.cfg
-
-# Lights
-TARGET_PROVIDES_LIBLIGHTS := true
-
-# Power
-TARGET_PROVIDES_POWERHAL := true
-
 # USB
 TARGET_USE_CUSTOM_LUN_FILE_PATH := /sys/devices/platform/msm_hsusb/gadget/lun%d/file
 
-# Wifi
-WIFI_BAND := 802_11_ABG
-WPA_SUPPLICANT_VERSION := VER_0_8_X
-BOARD_WPA_SUPPLICANT_DRIVER := NL80211
-BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_bcmdhd
-BOARD_HOSTAPD_DRIVER := NL80211
-BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_bcmdhd
-BOARD_WLAN_DEVICE := bcmdhd
-
-WIFI_DRIVER_MODULE_PATH := "/system/lib/modules/bcmdhd.ko"
-WIFI_DRIVER_MODULE_NAME := "bcmdhd"
-WIFI_DRIVER_MODULE_ARG := "firmware_path=/system/etc/firmware/fw_bcm4335.bin nvram_path=/system/etc/calibration"
-WIFI_DRIVER_MODULE_AP_ARG := "firmware_path=/system/etc/firmware/fw_bcm4335_apsta.bin nvram_path=/system/etc/calibration"
-WIFI_DRIVER_FW_PATH_STA := "/system/etc/firmware/fw_bcm4335.bin"
-WIFI_DRIVER_FW_PATH_AP := "/system/etc/firmware/fw_bcm4335_apsta.bin"
-WIFI_DRIVER_FW_PATH_P2P := "/system/etc/firmware/fw_bcm4335_p2p.bin"
-
-# GPS
-BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE := $(TARGET_BOARD_PLATFORM)
-TARGET_NO_RPC := true
-
 # Filesystem
 BOARD_BOOTIMAGE_PARTITION_SIZE := 16777216
 BOARD_RECOVERYIMAGE_PARTITION_SIZE := 16776704
@@ -129,13 +49,28 @@
 BOARD_USERDATAIMAGE_PARTITION_SIZE := 27917287424
 BOARD_FLASH_BLOCK_SIZE := 131072
 
-# Custom Recovery
-TARGET_PREBUILT_KERNEL := device/htc/m7wls/kernel
-BOARD_USE_CUSTOM_RECOVERY_FONT := \"roboto_23x41.h\"
-TARGET_RECOVERY_INITRC := device/htc/m7wls/recovery/init.rc
-BOARD_HAS_NO_SELECT_BUTTON := true
-BOARD_HAS_LARGE_FILESYSTEM := true
-
-# Webkit
-ENABLE_WEBGL := true
-TARGET_FORCE_CPU_UPLOAD := true
+# cat /proc/emmc:
+# dev: size erasesize name
+# mmcblk0p19: 000ffa00 00000200 "misc"
+# mmcblk0p36: 00fffe00 00000200 "recovery"
+# mmcblk0p35: 01000000 00000200 "boot"
+# mmcblk0p37: 73fffc00 00000200 "system"
+# mmcblk0p26: 00140200 00000200 "local"
+# mmcblk0p38: 27fffe00 00000200 "cache"
+# mmcblk0p39: 680000000 00000200 "userdata"
+# mmcblk0p22: 01400000 00000200 "devlog"
+# mmcblk0p24: 00040000 00000200 "pdata"
+# mmcblk0p27: 00010000 00000200 "extra"
+# mmcblk0p33: 04b00200 00000200 "radio"
+# mmcblk0p16: 03c00400 00000200 "adsp"
+# mmcblk0p15: 00100000 00000200 "dsps"
+# mmcblk0p17: 007ffa00 00000200 "radio_config"
+# mmcblk0p20: 00400000 00000200 "modem_st1"
+# mmcblk0p21: 00400000 00000200 "modem_st2"
+# mmcblk0p29: 00040000 00000200 "skylink"
+# mmcblk0p30: 01900000 00000200 "carrier"
+# mmcblk0p28: 00100000 00000200 "cdma_record"
+# mmcblk0p18: 02000000 00000200 "reserve_1"
+# mmcblk0p32: 034ffa00 00000200 "reserve_2"
+# mmcblk0p34: 05fffc00 00000200 "reserve_3"
+# mmcblk0p31: 04729a00 00000200 "reserve"
diff --git a/cm.dependencies b/cm.dependencies
new file mode 100644
index 0000000..d662c05
--- /dev/null
+++ b/cm.dependencies
@@ -0,0 +1,10 @@
+[
+  {
+    "repository": "android_device_htc_msm8960-common",
+    "target_path": "device/htc/msm8960-common"
+  },
+  {
+    "repository": "android_kernel_htc_msm8960",
+    "target_path": "kernel/htc/msm8960"
+  }
+]
diff --git a/cm.mk b/cm.mk
index b287a13..b787fd4 100644
--- a/cm.mk
+++ b/cm.mk
@@ -1,6 +1,23 @@
-## Specify phone tech before including full_phone
+$(call inherit-product, vendor/cm/config/common_full_phone.mk)
+
 $(call inherit-product, vendor/cm/config/cdma.mk)
 
+# Enhanced NFC
+$(call inherit-product, vendor/cm/config/nfc_enhanced.mk)
+
+# Inherit device configuration
+$(call inherit-product, device/htc/m7wls/device_m7wls.mk)
+
+# Device naming
+PRODUCT_DEVICE := m7wls
+PRODUCT_NAME := cm_m7wls
+PRODUCT_BRAND := htc
+PRODUCT_MODEL := HTC One
+PRODUCT_MANUFACTURER := HTC
+
+# Set build fingerprint / ID / Product Name ect.
+PRODUCT_BUILD_PROP_OVERRIDES += PRODUCT_NAME=htc_m7wls BUILD_ID=JZO54K BUILD_FINGERPRINT="htc/m7wls/m7wls:4.1.2/JZO54K/166937.7:user/release-keys" PRIVATE_BUILD_DESC="1.29.651.7 CL166937 release-keys"
+
 # Release name
 PRODUCT_RELEASE_NAME := m7wls
 
@@ -8,18 +25,4 @@
 TARGET_SCREEN_HEIGHT := 1920
 TARGET_SCREEN_WIDTH := 1080
 
-# Inherit some common CM stuff.
-$(call inherit-product, vendor/cm/config/common_full_phone.mk)
-
-# Enhanced NFC
-$(call inherit-product, vendor/cm/config/nfc_enhanced.mk)
-
-# Inherit device configuration
-$(call inherit-product, device/htc/m7wls/device_m7.mk)
-
-## Device identifier. This must come after all inclusions
-PRODUCT_DEVICE := m7wls
-PRODUCT_NAME := cm_m7wls
-PRODUCT_BRAND := htc
-PRODUCT_MODEL := HTC One
-PRODUCT_MANUFACTURER := HTC
+-include vendor/cm/config/common_versions.mk
\ No newline at end of file
diff --git a/configs/calibration_EMEA b/configs/calibration_EMEA
deleted file mode 100644
index b25f131..0000000
--- a/configs/calibration_EMEA
+++ /dev/null
@@ -1,96 +0,0 @@
-# Sample variables file for BCM94335 WLBGA ePA, eLNA board for production package
-NVRAMRev=$Rev: 364793 $
-sromrev=11
-boardrev=0x1216
-boardtype=0x064c
-boardflags=0x10401001
-boardflags2=0x10000000
-#spur mode off with boardflags3 |= 0x1000
-boardflags3=0x1009
-#boardnum=57410 
-macaddr=00:90:4c:c5:12:38
-ccode=0
-regrev=0
-antswitch=0
-pdgain5g=1
-pdgain2g=1
-tworangetssi2g=0
-tworangetssi5g=0
-femctrl=4
-pcieingress_war=15
-vendid=0x14e4
-devid=0x43ae
-manfid=0x2d0
-#prodid=0x052e
-nocrc=1
-otpimagesize=502
-xtalfreq=37400
-extpagain2g=1
-pdetrange2g=2
-extpagain5g=1
-pdetrange5g=2
-rxgains2gelnagaina0=3
-rxgains2gtrisoa0=6
-rxgains2gtrelnabypa0=1
-rxgains5gelnagaina0=3
-rxgains5gtrisoa0=6
-rxgains5gtrelnabypa0=1
-rxchain=1
-txchain=1
-aa2g=1
-aa5g=1
-tssipos5g=1
-tssipos2g=1
-pa2ga0=0xff60,0x183c,0xfd30
-pa5ga0=0xff2a,0x18f2,0xfcdd,0xff34,0x1a57,0xfcb7,0xff27,0x1930,0xfcd7,0xff26,0x1a7f,0xfcad
-maxp2ga0=82
-maxp5ga0=70,70,70,70
-pdoffset40ma0=0x2222
-pdoffset80ma0=0x2222
-pdoffsetcckma0=1
-cckbw202gpo=0x2222
-cckbw20ul2gpo=0x2222
-mcsbw202gpo=0xcccc6666
-mcsbw402gpo=0xcccc6666
-dot11agofdmhrbw202gpo=0xc666
-ofdmlrbw202gpo=0x0066
-mcsbw205glpo=0xaa662220
-mcsbw405glpo=0xaaaa6666
-mcsbw805glpo=0xaaaa6666
-mcsbw205gmpo=0xaa662220
-mcsbw405gmpo=0xaaaa6666
-mcsbw805gmpo=0xaaaa6666
-mcsbw205ghpo=0xaa662220
-mcsbw405ghpo=0xaaaa6666
-mcsbw805ghpo=0xaaaa6666
-mcslr5glpo=0x0000
-mcslr5gmpo=0x0000
-mcslr5ghpo=0x0000
-sb20in40hrrpo=0x0
-sb20in80and160hr5glpo=0x0
-sb40and80hr5glpo=0x0
-sb20in80and160hr5gmpo=0x0
-sb40and80hr5gmpo=0x0
-sb20in80and160hr5ghpo=0x0
-sb40and80hr5ghpo=0x0
-sb20in40lrpo=0x0
-sb20in80and160lr5glpo=0x0
-sb40and80lr5glpo=0x0
-sb20in80and160lr5gmpo=0x0
-sb40and80lr5gmpo=0x0
-sb20in80and160lr5ghpo=0x0
-sb40and80lr5ghpo=0x0
-dot11agduphrpo=0x0
-dot11agduplrpo=0x0
-phycal_tempdelta=5
-tssifloor5g=220,213,218,228
-tssifloor2g=245
-cckdigfilttype=1
-femtable2=0x00FF8F08
-femtable1=0x04000300
-femtable0=0x40805010
-muxenab=0x10
-btc_params80=0
-btc_params6=30
-rssi_offset=4
-rssi_offset_5g=0
diff --git a/device_m7.mk b/device_m7.mk
deleted file mode 100644
index 878038d..0000000
--- a/device_m7.mk
+++ /dev/null
@@ -1,253 +0,0 @@
-#
-# Copyright (C) 2011 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.
-#
-
-
-$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base_telephony.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/languages_full.mk)
-
-DEVICE_PACKAGE_OVERLAYS += device/htc/m7wls/overlay
-
-# Ramdisk
-PRODUCT_COPY_FILES += \
-    device/htc/m7wls/ramdisk/fstab.m7:root/fstab.m7 \
-    device/htc/m7wls/ramdisk/init:root/init \
-    device/htc/m7wls/ramdisk/init.m7.rc:root/init.m7.rc \
-    device/htc/m7wls/ramdisk/init.m7.usb.rc:root/init.m7.usb.rc \
-    device/htc/m7wls/ramdisk/init.rc:root/init.rc \
-    device/htc/m7wls/ramdisk/ueventd.m7.rc:root/ueventd.m7.rc \
-
-# QCOM Boot ramdisk setup
-PRODUCT_PACKAGES += \
-    init.qcom.sh \
-    init.qcom.usb.rc \
-    init.qcom.rc \
-    ueventd.qcom.rc
-
-# Qualcomm scripts
-PRODUCT_COPY_FILES += \
-    device/htc/m7wls/configs/init.qcom.bt.sh:/system/etc/init.qcom.bt.sh \
-    device/htc/m7wls/configs/init.qcom.fm.sh:/system/etc/init.qcom.fm.sh \
-    device/htc/m7wls/configs/init.qcom.post_boot.sh:/system/etc/init.qcom.post_boot.sh \
-    device/htc/m7wls/configs/init.qcom.sdio.sh:/system/etc/init.qcom.sdio.sh \
-    device/htc/m7wls/configs/init.qcom.wifi.sh:/system/etc/init.qcom.wifi.sh
-
-# Custom recovery charging
-PRODUCT_COPY_FILES += \
-    device/htc/m7wls/recovery/sbin/choice_fn:recovery/root/sbin/choice_fn \
-    device/htc/m7wls/recovery/sbin/offmode_charging:recovery/root/sbin/offmode_charging \
-    device/htc/m7wls/recovery/sbin/detect_key:recovery/root/sbin/detect_key \
-    device/htc/m7wls/recovery/sbin/power_test:recovery/root/sbin/power_test
-
-# QC thermald config
-PRODUCT_COPY_FILES += device/htc/m7wls/configs/thermald.conf:system/etc/thermald.conf
-
-# Vold config
-PRODUCT_COPY_FILES += \
-    device/htc/m7wls/configs/vold.fstab:system/etc/vold.fstab
-
-# Wifi config
-PRODUCT_COPY_FILES += \
-    device/htc/m7wls/configs/wpa_supplicant.conf:/system/etc/wifi/wpa_supplicant.conf \
-    device/htc/m7wls/configs/calibration:/system/etc/calibration
-
-# Sound configs
-PRODUCT_COPY_FILES += \
-    device/htc/m7wls/dsp/soundimage/srs_bypass.cfg:system/etc/soundimage/srs_bypass.cfg \
-    device/htc/m7wls/dsp/soundimage/srsfx_trumedia_51.cfg:system/etc/soundimage/srsfx_trumedia_51.cfg \
-    device/htc/m7wls/dsp/soundimage/srsfx_trumedia_movie.cfg:system/etc/soundimage/srsfx_trumedia_movie.cfg \
-    device/htc/m7wls/dsp/soundimage/srsfx_trumedia_music.cfg:system/etc/soundimage/srsfx_trumedia_music.cfg \
-    device/htc/m7wls/dsp/soundimage/srsfx_trumedia_voice.cfg:system/etc/soundimage/srsfx_trumedia_voice.cfg \
-    device/htc/m7wls/dsp/soundimage/srs_geq10.cfg:system/etc/soundimage/srs_geq10.cfg \
-    device/htc/m7wls/dsp/soundimage/srs_global.cfg:system/etc/soundimage/srs_global.cfg
-	
-# Media config
-PRODUCT_COPY_FILES += \
-    device/htc/m7wls/configs/audio_policy.conf:system/etc/audio_policy.conf \
-    device/htc/m7wls/configs/AudioBTID.csv:system/etc/AudioBTID.csv \
-    device/htc/m7wls/configs/AudioBTIDnew.csv:system/etc/AudioBTIDnew.csvs \
-    device/htc/m7wls/configs/media_profiles.xml:system/etc/media_profiles.xml \
-    device/htc/m7wls/configs/media_codecs.xml:system/etc/media_codecs.xml \
-    device/htc/m7wls/dsp/snd_soc_msm/snd_soc_msm_2x_Fusion3:system/etc/snd_soc_msm/snd_soc_msm_2x_Fusion3
-	
-# Keylayouts and Keychars
-PRODUCT_COPY_FILES += \
-    device/htc/m7wls/keylayout/AVRCP.kl:system/usr/keylayout/AVRCP.kl \
-    device/htc/m7wls/keylayout/Generic.kl:system/usr/keylayout/Generic.kl \
-    device/htc/m7wls/keylayout/h2w_headset.kl:system/usr/keylayout/h2w_headset.kl \
-    device/htc/m7wls/keylayout/keypad_8960.kl:system/usr/keylayout/keypad_8960.kl \
-    device/htc/m7wls/keylayout/projector-Keypad.kl:system/usr/keylayout/projector-Keypad.kl \
-    device/htc/m7wls/keylayout/qwerty.kl:system/usr/keylayout/qwerty.kl \
-    device/htc/m7wls/keylayout/synaptics-rmi-touchscreen.kl:system/usr/keylayout/synaptics-rmi-touchscreen.kl \
-	
-# Input device config
-PRODUCT_COPY_FILES += \
-    device/htc/m7wls/idc/projector_input.idc:system/usr/idc/projector_input.idc \
-    device/htc/m7wls7/idc/qwerty2.idc:system/usr/idc/qwerty2.idc \
-    device/htc/m7wls/idc/qwerty.idc:system/usr/idc/qwerty.idc \
-    device/htc/m7wls/idc/synaptics-rmi-touchscreen.idc:system/usr/idc/synaptics-rmi-touchscreen.idc
-
-# Audio
-PRODUCT_PACKAGES += \
-    alsa.msm8960 \
-    audio.a2dp.default \
-    audio_policy.msm8960 \
-    audio.primary.msm8960 \
-    audio.r_submix.default \
-    audio.usb.default \
-    libaudio-resampler
-
-# Bluetooth
-PRODUCT_PACKAGES += \
-    hci_qcomm_init
-
-# Camera
-#PRODUCT_PACKAGES += \
-#    camera.msm8960
-
-# GPS
-PRODUCT_PACKAGES += \
-    libloc_adapter \
-    libloc_eng \
-    libgps.utils \
-    gps.msm8960
-
-# Graphics
-PRODUCT_PACKAGES += \
-    copybit.msm8960 \
-    gralloc.msm8960 \
-    hwcomposer.msm8960 \
-    libgenlock \
-    liboverlay
-
-# Lights
-PRODUCT_PACKAGES += \
-    lights.msm8960
-
-# OMX
-PRODUCT_PACKAGES += \
-    libc2dcolorconvert \
-    libdivxdrmdecrypt \
-    libOmxCore \
-    libOmxVdec \
-    libOmxVenc \
-    libOmxAacEnc \
-    libOmxAmrEnc \
-    libOmxEvrcEnc \
-    libOmxQcelp13Enc \
-    libstagefrighthw
-
-# Power
-PRODUCT_PACKAGES += \
-    power.msm8960
-
-# HDMI
-PRODUCT_PACKAGES += \
-    hdmid
-
-# QCOM rngd
-PRODUCT_PACKAGES += \
-    qrngd
-
-# USB
-PRODUCT_PACKAGES += \
-    com.android.future.usb.accessory
-
-# Filesystem management tools
-PRODUCT_PACKAGES += \
-    make_ext4fs \
-    setup_fs
-
-# NFC
-PRODUCT_PACKAGES += \
-    libnfc \
-    libnfc_ndef \
-    libnfc_jni \
-    Nfc \
-    Tag \
-    com.android.nfc_extras
-
-# Torch
-PRODUCT_PACKAGES += \
-    Torch
-
-# Permissions
-PRODUCT_COPY_FILES += \
-    frameworks/native/data/etc/android.hardware.nfc.xml:system/etc/permissions/android.hardware.nfc.xml \
-    frameworks/native/data/etc/com.android.nfc_extras.xml:system/etc/permissions/com.android.nfc_extras.xml \
-    frameworks/native/data/etc/android.hardware.telephony.gsm.xml:system/etc/permissions/android.hardware.telephony.gsm.xml \
-    frameworks/native/data/etc/android.hardware.telephony.cdma.xml:system/etc/permissions/android.hardware.telephony.cdma.xml \
-    frameworks/native/data/etc/handheld_core_hardware.xml:system/etc/permissions/handheld_core_hardware.xml \
-    frameworks/native/data/etc/android.hardware.camera.flash-autofocus.xml:system/etc/permissions/android.hardware.camera.flash-autofocus.xml \
-    frameworks/native/data/etc/android.hardware.camera.front.xml:system/etc/permissions/android.hardware.camera.front.xml \
-    frameworks/native/data/etc/android.hardware.location.gps.xml:system/etc/permissions/android.hardware.location.gps.xml \
-    frameworks/native/data/etc/android.hardware.wifi.xml:system/etc/permissions/android.hardware.wifi.xml \
-    frameworks/native/data/etc/android.hardware.sensor.proximity.xml:system/etc/permissions/android.hardware.sensor.proximity.xml \
-    frameworks/native/data/etc/android.hardware.sensor.light.xml:system/etc/permissions/android.hardware.sensor.light.xml \
-    frameworks/native/data/etc/android.hardware.sensor.gyroscope.xml:system/etc/permissions/android.hardwardware.sensor.gyroscope.xml \
-    frameworks/native/data/etc/android.hardware.touchscreen.multitouch.distinct.xml:system/etc/permissions/android.hardware.touchscreen.multitouch.distinct.xml \
-    frameworks/native/data/etc/android.hardware.usb.accessory.xml:system/etc/permissions/android.hardware.usb.accessory.xml \
-    frameworks/native/data/etc/android.hardware.usb.host.xml:system/etc/permissions/android.hardware.usb.host.xml \
-    frameworks/native/data/etc/android.software.sip.voip.xml:system/etc/permissions/android.software.sip.voip.xml \
-    frameworks/native/data/etc/android.hardware.sensor.accelerometer.xml:system/etc/permissions/android.hardware.sensor.accelerometer.xml \
-    frameworks/native/data/etc/android.hardware.sensor.compass.xml:system/etc/permissions/android.hardware.compass.xml \
-    packages/wallpapers/LivePicker/android.software.live_wallpaper.xml:system/etc/permissions/android.software.live_wallpaper.xml
-
-# GPS config
-PRODUCT_COPY_FILES += \
-    device/htc/m7wls/configs/gps.conf:system/etc/gps.conf
-	
-PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
-    persist.sys.usb.config=mtp
-	
-# Common build properties
-PRODUCT_PROPERTY_OVERRIDES += \
-    com.qc.hardware=true \
-    debug.composition.type=dyn \
-    debug.egl.hw=1 \
-    debug.mdpcomp.logs=0 \
-    debug.sf.hw=1 \
-    dev.pm.dyn_samplingrate=1 \
-    lpa.decode=true \
-    persist.audio.fluence.mode=endfire \
-    persist.audio.vr.enable=false \
-    persist.audio.handset.mic=digital \
-    persist.audio.speaker.location=high \
-    persist.gps.qmienabled=true \
-    persist.hwc.mdpcomp.enable=true \
-    persist.thermal.monitor=true \
-    ro.baseband.arch=msm \
-    ro.opengles.version=131072 \
-    ro.product.wireless=WCN3660 \
-    ro.qc.sdk.audio.fluencetype=fluence \
-    ro.qualcomm.bt.hci_transport=smd \
-    ro.telephony.ril_class=HTC8960RIL \
-    ro.use_data_netmgrd=true \
-    wifi.interface=wlan0
-
-# Set build date
-PRODUCT_BUILD_PROP_OVERRIDES += BUILD_UTC_DATE=0
-
-# Device uses high-density artwork where available
-PRODUCT_AAPT_CONFIG := normal hdpi xhdpi xxhdpi
-PRODUCT_AAPT_PREF_CONFIG := xhdpi xxhdpi
-PRODUCT_NAME := full_m7wls
-PRODUCT_DEVICE := m7wls
-
-# call the proprietary setup
-$(call inherit-product-if-exists, vendor/htc/m7wls/m7-vendor.mk)
-
-# call dalvik heap config
-$(call inherit-product-if-exists, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk)
diff --git a/device_m7wls.mk b/device_m7wls.mk
new file mode 100644
index 0000000..9ac49ef
--- /dev/null
+++ b/device_m7wls.mk
@@ -0,0 +1,141 @@
+#
+# Copyright (C) 2011 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.
+#
+
+
+$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base_telephony.mk)
+
+# common msm8960 configs
+$(call inherit-product, device/htc/msm8960-common/msm8960.mk)
+
+DEVICE_PACKAGE_OVERLAYS += device/htc/m7wls/overlay
+
+# Boot ramdisk setup
+PRODUCT_PACKAGES += \
+    fstab.jet \
+    init.target.rc
+
+# Custom recovery charging
+PRODUCT_COPY_FILES += \
+    device/htc/m7wls/recovery/sbin/choice_fn:recovery/root/sbin/choice_fn \
+    device/htc/m7wls/recovery/sbin/offmode_charging:recovery/root/sbin/offmode_charging \
+    device/htc/m7wls/recovery/sbin/detect_key:recovery/root/sbin/detect_key \
+    device/htc/m7wls/recovery/sbin/power_test:recovery/root/sbin/power_test
+
+# Vold config
+PRODUCT_COPY_FILES += \
+    device/htc/m7wls/configs/vold.fstab:system/etc/vold.fstab
+
+# Sound configs
+PRODUCT_COPY_FILES += \
+    device/htc/m7wls/dsp/soundimage/srs_bypass.cfg:system/etc/soundimage/srs_bypass.cfg \
+    device/htc/m7wls/dsp/soundimage/srsfx_trumedia_51.cfg:system/etc/soundimage/srsfx_trumedia_51.cfg \
+    device/htc/m7wls/dsp/soundimage/srsfx_trumedia_movie.cfg:system/etc/soundimage/srsfx_trumedia_movie.cfg \
+    device/htc/m7wls/dsp/soundimage/srsfx_trumedia_music.cfg:system/etc/soundimage/srsfx_trumedia_music.cfg \
+    device/htc/m7wls/dsp/soundimage/srsfx_trumedia_voice.cfg:system/etc/soundimage/srsfx_trumedia_voice.cfg \
+    device/htc/m7wls/dsp/soundimage/srs_geq10.cfg:system/etc/soundimage/srs_geq10.cfg \
+    device/htc/m7wls/dsp/soundimage/srs_global.cfg:system/etc/soundimage/srs_global.cfg
+	
+# Media config
+PRODUCT_COPY_FILES += \
+    device/htc/m7wls/configs/audio_policy.conf:system/etc/audio_policy.conf \
+    device/htc/m7wls/configs/AudioBTID.csv:system/etc/AudioBTID.csv \
+    device/htc/m7wls/configs/AudioBTIDnew.csv:system/etc/AudioBTIDnew.csvs \
+    device/htc/m7wls/configs/media_profiles.xml:system/etc/media_profiles.xml \
+    device/htc/m7wls/configs/media_codecs.xml:system/etc/media_codecs.xml \
+    device/htc/m7wls/dsp/snd_soc_msm/snd_soc_msm_2x_Fusion3:system/etc/snd_soc_msm/snd_soc_msm_2x_Fusion3
+	
+# Keylayouts and Keychars
+PRODUCT_COPY_FILES += \
+    device/htc/m7wls/keylayout/AVRCP.kl:system/usr/keylayout/AVRCP.kl \
+    device/htc/m7wls/keylayout/Generic.kl:system/usr/keylayout/Generic.kl \
+    device/htc/m7wls/keylayout/h2w_headset.kl:system/usr/keylayout/h2w_headset.kl \
+    device/htc/m7wls/keylayout/keypad_8960.kl:system/usr/keylayout/keypad_8960.kl \
+    device/htc/m7wls/keylayout/projector-Keypad.kl:system/usr/keylayout/projector-Keypad.kl \
+    device/htc/m7wls/keylayout/qwerty.kl:system/usr/keylayout/qwerty.kl \
+    device/htc/m7wls/keylayout/synaptics-rmi-touchscreen.kl:system/usr/keylayout/synaptics-rmi-touchscreen.kl \
+	
+# Input device config
+PRODUCT_COPY_FILES += \
+    device/htc/m7wls/idc/projector_input.idc:system/usr/idc/projector_input.idc \
+    device/htc/m7wls7/idc/qwerty2.idc:system/usr/idc/qwerty2.idc \
+    device/htc/m7wls/idc/qwerty.idc:system/usr/idc/qwerty.idc \
+    device/htc/m7wls/idc/synaptics-rmi-touchscreen.idc:system/usr/idc/synaptics-rmi-touchscreen.idc
+
+# NFCEE access control
+ifeq ($(TARGET_BUILD_VARIANT),user)
+    NFCEE_ACCESS_PATH := device/htc/m7wls/configs/nfcee_access.xml
+else
+    NFCEE_ACCESS_PATH := device/htc/m7wls/configs/nfcee_access_debug.xml
+endif
+PRODUCT_COPY_FILES += \
+    $(NFCEE_ACCESS_PATH):system/etc/nfcee_access.xml
+
+# NFC Support
+PRODUCT_PACKAGES += \
+    libnfc \
+    libnfc_jni \
+    Nfc \
+    Tag \
+    com.android.nfc_extras
+
+# Torch
+PRODUCT_PACKAGES += \
+    Torch
+
+# Filesystem management tools
+PRODUCT_PACKAGES += \
+   make_ext4fs \
+   e2fsck \
+   setup_fs
+
+# Permissions
+PRODUCT_COPY_FILES += \
+    frameworks/native/data/etc/android.hardware.telephony.cdma.xml:system/etc/permissions/android.hardware.telephony.cdma.xml \
+    frameworks/native/data/etc/android.hardware.nfc.xml:system/etc/permissions/android.hardware.nfc.xml \
+    frameworks/base/nfc-extras/com.android.nfc_extras.xml:system/etc/permissions/com.android.nfc_extras.xml \
+    frameworks/native/data/etc/com.nxp.mifare.xml:system/etc/permissions/com.nxp.mifare.xml
+
+## CDMA Sprint stuffs
+PRODUCT_PROPERTY_OVERRIDES += \
+    ro.com.google.clientidbase=android-sprint-us \
+    ro.com.google.locationfeatures=1 \
+    ro.cdma.home.operator.numeric=310120 \
+    ro.cdma.home.operator.alpha=Sprint \
+    gsm.sim.operator.alpha = sprint \
+    gsm.sim.operator.numeric = 310120 \
+    gsm.sim.operator.iso-country = us \
+    gsm.operator.alpha = sprint \
+    gsm.operator.numeric = 310120 \
+    gsm.operator.iso-country = us \
+    ro.carrier=Sprint
+
+# We have enough space to hold precise GC data
+PRODUCT_TAGS += dalvik.gc.type-precise
+
+# Set build date
+PRODUCT_BUILD_PROP_OVERRIDES += BUILD_UTC_DATE=0
+
+# Device uses high-density artwork where available
+PRODUCT_AAPT_CONFIG := normal hdpi xhdpi xxhdpi
+PRODUCT_AAPT_PREF_CONFIG := xhdpi xxhdpi
+PRODUCT_NAME := full_m7wls
+PRODUCT_DEVICE := m7wls
+
+# call the proprietary setup
+$(call inherit-product-if-exists, vendor/htc/m7wls/m7-vendor.mk)
+
+# call dalvik heap config
+$(call inherit-product-if-exists, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk)
diff --git a/kernel b/kernel
deleted file mode 100644
index 4562591..0000000
--- a/kernel
+++ /dev/null
Binary files differ
diff --git a/liblights/Android.mk b/liblights/Android.mk
deleted file mode 100644
index 719d6db..0000000
--- a/liblights/Android.mk
+++ /dev/null
@@ -1,38 +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.
-
-LOCAL_PATH:= $(call my-dir)
-
-ifeq ($(TARGET_PROVIDES_LIBLIGHT),true)
-ifeq ($(BOARD_VENDOR),htc)
-ifeq ($(TARGET_BOARD_PLATFORM),msm8960)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := lights.msm8960
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := lights.c
-LOCAL_SHARED_LIBRARIES := liblog
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
-
-endif # TARGET_BOARD_PLATFORM
-endif # TARGET_VENDOR
-endif # TARGET_PROVIDES_LIBLIGHT
diff --git a/liblights/MODULE_LICENSE_APACHE2 b/liblights/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29..0000000
--- a/liblights/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/liblights/NOTICE b/liblights/NOTICE
deleted file mode 100644
index 7340b9e..0000000
--- a/liblights/NOTICE
+++ /dev/null
@@ -1,190 +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.
-
-   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.
-
-
-                                 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
-
diff --git a/liblights/lights.c b/liblights/lights.c
deleted file mode 100644
index f118013..0000000
--- a/liblights/lights.c
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#define LOG_TAG "lights"
-
-#include <cutils/log.h>
-
-#include <stdint.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <pthread.h>
-
-
-#include <sys/ioctl.h>
-#include <sys/types.h>
-
-#include <hardware/lights.h>
-
-static pthread_once_t g_init = PTHREAD_ONCE_INIT;
-static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER;
-static struct light_state_t g_notification;
-static struct light_state_t g_battery;
-static int g_backlight = 255;
-
-char const*const AMBER_LED_FILE = "/sys/class/leds/amber/brightness";
-char const*const GREEN_LED_FILE = "/sys/class/leds/green/brightness";
-
-char const*const BUTTON_FILE = "/sys/class/leds/button-backlight/brightness";
-
-char const*const AMBER_BLINK_FILE = "/sys/class/leds/amber/blink";
-char const*const GREEN_BLINK_FILE = "/sys/class/leds/green/blink";
-
-char const*const LCD_BACKLIGHT_FILE = "/sys/class/leds/lcd-backlight/brightness";
-
-enum {
-  LED_AMBER,
-  LED_GREEN,
-  LED_BLANK,
-};
-
-enum {
-  PULSE_LENGTH_ALWAYS_ON = 1,
-  PULSE_LENGTH_NORMAL = 2,
-  PULSE_LENGTH_LONG = 3,
-};
-
-enum {
-  BLINK_MODE_OFF = 0,
-  BLINK_MODE_NORMAL = 1,
-  BLINK_MODE_LONG = 4,
-};
-
-static int write_int(const char* path, int value) {
-  int fd;
-  int bytes, written;
-  char buffer[20];
-  static int already_warned = 0;
-
-  fd = open(path, O_RDWR);
-  if (fd < 0) {
-    if (already_warned == 0) {
-      ALOGE("write_int failed to open %s\n", path);
-      already_warned = 1;
-    }
-    return -errno;
-  }
-
-  bytes = snprintf(buffer, sizeof(buffer), "%d\n", value);
-  written = write(fd, buffer, bytes);
-  close(fd);
-
-  return written == -1 ? -errno : 0;
-}
-
-void init_globals(void) {
-  pthread_mutex_init (&g_lock, NULL);
-}
-
-static int is_lit(struct light_state_t const* state) {
-  return state->color & 0x00ffffff;
-}
-
-static void set_speaker_light_locked(struct light_device_t *dev,
-                                     struct light_state_t *state) {
-  unsigned int colorRGB = state->color & 0xFFFFFF;
-  unsigned int color = LED_BLANK;
-  unsigned int blinkMode = BLINK_MODE_OFF;
-
-  if ((colorRGB >> 8) & 0xFF) color = LED_GREEN;
-  if ((colorRGB >> 16) & 0xFF) color = LED_AMBER;
-  if (((colorRGB >> 8) & 0xFF) > ((colorRGB >> 16) & 0xFF)) color = LED_GREEN;
-
-  switch (state->flashOnMS) {
-    case PULSE_LENGTH_ALWAYS_ON:
-      state->flashMode = LIGHT_FLASH_NONE;
-      break;
-    case PULSE_LENGTH_NORMAL:
-      blinkMode = BLINK_MODE_NORMAL;
-      break;
-    case PULSE_LENGTH_LONG:
-      blinkMode = BLINK_MODE_LONG;
-      break;
-  }
-
-  switch (state->flashMode) {
-    case LIGHT_FLASH_TIMED:
-      switch (color) {
-        case LED_AMBER:
-          write_int(AMBER_LED_FILE, 1);
-          write_int(GREEN_LED_FILE, 0);
-          write_int(AMBER_BLINK_FILE, blinkMode);
-          write_int(GREEN_BLINK_FILE, 0);
-          break;
-        case LED_GREEN:
-          write_int(AMBER_LED_FILE, 0);
-          write_int(GREEN_LED_FILE, 1);
-          write_int(AMBER_BLINK_FILE, 0);
-          write_int(GREEN_BLINK_FILE, blinkMode);
-          break;
-        case LED_BLANK:
-          write_int(AMBER_BLINK_FILE, 0);
-          write_int(GREEN_BLINK_FILE, 0);
-          break;
-        default:
-          ALOGE("set_led_state colorRGB=%08X, unknown color\n", colorRGB);
-          break;
-      }
-      break;
-    case LIGHT_FLASH_NONE:
-      switch (color) {
-        case LED_AMBER:
-          write_int(AMBER_LED_FILE, 1);
-          write_int(GREEN_LED_FILE, 0);
-          write_int(AMBER_BLINK_FILE, 0);
-          write_int(GREEN_BLINK_FILE, 0);
-          break;
-        case LED_GREEN:
-          write_int(AMBER_LED_FILE, 0);
-          write_int(GREEN_LED_FILE, 1);
-          write_int(AMBER_BLINK_FILE, 0);
-          write_int(GREEN_BLINK_FILE, 0);
-          break;
-        case LED_BLANK:
-          write_int(AMBER_LED_FILE, 0);
-          write_int(GREEN_LED_FILE, 0);
-          break;
-      }
-      break;
-    default:
-      ALOGE("set_led_state colorRGB=%08X, unknown mode %d\n",
-            colorRGB, state->flashMode);
-  }
-}
-
-static void set_speaker_light_locked_dual(struct light_device_t *dev,
-                                          struct light_state_t *bstate,
-                                          struct light_state_t *nstate) {
-  unsigned int bcolorRGB = bstate->color & 0xFFFFFF;
-  unsigned int bcolor = LED_BLANK;
-  unsigned int blinkMode = BLINK_MODE_LONG;
-
-  if ((bcolorRGB >> 8) & 0xFF) bcolor = LED_GREEN;
-  if ((bcolorRGB >> 16) & 0xFF) bcolor = LED_AMBER;
-
-  switch (bcolor) {
-    case LED_AMBER:
-      write_int (AMBER_BLINK_FILE, 1);
-      write_int (GREEN_LED_FILE, 1);
-      write_int (AMBER_BLINK_FILE, 4);
-      break;
-    case LED_GREEN:
-      write_int (GREEN_BLINK_FILE, 1);
-      write_int (AMBER_LED_FILE, 1);
-      write_int (GREEN_BLINK_FILE, 4);
-      break;
-    default:
-      ALOGE("set_led_state (dual) unexpected color: bcolorRGB=%08x\n", bcolorRGB);
-  }
-}
-
-
-static void handle_speaker_battery_locked(struct light_device_t *dev) {
-  if (is_lit(&g_battery) && is_lit(&g_notification)) {
-    set_speaker_light_locked_dual(dev, &g_battery, &g_notification);
-  } else if (is_lit (&g_battery)) {
-    set_speaker_light_locked(dev, &g_battery);
-  } else {
-    set_speaker_light_locked(dev, &g_notification);
-  }
-}
-
-static int set_light_buttons(struct light_device_t* dev,
-                             struct light_state_t const* state) {
-  int err = 0;
-  int on = is_lit(state);
-  pthread_mutex_lock(&g_lock);
-  err = write_int(BUTTON_FILE, on ? 255 : 0);
-  pthread_mutex_unlock(&g_lock);
-
-  return 0;
-}
-
-static int rgb_to_brightness(struct light_state_t const* state)
-{
-  int color = state->color & 0x00ffffff;
-  return ((77 * ((color >> 16) & 0x00ff)) + (150 * ((color >> 8) & 0x00ff)) +
-          (29 * (color & 0x00ff))) >> 8;
-}
-
-static int set_light_backlight(struct light_device_t* dev,
-                               struct light_state_t const* state) {
-  int err = 0;
-  int brightness = rgb_to_brightness(state);
-  ALOGV("%s brightness=%d color=0x%08x", __func__,brightness, state->color);
-  pthread_mutex_lock(&g_lock);
-  g_backlight = brightness;
-  err = write_int(LCD_BACKLIGHT_FILE, brightness);
-  pthread_mutex_unlock(&g_lock);
-  return err;
-}
-
-static int set_light_battery(struct light_device_t* dev,
-                             struct light_state_t const* state) {
-  pthread_mutex_lock(&g_lock);
-  g_battery = *state;
-  handle_speaker_battery_locked(dev);
-  pthread_mutex_unlock(&g_lock);
-
-  return 0;
-}
-
-static int set_light_attention(struct light_device_t* dev,
-                               struct light_state_t const* state) {
-  return 0;
-}
-
-static int set_light_notifications(struct light_device_t* dev,
-                                   struct light_state_t const* state) {
-  pthread_mutex_lock(&g_lock);
-  g_notification = *state;
-  handle_speaker_battery_locked(dev);
-  pthread_mutex_unlock(&g_lock);
-
-  return 0;
-}
-
-static int close_lights(struct light_device_t *dev) {
-  if (dev)
-    free (dev);
-
-  return 0;
-}
-
-static int open_lights(const struct hw_module_t* module, char const* name,
-                       struct hw_device_t** device) {
-  int (*set_light)(struct light_device_t* dev,
-  struct light_state_t const* state);
-  struct light_device_t *dev;
-
-  if (0 == strcmp(LIGHT_ID_BACKLIGHT, name)) {
-    set_light = set_light_backlight;
-  } else if (0 == strcmp(LIGHT_ID_BUTTONS, name)) {
-    set_light = set_light_buttons;
-  } else if (0 == strcmp(LIGHT_ID_BATTERY, name)) {
-    set_light = set_light_battery;
-  } else if (0 == strcmp(LIGHT_ID_ATTENTION, name)) {
-    set_light = set_light_attention;
-  } else if (0 == strcmp(LIGHT_ID_NOTIFICATIONS, name))  {
-    set_light = set_light_notifications;
-  } else {
-    return -EINVAL;
-  }
-
-  pthread_once(&g_init, init_globals);
-  dev = malloc(sizeof(struct light_device_t));
-  memset(dev, 0, sizeof(struct light_device_t));
-
-  dev->common.tag = HARDWARE_DEVICE_TAG;
-  dev->common.version = 0;
-  dev->common.module = (struct hw_module_t*) module;
-  dev->common.close = (int (*)(struct hw_device_t*)) close_lights;
-  dev->set_light = set_light;
-
-  *device = (struct hw_device_t*) dev;
-  return 0;
-
-}
-
-static struct hw_module_methods_t lights_module_methods = {
-  .open = open_lights,
-};
-
-struct hw_module_t HAL_MODULE_INFO_SYM = {
-  .tag = HARDWARE_MODULE_TAG,
-  .version_major = 1,
-  .version_minor = 0,
-  .id = LIGHTS_HARDWARE_MODULE_ID,
-  .name = "Lights module",
-  .author = "The CyanogenMod Project",
-  .methods = &lights_module_methods,
-};
diff --git a/libril/Android.mk b/libril/Android.mk
deleted file mode 100644
index b8cb7a2..0000000
--- a/libril/Android.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 2006 The Android Open Source Project
-
-ifeq ($(BOARD_PROVIDES_LIBRIL),true)
-ifeq ($(TARGET_BOARD_PLATFORM),msm8960)
-ifeq ($(BOARD_VENDOR),htc)
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
-    ril.cpp \
-    ril_event.cpp
-
-LOCAL_SHARED_LIBRARIES := \
-    libutils \
-    libbinder \
-    libcutils \
-    libhardware_legacy
-
-LOCAL_CFLAGS :=
-
-LOCAL_MODULE:= libril
-
-LOCAL_LDLIBS += -lpthread
-
-include $(BUILD_SHARED_LIBRARY)
-
-endif # BOARD_VENDOR
-endif # TARGET_BOARD_PLATFORM
-endif # BOARD_PROVIDES_LIBRIL
diff --git a/libril/HTC8960RIL.java b/libril/HTC8960RIL.java
deleted file mode 100644
index 787a1b6..0000000
--- a/libril/HTC8960RIL.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-package com.android.internal.telephony;
-
-import static com.android.internal.telephony.RILConstants.*;
-
-import android.content.Context;
-import android.os.AsyncResult;
-import android.os.HandlerThread;
-import android.os.Looper;
-import android.os.Message;
-import android.os.Parcel;
-import android.telephony.SignalStrength;
-import android.text.TextUtils;
-import android.util.Log;
-
-import com.android.internal.telephony.IccCardApplicationStatus;
-import com.android.internal.telephony.IccCardStatus;
-
-import java.util.ArrayList;
-
-/**
- * Qualcomm RIL class for basebands that do not send the SIM status
- * piggybacked in RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED. Instead,
- * these radios will send radio state and we have to query for SIM
- * status separately.
- *
- * {@hide}
- */
-public class HTC8960RIL extends QualcommSharedRIL implements CommandsInterface {
-
-    private static final int RIL_UNSOL_ENTER_LPM = 1523;
-    private static final int RIL_UNSOL_CDMA_3G_INDICATOR = 3009;
-    private static final int RIL_UNSOL_CDMA_ENHANCE_ROAMING_INDICATOR = 3012;
-    private static final int RIL_UNSOL_RESPONSE_PHONE_MODE_CHANGE = 6002;
-    private static final int RIL_UNSOL_RESPONSE_VOICE_RADIO_TECH_CHANGED = 21004;
-    private static final int RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED = 21005;
-    private static final int RIL_UNSOL_RESPONSE_DATA_NETWORK_STATE_CHANGED = 21007;
-
-    public HTC8960RIL(Context context, int networkMode, int cdmaSubscription) {
-        super(context, networkMode, cdmaSubscription);
-    }
-
-    @Override
-    protected Object
-    responseIccCardStatus(Parcel p) {
-        IccCardApplicationStatus appStatus;
-
-        // use old needsOldRilFeature method for feature. it would be redundant to make
-        // a new method just for naming sake.
-        boolean oldRil = needsOldRilFeature("icccardstatus");
-
-        IccCardStatus cardStatus = new IccCardStatus();
-        cardStatus.setCardState(p.readInt());
-        cardStatus.setUniversalPinState(p.readInt());
-        cardStatus.mGsmUmtsSubscriptionAppIndex = p.readInt();
-        cardStatus.mCdmaSubscriptionAppIndex = p.readInt();
-
-        if (!oldRil)
-            cardStatus.mImsSubscriptionAppIndex = p.readInt();
-
-        int numApplications = p.readInt();
-
-        // limit to maximum allowed applications
-        if (numApplications > IccCardStatus.CARD_MAX_APPS) {
-            numApplications = IccCardStatus.CARD_MAX_APPS;
-        }
-        cardStatus.mApplications = new IccCardApplicationStatus[numApplications];
-
-        for (int i = 0 ; i < numApplications ; i++) {
-            appStatus = new IccCardApplicationStatus();
-            appStatus.app_type       = appStatus.AppTypeFromRILInt(p.readInt());
-            appStatus.app_state      = appStatus.AppStateFromRILInt(p.readInt());
-            appStatus.perso_substate = appStatus.PersoSubstateFromRILInt(p.readInt());
-            if ((appStatus.app_state == IccCardApplicationStatus.AppState.APPSTATE_SUBSCRIPTION_PERSO) &&
-                ((appStatus.perso_substate == IccCardApplicationStatus.PersoSubState.PERSOSUBSTATE_READY) ||
-                (appStatus.perso_substate == IccCardApplicationStatus.PersoSubState.PERSOSUBSTATE_UNKNOWN))) {
-                // ridiculous HTC hack
-                appStatus.app_state = IccCardApplicationStatus.AppState.APPSTATE_UNKNOWN;
-                Log.d(LOG_TAG, "ca.app_state == AppState.APPSTATE_SUBSCRIPTION_PERSO");
-                Log.d(LOG_TAG, "ca.perso_substate == PersoSubState.PERSOSUBSTATE_READY");
-            }
-            appStatus.aid            = p.readString();
-            appStatus.app_label      = p.readString();
-            appStatus.pin1_replaced  = p.readInt();
-            appStatus.pin1           = appStatus.PinStateFromRILInt(p.readInt());
-            appStatus.pin2           = appStatus.PinStateFromRILInt(p.readInt());
-            cardStatus.mApplications[i] = appStatus;
-        }
-        int appIndex = -1;
-        if (mPhoneType == RILConstants.CDMA_PHONE && !skipCdmaSubcription) {
-            appIndex = cardStatus.mCdmaSubscriptionAppIndex;
-            Log.d(LOG_TAG, "This is a CDMA PHONE " + appIndex);
-        } else {
-            appIndex = cardStatus.mGsmUmtsSubscriptionAppIndex;
-            Log.d(LOG_TAG, "This is a GSM PHONE " + appIndex);
-        }
-
-        if (numApplications > 0) {
-            IccCardApplicationStatus application = cardStatus.mApplications[appIndex];
-            mAid = application.aid;
-            mUSIM = application.app_type
-                      == IccCardApplicationStatus.AppType.APPTYPE_USIM;
-            mSetPreferredNetworkType = mPreferredNetworkType;
-
-            if (TextUtils.isEmpty(mAid))
-               mAid = "";
-            Log.d(LOG_TAG, "mAid " + mAid);
-        }
-        return cardStatus;
-    }
-
-    @Override
-    protected Object
-    responseSignalStrength(Parcel p) {
-        /* HTC signal strength format:
-         * 0: GW_SignalStrength
-         * 1: GW_SignalStrength.bitErrorRate
-         * 2: CDMA_SignalStrength.dbm
-         * 3: CDMA_SignalStrength.ecio
-         * 4: EVDO_SignalStrength.dbm
-         * 5: EVDO_SignalStrength.ecio
-         * 6: EVDO_SignalStrength.signalNoiseRatio
-         * 7: ATT_SignalStrength.dbm
-         * 8: ATT_SignalStrength.ecno
-         * 9: LTE_SignalStrength.signalStrength
-         * 10: LTE_SignalStrength.rsrp
-         * 11: LTE_SignalStrength.rsrq
-         * 12: LTE_SignalStrength.rssnr
-         * 13: LTE_SignalStrength.cqi
-         */
-
-        int gsmSignalStrength = p.readInt();
-        int gsmBitErrorRate = p.readInt();
-        int cdmaDbm = p.readInt();
-        int cdmaEcio = p.readInt();
-        int evdoDbm = p.readInt();
-        int evdoEcio = p.readInt();
-        int evdoSnr = p.readInt();
-        p.readInt(); // ATT_SignalStrength.dbm
-        p.readInt(); // ATT_SignalStrength.ecno
-        int lteSignalStrength = p.readInt();
-        int lteRsrp = p.readInt();
-        int lteRsrq = p.readInt();
-        int lteRssnr = p.readInt();
-        int lteCqi = p.readInt();
-        boolean isGsm = (mPhoneType == RILConstants.GSM_PHONE);
-
-        SignalStrength signalStrength = new SignalStrength(gsmSignalStrength,
-                gsmBitErrorRate, cdmaDbm, cdmaEcio, evdoDbm, evdoEcio, evdoSnr,
-                lteSignalStrength, lteRsrp, lteRsrq, lteRssnr, lteCqi, isGsm);
-
-        return signalStrength;
-    }
-
-    @Override
-    protected void
-    processUnsolicited (Parcel p) {
-        Object ret;
-        int dataPosition = p.dataPosition(); // save off position within the Parcel
-        int response = p.readInt();
-
-        switch(response) {
-            case RIL_UNSOL_ENTER_LPM: ret = responseVoid(p); break;
-            case RIL_UNSOL_CDMA_3G_INDICATOR:  ret = responseInts(p); break;
-            case RIL_UNSOL_CDMA_ENHANCE_ROAMING_INDICATOR:  ret = responseInts(p); break;
-            case RIL_UNSOL_RESPONSE_PHONE_MODE_CHANGE:  ret = responseInts(p); break;
-            case RIL_UNSOL_RESPONSE_VOICE_RADIO_TECH_CHANGED: ret = responseVoid(p); break;
-            case RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED: ret = responseVoid(p); break;
-            case RIL_UNSOL_RESPONSE_DATA_NETWORK_STATE_CHANGED: ret = responseVoid(p); break;
-
-            default:
-                // Rewind the Parcel
-                p.setDataPosition(dataPosition);
-
-                // Forward responses that we are not overriding to the super class
-                super.processUnsolicited(p);
-                return;
-        }
-
-        switch(response) {
-            case RIL_UNSOL_ENTER_LPM:
-            case RIL_UNSOL_CDMA_3G_INDICATOR:
-            case RIL_UNSOL_CDMA_ENHANCE_ROAMING_INDICATOR:
-            case RIL_UNSOL_RESPONSE_PHONE_MODE_CHANGE:
-            case RIL_UNSOL_RESPONSE_VOICE_RADIO_TECH_CHANGED:
-            case RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED:
-            case RIL_UNSOL_RESPONSE_DATA_NETWORK_STATE_CHANGED:
-                if (RILJ_LOGD) unsljLogRet(response, ret);
-
-                if (mExitEmergencyCallbackModeRegistrants != null) {
-                    mExitEmergencyCallbackModeRegistrants.notifyRegistrants(
-                                        new AsyncResult (null, null, null));
-                }
-                break;
-        }
-    }
-
-}
diff --git a/libril/MODULE_LICENSE_APACHE2 b/libril/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29..0000000
--- a/libril/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/libril/NOTICE b/libril/NOTICE
deleted file mode 100644
index c5b1efa..0000000
--- a/libril/NOTICE
+++ /dev/null
@@ -1,190 +0,0 @@
-
-   Copyright (c) 2005-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.
-
-   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.
-
-
-                                 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
-
diff --git a/libril/ril.cpp b/libril/ril.cpp
deleted file mode 100644
index 64fba2d..0000000
--- a/libril/ril.cpp
+++ /dev/null
@@ -1,3525 +0,0 @@
-/* //device/libs/telephony/ril.cpp
-**
-** Copyright 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.
-*/
-
-#define LOG_TAG "RILC"
-
-#include <hardware_legacy/power.h>
-
-#include "telephony/ril.h"
-#include "telephony/ril_cdma_sms.h"
-#include <cutils/sockets.h>
-#include <cutils/jstring.h>
-#include <cutils/record_stream.h>
-#include <utils/Log.h>
-#include <utils/SystemClock.h>
-#include <pthread.h>
-#include <binder/Parcel.h>
-#include <cutils/jstring.h>
-
-#include <sys/types.h>
-#include <pwd.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <time.h>
-#include <errno.h>
-#include <assert.h>
-#include <ctype.h>
-#include <alloca.h>
-#include <sys/un.h>
-#include <assert.h>
-#include <netinet/in.h>
-#include <cutils/properties.h>
-
-#include <ril_event.h>
-
-namespace android {
-
-#define PHONE_PROCESS "radio"
-
-#define SOCKET_NAME_RIL "rild"
-#define SOCKET_NAME_RIL_DEBUG "rild-debug"
-
-#define ANDROID_WAKE_LOCK_NAME "radio-interface"
-
-
-#define PROPERTY_RIL_IMPL "gsm.version.ril-impl"
-
-// match with constant in RIL.java
-#define MAX_COMMAND_BYTES (8 * 1024)
-
-// Basically: memset buffers that the client library
-// shouldn't be using anymore in an attempt to find
-// memory usage issues sooner.
-#define MEMSET_FREED 1
-
-#define NUM_ELEMS(a)     (sizeof (a) / sizeof (a)[0])
-
-#define MIN(a,b) ((a)<(b) ? (a) : (b))
-
-/* Constants for response types */
-#define RESPONSE_SOLICITED 0
-#define RESPONSE_UNSOLICITED 1
-
-/* Negative values for private RIL errno's */
-#define RIL_ERRNO_INVALID_RESPONSE -1
-
-// request, response, and unsolicited msg print macro
-#define PRINTBUF_SIZE 8096
-
-// Enable RILC log
-#define RILC_LOG 0
-
-#if RILC_LOG
-    #define startRequest           sprintf(printBuf, "(")
-    #define closeRequest           sprintf(printBuf, "%s)", printBuf)
-    #define printRequest(token, req)           \
-            ALOGD("[%04d]> %s %s", token, requestToString(req), printBuf)
-
-    #define startResponse           sprintf(printBuf, "%s {", printBuf)
-    #define closeResponse           sprintf(printBuf, "%s}", printBuf)
-    #define printResponse           ALOGD("%s", printBuf)
-
-    #define clearPrintBuf           printBuf[0] = 0
-    #define removeLastChar          printBuf[strlen(printBuf)-1] = 0
-    #define appendPrintBuf(x...)    sprintf(printBuf, x)
-#else
-    #define startRequest
-    #define closeRequest
-    #define printRequest(token, req)
-    #define startResponse
-    #define closeResponse
-    #define printResponse
-    #define clearPrintBuf
-    #define removeLastChar
-    #define appendPrintBuf(x...)
-#endif
-
-enum WakeType {DONT_WAKE, WAKE_PARTIAL};
-
-typedef struct {
-    int requestNumber;
-    void (*dispatchFunction) (Parcel &p, struct RequestInfo *pRI);
-    int(*responseFunction) (Parcel &p, void *response, size_t responselen);
-} CommandInfo;
-
-typedef struct {
-    int requestNumber;
-    int (*responseFunction) (Parcel &p, void *response, size_t responselen);
-    WakeType wakeType;
-} UnsolResponseInfo;
-
-typedef struct RequestInfo {
-    int32_t token;      //this is not RIL_Token
-    CommandInfo *pCI;
-    struct RequestInfo *p_next;
-    char cancelled;
-    char local;         // responses to local commands do not go back to command process
-} RequestInfo;
-
-typedef struct UserCallbackInfo {
-    RIL_TimedCallback p_callback;
-    void *userParam;
-    struct ril_event event;
-    struct UserCallbackInfo *p_next;
-} UserCallbackInfo;
-
-
-/*******************************************************************/
-
-RIL_RadioFunctions s_callbacks = {0, NULL, NULL, NULL, NULL, NULL};
-static int s_registerCalled = 0;
-
-static pthread_t s_tid_dispatch;
-static pthread_t s_tid_reader;
-static int s_started = 0;
-
-static int s_fdListen = -1;
-static int s_fdCommand = -1;
-static int s_fdDebug = -1;
-
-static int s_fdWakeupRead;
-static int s_fdWakeupWrite;
-
-static struct ril_event s_commands_event;
-static struct ril_event s_wakeupfd_event;
-static struct ril_event s_listen_event;
-static struct ril_event s_wake_timeout_event;
-static struct ril_event s_debug_event;
-
-
-static const struct timeval TIMEVAL_WAKE_TIMEOUT = {1,0};
-
-static pthread_mutex_t s_pendingRequestsMutex = PTHREAD_MUTEX_INITIALIZER;
-static pthread_mutex_t s_writeMutex = PTHREAD_MUTEX_INITIALIZER;
-static pthread_mutex_t s_startupMutex = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t s_startupCond = PTHREAD_COND_INITIALIZER;
-
-static pthread_mutex_t s_dispatchMutex = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t s_dispatchCond = PTHREAD_COND_INITIALIZER;
-
-static RequestInfo *s_pendingRequests = NULL;
-
-static RequestInfo *s_toDispatchHead = NULL;
-static RequestInfo *s_toDispatchTail = NULL;
-
-static UserCallbackInfo *s_last_wake_timeout_info = NULL;
-
-static void *s_lastNITZTimeData = NULL;
-static size_t s_lastNITZTimeDataSize;
-
-#if RILC_LOG
-    static char printBuf[PRINTBUF_SIZE];
-#endif
-
-/*******************************************************************/
-
-static void dispatchVoid (Parcel& p, RequestInfo *pRI);
-static void dispatchString (Parcel& p, RequestInfo *pRI);
-static void dispatchStrings (Parcel& p, RequestInfo *pRI);
-static void dispatchInts (Parcel& p, RequestInfo *pRI);
-static void dispatchDial (Parcel& p, RequestInfo *pRI);
-static void dispatchSIM_IO (Parcel& p, RequestInfo *pRI);
-static void dispatchCallForward(Parcel& p, RequestInfo *pRI);
-static void dispatchRaw(Parcel& p, RequestInfo *pRI);
-static void dispatchSmsWrite (Parcel &p, RequestInfo *pRI);
-static void dispatchDataCall (Parcel& p, RequestInfo *pRI);
-static void dispatchVoiceRadioTech (Parcel& p, RequestInfo *pRI);
-static void dispatchCdmaSubscriptionSource (Parcel& p, RequestInfo *pRI);
-
-static void dispatchCdmaSms(Parcel &p, RequestInfo *pRI);
-static void dispatchCdmaSmsAck(Parcel &p, RequestInfo *pRI);
-static void dispatchGsmBrSmsCnf(Parcel &p, RequestInfo *pRI);
-static void dispatchCdmaBrSmsCnf(Parcel &p, RequestInfo *pRI);
-static void dispatchRilCdmaSmsWriteArgs(Parcel &p, RequestInfo *pRI);
-static int responseInts(Parcel &p, void *response, size_t responselen);
-static int responseStrings(Parcel &p, void *response, size_t responselen);
-static int responseString(Parcel &p, void *response, size_t responselen);
-static int responseVoid(Parcel &p, void *response, size_t responselen);
-static int responseCallList(Parcel &p, void *response, size_t responselen);
-static int responseSMS(Parcel &p, void *response, size_t responselen);
-static int responseSIM_IO(Parcel &p, void *response, size_t responselen);
-static int responseCallForwards(Parcel &p, void *response, size_t responselen);
-static int responseDataCallList(Parcel &p, void *response, size_t responselen);
-static int responseSetupDataCall(Parcel &p, void *response, size_t responselen);
-static int responseRaw(Parcel &p, void *response, size_t responselen);
-static int responseSsn(Parcel &p, void *response, size_t responselen);
-static int responseSimStatus(Parcel &p, void *response, size_t responselen);
-static int responseGsmBrSmsCnf(Parcel &p, void *response, size_t responselen);
-static int responseCdmaBrSmsCnf(Parcel &p, void *response, size_t responselen);
-static int responseCdmaERIInfo(Parcel &p, void *response, size_t responselen);
-static int responseCdmaSms(Parcel &p, void *response, size_t responselen);
-static int responseCellList(Parcel &p, void *response, size_t responselen);
-static int responseCdmaInformationRecords(Parcel &p,void *response, size_t responselen);
-static int responseRilSignalStrength(Parcel &p,void *response, size_t responselen);
-static int responseCallRing(Parcel &p, void *response, size_t responselen);
-static int responseCdmaSignalInfoRecord(Parcel &p,void *response, size_t responselen);
-static int responseCdmaCallWaiting(Parcel &p,void *response, size_t responselen);
-static int responseSimRefresh(Parcel &p, void *response, size_t responselen);
-
-static int decodeVoiceRadioTechnology (RIL_RadioState radioState);
-static int decodeCdmaSubscriptionSource (RIL_RadioState radioState);
-static RIL_RadioState processRadioState(RIL_RadioState newRadioState);
-
-extern "C" const char * requestToString(int request);
-extern "C" const char * failCauseToString(RIL_Errno);
-extern "C" const char * callStateToString(RIL_CallState);
-extern "C" const char * radioStateToString(RIL_RadioState);
-
-#ifdef RIL_SHLIB
-extern "C" void RIL_onUnsolicitedResponse(int unsolResponse, void *data,
-                                size_t datalen);
-#endif
-
-static UserCallbackInfo * internalRequestTimedCallback
-    (RIL_TimedCallback callback, void *param,
-        const struct timeval *relativeTime);
-
-/** Index == requestNumber */
-static CommandInfo s_commands[] = {
-#include "ril_commands.h"
-};
-
-static UnsolResponseInfo s_unsolResponses[] = {
-#include "ril_unsol_commands.h"
-};
-
-/* For older RILs that do not support new commands RIL_REQUEST_VOICE_RADIO_TECH and
-   RIL_UNSOL_VOICE_RADIO_TECH_CHANGED messages, decode the voice radio tech from
-   radio state message and store it. Every time there is a change in Radio State
-   check to see if voice radio tech changes and notify telephony
- */
-int voiceRadioTech = -1;
-
-/* For older RILs that do not support new commands RIL_REQUEST_GET_CDMA_SUBSCRIPTION_SOURCE
-   and RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED messages, decode the subscription
-   source from radio state and store it. Every time there is a change in Radio State
-   check to see if subscription source changed and notify telephony
- */
-int cdmaSubscriptionSource = -1;
-
-/* For older RILs that do not send RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED, decode the
-   SIM/RUIM state from radio state and store it. Every time there is a change in Radio State,
-   check to see if SIM/RUIM status changed and notify telephony
- */
-int simRuimStatus = -1;
-
-static char *
-strdupReadString(Parcel &p) {
-    size_t stringlen;
-    const char16_t *s16;
-
-    s16 = p.readString16Inplace(&stringlen);
-
-    return strndup16to8(s16, stringlen);
-}
-
-static void writeStringToParcel(Parcel &p, const char *s) {
-    char16_t *s16;
-    size_t s16_len;
-    s16 = strdup8to16(s, &s16_len);
-    p.writeString16(s16, s16_len);
-    free(s16);
-}
-
-
-static void
-memsetString (char *s) {
-    if (s != NULL) {
-        memset (s, 0, strlen(s));
-    }
-}
-
-void   nullParcelReleaseFunction (const uint8_t* data, size_t dataSize,
-                                    const size_t* objects, size_t objectsSize,
-                                        void* cookie) {
-    // do nothing -- the data reference lives longer than the Parcel object
-}
-
-/**
- * To be called from dispatch thread
- * Issue a single local request, ensuring that the response
- * is not sent back up to the command process
- */
-static void
-issueLocalRequest(int request, void *data, int len) {
-    RequestInfo *pRI;
-    int ret;
-
-    pRI = (RequestInfo *)calloc(1, sizeof(RequestInfo));
-
-    pRI->local = 1;
-    pRI->token = 0xffffffff;        // token is not used in this context
-    pRI->pCI = &(s_commands[request]);
-
-    ret = pthread_mutex_lock(&s_pendingRequestsMutex);
-    assert (ret == 0);
-
-    pRI->p_next = s_pendingRequests;
-    s_pendingRequests = pRI;
-
-    ret = pthread_mutex_unlock(&s_pendingRequestsMutex);
-    assert (ret == 0);
-
-    ALOGD("C[locl]> %s", requestToString(request));
-
-    s_callbacks.onRequest(request, data, len, pRI);
-}
-
-
-
-static int
-processCommandBuffer(void *buffer, size_t buflen) {
-    Parcel p;
-    status_t status;
-    int32_t request;
-    int32_t token;
-    RequestInfo *pRI;
-    int ret;
-
-    p.setData((uint8_t *) buffer, buflen);
-
-    // status checked at end
-    status = p.readInt32(&request);
-    status = p.readInt32 (&token);
-
-    if (status != NO_ERROR) {
-        ALOGE("invalid request block");
-        return 0;
-    }
-
-    if (request < 1 || request >= (int32_t)NUM_ELEMS(s_commands)) {
-        ALOGE("unsupported request code %d token %d", request, token);
-        // FIXME this should perhaps return a response
-        return 0;
-    }
-
-
-    pRI = (RequestInfo *)calloc(1, sizeof(RequestInfo));
-
-    pRI->token = token;
-    pRI->pCI = &(s_commands[request]);
-
-    ret = pthread_mutex_lock(&s_pendingRequestsMutex);
-    assert (ret == 0);
-
-    pRI->p_next = s_pendingRequests;
-    s_pendingRequests = pRI;
-
-    ret = pthread_mutex_unlock(&s_pendingRequestsMutex);
-    assert (ret == 0);
-
-/*    sLastDispatchedToken = token; */
-
-    pRI->pCI->dispatchFunction(p, pRI);
-
-    return 0;
-}
-
-static void
-invalidCommandBlock (RequestInfo *pRI) {
-    ALOGE("invalid command block for token %d request %s",
-                pRI->token, requestToString(pRI->pCI->requestNumber));
-}
-
-/** Callee expects NULL */
-static void
-dispatchVoid (Parcel& p, RequestInfo *pRI) {
-    clearPrintBuf;
-    printRequest(pRI->token, pRI->pCI->requestNumber);
-    s_callbacks.onRequest(pRI->pCI->requestNumber, NULL, 0, pRI);
-}
-
-/** Callee expects const char * */
-static void
-dispatchString (Parcel& p, RequestInfo *pRI) {
-    status_t status;
-    size_t datalen;
-    size_t stringlen;
-    char *string8 = NULL;
-
-    string8 = strdupReadString(p);
-
-    startRequest;
-    appendPrintBuf("%s%s", printBuf, string8);
-    closeRequest;
-    printRequest(pRI->token, pRI->pCI->requestNumber);
-
-    s_callbacks.onRequest(pRI->pCI->requestNumber, string8,
-                       sizeof(char *), pRI);
-
-#ifdef MEMSET_FREED
-    memsetString(string8);
-#endif
-
-    free(string8);
-    return;
-invalid:
-    invalidCommandBlock(pRI);
-    return;
-}
-
-/** Callee expects const char ** */
-static void
-dispatchStrings (Parcel &p, RequestInfo *pRI) {
-    int32_t countStrings;
-    status_t status;
-    size_t datalen;
-    char **pStrings;
-
-    status = p.readInt32 (&countStrings);
-
-    if (status != NO_ERROR) {
-        goto invalid;
-    }
-
-    startRequest;
-    if (countStrings == 0) {
-        // just some non-null pointer
-        pStrings = (char **)alloca(sizeof(char *));
-        datalen = 0;
-    } else if (((int)countStrings) == -1) {
-        pStrings = NULL;
-        datalen = 0;
-    } else {
-        datalen = sizeof(char *) * countStrings;
-
-        pStrings = (char **)alloca(datalen);
-
-        for (int i = 0 ; i < countStrings ; i++) {
-            pStrings[i] = strdupReadString(p);
-            appendPrintBuf("%s%s,", printBuf, pStrings[i]);
-        }
-    }
-    removeLastChar;
-    closeRequest;
-    printRequest(pRI->token, pRI->pCI->requestNumber);
-
-    s_callbacks.onRequest(pRI->pCI->requestNumber, pStrings, datalen, pRI);
-
-    if (pStrings != NULL) {
-        for (int i = 0 ; i < countStrings ; i++) {
-#ifdef MEMSET_FREED
-            memsetString (pStrings[i]);
-#endif
-            free(pStrings[i]);
-        }
-
-#ifdef MEMSET_FREED
-        memset(pStrings, 0, datalen);
-#endif
-    }
-
-    return;
-invalid:
-    invalidCommandBlock(pRI);
-    return;
-}
-
-/** Callee expects const int * */
-static void
-dispatchInts (Parcel &p, RequestInfo *pRI) {
-    int32_t count;
-    status_t status;
-    size_t datalen;
-    int *pInts;
-
-    status = p.readInt32 (&count);
-
-    if (status != NO_ERROR || count == 0) {
-        goto invalid;
-    }
-
-    datalen = sizeof(int) * count;
-    pInts = (int *)alloca(datalen);
-
-    startRequest;
-    for (int i = 0 ; i < count ; i++) {
-        int32_t t;
-
-        status = p.readInt32(&t);
-        pInts[i] = (int)t;
-        appendPrintBuf("%s%d,", printBuf, t);
-
-        if (status != NO_ERROR) {
-            goto invalid;
-        }
-   }
-   removeLastChar;
-   closeRequest;
-   printRequest(pRI->token, pRI->pCI->requestNumber);
-
-   s_callbacks.onRequest(pRI->pCI->requestNumber, const_cast<int *>(pInts),
-                       datalen, pRI);
-
-#ifdef MEMSET_FREED
-    memset(pInts, 0, datalen);
-#endif
-
-    return;
-invalid:
-    invalidCommandBlock(pRI);
-    return;
-}
-
-
-/**
- * Callee expects const RIL_SMS_WriteArgs *
- * Payload is:
- *   int32_t status
- *   String pdu
- */
-static void
-dispatchSmsWrite (Parcel &p, RequestInfo *pRI) {
-    RIL_SMS_WriteArgs args;
-    int32_t t;
-    status_t status;
-
-    memset (&args, 0, sizeof(args));
-
-    status = p.readInt32(&t);
-    args.status = (int)t;
-
-    args.pdu = strdupReadString(p);
-
-    if (status != NO_ERROR || args.pdu == NULL) {
-        goto invalid;
-    }
-
-    args.smsc = strdupReadString(p);
-
-    startRequest;
-    appendPrintBuf("%s%d,%s,smsc=%s", printBuf, args.status,
-        (char*)args.pdu,  (char*)args.smsc);
-    closeRequest;
-    printRequest(pRI->token, pRI->pCI->requestNumber);
-
-    s_callbacks.onRequest(pRI->pCI->requestNumber, &args, sizeof(args), pRI);
-
-#ifdef MEMSET_FREED
-    memsetString (args.pdu);
-#endif
-
-    free (args.pdu);
-
-#ifdef MEMSET_FREED
-    memset(&args, 0, sizeof(args));
-#endif
-
-    return;
-invalid:
-    invalidCommandBlock(pRI);
-    return;
-}
-
-/**
- * Callee expects const RIL_Dial *
- * Payload is:
- *   String address
- *   int32_t clir
- */
-static void
-dispatchDial (Parcel &p, RequestInfo *pRI) {
-    RIL_Dial dial;
-    RIL_UUS_Info uusInfo;
-    int32_t sizeOfDial;
-    int32_t t;
-    int32_t uusPresent;
-    status_t status;
-
-    memset (&dial, 0, sizeof(dial));
-
-    dial.address = strdupReadString(p);
-
-    status = p.readInt32(&t);
-    dial.clir = (int)t;
-
-    if (status != NO_ERROR || dial.address == NULL) {
-        goto invalid;
-    }
-
-    if (s_callbacks.version < 3) { // Remove when partners upgrade to version 3
-        uusPresent = 0;
-        sizeOfDial = sizeof(dial) - sizeof(RIL_UUS_Info *);
-    } else {
-        status = p.readInt32(&uusPresent);
-
-        if (status != NO_ERROR) {
-            goto invalid;
-        }
-
-        if (uusPresent == 0) {
-            dial.uusInfo = NULL;
-        } else {
-            int32_t len;
-
-            memset(&uusInfo, 0, sizeof(RIL_UUS_Info));
-
-            status = p.readInt32(&t);
-            uusInfo.uusType = (RIL_UUS_Type) t;
-
-            status = p.readInt32(&t);
-            uusInfo.uusDcs = (RIL_UUS_DCS) t;
-
-            status = p.readInt32(&len);
-            if (status != NO_ERROR) {
-                goto invalid;
-            }
-
-            // The java code writes -1 for null arrays
-            if (((int) len) == -1) {
-                uusInfo.uusData = NULL;
-                len = 0;
-            } else {
-                uusInfo.uusData = (char*) p.readInplace(len);
-            }
-
-            uusInfo.uusLength = len;
-            dial.uusInfo = &uusInfo;
-        }
-        sizeOfDial = sizeof(dial);
-    }
-
-    startRequest;
-    appendPrintBuf("%snum=%s,clir=%d", printBuf, dial.address, dial.clir);
-    if (uusPresent) {
-        appendPrintBuf("%s,uusType=%d,uusDcs=%d,uusLen=%d", printBuf,
-                dial.uusInfo->uusType, dial.uusInfo->uusDcs,
-                dial.uusInfo->uusLength);
-    }
-    closeRequest;
-    printRequest(pRI->token, pRI->pCI->requestNumber);
-
-    s_callbacks.onRequest(pRI->pCI->requestNumber, &dial, sizeOfDial, pRI);
-
-#ifdef MEMSET_FREED
-    memsetString (dial.address);
-#endif
-
-    free (dial.address);
-
-#ifdef MEMSET_FREED
-    memset(&uusInfo, 0, sizeof(RIL_UUS_Info));
-    memset(&dial, 0, sizeof(dial));
-#endif
-
-    return;
-invalid:
-    invalidCommandBlock(pRI);
-    return;
-}
-
-/**
- * Callee expects const RIL_SIM_IO *
- * Payload is:
- *   int32_t command
- *   int32_t fileid
- *   String path
- *   int32_t p1, p2, p3
- *   String data
- *   String pin2
- *   String aidPtr
- */
-static void
-dispatchSIM_IO (Parcel &p, RequestInfo *pRI) {
-    union RIL_SIM_IO {
-        RIL_SIM_IO_v6 v6;
-        RIL_SIM_IO_v5 v5;
-    } simIO;
-
-    int32_t t;
-    int size;
-    status_t status;
-
-    memset (&simIO, 0, sizeof(simIO));
-
-    // note we only check status at the end
-
-    status = p.readInt32(&t);
-    simIO.v6.command = (int)t;
-
-    status = p.readInt32(&t);
-    simIO.v6.fileid = (int)t;
-
-    simIO.v6.path = strdupReadString(p);
-
-    status = p.readInt32(&t);
-    simIO.v6.p1 = (int)t;
-
-    status = p.readInt32(&t);
-    simIO.v6.p2 = (int)t;
-
-    status = p.readInt32(&t);
-    simIO.v6.p3 = (int)t;
-
-    simIO.v6.data = strdupReadString(p);
-    simIO.v6.pin2 = strdupReadString(p);
-    simIO.v6.aidPtr = strdupReadString(p);
-
-    startRequest;
-    appendPrintBuf("%scmd=0x%X,efid=0x%X,path=%s,%d,%d,%d,%s,pin2=%s,aid=%s", printBuf,
-        simIO.v6.command, simIO.v6.fileid, (char*)simIO.v6.path,
-        simIO.v6.p1, simIO.v6.p2, simIO.v6.p3,
-        (char*)simIO.v6.data,  (char*)simIO.v6.pin2, simIO.v6.aidPtr);
-    closeRequest;
-    printRequest(pRI->token, pRI->pCI->requestNumber);
-
-    if (status != NO_ERROR) {
-        goto invalid;
-    }
-
-    size = (s_callbacks.version < 6) ? sizeof(simIO.v5) : sizeof(simIO.v6);
-    s_callbacks.onRequest(pRI->pCI->requestNumber, &simIO, size, pRI);
-
-#ifdef MEMSET_FREED
-    memsetString (simIO.v6.path);
-    memsetString (simIO.v6.data);
-    memsetString (simIO.v6.pin2);
-    memsetString (simIO.v6.aidPtr);
-#endif
-
-    free (simIO.v6.path);
-    free (simIO.v6.data);
-    free (simIO.v6.pin2);
-    free (simIO.v6.aidPtr);
-
-#ifdef MEMSET_FREED
-    memset(&simIO, 0, sizeof(simIO));
-#endif
-
-    return;
-invalid:
-    invalidCommandBlock(pRI);
-    return;
-}
-
-/**
- * Callee expects const RIL_CallForwardInfo *
- * Payload is:
- *  int32_t status/action
- *  int32_t reason
- *  int32_t serviceCode
- *  int32_t toa
- *  String number  (0 length -> null)
- *  int32_t timeSeconds
- */
-static void
-dispatchCallForward(Parcel &p, RequestInfo *pRI) {
-    RIL_CallForwardInfo cff;
-    int32_t t;
-    status_t status;
-
-    memset (&cff, 0, sizeof(cff));
-
-    // note we only check status at the end
-
-    status = p.readInt32(&t);
-    cff.status = (int)t;
-
-    status = p.readInt32(&t);
-    cff.reason = (int)t;
-
-    status = p.readInt32(&t);
-    cff.serviceClass = (int)t;
-
-    status = p.readInt32(&t);
-    cff.toa = (int)t;
-
-    cff.number = strdupReadString(p);
-
-    status = p.readInt32(&t);
-    cff.timeSeconds = (int)t;
-
-    if (status != NO_ERROR) {
-        goto invalid;
-    }
-
-    // special case: number 0-length fields is null
-
-    if (cff.number != NULL && strlen (cff.number) == 0) {
-        cff.number = NULL;
-    }
-
-    startRequest;
-    appendPrintBuf("%sstat=%d,reason=%d,serv=%d,toa=%d,%s,tout=%d", printBuf,
-        cff.status, cff.reason, cff.serviceClass, cff.toa,
-        (char*)cff.number, cff.timeSeconds);
-    closeRequest;
-    printRequest(pRI->token, pRI->pCI->requestNumber);
-
-    s_callbacks.onRequest(pRI->pCI->requestNumber, &cff, sizeof(cff), pRI);
-
-#ifdef MEMSET_FREED
-    memsetString(cff.number);
-#endif
-
-    free (cff.number);
-
-#ifdef MEMSET_FREED
-    memset(&cff, 0, sizeof(cff));
-#endif
-
-    return;
-invalid:
-    invalidCommandBlock(pRI);
-    return;
-}
-
-
-static void
-dispatchRaw(Parcel &p, RequestInfo *pRI) {
-    int32_t len;
-    status_t status;
-    const void *data;
-
-    status = p.readInt32(&len);
-
-    if (status != NO_ERROR) {
-        goto invalid;
-    }
-
-    // The java code writes -1 for null arrays
-    if (((int)len) == -1) {
-        data = NULL;
-        len = 0;
-    }
-
-    data = p.readInplace(len);
-
-    startRequest;
-    appendPrintBuf("%sraw_size=%d", printBuf, len);
-    closeRequest;
-    printRequest(pRI->token, pRI->pCI->requestNumber);
-
-    s_callbacks.onRequest(pRI->pCI->requestNumber, const_cast<void *>(data), len, pRI);
-
-    return;
-invalid:
-    invalidCommandBlock(pRI);
-    return;
-}
-
-static void
-dispatchCdmaSms(Parcel &p, RequestInfo *pRI) {
-    RIL_CDMA_SMS_Message rcsm;
-    int32_t  t;
-    uint8_t ut;
-    status_t status;
-    int32_t digitCount;
-    int digitLimit;
-
-    memset(&rcsm, 0, sizeof(rcsm));
-
-    status = p.readInt32(&t);
-    rcsm.uTeleserviceID = (int) t;
-
-    status = p.read(&ut,sizeof(ut));
-    rcsm.bIsServicePresent = (uint8_t) ut;
-
-    status = p.readInt32(&t);
-    rcsm.uServicecategory = (int) t;
-
-    status = p.readInt32(&t);
-    rcsm.sAddress.digit_mode = (RIL_CDMA_SMS_DigitMode) t;
-
-    status = p.readInt32(&t);
-    rcsm.sAddress.number_mode = (RIL_CDMA_SMS_NumberMode) t;
-
-    status = p.readInt32(&t);
-    rcsm.sAddress.number_type = (RIL_CDMA_SMS_NumberType) t;
-
-    status = p.readInt32(&t);
-    rcsm.sAddress.number_plan = (RIL_CDMA_SMS_NumberPlan) t;
-
-    status = p.read(&ut,sizeof(ut));
-    rcsm.sAddress.number_of_digits= (uint8_t) ut;
-
-    digitLimit= MIN((rcsm.sAddress.number_of_digits), RIL_CDMA_SMS_ADDRESS_MAX);
-    for(digitCount =0 ; digitCount < digitLimit; digitCount ++) {
-        status = p.read(&ut,sizeof(ut));
-        rcsm.sAddress.digits[digitCount] = (uint8_t) ut;
-    }
-
-    status = p.readInt32(&t);
-    rcsm.sSubAddress.subaddressType = (RIL_CDMA_SMS_SubaddressType) t;
-
-    status = p.read(&ut,sizeof(ut));
-    rcsm.sSubAddress.odd = (uint8_t) ut;
-
-    status = p.read(&ut,sizeof(ut));
-    rcsm.sSubAddress.number_of_digits = (uint8_t) ut;
-
-    digitLimit= MIN((rcsm.sSubAddress.number_of_digits), RIL_CDMA_SMS_SUBADDRESS_MAX);
-    for(digitCount =0 ; digitCount < digitLimit; digitCount ++) {
-        status = p.read(&ut,sizeof(ut));
-        rcsm.sSubAddress.digits[digitCount] = (uint8_t) ut;
-    }
-
-    status = p.readInt32(&t);
-    rcsm.uBearerDataLen = (int) t;
-
-    digitLimit= MIN((rcsm.uBearerDataLen), RIL_CDMA_SMS_BEARER_DATA_MAX);
-    for(digitCount =0 ; digitCount < digitLimit; digitCount ++) {
-        status = p.read(&ut, sizeof(ut));
-        rcsm.aBearerData[digitCount] = (uint8_t) ut;
-    }
-
-    if (status != NO_ERROR) {
-        goto invalid;
-    }
-
-    startRequest;
-    appendPrintBuf("%suTeleserviceID=%d, bIsServicePresent=%d, uServicecategory=%d, \
-            sAddress.digit_mode=%d, sAddress.Number_mode=%d, sAddress.number_type=%d, ",
-            printBuf, rcsm.uTeleserviceID,rcsm.bIsServicePresent,rcsm.uServicecategory,
-            rcsm.sAddress.digit_mode, rcsm.sAddress.number_mode,rcsm.sAddress.number_type);
-    closeRequest;
-
-    printRequest(pRI->token, pRI->pCI->requestNumber);
-
-    s_callbacks.onRequest(pRI->pCI->requestNumber, &rcsm, sizeof(rcsm),pRI);
-
-#ifdef MEMSET_FREED
-    memset(&rcsm, 0, sizeof(rcsm));
-#endif
-
-    return;
-
-invalid:
-    invalidCommandBlock(pRI);
-    return;
-}
-
-static void
-dispatchCdmaSmsAck(Parcel &p, RequestInfo *pRI) {
-    RIL_CDMA_SMS_Ack rcsa;
-    int32_t  t;
-    status_t status;
-    int32_t digitCount;
-
-    memset(&rcsa, 0, sizeof(rcsa));
-
-    status = p.readInt32(&t);
-    rcsa.uErrorClass = (RIL_CDMA_SMS_ErrorClass) t;
-
-    status = p.readInt32(&t);
-    rcsa.uSMSCauseCode = (int) t;
-
-    if (status != NO_ERROR) {
-        goto invalid;
-    }
-
-    startRequest;
-    appendPrintBuf("%suErrorClass=%d, uTLStatus=%d, ",
-            printBuf, rcsa.uErrorClass, rcsa.uSMSCauseCode);
-    closeRequest;
-
-    printRequest(pRI->token, pRI->pCI->requestNumber);
-
-    s_callbacks.onRequest(pRI->pCI->requestNumber, &rcsa, sizeof(rcsa),pRI);
-
-#ifdef MEMSET_FREED
-    memset(&rcsa, 0, sizeof(rcsa));
-#endif
-
-    return;
-
-invalid:
-    invalidCommandBlock(pRI);
-    return;
-}
-
-static void
-dispatchGsmBrSmsCnf(Parcel &p, RequestInfo *pRI) {
-    int32_t t;
-    status_t status;
-    int32_t num;
-
-    status = p.readInt32(&num);
-    if (status != NO_ERROR) {
-        goto invalid;
-    }
-
-    RIL_GSM_BroadcastSmsConfigInfo gsmBci[num];
-    RIL_GSM_BroadcastSmsConfigInfo *gsmBciPtrs[num];
-
-    startRequest;
-    for (int i = 0 ; i < num ; i++ ) {
-        gsmBciPtrs[i] = &gsmBci[i];
-
-        status = p.readInt32(&t);
-        gsmBci[i].fromServiceId = (int) t;
-
-        status = p.readInt32(&t);
-        gsmBci[i].toServiceId = (int) t;
-
-        status = p.readInt32(&t);
-        gsmBci[i].fromCodeScheme = (int) t;
-
-        status = p.readInt32(&t);
-        gsmBci[i].toCodeScheme = (int) t;
-
-        status = p.readInt32(&t);
-        gsmBci[i].selected = (uint8_t) t;
-
-        appendPrintBuf("%s [%d: fromServiceId=%d, toServiceId =%d, \
-              fromCodeScheme=%d, toCodeScheme=%d, selected =%d]", printBuf, i,
-              gsmBci[i].fromServiceId, gsmBci[i].toServiceId,
-              gsmBci[i].fromCodeScheme, gsmBci[i].toCodeScheme,
-              gsmBci[i].selected);
-    }
-    closeRequest;
-
-    if (status != NO_ERROR) {
-        goto invalid;
-    }
-
-    s_callbacks.onRequest(pRI->pCI->requestNumber,
-                          gsmBciPtrs,
-                          num * sizeof(RIL_GSM_BroadcastSmsConfigInfo *),
-                          pRI);
-
-#ifdef MEMSET_FREED
-    memset(gsmBci, 0, num * sizeof(RIL_GSM_BroadcastSmsConfigInfo));
-    memset(gsmBciPtrs, 0, num * sizeof(RIL_GSM_BroadcastSmsConfigInfo *));
-#endif
-
-    return;
-
-invalid:
-    invalidCommandBlock(pRI);
-    return;
-}
-
-static void
-dispatchCdmaBrSmsCnf(Parcel &p, RequestInfo *pRI) {
-    int32_t t;
-    status_t status;
-    int32_t num;
-
-    status = p.readInt32(&num);
-    if (status != NO_ERROR) {
-        goto invalid;
-    }
-
-    RIL_CDMA_BroadcastSmsConfigInfo cdmaBci[num];
-    RIL_CDMA_BroadcastSmsConfigInfo *cdmaBciPtrs[num];
-
-    startRequest;
-    for (int i = 0 ; i < num ; i++ ) {
-        cdmaBciPtrs[i] = &cdmaBci[i];
-
-        status = p.readInt32(&t);
-        cdmaBci[i].service_category = (int) t;
-
-        status = p.readInt32(&t);
-        cdmaBci[i].language = (int) t;
-
-        status = p.readInt32(&t);
-        cdmaBci[i].selected = (uint8_t) t;
-
-        appendPrintBuf("%s [%d: service_category=%d, language =%d, \
-              entries.bSelected =%d]", printBuf, i, cdmaBci[i].service_category,
-              cdmaBci[i].language, cdmaBci[i].selected);
-    }
-    closeRequest;
-
-    if (status != NO_ERROR) {
-        goto invalid;
-    }
-
-    s_callbacks.onRequest(pRI->pCI->requestNumber,
-                          cdmaBciPtrs,
-                          num * sizeof(RIL_CDMA_BroadcastSmsConfigInfo *),
-                          pRI);
-
-#ifdef MEMSET_FREED
-    memset(cdmaBci, 0, num * sizeof(RIL_CDMA_BroadcastSmsConfigInfo));
-    memset(cdmaBciPtrs, 0, num * sizeof(RIL_CDMA_BroadcastSmsConfigInfo *));
-#endif
-
-    return;
-
-invalid:
-    invalidCommandBlock(pRI);
-    return;
-}
-
-static void dispatchRilCdmaSmsWriteArgs(Parcel &p, RequestInfo *pRI) {
-    RIL_CDMA_SMS_WriteArgs rcsw;
-    int32_t  t;
-    uint32_t ut;
-    uint8_t  uct;
-    status_t status;
-    int32_t  digitCount;
-
-    memset(&rcsw, 0, sizeof(rcsw));
-
-    status = p.readInt32(&t);
-    rcsw.status = t;
-
-    status = p.readInt32(&t);
-    rcsw.message.uTeleserviceID = (int) t;
-
-    status = p.read(&uct,sizeof(uct));
-    rcsw.message.bIsServicePresent = (uint8_t) uct;
-
-    status = p.readInt32(&t);
-    rcsw.message.uServicecategory = (int) t;
-
-    status = p.readInt32(&t);
-    rcsw.message.sAddress.digit_mode = (RIL_CDMA_SMS_DigitMode) t;
-
-    status = p.readInt32(&t);
-    rcsw.message.sAddress.number_mode = (RIL_CDMA_SMS_NumberMode) t;
-
-    status = p.readInt32(&t);
-    rcsw.message.sAddress.number_type = (RIL_CDMA_SMS_NumberType) t;
-
-    status = p.readInt32(&t);
-    rcsw.message.sAddress.number_plan = (RIL_CDMA_SMS_NumberPlan) t;
-
-    status = p.read(&uct,sizeof(uct));
-    rcsw.message.sAddress.number_of_digits = (uint8_t) uct;
-
-    for(digitCount = 0 ; digitCount < RIL_CDMA_SMS_ADDRESS_MAX; digitCount ++) {
-        status = p.read(&uct,sizeof(uct));
-        rcsw.message.sAddress.digits[digitCount] = (uint8_t) uct;
-    }
-
-    status = p.readInt32(&t);
-    rcsw.message.sSubAddress.subaddressType = (RIL_CDMA_SMS_SubaddressType) t;
-
-    status = p.read(&uct,sizeof(uct));
-    rcsw.message.sSubAddress.odd = (uint8_t) uct;
-
-    status = p.read(&uct,sizeof(uct));
-    rcsw.message.sSubAddress.number_of_digits = (uint8_t) uct;
-
-    for(digitCount = 0 ; digitCount < RIL_CDMA_SMS_SUBADDRESS_MAX; digitCount ++) {
-        status = p.read(&uct,sizeof(uct));
-        rcsw.message.sSubAddress.digits[digitCount] = (uint8_t) uct;
-    }
-
-    status = p.readInt32(&t);
-    rcsw.message.uBearerDataLen = (int) t;
-
-    for(digitCount = 0 ; digitCount < RIL_CDMA_SMS_BEARER_DATA_MAX; digitCount ++) {
-        status = p.read(&uct, sizeof(uct));
-        rcsw.message.aBearerData[digitCount] = (uint8_t) uct;
-    }
-
-    if (status != NO_ERROR) {
-        goto invalid;
-    }
-
-    startRequest;
-    appendPrintBuf("%sstatus=%d, message.uTeleserviceID=%d, message.bIsServicePresent=%d, \
-            message.uServicecategory=%d, message.sAddress.digit_mode=%d, \
-            message.sAddress.number_mode=%d, \
-            message.sAddress.number_type=%d, ",
-            printBuf, rcsw.status, rcsw.message.uTeleserviceID, rcsw.message.bIsServicePresent,
-            rcsw.message.uServicecategory, rcsw.message.sAddress.digit_mode,
-            rcsw.message.sAddress.number_mode,
-            rcsw.message.sAddress.number_type);
-    closeRequest;
-
-    printRequest(pRI->token, pRI->pCI->requestNumber);
-
-    s_callbacks.onRequest(pRI->pCI->requestNumber, &rcsw, sizeof(rcsw),pRI);
-
-#ifdef MEMSET_FREED
-    memset(&rcsw, 0, sizeof(rcsw));
-#endif
-
-    return;
-
-invalid:
-    invalidCommandBlock(pRI);
-    return;
-
-}
-
-// For backwards compatibility in RIL_REQUEST_SETUP_DATA_CALL.
-// Version 4 of the RIL interface adds a new PDP type parameter to support
-// IPv6 and dual-stack PDP contexts. When dealing with a previous version of
-// RIL, remove the parameter from the request.
-static void dispatchDataCall(Parcel& p, RequestInfo *pRI) {
-    // In RIL v3, REQUEST_SETUP_DATA_CALL takes 6 parameters.
-    const int numParamsRilV3 = 6;
-
-    // The first bytes of the RIL parcel contain the request number and the
-    // serial number - see processCommandBuffer(). Copy them over too.
-    int pos = p.dataPosition();
-
-    int numParams = p.readInt32();
-    if (s_callbacks.version < 4 && numParams > numParamsRilV3) {
-      Parcel p2;
-      p2.appendFrom(&p, 0, pos);
-      p2.writeInt32(numParamsRilV3);
-      for(int i = 0; i < numParamsRilV3; i++) {
-        p2.writeString16(p.readString16());
-      }
-      p2.setDataPosition(pos);
-      dispatchStrings(p2, pRI);
-    } else {
-      p.setDataPosition(pos);
-      dispatchStrings(p, pRI);
-    }
-}
-
-// For backwards compatibility with RILs that dont support RIL_REQUEST_VOICE_RADIO_TECH.
-// When all RILs handle this request, this function can be removed and
-// the request can be sent directly to the RIL using dispatchVoid.
-static void dispatchVoiceRadioTech(Parcel& p, RequestInfo *pRI) {
-    RIL_RadioState state = s_callbacks.onStateRequest();
-
-    if ((RADIO_STATE_UNAVAILABLE == state) || (RADIO_STATE_OFF == state)) {
-        RIL_onRequestComplete(pRI, RIL_E_RADIO_NOT_AVAILABLE, NULL, 0);
-    }
-
-    // RILs that support RADIO_STATE_ON should support this request.
-    if (RADIO_STATE_ON == state) {
-        dispatchVoid(p, pRI);
-        return;
-    }
-
-    // For Older RILs, that do not support RADIO_STATE_ON, assume that they
-    // will not support this new request either and decode Voice Radio Technology
-    // from Radio State
-    voiceRadioTech = decodeVoiceRadioTechnology(state);
-
-    if (voiceRadioTech < 0)
-        RIL_onRequestComplete(pRI, RIL_E_GENERIC_FAILURE, NULL, 0);
-    else
-        RIL_onRequestComplete(pRI, RIL_E_SUCCESS, &voiceRadioTech, sizeof(int));
-}
-
-// For backwards compatibility in RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE:.
-// When all RILs handle this request, this function can be removed and
-// the request can be sent directly to the RIL using dispatchVoid.
-static void dispatchCdmaSubscriptionSource(Parcel& p, RequestInfo *pRI) {
-    RIL_RadioState state = s_callbacks.onStateRequest();
-
-    if ((RADIO_STATE_UNAVAILABLE == state) || (RADIO_STATE_OFF == state)) {
-        RIL_onRequestComplete(pRI, RIL_E_RADIO_NOT_AVAILABLE, NULL, 0);
-    }
-
-    // RILs that support RADIO_STATE_ON should support this request.
-    if (RADIO_STATE_ON == state) {
-        dispatchVoid(p, pRI);
-        return;
-    }
-
-    // For Older RILs, that do not support RADIO_STATE_ON, assume that they
-    // will not support this new request either and decode CDMA Subscription Source
-    // from Radio State
-    cdmaSubscriptionSource = decodeCdmaSubscriptionSource(state);
-
-    if (cdmaSubscriptionSource < 0)
-        RIL_onRequestComplete(pRI, RIL_E_GENERIC_FAILURE, NULL, 0);
-    else
-        RIL_onRequestComplete(pRI, RIL_E_SUCCESS, &cdmaSubscriptionSource, sizeof(int));
-}
-
-static int
-blockingWrite(int fd, const void *buffer, size_t len) {
-    size_t writeOffset = 0;
-    const uint8_t *toWrite;
-
-    toWrite = (const uint8_t *)buffer;
-
-    while (writeOffset < len) {
-        ssize_t written;
-        do {
-            written = write (fd, toWrite + writeOffset,
-                                len - writeOffset);
-        } while (written < 0 && errno == EINTR);
-
-        if (written >= 0) {
-            writeOffset += written;
-        } else {   // written < 0
-            ALOGE ("RIL Response: unexpected error on write errno:%d", errno);
-            close(fd);
-            return -1;
-        }
-    }
-
-    return 0;
-}
-
-static int
-sendResponseRaw (const void *data, size_t dataSize) {
-    int fd = s_fdCommand;
-    int ret;
-    uint32_t header;
-
-    if (s_fdCommand < 0) {
-        return -1;
-    }
-
-    if (dataSize > MAX_COMMAND_BYTES) {
-        ALOGE("RIL: packet larger than %u (%u)",
-                MAX_COMMAND_BYTES, (unsigned int )dataSize);
-
-        return -1;
-    }
-
-    pthread_mutex_lock(&s_writeMutex);
-
-    header = htonl(dataSize);
-
-    ret = blockingWrite(fd, (void *)&header, sizeof(header));
-
-    if (ret < 0) {
-        pthread_mutex_unlock(&s_writeMutex);
-        return ret;
-    }
-
-    ret = blockingWrite(fd, data, dataSize);
-
-    if (ret < 0) {
-        pthread_mutex_unlock(&s_writeMutex);
-        return ret;
-    }
-
-    pthread_mutex_unlock(&s_writeMutex);
-
-    return 0;
-}
-
-static int
-sendResponse (Parcel &p) {
-    printResponse;
-    return sendResponseRaw(p.data(), p.dataSize());
-}
-
-/** response is an int* pointing to an array of ints*/
-
-static int
-responseInts(Parcel &p, void *response, size_t responselen) {
-    int numInts;
-
-    if (response == NULL && responselen != 0) {
-        ALOGE("invalid response: NULL");
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-    if (responselen % sizeof(int) != 0) {
-        ALOGE("invalid response length %d expected multiple of %d\n",
-            (int)responselen, (int)sizeof(int));
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    int *p_int = (int *) response;
-
-    numInts = responselen / sizeof(int *);
-    p.writeInt32 (numInts);
-
-    /* each int*/
-    startResponse;
-    for (int i = 0 ; i < numInts ; i++) {
-        appendPrintBuf("%s%d,", printBuf, p_int[i]);
-        p.writeInt32(p_int[i]);
-    }
-    removeLastChar;
-    closeResponse;
-
-    return 0;
-}
-
-/** response is a char **, pointing to an array of char *'s
-    The parcel will begin with the version */
-static int responseStringsWithVersion(int version, Parcel &p, void *response, size_t responselen) {
-    p.writeInt32(version);
-    return responseStrings(p, response, responselen);
-}
-
-/** response is a char **, pointing to an array of char *'s */
-static int responseStrings(Parcel &p, void *response, size_t responselen) {
-    int numStrings;
-
-    if (response == NULL && responselen != 0) {
-        ALOGE("invalid response: NULL");
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-    if (responselen % sizeof(char *) != 0) {
-        ALOGE("invalid response length %d expected multiple of %d\n",
-            (int)responselen, (int)sizeof(char *));
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    if (response == NULL) {
-        p.writeInt32 (0);
-    } else {
-        char **p_cur = (char **) response;
-
-        numStrings = responselen / sizeof(char *);
-        p.writeInt32 (numStrings);
-
-        /* each string*/
-        startResponse;
-        for (int i = 0 ; i < numStrings ; i++) {
-            appendPrintBuf("%s%s,", printBuf, (char*)p_cur[i]);
-            writeStringToParcel (p, p_cur[i]);
-        }
-        removeLastChar;
-        closeResponse;
-    }
-    return 0;
-}
-
-
-/**
- * NULL strings are accepted
- * FIXME currently ignores responselen
- */
-static int responseString(Parcel &p, void *response, size_t responselen) {
-    /* one string only */
-    startResponse;
-    appendPrintBuf("%s%s", printBuf, (char*)response);
-    closeResponse;
-
-    writeStringToParcel(p, (const char *)response);
-
-    return 0;
-}
-
-static int responseVoid(Parcel &p, void *response, size_t responselen) {
-    startResponse;
-    removeLastChar;
-    return 0;
-}
-
-static int responseCallList(Parcel &p, void *response, size_t responselen) {
-    int num;
-
-    if (response == NULL && responselen != 0) {
-        ALOGE("invalid response: NULL");
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    if (responselen % sizeof (RIL_Call *) != 0) {
-        ALOGE("invalid response length %d expected multiple of %d\n",
-            (int)responselen, (int)sizeof (RIL_Call *));
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    startResponse;
-    /* number of call info's */
-    num = responselen / sizeof(RIL_Call *);
-    p.writeInt32(num);
-
-    for (int i = 0 ; i < num ; i++) {
-        RIL_Call *p_cur = ((RIL_Call **) response)[i];
-        /* each call info */
-        p.writeInt32(p_cur->state);
-        p.writeInt32(p_cur->index);
-        p.writeInt32(p_cur->toa);
-        p.writeInt32(p_cur->isMpty);
-        p.writeInt32(p_cur->isMT);
-        p.writeInt32(p_cur->als);
-        p.writeInt32(p_cur->isVoice);
-        p.writeInt32(p_cur->isVoicePrivacy);
-        writeStringToParcel(p, p_cur->number);
-        p.writeInt32(p_cur->numberPresentation);
-        writeStringToParcel(p, p_cur->name);
-        p.writeInt32(p_cur->namePresentation);
-        // Remove when partners upgrade to version 3
-        if ((s_callbacks.version < 3) || (p_cur->uusInfo == NULL || p_cur->uusInfo->uusData == NULL)) {
-            p.writeInt32(0); /* UUS Information is absent */
-        } else {
-            RIL_UUS_Info *uusInfo = p_cur->uusInfo;
-            p.writeInt32(1); /* UUS Information is present */
-            p.writeInt32(uusInfo->uusType);
-            p.writeInt32(uusInfo->uusDcs);
-            p.writeInt32(uusInfo->uusLength);
-            p.write(uusInfo->uusData, uusInfo->uusLength);
-        }
-        appendPrintBuf("%s[id=%d,%s,toa=%d,",
-            printBuf,
-            p_cur->index,
-            callStateToString(p_cur->state),
-            p_cur->toa);
-        appendPrintBuf("%s%s,%s,als=%d,%s,%s,",
-            printBuf,
-            (p_cur->isMpty)?"conf":"norm",
-            (p_cur->isMT)?"mt":"mo",
-            p_cur->als,
-            (p_cur->isVoice)?"voc":"nonvoc",
-            (p_cur->isVoicePrivacy)?"evp":"noevp");
-        appendPrintBuf("%s%s,cli=%d,name='%s',%d]",
-            printBuf,
-            p_cur->number,
-            p_cur->numberPresentation,
-            p_cur->name,
-            p_cur->namePresentation);
-    }
-    removeLastChar;
-    closeResponse;
-
-    return 0;
-}
-
-static int responseSMS(Parcel &p, void *response, size_t responselen) {
-    if (response == NULL) {
-        ALOGE("invalid response: NULL");
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    if (responselen != sizeof (RIL_SMS_Response) ) {
-        ALOGE("invalid response length %d expected %d",
-                (int)responselen, (int)sizeof (RIL_SMS_Response));
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    RIL_SMS_Response *p_cur = (RIL_SMS_Response *) response;
-
-    p.writeInt32(p_cur->messageRef);
-    writeStringToParcel(p, p_cur->ackPDU);
-    p.writeInt32(p_cur->errorCode);
-
-    startResponse;
-    appendPrintBuf("%s%d,%s,%d", printBuf, p_cur->messageRef,
-        (char*)p_cur->ackPDU, p_cur->errorCode);
-    closeResponse;
-
-    return 0;
-}
-
-static int responseDataCallListV4(Parcel &p, void *response, size_t responselen)
-{
-    if (response == NULL && responselen != 0) {
-        ALOGE("invalid response: NULL");
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    if (responselen % sizeof(RIL_Data_Call_Response_v4) != 0) {
-        ALOGE("invalid response length %d expected multiple of %d",
-                (int)responselen, (int)sizeof(RIL_Data_Call_Response_v4));
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    int num = responselen / sizeof(RIL_Data_Call_Response_v4);
-    p.writeInt32(num);
-
-    RIL_Data_Call_Response_v4 *p_cur = (RIL_Data_Call_Response_v4 *) response;
-    startResponse;
-    int i;
-    for (i = 0; i < num; i++) {
-        p.writeInt32(p_cur[i].cid);
-        p.writeInt32(p_cur[i].active);
-        writeStringToParcel(p, p_cur[i].type);
-        // apn is not used, so don't send.
-        writeStringToParcel(p, p_cur[i].address);
-        appendPrintBuf("%s[cid=%d,%s,%s,%s],", printBuf,
-            p_cur[i].cid,
-            (p_cur[i].active==0)?"down":"up",
-            (char*)p_cur[i].type,
-            (char*)p_cur[i].address);
-    }
-    removeLastChar;
-    closeResponse;
-
-    return 0;
-}
-
-static int responseDataCallList(Parcel &p, void *response, size_t responselen)
-{
-    // Write version
-    p.writeInt32(s_callbacks.version);
-
-    if (s_callbacks.version < 5) {
-        return responseDataCallListV4(p, response, responselen);
-    } else {
-        if (response == NULL && responselen != 0) {
-            ALOGE("invalid response: NULL");
-            return RIL_ERRNO_INVALID_RESPONSE;
-        }
-
-        if (responselen % sizeof(RIL_Data_Call_Response_v6) != 0) {
-            ALOGE("invalid response length %d expected multiple of %d",
-                    (int)responselen, (int)sizeof(RIL_Data_Call_Response_v6));
-            return RIL_ERRNO_INVALID_RESPONSE;
-        }
-
-        int num = responselen / sizeof(RIL_Data_Call_Response_v6);
-        p.writeInt32(num);
-
-        RIL_Data_Call_Response_v6 *p_cur = (RIL_Data_Call_Response_v6 *) response;
-        startResponse;
-        int i;
-        for (i = 0; i < num; i++) {
-            p.writeInt32((int)p_cur[i].status);
-#ifndef HCRADIO
-            p.writeInt32(p_cur[i].suggestedRetryTime);
-#endif
-            p.writeInt32(p_cur[i].cid);
-            p.writeInt32(p_cur[i].active);
-            writeStringToParcel(p, p_cur[i].type);
-            writeStringToParcel(p, p_cur[i].ifname);
-            writeStringToParcel(p, p_cur[i].addresses);
-            writeStringToParcel(p, p_cur[i].dnses);
-            writeStringToParcel(p, p_cur[i].gateways);
-            appendPrintBuf("%s[status=%d,retry=%d,cid=%d,%s,%d,%s,%s,%s],", printBuf,
-                p_cur[i].status,
-                p_cur[i].suggestedRetryTime,
-                p_cur[i].cid,
-                (p_cur[i].active==0)?"down":"up",
-                (char*)p_cur[i].ifname,
-                (char*)p_cur[i].addresses,
-                (char*)p_cur[i].dnses,
-                (char*)p_cur[i].gateways);
-        }
-        removeLastChar;
-        closeResponse;
-    }
-
-    return 0;
-}
-
-static int responseSetupDataCall(Parcel &p, void *response, size_t responselen)
-{
-    if (s_callbacks.version < 5) {
-        return responseStringsWithVersion(s_callbacks.version, p, response, responselen);
-    } else {
-        return responseDataCallList(p, response, responselen);
-    }
-}
-
-static int responseRaw(Parcel &p, void *response, size_t responselen) {
-    if (response == NULL && responselen != 0) {
-        ALOGE("invalid response: NULL with responselen != 0");
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    // The java code reads -1 size as null byte array
-    if (response == NULL) {
-        p.writeInt32(-1);
-    } else {
-        p.writeInt32(responselen);
-        p.write(response, responselen);
-    }
-
-    return 0;
-}
-
-
-static int responseSIM_IO(Parcel &p, void *response, size_t responselen) {
-    if (response == NULL) {
-        ALOGE("invalid response: NULL");
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    if (responselen != sizeof (RIL_SIM_IO_Response) ) {
-        ALOGE("invalid response length was %d expected %d",
-                (int)responselen, (int)sizeof (RIL_SIM_IO_Response));
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    RIL_SIM_IO_Response *p_cur = (RIL_SIM_IO_Response *) response;
-    p.writeInt32(p_cur->sw1);
-    p.writeInt32(p_cur->sw2);
-    writeStringToParcel(p, p_cur->simResponse);
-
-    startResponse;
-    appendPrintBuf("%ssw1=0x%X,sw2=0x%X,%s", printBuf, p_cur->sw1, p_cur->sw2,
-        (char*)p_cur->simResponse);
-    closeResponse;
-
-
-    return 0;
-}
-
-static int responseCallForwards(Parcel &p, void *response, size_t responselen) {
-    int num;
-
-    if (response == NULL && responselen != 0) {
-        ALOGE("invalid response: NULL");
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    if (responselen % sizeof(RIL_CallForwardInfo *) != 0) {
-        ALOGE("invalid response length %d expected multiple of %d",
-                (int)responselen, (int)sizeof(RIL_CallForwardInfo *));
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    /* number of call info's */
-    num = responselen / sizeof(RIL_CallForwardInfo *);
-    p.writeInt32(num);
-
-    startResponse;
-    for (int i = 0 ; i < num ; i++) {
-        RIL_CallForwardInfo *p_cur = ((RIL_CallForwardInfo **) response)[i];
-
-        p.writeInt32(p_cur->status);
-        p.writeInt32(p_cur->reason);
-        p.writeInt32(p_cur->serviceClass);
-        p.writeInt32(p_cur->toa);
-        writeStringToParcel(p, p_cur->number);
-        p.writeInt32(p_cur->timeSeconds);
-        appendPrintBuf("%s[%s,reason=%d,cls=%d,toa=%d,%s,tout=%d],", printBuf,
-            (p_cur->status==1)?"enable":"disable",
-            p_cur->reason, p_cur->serviceClass, p_cur->toa,
-            (char*)p_cur->number,
-            p_cur->timeSeconds);
-    }
-    removeLastChar;
-    closeResponse;
-
-    return 0;
-}
-
-static int responseSsn(Parcel &p, void *response, size_t responselen) {
-    if (response == NULL) {
-        ALOGE("invalid response: NULL");
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    if (responselen != sizeof(RIL_SuppSvcNotification)) {
-        ALOGE("invalid response length was %d expected %d",
-                (int)responselen, (int)sizeof (RIL_SuppSvcNotification));
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    RIL_SuppSvcNotification *p_cur = (RIL_SuppSvcNotification *) response;
-    p.writeInt32(p_cur->notificationType);
-    p.writeInt32(p_cur->code);
-    p.writeInt32(p_cur->index);
-    p.writeInt32(p_cur->type);
-    writeStringToParcel(p, p_cur->number);
-
-    startResponse;
-    appendPrintBuf("%s%s,code=%d,id=%d,type=%d,%s", printBuf,
-        (p_cur->notificationType==0)?"mo":"mt",
-         p_cur->code, p_cur->index, p_cur->type,
-        (char*)p_cur->number);
-    closeResponse;
-
-    return 0;
-}
-
-static int responseCellList(Parcel &p, void *response, size_t responselen) {
-    int num;
-
-    if (response == NULL && responselen != 0) {
-        ALOGE("invalid response: NULL");
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    if (responselen % sizeof (RIL_NeighboringCell *) != 0) {
-        ALOGE("invalid response length %d expected multiple of %d\n",
-            (int)responselen, (int)sizeof (RIL_NeighboringCell *));
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    startResponse;
-    /* number of records */
-    num = responselen / sizeof(RIL_NeighboringCell *);
-    p.writeInt32(num);
-
-    for (int i = 0 ; i < num ; i++) {
-        RIL_NeighboringCell *p_cur = ((RIL_NeighboringCell **) response)[i];
-
-        p.writeInt32(p_cur->rssi);
-        writeStringToParcel (p, p_cur->cid);
-
-        appendPrintBuf("%s[cid=%s,rssi=%d],", printBuf,
-            p_cur->cid, p_cur->rssi);
-    }
-    removeLastChar;
-    closeResponse;
-
-    return 0;
-}
-
-/**
- * Marshall the signalInfoRecord into the parcel if it exists.
- */
-static void marshallSignalInfoRecord(Parcel &p,
-            RIL_CDMA_SignalInfoRecord &p_signalInfoRecord) {
-    p.writeInt32(p_signalInfoRecord.isPresent);
-    p.writeInt32(p_signalInfoRecord.signalType);
-    p.writeInt32(p_signalInfoRecord.alertPitch);
-    p.writeInt32(p_signalInfoRecord.signal);
-}
-
-static int responseCdmaERIInfo(Parcel &p,
-            void *response, size_t responselen) {
-    /*
-     * Method from RIL.java
-     * private Object responseCdmaERIInfo(Parcel p)  {
-     * CdmaERIInfo mCdmaERIInfo = new CdmaERIInfo();
-     *
-     * mCdmaERIInfo.carrier_id = p.readInt();
-     * mCdmaERIInfo.eri_id = p.readInt();
-     * mCdmaERIInfo.icon_img_id = p.readInt();
-     * mCdmaERIInfo.param1 = p.readInt();
-     * mCdmaERIInfo.param2 = p.readInt();
-     * mCdmaERIInfo.param3 = p.readInt();
-     * mCdmaERIInfo.param4 = p.readInt();
-     * mCdmaERIInfo.text = p.readString();
-     * mCdmaERIInfo.data_support = p.readInt();
-     *
-     * if (p.dataAvail() > 0)
-     *      localCdmaERIInfo.roaming_type = p.readInt();
-     *
-     * return localCdmaERIInfo;
-     * }
-     */
-     return 0;
-}
-
-static int responseCdmaInformationRecords(Parcel &p,
-            void *response, size_t responselen) {
-    int num;
-    char* string8 = NULL;
-    int buffer_lenght;
-    RIL_CDMA_InformationRecord *infoRec;
-
-    if (response == NULL && responselen != 0) {
-        ALOGE("invalid response: NULL");
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    if (responselen != sizeof (RIL_CDMA_InformationRecords)) {
-        ALOGE("invalid response length %d expected multiple of %d\n",
-            (int)responselen, (int)sizeof (RIL_CDMA_InformationRecords *));
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    RIL_CDMA_InformationRecords *p_cur =
-                             (RIL_CDMA_InformationRecords *) response;
-    num = MIN(p_cur->numberOfInfoRecs, RIL_CDMA_MAX_NUMBER_OF_INFO_RECS);
-
-    startResponse;
-    p.writeInt32(num);
-
-    for (int i = 0 ; i < num ; i++) {
-        infoRec = &p_cur->infoRec[i];
-        p.writeInt32(infoRec->name);
-        switch (infoRec->name) {
-            case RIL_CDMA_DISPLAY_INFO_REC:
-            case RIL_CDMA_EXTENDED_DISPLAY_INFO_REC:
-                if (infoRec->rec.display.alpha_len >
-                                         CDMA_ALPHA_INFO_BUFFER_LENGTH) {
-                    ALOGE("invalid display info response length %d \
-                          expected not more than %d\n",
-                         (int)infoRec->rec.display.alpha_len,
-                         CDMA_ALPHA_INFO_BUFFER_LENGTH);
-                    return RIL_ERRNO_INVALID_RESPONSE;
-                }
-                string8 = (char*) malloc((infoRec->rec.display.alpha_len + 1)
-                                                             * sizeof(char) );
-                for (int i = 0 ; i < infoRec->rec.display.alpha_len ; i++) {
-                    string8[i] = infoRec->rec.display.alpha_buf[i];
-                }
-                string8[(int)infoRec->rec.display.alpha_len] = '\0';
-                writeStringToParcel(p, (const char*)string8);
-                free(string8);
-                string8 = NULL;
-                break;
-            case RIL_CDMA_CALLED_PARTY_NUMBER_INFO_REC:
-            case RIL_CDMA_CALLING_PARTY_NUMBER_INFO_REC:
-            case RIL_CDMA_CONNECTED_NUMBER_INFO_REC:
-                if (infoRec->rec.number.len > CDMA_NUMBER_INFO_BUFFER_LENGTH) {
-                    ALOGE("invalid display info response length %d \
-                          expected not more than %d\n",
-                         (int)infoRec->rec.number.len,
-                         CDMA_NUMBER_INFO_BUFFER_LENGTH);
-                    return RIL_ERRNO_INVALID_RESPONSE;
-                }
-                string8 = (char*) malloc((infoRec->rec.number.len + 1)
-                                                             * sizeof(char) );
-                for (int i = 0 ; i < infoRec->rec.number.len; i++) {
-                    string8[i] = infoRec->rec.number.buf[i];
-                }
-                string8[(int)infoRec->rec.number.len] = '\0';
-                writeStringToParcel(p, (const char*)string8);
-                free(string8);
-                string8 = NULL;
-                p.writeInt32(infoRec->rec.number.number_type);
-                p.writeInt32(infoRec->rec.number.number_plan);
-                p.writeInt32(infoRec->rec.number.pi);
-                p.writeInt32(infoRec->rec.number.si);
-                break;
-            case RIL_CDMA_SIGNAL_INFO_REC:
-                p.writeInt32(infoRec->rec.signal.isPresent);
-                p.writeInt32(infoRec->rec.signal.signalType);
-                p.writeInt32(infoRec->rec.signal.alertPitch);
-                p.writeInt32(infoRec->rec.signal.signal);
-
-                appendPrintBuf("%sisPresent=%X, signalType=%X, \
-                                alertPitch=%X, signal=%X, ",
-                   printBuf, (int)infoRec->rec.signal.isPresent,
-                   (int)infoRec->rec.signal.signalType,
-                   (int)infoRec->rec.signal.alertPitch,
-                   (int)infoRec->rec.signal.signal);
-                removeLastChar;
-                break;
-            case RIL_CDMA_REDIRECTING_NUMBER_INFO_REC:
-                if (infoRec->rec.redir.redirectingNumber.len >
-                                              CDMA_NUMBER_INFO_BUFFER_LENGTH) {
-                    ALOGE("invalid display info response length %d \
-                          expected not more than %d\n",
-                         (int)infoRec->rec.redir.redirectingNumber.len,
-                         CDMA_NUMBER_INFO_BUFFER_LENGTH);
-                    return RIL_ERRNO_INVALID_RESPONSE;
-                }
-                string8 = (char*) malloc((infoRec->rec.redir.redirectingNumber
-                                          .len + 1) * sizeof(char) );
-                for (int i = 0;
-                         i < infoRec->rec.redir.redirectingNumber.len;
-                         i++) {
-                    string8[i] = infoRec->rec.redir.redirectingNumber.buf[i];
-                }
-                string8[(int)infoRec->rec.redir.redirectingNumber.len] = '\0';
-                writeStringToParcel(p, (const char*)string8);
-                free(string8);
-                string8 = NULL;
-                p.writeInt32(infoRec->rec.redir.redirectingNumber.number_type);
-                p.writeInt32(infoRec->rec.redir.redirectingNumber.number_plan);
-                p.writeInt32(infoRec->rec.redir.redirectingNumber.pi);
-                p.writeInt32(infoRec->rec.redir.redirectingNumber.si);
-                p.writeInt32(infoRec->rec.redir.redirectingReason);
-                break;
-            case RIL_CDMA_LINE_CONTROL_INFO_REC:
-                p.writeInt32(infoRec->rec.lineCtrl.lineCtrlPolarityIncluded);
-                p.writeInt32(infoRec->rec.lineCtrl.lineCtrlToggle);
-                p.writeInt32(infoRec->rec.lineCtrl.lineCtrlReverse);
-                p.writeInt32(infoRec->rec.lineCtrl.lineCtrlPowerDenial);
-
-                appendPrintBuf("%slineCtrlPolarityIncluded=%d, \
-                                lineCtrlToggle=%d, lineCtrlReverse=%d, \
-                                lineCtrlPowerDenial=%d, ", printBuf,
-                       (int)infoRec->rec.lineCtrl.lineCtrlPolarityIncluded,
-                       (int)infoRec->rec.lineCtrl.lineCtrlToggle,
-                       (int)infoRec->rec.lineCtrl.lineCtrlReverse,
-                       (int)infoRec->rec.lineCtrl.lineCtrlPowerDenial);
-                removeLastChar;
-                break;
-            case RIL_CDMA_T53_CLIR_INFO_REC:
-                p.writeInt32((int)(infoRec->rec.clir.cause));
-
-                appendPrintBuf("%scause%d", printBuf, infoRec->rec.clir.cause);
-                removeLastChar;
-                break;
-            case RIL_CDMA_T53_AUDIO_CONTROL_INFO_REC:
-                p.writeInt32(infoRec->rec.audioCtrl.upLink);
-                p.writeInt32(infoRec->rec.audioCtrl.downLink);
-
-                appendPrintBuf("%supLink=%d, downLink=%d, ", printBuf,
-                        infoRec->rec.audioCtrl.upLink,
-                        infoRec->rec.audioCtrl.downLink);
-                removeLastChar;
-                break;
-            case RIL_CDMA_T53_RELEASE_INFO_REC:
-                // TODO(Moto): See David Krause, he has the answer:)
-                ALOGE("RIL_CDMA_T53_RELEASE_INFO_REC: return INVALID_RESPONSE");
-                return RIL_ERRNO_INVALID_RESPONSE;
-            default:
-                ALOGE("Incorrect name value");
-                return RIL_ERRNO_INVALID_RESPONSE;
-        }
-    }
-    closeResponse;
-
-    return 0;
-}
-
-static int responseRilSignalStrength(Parcel &p,
-                    void *response, size_t responselen) {
-    if (response == NULL && responselen != 0) {
-        ALOGE("invalid response: NULL");
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    if (responselen >= sizeof (RIL_SignalStrength_HTC)) {
-        RIL_SignalStrength_HTC *p_cur = ((RIL_SignalStrength_HTC *) response);
-
-        p.writeInt32(p_cur->GW_SignalStrength.signalStrength);
-        p.writeInt32(p_cur->GW_SignalStrength.bitErrorRate);
-        p.writeInt32(p_cur->CDMA_SignalStrength.dbm);
-        p.writeInt32(p_cur->CDMA_SignalStrength.ecio);
-        p.writeInt32(p_cur->EVDO_SignalStrength.dbm);
-        p.writeInt32(p_cur->EVDO_SignalStrength.ecio);
-        p.writeInt32(p_cur->EVDO_SignalStrength.signalNoiseRatio);
-        p.writeInt32(p_cur->ATT_SignalStrength.dbm);
-        p.writeInt32(p_cur->ATT_SignalStrength.ecno);
-        p.writeInt32(p_cur->LTE_SignalStrength.signalStrength);
-        p.writeInt32(p_cur->LTE_SignalStrength.rsrp);
-        p.writeInt32(p_cur->LTE_SignalStrength.rsrq);
-        p.writeInt32(p_cur->LTE_SignalStrength.rssnr);
-        p.writeInt32(p_cur->LTE_SignalStrength.cqi);
-
-        startResponse;
-        appendPrintBuf("%s[signalStrength=%d,bitErrorRate=%d,\
-                CDMA_SS.dbm=%d,CDMA_SSecio=%d,\
-                EVDO_SS.dbm=%d,EVDO_SS.ecio=%d,\
-                EVDO_SS.signalNoiseRatio=%d,\
-                ATT_SS.dbm=%d,ATT_SS.ecno=%d,\
-                LTE_SS.signalStrength=%d,LTE_SS.rsrp=%d,LTE_SS.rsrq=%d,\
-                LTE_SS.rssnr=%d,LTE_SS.cqi=%d]",
-                printBuf,
-                p_cur->GW_SignalStrength.signalStrength,
-                p_cur->GW_SignalStrength.bitErrorRate,
-                p_cur->CDMA_SignalStrength.dbm,
-                p_cur->CDMA_SignalStrength.ecio,
-                p_cur->EVDO_SignalStrength.dbm,
-                p_cur->EVDO_SignalStrength.ecio,
-                p_cur->EVDO_SignalStrength.signalNoiseRatio,
-                p_cur->ATT_SignalStrength.dbm,
-                p_cur->ATT_SignalStrength.ecno,
-                p_cur->LTE_SignalStrength.signalStrength,
-                p_cur->LTE_SignalStrength.rsrp,
-                p_cur->LTE_SignalStrength.rsrq,
-                p_cur->LTE_SignalStrength.rssnr,
-                p_cur->LTE_SignalStrength.cqi);
-        closeResponse;
-
-    } else {
-        ALOGE("invalid response length");
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    return 0;
-}
-
-static int responseCallRing(Parcel &p, void *response, size_t responselen) {
-    if ((response == NULL) || (responselen == 0)) {
-        return responseVoid(p, response, responselen);
-    } else {
-        return responseCdmaSignalInfoRecord(p, response, responselen);
-    }
-}
-
-static int responseCdmaSignalInfoRecord(Parcel &p, void *response, size_t responselen) {
-    if (response == NULL || responselen == 0) {
-        ALOGE("invalid response: NULL");
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    if (responselen != sizeof (RIL_CDMA_SignalInfoRecord)) {
-        ALOGE("invalid response length %d expected sizeof (RIL_CDMA_SignalInfoRecord) of %d\n",
-            (int)responselen, (int)sizeof (RIL_CDMA_SignalInfoRecord));
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    startResponse;
-
-    RIL_CDMA_SignalInfoRecord *p_cur = ((RIL_CDMA_SignalInfoRecord *) response);
-    marshallSignalInfoRecord(p, *p_cur);
-
-    appendPrintBuf("%s[isPresent=%d,signalType=%d,alertPitch=%d\
-              signal=%d]",
-              printBuf,
-              p_cur->isPresent,
-              p_cur->signalType,
-              p_cur->alertPitch,
-              p_cur->signal);
-
-    closeResponse;
-    return 0;
-}
-
-static int responseCdmaCallWaiting(Parcel &p, void *response,
-            size_t responselen) {
-    if (response == NULL && responselen != 0) {
-        ALOGE("invalid response: NULL");
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    if (responselen < sizeof(RIL_CDMA_CallWaiting_v6)) {
-        ALOGW("Upgrade to ril version %d\n", RIL_VERSION);
-    }
-
-    RIL_CDMA_CallWaiting_v6 *p_cur = ((RIL_CDMA_CallWaiting_v6 *) response);
-
-    writeStringToParcel(p, p_cur->number);
-    p.writeInt32(p_cur->numberPresentation);
-    writeStringToParcel(p, p_cur->name);
-    marshallSignalInfoRecord(p, p_cur->signalInfoRecord);
-
-    if (responselen >= sizeof(RIL_CDMA_CallWaiting_v6)) {
-        p.writeInt32(p_cur->number_type);
-        p.writeInt32(p_cur->number_plan);
-    } else {
-        p.writeInt32(0);
-        p.writeInt32(0);
-    }
-
-    startResponse;
-    appendPrintBuf("%snumber=%s,numberPresentation=%d, name=%s,\
-            signalInfoRecord[isPresent=%d,signalType=%d,alertPitch=%d\
-            signal=%d,number_type=%d,number_plan=%d]",
-            printBuf,
-            p_cur->number,
-            p_cur->numberPresentation,
-            p_cur->name,
-            p_cur->signalInfoRecord.isPresent,
-            p_cur->signalInfoRecord.signalType,
-            p_cur->signalInfoRecord.alertPitch,
-            p_cur->signalInfoRecord.signal,
-            p_cur->number_type,
-            p_cur->number_plan);
-    closeResponse;
-
-    return 0;
-}
-
-static int responseSimRefresh(Parcel &p, void *response, size_t responselen) {
-    if (response == NULL && responselen != 0) {
-        ALOGE("responseSimRefresh: invalid response: NULL");
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    startResponse;
-    if (s_callbacks.version == 7) {
-        RIL_SimRefreshResponse_v7 *p_cur = ((RIL_SimRefreshResponse_v7 *) response);
-        p.writeInt32(p_cur->result);
-        p.writeInt32(p_cur->ef_id);
-        writeStringToParcel(p, p_cur->aid);
-
-        appendPrintBuf("%sresult=%d, ef_id=%d, aid=%s",
-                printBuf,
-                p_cur->result,
-                p_cur->ef_id,
-                p_cur->aid);
-    } else {
-        int *p_cur = ((int *) response);
-        p.writeInt32(p_cur[0]);
-        p.writeInt32(p_cur[1]);
-        writeStringToParcel(p, NULL);
-
-        appendPrintBuf("%sresult=%d, ef_id=%d",
-                printBuf,
-                p_cur[0],
-                p_cur[1]);
-    }
-    closeResponse;
-
-    return 0;
-}
-
-static void triggerEvLoop() {
-    int ret;
-    if (!pthread_equal(pthread_self(), s_tid_dispatch)) {
-        /* trigger event loop to wakeup. No reason to do this,
-         * if we're in the event loop thread */
-         do {
-            ret = write (s_fdWakeupWrite, " ", 1);
-         } while (ret < 0 && errno == EINTR);
-    }
-}
-
-static void rilEventAddWakeup(struct ril_event *ev) {
-    ril_event_add(ev);
-    triggerEvLoop();
-}
-
-static void sendSimStatusAppInfo(Parcel &p, int num_apps, RIL_AppStatus appStatus[]) {
-        p.writeInt32(num_apps);
-        startResponse;
-        for (int i = 0; i < num_apps; i++) {
-            p.writeInt32(appStatus[i].app_type);
-            p.writeInt32(appStatus[i].app_state);
-            p.writeInt32(appStatus[i].perso_substate);
-            writeStringToParcel(p, (const char*)(appStatus[i].aid_ptr));
-            writeStringToParcel(p, (const char*)
-                                          (appStatus[i].app_label_ptr));
-            p.writeInt32(appStatus[i].pin1_replaced);
-            p.writeInt32(appStatus[i].pin1);
-            p.writeInt32(appStatus[i].pin2);
-            appendPrintBuf("%s[app_type=%d,app_state=%d,perso_substate=%d,\
-                    aid_ptr=%s,app_label_ptr=%s,pin1_replaced=%d,pin1=%d,pin2=%d],",
-                    printBuf,
-                    appStatus[i].app_type,
-                    appStatus[i].app_state,
-                    appStatus[i].perso_substate,
-                    appStatus[i].aid_ptr,
-                    appStatus[i].app_label_ptr,
-                    appStatus[i].pin1_replaced,
-                    appStatus[i].pin1,
-                    appStatus[i].pin2);
-        }
-        closeResponse;
-}
-
-static int responseSimStatus(Parcel &p, void *response, size_t responselen) {
-    int i;
-
-    if (response == NULL && responselen != 0) {
-        ALOGE("invalid response: NULL");
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    if (responselen == sizeof (RIL_CardStatus_v6)) {
-        RIL_CardStatus_v6 *p_cur = ((RIL_CardStatus_v6 *) response);
-
-        p.writeInt32(p_cur->card_state);
-        p.writeInt32(p_cur->universal_pin_state);
-        p.writeInt32(p_cur->gsm_umts_subscription_app_index);
-        p.writeInt32(p_cur->cdma_subscription_app_index);
-        p.writeInt32(p_cur->ims_subscription_app_index);
-
-        sendSimStatusAppInfo(p, p_cur->num_applications, p_cur->applications);
-    } else if (responselen == sizeof (RIL_CardStatus_v5)) {
-        RIL_CardStatus_v5 *p_cur = ((RIL_CardStatus_v5 *) response);
-
-        p.writeInt32(p_cur->card_state);
-        p.writeInt32(p_cur->universal_pin_state);
-        p.writeInt32(p_cur->gsm_umts_subscription_app_index);
-        p.writeInt32(p_cur->cdma_subscription_app_index);
-        p.writeInt32(-1);
-
-        sendSimStatusAppInfo(p, p_cur->num_applications, p_cur->applications);
-    } else {
-        ALOGE("responseSimStatus: A RilCardStatus_v6 or _v5 expected\n");
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    return 0;
-}
-
-static int responseGsmBrSmsCnf(Parcel &p, void *response, size_t responselen) {
-    int num = responselen / sizeof(RIL_GSM_BroadcastSmsConfigInfo *);
-    p.writeInt32(num);
-
-    startResponse;
-    RIL_GSM_BroadcastSmsConfigInfo **p_cur =
-                (RIL_GSM_BroadcastSmsConfigInfo **) response;
-    for (int i = 0; i < num; i++) {
-        p.writeInt32(p_cur[i]->fromServiceId);
-        p.writeInt32(p_cur[i]->toServiceId);
-        p.writeInt32(p_cur[i]->fromCodeScheme);
-        p.writeInt32(p_cur[i]->toCodeScheme);
-        p.writeInt32(p_cur[i]->selected);
-
-        appendPrintBuf("%s [%d: fromServiceId=%d, toServiceId=%d, \
-                fromCodeScheme=%d, toCodeScheme=%d, selected =%d]",
-                printBuf, i, p_cur[i]->fromServiceId, p_cur[i]->toServiceId,
-                p_cur[i]->fromCodeScheme, p_cur[i]->toCodeScheme,
-                p_cur[i]->selected);
-    }
-    closeResponse;
-
-    return 0;
-}
-
-static int responseCdmaBrSmsCnf(Parcel &p, void *response, size_t responselen) {
-    RIL_CDMA_BroadcastSmsConfigInfo **p_cur =
-               (RIL_CDMA_BroadcastSmsConfigInfo **) response;
-
-    int num = responselen / sizeof (RIL_CDMA_BroadcastSmsConfigInfo *);
-    p.writeInt32(num);
-
-    startResponse;
-    for (int i = 0 ; i < num ; i++ ) {
-        p.writeInt32(p_cur[i]->service_category);
-        p.writeInt32(p_cur[i]->language);
-        p.writeInt32(p_cur[i]->selected);
-
-        appendPrintBuf("%s [%d: srvice_category=%d, language =%d, \
-              selected =%d], ",
-              printBuf, i, p_cur[i]->service_category, p_cur[i]->language,
-              p_cur[i]->selected);
-    }
-    closeResponse;
-
-    return 0;
-}
-
-static int responseCdmaSms(Parcel &p, void *response, size_t responselen) {
-    int num;
-    int digitCount;
-    int digitLimit;
-    uint8_t uct;
-    void* dest;
-
-    ALOGD("Inside responseCdmaSms");
-
-    if (response == NULL && responselen != 0) {
-        ALOGE("invalid response: NULL");
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    if (responselen != sizeof(RIL_CDMA_SMS_Message)) {
-        ALOGE("invalid response length was %d expected %d",
-                (int)responselen, (int)sizeof(RIL_CDMA_SMS_Message));
-        return RIL_ERRNO_INVALID_RESPONSE;
-    }
-
-    RIL_CDMA_SMS_Message *p_cur = (RIL_CDMA_SMS_Message *) response;
-    p.writeInt32(p_cur->uTeleserviceID);
-    p.write(&(p_cur->bIsServicePresent),sizeof(uct));
-    p.writeInt32(p_cur->uServicecategory);
-    p.writeInt32(p_cur->sAddress.digit_mode);
-    p.writeInt32(p_cur->sAddress.number_mode);
-    p.writeInt32(p_cur->sAddress.number_type);
-    p.writeInt32(p_cur->sAddress.number_plan);
-    p.write(&(p_cur->sAddress.number_of_digits), sizeof(uct));
-    digitLimit= MIN((p_cur->sAddress.number_of_digits), RIL_CDMA_SMS_ADDRESS_MAX);
-    for(digitCount =0 ; digitCount < digitLimit; digitCount ++) {
-        p.write(&(p_cur->sAddress.digits[digitCount]),sizeof(uct));
-    }
-
-    p.writeInt32(p_cur->sSubAddress.subaddressType);
-    p.write(&(p_cur->sSubAddress.odd),sizeof(uct));
-    p.write(&(p_cur->sSubAddress.number_of_digits),sizeof(uct));
-    digitLimit= MIN((p_cur->sSubAddress.number_of_digits), RIL_CDMA_SMS_SUBADDRESS_MAX);
-    for(digitCount =0 ; digitCount < digitLimit; digitCount ++) {
-        p.write(&(p_cur->sSubAddress.digits[digitCount]),sizeof(uct));
-    }
-
-    digitLimit= MIN((p_cur->uBearerDataLen), RIL_CDMA_SMS_BEARER_DATA_MAX);
-    p.writeInt32(p_cur->uBearerDataLen);
-    for(digitCount =0 ; digitCount < digitLimit; digitCount ++) {
-       p.write(&(p_cur->aBearerData[digitCount]), sizeof(uct));
-    }
-
-    startResponse;
-    appendPrintBuf("%suTeleserviceID=%d, bIsServicePresent=%d, uServicecategory=%d, \
-            sAddress.digit_mode=%d, sAddress.number_mode=%d, sAddress.number_type=%d, ",
-            printBuf, p_cur->uTeleserviceID,p_cur->bIsServicePresent,p_cur->uServicecategory,
-            p_cur->sAddress.digit_mode, p_cur->sAddress.number_mode,p_cur->sAddress.number_type);
-    closeResponse;
-
-    return 0;
-}
-
-/**
- * A write on the wakeup fd is done just to pop us out of select()
- * We empty the buffer here and then ril_event will reset the timers on the
- * way back down
- */
-static void processWakeupCallback(int fd, short flags, void *param) {
-    char buff[16];
-    int ret;
-
-    ALOGV("processWakeupCallback");
-
-    /* empty our wakeup socket out */
-    do {
-        ret = read(s_fdWakeupRead, &buff, sizeof(buff));
-    } while (ret > 0 || (ret < 0 && errno == EINTR));
-}
-
-static void onCommandsSocketClosed() {
-    int ret;
-    RequestInfo *p_cur;
-
-    /* mark pending requests as "cancelled" so we dont report responses */
-
-    ret = pthread_mutex_lock(&s_pendingRequestsMutex);
-    assert (ret == 0);
-
-    p_cur = s_pendingRequests;
-
-    for (p_cur = s_pendingRequests
-            ; p_cur != NULL
-            ; p_cur  = p_cur->p_next
-    ) {
-        p_cur->cancelled = 1;
-    }
-
-    ret = pthread_mutex_unlock(&s_pendingRequestsMutex);
-    assert (ret == 0);
-}
-
-static void processCommandsCallback(int fd, short flags, void *param) {
-    RecordStream *p_rs;
-    void *p_record;
-    size_t recordlen;
-    int ret;
-
-    assert(fd == s_fdCommand);
-
-    p_rs = (RecordStream *)param;
-
-    for (;;) {
-        /* loop until EAGAIN/EINTR, end of stream, or other error */
-        ret = record_stream_get_next(p_rs, &p_record, &recordlen);
-
-        if (ret == 0 && p_record == NULL) {
-            /* end-of-stream */
-            break;
-        } else if (ret < 0) {
-            break;
-        } else if (ret == 0) { /* && p_record != NULL */
-            processCommandBuffer(p_record, recordlen);
-        }
-    }
-
-    if (ret == 0 || !(errno == EAGAIN || errno == EINTR)) {
-        /* fatal error or end-of-stream */
-        if (ret != 0) {
-            ALOGE("error on reading command socket errno:%d\n", errno);
-        } else {
-            ALOGW("EOS.  Closing command socket.");
-        }
-
-        close(s_fdCommand);
-        s_fdCommand = -1;
-
-        ril_event_del(&s_commands_event);
-
-        record_stream_free(p_rs);
-
-        /* start listening for new connections again */
-        rilEventAddWakeup(&s_listen_event);
-
-        onCommandsSocketClosed();
-    }
-}
-
-
-static void onNewCommandConnect() {
-    // Inform we are connected and the ril version
-    int rilVer = s_callbacks.version;
-    RIL_onUnsolicitedResponse(RIL_UNSOL_RIL_CONNECTED,
-                                    &rilVer, sizeof(rilVer));
-
-    // implicit radio state changed
-    RIL_onUnsolicitedResponse(RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED,
-                                    NULL, 0);
-
-    // Send last NITZ time data, in case it was missed
-    if (s_lastNITZTimeData != NULL) {
-        sendResponseRaw(s_lastNITZTimeData, s_lastNITZTimeDataSize);
-
-        free(s_lastNITZTimeData);
-        s_lastNITZTimeData = NULL;
-    }
-
-    // Get version string
-    if (s_callbacks.getVersion != NULL) {
-        const char *version;
-        version = s_callbacks.getVersion();
-        ALOGI("RIL Daemon version: %s\n", version);
-
-        property_set(PROPERTY_RIL_IMPL, version);
-    } else {
-        ALOGI("RIL Daemon version: unavailable\n");
-        property_set(PROPERTY_RIL_IMPL, "unavailable");
-    }
-
-}
-
-static void listenCallback (int fd, short flags, void *param) {
-    int ret;
-    int err;
-    int is_phone_socket;
-    RecordStream *p_rs;
-
-    struct sockaddr_un peeraddr;
-    socklen_t socklen = sizeof (peeraddr);
-
-    struct ucred creds;
-    socklen_t szCreds = sizeof(creds);
-
-    struct passwd *pwd = NULL;
-
-    assert (s_fdCommand < 0);
-    assert (fd == s_fdListen);
-
-    s_fdCommand = accept(s_fdListen, (sockaddr *) &peeraddr, &socklen);
-
-    if (s_fdCommand < 0 ) {
-        ALOGE("Error on accept() errno:%d", errno);
-        /* start listening for new connections again */
-        rilEventAddWakeup(&s_listen_event);
-	      return;
-    }
-
-    /* check the credential of the other side and only accept socket from
-     * phone process
-     */
-    errno = 0;
-    is_phone_socket = 0;
-
-    err = getsockopt(s_fdCommand, SOL_SOCKET, SO_PEERCRED, &creds, &szCreds);
-
-    if (err == 0 && szCreds > 0) {
-        errno = 0;
-        pwd = getpwuid(creds.uid);
-        if (pwd != NULL) {
-            if (strcmp(pwd->pw_name, PHONE_PROCESS) == 0) {
-                is_phone_socket = 1;
-            } else {
-                ALOGE("RILD can't accept socket from process %s", pwd->pw_name);
-            }
-        } else {
-            ALOGE("Error on getpwuid() errno: %d", errno);
-        }
-    } else {
-        ALOGD("Error on getsockopt() errno: %d", errno);
-    }
-
-    if ( !is_phone_socket ) {
-      ALOGE("RILD must accept socket from %s", PHONE_PROCESS);
-
-      close(s_fdCommand);
-      s_fdCommand = -1;
-
-      onCommandsSocketClosed();
-
-      /* start listening for new connections again */
-      rilEventAddWakeup(&s_listen_event);
-
-      return;
-    }
-
-    ret = fcntl(s_fdCommand, F_SETFL, O_NONBLOCK);
-
-    if (ret < 0) {
-        ALOGE ("Error setting O_NONBLOCK errno:%d", errno);
-    }
-
-    ALOGI("libril: new connection");
-
-    p_rs = record_stream_new(s_fdCommand, MAX_COMMAND_BYTES);
-
-    ril_event_set (&s_commands_event, s_fdCommand, 1,
-        processCommandsCallback, p_rs);
-
-    rilEventAddWakeup (&s_commands_event);
-
-    onNewCommandConnect();
-}
-
-static void freeDebugCallbackArgs(int number, char **args) {
-    for (int i = 0; i < number; i++) {
-        if (args[i] != NULL) {
-            free(args[i]);
-        }
-    }
-    free(args);
-}
-
-static void debugCallback (int fd, short flags, void *param) {
-    int acceptFD, option;
-    struct sockaddr_un peeraddr;
-    socklen_t socklen = sizeof (peeraddr);
-    int data;
-    unsigned int qxdm_data[6];
-    const char *deactData[1] = {"1"};
-    char *actData[1];
-    RIL_Dial dialData;
-    int hangupData[1] = {1};
-    int number;
-    char **args;
-
-    acceptFD = accept (fd,  (sockaddr *) &peeraddr, &socklen);
-
-    if (acceptFD < 0) {
-        ALOGE ("error accepting on debug port: %d\n", errno);
-        return;
-    }
-
-    if (recv(acceptFD, &number, sizeof(int), 0) != sizeof(int)) {
-        ALOGE ("error reading on socket: number of Args: \n");
-        return;
-    }
-    args = (char **) malloc(sizeof(char*) * number);
-
-    for (int i = 0; i < number; i++) {
-        int len;
-        if (recv(acceptFD, &len, sizeof(int), 0) != sizeof(int)) {
-            ALOGE ("error reading on socket: Len of Args: \n");
-            freeDebugCallbackArgs(i, args);
-            return;
-        }
-        // +1 for null-term
-        args[i] = (char *) malloc((sizeof(char) * len) + 1);
-        if (recv(acceptFD, args[i], sizeof(char) * len, 0)
-            != (int)sizeof(char) * len) {
-            ALOGE ("error reading on socket: Args[%d] \n", i);
-            freeDebugCallbackArgs(i, args);
-            return;
-        }
-        char * buf = args[i];
-        buf[len] = 0;
-    }
-
-    switch (atoi(args[0])) {
-        case 0:
-            ALOGI ("Connection on debug port: issuing reset.");
-            issueLocalRequest(RIL_REQUEST_RESET_RADIO, NULL, 0);
-            break;
-        case 1:
-            ALOGI ("Connection on debug port: issuing radio power off.");
-            data = 0;
-            issueLocalRequest(RIL_REQUEST_RADIO_POWER, &data, sizeof(int));
-            // Close the socket
-            close(s_fdCommand);
-            s_fdCommand = -1;
-            break;
-        case 2:
-            ALOGI ("Debug port: issuing unsolicited voice network change.");
-            RIL_onUnsolicitedResponse(RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED,
-                                      NULL, 0);
-            break;
-        case 3:
-            ALOGI ("Debug port: QXDM log enable.");
-            qxdm_data[0] = 65536;     // head.func_tag
-            qxdm_data[1] = 16;        // head.len
-            qxdm_data[2] = 1;         // mode: 1 for 'start logging'
-            qxdm_data[3] = 32;        // log_file_size: 32megabytes
-            qxdm_data[4] = 0;         // log_mask
-            qxdm_data[5] = 8;         // log_max_fileindex
-            issueLocalRequest(RIL_REQUEST_OEM_HOOK_RAW, qxdm_data,
-                              6 * sizeof(int));
-            break;
-        case 4:
-            ALOGI ("Debug port: QXDM log disable.");
-            qxdm_data[0] = 65536;
-            qxdm_data[1] = 16;
-            qxdm_data[2] = 0;          // mode: 0 for 'stop logging'
-            qxdm_data[3] = 32;
-            qxdm_data[4] = 0;
-            qxdm_data[5] = 8;
-            issueLocalRequest(RIL_REQUEST_OEM_HOOK_RAW, qxdm_data,
-                              6 * sizeof(int));
-            break;
-        case 5:
-            ALOGI("Debug port: Radio On");
-            data = 1;
-            issueLocalRequest(RIL_REQUEST_RADIO_POWER, &data, sizeof(int));
-            sleep(2);
-            // Set network selection automatic.
-            issueLocalRequest(RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC, NULL, 0);
-            break;
-        case 6:
-            ALOGI("Debug port: Setup Data Call, Apn :%s\n", args[1]);
-            actData[0] = args[1];
-            issueLocalRequest(RIL_REQUEST_SETUP_DATA_CALL, &actData,
-                              sizeof(actData));
-            break;
-        case 7:
-            ALOGI("Debug port: Deactivate Data Call");
-            issueLocalRequest(RIL_REQUEST_DEACTIVATE_DATA_CALL, &deactData,
-                              sizeof(deactData));
-            break;
-        case 8:
-            ALOGI("Debug port: Dial Call");
-            dialData.clir = 0;
-            dialData.address = args[1];
-            issueLocalRequest(RIL_REQUEST_DIAL, &dialData, sizeof(dialData));
-            break;
-        case 9:
-            ALOGI("Debug port: Answer Call");
-            issueLocalRequest(RIL_REQUEST_ANSWER, NULL, 0);
-            break;
-        case 10:
-            ALOGI("Debug port: End Call");
-            issueLocalRequest(RIL_REQUEST_HANGUP, &hangupData,
-                              sizeof(hangupData));
-            break;
-        default:
-            ALOGE ("Invalid request");
-            break;
-    }
-    freeDebugCallbackArgs(number, args);
-    close(acceptFD);
-}
-
-
-static void userTimerCallback (int fd, short flags, void *param) {
-    UserCallbackInfo *p_info;
-
-    p_info = (UserCallbackInfo *)param;
-
-    p_info->p_callback(p_info->userParam);
-
-
-    // FIXME generalize this...there should be a cancel mechanism
-    if (s_last_wake_timeout_info != NULL && s_last_wake_timeout_info == p_info) {
-        s_last_wake_timeout_info = NULL;
-    }
-
-    free(p_info);
-}
-
-
-static void *
-eventLoop(void *param) {
-    int ret;
-    int filedes[2];
-
-    ril_event_init();
-
-    pthread_mutex_lock(&s_startupMutex);
-
-    s_started = 1;
-    pthread_cond_broadcast(&s_startupCond);
-
-    pthread_mutex_unlock(&s_startupMutex);
-
-    ret = pipe(filedes);
-
-    if (ret < 0) {
-        ALOGE("Error in pipe() errno:%d", errno);
-        return NULL;
-    }
-
-    s_fdWakeupRead = filedes[0];
-    s_fdWakeupWrite = filedes[1];
-
-    fcntl(s_fdWakeupRead, F_SETFL, O_NONBLOCK);
-
-    ril_event_set (&s_wakeupfd_event, s_fdWakeupRead, true,
-                processWakeupCallback, NULL);
-
-    rilEventAddWakeup (&s_wakeupfd_event);
-
-    // Only returns on error
-    ril_event_loop();
-    ALOGE ("error in event_loop_base errno:%d", errno);
-    // kill self to restart on error
-    kill(0, SIGKILL);
-
-    return NULL;
-}
-
-extern "C" void
-RIL_startEventLoop(void) {
-    int ret;
-    pthread_attr_t attr;
-
-    /* spin up eventLoop thread and wait for it to get started */
-    s_started = 0;
-    pthread_mutex_lock(&s_startupMutex);
-
-    pthread_attr_init (&attr);
-    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-    ret = pthread_create(&s_tid_dispatch, &attr, eventLoop, NULL);
-
-    while (s_started == 0) {
-        pthread_cond_wait(&s_startupCond, &s_startupMutex);
-    }
-
-    pthread_mutex_unlock(&s_startupMutex);
-
-    if (ret < 0) {
-        ALOGE("Failed to create dispatch thread errno:%d", errno);
-        return;
-    }
-}
-
-// Used for testing purpose only.
-extern "C" void RIL_setcallbacks (const RIL_RadioFunctions *callbacks) {
-    memcpy(&s_callbacks, callbacks, sizeof (RIL_RadioFunctions));
-}
-
-extern "C" void
-RIL_register (const RIL_RadioFunctions *callbacks) {
-    int ret;
-    int flags;
-
-    if (callbacks == NULL) {
-        ALOGE("RIL_register: RIL_RadioFunctions * null");
-        return;
-    }
-    if (callbacks->version < RIL_VERSION_MIN) {
-        ALOGE("RIL_register: version %d is to old, min version is %d",
-             callbacks->version, RIL_VERSION_MIN);
-        return;
-    }
-    if (callbacks->version > RIL_VERSION) {
-        ALOGE("RIL_register: version %d is too new, max version is %d",
-             callbacks->version, RIL_VERSION);
-        return;
-    }
-    ALOGE("RIL_register: RIL version %d", callbacks->version);
-
-    if (s_registerCalled > 0) {
-        ALOGE("RIL_register has been called more than once. "
-                "Subsequent call ignored");
-        return;
-    }
-
-    memcpy(&s_callbacks, callbacks, sizeof (RIL_RadioFunctions));
-
-    s_registerCalled = 1;
-
-    // Little self-check
-
-    for (int i = 0; i < (int)NUM_ELEMS(s_commands); i++) {
-        assert(i == s_commands[i].requestNumber);
-    }
-
-    for (int i = 0; i < (int)NUM_ELEMS(s_unsolResponses); i++) {
-        assert(i + RIL_UNSOL_RESPONSE_BASE
-                == s_unsolResponses[i].requestNumber);
-    }
-
-    // New rild impl calls RIL_startEventLoop() first
-    // old standalone impl wants it here.
-
-    if (s_started == 0) {
-        RIL_startEventLoop();
-    }
-
-    // start listen socket
-
-#if 0
-    ret = socket_local_server (SOCKET_NAME_RIL,
-            ANDROID_SOCKET_NAMESPACE_ABSTRACT, SOCK_STREAM);
-
-    if (ret < 0) {
-        ALOGE("Unable to bind socket errno:%d", errno);
-        exit (-1);
-    }
-    s_fdListen = ret;
-
-#else
-    s_fdListen = android_get_control_socket(SOCKET_NAME_RIL);
-    if (s_fdListen < 0) {
-        ALOGE("Failed to get socket '" SOCKET_NAME_RIL "'");
-        exit(-1);
-    }
-
-    ret = listen(s_fdListen, 4);
-
-    if (ret < 0) {
-        ALOGE("Failed to listen on control socket '%d': %s",
-             s_fdListen, strerror(errno));
-        exit(-1);
-    }
-#endif
-
-
-    /* note: non-persistent so we can accept only one connection at a time */
-    ril_event_set (&s_listen_event, s_fdListen, false,
-                listenCallback, NULL);
-
-    rilEventAddWakeup (&s_listen_event);
-
-#if 1
-    // start debug interface socket
-
-    s_fdDebug = android_get_control_socket(SOCKET_NAME_RIL_DEBUG);
-    if (s_fdDebug < 0) {
-        ALOGE("Failed to get socket '" SOCKET_NAME_RIL_DEBUG "' errno:%d", errno);
-        exit(-1);
-    }
-
-    ret = listen(s_fdDebug, 4);
-
-    if (ret < 0) {
-        ALOGE("Failed to listen on ril debug socket '%d': %s",
-             s_fdDebug, strerror(errno));
-        exit(-1);
-    }
-
-    ril_event_set (&s_debug_event, s_fdDebug, true,
-                debugCallback, NULL);
-
-    rilEventAddWakeup (&s_debug_event);
-#endif
-
-}
-
-static int
-checkAndDequeueRequestInfo(struct RequestInfo *pRI) {
-    int ret = 0;
-
-    if (pRI == NULL) {
-        return 0;
-    }
-
-    pthread_mutex_lock(&s_pendingRequestsMutex);
-
-    for(RequestInfo **ppCur = &s_pendingRequests
-        ; *ppCur != NULL
-        ; ppCur = &((*ppCur)->p_next)
-    ) {
-        if (pRI == *ppCur) {
-            ret = 1;
-
-            *ppCur = (*ppCur)->p_next;
-            break;
-        }
-    }
-
-    pthread_mutex_unlock(&s_pendingRequestsMutex);
-
-    return ret;
-}
-
-
-extern "C" void
-RIL_onRequestComplete(RIL_Token t, RIL_Errno e, void *response, size_t responselen) {
-    RequestInfo *pRI;
-    int ret;
-    size_t errorOffset;
-
-    pRI = (RequestInfo *)t;
-
-    if (!checkAndDequeueRequestInfo(pRI)) {
-        ALOGE ("RIL_onRequestComplete: invalid RIL_Token");
-        return;
-    }
-
-    if (pRI->local > 0) {
-        // Locally issued command...void only!
-        // response does not go back up the command socket
-        ALOGD("C[locl]< %s", requestToString(pRI->pCI->requestNumber));
-
-        goto done;
-    }
-
-    appendPrintBuf("[%04d]< %s",
-        pRI->token, requestToString(pRI->pCI->requestNumber));
-
-    if (pRI->cancelled == 0) {
-        Parcel p;
-
-        p.writeInt32 (RESPONSE_SOLICITED);
-        p.writeInt32 (pRI->token);
-        errorOffset = p.dataPosition();
-
-        p.writeInt32 (e);
-
-        if (response != NULL) {
-            // there is a response payload, no matter success or not.
-            ret = pRI->pCI->responseFunction(p, response, responselen);
-
-            /* if an error occurred, rewind and mark it */
-            if (ret != 0) {
-                p.setDataPosition(errorOffset);
-                p.writeInt32 (ret);
-            }
-        }
-
-        if (e != RIL_E_SUCCESS) {
-            appendPrintBuf("%s fails by %s", printBuf, failCauseToString(e));
-        }
-
-        if (s_fdCommand < 0) {
-            ALOGD ("RIL onRequestComplete: Command channel closed");
-        }
-        sendResponse(p);
-    }
-
-done:
-    free(pRI);
-}
-
-
-static void
-grabPartialWakeLock() {
-    acquire_wake_lock(PARTIAL_WAKE_LOCK, ANDROID_WAKE_LOCK_NAME);
-}
-
-static void
-releaseWakeLock() {
-    release_wake_lock(ANDROID_WAKE_LOCK_NAME);
-}
-
-/**
- * Timer callback to put us back to sleep before the default timeout
- */
-static void
-wakeTimeoutCallback (void *param) {
-    // We're using "param != NULL" as a cancellation mechanism
-    if (param == NULL) {
-        //ALOGD("wakeTimeout: releasing wake lock");
-
-        releaseWakeLock();
-    } else {
-        //ALOGD("wakeTimeout: releasing wake lock CANCELLED");
-    }
-}
-
-static int
-decodeVoiceRadioTechnology (RIL_RadioState radioState) {
-    switch (radioState) {
-        case RADIO_STATE_SIM_NOT_READY:
-        case RADIO_STATE_SIM_LOCKED_OR_ABSENT:
-        case RADIO_STATE_SIM_READY:
-            return RADIO_TECH_UMTS;
-
-        case RADIO_STATE_RUIM_NOT_READY:
-        case RADIO_STATE_RUIM_READY:
-        case RADIO_STATE_RUIM_LOCKED_OR_ABSENT:
-        case RADIO_STATE_NV_NOT_READY:
-        case RADIO_STATE_NV_READY:
-            return RADIO_TECH_1xRTT;
-
-        default:
-            ALOGD("decodeVoiceRadioTechnology: Invoked with incorrect RadioState");
-            return -1;
-    }
-}
-
-static int
-decodeCdmaSubscriptionSource (RIL_RadioState radioState) {
-    switch (radioState) {
-        case RADIO_STATE_SIM_NOT_READY:
-        case RADIO_STATE_SIM_LOCKED_OR_ABSENT:
-        case RADIO_STATE_SIM_READY:
-        case RADIO_STATE_RUIM_NOT_READY:
-        case RADIO_STATE_RUIM_READY:
-        case RADIO_STATE_RUIM_LOCKED_OR_ABSENT:
-            return CDMA_SUBSCRIPTION_SOURCE_RUIM_SIM;
-
-        case RADIO_STATE_NV_NOT_READY:
-        case RADIO_STATE_NV_READY:
-            return CDMA_SUBSCRIPTION_SOURCE_NV;
-
-        default:
-            ALOGD("decodeCdmaSubscriptionSource: Invoked with incorrect RadioState");
-            return -1;
-    }
-}
-
-static int
-decodeSimStatus (RIL_RadioState radioState) {
-   switch (radioState) {
-       case RADIO_STATE_SIM_NOT_READY:
-       case RADIO_STATE_RUIM_NOT_READY:
-       case RADIO_STATE_NV_NOT_READY:
-       case RADIO_STATE_NV_READY:
-           return -1;
-       case RADIO_STATE_SIM_LOCKED_OR_ABSENT:
-       case RADIO_STATE_SIM_READY:
-       case RADIO_STATE_RUIM_READY:
-       case RADIO_STATE_RUIM_LOCKED_OR_ABSENT:
-           return radioState;
-       default:
-           ALOGD("decodeSimStatus: Invoked with incorrect RadioState");
-           return -1;
-   }
-}
-
-static bool is3gpp2(int radioTech) {
-    switch (radioTech) {
-        case RADIO_TECH_IS95A:
-        case RADIO_TECH_IS95B:
-        case RADIO_TECH_1xRTT:
-        case RADIO_TECH_EVDO_0:
-        case RADIO_TECH_EVDO_A:
-        case RADIO_TECH_EVDO_B:
-        case RADIO_TECH_EHRPD:
-            return true;
-        default:
-            return false;
-    }
-}
-
-/* If RIL sends SIM states or RUIM states, store the voice radio
- * technology and subscription source information so that they can be
- * returned when telephony framework requests them
- */
-static RIL_RadioState
-processRadioState(RIL_RadioState newRadioState) {
-
-    if((newRadioState > RADIO_STATE_UNAVAILABLE) && (newRadioState < RADIO_STATE_ON)) {
-        int newVoiceRadioTech;
-        int newCdmaSubscriptionSource;
-        int newSimStatus;
-
-        /* This is old RIL. Decode Subscription source and Voice Radio Technology
-           from Radio State and send change notifications if there has been a change */
-        newVoiceRadioTech = decodeVoiceRadioTechnology(newRadioState);
-        if(newVoiceRadioTech != voiceRadioTech) {
-            voiceRadioTech = newVoiceRadioTech;
-            RIL_onUnsolicitedResponse (RIL_UNSOL_VOICE_RADIO_TECH_CHANGED,
-                        &voiceRadioTech, sizeof(voiceRadioTech));
-        }
-        if(is3gpp2(newVoiceRadioTech)) {
-            newCdmaSubscriptionSource = decodeCdmaSubscriptionSource(newRadioState);
-            if(newCdmaSubscriptionSource != cdmaSubscriptionSource) {
-                cdmaSubscriptionSource = newCdmaSubscriptionSource;
-                RIL_onUnsolicitedResponse (RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED,
-                        &cdmaSubscriptionSource, sizeof(cdmaSubscriptionSource));
-            }
-        }
-        newSimStatus = decodeSimStatus(newRadioState);
-        if(newSimStatus != simRuimStatus) {
-            simRuimStatus = newSimStatus;
-            RIL_onUnsolicitedResponse(RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED, NULL, 0);
-        }
-
-        /* Send RADIO_ON to telephony */
-        newRadioState = RADIO_STATE_ON;
-    }
-
-    return newRadioState;
-}
-
-extern "C"
-void RIL_onUnsolicitedResponse(int unsolResponse, void *data,
-                                size_t datalen)
-{
-    int unsolResponseIndex;
-    int ret;
-    int64_t timeReceived = 0;
-    bool shouldScheduleTimeout = false;
-    RIL_RadioState newState;
-
-    if (s_registerCalled == 0) {
-        // Ignore RIL_onUnsolicitedResponse before RIL_register
-        ALOGW("RIL_onUnsolicitedResponse called before RIL_register");
-        return;
-    }
-
-    unsolResponseIndex = unsolResponse - RIL_UNSOL_RESPONSE_BASE;
-
-    if ((unsolResponseIndex < 0)
-        || (unsolResponseIndex >= (int32_t)NUM_ELEMS(s_unsolResponses))) {
-        /*
-         * catching HTC custom responses and mapping them directly to the ril_unsol_commands array
-         * before giving up on an unsupported response
-         *
-         * don't forget to update indices when changing something!
-         */
-        switch (unsolResponse) {
-          case RIL_UNSOL_ENTER_LPM: unsolResponseIndex = 36; break;
-          case RIL_UNSOL_CDMA_3G_INDICATOR: unsolResponseIndex = 37; break;
-          case RIL_UNSOL_CDMA_ENHANCE_ROAMING_INDICATOR: unsolResponseIndex = 38; break;
-          case RIL_UNSOL_RESPONSE_PHONE_MODE_CHANGE: unsolResponseIndex = 39; break;
-          case RIL_UNSOL_RESPONSE_VOICE_RADIO_TECH_CHANGED: unsolResponseIndex = 40; break;
-          case RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED: unsolResponseIndex = 41; break;
-          case RIL_UNSOL_RESPONSE_DATA_NETWORK_STATE_CHANGED: unsolResponseIndex = 42; break;
-          default: ALOGE("unsupported unsolicited response code %d", unsolResponse); return;
-        }
-
-    }
-
-    // Grab a wake lock if needed for this reponse,
-    // as we exit we'll either release it immediately
-    // or set a timer to release it later.
-    switch (s_unsolResponses[unsolResponseIndex].wakeType) {
-        case WAKE_PARTIAL:
-            grabPartialWakeLock();
-            shouldScheduleTimeout = true;
-        break;
-
-        case DONT_WAKE:
-        default:
-            // No wake lock is grabed so don't set timeout
-            shouldScheduleTimeout = false;
-            break;
-    }
-
-    // Mark the time this was received, doing this
-    // after grabing the wakelock incase getting
-    // the elapsedRealTime might cause us to goto
-    // sleep.
-    if (unsolResponse == RIL_UNSOL_NITZ_TIME_RECEIVED) {
-        timeReceived = elapsedRealtime();
-    }
-
-    appendPrintBuf("[UNSL]< %s", requestToString(unsolResponse));
-
-    Parcel p;
-
-    p.writeInt32 (RESPONSE_UNSOLICITED);
-    p.writeInt32 (unsolResponse);
-
-    ret = s_unsolResponses[unsolResponseIndex]
-                .responseFunction(p, data, datalen);
-    if (ret != 0) {
-        // Problem with the response. Don't continue;
-        goto error_exit;
-    }
-
-    // some things get more payload
-    switch(unsolResponse) {
-        case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED:
-            newState = processRadioState(s_callbacks.onStateRequest());
-            p.writeInt32(newState);
-            appendPrintBuf("%s {%s}", printBuf,
-                radioStateToString(s_callbacks.onStateRequest()));
-        break;
-
-
-        case RIL_UNSOL_NITZ_TIME_RECEIVED:
-            // Store the time that this was received so the
-            // handler of this message can account for
-            // the time it takes to arrive and process. In
-            // particular the system has been known to sleep
-            // before this message can be processed.
-            p.writeInt64(timeReceived);
-        break;
-    }
-
-    ret = sendResponse(p);
-    if (ret != 0 && unsolResponse == RIL_UNSOL_NITZ_TIME_RECEIVED) {
-
-        // Unfortunately, NITZ time is not poll/update like everything
-        // else in the system. So, if the upstream client isn't connected,
-        // keep a copy of the last NITZ response (with receive time noted
-        // above) around so we can deliver it when it is connected
-
-        if (s_lastNITZTimeData != NULL) {
-            free (s_lastNITZTimeData);
-            s_lastNITZTimeData = NULL;
-        }
-
-        s_lastNITZTimeData = malloc(p.dataSize());
-        s_lastNITZTimeDataSize = p.dataSize();
-        memcpy(s_lastNITZTimeData, p.data(), p.dataSize());
-    }
-
-    // For now, we automatically go back to sleep after TIMEVAL_WAKE_TIMEOUT
-    // FIXME The java code should handshake here to release wake lock
-
-    if (shouldScheduleTimeout) {
-        // Cancel the previous request
-        if (s_last_wake_timeout_info != NULL) {
-            s_last_wake_timeout_info->userParam = (void *)1;
-        }
-
-        s_last_wake_timeout_info
-            = internalRequestTimedCallback(wakeTimeoutCallback, NULL,
-                                            &TIMEVAL_WAKE_TIMEOUT);
-    }
-
-    // Normal exit
-    return;
-
-error_exit:
-    if (shouldScheduleTimeout) {
-        releaseWakeLock();
-    }
-}
-
-/** FIXME generalize this if you track UserCAllbackInfo, clear it
-    when the callback occurs
-*/
-static UserCallbackInfo *
-internalRequestTimedCallback (RIL_TimedCallback callback, void *param,
-                                const struct timeval *relativeTime)
-{
-    struct timeval myRelativeTime;
-    UserCallbackInfo *p_info;
-
-    p_info = (UserCallbackInfo *) malloc (sizeof(UserCallbackInfo));
-
-    p_info->p_callback = callback;
-    p_info->userParam = param;
-
-    if (relativeTime == NULL) {
-        /* treat null parameter as a 0 relative time */
-        memset (&myRelativeTime, 0, sizeof(myRelativeTime));
-    } else {
-        /* FIXME I think event_add's tv param is really const anyway */
-        memcpy (&myRelativeTime, relativeTime, sizeof(myRelativeTime));
-    }
-
-    ril_event_set(&(p_info->event), -1, false, userTimerCallback, p_info);
-
-    ril_timer_add(&(p_info->event), &myRelativeTime);
-
-    triggerEvLoop();
-    return p_info;
-}
-
-
-extern "C" void
-RIL_requestTimedCallback (RIL_TimedCallback callback, void *param,
-                                const struct timeval *relativeTime) {
-    internalRequestTimedCallback (callback, param, relativeTime);
-}
-
-const char *
-failCauseToString(RIL_Errno e) {
-    switch(e) {
-        case RIL_E_SUCCESS: return "E_SUCCESS";
-        case RIL_E_RADIO_NOT_AVAILABLE: return "E_RAIDO_NOT_AVAILABLE";
-        case RIL_E_GENERIC_FAILURE: return "E_GENERIC_FAILURE";
-        case RIL_E_PASSWORD_INCORRECT: return "E_PASSWORD_INCORRECT";
-        case RIL_E_SIM_PIN2: return "E_SIM_PIN2";
-        case RIL_E_SIM_PUK2: return "E_SIM_PUK2";
-        case RIL_E_REQUEST_NOT_SUPPORTED: return "E_REQUEST_NOT_SUPPORTED";
-        case RIL_E_CANCELLED: return "E_CANCELLED";
-        case RIL_E_OP_NOT_ALLOWED_DURING_VOICE_CALL: return "E_OP_NOT_ALLOWED_DURING_VOICE_CALL";
-        case RIL_E_OP_NOT_ALLOWED_BEFORE_REG_TO_NW: return "E_OP_NOT_ALLOWED_BEFORE_REG_TO_NW";
-        case RIL_E_SMS_SEND_FAIL_RETRY: return "E_SMS_SEND_FAIL_RETRY";
-        case RIL_E_SIM_ABSENT:return "E_SIM_ABSENT";
-        case RIL_E_ILLEGAL_SIM_OR_ME:return "E_ILLEGAL_SIM_OR_ME";
-#ifdef FEATURE_MULTIMODE_ANDROID
-        case RIL_E_SUBSCRIPTION_NOT_AVAILABLE:return "E_SUBSCRIPTION_NOT_AVAILABLE";
-        case RIL_E_MODE_NOT_SUPPORTED:return "E_MODE_NOT_SUPPORTED";
-#endif
-        default: return "<unknown error>";
-    }
-}
-
-const char *
-radioStateToString(RIL_RadioState s) {
-    switch(s) {
-        case RADIO_STATE_OFF: return "RADIO_OFF";
-        case RADIO_STATE_UNAVAILABLE: return "RADIO_UNAVAILABLE";
-        case RADIO_STATE_SIM_NOT_READY: return "RADIO_SIM_NOT_READY";
-        case RADIO_STATE_SIM_LOCKED_OR_ABSENT: return "RADIO_SIM_LOCKED_OR_ABSENT";
-        case RADIO_STATE_SIM_READY: return "RADIO_SIM_READY";
-        case RADIO_STATE_RUIM_NOT_READY:return"RADIO_RUIM_NOT_READY";
-        case RADIO_STATE_RUIM_READY:return"RADIO_RUIM_READY";
-        case RADIO_STATE_RUIM_LOCKED_OR_ABSENT:return"RADIO_RUIM_LOCKED_OR_ABSENT";
-        case RADIO_STATE_NV_NOT_READY:return"RADIO_NV_NOT_READY";
-        case RADIO_STATE_NV_READY:return"RADIO_NV_READY";
-        case RADIO_STATE_ON:return"RADIO_ON";
-        default: return "<unknown state>";
-    }
-}
-
-const char *
-callStateToString(RIL_CallState s) {
-    switch(s) {
-        case RIL_CALL_ACTIVE : return "ACTIVE";
-        case RIL_CALL_HOLDING: return "HOLDING";
-        case RIL_CALL_DIALING: return "DIALING";
-        case RIL_CALL_ALERTING: return "ALERTING";
-        case RIL_CALL_INCOMING: return "INCOMING";
-        case RIL_CALL_WAITING: return "WAITING";
-        default: return "<unknown state>";
-    }
-}
-
-const char *
-requestToString(int request) {
-/*
- cat libs/telephony/ril_commands.h \
- | egrep "^ *{RIL_" \
- | sed -re 's/\{RIL_([^,]+),[^,]+,([^}]+).+/case RIL_\1: return "\1";/'
-
-
- cat libs/telephony/ril_unsol_commands.h \
- | egrep "^ *{RIL_" \
- | sed -re 's/\{RIL_([^,]+),([^}]+).+/case RIL_\1: return "\1";/'
-
-*/
-    switch(request) {
-        case RIL_REQUEST_GET_SIM_STATUS: return "GET_SIM_STATUS";
-        case RIL_REQUEST_ENTER_SIM_PIN: return "ENTER_SIM_PIN";
-        case RIL_REQUEST_ENTER_SIM_PUK: return "ENTER_SIM_PUK";
-        case RIL_REQUEST_ENTER_SIM_PIN2: return "ENTER_SIM_PIN2";
-        case RIL_REQUEST_ENTER_SIM_PUK2: return "ENTER_SIM_PUK2";
-        case RIL_REQUEST_CHANGE_SIM_PIN: return "CHANGE_SIM_PIN";
-        case RIL_REQUEST_CHANGE_SIM_PIN2: return "CHANGE_SIM_PIN2";
-        case RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION: return "ENTER_NETWORK_DEPERSONALIZATION";
-        case RIL_REQUEST_GET_CURRENT_CALLS: return "GET_CURRENT_CALLS";
-        case RIL_REQUEST_DIAL: return "DIAL";
-        case RIL_REQUEST_GET_IMSI: return "GET_IMSI";
-        case RIL_REQUEST_HANGUP: return "HANGUP";
-        case RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND: return "HANGUP_WAITING_OR_BACKGROUND";
-        case RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND: return "HANGUP_FOREGROUND_RESUME_BACKGROUND";
-        case RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE: return "SWITCH_WAITING_OR_HOLDING_AND_ACTIVE";
-        case RIL_REQUEST_CONFERENCE: return "CONFERENCE";
-        case RIL_REQUEST_UDUB: return "UDUB";
-        case RIL_REQUEST_LAST_CALL_FAIL_CAUSE: return "LAST_CALL_FAIL_CAUSE";
-        case RIL_REQUEST_SIGNAL_STRENGTH: return "SIGNAL_STRENGTH";
-        case RIL_REQUEST_VOICE_REGISTRATION_STATE: return "VOICE_REGISTRATION_STATE";
-        case RIL_REQUEST_DATA_REGISTRATION_STATE: return "DATA_REGISTRATION_STATE";
-        case RIL_REQUEST_OPERATOR: return "OPERATOR";
-        case RIL_REQUEST_RADIO_POWER: return "RADIO_POWER";
-        case RIL_REQUEST_DTMF: return "DTMF";
-        case RIL_REQUEST_SEND_SMS: return "SEND_SMS";
-        case RIL_REQUEST_SEND_SMS_EXPECT_MORE: return "SEND_SMS_EXPECT_MORE";
-        case RIL_REQUEST_SETUP_DATA_CALL: return "SETUP_DATA_CALL";
-        case RIL_REQUEST_SIM_IO: return "SIM_IO";
-        case RIL_REQUEST_SEND_USSD: return "SEND_USSD";
-        case RIL_REQUEST_CANCEL_USSD: return "CANCEL_USSD";
-        case RIL_REQUEST_GET_CLIR: return "GET_CLIR";
-        case RIL_REQUEST_SET_CLIR: return "SET_CLIR";
-        case RIL_REQUEST_QUERY_CALL_FORWARD_STATUS: return "QUERY_CALL_FORWARD_STATUS";
-        case RIL_REQUEST_SET_CALL_FORWARD: return "SET_CALL_FORWARD";
-        case RIL_REQUEST_QUERY_CALL_WAITING: return "QUERY_CALL_WAITING";
-        case RIL_REQUEST_SET_CALL_WAITING: return "SET_CALL_WAITING";
-        case RIL_REQUEST_SMS_ACKNOWLEDGE: return "SMS_ACKNOWLEDGE";
-        case RIL_REQUEST_GET_IMEI: return "GET_IMEI";
-        case RIL_REQUEST_GET_IMEISV: return "GET_IMEISV";
-        case RIL_REQUEST_ANSWER: return "ANSWER";
-        case RIL_REQUEST_DEACTIVATE_DATA_CALL: return "DEACTIVATE_DATA_CALL";
-        case RIL_REQUEST_QUERY_FACILITY_LOCK: return "QUERY_FACILITY_LOCK";
-        case RIL_REQUEST_SET_FACILITY_LOCK: return "SET_FACILITY_LOCK";
-        case RIL_REQUEST_CHANGE_BARRING_PASSWORD: return "CHANGE_BARRING_PASSWORD";
-        case RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE: return "QUERY_NETWORK_SELECTION_MODE";
-        case RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC: return "SET_NETWORK_SELECTION_AUTOMATIC";
-        case RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL: return "SET_NETWORK_SELECTION_MANUAL";
-        case RIL_REQUEST_QUERY_AVAILABLE_NETWORKS : return "QUERY_AVAILABLE_NETWORKS ";
-        case RIL_REQUEST_DTMF_START: return "DTMF_START";
-        case RIL_REQUEST_DTMF_STOP: return "DTMF_STOP";
-        case RIL_REQUEST_BASEBAND_VERSION: return "BASEBAND_VERSION";
-        case RIL_REQUEST_SEPARATE_CONNECTION: return "SEPARATE_CONNECTION";
-        case RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE: return "SET_PREFERRED_NETWORK_TYPE";
-        case RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE: return "GET_PREFERRED_NETWORK_TYPE";
-        case RIL_REQUEST_GET_NEIGHBORING_CELL_IDS: return "GET_NEIGHBORING_CELL_IDS";
-        case RIL_REQUEST_SET_MUTE: return "SET_MUTE";
-        case RIL_REQUEST_GET_MUTE: return "GET_MUTE";
-        case RIL_REQUEST_QUERY_CLIP: return "QUERY_CLIP";
-        case RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE: return "LAST_DATA_CALL_FAIL_CAUSE";
-        case RIL_REQUEST_DATA_CALL_LIST: return "DATA_CALL_LIST";
-        case RIL_REQUEST_RESET_RADIO: return "RESET_RADIO";
-        case RIL_REQUEST_OEM_HOOK_RAW: return "OEM_HOOK_RAW";
-        case RIL_REQUEST_OEM_HOOK_STRINGS: return "OEM_HOOK_STRINGS";
-        case RIL_REQUEST_SET_BAND_MODE: return "SET_BAND_MODE";
-        case RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE: return "QUERY_AVAILABLE_BAND_MODE";
-        case RIL_REQUEST_STK_GET_PROFILE: return "STK_GET_PROFILE";
-        case RIL_REQUEST_STK_SET_PROFILE: return "STK_SET_PROFILE";
-        case RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND: return "STK_SEND_ENVELOPE_COMMAND";
-        case RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE: return "STK_SEND_TERMINAL_RESPONSE";
-        case RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM: return "STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM";
-        case RIL_REQUEST_SCREEN_STATE: return "SCREEN_STATE";
-        case RIL_REQUEST_EXPLICIT_CALL_TRANSFER: return "EXPLICIT_CALL_TRANSFER";
-        case RIL_REQUEST_SET_LOCATION_UPDATES: return "SET_LOCATION_UPDATES";
-        case RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE:return"CDMA_SET_SUBSCRIPTION_SOURCE";
-        case RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE:return"CDMA_SET_ROAMING_PREFERENCE";
-        case RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE:return"CDMA_QUERY_ROAMING_PREFERENCE";
-        case RIL_REQUEST_SET_TTY_MODE:return"SET_TTY_MODE";
-        case RIL_REQUEST_QUERY_TTY_MODE:return"QUERY_TTY_MODE";
-        case RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE:return"CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE";
-        case RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE:return"CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE";
-        case RIL_REQUEST_CDMA_FLASH:return"CDMA_FLASH";
-        case RIL_REQUEST_CDMA_BURST_DTMF:return"CDMA_BURST_DTMF";
-        case RIL_REQUEST_CDMA_SEND_SMS:return"CDMA_SEND_SMS";
-        case RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE:return"CDMA_SMS_ACKNOWLEDGE";
-        case RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG:return"GSM_GET_BROADCAST_SMS_CONFIG";
-        case RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG:return"GSM_SET_BROADCAST_SMS_CONFIG";
-        case RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG:return "CDMA_GET_BROADCAST_SMS_CONFIG";
-        case RIL_REQUEST_CDMA_SET_BROADCAST_SMS_CONFIG:return "CDMA_SET_BROADCAST_SMS_CONFIG";
-        case RIL_REQUEST_CDMA_SMS_BROADCAST_ACTIVATION:return "CDMA_SMS_BROADCAST_ACTIVATION";
-        case RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY: return"CDMA_VALIDATE_AND_WRITE_AKEY";
-        case RIL_REQUEST_CDMA_SUBSCRIPTION: return"CDMA_SUBSCRIPTION";
-        case RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM: return "CDMA_WRITE_SMS_TO_RUIM";
-        case RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM: return "CDMA_DELETE_SMS_ON_RUIM";
-        case RIL_REQUEST_DEVICE_IDENTITY: return "DEVICE_IDENTITY";
-        case RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE: return "EXIT_EMERGENCY_CALLBACK_MODE";
-        case RIL_REQUEST_GET_SMSC_ADDRESS: return "GET_SMSC_ADDRESS";
-        case RIL_REQUEST_SET_SMSC_ADDRESS: return "SET_SMSC_ADDRESS";
-        case RIL_REQUEST_REPORT_SMS_MEMORY_STATUS: return "REPORT_SMS_MEMORY_STATUS";
-        case RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING: return "REPORT_STK_SERVICE_IS_RUNNING";
-        case RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE: return "CDMA_GET_SUBSCRIPTION_SOURCE";
-        case RIL_REQUEST_ISIM_AUTHENTICATION: return "ISIM_AUTHENTICATION";
-        case RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU: return "RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU";
-        case RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS: return "RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS";
-        case RIL_REQUEST_VOICE_RADIO_TECH: return "VOICE_RADIO_TECH";
-        case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED: return "UNSOL_RESPONSE_RADIO_STATE_CHANGED";
-        case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED: return "UNSOL_RESPONSE_CALL_STATE_CHANGED";
-        case RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED: return "UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED";
-        case RIL_UNSOL_RESPONSE_NEW_SMS: return "UNSOL_RESPONSE_NEW_SMS";
-        case RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT: return "UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT";
-        case RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM: return "UNSOL_RESPONSE_NEW_SMS_ON_SIM";
-        case RIL_UNSOL_ON_USSD: return "UNSOL_ON_USSD";
-        case RIL_UNSOL_ON_USSD_REQUEST: return "UNSOL_ON_USSD_REQUEST(obsolete)";
-        case RIL_UNSOL_NITZ_TIME_RECEIVED: return "UNSOL_NITZ_TIME_RECEIVED";
-        case RIL_UNSOL_SIGNAL_STRENGTH: return "UNSOL_SIGNAL_STRENGTH";
-        case RIL_UNSOL_STK_SESSION_END: return "UNSOL_STK_SESSION_END";
-        case RIL_UNSOL_STK_PROACTIVE_COMMAND: return "UNSOL_STK_PROACTIVE_COMMAND";
-        case RIL_UNSOL_STK_EVENT_NOTIFY: return "UNSOL_STK_EVENT_NOTIFY";
-        case RIL_UNSOL_STK_CALL_SETUP: return "UNSOL_STK_CALL_SETUP";
-        case RIL_UNSOL_SIM_SMS_STORAGE_FULL: return "UNSOL_SIM_SMS_STORAGE_FUL";
-        case RIL_UNSOL_SIM_REFRESH: return "UNSOL_SIM_REFRESH";
-        case RIL_UNSOL_DATA_CALL_LIST_CHANGED: return "UNSOL_DATA_CALL_LIST_CHANGED";
-        case RIL_UNSOL_CALL_RING: return "UNSOL_CALL_RING";
-        case RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED: return "UNSOL_RESPONSE_SIM_STATUS_CHANGED";
-        case RIL_UNSOL_RESPONSE_CDMA_NEW_SMS: return "UNSOL_NEW_CDMA_SMS";
-        case RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS: return "UNSOL_NEW_BROADCAST_SMS";
-        case RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL: return "UNSOL_CDMA_RUIM_SMS_STORAGE_FULL";
-        case RIL_UNSOL_RESTRICTED_STATE_CHANGED: return "UNSOL_RESTRICTED_STATE_CHANGED";
-        case RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE: return "UNSOL_ENTER_EMERGENCY_CALLBACK_MODE";
-        case RIL_UNSOL_CDMA_CALL_WAITING: return "UNSOL_CDMA_CALL_WAITING";
-        case RIL_UNSOL_CDMA_OTA_PROVISION_STATUS: return "UNSOL_CDMA_OTA_PROVISION_STATUS";
-        case RIL_UNSOL_CDMA_INFO_REC: return "UNSOL_CDMA_INFO_REC";
-        case RIL_UNSOL_OEM_HOOK_RAW: return "UNSOL_OEM_HOOK_RAW";
-        case RIL_UNSOL_RINGBACK_TONE: return "UNSOL_RINGBACK_TONE";
-        case RIL_UNSOL_RESEND_INCALL_MUTE: return "UNSOL_RESEND_INCALL_MUTE";
-        case RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED: return "UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED";
-        case RIL_UNSOL_CDMA_PRL_CHANGED: return "UNSOL_CDMA_PRL_CHANGED";
-        case RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE: return "UNSOL_EXIT_EMERGENCY_CALLBACK_MODE";
-        case RIL_UNSOL_RIL_CONNECTED: return "UNSOL_RIL_CONNECTED";
-        case RIL_UNSOL_VOICE_RADIO_TECH_CHANGED: return "UNSOL_VOICE_RADIO_TECH_CHANGED";
-        case RIL_UNSOL_ENTER_LPM: return "UNSOL_ENTER_LPM";
-        case RIL_UNSOL_CDMA_3G_INDICATOR: return "UNSOL_CDMA_3G_INDICATOR";
-        case RIL_UNSOL_CDMA_ENHANCE_ROAMING_INDICATOR: return "UNSOL_CDMA_ENHANCE_ROAMING_INDICATOR";
-        case RIL_UNSOL_RESPONSE_PHONE_MODE_CHANGE: return "UNSOL_RESPONSE_PHONE_MODE_CHANGE";
-        case RIL_UNSOL_RESPONSE_VOICE_RADIO_TECH_CHANGED: return "UNSOL_RESPONSE_VOICE_RADIO_TECH_CHANGED";
-        case RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED: return "UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED";
-        case RIL_UNSOL_RESPONSE_DATA_NETWORK_STATE_CHANGED: return "UNSOL_RESPONSE_DATA_NETWORK_STATE_CHANGED";
-        default: return "<unknown request>";
-    }
-}
-
-} /* namespace android */
diff --git a/libril/ril_commands.h b/libril/ril_commands.h
deleted file mode 100644
index 069ee75..0000000
--- a/libril/ril_commands.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/* //device/libs/telephony/ril_commands.h
-**
-** Copyright 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.
-*/
-    {0, NULL, NULL},                   //none
-    {RIL_REQUEST_GET_SIM_STATUS, dispatchVoid, responseSimStatus},
-    {RIL_REQUEST_ENTER_SIM_PIN, dispatchStrings, responseInts},
-    {RIL_REQUEST_ENTER_SIM_PUK, dispatchStrings, responseInts},
-    {RIL_REQUEST_ENTER_SIM_PIN2, dispatchStrings, responseInts},
-    {RIL_REQUEST_ENTER_SIM_PUK2, dispatchStrings, responseInts},
-    {RIL_REQUEST_CHANGE_SIM_PIN, dispatchStrings, responseInts},
-    {RIL_REQUEST_CHANGE_SIM_PIN2, dispatchStrings, responseInts},
-    {RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION, dispatchStrings, responseInts},
-    {RIL_REQUEST_GET_CURRENT_CALLS, dispatchVoid, responseCallList},
-    {RIL_REQUEST_DIAL, dispatchDial, responseVoid},
-    {RIL_REQUEST_GET_IMSI, dispatchStrings, responseString},
-    {RIL_REQUEST_HANGUP, dispatchInts, responseVoid},
-    {RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND, dispatchVoid, responseVoid},
-    {RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND, dispatchVoid, responseVoid},
-    {RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE, dispatchVoid, responseVoid},
-    {RIL_REQUEST_CONFERENCE, dispatchVoid, responseVoid},
-    {RIL_REQUEST_UDUB, dispatchVoid, responseVoid},
-    {RIL_REQUEST_LAST_CALL_FAIL_CAUSE, dispatchVoid, responseInts},
-    {RIL_REQUEST_SIGNAL_STRENGTH, dispatchVoid, responseRilSignalStrength},
-    {RIL_REQUEST_VOICE_REGISTRATION_STATE, dispatchVoid, responseStrings},
-    {RIL_REQUEST_DATA_REGISTRATION_STATE, dispatchVoid, responseStrings},
-    {RIL_REQUEST_OPERATOR, dispatchVoid, responseStrings},
-    {RIL_REQUEST_RADIO_POWER, dispatchInts, responseVoid},
-    {RIL_REQUEST_DTMF, dispatchString, responseVoid},
-    {RIL_REQUEST_SEND_SMS, dispatchStrings, responseSMS},
-    {RIL_REQUEST_SEND_SMS_EXPECT_MORE, dispatchStrings, responseSMS},
-    {RIL_REQUEST_SETUP_DATA_CALL, dispatchDataCall, responseSetupDataCall},
-    {RIL_REQUEST_SIM_IO, dispatchSIM_IO, responseSIM_IO},
-    {RIL_REQUEST_SEND_USSD, dispatchString, responseVoid},
-    {RIL_REQUEST_CANCEL_USSD, dispatchVoid, responseVoid},
-    {RIL_REQUEST_GET_CLIR, dispatchVoid, responseInts},
-    {RIL_REQUEST_SET_CLIR, dispatchInts, responseVoid},
-    {RIL_REQUEST_QUERY_CALL_FORWARD_STATUS, dispatchCallForward, responseCallForwards},
-    {RIL_REQUEST_SET_CALL_FORWARD, dispatchCallForward, responseVoid},
-    {RIL_REQUEST_QUERY_CALL_WAITING, dispatchInts, responseInts},
-    {RIL_REQUEST_SET_CALL_WAITING, dispatchInts, responseVoid},
-    {RIL_REQUEST_SMS_ACKNOWLEDGE, dispatchInts, responseVoid},
-    {RIL_REQUEST_GET_IMEI, dispatchVoid, responseString},
-    {RIL_REQUEST_GET_IMEISV, dispatchVoid, responseString},
-    {RIL_REQUEST_ANSWER,dispatchVoid, responseVoid},
-    {RIL_REQUEST_DEACTIVATE_DATA_CALL, dispatchStrings, responseVoid},
-    {RIL_REQUEST_QUERY_FACILITY_LOCK, dispatchStrings, responseInts},
-    {RIL_REQUEST_SET_FACILITY_LOCK, dispatchStrings, responseInts},
-    {RIL_REQUEST_CHANGE_BARRING_PASSWORD, dispatchStrings, responseVoid},
-    {RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE, dispatchVoid, responseInts},
-    {RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC, dispatchVoid, responseVoid},
-    {RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL, dispatchString, responseVoid},
-    {RIL_REQUEST_QUERY_AVAILABLE_NETWORKS , dispatchVoid, responseStrings},
-    {RIL_REQUEST_DTMF_START, dispatchString, responseVoid},
-    {RIL_REQUEST_DTMF_STOP, dispatchVoid, responseVoid},
-    {RIL_REQUEST_BASEBAND_VERSION, dispatchVoid, responseString},
-    {RIL_REQUEST_SEPARATE_CONNECTION, dispatchInts, responseVoid},
-    {RIL_REQUEST_SET_MUTE, dispatchInts, responseVoid},
-    {RIL_REQUEST_GET_MUTE, dispatchVoid, responseInts},
-    {RIL_REQUEST_QUERY_CLIP, dispatchVoid, responseInts},
-    {RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE, dispatchVoid, responseInts},
-    {RIL_REQUEST_DATA_CALL_LIST, dispatchVoid, responseDataCallList},
-    {RIL_REQUEST_RESET_RADIO, dispatchVoid, responseVoid},
-    {RIL_REQUEST_OEM_HOOK_RAW, dispatchRaw, responseRaw},
-    {RIL_REQUEST_OEM_HOOK_STRINGS, dispatchStrings, responseStrings},
-    {RIL_REQUEST_SCREEN_STATE, dispatchInts, responseVoid},
-    {RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION, dispatchInts, responseVoid},
-    {RIL_REQUEST_WRITE_SMS_TO_SIM, dispatchSmsWrite, responseInts},
-    {RIL_REQUEST_DELETE_SMS_ON_SIM, dispatchInts, responseVoid},
-    {RIL_REQUEST_SET_BAND_MODE, dispatchInts, responseVoid},
-    {RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE, dispatchVoid, responseInts},
-    {RIL_REQUEST_STK_GET_PROFILE, dispatchVoid, responseString},
-    {RIL_REQUEST_STK_SET_PROFILE, dispatchString, responseVoid},
-    {RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND, dispatchString, responseString},
-    {RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE, dispatchString, responseVoid},
-    {RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM, dispatchInts, responseVoid},
-    {RIL_REQUEST_EXPLICIT_CALL_TRANSFER, dispatchVoid, responseVoid},
-    {RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE, dispatchInts, responseVoid},
-    {RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE, dispatchVoid, responseInts},
-    {RIL_REQUEST_GET_NEIGHBORING_CELL_IDS, dispatchVoid, responseCellList},
-    {RIL_REQUEST_SET_LOCATION_UPDATES, dispatchInts, responseVoid},
-    {RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE, dispatchInts, responseVoid},
-    {RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE, dispatchInts, responseVoid},
-    {RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE, dispatchVoid, responseInts},
-    {RIL_REQUEST_SET_TTY_MODE, dispatchInts, responseVoid},
-    {RIL_REQUEST_QUERY_TTY_MODE, dispatchVoid, responseInts},
-    {RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE, dispatchInts, responseVoid},
-    {RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE, dispatchVoid, responseInts},
-    {RIL_REQUEST_CDMA_FLASH, dispatchString, responseVoid},
-    {RIL_REQUEST_CDMA_BURST_DTMF, dispatchStrings, responseVoid},
-    {RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY, dispatchString, responseVoid},
-    {RIL_REQUEST_CDMA_SEND_SMS, dispatchCdmaSms, responseSMS},
-    {RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE, dispatchCdmaSmsAck, responseVoid},
-    {RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG, dispatchVoid, responseGsmBrSmsCnf},
-    {RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG, dispatchGsmBrSmsCnf, responseVoid},
-    {RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION, dispatchInts, responseVoid},
-    {RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG, dispatchVoid, responseCdmaBrSmsCnf},
-    {RIL_REQUEST_CDMA_SET_BROADCAST_SMS_CONFIG, dispatchCdmaBrSmsCnf, responseVoid},
-    {RIL_REQUEST_CDMA_SMS_BROADCAST_ACTIVATION, dispatchInts, responseVoid},
-    {RIL_REQUEST_CDMA_SUBSCRIPTION, dispatchVoid, responseStrings},
-    {RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM, dispatchRilCdmaSmsWriteArgs, responseInts},
-    {RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM, dispatchInts, responseVoid},
-    {RIL_REQUEST_DEVICE_IDENTITY, dispatchVoid, responseStrings},
-    {RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE, dispatchVoid, responseVoid},
-    {RIL_REQUEST_GET_SMSC_ADDRESS, dispatchVoid, responseString},
-    {RIL_REQUEST_SET_SMSC_ADDRESS, dispatchString, responseVoid},
-    {RIL_REQUEST_REPORT_SMS_MEMORY_STATUS, dispatchInts, responseVoid},
-    {RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING, dispatchVoid, responseVoid},
-    {RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE, dispatchCdmaSubscriptionSource, responseInts},
-    {RIL_REQUEST_ISIM_AUTHENTICATION, dispatchString, responseString},
-    {RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU, dispatchStrings, responseVoid},
-    {RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS, dispatchString, responseSIM_IO},
-    {RIL_REQUEST_VOICE_RADIO_TECH, dispatchVoiceRadioTech, responseInts},
diff --git a/libril/ril_event.cpp b/libril/ril_event.cpp
deleted file mode 100644
index 93511e9..0000000
--- a/libril/ril_event.cpp
+++ /dev/null
@@ -1,385 +0,0 @@
-/* //device/libs/telephony/ril_event.cpp
-**
-** Copyright 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 LOG_TAG "RILC"
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <utils/Log.h>
-#include <ril_event.h>
-#include <string.h>
-#include <sys/time.h>
-#include <time.h>
-
-#include <pthread.h>
-static pthread_mutex_t listMutex;
-#define MUTEX_ACQUIRE() pthread_mutex_lock(&listMutex)
-#define MUTEX_RELEASE() pthread_mutex_unlock(&listMutex)
-#define MUTEX_INIT() pthread_mutex_init(&listMutex, NULL)
-#define MUTEX_DESTROY() pthread_mutex_destroy(&listMutex)
-
-#ifndef timeradd
-#define timeradd(tvp, uvp, vvp)						\
-	do {								\
-		(vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec;		\
-		(vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec;       \
-		if ((vvp)->tv_usec >= 1000000) {			\
-			(vvp)->tv_sec++;				\
-			(vvp)->tv_usec -= 1000000;			\
-		}							\
-	} while (0)
-#endif
-
-#ifndef timercmp
-#define timercmp(a, b, op)               \
-        ((a)->tv_sec == (b)->tv_sec      \
-        ? (a)->tv_usec op (b)->tv_usec   \
-        : (a)->tv_sec op (b)->tv_sec)
-#endif
-
-#ifndef timersub
-#define timersub(a, b, res)                           \
-    do {                                              \
-        (res)->tv_sec = (a)->tv_sec - (b)->tv_sec;    \
-        (res)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
-        if ((res)->tv_usec < 0) {                     \
-            (res)->tv_usec += 1000000;                \
-            (res)->tv_sec -= 1;                       \
-        }                                             \
-    } while(0);
-#endif
-
-static fd_set readFds;
-static int nfds = 0;
-
-static struct ril_event * watch_table[MAX_FD_EVENTS];
-static struct ril_event timer_list;
-static struct ril_event pending_list;
-
-#define DEBUG 0
-
-#if DEBUG
-#define dlog(x...) ALOGD( x )
-static void dump_event(struct ril_event * ev)
-{
-    dlog("~~~~ Event %x ~~~~", (unsigned int)ev);
-    dlog("     next    = %x", (unsigned int)ev->next);
-    dlog("     prev    = %x", (unsigned int)ev->prev);
-    dlog("     fd      = %d", ev->fd);
-    dlog("     pers    = %d", ev->persist);
-    dlog("     timeout = %ds + %dus", (int)ev->timeout.tv_sec, (int)ev->timeout.tv_usec);
-    dlog("     func    = %x", (unsigned int)ev->func);
-    dlog("     param   = %x", (unsigned int)ev->param);
-    dlog("~~~~~~~~~~~~~~~~~~");
-}
-#else
-#define dlog(x...) do {} while(0)
-#define dump_event(x) do {} while(0)
-#endif
-
-static void getNow(struct timeval * tv)
-{
-#ifdef HAVE_POSIX_CLOCKS
-    struct timespec ts;
-    clock_gettime(CLOCK_MONOTONIC, &ts);
-    tv->tv_sec = ts.tv_sec;
-    tv->tv_usec = ts.tv_nsec/1000;
-#else
-    gettimeofday(tv, NULL);
-#endif
-}
-
-static void init_list(struct ril_event * list)
-{
-    memset(list, 0, sizeof(struct ril_event));
-    list->next = list;
-    list->prev = list;
-    list->fd = -1;
-}
-
-static void addToList(struct ril_event * ev, struct ril_event * list)
-{
-    ev->next = list;
-    ev->prev = list->prev;
-    ev->prev->next = ev;
-    list->prev = ev;
-    dump_event(ev);
-}
-
-static void removeFromList(struct ril_event * ev)
-{
-    dlog("~~~~ Removing event ~~~~");
-    dump_event(ev);
-
-    ev->next->prev = ev->prev;
-    ev->prev->next = ev->next;
-    ev->next = NULL;
-    ev->prev = NULL;
-}
-
-
-static void removeWatch(struct ril_event * ev, int index)
-{
-    watch_table[index] = NULL;
-    ev->index = -1;
-
-    FD_CLR(ev->fd, &readFds);
-
-    if (ev->fd+1 == nfds) {
-        int n = 0;
-
-        for (int i = 0; i < MAX_FD_EVENTS; i++) {
-            struct ril_event * rev = watch_table[i];
-
-            if ((rev != NULL) && (rev->fd > n)) {
-                n = rev->fd;
-            }
-        }
-        nfds = n + 1;
-        dlog("~~~~ nfds = %d ~~~~", nfds);
-    }
-}
-
-static void processTimeouts()
-{
-    dlog("~~~~ +processTimeouts ~~~~");
-    MUTEX_ACQUIRE();
-    struct timeval now;
-    struct ril_event * tev = timer_list.next;
-    struct ril_event * next;
-
-    getNow(&now);
-    // walk list, see if now >= ev->timeout for any events
-
-    dlog("~~~~ Looking for timers <= %ds + %dus ~~~~", (int)now.tv_sec, (int)now.tv_usec);
-    while ((tev != &timer_list) && (timercmp(&now, &tev->timeout, >))) {
-        // Timer expired
-        dlog("~~~~ firing timer ~~~~");
-        next = tev->next;
-        removeFromList(tev);
-        addToList(tev, &pending_list);
-        tev = next;
-    }
-    MUTEX_RELEASE();
-    dlog("~~~~ -processTimeouts ~~~~");
-}
-
-static void processReadReadies(fd_set * rfds, int n)
-{
-    dlog("~~~~ +processReadReadies (%d) ~~~~", n);
-    MUTEX_ACQUIRE();
-
-    for (int i = 0; (i < MAX_FD_EVENTS) && (n > 0); i++) {
-        struct ril_event * rev = watch_table[i];
-        if (rev != NULL && FD_ISSET(rev->fd, rfds)) {
-            addToList(rev, &pending_list);
-            if (rev->persist == false) {
-                removeWatch(rev, i);
-            }
-            n--;
-        }
-    }
-
-    MUTEX_RELEASE();
-    dlog("~~~~ -processReadReadies (%d) ~~~~", n);
-}
-
-static void firePending()
-{
-    dlog("~~~~ +firePending ~~~~");
-    struct ril_event * ev = pending_list.next;
-    while (ev != &pending_list) {
-        struct ril_event * next = ev->next;
-        removeFromList(ev);
-        ev->func(ev->fd, 0, ev->param);
-        ev = next;
-    }
-    dlog("~~~~ -firePending ~~~~");
-}
-
-static int calcNextTimeout(struct timeval * tv)
-{
-    struct ril_event * tev = timer_list.next;
-    struct timeval now;
-
-    getNow(&now);
-
-    // Sorted list, so calc based on first node
-    if (tev == &timer_list) {
-        // no pending timers
-        return -1;
-    }
-
-    dlog("~~~~ now = %ds + %dus ~~~~", (int)now.tv_sec, (int)now.tv_usec);
-    dlog("~~~~ next = %ds + %dus ~~~~",
-            (int)tev->timeout.tv_sec, (int)tev->timeout.tv_usec);
-    if (timercmp(&tev->timeout, &now, >)) {
-        timersub(&tev->timeout, &now, tv);
-    } else {
-        // timer already expired.
-        tv->tv_sec = tv->tv_usec = 0;
-    }
-    return 0;
-}
-
-// Initialize internal data structs
-void ril_event_init()
-{
-    MUTEX_INIT();
-
-    FD_ZERO(&readFds);
-    init_list(&timer_list);
-    init_list(&pending_list);
-    memset(watch_table, 0, sizeof(watch_table));
-}
-
-// Initialize an event
-void ril_event_set(struct ril_event * ev, int fd, bool persist, ril_event_cb func, void * param)
-{
-    dlog("~~~~ ril_event_set %x ~~~~", (unsigned int)ev);
-    memset(ev, 0, sizeof(struct ril_event));
-    ev->fd = fd;
-    ev->index = -1;
-    ev->persist = persist;
-    ev->func = func;
-    ev->param = param;
-    fcntl(fd, F_SETFL, O_NONBLOCK);
-}
-
-// Add event to watch list
-void ril_event_add(struct ril_event * ev)
-{
-    dlog("~~~~ +ril_event_add ~~~~");
-    MUTEX_ACQUIRE();
-    for (int i = 0; i < MAX_FD_EVENTS; i++) {
-        if (watch_table[i] == NULL) {
-            watch_table[i] = ev;
-            ev->index = i;
-            dlog("~~~~ added at %d ~~~~", i);
-            dump_event(ev);
-            FD_SET(ev->fd, &readFds);
-            if (ev->fd >= nfds) nfds = ev->fd+1;
-            dlog("~~~~ nfds = %d ~~~~", nfds);
-            break;
-        }
-    }
-    MUTEX_RELEASE();
-    dlog("~~~~ -ril_event_add ~~~~");
-}
-
-// Add timer event
-void ril_timer_add(struct ril_event * ev, struct timeval * tv)
-{
-    dlog("~~~~ +ril_timer_add ~~~~");
-    MUTEX_ACQUIRE();
-
-    struct ril_event * list;
-    if (tv != NULL) {
-        // add to timer list
-        list = timer_list.next;
-        ev->fd = -1; // make sure fd is invalid
-
-        struct timeval now;
-        getNow(&now);
-        timeradd(&now, tv, &ev->timeout);
-
-        // keep list sorted
-        while (timercmp(&list->timeout, &ev->timeout, < )
-                && (list != &timer_list)) {
-            list = list->next;
-        }
-        // list now points to the first event older than ev
-        addToList(ev, list);
-    }
-
-    MUTEX_RELEASE();
-    dlog("~~~~ -ril_timer_add ~~~~");
-}
-
-// Remove event from watch or timer list
-void ril_event_del(struct ril_event * ev)
-{
-    dlog("~~~~ +ril_event_del ~~~~");
-    MUTEX_ACQUIRE();
-
-    if (ev->index < 0 || ev->index >= MAX_FD_EVENTS) {
-        MUTEX_RELEASE();
-        return;
-    }
-
-    removeWatch(ev, ev->index);
-
-    MUTEX_RELEASE();
-    dlog("~~~~ -ril_event_del ~~~~");
-}
-
-#if DEBUG
-static void printReadies(fd_set * rfds)
-{
-    for (int i = 0; (i < MAX_FD_EVENTS); i++) {
-        struct ril_event * rev = watch_table[i];
-        if (rev != NULL && FD_ISSET(rev->fd, rfds)) {
-          dlog("DON: fd=%d is ready", rev->fd);
-        }
-    }
-}
-#else
-#define printReadies(rfds) do {} while(0)
-#endif
-
-void ril_event_loop()
-{
-    int n;
-    fd_set rfds;
-    struct timeval tv;
-    struct timeval * ptv;
-
-
-    for (;;) {
-
-        // make local copy of read fd_set
-        memcpy(&rfds, &readFds, sizeof(fd_set));
-        if (-1 == calcNextTimeout(&tv)) {
-            // no pending timers; block indefinitely
-            dlog("~~~~ no timers; blocking indefinitely ~~~~");
-            ptv = NULL;
-        } else {
-            dlog("~~~~ blocking for %ds + %dus ~~~~", (int)tv.tv_sec, (int)tv.tv_usec);
-            ptv = &tv;
-        }
-        printReadies(&rfds);
-        n = select(nfds, &rfds, NULL, NULL, ptv);
-        printReadies(&rfds);
-        dlog("~~~~ %d events fired ~~~~", n);
-        if (n < 0) {
-            if (errno == EINTR) continue;
-
-            ALOGE("ril_event: select error (%d)", errno);
-            // bail?
-            return;
-        }
-
-        // Check for timeouts
-        processTimeouts();
-        // Check for read-ready
-        processReadReadies(&rfds, n);
-        // Fire away
-        firePending();
-    }
-}
diff --git a/libril/ril_event.h b/libril/ril_event.h
deleted file mode 100644
index 7ba231b..0000000
--- a/libril/ril_event.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* //device/libs/telephony/ril_event.h
-**
-** Copyright 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.
-*/
-
-// Max number of fd's we watch at any one time.  Increase if necessary.
-#define MAX_FD_EVENTS 8
-
-typedef void (*ril_event_cb)(int fd, short events, void *userdata);
-
-struct ril_event {
-    struct ril_event *next;
-    struct ril_event *prev;
-
-    int fd;
-    int index;
-    bool persist;
-    struct timeval timeout;
-    ril_event_cb func;
-    void *param;
-};
-
-// Initialize internal data structs
-void ril_event_init();
-
-// Initialize an event
-void ril_event_set(struct ril_event * ev, int fd, bool persist, ril_event_cb func, void * param);
-
-// Add event to watch list
-void ril_event_add(struct ril_event * ev);
-
-// Add timer event
-void ril_timer_add(struct ril_event * ev, struct timeval * tv);
-
-// Remove event from watch list
-void ril_event_del(struct ril_event * ev);
-
-// Event loop
-void ril_event_loop();
-
diff --git a/libril/ril_unsol_commands.h b/libril/ril_unsol_commands.h
deleted file mode 100644
index 250c5be..0000000
--- a/libril/ril_unsol_commands.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* //device/libs/telephony/ril_unsol_commands.h
-**
-** Copyright 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.
-*/
-    {RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED, responseVoid, WAKE_PARTIAL},
-    {RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED, responseVoid, WAKE_PARTIAL},
-    {RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED, responseVoid, WAKE_PARTIAL},
-    {RIL_UNSOL_RESPONSE_NEW_SMS, responseString, WAKE_PARTIAL},
-    {RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT, responseString, WAKE_PARTIAL},
-    {RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM, responseInts, WAKE_PARTIAL},
-    {RIL_UNSOL_ON_USSD, responseStrings, WAKE_PARTIAL},
-    {RIL_UNSOL_ON_USSD_REQUEST, responseVoid, DONT_WAKE},
-    {RIL_UNSOL_NITZ_TIME_RECEIVED, responseString, WAKE_PARTIAL},
-    {RIL_UNSOL_SIGNAL_STRENGTH, responseRilSignalStrength, DONT_WAKE},
-    {RIL_UNSOL_DATA_CALL_LIST_CHANGED, responseDataCallList, WAKE_PARTIAL},
-    {RIL_UNSOL_SUPP_SVC_NOTIFICATION, responseSsn, WAKE_PARTIAL},
-    {RIL_UNSOL_STK_SESSION_END, responseVoid, WAKE_PARTIAL},
-    {RIL_UNSOL_STK_PROACTIVE_COMMAND, responseString, WAKE_PARTIAL},
-    {RIL_UNSOL_STK_EVENT_NOTIFY, responseString, WAKE_PARTIAL},
-    {RIL_UNSOL_STK_CALL_SETUP, responseInts, WAKE_PARTIAL},
-    {RIL_UNSOL_SIM_SMS_STORAGE_FULL, responseVoid, WAKE_PARTIAL},
-    {RIL_UNSOL_SIM_REFRESH, responseSimRefresh, WAKE_PARTIAL},
-    {RIL_UNSOL_CALL_RING, responseCallRing, WAKE_PARTIAL},
-    {RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED, responseVoid, WAKE_PARTIAL},
-    {RIL_UNSOL_RESPONSE_CDMA_NEW_SMS, responseCdmaSms, WAKE_PARTIAL},
-    {RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS, responseRaw, WAKE_PARTIAL},
-    {RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL, responseVoid, WAKE_PARTIAL},
-    {RIL_UNSOL_RESTRICTED_STATE_CHANGED, responseInts, WAKE_PARTIAL},
-    {RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE, responseVoid, WAKE_PARTIAL},
-    {RIL_UNSOL_CDMA_CALL_WAITING, responseCdmaCallWaiting, WAKE_PARTIAL},
-    {RIL_UNSOL_CDMA_OTA_PROVISION_STATUS, responseInts, WAKE_PARTIAL},
-    {RIL_UNSOL_CDMA_INFO_REC, responseCdmaInformationRecords, WAKE_PARTIAL},
-    {RIL_UNSOL_OEM_HOOK_RAW, responseRaw, WAKE_PARTIAL},
-    {RIL_UNSOL_RINGBACK_TONE, responseInts, WAKE_PARTIAL},
-    {RIL_UNSOL_RESEND_INCALL_MUTE, responseVoid, WAKE_PARTIAL},
-    {RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED, responseInts, WAKE_PARTIAL},
-    {RIL_UNSOL_CDMA_PRL_CHANGED, responseInts, WAKE_PARTIAL},
-    {RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE, responseVoid, WAKE_PARTIAL},
-    {RIL_UNSOL_RIL_CONNECTED, responseInts, WAKE_PARTIAL},
-    {RIL_UNSOL_VOICE_RADIO_TECH_CHANGED, responseInts, WAKE_PARTIAL},
-    {RIL_UNSOL_ENTER_LPM, responseVoid, WAKE_PARTIAL},                            // s_unsolResponses[36]: 1523
-    {RIL_UNSOL_CDMA_3G_INDICATOR, responseInts, WAKE_PARTIAL},                    // s_unsolResponses[37]: 3009
-    {RIL_UNSOL_CDMA_ENHANCE_ROAMING_INDICATOR, responseCdmaERIInfo, WAKE_PARTIAL},// s_unsolResponses[38]: 3012
-    {RIL_UNSOL_RESPONSE_PHONE_MODE_CHANGE, responseInts, WAKE_PARTIAL},           // s_unsolResponses[39]: 6002
-    {RIL_UNSOL_RESPONSE_VOICE_RADIO_TECH_CHANGED, responseVoid, WAKE_PARTIAL},    // s_unsolResponses[40]: 21004
-    {RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED, responseVoid, WAKE_PARTIAL},   // s_unsolResponses[41]: 21005
-    {RIL_UNSOL_RESPONSE_DATA_NETWORK_STATE_CHANGED, responseVoid, WAKE_PARTIAL},  // s_unsolResponses[42]: 21007
diff --git a/libril/telephony/ril.h b/libril/telephony/ril.h
deleted file mode 100644
index 0019f34..0000000
--- a/libril/telephony/ril.h
+++ /dev/null
@@ -1,3989 +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>
-#ifndef FEATURE_UNIT_TEST
-#include <sys/time.h>
-#endif /* !FEATURE_UNIT_TEST */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define RIL_VERSION 7     /* 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
-
-typedef void * RIL_Token;
-
-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_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
-} RIL_RadioTechnology;
-
-// 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 */
-} 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 */
-#ifndef HCRADIO
-    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 MAX_INT(0x7fffffff) means no retry. */
-#endif
-    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 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;
-
-typedef struct {
-    int sw1;
-    int sw2;
-    char *simResponse;  /* In hex string format ([a-fA-F0-9]*). */
-} 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;
-
-/* 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_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;
-
-/* 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_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,            /* no retry */
-    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_OEM_BASE   = 1000    /* Start of OEM-specific profiles */
-} 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;
-} 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 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 dbm;
-    int ecno;
-} RIL_ATT_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;
-
-/* 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_ATT_SignalStrength  ATT_SignalStrength;
-    RIL_LTE_SignalStrength  LTE_SignalStrength;
-} RIL_SignalStrength_HTC;
-
-/* 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;
-
-/**
- * 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)
- *  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.
- *
- * 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_v6
- *
- * 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
- *  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
- *  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
- *  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
- *  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
- *  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
- *  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
- *  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
- *  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
- *  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
- *  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)
- *  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
-
-
-/***********************************************************************/
-
-
-#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
-
-/**
- * Custom responses for HTCQualcommRIL.java
- */
-#define RIL_UNSOL_ENTER_LPM 1523
-#define RIL_UNSOL_CDMA_3G_INDICATOR 3009
-#define RIL_UNSOL_CDMA_ENHANCE_ROAMING_INDICATOR 3012
-#define RIL_UNSOL_RESPONSE_PHONE_MODE_CHANGE 6002
-#define RIL_UNSOL_RESPONSE_VOICE_RADIO_TECH_CHANGED 21004
-#define RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED 21005
-#define RIL_UNSOL_RESPONSE_DATA_NETWORK_STATE_CHANGED 21007
-
-/***********************************************************************/
-
-
-/**
- * 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)();
-
-/**
- * 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;
-
-#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);
-
-    /**
-     * "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);
-
-    /**
-     * 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);
-
-/**
- * @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, void *data,
-                                size_t datalen);
-
-
-/**
- * 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/libril/telephony/ril_cdma_sms.h b/libril/telephony/ril_cdma_sms.h
deleted file mode 100644
index bcf6b30..0000000
--- a/libril/telephony/ril_cdma_sms.h
+++ /dev/null
@@ -1,806 +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.
- */
-
-/*
- * ISSUES:
- *
- */
-
-/**
- * TODO
- *
- *
- */
-
-
-#ifndef ANDROID_RIL_CDMA_SMS_H
-#define ANDROID_RIL_CDMA_SMS_H 1
-
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Used by RIL_REQUEST_CDMA_SEND_SMS and RIL_UNSOL_RESPONSE_CDMA_NEW_SMS */
-
-#define RIL_CDMA_SMS_ADDRESS_MAX     36
-#define RIL_CDMA_SMS_SUBADDRESS_MAX  36
-#define RIL_CDMA_SMS_BEARER_DATA_MAX 255
-
-typedef enum {
-    RIL_CDMA_SMS_DIGIT_MODE_4_BIT = 0,     /* DTMF digits */
-    RIL_CDMA_SMS_DIGIT_MODE_8_BIT = 1,
-    RIL_CDMA_SMS_DIGIT_MODE_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
-} RIL_CDMA_SMS_DigitMode;
-
-typedef enum {
-    RIL_CDMA_SMS_NUMBER_MODE_NOT_DATA_NETWORK = 0,
-    RIL_CDMA_SMS_NUMBER_MODE_DATA_NETWORK     = 1,
-    RIL_CDMA_SMS_NUMBER_MODE_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
-} RIL_CDMA_SMS_NumberMode;
-
-typedef enum {
-    RIL_CDMA_SMS_NUMBER_TYPE_UNKNOWN                   = 0,
-    RIL_CDMA_SMS_NUMBER_TYPE_INTERNATIONAL_OR_DATA_IP  = 1,
-      /* INTERNATIONAL is used when number mode is not data network address.
-       * DATA_IP is used when the number mode is data network address
-       */
-    RIL_CDMA_SMS_NUMBER_TYPE_NATIONAL_OR_INTERNET_MAIL = 2,
-      /* NATIONAL is used when the number mode is not data network address.
-       * INTERNET_MAIL is used when the number mode is data network address.
-       * For INTERNET_MAIL, in the address data "digits", each byte contains
-       * an ASCII character. Examples are "x@y.com,a@b.com - ref TIA/EIA-637A 3.4.3.3
-       */
-    RIL_CDMA_SMS_NUMBER_TYPE_NETWORK                   = 3,
-    RIL_CDMA_SMS_NUMBER_TYPE_SUBSCRIBER                = 4,
-    RIL_CDMA_SMS_NUMBER_TYPE_ALPHANUMERIC              = 5,
-      /* GSM SMS: address value is GSM 7-bit chars */
-    RIL_CDMA_SMS_NUMBER_TYPE_ABBREVIATED               = 6,
-    RIL_CDMA_SMS_NUMBER_TYPE_RESERVED_7                = 7,
-    RIL_CDMA_SMS_NUMBER_TYPE_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
-} RIL_CDMA_SMS_NumberType;
-
-typedef enum {
-    RIL_CDMA_SMS_NUMBER_PLAN_UNKNOWN     = 0,
-    RIL_CDMA_SMS_NUMBER_PLAN_TELEPHONY   = 1,      /* CCITT E.164 and E.163, including ISDN plan */
-    RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_2  = 2,
-    RIL_CDMA_SMS_NUMBER_PLAN_DATA        = 3,      /* CCITT X.121 */
-    RIL_CDMA_SMS_NUMBER_PLAN_TELEX       = 4,      /* CCITT F.69 */
-    RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_5  = 5,
-    RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_6  = 6,
-    RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_7  = 7,
-    RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_8  = 8,
-    RIL_CDMA_SMS_NUMBER_PLAN_PRIVATE     = 9,
-    RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_10 = 10,
-    RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_11 = 11,
-    RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_12 = 12,
-    RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_13 = 13,
-    RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_14 = 14,
-    RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_15 = 15,
-    RIL_CDMA_SMS_NUMBER_PLAN_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
-} RIL_CDMA_SMS_NumberPlan;
-
-typedef struct {
-    RIL_CDMA_SMS_DigitMode digit_mode;
-      /* Indicates 4-bit or 8-bit */
-    RIL_CDMA_SMS_NumberMode number_mode;
-      /* Used only when digitMode is 8-bit */
-    RIL_CDMA_SMS_NumberType number_type;
-      /* Used only when digitMode is 8-bit.
-       * To specify an international address, use the following:
-       * digitMode = RIL_CDMA_SMS_DIGIT_MODE_8_BIT
-       * numberMode = RIL_CDMA_SMS_NOT_DATA_NETWORK
-       * numberType = RIL_CDMA_SMS_NUMBER_TYPE_INTERNATIONAL_OR_DATA_IP
-       * numberPlan = RIL_CDMA_SMS_NUMBER_PLAN_TELEPHONY
-       * numberOfDigits = number of digits
-       * digits = ASCII digits, e.g. '1', '2', '3'3, '4', and '5'
-       */
-    RIL_CDMA_SMS_NumberPlan number_plan;
-      /* Used only when digitMode is 8-bit */
-    unsigned char number_of_digits;
-    unsigned char digits[ RIL_CDMA_SMS_ADDRESS_MAX ];
-      /* Each byte in this array represnts a 40bit or 8-bit digit of address data */
-} RIL_CDMA_SMS_Address;
-
-typedef enum {
-    RIL_CDMA_SMS_SUBADDRESS_TYPE_NSAP           = 0,    /* CCITT X.213 or ISO 8348 AD2 */
-    RIL_CDMA_SMS_SUBADDRESS_TYPE_USER_SPECIFIED = 1,    /* e.g. X.25 */
-    RIL_CDMA_SMS_SUBADDRESS_TYPE_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
-} RIL_CDMA_SMS_SubaddressType;
-
-typedef struct {
-    RIL_CDMA_SMS_SubaddressType subaddressType;
-    /* 1 means the last byte's lower 4 bits should be ignored */
-    unsigned char odd;
-    unsigned char number_of_digits;
-    /* Each byte respresents a 8-bit digit of subaddress data */
-    unsigned char digits[ RIL_CDMA_SMS_SUBADDRESS_MAX ];
-} RIL_CDMA_SMS_Subaddress;
-
-typedef struct {
-    int uTeleserviceID;
-    unsigned char bIsServicePresent;
-    int uServicecategory;
-    RIL_CDMA_SMS_Address sAddress;
-    RIL_CDMA_SMS_Subaddress sSubAddress;
-    int uBearerDataLen;
-    unsigned char aBearerData[ RIL_CDMA_SMS_BEARER_DATA_MAX ];
-} RIL_CDMA_SMS_Message;
-
-/* Used by RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE */
-
-typedef enum {
-    RIL_CDMA_SMS_NO_ERROR       = 0,
-    RIL_CDMA_SMS_ERROR          = 1,
-    RIL_CDMA_SMS_ERROR_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
-} RIL_CDMA_SMS_ErrorClass;
-
-typedef struct {
-    RIL_CDMA_SMS_ErrorClass uErrorClass;
-    int uSMSCauseCode;  /* As defined in N.S00005, 6.5.2.125.
-                           Currently, only 35 (resource shortage) and
-                           39 (other terminal problem) are reported. */
-} RIL_CDMA_SMS_Ack;
-
-/* Used by RIL_REQUEST_CDMA_SMS_GET_BROADCAST_CONFIG and
-   RIL_REQUEST_CDMA_SMS_SET_BROADCAST_CONFIG */
-
-typedef struct {
-    int service_category;
-    int language;
-    unsigned char selected;
-} RIL_CDMA_BroadcastSmsConfigInfo;
-
-/* Used by RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM */
-
-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"      */
-
-    RIL_CDMA_SMS_Message message;
-} RIL_CDMA_SMS_WriteArgs;
-
-
-/* Used by RIL_REQUEST_ENCODE_CDMA_SMS and RIL_REQUEST_DECODE_CDMA_SMS*/
-
-#define RIL_CDMA_SMS_UDH_MAX_SND_SIZE           128
-#define RIL_CDMA_SMS_UDH_EO_DATA_SEGMENT_MAX    131 /* 140 - 3 - 6 */
-#define RIL_CDMA_SMS_MAX_UD_HEADERS         7
-#define RIL_CDMA_SMS_USER_DATA_MAX     229
-#define RIL_CDMA_SMS_ADDRESS_MAX            36
-#define RIL_CDMA_SMS_UDH_LARGE_PIC_SIZE     128
-#define RIL_CDMA_SMS_UDH_SMALL_PIC_SIZE     32
-#define RIL_CDMA_SMS_UDH_VAR_PIC_SIZE       134
-#define RIL_CDMA_SMS_UDH_ANIM_NUM_BITMAPS   4
-#define RIL_CDMA_SMS_UDH_LARGE_BITMAP_SIZE  32
-#define RIL_CDMA_SMS_UDH_SMALL_BITMAP_SIZE  8
-#define RIL_CDMA_SMS_UDH_OTHER_SIZE         226
-#define RIL_CDMA_SMS_IP_ADDRESS_SIZE        4
-
-/* ------------------- */
-/* ---- User Data ---- */
-/* ------------------- */
-typedef enum {
-    RIL_CDMA_SMS_UDH_CONCAT_8         = 0x00,
-    RIL_CDMA_SMS_UDH_SPECIAL_SM,
-    /* 02 - 03    Reserved */
-    RIL_CDMA_SMS_UDH_PORT_8           = 0x04,
-    RIL_CDMA_SMS_UDH_PORT_16,
-    RIL_CDMA_SMS_UDH_SMSC_CONTROL,
-    RIL_CDMA_SMS_UDH_SOURCE,
-    RIL_CDMA_SMS_UDH_CONCAT_16,
-    RIL_CDMA_SMS_UDH_WCMP,
-    RIL_CDMA_SMS_UDH_TEXT_FORMATING,
-    RIL_CDMA_SMS_UDH_PRE_DEF_SOUND,
-    RIL_CDMA_SMS_UDH_USER_DEF_SOUND,
-    RIL_CDMA_SMS_UDH_PRE_DEF_ANIM,
-    RIL_CDMA_SMS_UDH_LARGE_ANIM,
-    RIL_CDMA_SMS_UDH_SMALL_ANIM,
-    RIL_CDMA_SMS_UDH_LARGE_PICTURE,
-    RIL_CDMA_SMS_UDH_SMALL_PICTURE,
-    RIL_CDMA_SMS_UDH_VAR_PICTURE,
-
-    RIL_CDMA_SMS_UDH_USER_PROMPT      = 0x13,
-    RIL_CDMA_SMS_UDH_EXTENDED_OBJECT  = 0x14,
-
-    /* 15 - 1F    Reserved for future EMS */
-
-    RIL_CDMA_SMS_UDH_RFC822           = 0x20,
-
-    /*  21 - 6F    Reserved for future use */
-    /*  70 - 7f    Reserved for (U)SIM Toolkit Security Headers */
-    /*  80 - 9F    SME to SME specific use */
-    /*  A0 - BF    Reserved for future use */
-    /*  C0 - DF    SC specific use */
-    /*  E0 - FF    Reserved for future use */
-
-    RIL_CDMA_SMS_UDH_OTHER            = 0xFFFF, /* For unsupported or proprietary headers */
-    RIL_CDMA_SMS_UDH_ID_MAX32 = 0x10000000   /* Force constant ENUM size in structures */
-
-} RIL_CDMA_SMS_UdhId;
-
-typedef struct {
-    /*indicates the reference number for a particular concatenated short message. */
-    /*it is constant for every short message which makes up a particular concatenated short message*/
-    unsigned char       msg_ref;
-
-    /*indicates the total number of short messages within the concatenated short message.
-     The value shall start at 1 and remain constant for every
-     short message which makes up the concatenated short message.
-     if it is 0 then the receiving entity shall ignore the whole Information Element*/
-    unsigned char       total_sm;
-
-    /*
-     * it indicates the sequence number of a particular short message within the concatenated short
-     * message. The value shall start at 1 and increment by one for every short message sent
-     * within the concatenated short message. If the value is zero or the value is
-     * greater than the value in octet 2 then the receiving
-     * entity shall ignore the whole Information Element.
-     */
-    unsigned char      seq_num;
-} RIL_CDMA_SMS_UdhConcat8;
-
-/* GW message waiting actions
-*/
-typedef enum {
-    RIL_CDMA_SMS_GW_MSG_WAITING_NONE,
-    RIL_CDMA_SMS_GW_MSG_WAITING_DISCARD,
-    RIL_CDMA_SMS_GW_MSG_WAITING_STORE,
-    RIL_CDMA_SMS_GW_MSG_WAITING_NONE_1111,
-    RIL_CDMA_SMS_GW_MSG_WAITING_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
-} RIL_CDMA_SMS_GWMsgWaiting;
-
-/* GW message waiting types
-*/
-typedef enum {
-    RIL_CDMA_SMS_GW_MSG_WAITING_VOICEMAIL,
-    RIL_CDMA_SMS_GW_MSG_WAITING_FAX,
-    RIL_CDMA_SMS_GW_MSG_WAITING_EMAIL,
-    RIL_CDMA_SMS_GW_MSG_WAITING_OTHER,
-    RIL_CDMA_SMS_GW_MSG_WAITING_KIND_MAX32 = 0x10000000   /* Force constant ENUM size in structures */
-} RIL_CDMA_SMS_GWMsgWaitingKind;
-
-typedef struct {
-    RIL_CDMA_SMS_GWMsgWaiting                 msg_waiting;
-    RIL_CDMA_SMS_GWMsgWaitingKind             msg_waiting_kind;
-
-    /*it indicates the number of messages of the type specified in Octet 1 waiting.*/
-    unsigned char                             message_count;
-} RIL_CDMA_SMS_UdhSpecialSM;
-
-typedef struct {
-    unsigned char  dest_port;
-    unsigned char  orig_port;
-} RIL_CDMA_SMS_UdhWap8;
-
-typedef struct {
-    unsigned short  dest_port;
-    unsigned short  orig_port;
-} RIL_CDMA_SMS_UdhWap16;
-
-typedef struct {
-    unsigned short      msg_ref;
-    unsigned char       total_sm;
-    unsigned char       seq_num;
-
-} RIL_CDMA_SMS_UdhConcat16;
-
-typedef enum {
-    RIL_CDMA_SMS_UDH_LEFT_ALIGNMENT = 0,
-    RIL_CDMA_SMS_UDH_CENTER_ALIGNMENT,
-    RIL_CDMA_SMS_UDH_RIGHT_ALIGNMENT,
-    RIL_CDMA_SMS_UDH_DEFAULT_ALIGNMENT,
-    RIL_CDMA_SMS_UDH_MAX_ALIGNMENT,
-    RIL_CDMA_SMS_UDH_ALIGNMENT_MAX32 = 0x10000000   /* Force constant ENUM size in structures */
-} RIL_CDMA_SMS_UdhAlignment;
-
-typedef enum {
-    RIL_CDMA_SMS_UDH_FONT_NORMAL = 0,
-    RIL_CDMA_SMS_UDH_FONT_LARGE,
-    RIL_CDMA_SMS_UDH_FONT_SMALL,
-    RIL_CDMA_SMS_UDH_FONT_RESERVED,
-    RIL_CDMA_SMS_UDH_FONT_MAX,
-    RIL_CDMA_SMS_UDH_FONT_MAX32 = 0x10000000   /* Force constant ENUM size in structures */
-} RIL_CDMA_SMS_UdhFontSize;
-
-typedef enum {
-    RIL_CDMA_SMS_UDH_TEXT_COLOR_BLACK          = 0x0,
-    RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_GREY      = 0x1,
-    RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_RED       = 0x2,
-    RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_YELLOW    = 0x3,
-    RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_GREEN     = 0x4,
-    RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_CYAN      = 0x5,
-    RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_BLUE      = 0x6,
-    RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_MAGENTA   = 0x7,
-    RIL_CDMA_SMS_UDH_TEXT_COLOR_GREY           = 0x8,
-    RIL_CDMA_SMS_UDH_TEXT_COLOR_WHITE          = 0x9,
-    RIL_CDMA_SMS_UDH_TEXT_COLOR_BRIGHT_RED     = 0xA,
-    RIL_CDMA_SMS_UDH_TEXT_COLOR_BRIGHT_YELLOW  = 0xB,
-    RIL_CDMA_SMS_UDH_TEXT_COLOR_BRIGHT_GREEN   = 0xC,
-    RIL_CDMA_SMS_UDH_TEXT_COLOR_BRIGHT_CYAN    = 0xD,
-    RIL_CDMA_SMS_UDH_TEXT_COLOR_BRIGHT_BLUE    = 0xE,
-    RIL_CDMA_SMS_UDH_TEXT_COLOR_BRIGHT_MAGENTA = 0xF,
-    RIL_CDMA_SMS_UDH_TEXT_COLOR_MAX32 = 0x10000000   /* Force constant ENUM size in structures */
-} RIL_CDMA_SMS_UdhTextColor;
-
-typedef struct {
-    unsigned char              start_position;
-    unsigned char              text_formatting_length;
-    RIL_CDMA_SMS_UdhAlignment  alignment_type ;       /*bit 0 and  bit 1*/
-    RIL_CDMA_SMS_UdhFontSize   font_size ;            /*bit 3 and  bit 2*/
-    unsigned char              style_bold;            /*bit 4 */
-    unsigned char              style_italic;          /*bit 5  */
-    unsigned char              style_underlined;      /*bit 6 */
-    unsigned char              style_strikethrough;   /*bit 7 */
-
-    /* if FALSE, ignore the following color information */
-    unsigned char              is_color_present;
-    RIL_CDMA_SMS_UdhTextColor  text_color_foreground;
-    RIL_CDMA_SMS_UdhTextColor  text_color_background;
-
-} RIL_CDMA_SMS_UdhTextFormating;
-
-/* Predefined sound
-*/
-typedef struct {
-    unsigned char       position;
-    unsigned char       snd_number;
-} RIL_CDMA_SMS_UdhPreDefSound;
-
-/* User Defined sound
-*/
-typedef struct {
-    unsigned char       data_length;
-    unsigned char       position;
-    unsigned char       user_def_sound[RIL_CDMA_SMS_UDH_MAX_SND_SIZE];
-} RIL_CDMA_SMS_UdhUserDefSound;
-
-/* Large picture
-*/
-typedef struct {
-    unsigned char       position;
-    unsigned char       data[RIL_CDMA_SMS_UDH_LARGE_PIC_SIZE];
-} RIL_CDMA_SMS_UdhLargePictureData;
-
-/* Small picture
-*/
-typedef struct {
-    unsigned char       position;
-    unsigned char       data[RIL_CDMA_SMS_UDH_SMALL_PIC_SIZE];
-} RIL_CDMA_SMS_UdhSmallPictureData;
-
-/* Variable length picture
-*/
-typedef struct {
-    unsigned char       position;
-    unsigned char       width;    /* Number of pixels - Should be a mutliple of 8 */
-    unsigned char       height;
-    unsigned char       data[RIL_CDMA_SMS_UDH_VAR_PIC_SIZE];
-} RIL_CDMA_SMS_UdhVarPicture;
-
-/* Predefined animation
-*/
-typedef struct {
-    unsigned char       position;
-    unsigned char       animation_number;
-} RIL_CDMA_SMS_UdhPreDefAnim;
-
-/* Large animation
-*/
-typedef struct {
-    unsigned char       position;
-    unsigned char       data[RIL_CDMA_SMS_UDH_ANIM_NUM_BITMAPS][RIL_CDMA_SMS_UDH_LARGE_BITMAP_SIZE];
-} RIL_CDMA_SMS_UdhLargeAnim;
-
-/* Small animation
-*/
-typedef struct {
-    unsigned char       position;
-    unsigned char       data[RIL_CDMA_SMS_UDH_ANIM_NUM_BITMAPS][RIL_CDMA_SMS_UDH_SMALL_BITMAP_SIZE];
-} RIL_CDMA_SMS_UdhSmallAnim;
-
-/* User Prompt Indicator UDH
-*/
-typedef struct {
-    unsigned char       number_of_objects;
-    /* Number of objects of the same kind that follow this header which will
-    ** be stitched together by the applications. For example, 5 small pictures
-    ** are to be stitched together horizontally, or 6 iMelody tones are to be
-    ** connected together with intermediate iMelody header and footer ignored.
-    ** Allowed objects to be stitched:
-    **   - Images (small, large, variable)
-    **   - User defined sounds
-    */
-} RIL_CDMA_SMS_UdhUserPrompt;
-
-typedef struct {
-    unsigned char         length;
-
-    unsigned char         data[RIL_CDMA_SMS_UDH_EO_DATA_SEGMENT_MAX];
-    /* RIL_CDMA_SMS_UDH_EO_VCARD: See http://www.imc.org/pdi/vcard-21.doc for payload */
-    /* RIL_CDMA_SMS_UDH_EO_VCALENDAR: See http://www.imc.org/pdi/vcal-10.doc */
-    /* Or: Unsupported/proprietary extended objects */
-
-} RIL_CDMA_SMS_UdhEoContent;
-
-/* Extended Object UDH
-*/
-/* Extended Object IDs/types
-*/
-typedef enum {
-    RIL_CDMA_SMS_UDH_EO_VCARD                   = 0x09,
-    RIL_CDMA_SMS_UDH_EO_VCALENDAR               = 0x0A,
-    RIL_CDMA_SMS_UDH_EO_MAX32 = 0x10000000   /* Force constant ENUM size in structures */
-} RIL_CDMA_SMS_UdhEoId;
-
-typedef struct {
-    /* Extended objects are to be used together with 16-bit concatenation
-    ** UDH. The max number of segments supported for E.O. is 8 at least.
-    */
-    RIL_CDMA_SMS_UdhEoContent    content;
-
-    unsigned char                                 first_segment;
-    /* The following fields are only present in the first segment of a
-    ** concatenated SMS message.
-    */
-   unsigned char                                   reference;
-    /* Identify those extended object segments which should be linked together
-    */
-   unsigned short                                  length;
-    /* Length of the whole extended object data
-    */
-    unsigned char                                   control;
-    RIL_CDMA_SMS_UdhEoId                    type;
-    unsigned short                                  position;
-    /* Absolute position of the E.O. in the whole text after concatenation,
-    ** starting from 1.
-    */
-} RIL_CDMA_SMS_UdhEo;
-
-typedef struct {
-    RIL_CDMA_SMS_UdhId  header_id;
-    unsigned char               header_length;
-    unsigned char              data[RIL_CDMA_SMS_UDH_OTHER_SIZE];
-} RIL_CDMA_SMS_UdhOther;
-
-typedef struct {
-    unsigned char        header_length;
-} RIL_CDMA_SMS_UdhRfc822;
-
-typedef struct {
-    RIL_CDMA_SMS_UdhId                header_id;
-
-    union {
-        RIL_CDMA_SMS_UdhConcat8             concat_8;       // 00
-
-        RIL_CDMA_SMS_UdhSpecialSM           special_sm;     // 01
-        RIL_CDMA_SMS_UdhWap8                wap_8;          // 04
-        RIL_CDMA_SMS_UdhWap16               wap_16;         // 05
-        RIL_CDMA_SMS_UdhConcat16            concat_16;      // 08
-        RIL_CDMA_SMS_UdhTextFormating       text_formating; // 0a
-        RIL_CDMA_SMS_UdhPreDefSound         pre_def_sound;  // 0b
-        RIL_CDMA_SMS_UdhUserDefSound        user_def_sound; // 0c
-        RIL_CDMA_SMS_UdhPreDefAnim          pre_def_anim;   // 0d
-        RIL_CDMA_SMS_UdhLargeAnim           large_anim;     // 0e
-        RIL_CDMA_SMS_UdhSmallAnim           small_anim;     // 0f
-        RIL_CDMA_SMS_UdhLargePictureData    large_picture;  // 10
-        RIL_CDMA_SMS_UdhSmallPictureData    small_picture;  // 11
-        RIL_CDMA_SMS_UdhVarPicture          var_picture;    // 12
-
-        RIL_CDMA_SMS_UdhUserPrompt          user_prompt;    // 13
-        RIL_CDMA_SMS_UdhEo                  eo;             // 14
-
-        RIL_CDMA_SMS_UdhRfc822              rfc822;         // 20
-        RIL_CDMA_SMS_UdhOther               other;
-
-    }u;
-} RIL_CDMA_SMS_Udh;
-
-/* ----------------------------- */
-/* -- User data encoding type -- */
-/* ----------------------------- */
-typedef enum {
-    RIL_CDMA_SMS_ENCODING_OCTET        = 0,    /* 8-bit */
-    RIL_CDMA_SMS_ENCODING_IS91EP,              /* varies */
-    RIL_CDMA_SMS_ENCODING_ASCII,               /* 7-bit */
-    RIL_CDMA_SMS_ENCODING_IA5,                 /* 7-bit */
-    RIL_CDMA_SMS_ENCODING_UNICODE,             /* 16-bit */
-    RIL_CDMA_SMS_ENCODING_SHIFT_JIS,           /* 8 or 16-bit */
-    RIL_CDMA_SMS_ENCODING_KOREAN,              /* 8 or 16-bit */
-    RIL_CDMA_SMS_ENCODING_LATIN_HEBREW,        /* 8-bit */
-    RIL_CDMA_SMS_ENCODING_LATIN,               /* 8-bit */
-    RIL_CDMA_SMS_ENCODING_GSM_7_BIT_DEFAULT,   /* 7-bit */
-    RIL_CDMA_SMS_ENCODING_MAX32        = 0x10000000
-
-} RIL_CDMA_SMS_UserDataEncoding;
-
-/* ------------------------ */
-/* -- IS-91 EP data type -- */
-/* ------------------------ */
-typedef enum {
-    RIL_CDMA_SMS_IS91EP_VOICE_MAIL         = 0x82,
-    RIL_CDMA_SMS_IS91EP_SHORT_MESSAGE_FULL = 0x83,
-    RIL_CDMA_SMS_IS91EP_CLI_ORDER          = 0x84,
-    RIL_CDMA_SMS_IS91EP_SHORT_MESSAGE      = 0x85,
-    RIL_CDMA_SMS_IS91EP_MAX32              = 0x10000000
-
-} RIL_CDMA_SMS_IS91EPType;
-
-typedef struct {
-    /* NOTE: If message_id.udh_present == TRUE:
-    **       'num_headers' is the number of User Data Headers (UDHs),
-    **       and 'headers' include all those headers.
-    */
-    unsigned char                              num_headers;
-    RIL_CDMA_SMS_Udh                     headers[RIL_CDMA_SMS_MAX_UD_HEADERS];
-
-    RIL_CDMA_SMS_UserDataEncoding      encoding;
-    RIL_CDMA_SMS_IS91EPType             is91ep_type;
-
-    /*----------------------------------------------------------------------
-     'data_len' indicates the valid number of bytes in the 'data' array.
-
-     'padding_bits' (0-7) indicates how many bits in the last byte of 'data'
-     are invalid bits. This parameter is only used for Mobile-Originated
-     messages. There is no way for the API to tell how many padding bits
-     exist in the received message. Instead, the application can find out how
-     many padding bits exist in the user data when decoding the user data.
-
-     'data' has the raw bits of the user data field of the SMS message.
-     The client software should decode the raw user data according to its
-     supported encoding types and languages.
-
-     EXCEPTION 1: CMT-91 user data raw bits are first translated into BD fields
-     (e.g. num_messages, callback, etc.) The translated user data field in
-     VMN and Short Message is in the form of ASCII characters, each occupying
-     a byte in the resulted 'data'.
-
-     EXCEPTION 2: GSM 7-bit Default characters are decoded so that each byte
-     has one 7-bit GSM character.
-
-     'number_of_digits' is the number of digits/characters (7, 8, 16, or
-     whatever bits) in the raw user data, which can be used by the client
-     when decoding the user data according to the encoding type and language.
-    -------------------------------------------------------------------------*/
-    unsigned char                                data_len;
-    unsigned char                                padding_bits;
-    unsigned char                                data[ RIL_CDMA_SMS_USER_DATA_MAX ];
-    unsigned char                                number_of_digits;
-
-} RIL_CDMA_SMS_CdmaUserData;
-
-/* -------------------- */
-/* ---- Message Id ---- */
-/* -------------------- */
-typedef enum {
-    RIL_CDMA_SMS_BD_TYPE_RESERVED_0     = 0,
-    RIL_CDMA_SMS_BD_TYPE_DELIVER,       /* MT only */
-    RIL_CDMA_SMS_BD_TYPE_SUBMIT,        /* MO only */
-    RIL_CDMA_SMS_BD_TYPE_CANCELLATION,  /* MO only */
-    RIL_CDMA_SMS_BD_TYPE_DELIVERY_ACK,  /* MT only */
-    RIL_CDMA_SMS_BD_TYPE_USER_ACK,      /* MT & MO */
-    RIL_CDMA_SMS_BD_TYPE_READ_ACK,      /* MT & MO */
-    RIL_CDMA_SMS_BD_TYPE_MAX32          = 0x10000000
-
-} RIL_CDMA_SMS_BdMessageType;
-
-typedef unsigned int  RIL_CDMA_SMS_MessageNumber;
-
-typedef struct {
-    RIL_CDMA_SMS_BdMessageType   type;
-    RIL_CDMA_SMS_MessageNumber      id_number;
-    unsigned char                      udh_present;
-    /* NOTE: if FEATURE_SMS_UDH is not defined,
-    ** udh_present should be ignored.
-    */
-} RIL_CDMA_SMS_MessageId;
-
-typedef unsigned char           RIL_CDMA_SMS_UserResponse;
-
-/* ------------------- */
-/* ---- Timestamp ---- */
-/* ------------------- */
-typedef struct {
-    /* If 'year' is between 96 and 99, the actual year is 1900 + 'year';
-       if 'year' is between 00 and 95, the actual year is 2000 + 'year'.
-       NOTE: Each field has two BCD digits and byte arrangement is <MSB, ... ,LSB>
-    */
-    unsigned char      year;        /* 0x00-0x99 */
-    unsigned char      month;       /* 0x01-0x12 */
-    unsigned char      day;         /* 0x01-0x31 */
-    unsigned char      hour;        /* 0x00-0x23 */
-    unsigned char      minute;      /* 0x00-0x59 */
-    unsigned char      second;      /* 0x00-0x59 */
-    signed char      timezone;    /* +/-, [-48,+48] number of 15 minutes - GW only */
-} RIL_CDMA_SMS_Timestamp;
-
-/* ------------------ */
-/* ---- Priority ---- */
-/* ------------------ */
-typedef enum {
-    RIL_CDMA_SMS_PRIORITY_NORMAL      = 0,
-    RIL_CDMA_SMS_PRIORITY_INTERACTIVE,
-    RIL_CDMA_SMS_PRIORITY_URGENT,
-    RIL_CDMA_SMS_PRIORITY_EMERGENCY,
-    RIL_CDMA_SMS_PRIORITY_MAX32       = 0x10000000
-
-} RIL_CDMA_SMS_Priority;
-
-/* ----------------- */
-/* ---- Privacy ---- */
-/* ----------------- */
-typedef enum {
-    RIL_CDMA_SMS_PRIVACY_NORMAL      = 0,
-    RIL_CDMA_SMS_PRIVACY_RESTRICTED,
-    RIL_CDMA_SMS_PRIVACY_CONFIDENTIAL,
-    RIL_CDMA_SMS_PRIVACY_SECRET,
-    RIL_CDMA_SMS_PRIVACY_MAX32       = 0x10000000
-
-} RIL_CDMA_SMS_Privacy;
-
-/* ---------------------- */
-/* ---- Reply option ---- */
-/* ---------------------- */
-typedef struct {
-    /* whether user ack is requested
-    */
-    unsigned char          user_ack_requested;
-
-    /* whether delivery ack is requested.
-       Should be FALSE for incoming messages.
-    */
-    unsigned char          delivery_ack_requested;
-
-    /* Message originator requests the receiving phone to send back a READ_ACK
-    ** message automatically when the user reads the received message.
-    */
-    unsigned char          read_ack_requested;
-
-} RIL_CDMA_SMS_ReplyOption;
-
-typedef enum {
-    RIL_CDMA_SMS_ALERT_MODE_DEFAULT         = 0,
-    RIL_CDMA_SMS_ALERT_MODE_LOW_PRIORITY    = 1,
-    RIL_CDMA_SMS_ALERT_MODE_MEDIUM_PRIORITY = 2,
-    RIL_CDMA_SMS_ALERT_MODE_HIGH_PRIORITY   = 3,
-
-    /* For pre-IS637A implementations, alert_mode only has values of True/False:
-    */
-    RIL_CDMA_SMS_ALERT_MODE_OFF   = 0,
-    RIL_CDMA_SMS_ALERT_MODE_ON    = 1
-
-} RIL_CDMA_SMS_AlertMode;
-
-/* ------------------ */
-/* ---- Language ---- */
-/* ------------------ */
-typedef enum {
-    RIL_CDMA_SMS_LANGUAGE_UNSPECIFIED = 0,
-    RIL_CDMA_SMS_LANGUAGE_ENGLISH,
-    RIL_CDMA_SMS_LANGUAGE_FRENCH,
-    RIL_CDMA_SMS_LANGUAGE_SPANISH,
-    RIL_CDMA_SMS_LANGUAGE_JAPANESE,
-    RIL_CDMA_SMS_LANGUAGE_KOREAN,
-    RIL_CDMA_SMS_LANGUAGE_CHINESE,
-    RIL_CDMA_SMS_LANGUAGE_HEBREW,
-    RIL_CDMA_SMS_LANGUAGE_MAX32       = 0x10000000
-
-} RIL_CDMA_SMS_Language;
-
-/* ---------------------------------- */
-/* ---------- Display Mode ---------- */
-/* ---------------------------------- */
-typedef enum {
-    RIL_CDMA_SMS_DISPLAY_MODE_IMMEDIATE   = 0,
-    RIL_CDMA_SMS_DISPLAY_MODE_DEFAULT     = 1,
-    RIL_CDMA_SMS_DISPLAY_MODE_USER_INVOKE = 2,
-    RIL_CDMA_SMS_DISPLAY_MODE_RESERVED    = 3
-} RIL_CDMA_SMS_DisplayMode;
-
-/* IS-637B parameters/fields
-*/
-
-/* ---------------------------------- */
-/* ---------- Delivery Status ------- */
-/* ---------------------------------- */
-typedef enum {
-    RIL_CDMA_SMS_DELIVERY_STATUS_ACCEPTED              = 0,    /* ERROR_CLASS_NONE */
-    RIL_CDMA_SMS_DELIVERY_STATUS_DEPOSITED_TO_INTERNET = 1,    /* ERROR_CLASS_NONE */
-    RIL_CDMA_SMS_DELIVERY_STATUS_DELIVERED             = 2,    /* ERROR_CLASS_NONE */
-    RIL_CDMA_SMS_DELIVERY_STATUS_CANCELLED             = 3,    /* ERROR_CLASS_NONE */
-
-    RIL_CDMA_SMS_DELIVERY_STATUS_NETWORK_CONGESTION  = 4,    /* ERROR_CLASS_TEMP & PERM */
-    RIL_CDMA_SMS_DELIVERY_STATUS_NETWORK_ERROR       = 5,    /* ERROR_CLASS_TEMP & PERM */
-    RIL_CDMA_SMS_DELIVERY_STATUS_CANCEL_FAILED       = 6,    /* ERROR_CLASS_PERM */
-    RIL_CDMA_SMS_DELIVERY_STATUS_BLOCKED_DESTINATION = 7,    /* ERROR_CLASS_PERM */
-    RIL_CDMA_SMS_DELIVERY_STATUS_TEXT_TOO_LONG       = 8,    /* ERROR_CLASS_PERM */
-    RIL_CDMA_SMS_DELIVERY_STATUS_DUPLICATE_MESSAGE   = 9,    /* ERROR_CLASS_PERM */
-    RIL_CDMA_SMS_DELIVERY_STATUS_INVALID_DESTINATION = 10,   /* ERROR_CLASS_PERM */
-    RIL_CDMA_SMS_DELIVERY_STATUS_MESSAGE_EXPIRED     = 13,   /* ERROR_CLASS_PERM */
-
-    RIL_CDMA_SMS_DELIVERY_STATUS_UNKNOWN_ERROR       = 0x1F  /* ERROR_CLASS_PERM */
-
-    /* All the other values are reserved */
-
-} RIL_CDMA_SMS_DeliveryStatusE;
-
-typedef struct {
-    RIL_CDMA_SMS_ErrorClass       error_class;
-    RIL_CDMA_SMS_DeliveryStatusE   status;
-} RIL_CDMA_SMS_DeliveryStatus;
-
-typedef struct {
-    unsigned char               address[RIL_CDMA_SMS_IP_ADDRESS_SIZE];
-    unsigned char             is_valid;
-} RIL_CDMA_SMS_IpAddress;
-
-/* This special parameter captures any unrecognized/proprietary parameters
-*/
-typedef struct {
-    unsigned char                         input_other_len;
-    unsigned char                         desired_other_len; /* used during decoding */
-    unsigned char                         * other_data;
-} RIL_CDMA_SMS_OtherParm;
-
-typedef struct {
-    /* the mask indicates which fields are present in this message */
-    unsigned int                        mask;
-
-    RIL_CDMA_SMS_MessageId         message_id;
-    RIL_CDMA_SMS_CdmaUserData     user_data;
-    RIL_CDMA_SMS_UserResponse        user_response;
-    RIL_CDMA_SMS_Timestamp          mc_time;
-    RIL_CDMA_SMS_Timestamp          validity_absolute;
-    RIL_CDMA_SMS_Timestamp          validity_relative;
-    RIL_CDMA_SMS_Timestamp          deferred_absolute;
-    RIL_CDMA_SMS_Timestamp          deferred_relative;
-    RIL_CDMA_SMS_Priority           priority;
-    RIL_CDMA_SMS_Privacy            privacy;
-    RIL_CDMA_SMS_ReplyOption       reply_option;
-    unsigned char                         num_messages;  /* the actual value; not BCDs */
-    RIL_CDMA_SMS_AlertMode         alert_mode;
-     /* For pre-IS-637A implementations, alert_mode is either Off or On. */
-    RIL_CDMA_SMS_Language           language;
-    RIL_CDMA_SMS_Address            callback;
-    RIL_CDMA_SMS_DisplayMode       display_mode;
-
-    RIL_CDMA_SMS_DeliveryStatus    delivery_status;
-    unsigned int                        deposit_index;
-
-    RIL_CDMA_SMS_IpAddress         ip_address;
-    unsigned char                         rsn_no_notify;
-
-    /* See function comments of wms_ts_decode() and
-    ** wms_ts_decode_cdma_bd_with_other() for details regarding 'other' parameters
-    */
-    RIL_CDMA_SMS_OtherParm         other;
-
-} RIL_CDMA_SMS_ClientBd;
-
-typedef struct {
-    unsigned char length;   /* length, in bytes, of the encoded SMS message */
-    unsigned char * data;   /* the encoded SMS message (max 255 bytes) */
-} RIL_CDMA_Encoded_SMS;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*ANDROID_RIL_CDMA_SMS_H*/
diff --git a/power/Android.mk b/power/Android.mk
deleted file mode 100644
index 7304deb..0000000
--- a/power/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright (C) 2012 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.
-
-ifeq ($(TARGET_PROVIDES_POWERHAL),true)
-ifeq ($(BOARD_VENDOR),htc)
-ifeq ($(TARGET_BOARD_PLATFORM),msm8960)
-LOCAL_PATH := $(call my-dir)
-
-# HAL module implemenation stored in
-# hw/<POWERS_HARDWARE_MODULE_ID>.<ro.hardware>.so
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
-LOCAL_SHARED_LIBRARIES := liblog libcutils
-LOCAL_SRC_FILES := power.c
-LOCAL_MODULE := power.$(TARGET_BOARD_PLATFORM)
-LOCAL_MODULE_TAGS := optional
-include $(BUILD_SHARED_LIBRARY)
-
-endif # TARGET_BOARD_PLATFORM
-endif # BOARD_VENDOR
-endif # TARGET_PROVIDES_POWERHAL
diff --git a/power/power.c b/power/power.c
deleted file mode 100644
index 65c4d5a..0000000
--- a/power/power.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- * Copyright (c) 2012 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.
- */
-#include <errno.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#define LOG_TAG "CM PowerHAL"
-#include <utils/Log.h>
-
-#include <hardware/hardware.h>
-#include <hardware/power.h>
-
-#define SCALING_GOVERNOR_PATH "/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
-#define BOOSTPULSE_ONDEMAND "/sys/devices/system/cpu/cpufreq/ondemand/boostpulse"
-#define BOOSTPULSE_INTERACTIVE "/sys/devices/system/cpu/cpufreq/interactive/boostpulse"
-#define SAMPLING_RATE_SCREEN_ON "50000"
-#define SAMPLING_RATE_SCREEN_OFF "500000"
-#define TIMER_RATE_SCREEN_ON "30000"
-#define TIMER_RATE_SCREEN_OFF "500000"
-
-struct cm_power_module {
-    struct power_module base;
-    pthread_mutex_t lock;
-    int boostpulse_fd;
-    int boostpulse_warned;
-};
-
-static char governor[20];
-
-static int sysfs_read(char *path, char *s, int num_bytes)
-{
-    char buf[80];
-    int count;
-    int ret = 0;
-    int fd = open(path, O_RDONLY);
-
-    if (fd < 0) {
-        strerror_r(errno, buf, sizeof(buf));
-        ALOGE("Error opening %s: %s\n", path, buf);
-
-        return -1;
-    }
-
-    if ((count = read(fd, s, num_bytes - 1)) < 0) {
-        strerror_r(errno, buf, sizeof(buf));
-        ALOGE("Error writing to %s: %s\n", path, buf);
-
-        ret = -1;
-    } else {
-        s[count] = '\0';
-    }
-
-    close(fd);
-
-    return ret;
-}
-
-static void sysfs_write(char *path, char *s)
-{
-    char buf[80];
-    int len;
-    int fd = open(path, O_WRONLY);
-
-    if (fd < 0) {
-        strerror_r(errno, buf, sizeof(buf));
-        ALOGE("Error opening %s: %s\n", path, buf);
-        return;
-    }
-
-    len = write(fd, s, strlen(s));
-    if (len < 0) {
-        strerror_r(errno, buf, sizeof(buf));
-        ALOGE("Error writing to %s: %s\n", path, buf);
-    }
-
-    close(fd);
-}
-
-static int get_scaling_governor() {
-    if (sysfs_read(SCALING_GOVERNOR_PATH, governor,
-                sizeof(governor)) == -1) {
-        return -1;
-    } else {
-        // Strip newline at the end.
-        int len = strlen(governor);
-
-        len--;
-
-        while (len >= 0 && (governor[len] == '\n' || governor[len] == '\r'))
-            governor[len--] = '\0';
-    }
-
-    return 0;
-}
-
-static void cm_power_set_interactive(struct power_module *module, int on)
-{
-    if (strncmp(governor, "ondemand", 8) == 0)
-        sysfs_write("/sys/devices/system/cpu/cpufreq/ondemand/sampling_rate",
-                on ? SAMPLING_RATE_SCREEN_ON : SAMPLING_RATE_SCREEN_OFF);
-    else if (strncmp(governor, "interactive", 11) == 0)
-        sysfs_write("/sys/devices/system/cpu/cpufreq/interactive/timer_rate",
-                on ? TIMER_RATE_SCREEN_ON : TIMER_RATE_SCREEN_OFF);
-}
-
-
-static void configure_governor()
-{
-    cm_power_set_interactive(NULL, 1);
-
-    if (strncmp(governor, "ondemand", 8) == 0) {
-        sysfs_write("/sys/devices/system/cpu/cpufreq/ondemand/up_threshold", "90");
-        sysfs_write("/sys/devices/system/cpu/cpufreq/ondemand/io_is_busy", "1");
-        sysfs_write("/sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor", "4");
-        sysfs_write("/sys/devices/system/cpu/cpufreq/ondemand/down_differential", "10");
-
-    } else if (strncmp(governor, "interactive", 11) == 0) {
-        sysfs_write("/sys/devices/system/cpu/cpufreq/interactive/min_sample_time", "90000");
-        sysfs_write("/sys/devices/system/cpu/cpufreq/interactive/hispeed_freq", "1134000");
-        sysfs_write("/sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay", "30000");
-    }
-}
-
-static int boostpulse_open(struct cm_power_module *cm)
-{
-    char buf[80];
-
-    pthread_mutex_lock(&cm->lock);
-
-    if (cm->boostpulse_fd < 0) {
-        if (get_scaling_governor() < 0) {
-            ALOGE("Can't read scaling governor.");
-            cm->boostpulse_warned = 1;
-        } else {
-            if (strncmp(governor, "ondemand", 8) == 0)
-                cm->boostpulse_fd = open(BOOSTPULSE_ONDEMAND, O_WRONLY);
-            else if (strncmp(governor, "interactive", 11) == 0)
-                cm->boostpulse_fd = open(BOOSTPULSE_INTERACTIVE, O_WRONLY);
-
-            if (cm->boostpulse_fd < 0 && !cm->boostpulse_warned) {
-                strerror_r(errno, buf, sizeof(buf));
-                ALOGV("Error opening boostpulse: %s\n", buf);
-                cm->boostpulse_warned = 1;
-            } else if (cm->boostpulse_fd > 0) {
-                configure_governor();
-                ALOGD("Opened %s boostpulse interface", governor);
-            }
-        }
-    }
-
-    pthread_mutex_unlock(&cm->lock);
-    return cm->boostpulse_fd;
-}
-
-static void cm_power_hint(struct power_module *module, power_hint_t hint,
-                            void *data)
-{
-    struct cm_power_module *cm = (struct cm_power_module *) module;
-    char buf[80];
-    int len;
-    int duration = 1;
-
-    switch (hint) {
-    case POWER_HINT_INTERACTION:
-    case POWER_HINT_CPU_BOOST:
-        if (boostpulse_open(cm) >= 0) {
-            if (data != NULL)
-                duration = (int) data;
-
-            snprintf(buf, sizeof(buf), "%d", duration);
-            len = write(cm->boostpulse_fd, buf, strlen(buf));
-
-            if (len < 0) {
-                strerror_r(errno, buf, sizeof(buf));
-	            ALOGE("Error writing to boostpulse: %s\n", buf);
-
-                pthread_mutex_lock(&cm->lock);
-                close(cm->boostpulse_fd);
-                cm->boostpulse_fd = -1;
-                cm->boostpulse_warned = 0;
-                pthread_mutex_unlock(&cm->lock);
-            }
-        }
-        break;
-
-    case POWER_HINT_VSYNC:
-        break;
-
-    default:
-        break;
-    }
-}
-
-static void cm_power_init(struct power_module *module)
-{
-    get_scaling_governor();
-    configure_governor();
-}
-
-static struct hw_module_methods_t power_module_methods = {
-    .open = NULL,
-};
-
-struct cm_power_module HAL_MODULE_INFO_SYM = {
-    base: {
-        common: {
-            tag: HARDWARE_MODULE_TAG,
-            module_api_version: POWER_MODULE_API_VERSION_0_2,
-            hal_api_version: HARDWARE_HAL_API_VERSION,
-            id: POWER_HARDWARE_MODULE_ID,
-            name: "CM Power HAL",
-            author: "The CyanogenMod Project",
-            methods: &power_module_methods,
-        },
-       init: cm_power_init,
-       setInteractive: cm_power_set_interactive,
-       powerHint: cm_power_hint,
-    },
-
-    lock: PTHREAD_MUTEX_INITIALIZER,
-    boostpulse_fd: -1,
-    boostpulse_warned: 0,
-};
diff --git a/ramdisk/init b/ramdisk/init
deleted file mode 100644
index 1fa96df..0000000
--- a/ramdisk/init
+++ /dev/null
Binary files differ
diff --git a/ramdisk/init.m7.rc b/ramdisk/init.m7.rc
deleted file mode 100644
index 75296e7..0000000
--- a/ramdisk/init.m7.rc
+++ /dev/null
@@ -1,720 +0,0 @@
-# Copyright (c) 2011, Code Aurora Forum. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#     * Redistributions of source code must retain the above copyright
-#       notice, this list of conditions and the following disclaimer.
-#     * Redistributions in binary form must reproduce the above
-#       copyright notice, this list of conditions and the following
-#       disclaimer in the documentation and/or other materials provided
-#       with the distribution.
-#     * Neither the name of Code Aurora Forum, Inc. nor the names of its
-#       contributors may be used to endorse or promote products derived
-#       from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-# ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-#
-# Start camera server as daemon
-service qcamerasvr /system/bin/mm-qcamera-daemon
-        class late_start
-        user system
-        group system camera inet graphics
-
-# On emmc mount the partition containing firmware
-on emmc-fs
-   mkdir /system
-   devwait emmc@system
-   mount ext4 emmc@system /system ro noatime barrier=0
-
-   # Load Mocana FIPS module. Add here since it can make sure system is mounted
-   insmod /system/lib/modules/moc_platform_mod.ko
-   insmod /system/lib/modules/moc_crypto.ko
-   insmod /system/lib/modules/dm-crypt.ko
-
-   mkdir /data 0771 system system
-   devwait emmc@userdata
-   mount_all /fstab.m7
-
-   mkdir /cache 0770 system cache
-   devwait emmc@cache
-   mount ext4 emmc@cache /cache nosuid nodev noatime barrier=0
-
-   mkdir /devlog 0700 root root
-   devwait emmc@devlog
-   e2fsck emmc@devlog
-   mount ext4 emmc@devlog /devlog nosuid nodev noatime barrier=0,errors=continue
-
-   mkdir /ramdump 0700 root root
-   devwait emmc@reserve
-   mount vfat emmc@reserve /ramdump rw
-   umount /ramdump
-
-   mkdir /data/tombstones 0771 system system
-   symlink /data/tombstones /tombstones
-   mkdir /tombstones/mdm 0771 system system
-   mkdir /tombstones/modem 0771 system system
-   mkdir /tombstones/lpass 0771 system system
-   mkdir /tombstones/dsps 0771 system system
-
-   # For firmwares
-   mkdir /firmware 0771 system system
-   mkdir /vendor 0771 system system
-   mkdir /vendor/firmware 0771 system system
-
-   # 8064 has only mdm, use radio partition for it.
-   mkdir /firmware/mdm 0771 system system
-
-   mkdir /data/qcks 0700 root system
-   mount tmpfs tmpfs /data/qcks size=20m,mode=0750,gid=1000
-
-   mkdir /data/efs 0700 root system
-   mount tmpfs tmpfs /data/efs size=20m,mode=0750,gid=1000
-
-   # 8064 need to created this folder for CSD-QMI usage
-   mkdir /data/audio 0775 media audio
-   chmod 2775 /data/audio
-
-   mkdir /firmware/q6 0771 system system
-
-   # Link widevine drm library path
-   symlink /system/vendor/lib /vendor/lib
-
-   mkdir /storage 0050 system sdcard_r
-   mkdir /storage/sdcard0 0000 system system
-   mkdir /storage/usb 0000 system system
-
-on init
-    # For Invense MPU3050
-    chmod 0664 /dev/mpu
-    chmod 0664 /dev/mpuirq
-    chmod 0664 /dev/timerirq
-    chmod 0664 /sys/class/gyro_sensors/gyro/mpu_lpm_flag
-    chown system system /dev/mpu
-    chown system system /dev/mpuirq
-    chown system system /dev/timerirq
-    chown system system /sys/class/gyro_sensors/gyro/mpu_lpm_flag
-
-    # For ST R3GD20
-    chown system system /sys/class/htc_gyro/gyro/enable_device
-    chown system system /sys/class/htc_gyro/gyro/pollrate_ms
-    chown system system /sys/class/htc_gyro/gyro/range
-    chown system system /sys/class/htc_gyro/gyro/enable_polling
-    chown system system /sys/class/htc_gyro/gyro/fifo_samples
-    chown system system /sys/class/htc_gyro/gyro/fifo_mode
-    chown system system /sys/class/htc_gyro/gyro/reg_value
-    chown system system /sys/class/htc_gyro/gyro/reg_addr
-    chmod 0664 /sys/class/htc_gyro/gyro/enable_device
-    chmod 0664 /sys/class/htc_gyro/gyro/pollrate_ms
-    chmod 0664 /sys/class/htc_gyro/gyro/range
-    chmod 0664 /sys/class/htc_gyro/gyro/enable_polling
-    chmod 0664 /sys/class/htc_gyro/gyro/fifo_samples
-    chmod 0664 /sys/class/htc_gyro/gyro/fifo_mode
-    chmod 0664 /sys/class/htc_gyro/gyro/reg_value
-    chmod 0664 /sys/class/htc_gyro/gyro/reg_addr
-
-    # For AKM8963
-    chown system system /dev/akm8963_dev
-    chown system system /sys/class/compass/akm8963/enable_acc
-    chown system system /sys/class/compass/akm8963/enable_mag
-    chown system system /sys/class/compass/akm8963/enable_ori
-    chown system system /sys/class/compass/akm8963/delay_acc
-    chown system system /sys/class/compass/akm8963/delay_mag
-    chown system system /sys/class/compass/akm8963/delay_ori
-    chown system system /sys/class/compass/akm8963/accel
-    chmod 0660 /dev/akm8963_dev
-    chmod 0660 /sys/class/compass/akm8963/enable_acc
-    chmod 0660 /sys/class/compass/akm8963/enable_mag
-    chmod 0660 /sys/class/compass/akm8963/enable_ori
-    chmod 0660 /sys/class/compass/akm8963/delay_acc
-    chmod 0660 /sys/class/compass/akm8963/delay_mag
-    chmod 0660 /sys/class/compass/akm8963/delay_ori
-    chmod 0660 /sys/class/compass/akm8963/accel
-
-    # For BMA250 BOSCH
-    chown system system /sys/class/htc_g_sensor/g_sensor/bandwidth
-    chown system system /sys/class/htc_g_sensor/g_sensor/chip_layout
-    chown system system /sys/class/htc_g_sensor/g_sensor/delay
-    chown system system /sys/class/htc_g_sensor/g_sensor/eeprom_writing
-    chown system system /sys/class/htc_g_sensor/g_sensor/enable
-    chown system system /sys/class/htc_g_sensor/g_sensor/enable_int
-    chown system system /sys/class/htc_g_sensor/g_sensor/fast_calibration_x
-    chown system system /sys/class/htc_g_sensor/g_sensor/fast_calibration_y
-    chown system system /sys/class/htc_g_sensor/g_sensor/fast_calibration_z
-    chown system system /sys/class/htc_g_sensor/g_sensor/flat_hold_time
-    chown system system /sys/class/htc_g_sensor/g_sensor/flat_theta
-    chown system system /sys/class/htc_g_sensor/g_sensor/get_raw_data
-    chown system system /sys/class/htc_g_sensor/g_sensor/high_g_duration
-    chown system system /sys/class/htc_g_sensor/g_sensor/high_g_threshold
-    chown system system /sys/class/htc_g_sensor/g_sensor/int_mode
-    chown system system /sys/class/htc_g_sensor/g_sensor/low_g_duration
-    chown system system /sys/class/htc_g_sensor/g_sensor/low_g_threshold
-    chown system system /sys/class/htc_g_sensor/g_sensor/mode
-    chown system system /sys/class/htc_g_sensor/g_sensor/orient_blocking
-    chown system system /sys/class/htc_g_sensor/g_sensor/orient_hyst
-    chown system system /sys/class/htc_g_sensor/g_sensor/orient_mode
-    chown system system /sys/class/htc_g_sensor/g_sensor/orient_theta
-    chown system system /sys/class/htc_g_sensor/g_sensor/range
-    chown system system /sys/class/htc_g_sensor/g_sensor/reg
-    chown system system /sys/class/htc_g_sensor/g_sensor/selftest
-    chown system system /sys/class/htc_g_sensor/g_sensor/set_k_value
-    chown system system /sys/class/htc_g_sensor/g_sensor/slope_duration
-    chown system system /sys/class/htc_g_sensor/g_sensor/slope_threshold
-    chown system system /sys/class/htc_g_sensor/g_sensor/tap_duration
-    chown system system /sys/class/htc_g_sensor/g_sensor/tap_quiet
-    chown system system /sys/class/htc_g_sensor/g_sensor/tap_samp
-    chown system system /sys/class/htc_g_sensor/g_sensor/tap_shock
-    chown system system /sys/class/htc_g_sensor/g_sensor/tap_threshold
-    chown system system /sys/class/htc_g_sensor/g_sensor/enable_cir_interrupt
-    chown system system /sys/class/bma250/bma250/enable
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/bandwidth
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/chip_layout
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/delay
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/eeprom_writing
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/enable
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/enable_int
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/fast_calibration_x
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/fast_calibration_y
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/fast_calibration_z
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/flat_hold_time
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/flat_theta
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/get_raw_data
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/high_g_duration
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/high_g_threshold
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/int_mode
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/low_g_duration
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/low_g_threshold
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/mode
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/orient_blocking
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/orient_hyst
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/orient_mode
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/orient_theta
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/range
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/reg
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/selftest
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/set_k_value
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/slope_duration
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/slope_threshold
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/tap_duration
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/tap_quiet
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/tap_samp
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/tap_shock
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/tap_threshold
-    chmod 0660 /sys/class/htc_g_sensor/g_sensor/enable_cir_interrupt
-    chmod 0660 /sys/class/bma250/bma250/enable
-
-    # P-sensor
-    chown radio radio /sys/class/optical_sensors/proximity/PhoneApp_status
-    chmod 0660 /sys/class/optical_sensors/proximity/PhoneApp_status
-
-    # htc_cir
-    chown irda irda /sys/class/htc_cir/cir/reset_cir
-    chmod 0660 /sys/class/htc_cir/cir/reset_cir
-
-    # Setup the global environment
-    export EXTERNAL_STORAGE /storage/sdcard0
-    export EXTERNAL_STORAGE4 /storage/usb
-    export EXTERNAL_STORAGE5 /storage/usb
-
-    # Create mountpoints
-        rm /sdcard
-        symlink /storage/sdcard0 /sdcard
-        symlink /storage/sdcard0 /mnt/sdcard
-        symlink /storage/usb     /mnt/usb
-
-    # NETWORK: NAT setting
-    # To prevent out of WINDOW ACK from making
-    # connection tracking to treat them as INVALID packet
-        write /proc/sys/net/netfilter/nf_conntrack_tcp_be_liberal 1
-
-    # For pnp thermal condition
-    write sys/power/pnpmgr/thermal/thermal_c0 1728000
-    write sys/power/pnpmgr/thermal/thermal_c1 1728000
-    write sys/power/pnpmgr/thermal/thermal_c2 1728000
-    write sys/power/pnpmgr/thermal/thermal_c3 1728000
-    write sys/power/pnpmgr/thermal/thermal_final 1728000
-    write sys/power/pnpmgr/thermal/thermal_g0 450000000
-    write /sys/power/pnpmgr/apps/media_mode "booting"
-
-on post-fs-data
-    mkdir /data/radio 0770 radio radio
-    chmod 2770 /data/radio
-#+SSD_RIL: from Qualcomm socket path
-    chmod 2770 /dev/socket/qmux_radio
-    mkdir /dev/socket/qmux_audio 0770 audio audio
-    chmod 2770 /dev/socket/qmux_audio
-    mkdir /dev/socket/qmux_bluetooth 0770 bluetooth bluetooth
-    chmod 2770 /dev/socket/qmux_bluetooth
-#-SSD_RIL: from Qualcomm socket path
-
-    # HTC add: 3LM setting on ICS
-    setprop ro.3lm.production 1
-
-    # HTC add: 3LM encryption on ICS
-    setprop ro.3lm.legacy_encryption 1
-    mkdir /data/secure 0755 system system
-    mkdir /data/secure/data 0755 system system
-    mount tmpfs tmpfs /data/secure/data mode=0755,gid=1000
-
-    # HTC add: double check the perms of /data/data for already existed case
-    chown system system /data/data
-    chmod 0771 /data/data
-
-    # If there is no fs-post-data action in the init.<device>.rc file, you
-    # must uncomment this line, otherwise encrypted filesystems
-    # won't work.
-    # Set indication (checked by vold) that we have finished this action
-    setprop vold.post_fs_data_done 1
-
-on boot
-   # We will remap this as /mnt/sdcard with the sdcard fuse tool
-   mkdir /data/media 0775 media_rw media_rw
-   chown media_rw media_rw /data/media
-   setprop ro.crypto.fuse_sdcard true
-   # Give system access to wpa_supplicant.conf for backup and restore
-   mkdir /data/misc/wifi/sockets 0771 wifi wifi
-   mkdir /data/misc/dhcp 0755 wifi wifi
-   chown dhcp dhcp /data/misc/dhcp
-   chmod 0770 /data/misc/wifi
-   write /sys/module/perflock/parameters/legacy_mode 0
-   write /sys/devices/i2c-3/3-0024/cyttsp_update_fw 1
-   start qcamerasvr
-#BT +
-    chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type
-    chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
-    chmod 0660 /sys/class/rfkill/rfkill0/state
-    chmod 0660 /proc/bluetooth/sleep/proto
-    chmod 0660 /sys/devices/platform/msm_serial_hs.0/clock
-#BT -
-
-# simlock +
-    chown radio radio /dev/simlock
-    chmod 0660 /dev/simlock
-# simlock -
-
-#DRM +
-    chown drm system /dev/htcdrm
-    chmod 0660 /dev/htcdrm
-#DRM -
-
-# Remote kill
-    chown system system /dev/htc_msgservice
-# Remote kill
-
-# HTC SSD Peripheral UI - BEGIN
-    chown system system /sys/class/leds/red/brightness
-    chown system system /sys/class/leds/red/blink
-    chown system system /sys/class/leds/red/off_timer
-    chown system system /sys/class/leds/green/brightness
-    chown system system /sys/class/leds/green/blink
-    chown system system /sys/class/leds/green/off_timer
-    chown system system /sys/class/leds/blue/brightness
-    chown system system /sys/class/leds/blue/blink
-    chown system system /sys/class/leds/blue/off_timer
-    chown system system /sys/class/leds/amber/brightness
-    chown system system /sys/class/leds/amber/blink
-    chown system system /sys/class/leds/amber/off_timer
-    chown system system /sys/class/leds/button-backlight-portrait/brightness
-    chown system system /sys/class/leds/button-backlight-landscape/brightness
-    chown system system /sys/class/leds/amber-portrait/brightness
-    chown system system /sys/class/leds/green-portrait/brightness
-    chown system system /sys/class/leds/blue-portrait/brightness
-    chown system system /sys/class/leds/amber-landscape/brightness
-    chown system system /sys/class/leds/green-landscape/brightness
-    chown system system /sys/class/leds/blue-landscape/brightness
-    chown system system /sys/class/leds/sharekey/brightness
-    chown system system /sys/class/leds/sharekey/breath_times
-    chown system system /sys/class/leds/sharekey/breath_max_brightness
-    chown system system /sys/class/leds/charming-led/brightness
-    chown system system /sys/class/leds/charming-led/blink
-    chown system system /sys/class/leds/charming-led/off_timer
-    chown system system /sys/class/leds/flashlight/brightness
-    chown system system /sys/class/leds/caps/brightness
-    chown system system /sys/class/leds/func/brightness
-    chown media media /sys/class/leds/green-camera/brightness
-    chown system system /sys/devices/virtual/htc_accessory/fm/flag
-    chown system system /sys/devices/virtual/htc_accessory/tty/flag
-    chown system system /sys/class/leds/indicator/ModeRGB
-# HTC SSD Peripheral UI - END
-
-# Permissions for NFC
-    chmod 0600 /dev/pn544
-    chown nfc nfc /dev/pn544
-    setprop debug.nfc.fw_download "true"
-    setprop debug.nfc.fw_boot_download "false"
-
-    # disable L27 S3 static pull down disable
-    write /sys/kernel/debug/pm8921-dbg/addr 0x0E3
-    write /sys/kernel/debug/pm8921-dbg/data 0xA0
-    write /sys/kernel/debug/pm8921-dbg/addr 0x1F5
-    write /sys/kernel/debug/pm8921-dbg/data 0xE1
-
-    # Load bcmdhd.ko while booting
-    chmod 0444 /system/lib/modules/bcmdhd.ko
-    insmod /system/lib/modules/bcmdhd.ko
-
-    write /proc/sys/net/ipv6/conf/p2p0/disable_ipv6 1
-
-    # Create symlink for fb1 as HDMI
-    symlink /dev/graphics/fb1 /dev/graphics/hdmi
-    # Remove write permissions to video related nodes
-    chmod 0664 /sys/devices/virtual/graphics/fb1/hpd
-    chmod 0664 /sys/devices/virtual/graphics/fb1/video_mode
-    chmod 0664 /sys/devices/virtual/graphics/fb1/format_3d
-
-    # Change owner and group for media server and surface flinger
-    chown system system /sys/devices/virtual/graphics/fb1/format_3d
-
-# ++SSD_GPS
-    mkdir /dev/socket/qmux_gps 0770 gps gps
-    chmod 2770 /dev/socket/qmux_gps
-
-    #Create directories for QuIPS
-    mkdir /data/misc/quipc 0770 gps system
-
-    #Create directories for Location services
-    mkdir /data/misc/location 0770 gps gps
-    mkdir /data/misc/location/mq 0770 gps gps
-# --SSD_GPS
-
-# ++SSD_AUDIO
-    chown system audio /dev/tfa9887
-    chmod 0664 /dev/tfa9887
-    chown system audio /dev/tfa9887l
-    chmod 0664 /dev/tfa9887l
-# --SSD_AUDIO
-
-# Set RLIMIT_NICE to allow priorities from 19 to -20
-    setrlimit 8 268435456 268435456
-
-# HTC SSD Camera
-    chown media system /sys/camera_htccallback/htccallback
-    chown media system /sys/camera_attrs/videochat
-
-    chown root system /proc/driver/hdf
-    chmod 0664 /proc/driver/hdf
-
-# Set touch permissions
-    chown system system /sys/android_touch/unlock
-
-# HTC SSD Camera
-    chown media system /sys/camera_htccallback/htccallback
-    chown media system /sys/camera_attrs/videochat
-
-# HTC SSD Battery - BEGIN
-# for RIL to notify battery driver talking and network_search state
-    chown radio radio /sys/class/power_supply/battery/phone_call
-    chmod 0220 /sys/class/power_supply/battery/phone_call
-    chown radio radio /sys/class/power_supply/battery/network_search
-    chmod 0220 /sys/class/power_supply/battery/network_search
-    chown system system /sys/class/power_supply/battery/navigation
-    chmod 0220 /sys/class/power_supply/battery/navigation
-# HTC SSD Battery - END
-
-# Define TCP buffer sizes for various networks
-#   ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax,
-    setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208
-    setprop net.tcp.buffersize.wifi    524288,1048576,2097152,262144,524288,1048576
-    setprop net.tcp.buffersize.lte     524288,1048576,5120000,4096,221184,3461120
-    setprop net.tcp.buffersize.hspap   4096,174760,1572864,4096,225280,1220608
-    setprop net.tcp.buffersize.hspa    4096,174760,1572864,4096,225280,1220608
-    setprop net.tcp.buffersize.hsupa   4096,174760,1572864,4096,225280,1220608
-    setprop net.tcp.buffersize.hsdpa   4096,174760,1572864,4096,225280,1220608
-    setprop net.tcp.buffersize.umts    4096,174760,1572864,4096,225280,1220608
-    setprop net.tcp.buffersize.edge    4093,26280,35040,4096,16384,35040
-    setprop net.tcp.buffersize.gprs    4092,8760,11680,4096,8760,11680
-    setprop net.tcp.buffersize.evdo_b  4094,87380,262144,4096,16384,262144
-
-# Assign TCP buffer thresholds to be ceiling value of technology maximums
-# Increased technology maximums should be reflected here.
-    write /proc/sys/net/core/rmem_max  1220608
-    write /proc/sys/net/core/wmem_max  1220608
-    
-    # Discretix DRM change start
-    mkdir /data/DxDrm
-    mkdir /data/DxDrm/fuse
-    chmod 555 /data/DxDrm
-    mkdir /sdcard/download
-    # Discretix DRM change end
-
-# To prevent out of order acknowledgements from making
-# connection tracking to treat them as not belonging to
-# the connection they belong to.
-# Otherwise, a weird issue happens in which some long
-# connections on high-throughput links get dropped when
-# an ack packet comes out of order
-    write /proc/sys/net/netfilter/nf_conntrack_tcp_be_liberal 1
-
-service postmount /system/bin/sh /init.post_mount.sh
-    class main
-    user root
-    group root
-    oneshot
-
-service thermald_boot /system/bin/thermald -c /system/etc/thermald_boot.conf
-    class main
-    user root
-    group root
-service thermald /system/bin/thermald
-    class main
-    user root
-    group root
-    disabled
-
-service zchgd_offmode /system/bin/zchgd -pseudooffmode
-    user root
-    group root graphics
-    disabled
-
-service zchgd_onmode /system/bin/zchgd -onmode
-    user root
-    group root graphics
-
-on property:dev.zcharge=true
-    start zchgd_onmode
-
-on property:dev.zcharge=false
-    stop zchgd_onmode
-
-service clockd /system/bin/clockd
-    class main
-
-service qb_offmode_alarm /system/bin/qb_offmode_alarm
-    class main
-    user root
-    disabled
-    oneshot
-
-service mpdecision /system/bin/mpdecision --no_sleep --avg_comp
-    class main
-    user root
-
-service pnpmgr /system/bin/pnpmgr
-    class main
-    user root
-
-service kickstart /system/bin/qcks -1 modem_st1 -2 modem_st2 -3 radio_config -4 cdma_record -i /firmware/mdm/image/ -u
-        class core
-        user root
-        oneshot
-        disabled
-
-service usf_tester /system/bin/usf_tester
-    user system
-    group system inet
-    disabled
-
-service usf_epos /system/bin/usf_epos
-    user system
-    group system inet
-    disabled
-
-service usf_gesture /system/bin/usf_gesture
-    user system
-    group system inet
-    disabled
-
-service usf_p2p /system/bin/usf_p2p
-    user system
-    group system inet
-    disabled
-
-service usf_hovering /system/bin/usf_hovering
-    user system
-    group system inet
-    disabled
-
-service usf-post-boot /system/bin/sh /system/etc/usf_post_boot.sh
-    class late_start
-    user root
-    disabled
-    oneshot
-
-# create virtual SD card at /mnt/sdcard, based on the /data/media directory
-# daemon will drop to user/group system/media_rw after initializing
-# underlying files in /data/media will be created with user and group media_rw (1023)
-service sdcard /system/bin/sdcard /data/media 1023 1023
-    class late_start
-
-# wifi ++
-service p2p_supplicant /system/bin/wpa_supplicant \
-    -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf -N \
-    -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf -e/data/misc/wifi/entropy.bin -puse_p2p_group_interface=1
-    class main
-    socket wpa_wlan0 dgram 660 wifi wifi
-    disabled
-    oneshot
-
-service wpa_supplicant /system/bin/logwrapper /system/bin/wpa_supplicant -Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf -puse_p2p_group_interface=1
-    socket wpa_wlan0 dgram 660 wifi wifi
-    disabled
-    oneshot
-
-service dhcpcd_wlan0 /system/bin/dhcpcd -ABKL
-    disabled
-    oneshot
-
-service dhcpcd_p2p /system/bin/dhcpcd -aABKL
-    disabled
-    oneshot
-
-service iprenew_wlan0 /system/bin/dhcpcd -n
-    disabled
-    oneshot
-
-service iprenew_p2p /system/bin/dhcpcd -n
-    disabled
-    oneshot
-# wifi--
-
-on property:init.svc.bootanim=stopped
-    start usf-post-boot
-    start post-boot
-    # Overwrite ActivityManager's low memory killer settings
-    write /sys/module/lowmemorykiller/parameters/adj 0,2,4,7,9,12
-    stop thermald_boot
-    start thermald
-    stop pnpmgr
-    start pnpmgr
-
-# ++SSD_BT
-service btld /system/bin/btld -lpm 1 -hb 3000000
-    user root
-    group bluetooth net_bt_admin
-    disabled
-    onrestart restart bluetoothd
-
-service dhcpcd_brcm-pan /system/bin/dhcpcd -ABKL
-    disabled
-    oneshot
-# --SSD_BT
-
-# DMagent
-service dmagent /system/bin/dmagent -N
-    class late_start
-    socket dmagent stream 660 root inet
-    user root
-    oneshot
-
-# ++SSD_RIL
-
-# QMUX must be in multiple groups to support external process connections
-service qmuxd /system/bin/qmuxd
-    class core
-    user radio
-    group radio audio gps
-
-service netmgrd /system/bin/netmgrd
-    class core
-
-# --SSD_RIL
-
-# ++SSD_GPS
-service quipc_igsn /system/bin/quipc_igsn
-    class late_start
-    user gps
-    group inet gps
-    disabled
-
-service quipc_main /system/bin/quipc_main
-    class late_start
-    user gps
-    group gps net_admin wifi inet
-    disabled
-# --SSD_GPS
-
-# HDMI
-
-service hdmid /system/bin/hdmid
-    class late_start
-    socket displayd stream 0660 root system graphics
-    disabled
-
-on property:ro.hdmi.enable=true
-    start hdmid
-
-service tpd /sbin/tpd
-    class core
-    cgroup bg
-    user root
-
-
-# For USB internet sharing
-service udhcpd /system/bin/udhcpd
-    disabled
-    oneshot
-
-service netsharing_on /system/bin/netsharing net on
-    disabled
-    oneshot
-
-service netsharing_off /system/bin/netsharing net off
-    disabled
-    oneshot
-
-service netsharing_pass /system/bin/netsharing net_pass on
-    disabled
-    oneshot
-
-service hdf /sbin/hdf
-    class core
-    oneshot
-
-on property:dev.bootcomplete=1
-    start bootcomplete
-    write /sys/power/pnpmgr/apps/media_mode " "
-
-service bootcomplete /system/bin/bootcomplete
-    user root
-    group root
-    disabled
-    oneshot
-
-# Discretix DRM change start
-service dx_drm_server /system/bin/DxDrmServerIpc -f -o allow_other /data/DxDrm/fuse
-    class main
-# Discretix DRM change end
-
-# Widevine DRM start
-service qseecomd /system/bin/qseecomd
-    class late_start
-    user system
-    group system drm
-
-service hcheck /system/bin/hcheck
-    class late_start
-    user system
-    group system
-    oneshot
-# Widevine DRM end
-
-# Compass/accelerometer daemon
-service akmd /system/bin/akmd
-    class main
-    user system
-    group system misc input
-
-# HTC Automotive - BEGIN
-service cand /system/bin/cand
-    class main
-    user root
-# HTC Automotive - END
-
-# HTC CIR firmware update - BEGIN
-service cir_fw_update /system/bin/cir_fw_update -u cir.img
-    class main
-    user root
-    group root
-    oneshot
-# HTC CIR firmware update - END
diff --git a/ramdisk/init.m7.usb.rc b/ramdisk/init.m7.usb.rc
deleted file mode 100644
index d6d5ca8..0000000
--- a/ramdisk/init.m7.usb.rc
+++ /dev/null
@@ -1,722 +0,0 @@
-# Copyright (C) 2012 The Android Open Source Project
-# Edited for Android Revolution HD
-# USB configuration common for all android devices
-
-on post-fs-data
-    chown system system /sys/class/android_usb/android0/f_mass_storage/lun/file
-    chmod 0660 /sys/class/android_usb/android0/f_mass_storage/lun/file
-    chown system system /sys/class/android_usb/android0/f_rndis/ethaddr
-    chmod 0660 /sys/class/android_usb/android0/f_rndis/ethaddr
-
-# Used to disable USB when switching states
-on property:sys.usb.config=none
-    stop adbd
-    write /sys/class/android_usb/android0/enable 0
-    write /sys/class/android_usb/android0/bDeviceClass 0
-    setprop sys.usb.state ${sys.usb.config}
-
-# adb only USB configuration
-# This should only be used during device bringup
-# and as a fallback if the USB manager fails to set a standard configuration
-on property:sys.usb.config=adb
-    start adbd
-    write /sys/class/android_usb/android0/f_adb/on 1
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=adboff
-    stop adbd
-    write /sys/class/android_usb/android0/f_adb/on 0
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mass_storage,adb
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 3
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mass_storage
-    write /sys/devices/platform/android_usb/usb_function_switch 1
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mass_storage,adb,diag
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 11
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mass_storage,diag
-    write /sys/devices/platform/android_usb/usb_function_switch 9
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mass_storage,adb,diag,diag_mdm
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 2059
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mass_storage,diag,diag_mdm
-    write /sys/devices/platform/android_usb/usb_function_switch 2057
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mass_storage,adb,diag,modem,diag_mdm,rmnet
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 6411
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mass_storage,diag,modem,diag_mdm,rmnet
-    write /sys/devices/platform/android_usb/usb_function_switch 6409
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mass_storage,adb,diag,modem,rmnet
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 4363
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mass_storage,diag,modem,rmnet
-    write /sys/devices/platform/android_usb/usb_function_switch 4361
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=diag,modem,diag_mdm,rmnet
-    write /sys/devices/platform/android_usb/usb_function_switch 6408
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=diag,modem,rmnet
-    write /sys/devices/platform/android_usb/usb_function_switch 4360
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mass_storage,adb,diag,modem,modem_mdm,diag_mdm,rmnet
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 22795
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mass_storage,diag,modem,modem_mdm,diag_mdm,rmnet
-    write /sys/devices/platform/android_usb/usb_function_switch 22793
-    setprop sys.usb.state ${sys.usb.config}
-
-# USB accessory configuration
-on property:sys.usb.config=accessory
-    write /sys/devices/platform/android_usb/usb_function_switch 8192
-    setprop sys.usb.state ${sys.usb.config}
-
-# USB accessory configuration, with adb
-on property:sys.usb.config=accessory,adb
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 8194
-    setprop sys.usb.state ${sys.usb.config}
-
-# Audio accessory configuration
-on property:sys.usb.config=audio_source
-    write /sys/class/android_usb/android0/enable 0
-    write /sys/class/android_usb/android0/idVendor 18d1
-    write /sys/class/android_usb/android0/idProduct 2d02
-    write /sys/class/android_usb/android0/functions ${sys.usb.config}
-    write /sys/class/android_usb/android0/enable 1
-    setprop sys.usb.state ${sys.usb.config}
-
-# Audio accessory configuration, with adb
-on property:sys.usb.config=audio_source,adb
-    write /sys/class/android_usb/android0/enable 0
-    write /sys/class/android_usb/android0/idVendor 18d1
-    write /sys/class/android_usb/android0/idProduct 2d03
-    write /sys/class/android_usb/android0/functions ${sys.usb.config}
-    write /sys/class/android_usb/android0/enable 1
-    start adbd
-    setprop sys.usb.state ${sys.usb.config}
-
-# USB and audio accessory configuration
-on property:sys.usb.config=accessory,audio_source
-    write /sys/class/android_usb/android0/enable 0
-    write /sys/class/android_usb/android0/idVendor 18d1
-    write /sys/class/android_usb/android0/idProduct 2d04
-    write /sys/class/android_usb/android0/functions ${sys.usb.config}
-    write /sys/class/android_usb/android0/enable 1
-    setprop sys.usb.state ${sys.usb.config}
-
-# USB and audio accessory configuration, with adb
-on property:sys.usb.config=accessory,audio_source,adb
-    write /sys/class/android_usb/android0/enable 0
-    write /sys/class/android_usb/android0/idVendor 18d1
-    write /sys/class/android_usb/android0/idProduct 2d05
-    write /sys/class/android_usb/android0/functions ${sys.usb.config}
-    write /sys/class/android_usb/android0/enable 1
-    start adbd
-    setprop sys.usb.state ${sys.usb.config}
-
-# Used to set USB configuration at boot and to switch the configuration
-# when changing the default configuration
-
-on property:persist.sys.usb.config=adb
-      setprop sys.usb.config ${persist.sys.usb.config}
-
-on property:persist.sys.usb.config=adboff
-      setprop sys.usb.config ${persist.sys.usb.config}
-
-on property:sys.usb.config=rndis
-    write /sys/devices/platform/android_usb/usb_function_switch 4
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=rndis,adb
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 6
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=rndis,diag
-    write /sys/devices/platform/android_usb/usb_function_switch 12
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=rndis,diag,diag_mdm
-    write /sys/devices/platform/android_usb/usb_function_switch 2060
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=rndis,adb,diag
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 14
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=rndis,adb,diag,diag_mdm
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 2062
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=rndis,mtp,adb
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 135
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,rmnet,adb
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 4227
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mtp,rmnet
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 4225
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=rndis,mtp
-    write /sys/devices/platform/android_usb/usb_function_switch 133
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=cdc_ethernet
-    write /sys/devices/platform/android_usb/usb_function_switch 512
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=cdc_network
-# Add projector
-    write /sys/devices/platform/android_usb/usb_function_switch 98304
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=cdc_network,adb
-    start adbd
-# Add projector
-    write /sys/devices/platform/android_usb/usb_function_switch 98306
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp
-    write /sys/devices/platform/android_usb/usb_function_switch 128
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,adb
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 130
-    setprop sys.usb.state ${sys.usb.config}
-
-# PC MODEM::modem+diag+serial+mtp+adb+mass_storage
-on property:sys.usb.config=mtp,modem,adb
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 411
-    setprop sys.usb.state ${sys.usb.config}
-    setprop service.modem.enable 1
-
-# PC MODEM::modem+diag+serial+mtp+mass_storage
-on property:sys.usb.config=mtp,modem
-    write /sys/devices/platform/android_usb/usb_function_switch 409
-    setprop sys.usb.state ${sys.usb.config}
-    setprop service.modem.enable 1
-
-#PC MODEM::modem+diag+serial+mtp+adb+mass_storage
-on property:sys.usb.config=mtp,modem,adb,diag
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 411
-    setprop sys.usb.state ${sys.usb.config}
-    setprop service.modem.enable 1
-
-#PC MODEM::modem+diag+serial+mtp+mass_storage
-on property:sys.usb.config=mtp,modem,diag
-    write /sys/devices/platform/android_usb/usb_function_switch 409
-    setprop sys.usb.state ${sys.usb.config}
-    setprop service.modem.enable 1
-
-
-# Will add mass_storage
-on property:sys.usb.config=mtp,diag,adb
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 139
-    setprop sys.usb.state ${sys.usb.config}
-
-# Will add mass_storage
-# Without adb
-on property:sys.usb.config=mtp,diag
-    write /sys/devices/platform/android_usb/usb_function_switch 137
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,adb,projector
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 162
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mtp,projector
-    write /sys/devices/platform/android_usb/usb_function_switch 160
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,adb,modem
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 386
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mtp,modem
-    write /sys/devices/platform/android_usb/usb_function_switch 384
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,adb,diag,modem
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 394
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mtp,diag,modem
-    write /sys/devices/platform/android_usb/usb_function_switch 392
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,adb,diag,modem,modem_mdm,diag_mdm
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 18826
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mtp,diag,modem,modem_mdm,diag_mdm
-    write /sys/devices/platform/android_usb/usb_function_switch 18824
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,adb,diag,modem,modem_mdm,diag_mdm,rmnet
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 22922
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mtp,diag,modem,modem_mdm,diag_mdm,rmnet
-    write /sys/devices/platform/android_usb/usb_function_switch 22920
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,adb,diag,modem,diag_mdm,rmnet
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 6538
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mtp,diag,modem,diag_mdm,rmnet
-    write /sys/devices/platform/android_usb/usb_function_switch 6536
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,adb,diag,diag_mdm,rmnet
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 6282
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mtp,diag,diag_mdm,rmnet
-    write /sys/devices/platform/android_usb/usb_function_switch 6280
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,adb,diag,rmnet
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 4234
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mtp,diag,rmnet
-    write /sys/devices/platform/android_usb/usb_function_switch 4232
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,adb,diag,modem,rmnet
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 4490
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mtp,diag,modem,rmnet
-    write /sys/devices/platform/android_usb/usb_function_switch 4488
-    setprop sys.usb.state ${sys.usb.config}
-
-# Will add mass_storage
-on property:sys.usb.config=mtp,adb,diag,diag_mdm
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 2187
-    setprop sys.usb.state ${sys.usb.config}
-
-# Will add mass_storage
-# Without adb
-on property:sys.usb.config=mtp,diag,diag_mdm
-    write /sys/devices/platform/android_usb/usb_function_switch 2185
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,adb,diag,modem,diag_mdm
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 2442
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mtp,diag,modem,diag_mdm
-    write /sys/devices/platform/android_usb/usb_function_switch 2440
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,mass_storage,adb
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 131
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,adb,mass_storage
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 131
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mtp,mass_storage
-    write /sys/devices/platform/android_usb/usb_function_switch 129
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=rndis,mtp,mass_storage,adb
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 135
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=rndis,mtp,adb,mass_storage
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 135
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=rndis,mtp,mass_storage
-    write /sys/devices/platform/android_usb/usb_function_switch 133
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,mass_storage,adb,diag
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 139
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,adb,mass_storage,diag
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 139
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mtp,mass_storage,diag
-    write /sys/devices/platform/android_usb/usb_function_switch 137
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,mass_storage,adb,diag,diag_mdm
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 2187
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,adb,mass_storage,diag,diag_mdm
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 2187
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mtp,mass_storage,diag,diag_mdm
-    write /sys/devices/platform/android_usb/usb_function_switch 2185
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,mass_storage,adb,diag,modem,rmnet
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 4491
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,adb,mass_storage,diag,modem,rmnet
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 4491
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mtp,mass_storage,diag,modem,rmnet
-    write /sys/devices/platform/android_usb/usb_function_switch 4489
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,mass_storage,adb,diag,modem,diag_mdm,rmnet
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 6539
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,adb,mass_storage,diag,modem,diag_mdm,rmnet
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 6539
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mtp,mass_storage,diag,modem,diag_mdm,rmnet
-    write /sys/devices/platform/android_usb/usb_function_switch 6537
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,mass_storage,adb,diag,modem,modem_mdm,diag_mdm,rmnet
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 22923
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,adb,mass_storage,diag,modem,modem_mdm,diag_mdm,rmnet
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 22923
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mtp,mass_storage,diag,modem,modem_mdm,diag_mdm,rmnet
-    write /sys/devices/platform/android_usb/usb_function_switch 22921
-    setprop sys.usb.state ${sys.usb.config}
-
-# Will add mass_storage
-on property:sys.usb.config=mtp,adb,diag
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 139
-    setprop sys.usb.state ${sys.usb.config}
-
-# Will add mass_storage
-on property:sys.usb.config=rndis,mtp,adb,diag
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 143
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb & add mass_storage
-on property:sys.usb.config=rndis,mtp,diag
-    write /sys/devices/platform/android_usb/usb_function_switch 141
-    setprop sys.usb.state ${sys.usb.config}
-
-# Will add mass_storage
-on property:sys.usb.config=rndis,mtp,adb,diag,modem
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 399
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb & add mass_storage
-on property:sys.usb.config=rndis,mtp,diag,modem
-    write /sys/devices/platform/android_usb/usb_function_switch 397
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=rndis,mtp,adb,mass_storage,diag
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 143
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=rndis,mtp,mass_storage,diag
-    write /sys/devices/platform/android_usb/usb_function_switch 141
-    setprop sys.usb.state ${sys.usb.config}
-
-# Will add mass_storage
-on property:sys.usb.config=rndis,mtp,adb,diag,diag_mdm
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 2191
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb & add mass_storage
-on property:sys.usb.config=rndis,mtp,diag,diag_mdm
-    write /sys/devices/platform/android_usb/usb_function_switch 2189
-    setprop sys.usb.state ${sys.usb.config}
-
-# Will add mass_storage
-on property:sys.usb.config=rndis,mtp,adb,diag,modem,diag_mdm
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 2447
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb & add mass_storage
-on property:sys.usb.config=rndis,mtp,diag,modem,diag_mdm
-    write /sys/devices/platform/android_usb/usb_function_switch 2445
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=rndis,mtp,adb,mass_storage,diag,diag_mdm
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 2191
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=rndis,mtp,mass_storage,diag,diag_mdm
-    write /sys/devices/platform/android_usb/usb_function_switch 2189
-    setprop sys.usb.state ${sys.usb.config}
-
-
-
-on property:sys.usb.config=rndis,mtp,adb,mass_storage,diag,modem
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 399
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=rndis,mtp,mass_storage,diag,modem
-    write /sys/devices/platform/android_usb/usb_function_switch 397
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=rndis,mtp,adb,mass_storage,diag,modem,diag_mdm
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 2447
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=rndis,mtp,mass_storage,diag,modem,diag_mdm
-    write /sys/devices/platform/android_usb/usb_function_switch 2445
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=rndis,mtp,adb,mass_storage,modem
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 391
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=rndis,mtp,mass_storage,modem
-    write /sys/devices/platform/android_usb/usb_function_switch 389
-    setprop sys.usb.state ${sys.usb.config}
-
-# Will add mass_storage
-on property:sys.usb.config=rndis,mtp,adb,modem
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 391
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb & add mass_storage
-on property:sys.usb.config=rndis,mtp,modem
-    write /sys/devices/platform/android_usb/usb_function_switch 389
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,adb,mass_storage,diag,modem
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 395
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mtp,mass_storage,diag,modem
-    write /sys/devices/platform/android_usb/usb_function_switch 393
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,adb,mass_storage,diag,modem,diag_mdm
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 2443
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mtp,mass_storage,diag,modem,diag_mdm
-    write /sys/devices/platform/android_usb/usb_function_switch 2441
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,adb,mass_storage,modem
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 387
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mtp,mass_storage,modem
-    write /sys/devices/platform/android_usb/usb_function_switch 385
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mass_storage,adb,modem
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 259
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mass_storage,modem
-    write /sys/devices/platform/android_usb/usb_function_switch 257
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mass_storage,adb,diag,modem
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 267
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mass_storage,diag,modem
-    write /sys/devices/platform/android_usb/usb_function_switch 265
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mass_storage,adb,diag,modem,diag_mdm
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 2315
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=mass_storage,diag,modem,diag_mdm
-    write /sys/devices/platform/android_usb/usb_function_switch 2313
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=rndis,adb,diag,modem,diag_mdm
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 2318
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=rndis,diag,modem,diag_mdm
-    write /sys/devices/platform/android_usb/usb_function_switch 2316
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=rndis,adb,diag,modem
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 270
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=rndis,diag,modem
-    write /sys/devices/platform/android_usb/usb_function_switch 268
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=rndis,adb,modem
-    start adbd
-    write /sys/devices/platform/android_usb/usb_function_switch 262
-    setprop sys.usb.state ${sys.usb.config}
-
-# Without adb
-on property:sys.usb.config=rndis,modem
-    write /sys/devices/platform/android_usb/usb_function_switch 260
-    setprop sys.usb.state ${sys.usb.config}
-
-
-# Used for ##3424
-on property:persist.sys.usb.diag.config=*
-    setprop sys.usb.diag.config ${persist.sys.usb.diag.config}
-
-on property:sys.usb.diag.config=diagon
-    write /sys/class/android_usb/android0/f_diag/on 1
-    setprop sys.usb.diag.state ${sys.usb.diag.config}
-
-on property:sys.usb.diag.config=diagoff
-    write /sys/class/android_usb/android0/f_diag/on 0
-    setprop sys.usb.diag.state ${sys.usb.diag.config}
-
-# HTC_IPT for USB IPT
-service udhcpd0 /system/bin/logwrapper /system/bin/udhcpd
-    disabled
-    oneshot
-
-service netsharing0_on /system/bin/netsharing net on
-    disabled
-    oneshot
-
-service netsharing0_off /system/bin/netsharing net off
-    disabled
-    oneshot
-
-service netsharing0_pass /system/bin/netsharing net_pass on
-    disabled
-    oneshot
-
-on property:sys.usb.projector.enable=1
-    write /sys/class/android_usb/f_projector/on 1
-
-on property:sys.usb.projector.enable=0
-    write /sys/class/android_usb/f_projector/on 0
-
diff --git a/ramdisk/init.rc b/ramdisk/init.rc
deleted file mode 100644
index 1e809c5..0000000
--- a/ramdisk/init.rc
+++ /dev/null
@@ -1,678 +0,0 @@
-# Copyright (C) 2012 The Android Open Source Project
-# Edited for Android Revolution HD
-# IMPORTANT: Do not create world writable files or directories.
-# This is a common source of Android security bugs.
-
-import /init.${ro.hardware}.rc
-import /init.usb.rc
-import /init.trace.rc
-
-on early-init
-    # Set init and its forked children's oom_adj.
-    write /proc/1/oom_adj -16
-
-    start ueventd
-
-# create mountpoints
-    mkdir /mnt 0775 root system
-
-on init
-
-sysclktz 0
-
-loglevel 3
-
-# setup the global environment
-    export PATH /sbin:/system/sbin:/system/bin:/system/xbin
-    export LD_LIBRARY_PATH /system/lib
-    export ANDROID_BOOTLOGO 1
-    export ANDROID_ROOT /system
-    export ANDROID_ASSETS /system/app
-    export ANDROID_DATA /data
-    export ASEC_MOUNTPOINT /mnt/asec
-    export LOOP_MOUNTPOINT /mnt/obb
-    export BOOTCLASSPATH /system/framework/core.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/framework2.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar:/system/framework/com.htc.android.bluetooth.jar:/system/framework/HTCDev.jar:/system/framework/HTCCommonctrl.jar:/system/framework/HTCExtension.jar:/system/framework/wimax.jar:/system/framework/com.orange.authentication.simcard.jar:/system/framework/usbnet.jar
-
-# Backward compatibility
-    symlink /system/etc /etc
-    symlink /sys/kernel/debug /d
-    symlink /mnt/sdcard /sdcard
-
-# Mount debugfs first, it's too slow to check not S-ON then mount. Systrace will work incorrect.
-    mount debugfs /sys/kernel/debug /sys/kernel/debug
-
-# Create cgroup mount point for cpu accounting
-    mkdir /acct
-    mount cgroup none /acct cpuacct
-    mkdir /acct/uid
-
-    mkdir /system
-    mkdir /data 0771 system system
-    mkdir /cache 0770 system cache
-    mkdir /config 0500 root root
-
-    # Directory for putting things only root should see.
-    mkdir /mnt/secure 0700 root root
-
-    # Directory for staging bindmounts
-    mkdir /mnt/secure/staging 0700 root root
-
-    # Directory-target for where the secure container
-    # imagefile directory will be bind-mounted
-    mkdir /mnt/secure/asec  0700 root root
-
-    # Secure container public mount points.
-    mkdir /mnt/asec  0700 root system
-    mount tmpfs tmpfs /mnt/asec mode=0755,gid=1000
-
-    # Filesystem image public mount points.
-    mkdir /mnt/obb 0700 root system
-    mount tmpfs tmpfs /mnt/obb mode=0755,gid=1000
-
-    write /proc/sys/kernel/panic_on_oops 1
-    write /proc/sys/kernel/hung_task_timeout_secs 0
-    write /proc/cpu/alignment 4
-    write /proc/sys/kernel/sched_latency_ns 10000000
-    write /proc/sys/kernel/sched_wakeup_granularity_ns 2000000
-    write /proc/sys/kernel/sched_compat_yield 1
-    write /proc/sys/kernel/sched_child_runs_first 0
-    write /proc/sys/kernel/randomize_va_space 2
-    write /proc/sys/kernel/kptr_restrict 2
-    write /proc/sys/kernel/dmesg_restrict 1
-    write /proc/sys/vm/mmap_min_addr 32768
-    write /proc/sys/kernel/sched_rt_runtime_us 950000
-    write /proc/sys/kernel/sched_rt_period_us 1000000
-
-# NETWORK: NAT setting
-# To prevent out of WINDOW ACK from making
-# connection tracking to treat them as INVALID packet
-    write /proc/sys/net/netfilter/nf_conntrack_tcp_be_liberal 1
-
-# Wifi: Disable the IPv6 of p2p0 interface
-    write /proc/sys/net/ipv6/conf/p2p0/disable_ipv6 1
-
-# Create cgroup mount points for process groups
-    mkdir /dev/cpuctl
-    mount cgroup none /dev/cpuctl cpu
-    chown system system /dev/cpuctl
-    chown system system /dev/cpuctl/tasks
-    chmod 0660 /dev/cpuctl/tasks
-    write /dev/cpuctl/cpu.shares 1024
-    write /dev/cpuctl/cpu.rt_runtime_us 950000
-    write /dev/cpuctl/cpu.rt_period_us 1000000
-
-    mkdir /dev/cpuctl/apps
-    chown system system /dev/cpuctl/apps/tasks
-    chmod 0666 /dev/cpuctl/apps/tasks
-    write /dev/cpuctl/apps/cpu.shares 1024
-    write /dev/cpuctl/apps/cpu.rt_runtime_us 800000
-    write /dev/cpuctl/apps/cpu.rt_period_us 1000000
-
-    mkdir /dev/cpuctl/apps/bg_non_interactive
-    chown system system /dev/cpuctl/apps/bg_non_interactive/tasks
-    chmod 0666 /dev/cpuctl/apps/bg_non_interactive/tasks
-    write /dev/cpuctl/apps/bg_non_interactive/cpu.shares 52
-    write /dev/cpuctl/apps/bg_non_interactive/cpu.rt_runtime_us 700000
-    write /dev/cpuctl/apps/bg_non_interactive/cpu.rt_period_us 1000000
-
-# Create cgroup mount points for timer groups
-    mkdir /dev/timer_group
-    mount cgroup none /dev/timer_group timer_slack
-    chown system system /dev/timer_group
-    chown system system /dev/timer_group/cgroup.procs
-    chown system system /dev/timer_group/tasks
-    chmod 0660 /dev/timer_group/cgroup.procs
-    chmod 0660 /dev/timer_group/tasks
-
-    mkdir /dev/timer_group/bg
-    chown system system /dev/timer_group/bg
-    chown system system /dev/timer_group/bg/cgroup.procs
-    chown system system /dev/timer_group/bg/tasks
-    chmod 0660 /dev/timer_group/bg/cgroup.procs
-    chmod 0660 /dev/timer_group/bg/tasks
-    write /dev/timer_group/bg/timer_slack.min_slack_ns 100000000
-
-# Allow everybody to read the xt_qtaguid resource tracking misc dev.
-# This is needed by any process that uses socket tagging.
-    chmod 0644 /dev/xt_qtaguid
-
-# Change mode & owner of HTC Debug Driver node
-    chmod 0664 /proc/driver/hdf
-    chown root system /proc/driver/hdf
-
-# Unmount debugfs if SHIP S-ON
-on property:ro.sf=1
-    umount /sys/kernel/debug
-
-on fs
-# Mount mtd partitions
-    # Mount /system rw first to give the filesystem a chance to save a checkpoint
-    mount yaffs2 mtd@system /system
-    mount yaffs2 mtd@system /system ro remount
-    mount yaffs2 mtd@userdata /data nosuid nodev
-    mount yaffs2 mtd@cache /cache nosuid nodev
-
-on post-fs
-    # Once everything is setup, no need to modify /
-    mount rootfs rootfs / ro remount
-
-    # We chown/chmod /cache again so because mount is run as root + defaults
-    chown system cache /cache
-    chmod 0770 /cache
-
-    # This may have been created by the recovery system with odd permissions
-    chown system cache /cache/recovery
-    chmod 0770 /cache/recovery
-
-    chmod 0700 /system/build.prop
-
-    # Change permissions on vmallocinfo so we can grab it from bugreports
-    chown root log /proc/vmallocinfo
-    chmod 0440 /proc/vmallocinfo
-
-    # Change permissions on kmsg & sysrq-trigger so bugreports can grab kthread stacks
-    chown root system /proc/kmsg
-    chmod 0440 /proc/kmsg
-    chown root system /proc/sysrq-trigger
-    chmod 0220 /proc/sysrq-trigger
-
-    # Create the lost+found directories, so as to enforce our permissions
-    mkdir /cache/lost+found 0770 root root
-
-on post-fs-data
-    # We chown/chmod /data again so because mount is run as root + defaults
-    chown system system /data
-    chmod 0771 /data
-
-    # Create dump dir and collect dumps.
-    # Do this before we mount cache so eventually we can use cache for
-    # storing dumps on platforms which do not have a dedicated dump partition.
-    mkdir /data/dontpanic 0750 root log
-
-    # Collect apanic data, free resources and re-arm trigger
-    copy /proc/apanic_console /data/dontpanic/apanic_console
-    chown root log /data/dontpanic/apanic_console
-    chmod 0640 /data/dontpanic/apanic_console
-
-    copy /proc/apanic_threads /data/dontpanic/apanic_threads
-    chown root log /data/dontpanic/apanic_threads
-    chmod 0640 /data/dontpanic/apanic_threads
-
-    write /proc/apanic_console 1
-
-    # Create basic filesystem structure
-    mkdir /data/misc 01771 system misc
-    mkdir /data/misc/bluetoothd 0770 bluetooth bluetooth
-    mkdir /data/misc/bluetooth 0770 system system
-    mkdir /data/misc/keystore 0700 keystore keystore
-    mkdir /data/misc/keychain 0771 system system
-    mkdir /data/misc/vpn 0770 system vpn
-    mkdir /data/misc/systemkeys 0700 system system
-    # Give system access to wpa_supplicant.conf for backup and restore
-    mkdir /data/misc/wifi 0770 wifi wifi
-    chmod 0660 /data/misc/wifi/wpa_supplicant.conf
-    chmod 0660 /data/misc/wifi/hostapd.conf
-    mkdir /data/local 0751 root root
-    chmod 2770 /data/radio
-
-    # HTC_DRM
-    chown drm system /dev/htcdrm
-    chmod 0660 /dev/htcdrm
-
-    # For security reasons, /data/local/tmp should always be empty.
-    # Do not place files or directories in /data/local/tmp
-    mkdir /data/local/tmp 0771 shell shell
-    mkdir /data/data 0771 system system
-    mkdir /data/app-private 0771 system system
-    mkdir /data/app-asec 0700 root root
-    mkdir /data/app 0771 system system
-    mkdir /data/property 0700 root root
-    mkdir /data/ssh 0750 root shell
-    mkdir /data/ssh/empty 0700 root root
-    mkdir /dev/socket/qmux_radio 0770 radio radio
-    mkdir /data/radio 0770 radio radio
-    mkdir /dev/radio 0770 radio radio
-
-    # COTA folder & file creating & permission checking
-    mkdir /data/data/cw 0770 root cw_access
-    mkdir /data/data/cwtemp 0770 root cw_access
-    chown root cw_access /data/data/cw
-    chown root cw_access /data/data/cwtemp
-    chmod 0770 /data/data/cw
-    chmod 0770 /data/data/cwtemp
-
-    # Check the permission & group of cw package (JB)
-    chmod 0740 /data/cw.prop
-    chmod 0740 /data/cw.crc
-    chmod 0740 /data/cwpkg.zip
-    chmod 0740 /data/data/cwtemp/cw.prop
-    chmod 0740 /data/data/cwtemp/cw.crc
-    chmod 0740 /data/data/cwtemp/cwpkg.zip
-    chown root cw_access /data/cw.prop
-    chown root cw_access /data/cw.crc
-    chown root cw_access /data/cwpkg.zip
-    chown root cw_access /data/data/cwtemp/cw.prop
-    chown root cw_access /data/data/cwtemp/cw.crc
-    chown root cw_access /data/data/cwtemp/cwpkg.zip
-
-    chown root recvy_access /data/data/recovery
-    chmod 0775 /data/data/recovery
-
-    # Create dalvik-cache, so as to enforce our permissions
-    mkdir /data/dalvik-cache 0771 system system
-
-    # Create resource-cache and double-check the perms
-    mkdir /data/resource-cache 0771 system system
-    chown system system /data/resource-cache
-    chmod 0771 /data/resource-cache
-
-    # Create the lost+found directories, so as to enforce our permissions
-    mkdir /data/lost+found 0770 root root
-
-    # Create directory for DRM plug-ins - give drm the read/write access to
-    # the following directory.
-    mkdir /data/drm 0770 drm drm
-
-    # HTC add: temp change settings db file access right while boot-up for bootanimation to access
-    chmod 0660 /data/data/com.android.providers.settings/databases/settings.db-wal
-    chmod 0660 /data/data/com.android.providers.settings/databases/settings.db-shm
-    chmod 0660 /data/data/com.android.providers.settings/databases/settings.db-journal
-
-    # If there is no fs-post-data action in the init.<device>.rc file, you
-    # must uncomment this line, otherwise encrypted filesystems won't work.
-    # Set indication (checked by vold) that we have finished this action
-    setprop vold.post_fs_data_done 1
-
-    chmod 0771 /data/preload
-    chown system system /data/preload
-
-on boot
-# Basic network init
-    ifup lo
-    hostname localhost
-    domainname localdomain
-
-# Set RLIMIT_NICE to allow priorities from 19 to -20
-    setrlimit 13 40 40
-    setrlimit 8 268435456 268435456
-
-# [framework] begin: Set core files handler by setting core_pattern.
-# The handler will compress core files and try to limit the max set number of core files to 3.
-    chmod 0755 /system/bin/dalvik_coredump.sh
-    write /proc/sys/kernel/core_pattern |/system/bin/dalvik_coredump.sh\ %p\ %u\ %t
-# [framwrok] :end
-
-# Memory management.  Basic kernel parameters, and allow the high
-# level system server to be able to adjust the kernel OOM driver
-# parameters to match how it is managing things.
-    write /proc/sys/vm/overcommit_memory 1
-    write /proc/sys/vm/min_free_order_shift 4
-    write /proc/sys/vm/highmem_is_dirtyable 1
-    chown root system /sys/module/lowmemorykiller/parameters/adj
-    chmod 0664 /sys/module/lowmemorykiller/parameters/adj
-    chown root system /sys/module/lowmemorykiller/parameters/minfree
-    chmod 0664 /sys/module/lowmemorykiller/parameters/minfree
-
-    # Tweak background writeout
-    write /proc/sys/vm/dirty_expire_centisecs 200
-    write /proc/sys/vm/dirty_background_ratio  5
-
-    # Permissions for System Server and daemons.
-    chown radio system /sys/android_power/state
-    chown radio system /sys/android_power/request_state
-    chown radio system /sys/android_power/acquire_full_wake_lock
-    chown radio system /sys/android_power/acquire_partial_wake_lock
-    chown radio system /sys/android_power/release_wake_lock
-    chown system system /sys/power/state
-    chown system system /sys/power/wakeup_count
-    chown radio system /sys/power/wake_lock
-    chown radio system /sys/power/wake_unlock
-    chmod 0660 /sys/power/state
-    chmod 0660 /sys/power/wake_lock
-    chmod 0660 /sys/power/wake_unlock
-
-# HTC SSD Peripheral UI - BEGIN
-    chown system system /sys/class/leds/green/brightness
-    chown system system /sys/class/leds/green/blink
-    chown system system /sys/class/leds/green/off_timer
-    chown system system /sys/class/leds/amber/brightness
-    chown system system /sys/class/leds/amber/blink
-    chown system system /sys/class/leds/amber/off_timer
-    chown system system /sys/class/state_helper/proximity/psensor_release_wakelock_event
-    chown system system /sys/class/state_helper/phone/phone_event
-# HTC SSD Peripheral UI - END
-
-# For Flashlight Restriction
-    chown radio system /sys/camera_led_status/led_ril_status
-
-    chown system system /sys/devices/system/cpu/cpufreq/interactive/timer_rate
-    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/timer_rate
-    chown system system /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
-    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
-    chown system system /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
-    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
-    chown system system /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
-    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
-    chown system system /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
-    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
-    chown system system /sys/devices/system/cpu/cpufreq/interactive/boost
-    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/boost
-    chown system system /sys/devices/system/cpu/cpufreq/interactive/boostpulse
-    chown system system /sys/devices/system/cpu/cpufreq/interactive/input_boost
-    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/input_boost
-
-    # Assume SMP uses shared cpufreq policy for all CPUs
-    chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
-    chmod 0660 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
-
-    chown system graphics /sys/class/leds/lcd-backlight/cabc_level_ctl
-    chown system graphics /sys/devices/virtual/graphics/fb0/perfhint
-    chown system system /sys/class/timed_output/vibrator/enable
-    chown system system /sys/class/leds/keyboard-backlight/brightness
-    chown system system /sys/class/leds/lcd-backlight/brightness
-    chown system system /sys/class/leds/button-backlight/brightness
-    chown system system /sys/class/leds/button-backlight1/brightness
-    chown system system /sys/class/leds/button-backlight2/brightness
-    chown system system /sys/class/leds/jogball-backlight/brightness
-    chown system system /sys/class/leds/red/brightness
-    chown system system /sys/class/leds/green/brightness
-    chown system system /sys/class/leds/blue/brightness
-    chown system system /sys/class/leds/red/device/grpfreq
-    chown system system /sys/class/leds/red/device/grppwm
-    chown system system /sys/class/leds/red/device/blink
-    chown system system /sys/class/leds/red/brightness
-    chown system system /sys/class/leds/green/brightness
-    chown system system /sys/class/leds/blue/brightness
-    chown system system /sys/class/leds/red/device/grpfreq
-    chown system system /sys/class/leds/red/device/grppwm
-    chown system system /sys/class/leds/red/device/blink
-    chown system system /sys/class/timed_output/vibrator/enable
-    chown system system /sys/module/sco/parameters/disable_esco
-    chown system system /sys/kernel/ipv4/tcp_wmem_min
-    chown system system /sys/kernel/ipv4/tcp_wmem_def
-    chown system system /sys/kernel/ipv4/tcp_wmem_max
-    chown system system /sys/kernel/ipv4/tcp_rmem_min
-    chown system system /sys/kernel/ipv4/tcp_rmem_def
-    chown system system /sys/kernel/ipv4/tcp_rmem_max
-    chown root radio /proc/cmdline
-
-# HTC SSD USB
-    chown system radio /sys/class/android_usb/f_modem/on
-    chown system system /sys/class/android_usb/f_diag/on
-    chown system system /sys/class/android_usb/f_rmnet/on
-    chown system system /sys/devices/platform/android_usb/usb_disable
-
-# Set diag permissions
-    chown radio radio /dev/diag
-    chown radio radio /dev/diag_mdm
-    chown radio radio /dev/htcdiag
-    chown radio radio /dev/diag_arm9
-    chown radio radio /dev/btdiag
-    chmod 0660 /dev/diag
-    chmod 0660 /dev/diag_mdm
-    chmod 0660 /dev/htcdiag
-    chmod 0660 /dev/diag_arm9
-    chmod 0660 /dev/btdiag
-
-# HTC SSD Camera
-# For Flashlight Restriction
-    chown system system /sys/camera_led_status/led_hotspot_status
-
-# HTC set radio_feedback permissions
-    chown radio radio /dev/radio_feedback
-    chmod 0660 /dev/radio_feedback
-
-# For RIL to set htc_monitor_param permission
-    chown radio radio /sys/htc_monitor_status/htc_monitor_param
-
-# Set touch permissions
-    chown system system /sys/android_touch/unlock
-
-# Set volume key wake up attribute file permission
-    chown media media /sys/keyboard/vol_wakeup
-
-# For camera to switch burst mode
-    chown media media /sys/devices/platform/msm_sdcc.1/burst
-    chown media media /proc/emmc_burst
-
-# Define TCP buffer sizes for various networks
-#   ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax,
-    setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208
-    setprop net.tcp.buffersize.wifi    524288,1048576,2097152,262144,524288,1048576
-    setprop net.tcp.buffersize.lte     4094,87380,1220608,4096,16384,1220608
-    setprop net.tcp.buffersize.umts    4094,87380,110208,4096,16384,110208
-    setprop net.tcp.buffersize.hspap   4094,87380,1220608,4096,16384,1220608
-    setprop net.tcp.buffersize.hspa    4094,87380,1220608,4096,16384,1220608
-    setprop net.tcp.buffersize.hsupa   4094,87380,1220608,4096,16384,1220608
-    setprop net.tcp.buffersize.hsdpa   4094,87380,1220608,4096,16384,1220608
-    setprop net.tcp.buffersize.edge    4093,26280,35040,4096,16384,35040
-    setprop net.tcp.buffersize.gprs    4092,8760,11680,4096,8760,11680
-    setprop net.tcp.buffersize.evdo_b  4094,87380,262144,4096,16384,262144
-
-# Assign TCP buffer thresholds to be ceiling value of technology maximums
-# Increased technology maximums should be reflected here.
-    write /proc/sys/net/core/rmem_max  2097152
-    write /proc/sys/net/core/wmem_max  1220608
-
-# Set this property so surfaceflinger is not started by system_init
-    setprop system_init.startsurfaceflinger 0
-
-    class_start core
-    class_start main
-
-on nonencrypted
-    class_start late_start
-
-on charger
-    class_start charger
-
-on property:vold.decrypt=trigger_reset_main
-    class_reset main
-
-on property:vold.decrypt=trigger_load_persist_props
-    load_persist_props
-
-on property:vold.decrypt=trigger_post_fs_data
-    trigger post-fs-data
-
-on property:vold.decrypt=trigger_restart_min_framework
-    start zygote
-    class_start main
-
-on property:vold.decrypt=trigger_restart_framework
-    start zygote
-    class_start main
-    class_start late_start
-
-on property:vold.decrypt=trigger_shutdown_framework
-    class_reset late_start
-    class_reset main
-
-# Daemon processes to be run by init.
-service ueventd /sbin/ueventd
-    class core
-    critical
-
-service console /system/bin/sh
-    class core
-    console
-    disabled
-    user shell
-    group log
-
-on property:ro.debuggable=1
-    start console
-
-# adbd is controlled via property triggers in init.<platform>.usb.rc
-service adbd /sbin/adbd
-    class core
-    disabled
-
-service sfc /sbin/sfc
-    class core
-    oneshot
-
-service servicemanager /system/bin/servicemanager
-    class core
-    user system
-    group system
-    critical
-    onrestart restart zygote
-    onrestart restart media
-    onrestart restart surfaceflinger
-    onrestart restart drm
-
-service vold /system/bin/vold
-    class core
-    cgroup bg
-    socket vold stream 0660 root mount
-    ioprio be 2
-
-service netd /system/bin/netd
-    class main
-    socket netd stream 0660 root system
-    socket dnsproxyd stream 0660 root inet
-    socket mdns stream 0660 root system
-
-service debuggerd /system/bin/debuggerd
-    class main
-    cgroup bg
-
-service ril-daemon /system/bin/rild
-    class core
-    socket rild stream 660 root radio
-    socket rild-debug stream 660 radio system
-    socket rild-htc stream 660 radio system
-    socket aepls001 stream 660 radio system
-    user root
-    group radio cache inet misc audio sdcard_r sdcard_rw qcom_oncrpc diag qcom_diag
-
-service surfaceflinger /system/bin/surfaceflinger
-    class core
-    user system
-    group graphics
-    onrestart restart zygote
-
-service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server
-    class main
-    socket zygote stream 660 root system
-    onrestart write /sys/android_power/request_state wake
-    onrestart write /sys/power/state on
-    onrestart restart media
-    onrestart restart netd
-
-service drm /system/bin/drmserver
-    class main
-    user drm
-    group drm system inet drmrpc sdcard_r
-
-service media /system/bin/mediaserver
-    class main
-    user media
-    group audio camera inet net_bt net_bt_admin net_bw_acct drmrpc qcom_diag sdcard_rw sdcard_r media_rw cw_access
-    ioprio rt 4
-
-service bootanim /system/bin/bootanimation
-    class main
-    user graphics
-    group system audio graphics cw_access
-    disabled
-    oneshot
-
-service dbus /system/bin/dbus-daemon --system --nofork
-    class main
-    socket dbus stream 660 bluetooth bluetooth
-    user bluetooth
-    group bluetooth net_bt_admin
-
-service bluetoothd /system/bin/bluetoothd -n
-    class main
-    socket bluetooth stream 660 bluetooth bluetooth
-    socket dbus_bluetooth stream 660 bluetooth bluetooth
-    # init.rc does not yet support applying capabilities, so run as root and
-    # let bluetoothd drop uid to bluetooth with the right linux capabilities
-    group bluetooth net_bt_admin misc
-    disabled
-
-service installd /system/bin/installd
-    class main
-    cgroup bg
-    socket installd stream 600 system system
-
-service racoon /system/bin/racoon
-    class main
-    socket racoon stream 600 system system
-    # IKE uses UDP port 500. Racoon will setuid to vpn after binding the port.
-    group vpn net_admin inet
-    disabled
-    oneshot
-
-service mtpd /system/bin/mtpd
-    class main
-    socket mtpd stream 600 system system
-    user vpn
-    group vpn net_admin inet net_raw
-    disabled
-    oneshot
-
-service keystore /system/bin/keystore /data/misc/keystore
-    class main
-    user keystore
-    group keystore drmrpc
-    socket keystore stream 666
-
-service dumpstate /system/bin/dumpstate -s
-    class main
-    socket dumpstate stream 0660 shell log
-    disabled
-    oneshot
-
-service htc_dk /system/bin/dumpstate -s -k -a
-    class main
-    socket htc_dk stream 0660 shell log
-
-service htc_dlk /system/bin/dumpstate -s -l -a
-    class main
-    socket htc_dlk stream 0660 shell log
-
-service shutdown /system/bin/shutdown
-    user root
-    group root
-    disabled
-    oneshot
-
-service charging /system/bin/charging
-    user root
-    group root
-    disabled
-    oneshot
-
-service sshd /system/bin/start-ssh
-    class main
-    disabled
-
-service mdnsd /system/bin/mdnsd
-    class main
-    user mdnsr
-    group inet net_raw
-    socket mdnsd stream 0660 mdnsr inet
-    disabled
-    oneshot
-
-service L2PE /system/bin/l2_profile_exchange handset softap.0
-    user root
-    group root
-    disabled
-    oneshot
-
-service priorityd /system/bin/sh /system/etc/priorityd.sh
-    user root
-    disabled
-    oneshot
-
-# Start tweaks core script for Android Revolution HD
-service arhd-tweaks /system/bin/sh /system/etc/init.post_boot.sh
-    class main
-    user root
-    group root
-    oneshot
diff --git a/ramdisk/ueventd.m7.rc b/ramdisk/ueventd.m7.rc
deleted file mode 100644
index a60caf0..0000000
--- a/ramdisk/ueventd.m7.rc
+++ /dev/null
@@ -1,118 +0,0 @@
-# Edited for Android Revolution HD
-/dev/rtc0                 0600   system     system
-
-# the DIAG device node is world writable/readable.
-/dev/diag                 0666   root       root
-
-# the genlock client device node is world writable/readable.
-/dev/genlock              0666   root      root
-
-# gpu driver for adreno200 is globally accessible
-/dev/kgsl                 0666   root       root
-/dev/kgsl-3d0             0666   root       root
-/dev/kgsl-2d0             0666   root       root
-/dev/kgsl-2d1             0666   root       root
-
-# these should not be world writable
-/dev/ttyHS0               0600   bluetooth  bluetooth
-/dev/ttyGS0               0660   system     system
-/dev/sdio_tty_ciq_00      0660   system     system
-/dev/pmem_audio           0660   system     audio
-/dev/pmem_smipool*        0660   system     camera
-/dev/oncrpc/*             0660   radio      system
-/dev/gss                  0660   gps        gps
-/dev/msm_camera/*         0660   system     camera
-/dev/radio0               0644   fm_radio   fm_radio
-/dev/i2c-0                0664   root       system
-/dev/i2c-1                0664   root       system
-/dev/i2c-2                0664   root       system
-/dev/i2c-4                0664   root       system
-/dev/msm_mvs              0660   system     audio
-/dev/msm_voicememo        0660   system     audio
-/dev/tzcom                0660   system     audio
-/dev/qce                  0660   system     audio
-/dev/msm_pcm_lp_dec       0660   system     audio
-/dev/smd4                 0660   system     system
-/dev/smd3                 0660   bluetooth  bluetooth
-/dev/smd2                 0660   bluetooth  bluetooth
-/dev/smd7                 0640   radio      radio
-/dev/smdcntl0             0640   radio      radio
-/dev/smdcntl1             0640   radio      radio
-/dev/smdcntl2             0640   radio      radio
-/dev/smdcntl3             0640   radio      radio
-/dev/smdcntl4             0640   radio      radio
-/dev/smdcntl5             0640   radio      radio
-/dev/smdcntl6             0640   radio      radio
-/dev/smdcntl7             0640   radio      radio
-/dev/sdioctl0             0640   radio      radio
-/dev/sdioctl1             0640   radio      radio
-/dev/sdioctl2             0640   radio      radio
-/dev/sdioctl3             0640   radio      radio
-/dev/sdioctl4             0640   radio      radio
-/dev/sdioctl4             0640   radio      radio
-/dev/sdioctl5             0640   radio      radio
-/dev/sdioctl6             0640   radio      radio
-/dev/sdioctl7             0640   radio      radio
-/dev/sdioctl8             0640   radio      radio
-/dev/rmnet_mux_ctrl       0640   radio      radio
-/dev/hsicctl0             0640   radio      radio
-/dev/hsicctl1             0640   radio      radio
-/dev/hsicctl2             0640   radio      radio
-/dev/hsicctl3             0640   radio      radio
-/dev/qemu_trace           0666   system     system
-/dev/gemini0              0660   system     camera
-/dev/rawchip0             0660   system     camera
-/dev/mdm                  0660   system     system
-/dev/ttyHSL1              0660   system     system
-/dev/tty_sdio_00          0660   system     system
-/dev/block/mmcblk0p17     0660   system     system
-/dev/block/mmcblk0p18     0660   system     system
-/dev/video*	              0660   system     camera 
-#regular apps need to be able to open ion
-/dev/ion                  0664   system     system
-
-#permissions for video
-/dev/msm_vidc_reg         0660  system       audio
-/dev/msm_vidc_dec         0660  system       audio
-/dev/msm_vidc_dec_sec     0660  system       audio
-/dev/msm_vidc_enc         0660  system       audio
-#permissions for audio
-/dev/msm_amrnb            0660  system       audio
-/dev/msm_amrwb            0660  system       audio
-/dev/msm_aac              0660  system       audio
-/dev/msm_multi_aac        0660  system       audio
-/dev/msm_aac_in           0660  system       audio
-/dev/msm_qcelp            0660  system       audio
-/dev/msm_evrc             0660  system       audio
-/dev/msm_fm               0660  system       audio
-/dev/msm_acdb             0660  system       audio
-/dev/msm_rtac             0660  system       audio
-/dev/msm_wma              0660  system       audio
-/dev/msm_wmapro           0660  system       audio
-/dev/msm_qcelp_in         0660  system       audio
-/dev/msm_evrc_in          0660  system       audio
-/dev/msm_preproc_ctl      0660  system       audio
-/dev/msm_a2dp_in          0640  system       audio
-/dev/msm_amrnb_in         0640  system       audio
-/sys/devices/virtual/smdpkt/smdcntl*       open_timeout   0664 radio radio
-#permissions for sensors
-/dev/msm_dsps             0660  system       system
-
-# felica device file nodes
-/dev/felica            0666   felicaclient   felicaclient
-/dev/felica_pon        0666   felicaclient   felicaclient
-/dev/felica_cen        0666   felicalock     felicalock
-/dev/felica_rfs        0444   felicaclient   felicaclient
-/dev/felica_rws        0666   felicaclient   felicaclient
-/dev/felica_int        0444   felicaclient   felicaclient
-/dev/felica_int_poll   0400   felicaclient   felicaclient
-/dev/felica_uid        0222   felicaclient   felicaclient
-
-# cir
-/dev/ttyHSL3              0660   irda       irda
-
-# HtcCarGPS
-/dev/ttyHSUSB1                                 0600    system  system
-
-# for autobot car pc
-/dev/ttyHSUSB3                                 0660    autobot_access autobot_access
diff --git a/rootdir/Android.mk b/rootdir/Android.mk
index 091c7e9..7655295 100644
--- a/rootdir/Android.mk
+++ b/rootdir/Android.mk
@@ -1,33 +1,18 @@
 LOCAL_PATH := $(call my-dir)
 
 include $(CLEAR_VARS)
-LOCAL_MODULE		:= init.qcom.sh
+LOCAL_MODULE		:= fstab.m7wls
 LOCAL_MODULE_TAGS	:= optional eng
 LOCAL_MODULE_CLASS	:= ETC
-LOCAL_SRC_FILES		:= etc/init.qcom.sh
+LOCAL_SRC_FILES		:= etc/fstab.m7wls
 LOCAL_MODULE_PATH	:= $(TARGET_ROOT_OUT)
 include $(BUILD_PREBUILT)
 
 include $(CLEAR_VARS)
-LOCAL_MODULE		:= init.qcom.usb.rc
+LOCAL_MODULE		:= init.target.rc
 LOCAL_MODULE_TAGS	:= optional eng
 LOCAL_MODULE_CLASS	:= ETC
-LOCAL_SRC_FILES		:= etc/init.qcom.usb.rc
+LOCAL_SRC_FILES		:= etc/init.target.rc
 LOCAL_MODULE_PATH	:= $(TARGET_ROOT_OUT)
 include $(BUILD_PREBUILT)
 
-include $(CLEAR_VARS)
-LOCAL_MODULE		:= init.qcom.rc
-LOCAL_MODULE_TAGS	:= optional eng
-LOCAL_MODULE_CLASS	:= ETC
-LOCAL_SRC_FILES		:= etc/init.qcom.rc
-LOCAL_MODULE_PATH	:= $(TARGET_ROOT_OUT)
-include $(BUILD_PREBUILT)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE		:= ueventd.qcom.rc
-LOCAL_MODULE_TAGS	:= optional eng
-LOCAL_MODULE_CLASS	:= ETC
-LOCAL_SRC_FILES		:= etc/ueventd.qcom.rc
-LOCAL_MODULE_PATH	:= $(TARGET_ROOT_OUT)
-include $(BUILD_PREBUILT)
diff --git a/ramdisk/fstab.m7 b/rootdir/etc/fstab.m7wls
similarity index 100%
rename from ramdisk/fstab.m7
rename to rootdir/etc/fstab.m7wls
diff --git a/rootdir/etc/init.qcom.rc b/rootdir/etc/init.qcom.rc
deleted file mode 100644
index 89d0eed..0000000
--- a/rootdir/etc/init.qcom.rc
+++ /dev/null
@@ -1,271 +0,0 @@
-# Common HTC 8960 init script
-
-import init.qcom.usb.rc
-
-on early-init
-    mkdir /mnt/usbdisk 0755 system system
-
-on init
-    mkdir /devlog 0700 root root
-
-on fs
-    mkdir /tombstones 0771 system system
-    mkdir /tombstones/lpass 0771 system system
-
-on post-fs-data
-    # double check perms and set owner
-    chown root root /devlog
-    chmod 0700 /devlog
-
-    # Set indication (checked by vold) that we have finished this action
-    setprop vold.post_fs_done 1
-
-    # prepare kernel for wifi module
-    setprop ro.product.wireless WCN3660
-    write /dev/wcnss_wlan 1
-
-on boot
-    # mount debugfs for systrace
-    mount debugfs /sys/kernel/debug /sys/kernel/debug
-
-    chown system system /persist
-    chmod 0771 /persist
-
-    # Chown polling nodes as needed from UI running on system server
-    chmod 0664 /sys/devices/platform/msm_sdcc.1/polling
-    chmod 0664 /sys/devices/platform/msm_sdcc.2/polling
-    chmod 0664 /sys/devices/platform/msm_sdcc.3/polling
-    chmod 0664 /sys/devices/platform/msm_sdcc.4/polling
-
-    chown system system /sys/devices/platform/msm_sdcc.1/polling
-    chown system system /sys/devices/platform/msm_sdcc.2/polling
-    chown system system /sys/devices/platform/msm_sdcc.3/polling
-    chown system system /sys/devices/platform/msm_sdcc.4/polling
-
-    # bluetooth
-    mkdir /data/misc/bluetooth 0770 bluetooth bluetooth
-    chown bluetooth bluetooth /sys/module/bluetooth_power/parameters/power
-    chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type
-    chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
-    chown bluetooth bluetooth /proc/bluetooth/sleep/proto
-    chown system system /sys/module/sco/parameters/disable_esco
-    chown bluetooth bluetooth /sys/module/hci_smd/parameters/hcismd_set
-    chmod 0660 /sys/module/bluetooth_power/parameters/power
-    chmod 0660 /sys/module/hci_smd/parameters/hcismd_set
-    chmod 0660 /sys/class/rfkill/rfkill0/state
-    chmod 0660 /proc/bluetooth/sleep/proto
-    chown bluetooth bluetooth /sys/devices/platform/msm_serial_hs.0/clock
-    chmod 0660 /sys/devices/platform/msm_serial_hs.0/clock
-
-    # for modem link
-    chown system system /sys/module/serial/parameters/modem_enabled
-
-    # wifi
-    mkdir /data/misc/wifi 0770 wifi wifi
-    mkdir /data/misc/wifi/sockets 0770 wifi wifi
-    mkdir /data/misc/wifi/hostapd 0770 wifi wifi
-    mkdir /data/misc/wifi/wpa_supplicant 0770 wifi wifi
-    mkdir /data/misc/dhcp 0770 dhcp dhcp
-    chown dhcp dhcp /data/misc/dhcp
-
-    # for ST R3GD20
-    chown system system /sys/class/htc_gyro/gyro/enable_device
-    chown system system /sys/class/htc_gyro/gyro/pollrate_ms
-    chown system system /sys/class/htc_gyro/gyro/range
-    chown system system /sys/class/htc_gyro/gyro/enable_polling
-    chown system system /sys/class/htc_gyro/gyro/fifo_samples
-    chown system system /sys/class/htc_gyro/gyro/fifo_mode
-    chown system system /sys/class/htc_gyro/gyro/reg_value
-    chown system system /sys/class/htc_gyro/gyro/reg_addr
-
-    # create symlink to qcn wpa_supplicant folder
-    symlink /data/misc/wifi/wpa_supplicant /data/system/wpa_supplicant
-    symlink /dev/socket/wpa_wlan0 /data/system/wpa_supplicant/wlan0
-
-    # node for USB service
-    mkdir /dev/bus/ 755 root root
-    mkdir /dev/bus/usb 755 root root
-
-    # symlink for HDMI
-    symlink /dev/graphics/fb1 /dev/graphics/hdmi
-
-    # audio
-    mkdir /data/audio 0775 media audio
-
-    # radio
-    mkdir /data/radio 0770 radio radio
-
-    # time-services
-    mkdir /data/time 0700 system system
-
-    # liblights
-    chown system system /sys/class/leds/green/brightness
-    chown system system /sys/class/leds/green/blink
-    chown system system /sys/class/leds/amber/brightness
-    chown system system /sys/class/leds/amber/blink
-    chown system system /sys/class/leds/button-backlight/brightness
-    chown system system /sys/class/leds/lcd-backlight/brightness
-
-    # flashlight
-    chown system system /sys/class/leds/flashlight/brightness
-    chmod 0666          /sys/class/leds/flashlight/brightness
-
-    # low charge current in voice call
-    chown radio radio /sys/class/power_supply/battery/phone_call
-    chown radio radio /sys/class/power_supply/battery/network_search
-
-    # allow interfaces to get v6 address when tethering is enabled
-    write /proc/sys/net/ipv6/conf/rmnet0/accept_ra 2
-    write /proc/sys/net/ipv6/conf/rmnet1/accept_ra 2
-    write /proc/sys/net/ipv6/conf/rmnet2/accept_ra 2
-    write /proc/sys/net/ipv6/conf/rmnet3/accept_ra 2
-    write /proc/sys/net/ipv6/conf/rmnet4/accept_ra 2
-    write /proc/sys/net/ipv6/conf/rmnet5/accept_ra 2
-    write /proc/sys/net/ipv6/conf/rmnet6/accept_ra 2
-    write /proc/sys/net/ipv6/conf/rmnet7/accept_ra 2
-    write /proc/sys/net/ipv6/conf/rmnet_sdio0/accept_ra 2
-    write /proc/sys/net/ipv6/conf/rmnet_sdio1/accept_ra 2
-    write /proc/sys/net/ipv6/conf/rmnet_sdio2/accept_ra 2
-    write /proc/sys/net/ipv6/conf/rmnet_sdio3/accept_ra 2
-    write /proc/sys/net/ipv6/conf/rmnet_sdio4/accept_ra 2
-    write /proc/sys/net/ipv6/conf/rmnet_sdio5/accept_ra 2
-    write /proc/sys/net/ipv6/conf/rmnet_sdio6/accept_ra 2
-    write /proc/sys/net/ipv6/conf/rmnet_sdio7/accept_ra 2
-
-    # Define TCP buffer sizes for various networks
-    setprop net.tcp.buffersize.hspa 4096,174760,3145728,4096,16384,110208
-    setprop net.tcp.buffersize.hsupa 4096,174760,1572864,4096,16384,110208
-    setprop net.tcp.buffersize.hsdpa 4096,174760,1572864,4096,16384,110208
-    setprop net.tcp.buffersize.umts 4096,174760,1572864,4096,16384,110208
-    setprop net.tcp.buffersize.edge 4096,174760,1572864,4096,16384,35040
-    setprop net.tcp.buffersize.gprs 4096,174760,1572864,4096,8760,11680
-
-    # load kineto_gan.ko
-    insmod /system/lib/modules/kineto_gan.ko
-
-    # cyttsp update
-    write /sys/devices/i2c-3/3-0024/cyttsp_update_fw 1
-
-# Services start here
-
-service abld /system/bin/mm-abl-daemon
-    disabled
-
-service dhcpcd_wlan0 /system/bin/dhcpcd -ABKLG
-    disabled
-    oneshot
-
-service fm_dl /system/bin/sh /system/etc/init.qcom.fm.sh
-    user root
-    group system qcom_oncrpc
-    disabled
-    oneshot
-
-service hciattach /system/bin/sh /system/etc/init.qcom.bt.sh
-    user bluetooth
-    group qcom_oncrpc bluetooth net_bt_admin
-    disabled
-    oneshot
-
-service hdmid /system/bin/hdmid
-    socket hdmid stream 0660 root system graphics
-    disabled
-
-service iprenew_wlan0 /system/bin/dhcpcd -n
-    disabled
-    oneshot
-
-service mpdecision /system/bin/mpdecision --no_sleep --avg_comp
-    user root
-    disabled
-
-service netmgrd /system/bin/netmgrd
-    class main
-
-service p2p_supplicant /system/bin/wpa_supplicant -Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf
-    user root
-    group wifi inet
-    socket wpa_wlan0 dgram 0660 wifi wifi
-    disabled
-    oneshot
-
-service qcamerasvr /system/bin/mm-qcamera-daemon
-    class main
-    user system
-    group system camera inet
-
-service qcom-post-boot /system/bin/sh /system/etc/init.qcom.post_boot.sh
-    user root
-    disabled
-    oneshot
-
-service qcom-sh /system/bin/sh /init.qcom.sh
-    class main
-    user root
-    oneshot
-
-service qmuxd /system/bin/qmuxd
-    class main
-    user radio
-    group radio
-
-service rmt_storage /system/bin/rmt_storage modem_st1 modem_st2 recovery radio_config
-    class core
-    user root
-
-service thermald /system/bin/thermald
-    user root
-    group root
-    disabled
-
-service time_daemon /system/bin/time_daemon
-    user root
-    group root
-    oneshot
-    disabled
-
-service wpa_supplicant /system/bin/wpa_supplicant -Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf
-    user root
-    group wifi inet
-    socket wpa_wlan0 dgram 0660 wifi wifi
-    disabled
-    oneshot
-
-service zchgd_offmode /system/bin/zchgd -pseudooffmode
-    user root
-    group root graphics
-    disabled
-
-service zchgd_onmode /system/bin/zchgd -onmode
-    user root
-    group root graphics
-    oneshot
-
-on property:init.svc.bootanim=stopped
-    start qcom-post-boot
-
-on property:init.svc.wpa_supplicant=stopped
-    stop dhcpcd_wlan0
-
-on property:persist.thermal.monitor=true
-    start thermald
-
-on property:persist.timed.enable=true
-    start time_daemon
-
-on property:ro.hdmi.enable=true
-    start hdmid
-
-on property:ro.qualcomm.cabl=1
-    start abld
-
-on property:ro.qualcomm.cabl=0
-    stop abld
-
-on property:ro.use_data_netmgrd=false
-    stop netmgrd
-
-on property:service.adb.root=1
-    write /sys/class/android_usb/android0/enable 0
-    restart adbd
-    write /sys/class/android_usb/android0/enable 1
diff --git a/rootdir/etc/init.qcom.sh b/rootdir/etc/init.qcom.sh
deleted file mode 100644
index d8709ec..0000000
--- a/rootdir/etc/init.qcom.sh
+++ /dev/null
@@ -1,257 +0,0 @@
-#!/system/bin/sh
-# Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#     * Redistributions of source code must retain the above copyright
-#       notice, this list of conditions and the following disclaimer.
-#     * Redistributions in binary form must reproduce the above copyright
-#       notice, this list of conditions and the following disclaimer in the
-#       documentation and/or other materials provided with the distribution.
-#     * Neither the name of Code Aurora nor
-#       the names of its contributors may be used to endorse or promote
-#       products derived from this software without specific prior written
-#       permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#
-# start ril-daemon only for targets on which radio is present
-#
-baseband=`getprop ro.baseband`
-multirild=`getprop ro.multi.rild`
-dsds=`getprop persist.dsds.enabled`
-case "$baseband" in
-    "msm" | "csfb" | "svlte2a" | "unknown")
-    start ril-daemon
-    start qmuxd
-    start netmgrd
-    case "$baseband" in
-        "svlte2a" | "csfb")
-        start qmiproxy
-    esac
-    case "$multirild" in
-        "true")
-         case "$dsds" in
-             "true")
-             start ril-daemon1
-         esac
-    esac
-esac
-
-#
-# Suppress default route installation during RA for IPV6; user space will take
-# care of this
-#
-for file in /proc/sys/net/ipv6/conf/*
-do
-  echo 0 > $file/accept_ra_defrtr
-done
-
-#
-# Allow unique persistent serial numbers for devices connected via usb
-# User needs to set unique usb serial number to persist.usb.serialno
-#
-serialno=`getprop persist.usb.serialno`
-case "$serialno" in
-    "") ;; #Do nothing here
-    * )
-    mount -t debugfs none /sys/kernel/debug
-    echo "$serialno" > /sys/kernel/debug/android/serial_number
-esac
-
-#
-# Allow persistent usb charging disabling
-# User needs to set usb charging disabled in persist.usb.chgdisabled
-#
-target=`getprop ro.board.platform`
-usbchgdisabled=`getprop persist.usb.chgdisabled`
-case "$usbchgdisabled" in
-    "") ;; #Do nothing here
-    * )
-    case $target in
-        "msm8660_surf" | "msm8660_csfb")
-        echo "$usbchgdisabled" > /sys/module/pmic8058_charger/parameters/disabled
-        echo "$usbchgdisabled" > /sys/module/smb137b/parameters/disabled
-	;;
-        "msm8960")
-        echo "$usbchgdisabled" > /sys/module/pm8921_charger/parameters/disabled
-	;;
-    esac
-esac
-
-#
-# Allow USB enumeration with default PID/VID
-#
-#case $target in
-#    by HTC: disable QCT USB initial code first
-#    "msm8960")
-#        echo 0       > /sys/class/android_usb/android0/enable
-#        echo 0x9025  > /sys/class/android_usb/android0/idProduct
-#        echo 0x05C6  > /sys/class/android_usb/android0/idVendor
-#        echo diag    > /sys/class/android_usb/android0/f_diag/clients
-#        echo smd,tty > /sys/class/android_usb/android0/f_serial/transports
-#        echo 1       > /sys/class/android_usb/android0/f_rmnet/instances
-#        echo diag,adb,serial,rmnet,mass_storage    > /sys/class/android_usb/android0/functions
-#        echo 1       > /sys/class/android_usb/android0/enable
-#    ;;
-#    * )
-#        echo 0       > /sys/class/android_usb/android0/enable
-#        echo 0x9025  > /sys/class/android_usb/android0/idProduct
-#        echo 0x05C6  > /sys/class/android_usb/android0/idVendor
-#        echo diag    > /sys/class/android_usb/android0/f_diag/clients
-#        echo tty,tty > /sys/class/android_usb/android0/f_serial/transports
-#        echo diag,adb,serial,rmnet_smd,mass_storage    > /sys/class/android_usb/android0/functions
-#        echo 1       > /sys/class/android_usb/android0/enable
-#    ;;
-#esac
-
-
-#
-# Start gpsone_daemon for SVLTE Type I & II devices
-#
-target=`getprop ro.board.platform`
-case "$target" in
-        "msm7630_fusion")
-        start gpsone_daemon
-esac
-case "$baseband" in
-        "svlte2a")
-        start gpsone_daemon
-        start bridgemgrd
-esac
-
-case "$target" in
-    "msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
-        insmod /system/lib/modules/ss_mfcinit.ko
-        insmod /system/lib/modules/ss_vencoder.ko
-        insmod /system/lib/modules/ss_vdecoder.ko
-        chmod 0666 /dev/ss_mfc_reg
-        chmod 0666 /dev/ss_vdec
-        chmod 0666 /dev/ss_venc
-
-        value=`cat /sys/devices/system/soc/soc0/hw_platform`
-
-        case "$value" in
-            "FFA" | "SVLTE_FFA")
-             # linking to surf_keypad_qwerty.kcm.bin instead of surf_keypad_numeric.kcm.bin so that
-             # the UI keyboard works fine.
-             ln -s  /system/usr/keychars/surf_keypad_qwerty.kcm.bin /system/usr/keychars/surf_keypad.kcm.bin;;
-            "Fluid")
-             setprop ro.sf.lcd_density 240
-             setprop qcom.bt.dev_power_class 2
-             start profiler_daemon;;
-            *)
-             ln -s  /system/usr/keychars/surf_keypad_qwerty.kcm.bin /system/usr/keychars/surf_keypad.kcm.bin;;
-
-        esac
-
-# Dynamic Memory Managment (DMM) provides a sys file system to the userspace
-# that can be used to plug in/out memory that has been configured as unstable.
-# This unstable memory can be in Active or In-Active State.
-# Each of which the userspace can request by writing to a sys file.
-
-# ro.dev.dmm = 1; Indicates that DMM is enabled in the Android User Space. This
-# property is set in the Android system properties file.
-
-# ro.dev.dmm.dpd.start_address is set when the target has a 2x256Mb memory
-# configuration. This is also used to indicate that the target is capable of
-# setting EBI-1 to Deep Power Down or Self Refresh.
-
-        mem="/sys/devices/system/memory"
-        op=`cat $mem/movable_start_bytes`
-        case "$op" in
-           "0" )
-                log -p i -t DMM DMM Disabled. movable_start_bytes not set: $op
-            ;;
-
-            "$mem/movable_start_bytes: No such file or directory " )
-                log -p i -t DMM DMM Disabled. movable_start_bytes does not exist: $op
-            ;;
-
-            * )
-                log -p i -t DMM DMM available. movable_start_bytes at $op
-                movable_start_bytes=0x`cat $mem/movable_start_bytes`
-                block_size_bytes=0x`cat $mem/block_size_bytes`
-                block=$(($movable_start_bytes/$block_size_bytes))
-
-                echo $movable_start_bytes > $mem/probe
-                case "$?" in
-                    "0" )
-                        log -p i -t DMM $movable_start_bytes to physical hotplug succeeded.
-                    ;;
-                    * )
-                        log -p e -t DMM $movable_start_bytes to physical hotplug failed.
-                        return 1
-                    ;;
-                esac
-
-               chown system system $mem/memory$block/state
-
-                echo online > $mem/memory$block/state
-                case "$?" in
-                    "0" )
-                        log -p i -t DMM \'echo online\' to logical hotplug succeeded.
-                    ;;
-                    * )
-                        log -p e -t DMM \'echo online\' to logical hotplug failed.
-                        return 1
-                    ;;
-                esac
-
-                setprop ro.dev.dmm.dpd.start_address $movable_start_bytes
-                setprop ro.dev.dmm.dpd.block $block
-            ;;
-        esac
-
-        op=`cat $mem/low_power_memory_start_bytes`
-        case "$op" in
-            "0" )
-                log -p i -t DMM Self-Refresh-Only Disabled. low_power_memory_start_bytes not set:$op
-            ;;
-
-            "$mem/low_power_memory_start_bytes No such file or directory " )
-                log -p i -t DMM Self-Refresh-Only Disabled. low_power_memory_start_bytes does not exist:$op
-            ;;
-
-            * )
-                log -p i -t DMM Self-Refresh-Only available. low_power_memory_start_bytes at $op
-            ;;
-        esac
-        ;;
-    "msm8660" | "msm8660_csfb" )
-        platformvalue=`cat /sys/devices/system/soc/soc0/hw_platform`
-        case "$platformvalue" in
-            "Fluid")
-                echo 1 > /data/system/sensors/settings
-                start sensors
-                setprop ro.sf.lcd_density 240
-                start profiler_daemon;;
-            "Dragon")
-                setprop ro.sound.alsa "WM8903";;
-        esac
-        chown root.system /sys/devices/platform/msm_hsusb/gadget/wakeup
-        chmod 220 /sys/devices/platform/msm_hsusb/gadget/wakeup
-        ;;
-    "msm7627a" )
-        chown root.system /sys/devices/platform/msm_hsusb/gadget/wakeup
-        chmod 220 /sys/devices/platform/msm_hsusb/gadget/wakeup
-        ;;
-    "msm8960")
-	echo 1 > /data/system/sensors/settings
-	start sensors
-	chown root.system /sys/devices/platform/msm_otg/msm_hsusb/gadget/wakeup
-	chmod 220 /sys/devices/platform/msm_otg/msm_hsusb/gadget/wakeup
-
-esac
diff --git a/rootdir/etc/init.qcom.usb.rc b/rootdir/etc/init.qcom.usb.rc
deleted file mode 100644
index 4002b28..0000000
--- a/rootdir/etc/init.qcom.usb.rc
+++ /dev/null
@@ -1,61 +0,0 @@
-on boot
-    write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer}
-    write /sys/class/android_usb/android0/iProduct ${ro.product.model}
-    write /sys/class/android_usb/android0/iSerial ${ro.serialno}
-    write /sys/class/android_usb/android0/f_mass_storage/inquiry_string "HTC Phone                0000"
-    write /sys/class/android_usb/android0/f_rndis/manufacturer HTC
-    write /sys/class/android_usb/android0/f_rndis/vendorID 0bb4
-    write /sys/class/android_usb/android0/f_rndis/wceis 1
-
-on property:sys.usb.config=mass_storage
-    write /sys/class/android_usb/android0/enable 0
-    write /sys/class/android_usb/android0/idVendor 0bb4
-    write /sys/class/android_usb/android0/idProduct ${ro.usb.idproduct.ums}
-    write /sys/class/android_usb/android0/functions ${sys.usb.config}
-    write /sys/class/android_usb/android0/enable 1
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mass_storage,adb
-    write /sys/class/android_usb/android0/enable 0
-    write /sys/class/android_usb/android0/idVendor 0bb4
-    write /sys/class/android_usb/android0/idProduct ${ro.usb.idproduct.ums}
-    write /sys/class/android_usb/android0/functions ${sys.usb.config}
-    write /sys/class/android_usb/android0/enable 1
-    start adbd
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp
-    write /sys/class/android_usb/android0/enable 0
-    write /sys/class/android_usb/android0/idVendor 0bb4
-    write /sys/class/android_usb/android0/idProduct ${ro.usb.idproduct.mtp}
-    write /sys/class/android_usb/android0/functions ${sys.usb.config}
-    write /sys/class/android_usb/android0/enable 1
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,adb
-    write /sys/class/android_usb/android0/enable 0
-    write /sys/class/android_usb/android0/idVendor 0bb4
-    write /sys/class/android_usb/android0/idProduct ${ro.usb.idproduct.mtp_adb}
-    write /sys/class/android_usb/android0/functions ${sys.usb.config}
-    write /sys/class/android_usb/android0/enable 1
-    start adbd
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=rndis
-    write /sys/class/android_usb/android0/enable 0
-    write /sys/class/android_usb/android0/idVendor 0bb4
-    write /sys/class/android_usb/android0/idProduct ${ro.usb.idproduct.rndis}
-    write /sys/class/android_usb/android0/functions ${sys.usb.config}
-    write /sys/class/android_usb/android0/bDeviceClass 224
-    write /sys/class/android_usb/android0/enable 1
-    setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=rndis,adb
-    write /sys/class/android_usb/android0/enable 0
-    write /sys/class/android_usb/android0/idVendor 0bb4
-    write /sys/class/android_usb/android0/idProduct ${ro.usb.idproduct.rndis}
-    write /sys/class/android_usb/android0/functions ${sys.usb.config}
-    write /sys/class/android_usb/android0/bDeviceClass 224
-    write /sys/class/android_usb/android0/enable 1
-    start adbd
-    setprop sys.usb.state ${sys.usb.config}
diff --git a/rootdir/etc/init.target.rc b/rootdir/etc/init.target.rc
new file mode 100755
index 0000000..7ad0d19
--- /dev/null
+++ b/rootdir/etc/init.target.rc
@@ -0,0 +1,34 @@
+on early-init
+    mkdir /storage 0050 system sdcard_r
+    mkdir /storage/sdcard0 0000 system system
+
+    # for backwards compatibility
+    symlink /storage/sdcard0 /mnt/sdcard
+    symlink /storage/sdcard0 /sdcard
+
+    export EXTERNAL_STORAGE /storage/sdcard0
+
+    setprop ro.usb.idproduct.ums 0ce9
+    setprop ro.usb.idproduct.mtp 0f91
+    setprop ro.usb.idproduct.mtp_adb 0df5
+    setprop ro.usb.idproduct.rndis 0ce9
+
+on fs
+    # mount all the things
+    mount_all fstab.m7wls
+
+    # for NFC
+    symlink /system/vendor/pittpatt /vendor/pittpatt
+    symlink /system/vendor/firmware/libpn544_fw.so /vendor/firmware/libpn544_fw.so
+
+on boot
+    # m7wls radio
+    mkdir /dev/socket/qmux_radio 0770 radio radio
+    chmod 2770 /dev/socket/qmux_radio
+
+# Services start here
+
+service akmd /system/bin/akmd
+    class main
+    user compass
+    group compass misc input
diff --git a/rootdir/etc/ueventd.qcom.rc b/rootdir/etc/ueventd.qcom.rc
deleted file mode 100644
index f2e31e1..0000000
--- a/rootdir/etc/ueventd.qcom.rc
+++ /dev/null
@@ -1,148 +0,0 @@
-/dev/rtc0                 0600   system     system
-
-# HTC diag
-/dev/btdiag               0660   radio      radio
-/dev/diag_arm9            0660   radio      radio
-/dev/diag_mdm             0660   radio      radio
-/dev/htcdiag              0660   radio      radio
-
-# the genlock client device node is world writable/readable.
-/dev/genlock              0666   root       root
-
-# gpu driver for adreno200 is globally accessible
-/dev/kgsl-3d0             0666   root       root
-/dev/kgsl-2d0             0666   root       root
-/dev/kgsl-2d1             0666   root       root
-
-/dev/ttyHS0               0660   bluetooth  bluetooth
-/dev/ttyGS0               0660   system     system
-/dev/sdio_tty_ciq_00      0660   system     system
-/dev/msm_rotator          0660   system     graphics
-/dev/pmem_audio           0660   system     audio
-/dev/pmem_smipool*        0660   system     camera
-/dev/oncrpc/*             0660   radio      system
-/dev/radio0               0644   fm_radio   fm_radio
-/dev/i2c-0                0664   root       system
-/dev/i2c-1                0664   root       system
-/dev/i2c-2                0664   root       system
-/dev/i2c-4                0664   root       system
-/dev/msm_mvs              0660   system     audio
-/dev/msm_voicememo        0660   system     audio
-/dev/tzcom                0660   system     audio
-/dev/qce                  0660   system     audio
-/dev/msm_pcm_lp_dec       0660   system     audio
-# HTC
-/dev/smd0                 0660   system     system
-/dev/smd4                 0660   system     system
-/dev/smd3                 0660   bluetooth      bluetooth
-/dev/smd2                 0660   bluetooth      bluetooth
-/dev/smd7                 0640   radio      radio
-/dev/smdcntl0             0640   radio      radio
-/dev/smdcntl1             0640   radio      radio
-/dev/smdcntl2             0640   radio      radio
-/dev/smdcntl3             0640   radio      radio
-/dev/smdcntl4             0640   radio      radio
-/dev/smdcntl5             0640   radio      radio
-/dev/smdcntl6             0640   radio      radio
-/dev/smdcntl7             0640   radio      radio
-/dev/sdioctl0             0640   radio      radio
-/dev/sdioctl1             0640   radio      radio
-/dev/sdioctl2             0640   radio      radio
-/dev/sdioctl3             0640   radio      radio
-/dev/sdioctl4             0640   radio      radio
-/dev/sdioctl4             0640   radio      radio
-/dev/sdioctl5             0640   radio      radio
-/dev/sdioctl6             0640   radio      radio
-/dev/sdioctl7             0640   radio      radio
-/dev/sdioctl8             0640   radio      radio
-/dev/rmnet_ctrl           0640   radio      radio
-/dev/qemu_trace           0666   system     system
-/dev/gemini0              0660   system     camera
-/dev/rawchip0             0660   system     system
-/dev/mdm                  0660   system     system
-/dev/ttyHSL1              0660   system     system
-/dev/tty_sdio_00          0660   system     system
-/dev/block/mmcblk0p17     0660   system     system
-/dev/block/mmcblk0p18     0660   system     system
-/dev/video*               0660   system     camera
-
-# regular apps need to be able to open ion
-/dev/ion                  0664   system     system
-
-# wifi
-/dev/rfkill               0660   root       wifi
-
-# CDMA radio interface MUX
-/dev/ts0710mux*           0640   radio      radio
-/dev/ppp                  0660   radio      vpn
-
-# permissions for video
-/dev/msm_vidc_reg         0660  system       audio
-/dev/msm_vidc_dec         0660  system       audio
-/dev/msm_vidc_dec_sec     0660  system       audio
-/dev/msm_vidc_enc         0660  system       audio
-
-# permissions for audio
-/dev/msm_amrnb            0660  system       audio
-/dev/msm_amrwb            0660  system       audio
-/dev/msm_aac              0660  system       audio
-/dev/msm_multi_aac        0660  system       audio
-/dev/msm_aac_in           0660  system       audio
-/dev/msm_qcelp            0660  system       audio
-/dev/msm_evrc             0660  system       audio
-/dev/msm_fm               0660  system       audio
-/dev/msm_acdb             0660  system       audio
-/dev/msm_rtac             0660  system       audio
-/dev/msm_wma              0660  system       audio
-/dev/msm_wmapro           0660  system       audio
-/dev/msm_qcelp_in         0660  system       audio
-/dev/msm_evrc_in          0660  system       audio
-/dev/msm_preproc_ctl      0660  system       audio
-/dev/msm_a2dp_in          0640  system       audio
-/dev/msm_amrnb_in         0640  system       audio
-
-# sensors
-/dev/akm8975_aot          0640  compass      system
-/dev/akm8975_daemon       0640  compass      system
-/dev/bma150               0640  compass      system
-/dev/ewtzmu2daemon        0640  system       system
-/dev/ewtzmu2hal           0640  system       system
-/dev/ewtzmu2              0640  system       system
-/dev/mpu                  0664  system       system
-/dev/mpuirq               0664  system       system
-/dev/timerirq             0664  system       system
-
-# for simlock
-/dev/simlock              0660  radio        radio
-
-# sysfs properties
-/sys/devices/virtual/smdpkt/smdcntl*       open_timeout   0664 radio radio
-
-# felica device file nodes
-/dev/felica            0666   felicaclient   felicaclient
-/dev/felica_pon        0666   felicaclient   felicaclient
-/dev/felica_cen        0666   felicalock     felicalock
-/dev/felica_rfs        0444   felicaclient   felicaclient
-/dev/felica_rws        0666   felicaclient   felicaclient
-/dev/felica_int        0444   felicaclient   felicaclient
-/dev/felica_int_poll   0400   felicaclient   felicaclient
-/dev/felica_uid        0222   felicaclient   felicaclient
-
-# for modem link
-/sys/module/serial/parameters/modem_enabled    0600    system  system
-/dev/ttyHSUSB0                                 0600    system  system
-/dev/ttySA0                                    0600    system  system
-/dev/smd9                                      0600    system  system
-
-# for autobot car pc
-/dev/ttyHSUSB3                                 0660    autobot_access autobot_access
-/dev/ttyHSUSB1                                 0600    system system
-
-# NFC
-/dev/pn544                0600   nfc        nfc
-
-#Usb Stuff
-/dev/bus/usb/*            0660   root       usb
-/dev/mtp_usb              0660   root       mtp
-/dev/usb_accessory        0660   root       usb
-/dev/usb/lp*              0660   system     usb
diff --git a/system.prop b/system.prop
index 4736d56..64f1f6c 100644
--- a/system.prop
+++ b/system.prop
@@ -2,286 +2,40 @@
 # system.prop for m7wls
 #
 
-ro.phone.min_match.BOOST000=8
-ro.phone.min_match.SPRINT00=8
-ro.phone.min_match.VM000000=8
-ro.ril.oem.ecclist=911
-ro.ril.hsdpa.category=10
-ro.ril.hsupa.category=6
-ro.ril.hsxpa=2
-ro.ril.disable.fd.plmn.prefix=23402,23410,23411,23420
-ro.ril.enable.sdr=0
-ro.ril.set.mtusize=1422
-ro.com.google.clientidbase=android-htc
-ro.com.google.clientidbase.yt=android-sprint-mvno-us
-ro.com.google.clientidbase.am=android-sprint-mvno-us
-ro.com.google.clientidbase.ms=android-sprint-mvno-us
-ro.wifi.hotspotUI=0
-ro.bt.tetheringUI=0
-ro.usb.tetheringUI=0
-ro.phone.min_match=8
-ro.product.brand=htc
-ro.product.model=HTCONE
-ro.camera.sound.forced=1
-ro.cdma.home.operator.alpha=HTC
-gsm.sim.operator.alpha=Chameleon
-gsm.operator.alpha=Chameleon
-ro.cdma.home.operator.numeric=000000
-gsm.sim.operator.numeric=000000
-gsm.operator.numeric=000000
-gsm.sim.operator.iso-country=us
-gsm.operator.iso-country=us
-ro.net.apnwhitelist=admin
-ro.htc.checkin.delay=0
-ro.watch.appid=com.sdgtl.watch.m7wl_50_jb_spcs
-ro.telephony.ipv6_capability=1
-dev.defaultwallpaper=/system/customize/resource/wallpapers_a_00.jpg
-# begin build properties
-# autogenerated by buildinfo.sh
-htc.build.stage=2
-ro.aa.rid=126
-ro.cwkey=SPCS_001
-ro.aa.skulist=651
-ro.aa.customizationid=499013
-ro.aa.taskid=312285
-ro.aa.romver=1.29.651.7
-ro.aa.project=M7_WL_JB_50_SPCS
-ro.onecid=1
-ro.aa.mainsku=651
-ro.aa.modelid=PN0720000
-ro.prot=true
-ro.aa.maincid=SPCS_001
-ro.aa.report=com
-ro.aa.cidlist=SPCS_001
-ro.com.google.clientidbase=android-htc
-ro.build.id=JZO54K
-ro.build.display.id=JZO54K
-ro.build.version.incremental=166937.7
-ro.build.version.sdk=16
-ro.build.version.codename=REL
-ro.build.version.release=4.1.2
-ro.build.date=一  3月 18 18:46:54 CST 2013
-ro.build.date.utc=1363603614
-ro.build.type=user
-ro.build.user=
-ro.build.host=abm007
-ro.build.tags=release-keys
-ro.product.model=M7WLS
-ro.product.brand=htc
-ro.product.name=m7wls
-ro.product.device=m7wls
-ro.product.board=
-ro.product.cpu.abi=armeabi-v7a
-ro.product.cpu.abi2=armeabi
-ro.product.manufacturer=HTC
-ro.product.locale.language=xxhdpi
-ro.wifi.channels=
-ro.board.platform=msm8960
-# ro.build.product is obsolete; use ro.product.device
-ro.build.product=m7wls
-ro.build.description=1.29.651.7 CL166937 release-keys
-ro.build.changelist=166937
-ro.build.fingerprint=htc/m7wls/m7wls:4.1.2/JZO54K/166937.7:user/release-keys
-ro.build.characteristics=nosdcard
-ro.build.project=M7_WL_JB_50_SPCS:312285
-ro.product.version=
-ro.build.languageremove=0
-ro.build.sense.version=5.0
-keyguard.no_require_sim=1
-# end build properties
-#
-# system.prop for m7wl
-#
-
-rild.libpath=/system/lib/libril-qc-qmi-1.so
-rild.libargs=-d /dev/smd0
-persist.rild.nitz_plmn=
-persist.rild.nitz_long_ons_0=
-persist.rild.nitz_long_ons_1=
-persist.rild.nitz_long_ons_2=
-persist.rild.nitz_long_ons_3=
-persist.rild.nitz_short_ons_0=
-persist.rild.nitz_short_ons_1=
-persist.rild.nitz_short_ons_2=
-persist.rild.nitz_short_ons_3=
-ril.subscription.types=NV,RUIM
-DEVICE_PROVISIONED=1
-
-
-#
-# system.prop for display
-#
-debug.sf.hw=1
-debug.egl.hw=1
-debug.composition.type=gpu
-debug.enabletr=true
-ro.hwui.renderer.disable_opaque=true
 ro.sf.lcd_density=480
-debug.mdpcomp.maxlayer=3
-debug.egl.buffcount=4
 
-dalvik.vm.heapsize=384m
-dalvik.vm.heapgrowthlimit=192m
-dev.pm.dyn_samplingrate=1
-
-#
-# system props for the cne module
-#
-persist.cne.UseCne=vendor
-persist.cne.UseSwim=false
-persist.cne.bat.range.low.med=30
-persist.cne.bat.range.med.high=60
-persist.cne.loc.policy.op=/system/etc/OperatorPolicy.xml
-persist.cne.loc.policy.user=/system/etc/UserPolicy.xml
-persist.cne.bwbased.rat.sel=false
-persist.cne.snsr.based.rat.mgt=false
-persist.cne.bat.based.rat.mgt=false
-persist.cne.rat.acq.time.out=30000
-persist.cne.rat.acq.retry.tout=0
-persist.cne.sync.swim.mode=false
-
-ro.hdmi.enable=true
-lpa.decode=true
-tunnel.decode=true
-lpa.use-stagefright=true
-lpa.releaselock=true
-
-#system props for the MM modules
-
-media.stagefright.enable-player=true
-media.stagefright.enable-http=true
-media.stagefright.enable-aac=true
-media.stagefright.enable-qcp=true
-media.stagefright.enable-fma2dp=true
-media.stagefright.enable-scan=true
-mmp.enable.3g2=true
-
-#
-# system props for the data modules
-#
+# RIL properties
+rild.libargs=-d /dev/smd0
+rild.libpath=/system/lib/libril-qc-qmi-1.so
+ro.vendor.extension_library=/system/lib/libqc-opt.so
+ril.subscription.types=NV,RUIM
+ro.telephony.ril.v3=subscriptionFromSource,skipCdmaSubcription
+ro.telephony.default_network=8
+keyguard.no_require_sim=true
+DEVICE_PROVISIONED=1
+telephony.lteOnCdmaDevice=1
+ro.config.svlte1x=true
+ro.cdma.subscribe_on_ruim_ready=true
+persist.radio.no_wait_for_card=1
+ro.ril.gprsclass=10
+ro.ril.hsxpa=1
+persist.radio.add_power_save=1
+persist.radio.snapshot_disabled=1
+persist.radio.apm_sim_not_pwdn=1
+ro.telephony.call_ring.multiple=0
+ro.ril.transmitpower=true
 ro.use_data_netmgrd=true
+persist.data_netmgrd_nint=16
+persist.cne.UseCne=false
 
-#system props for time-services
+# NFC
+debug.nfc.fw_download=true
+debug.nfc.fw_boot_download=false
+debug.nfc.se=true
+ro.nfc.port=I2C
+
+# enable time services
 persist.timed.enable=true
 
-# System props for audio
-persist.audio.fluence.mode=endfire
-persist.audio.vr.enable=false
-persist.audio.handset.mic=digital
-# System props for soundhound
-persist.htc.audio.pcm.samplerate=48000
-persist.htc.audio.pcm.channels=2
-
-# System prop to select audio resampler quality
-af.resampler.quality=255
-
-# System props for global effect
-htc.audio.global.state=0
-htc.audio.global.profile=0
-htc.audio.q6.topology=0
-htc.audio.global.speaker=1
-
-# System props for inbox bundle headset info
-persist.htc.audio.inbox.profile=max300_2vol_20130219
-
-#
-# system prop for opengles version
-#
-# 131072 is decimal for 0x20000 to report version 2
-ro.opengles.version=131072
-
-#system prop for switching gps driver to qmi
-persist.gps.qmienabled=true
-
-# System property for cabl
-ro.qualcomm.cabl=0
-
-#
-# System prop for sending transmit power request to RIL during WiFi hotspot on/off
-#
-ro.ril.transmitpower=true
-
-#
-# System prop for RIL to check world phone feature for ECC list
-#
-ro.ril.wp.feature=1
-
-# For workaround for ro.baseband property. QCT use the property same as radio version to determine the architecture.
-# But we hard code to mdm for M7.
-ro.baseband.arch = mdm
-
-#Add default network type for phone reference
-ro.telephony.default_network=8
-
-#
-#Simulate sdcard on /data/media
-#
-persist.fuse_sdcard=true
-
-# M7 Hardware Info
-ro.product.bluetooth=4.0
-ro.product.display_resolution = 4.7 inch 1080p resolution
-ro.product.main_camera = HTC UltraPixel Camera
-ro.product.front_camera = 2.1M
-ro.product.processor = Quadcore
-ro.product.ram = 2GB
-ro.product.wifi = 802.11 a/b/g/n/ac
-
-
-#wifi
-wifi.interface=wlan0
-wifi.supplicant_scan_interval=15
-wifi.softap.interface=wlan0
-wifi.softapconcurrent.interface=wl0.1
-persist.wifi.v6=true
-persist.wifi.v6.rs.count=5
-persist.wifi.v6.rs.timeout=5
-
-# Properties of BTLA stack
-service.brcm.bt.activation = 0
-service.brcm.bt.srv_active = 0
-service.brcm.bt.hcid_active = 0
-service.brcm.bt.btld = 0
-service.brcm.bt.btld_pid = 0
-service.brcm.bt.avrcp_pass_thru = 0
-service.brcm.bt.avrcp_toggle = 1
-service.brcm.bt.local_name =
-service.brcm.bt.4335hwerrwar = 1
-service.brcm.bt.TRC_HTCSDBG = 1
-service.brcm.bt.wbs = 1
-service.brcm.bt.FTS_ROOT_FOLDER = /storage
-
-# Support HW reset
-ro.product.hwreset = 1
-ro.product.hwreset.timer1 = 6
-ro.product.hwreset.timer2 = 9
-
-#For usb storage
-ro.usb_host = 1
-
-# system property for RIL snapshot feature/timer
-persist.radio.snapshot_enabled = 1
-persist.radio.snapshot_timer = 22
-
-# Preloading common control assets
-persist.preload.common=1
-
-# Perflock for inter-process activity launch and first launch
-persist.htc.multicore.timeout = 1500
-
-# Perflock for Home process lock duration
-persist.htc.multicore.home = 800
-
-#
-# ADDITIONAL_BUILD_PROPERTIES
-#
-ro.carrier=unknown
-ro.config.notification_sound=OnTheHunt.ogg
-ro.config.alarm_alert=Alarm_Classic.ogg
-drm.service.enabled=true
-ro.setupwizard.mode=OPTIONAL
-ro.com.google.gmsversion=4.1_r4
-ro.service.dpsvr.enabled=true
-ro.vendor.extension_library=/system/lib/libqc-opt.so
-net.bt.name=Android
-dalvik.vm.stack-trace-file=/data/anr/traces.txt
\ No newline at end of file
+# UMS
+persist.sys.usb.config=mtp
\ No newline at end of file