Compare commits
88 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 630d6ffa07 | |||
| 476f7c66bc | |||
| 48c1b054fb | |||
| afbf81a098 | |||
| bee16fab09 | |||
| 0aaee3d485 | |||
| a2723a09ed | |||
| 6a4d9c2ba1 | |||
| f30988f7d5 | |||
| d667d569f4 | |||
| 5868faf190 | |||
| a63180a8a3 | |||
| 975afea5f8 | |||
| 2f4a508d25 | |||
| 5474f86ed3 | |||
| dbf7120621 | |||
| 51f1b5c413 | |||
| 2974fcbacc | |||
| 5ef184cde2 | |||
| 123acb3039 | |||
| 42985a4d74 | |||
| 2fff02bc6c | |||
| f4202152b2 | |||
| fccb9fd63e | |||
| ed2b211764 | |||
| 356a9ca71a | |||
| d3d8ed8255 | |||
| 7954b3b196 | |||
| 99934e61ef | |||
| bde4c9ced6 | |||
| 491578e176 | |||
| 43c99f3a9e | |||
| 68347ad03d | |||
| e6475587b2 | |||
| 61467d0f18 | |||
| 95b720a985 | |||
| 0997cac3d0 | |||
| 905c306371 | |||
| b8e67364ce | |||
| 284b07cd48 | |||
| 115162ec01 | |||
| 1fa6ce7906 | |||
| 74e6b79ccd | |||
| 7bb1419ece | |||
| 16c60556b3 | |||
| 12861a9115 | |||
| 5c950fc2c5 | |||
| 2629ed2783 | |||
| 3af430148d | |||
| be412e9874 | |||
| a7c975743e | |||
| 583934990e | |||
| a99e72d7ae | |||
| af5fc1119f | |||
| f078808c05 | |||
| bc9a06bdcd | |||
| 49f7f6d552 | |||
| 6995162644 | |||
| 735eff93ef | |||
| 1c63b627e5 | |||
| 21c182ea64 | |||
| 945d603e1a | |||
| 095a0d6458 | |||
| 9c8f0dd4b3 | |||
| 982245879f | |||
| 747ea0b6e4 | |||
| 499f58e1f3 | |||
| c327fa2795 | |||
| 8044589cc2 | |||
| c374a5d94c | |||
| 9b6e1687a5 | |||
| f05ef24973 | |||
| 354f24634c | |||
| 11a691afac | |||
| a711c66fde | |||
| f3dbfe434c | |||
| d0a57d821c | |||
| de2f47b646 | |||
| 05b4e6e8d2 | |||
| 9c2791c193 | |||
| 6680f39db9 | |||
| f0199bc841 | |||
| 4aff6597ba | |||
| 8453b50bd1 | |||
| b36544cd03 | |||
| 3c3077c603 | |||
| 592dcad594 | |||
| ae057fde23 |
+7
-1
@@ -12,10 +12,16 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
ifeq ($(TARGET_BOOTLOADER_BOARD_NAME),htcleo)
|
||||
|
||||
LOCAL_PATH := $(my-dir)
|
||||
subdir_makefiles := \
|
||||
$(LOCAL_PATH)/libreference-ril/Android.mk \
|
||||
$(LOCAL_PATH)/libsensors/Android.mk \
|
||||
$(LOCAL_PATH)/liblights/Android.mk
|
||||
$(LOCAL_PATH)/liblights/Android.mk \
|
||||
$(LOCAL_PATH)/libgps/Android.mk \
|
||||
$(LOCAL_PATH)/libhtc_ril_wrapper/Android.mk
|
||||
|
||||
include $(subdir_makefiles)
|
||||
|
||||
endif
|
||||
|
||||
@@ -25,5 +25,12 @@ LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
ALL_PREBUILT += $(INSTALLED_KERNEL_TARGET)
|
||||
|
||||
file := $(TARGET_RECOVERY_ROOT_OUT)/sbin/postrecoveryboot.sh
|
||||
ALL_PREBUILT += $(file)
|
||||
$(file) : $(LOCAL_PATH)/postrecoveryboot.sh | $(ACP)
|
||||
$(transform-prebuilt-to-target)
|
||||
|
||||
# include the non-open-source counterpart to this file
|
||||
-include vendor/htc/leo/AndroidBoardVendor.mk
|
||||
|
||||
+24
-52
@@ -25,79 +25,51 @@
|
||||
# against the traditional rules of inheritance).
|
||||
USE_CAMERA_STUB := false
|
||||
|
||||
# inherit from common msm7x30 device
|
||||
-include device/htc/msm7x30-common/BoardConfigCommon.mk
|
||||
|
||||
# inherit from the proprietary version
|
||||
-include vendor/htc/leo/BoardConfigVendor.mk
|
||||
|
||||
TARGET_NO_BOOTLOADER := true
|
||||
|
||||
TARGET_BOARD_PLATFORM := qsd8k
|
||||
TARGET_BOARD_PLATFORM_GPU := qcom-adreno200
|
||||
TARGET_BOOTLOADER_BOARD_NAME := htcleo
|
||||
|
||||
TARGET_CPU_ABI := armeabi-v7a
|
||||
TARGET_CPU_ABI2 := armeabi
|
||||
TARGET_ARCH_VARIANT := armv7-a-neon
|
||||
|
||||
TARGET_BOOTLOADER_BOARD_NAME := leo
|
||||
|
||||
# Wifi related defines
|
||||
BOARD_WPA_SUPPLICANT_DRIVER := WEXT
|
||||
WPA_SUPPLICANT_VERSION := VER_0_6_X
|
||||
BOARD_WLAN_DEVICE := bcm4329
|
||||
WIFI_DRIVER_MODULE_PATH := "/system/lib/modules/bcm4329.ko"
|
||||
WIFI_DRIVER_FW_STA_PATH := "/vendor/firmware/fw_bcm4329.bin"
|
||||
WIFI_DRIVER_FW_AP_PATH := "/vendor/firmware/fw_bcm4329_apsta.bin"
|
||||
WIFI_DRIVER_MODULE_ARG := "firmware_path=/vendor/firmware/fw_bcm4329.bin nvram_path=/proc/calibration"
|
||||
WIFI_DRIVER_MODULE_NAME := "bcm4329"
|
||||
|
||||
BOARD_KERNEL_CMDLINE := no_console_suspend=1 msmsdcc_sdioirq=1 wire.search_count=5
|
||||
|
||||
BOARD_USES_GENERIC_AUDIO := false
|
||||
BOARD_KERNEL_BASE := 0x20000000
|
||||
BOARD_KERNEL_CMDLINE := no_console_suspend=1 wire.search_count=5
|
||||
BOARD_KERNEL_BASE := 0x11800000
|
||||
BOARD_KERNEL_NEW_PPPOX := true
|
||||
|
||||
BOARD_HAVE_BLUETOOTH := true
|
||||
BOARD_HAVE_BLUETOOTH_BCM := true
|
||||
|
||||
BOARD_VENDOR_QCOM_AMSS_VERSION := 3200
|
||||
|
||||
BOARD_VENDOR_QCOM_AMSS_VERSION := 1550
|
||||
BOARD_VENDOR_USE_AKMD := akm8973
|
||||
|
||||
BOARD_EGL_CFG := device/htc/leo/egl.cfg
|
||||
|
||||
BOARD_USE_FROYO_LIBCAMERA := true
|
||||
|
||||
BOARD_USES_QCOM_LIBS := true
|
||||
BOARD_USES_QCOM_LIBRPC := true
|
||||
BOARD_USES_QCOM_GPS := true
|
||||
|
||||
BOARD_HAVE_FM_RADIO := true
|
||||
BOARD_GLOBAL_CFLAGS += -DHAVE_FM_RADIO
|
||||
|
||||
# Use Special Leo update
|
||||
TARGET_USES_LEOUPDATE := true
|
||||
|
||||
TARGET_USES_16BPPSURFACE_FOR_OPAQUE := true
|
||||
BOARD_NO_RGBX_8888 := true
|
||||
|
||||
BOARD_USE_KINETO_COMPATIBILITY := true
|
||||
|
||||
# # cat /proc/mtd
|
||||
# dev: size erasesize name
|
||||
# mtd0: 000a0000 00020000 "misc"
|
||||
# mtd1: 00500000 00020000 "recovery"
|
||||
# mtd2: 00280000 00020000 "boot"
|
||||
# mtd3: 0fa00000 00020000 "system"
|
||||
# mtd4: 02800000 00020000 "cache"
|
||||
# mtd5: 093a0000 00020000 "userdata"
|
||||
#mtd0: 00100000 00020000 "misc"
|
||||
#mtd1: 00500000 00020000 "recovery"
|
||||
#mtd2: 00500000 00020000 "boot"
|
||||
#mtd3: 09600000 00020000 "system"
|
||||
#mtd4: 02c00000 00020000 "cache"
|
||||
#mtd5: 0d900000 00020000 "userdata"
|
||||
|
||||
BOARD_BOOTIMAGE_PARTITION_SIZE := 0x00300000
|
||||
BOARD_BOOTIMAGE_PARTITION_SIZE := 0x00500000
|
||||
BOARD_RECOVERYIMAGE_PARTITION_SIZE := 0x00500000
|
||||
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 0x09100000 # limited so we enforce room to grow
|
||||
BOARD_USERDATAIMAGE_PARTITION_SIZE := 0x093a0000
|
||||
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 0x09600000 # limited so we enforce room to grow
|
||||
BOARD_USERDATAIMAGE_PARTITION_SIZE := 0x0d900000
|
||||
BOARD_FLASH_BLOCK_SIZE := 131072
|
||||
|
||||
|
||||
TARGET_CUSTOM_RELEASETOOL := device/htc/leo/releasetools/squisher
|
||||
TARGET_RELEASETOOLS_EXTENSIONS := device/htc/common
|
||||
TARGET_PREBUILT_KERNEL := device/htc/leo/kernel
|
||||
TARGET_PREBUILT_KERNEL := device/htc/leo/prebuilt/kernel
|
||||
TARGET_PREBUILT_RECOVERY_KERNEL := device/htc/leo/prebuilt/recovery_kernel
|
||||
|
||||
# to enable the GPS HAL
|
||||
BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE := htcleo
|
||||
BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE := leo
|
||||
# AMSS version to use for GPS
|
||||
BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION := 3200
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2010 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.
|
||||
|
||||
DEVICE=leo
|
||||
MANUFACTURER=htc
|
||||
STAGESYS=~/cm-$DEVICE/system
|
||||
|
||||
if [ "$1" = "pull" ]; then
|
||||
if [ -s "$STAGESYS" ]; then
|
||||
rm -R ~/cm-$DEVICE
|
||||
fi
|
||||
mkdir ~/cm-$DEVICE
|
||||
mkdir $STAGESYS
|
||||
mkdir $STAGESYS/bin
|
||||
mkdir $STAGESYS/lib
|
||||
mkdir $STAGESYS/etc
|
||||
adb pull /system/bin $STAGESYS/bin
|
||||
adb pull /system/lib $STAGESYS/lib
|
||||
adb pull /system/etc $STAGESYS/etc
|
||||
fi
|
||||
|
||||
OUTDIR=../../../vendor/$MANUFACTURER/$DEVICE
|
||||
BASE=$OUTDIR/proprietary
|
||||
rm -rf $BASE/*
|
||||
|
||||
for FILE in `cat proprietary-files.txt | grep -v ^# | grep -v ^$`; do
|
||||
DIR=`dirname $FILE`
|
||||
if [ ! -d $BASE/$DIR ]; then
|
||||
mkdir -p $BASE/$DIR
|
||||
fi
|
||||
cp $STAGESYS/$FILE $BASE/$FILE
|
||||
done
|
||||
|
||||
./setup-makefiles.sh
|
||||
+9
-87
@@ -19,93 +19,15 @@
|
||||
DEVICE=leo
|
||||
MANUFACTURER=htc
|
||||
|
||||
mkdir -p ../../../vendor/$MANUFACTURER/$DEVICE/proprietary
|
||||
adb pull /system/bin/akmd ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/akmd
|
||||
chmod 755 ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/akmd
|
||||
adb pull /system/bin/parse_radio_log ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/parse_radio_log
|
||||
chmod 755 ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/parse_radio_log
|
||||
adb pull /system/etc/AudioBTID.csv ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/AudioBTID.csv
|
||||
adb pull /system/etc/AdieHWCodecSetting.csv ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/AdieHWCodecSetting.csv
|
||||
adb pull /system/etc/firmware/BCM4329B1_002.002.023.0360.0362.hcd ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/BCM4329B1_002.002.023.0360.0362.hcd
|
||||
adb pull /system/etc/firmware/BCM4329B1_002.002.023.0436.0439.hcd ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/BCM4329B1_002.002.023.0436.0439.hcd
|
||||
adb pull /system/etc/firmware/BCM4329B1_002.002.023.0436.0439.hcd ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/BCM4329B1_002.002.023.0436.0439.hcd
|
||||
adb pull /system/etc/firmware/BCM4329B1_002.002.023.0511.0538.hcd ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/BCM4329B1_002.002.023.0511.0538.hcd
|
||||
adb pull /system/etc/firmware/bcm4329.hcd ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/bcm4329.hcd
|
||||
adb pull /system/etc/firmware/htcleo.acdb ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/htcleo.acdb
|
||||
adb pull /system/etc/firmware/default.acdb ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/default.acdb
|
||||
adb pull /system/etc/firmware/yamato_pfp.fw ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/yamato_pfp.fw
|
||||
adb pull /system/etc/firmware/yamato_pm4.fw ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/yamato_pm4.fw
|
||||
adb pull /system/lib/egl/libEGL_adreno200.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/libEGL_adreno200.so
|
||||
adb pull /system/lib/egl/libGLESv1_CM_adreno200.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/libGLESv1_CM_adreno200.so
|
||||
adb pull /system/lib/egl/libGLESv2_adreno200.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/libGLESv2_adreno200.so
|
||||
adb pull /system/lib/egl/libq3dtools_adreno200.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/libq3dtools_adreno200.so
|
||||
adb pull /system/lib/libcamera.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/libcamera.so
|
||||
adb pull /system/lib/libgsl.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/libgsl.so
|
||||
adb pull /system/lib/libhtc_acoustic.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/libhtc_acoustic.so
|
||||
adb pull /system/lib/libhtc_ril.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/libhtc_ril.so
|
||||
adb pull /system/lib/libhtc_ril_wrapper.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/libhtc_ril_wrapper.so
|
||||
adb pull /system/lib/liboemcamera.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/liboemcamera.so
|
||||
adb pull /system/lib/libOmxVdec.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/libOmxVdec.so
|
||||
adb pull /system/lib/libOmxVidEnc.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/libOmxVidEnc.so
|
||||
adb pull /system/lib/libOmxCore.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/libOmxCore.so
|
||||
adb pull /system/lib/libmm-omxcore.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/libmm-omxcore.so
|
||||
adb pull /system/lib/libgps.so ..h/../../vendor/$MANUFACTURER/$DEVICE/proprietary/libgps.so
|
||||
adb pull /system/lib/hw/gps.htcleo.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/gps.htcleo.so
|
||||
adb pull /system/lib/hw/sensors.bravo.so ../../../vendor/$MANUFACTURER/$DEVICE/proprietary/sensors.bravo.so
|
||||
BASE=../../../vendor/$MANUFACTURER/$DEVICE/proprietary
|
||||
rm -rf $BASE/*
|
||||
|
||||
(cat << EOF) | sed s/__DEVICE__/$DEVICE/g | sed s/__MANUFACTURER__/$MANUFACTURER/g > ../../../vendor/$MANUFACTURER/$DEVICE/device-vendor-blobs.mk
|
||||
# Copyright (C) 2010 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.
|
||||
|
||||
# This file is generated by device/__MANUFACTURER__/__DEVICE__/extract-files.sh - DO NOT EDIT
|
||||
|
||||
# Prebuilt libraries that are needed to build open-source libraries
|
||||
PRODUCT_COPY_FILES := \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/libcamera.so:obj/lib/libcamera.so
|
||||
|
||||
# All the blobs necessary for leo
|
||||
PRODUCT_COPY_FILES += \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/akmd:system/bin/akmd \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/parse_radio_log:system/bin/parse_radio_log \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/AudioBTID.csv:system/etc/AudioBTID.csv \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/AdieHWCodecSetting.csv:system/etc/AdieHWCodecSetting.csv \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/bcm4329.hcd:system/etc/firmware/bcm4329.hcd \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/BCM4329B1_002.002.023.0360.0362.hcd:system/etc/firmware/BCM4329B1_002.002.023.0360.0362.hcd \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/BCM4329B1_002.002.023.0436.0439.hcd:system/etc/firmware/BCM4329B1_002.002.023.0436.0439.hcd \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/BCM4329B1_002.002.023.0511.0538.hcd:system/etc/firmware/BCM4329B1_002.002.023.0511.0538.hcd \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/htcleo.acdb:system/etc/firmware/htcleo.acdb \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/bcm4329.hcd:system/etc/firmware/bcm4329.hcd \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/htcleo.acdb:system/etc/firmware/htcleo.acdb \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/default.acdb:system/etc/firmware/default.acdb \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/yamato_pfp.fw:system/etc/firmware/yamato_pfp.fw \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/yamato_pm4.fw:system/etc/firmware/yamato_pm4.fw \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/libEGL_adreno200.so:system/lib/egl/libEGL_adreno200.so \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/libGLESv1_CM_adreno200.so:system/lib/egl/libGLESv1_CM_adreno200.so \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/libGLESv2_adreno200.so:system/lib/egl/libGLESv2_adreno200.so \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/libq3dtools_adreno200.so:system/lib/egl/libq3dtools_adreno200.so \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/libcamera.so:system/lib/libcamera.so \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/libgsl.so:system/lib/libgsl.so \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/libhtc_acoustic.so:system/lib/libhtc_acoustic.so \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/libhtc_ril.so:system/lib/libhtc_ril.so \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/libhtc_ril_wrapper.so:system/lib/libhtc_ril_wrapper.so \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/liboemcamera.so:system/lib/liboemcamera.so \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/libOmxVdec.so:system/lib/libOmxVdec.so \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/libOmxVidEnc.so:system/lib/libOmxVidEnc.so \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/libOmxCore.so:system/lib/libOmxCore.so \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/libgps.so:system/lib/libgps.so \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/gps.htcleo.so:system/lib/hw/gps.htcleo.so \\
|
||||
vendor/__MANUFACTURER__/__DEVICE__/proprietary/sensors.bravo.so:system/lib/hw/sensors.bravo.so \\
|
||||
EOF
|
||||
for FILE in `cat proprietary-files.txt | grep -v ^# | grep -v ^$`; do
|
||||
DIR=`dirname $FILE`
|
||||
if [ ! -d $BASE/$DIR ]; then
|
||||
mkdir -p $BASE/$DIR
|
||||
fi
|
||||
adb pull /system/$FILE $BASE/$FILE
|
||||
done
|
||||
|
||||
./setup-makefiles.sh
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
NTP_SERVER=north-america.pool.ntp.org
|
||||
XTRA_SERVER_1=http://xtra1.gpsonextra.net/xtra.bin
|
||||
XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra.bin
|
||||
XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra.bin
|
||||
NTP_SERVER=0.north-america.pool.ntp.org
|
||||
NTP_SERVER=1.north-america.pool.ntp.org
|
||||
NTP_SERVER=2.north-america.pool.ntp.org
|
||||
NTP_SERVER=3.north-america.pool.ntp.org
|
||||
XTRA_SERVER_1=http://xtra1.gpsonextra.net/xtra.bin
|
||||
XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra.bin
|
||||
XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra.bin
|
||||
SUPL_HOST=supl.google.com
|
||||
SUPL_PORT=7276
|
||||
SUPL_HOST=FQDN
|
||||
SUPL_PORT=7275
|
||||
SUPL_TLS_HOST=FQDN
|
||||
SUPL_TLS_CERT=/etc/SuplRootCert
|
||||
-131
@@ -1,131 +0,0 @@
|
||||
on init
|
||||
mount rootfs rootfs / remount
|
||||
mkdir /app-cache 01777 system system
|
||||
mount tmpfs tmpfs /app-cache size=8m
|
||||
mount rootfs rootfs / ro remount
|
||||
|
||||
# Define the memory thresholds at which the above process classes will
|
||||
# be killed. These numbers are in pages (4k).
|
||||
setprop ro.FOREGROUND_APP_MEM 3584
|
||||
setprop ro.VISIBLE_APP_MEM 4096
|
||||
setprop ro.SECONDARY_SERVER_MEM 6144
|
||||
setprop ro.BACKUP_APP_MEM 6144
|
||||
setprop ro.HOME_APP_MEM 6144
|
||||
setprop ro.HIDDEN_APP_MEM 7168
|
||||
setprop ro.CONTENT_PROVIDER_MEM 7680
|
||||
setprop ro.EMPTY_APP_MEM 8192
|
||||
|
||||
on boot
|
||||
mkdir /data/misc/wifi 0770 wifi wifi
|
||||
mkdir /data/misc/wifi/sockets 0770 wifi wifi
|
||||
mkdir /data/misc/dhcp 0770 dhcp dhcp
|
||||
chown dhcp dhcp /data/misc/dhcp
|
||||
|
||||
# bluetooth power up/down interface
|
||||
chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type
|
||||
chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
|
||||
chmod 0660 /sys/class/rfkill/rfkill0/state
|
||||
|
||||
chown radio radio /sys/module/pm/parameters/idle_sleep_mode
|
||||
|
||||
# for wireless modem
|
||||
chown system system /sys/module/serial/parameters/modem_enabled
|
||||
chown system system /dev/ttyHSUSB0
|
||||
chown system system /dev/smd9
|
||||
chown media media /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
|
||||
|
||||
# Power Management
|
||||
write /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate 40000
|
||||
|
||||
# Overwrite framework low memory killer minfree setting
|
||||
write /sys/module/lowmemorykiller/parameters/minfree 3584,4096,6144,7168,7680,8192
|
||||
|
||||
# Enable low memory killer to check file pages
|
||||
write /sys/module/lowmemorykiller/parameters/minfile 0,0,0,5120,5632,6144
|
||||
write /sys/module/lowmemorykiller/parameters/check_filepages 1
|
||||
|
||||
service wpa_supplicant /system/bin/logwrapper /system/bin/wpa_supplicant \
|
||||
-Dwext -ieth0 -c/data/misc/wifi/wpa_supplicant.conf
|
||||
# we will start as root and wpa_supplicant will switch to user wifi
|
||||
# after setting up the capabilities required for WEXT
|
||||
# user wifi
|
||||
# group wifi inet keystore
|
||||
socket wpa_eth0 dgram 660 wifi wifi
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
|
||||
service dhcpcd /system/bin/dhcpcd -ABKL eth0
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
# compass/accelerometer daemon
|
||||
service akmd /system/bin/akmd
|
||||
user compass
|
||||
group compass misc input
|
||||
|
||||
# bugreport is triggered by the KEY_VOLUMEUP and BTN_MOUSE keycodes
|
||||
service bugreport /system/bin/dumpstate -d -v -o /sdcard/bugreports/bugreport
|
||||
disabled
|
||||
oneshot
|
||||
keycodes 115 272
|
||||
|
||||
#service hciattach /system/bin/brcm_patchram_plus --enable_hci --patchram /etc/firmware/bcm4329.hcd /dev/ttyHS0
|
||||
# user bluetooth
|
||||
# group bluetooth net_bt_admin
|
||||
# disabled
|
||||
|
||||
# Make sure we startup btld before hcid
|
||||
# Set target address to emulator host loopback IF
|
||||
# Limit baudrate to 460800 to ensure reliable uart operation
|
||||
#service btld /system/bin/logwrapper /system/bin/btld -hwtun 10.0.2.2 -hb 460800 3000000 -lpm 1
|
||||
service btld /system/bin/logwrapper /system/bin/btld -lpm 1 -hb 3000000
|
||||
user root
|
||||
group bluetooth net_bt_admin
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
# 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 modem /system/xbin/wireless_modem
|
||||
user system
|
||||
group system
|
||||
disabled
|
||||
|
||||
service zchgd /system/bin/zchgd
|
||||
user root
|
||||
group root graphics
|
||||
oneshot
|
||||
|
||||
on property:service.modem.enable=1
|
||||
start modem
|
||||
|
||||
on property:service.modem.enable=0
|
||||
stop modem
|
||||
|
||||
service srv_ser2net /system/bin/ser2net -n
|
||||
disabled
|
||||
|
||||
on property:service.ser2net.enable=1
|
||||
start srv_ser2net
|
||||
|
||||
on property:service.ser2net.enable=0
|
||||
stop srv_ser2net
|
||||
|
||||
service clockd /system/bin/clockd
|
||||
|
||||
@@ -23,59 +23,12 @@
|
||||
## (1) First, the most specific values, i.e. the aspects that are specific to GSM
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/htc/leo/init.leo.rc:root/init.leo.rc \
|
||||
|
||||
PRODUCT_PROPERTY_OVERRIDES += \
|
||||
ro.sf.lcd_density=240 \
|
||||
rild.libpath=/system/lib/libhtc_ril.so \
|
||||
ro.ril.ecc.HTC-ELL=92,93,94 \
|
||||
ro.ril.ecc.HTC-WWE=999 \
|
||||
ro.ril.enable.a52.HTC-ITA=1 \
|
||||
ro.ril.enable.a53.HTC-ITA=1 \
|
||||
ro.ril.enable.a52=0 \
|
||||
ro.ril.enable.a53=1 \
|
||||
ro.ril.enable.dtm = 1 \
|
||||
ro.ril.gprsclass = 12 \
|
||||
ro.ril.hsdpa.category=8 \
|
||||
ro.ril.hsupa.category=5 \
|
||||
ro.ril.hsxpa=2 \
|
||||
wifi.interface=eth0 \
|
||||
wifi.supplicant_scan_interval=15
|
||||
|
||||
# Default network type.
|
||||
# 0 => WCDMA preferred.
|
||||
PRODUCT_PROPERTY_OVERRIDES += \
|
||||
ro.telephony.default_network=0
|
||||
|
||||
|
||||
# Set default_france.acdb to audio_ctl driver if the ro.cid is HTC__203
|
||||
PRODUCT_PROPERTY_OVERRIDES += \
|
||||
ro.ril.enable.prl.recognition=1
|
||||
|
||||
# AGPS otpions
|
||||
PRODUCT_PROPERTY_OVERRIDES += \
|
||||
ro.ril.def.agps.mode=2
|
||||
|
||||
# The OpenGL ES API level that is natively supported by this device.
|
||||
# This is a 16.16 fixed point number
|
||||
PRODUCT_PROPERTY_OVERRIDES += \
|
||||
ro.opengles.version=131072
|
||||
|
||||
device/htc/leo/prebuilt/init.htcleo.rc:root/init.htcleo.rc \
|
||||
device/htc/leo/prebuilt/ueventd.htcleo.rc:root/ueventd.htcleo.rc \
|
||||
|
||||
# we have enough storage space to hold precise GC data
|
||||
PRODUCT_TAGS += dalvik.gc.type-precise
|
||||
|
||||
PRODUCT_PROPERTY_OVERRIDES += \
|
||||
ro.media.dec.jpeg.memcap=20000000
|
||||
|
||||
# This is a high density device with more memory, so larger vm heaps for it.
|
||||
PRODUCT_PROPERTY_OVERRIDES += \
|
||||
dalvik.vm.heapsize=32m
|
||||
|
||||
# leo have huge 250Mb unwritable system and small 50Mb cache .
|
||||
PRODUCT_PROPERTY_OVERRIDES += \
|
||||
dalvik.vm.dexopt-data-only=1
|
||||
|
||||
## (2) Also get non-open-source GSM-specific aspects if available
|
||||
$(call inherit-product-if-exists, vendor/htc/leo/leo-vendor.mk)
|
||||
|
||||
@@ -95,17 +48,22 @@ PRODUCT_COPY_FILES += \
|
||||
|
||||
# media config xml file
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/htc/leo/media_profiles.xml:system/etc/media_profiles.xml
|
||||
device/htc/leo/prebuilt/media_profiles.xml:system/etc/media_profiles.xml
|
||||
|
||||
# This file is used to install the enable RMNET and corresponding modules which dont get activated by normal module script
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/htc/leo/prebuilt/01modules:system/etc/init.d/01modules
|
||||
|
||||
PRODUCT_PACKAGES += \
|
||||
sensors.leo \
|
||||
lights.leo \
|
||||
sensors.htcleo \
|
||||
lights.htcleo \
|
||||
librs_jni \
|
||||
gralloc.qsd8k \
|
||||
copybit.qsd8k \
|
||||
lights.leo \
|
||||
leo-reference-ril \
|
||||
gps.htcleo
|
||||
gps.htcleo \
|
||||
libgps \
|
||||
libhtc_ril_wrapper
|
||||
|
||||
|
||||
|
||||
@@ -113,44 +71,45 @@ PRODUCT_PACKAGES += \
|
||||
PRODUCT_LOCALES := hdpi
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/htc/leo/vold.fstab:system/etc/vold.fstab
|
||||
device/htc/leo/prebuilt/vold.fstab:system/etc/vold.fstab
|
||||
|
||||
# Keylayouts
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/htc/leo/leo-keypad.kl:system/usr/keylayout/leo-keypad.kl \
|
||||
device/htc/leo/leo-keypad.kcm.bin:system/usr/keychars/leo-keypad.kcm.bin \
|
||||
device/htc/leo/h2w_headset.kl:system/usr/keylayout/h2w_headset.kl
|
||||
device/htc/leo/prebuilt/keylayout/leo-keypad.kl:system/usr/keylayout/leo-keypad.kl \
|
||||
device/htc/leo/prebuilt/keylayout/leo-keypad.kcm.bin:system/usr/keychars/leo-keypad.kcm.bin \
|
||||
device/htc/leo/prebuilt/keylayout/h2w_headset.kl:system/usr/keylayout/h2w_headset.kl
|
||||
|
||||
# Firmware
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/htc/leo/firmware/fw_bcm4329.bin:system/etc/firmware/fw_bcm4329.bin \
|
||||
device/htc/leo/firmware/fw_bcm4329_apsta.bin:system/etc/firmware/fw_bcm4329_apsta.bin
|
||||
device/htc/leo/prebuilt/firmware/fw_bcm4329.bin:system/etc/firmware/fw_bcm4329.bin \
|
||||
device/htc/leo/prebuilt/firmware/fw_bcm4329_apsta.bin:system/etc/firmware/fw_bcm4329_apsta.bin
|
||||
|
||||
#GSM APN LIST
|
||||
PRODUCT_COPY_FILES += \
|
||||
vendor/cyanogen/prebuilt/common/etc/apns-conf.xml:system/etc/apns-conf.xml
|
||||
|
||||
vendor/cyanogen/prebuilt/common/etc/apns-conf.xml:system/etc/apns-conf.xml
|
||||
|
||||
# kernel modules
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/htc/leo/modules/bcm4329.ko:system/lib/modules/bcm4329.ko \
|
||||
device/htc/leo/modules/cifs.ko:system/lib/modules/cifs.ko \
|
||||
device/htc/leo/modules/msm_rmnet.ko:system/lib/modules/msm_rmnet.ko \
|
||||
device/htc/leo/modules/nls_utf8.ko:system/lib/modules/nls_utf8.ko \
|
||||
device/htc/leo/modules/tun.ko:system/lib/modules/tun.ko \
|
||||
device/htc/leo/modules/fuse.ko:system/lib/modules/fuse.ko
|
||||
device/htc/leo/prebuilt/modules/bcm4329.ko:system/lib/modules/bcm4329.ko \
|
||||
device/htc/leo/prebuilt/modules/cifs.ko:system/lib/modules/cifs.ko \
|
||||
device/htc/leo/prebuilt/modules/msm_rmnet.ko:system/lib/modules/msm_rmnet.ko \
|
||||
device/htc/leo/prebuilt/modules/nls_utf8.ko:system/lib/modules/nls_utf8.ko \
|
||||
device/htc/leo/prebuilt/modules/tun.ko:system/lib/modules/tun.ko \
|
||||
device/htc/leo/prebuilt/modules/fuse.ko:system/lib/modules/fuse.ko
|
||||
|
||||
# kernel
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/htc/leo/kernel:boot/zImage \
|
||||
device/htc/leo/initrd.gz:boot/initrd.gz \
|
||||
device/htc/leo/prebuilt/kernel:boot/zImage \
|
||||
|
||||
ifeq ($(TARGET_PREBUILT_KERNEL),)
|
||||
LOCAL_KERNEL := device/htc/leo/kernel
|
||||
LOCAL_KERNEL := device/htc/leo/prebuilt/kernel
|
||||
else
|
||||
LOCAL_KERNEL := $(TARGET_PREBUILT_KERNEL)
|
||||
endif
|
||||
|
||||
# The gps config appropriate for this device
|
||||
$(call inherit-product, device/common/gps/gps_as_supl.mk)
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/htc/leo/prebuilt/gps.conf:system/etc/gps.conf
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(LOCAL_KERNEL):kernel
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
#
|
||||
|
||||
# The gps config appropriate for this device
|
||||
$(call inherit-product, device/common/gps/gps_eu_supl.mk)
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/htc/leo/prebuilt/gps_eu.conf:system/etc/gps.conf
|
||||
|
||||
|
||||
# The rest of the configuration is inherited from a generic config
|
||||
$(call inherit-product, device/htc/leo/leo.mk)
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
|
||||
ifneq ($(TARGET_SIMULATOR),true)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
LOCAL_MODULE := libgps
|
||||
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := libutils libcutils librpc
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(TARGET_OUT_HEADERS)/librpc
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
leo-gps.c \
|
||||
leo-gps-rpc.c \
|
||||
time.cpp \
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
endif # !TARGET_SIMULATOR
|
||||
+358
@@ -0,0 +1,358 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _HARDWARE_GPS_H
|
||||
#define _HARDWARE_GPS_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Milliseconds since January 1, 1970 */
|
||||
typedef int64_t GpsUtcTime;
|
||||
|
||||
/** Maximum number of SVs for gps_sv_status_callback(). */
|
||||
#define GPS_MAX_SVS 32
|
||||
|
||||
/** Requested mode for GPS operation. */
|
||||
typedef uint16_t GpsPositionMode;
|
||||
// IMPORTANT: Note that the following values must match
|
||||
// constants in GpsLocationProvider.java.
|
||||
/** Mode for running GPS standalone (no assistance). */
|
||||
#define GPS_POSITION_MODE_STANDALONE 0
|
||||
/** AGPS MS-Based mode. */
|
||||
#define GPS_POSITION_MODE_MS_BASED 1
|
||||
/** AGPS MS-Assisted mode. */
|
||||
#define GPS_POSITION_MODE_MS_ASSISTED 2
|
||||
|
||||
/** GPS status event values. */
|
||||
typedef uint16_t GpsStatusValue;
|
||||
// IMPORTANT: Note that the following values must match
|
||||
// constants in GpsLocationProvider.java.
|
||||
/** GPS status unknown. */
|
||||
#define GPS_STATUS_NONE 0
|
||||
/** GPS has begun navigating. */
|
||||
#define GPS_STATUS_SESSION_BEGIN 1
|
||||
/** GPS has stopped navigating. */
|
||||
#define GPS_STATUS_SESSION_END 2
|
||||
/** GPS has powered on but is not navigating. */
|
||||
#define GPS_STATUS_ENGINE_ON 3
|
||||
/** GPS is powered off. */
|
||||
#define GPS_STATUS_ENGINE_OFF 4
|
||||
|
||||
/** Flags to indicate which values are valid in a GpsLocation. */
|
||||
typedef uint16_t GpsLocationFlags;
|
||||
// IMPORTANT: Note that the following values must match
|
||||
// constants in GpsLocationProvider.java.
|
||||
/** GpsLocation has valid latitude and longitude. */
|
||||
#define GPS_LOCATION_HAS_LAT_LONG 0x0001
|
||||
/** GpsLocation has valid altitude. */
|
||||
#define GPS_LOCATION_HAS_ALTITUDE 0x0002
|
||||
/** GpsLocation has valid speed. */
|
||||
#define GPS_LOCATION_HAS_SPEED 0x0004
|
||||
/** GpsLocation has valid bearing. */
|
||||
#define GPS_LOCATION_HAS_BEARING 0x0008
|
||||
/** GpsLocation has valid accuracy. */
|
||||
#define GPS_LOCATION_HAS_ACCURACY 0x0010
|
||||
|
||||
/** Flags used to specify which aiding data to delete
|
||||
when calling delete_aiding_data(). */
|
||||
typedef uint16_t GpsAidingData;
|
||||
// IMPORTANT: Note that the following values must match
|
||||
// constants in GpsLocationProvider.java.
|
||||
#define GPS_DELETE_EPHEMERIS 0x0001
|
||||
#define GPS_DELETE_ALMANAC 0x0002
|
||||
#define GPS_DELETE_POSITION 0x0004
|
||||
#define GPS_DELETE_TIME 0x0008
|
||||
#define GPS_DELETE_IONO 0x0010
|
||||
#define GPS_DELETE_UTC 0x0020
|
||||
#define GPS_DELETE_HEALTH 0x0040
|
||||
#define GPS_DELETE_SVDIR 0x0080
|
||||
#define GPS_DELETE_SVSTEER 0x0100
|
||||
#define GPS_DELETE_SADATA 0x0200
|
||||
#define GPS_DELETE_RTI 0x0400
|
||||
#define GPS_DELETE_CELLDB_INFO 0x8000
|
||||
#define GPS_DELETE_ALL 0xFFFF
|
||||
|
||||
/** AGPS type */
|
||||
typedef uint16_t AGpsType;
|
||||
#define AGPS_TYPE_SUPL 1
|
||||
#define AGPS_TYPE_C2K 2
|
||||
|
||||
|
||||
/** AGPS status event values. */
|
||||
typedef uint16_t AGpsStatusValue;
|
||||
/** GPS requests data connection for AGPS. */
|
||||
#define GPS_REQUEST_AGPS_DATA_CONN 1
|
||||
/** GPS releases the AGPS data connection. */
|
||||
#define GPS_RELEASE_AGPS_DATA_CONN 2
|
||||
/** AGPS data connection initiated */
|
||||
#define GPS_AGPS_DATA_CONNECTED 3
|
||||
/** AGPS data connection completed */
|
||||
#define GPS_AGPS_DATA_CONN_DONE 4
|
||||
/** AGPS data connection failed */
|
||||
#define GPS_AGPS_DATA_CONN_FAILED 5
|
||||
|
||||
/**
|
||||
* Name for the GPS XTRA interface.
|
||||
*/
|
||||
#define GPS_XTRA_INTERFACE "gps-xtra"
|
||||
|
||||
/**
|
||||
* Name for the GPS DEBUG interface.
|
||||
*/
|
||||
#define GPS_DEBUG_INTERFACE "gps-debug"
|
||||
|
||||
/**
|
||||
* Name for the AGPS interface.
|
||||
*/
|
||||
#define AGPS_INTERFACE "agps"
|
||||
|
||||
/**
|
||||
* Name for the GPS privacy interface.
|
||||
*/
|
||||
#define GPS_PRIVACY_INTERFACE "privacy"
|
||||
|
||||
/** Represents a location. */
|
||||
typedef struct {
|
||||
/** Contains GpsLocationFlags bits. */
|
||||
uint16_t flags;
|
||||
/** Represents latitude in degrees. */
|
||||
double latitude;
|
||||
/** Represents longitude in degrees. */
|
||||
double longitude;
|
||||
/** Represents altitude in meters above the WGS 84 reference
|
||||
* ellipsoid. */
|
||||
double altitude;
|
||||
/** Represents speed in meters per second. */
|
||||
float speed;
|
||||
/** Represents heading in degrees. */
|
||||
float bearing;
|
||||
/** Represents expected accuracy in meters. */
|
||||
float accuracy;
|
||||
/** Timestamp for the location fix. */
|
||||
GpsUtcTime timestamp;
|
||||
} GpsLocation;
|
||||
|
||||
/** Represents the status. */
|
||||
typedef struct {
|
||||
GpsStatusValue status;
|
||||
} GpsStatus;
|
||||
|
||||
/** Represents SV information. */
|
||||
typedef struct {
|
||||
/** Pseudo-random number for the SV. */
|
||||
int prn;
|
||||
/** Signal to noise ratio. */
|
||||
float snr;
|
||||
/** Elevation of SV in degrees. */
|
||||
float elevation;
|
||||
/** Azimuth of SV in degrees. */
|
||||
float azimuth;
|
||||
} GpsSvInfo;
|
||||
|
||||
/** Represents SV status. */
|
||||
typedef struct {
|
||||
/** Number of SVs currently visible. */
|
||||
int num_svs;
|
||||
|
||||
/** Contains an array of SV information. */
|
||||
GpsSvInfo sv_list[GPS_MAX_SVS];
|
||||
|
||||
/** Represents a bit mask indicating which SVs
|
||||
* have ephemeris data.
|
||||
*/
|
||||
uint32_t ephemeris_mask;
|
||||
|
||||
/** Represents a bit mask indicating which SVs
|
||||
* have almanac data.
|
||||
*/
|
||||
uint32_t almanac_mask;
|
||||
|
||||
/**
|
||||
* Represents a bit mask indicating which SVs
|
||||
* were used for computing the most recent position fix.
|
||||
*/
|
||||
uint32_t used_in_fix_mask;
|
||||
} GpsSvStatus;
|
||||
|
||||
/** Callback with location information. */
|
||||
typedef void (* gps_location_callback)(GpsLocation* location);
|
||||
|
||||
/** Callback with status information. */
|
||||
typedef void (* gps_status_callback)(GpsStatus* status);
|
||||
|
||||
/** Callback with SV status information. */
|
||||
typedef void (* gps_sv_status_callback)(GpsSvStatus* sv_info);
|
||||
|
||||
/** Callback for reporting NMEA sentences. */
|
||||
typedef void (* gps_nmea_callback)(GpsUtcTime timestamp, const char* nmea, int length);
|
||||
|
||||
/** GPS callback structure. */
|
||||
typedef struct {
|
||||
gps_location_callback location_cb;
|
||||
gps_status_callback status_cb;
|
||||
gps_sv_status_callback sv_status_cb;
|
||||
gps_nmea_callback nmea_cb;
|
||||
} GpsCallbacks;
|
||||
|
||||
|
||||
/** Represents the standard GPS interface. */
|
||||
typedef struct {
|
||||
/**
|
||||
* Opens the interface and provides the callback routines
|
||||
* to the implemenation of this interface.
|
||||
*/
|
||||
int (*init)( GpsCallbacks* callbacks );
|
||||
|
||||
/** Starts navigating. */
|
||||
int (*start)( void );
|
||||
|
||||
/** Stops navigating. */
|
||||
int (*stop)( void );
|
||||
|
||||
/** Closes the interface. */
|
||||
void (*cleanup)( void );
|
||||
|
||||
/** Injects the current time. */
|
||||
int (*inject_time)(GpsUtcTime time, int64_t timeReference,
|
||||
int uncertainty);
|
||||
|
||||
/** Injects current location from another location provider
|
||||
* (typically cell ID).
|
||||
* latitude and longitude are measured in degrees
|
||||
* expected accuracy is measured in meters
|
||||
*/
|
||||
int (*inject_location)(double latitude, double longitude, float accuracy);
|
||||
|
||||
/**
|
||||
* Specifies that the next call to start will not use the
|
||||
* information defined in the flags. GPS_DELETE_ALL is passed for
|
||||
* a cold start.
|
||||
*/
|
||||
void (*delete_aiding_data)(GpsAidingData flags);
|
||||
|
||||
/**
|
||||
* fix_frequency represents the time between fixes in seconds.
|
||||
* Set fix_frequency to zero for a single-shot fix.
|
||||
*/
|
||||
int (*set_position_mode)(GpsPositionMode mode, int fix_frequency);
|
||||
|
||||
/** Get a pointer to extension information. */
|
||||
const void* (*get_extension)(const char* name);
|
||||
} GpsInterface;
|
||||
|
||||
/** Callback to request the client to download XTRA data.
|
||||
The client should download XTRA data and inject it by calling
|
||||
inject_xtra_data(). */
|
||||
typedef void (* gps_xtra_download_request)();
|
||||
|
||||
/** Callback structure for the XTRA interface. */
|
||||
typedef struct {
|
||||
gps_xtra_download_request download_request_cb;
|
||||
} GpsXtraCallbacks;
|
||||
|
||||
/** Extended interface for XTRA support. */
|
||||
typedef struct {
|
||||
/**
|
||||
* Opens the XTRA interface and provides the callback routines
|
||||
* to the implemenation of this interface.
|
||||
*/
|
||||
int (*init)( GpsXtraCallbacks* callbacks );
|
||||
/** Injects XTRA data into the GPS. */
|
||||
int (*inject_xtra_data)( char* data, int length );
|
||||
} GpsXtraInterface;
|
||||
|
||||
/** Extended interface for DEBUG support. */
|
||||
typedef struct {
|
||||
/**
|
||||
* This function should return any information that the native
|
||||
* implementation wishes to include in a bugreport.
|
||||
*/
|
||||
size_t (*get_internal_state)(char* buffer, size_t bufferSize);
|
||||
} GpsDebugInterface;
|
||||
|
||||
/** Represents the status of AGPS. */
|
||||
typedef struct {
|
||||
AGpsType type;
|
||||
AGpsStatusValue status;
|
||||
} AGpsStatus;
|
||||
|
||||
/** Callback with AGPS status information. */
|
||||
typedef void (* agps_status_callback)(AGpsStatus* status);
|
||||
|
||||
/** Callback structure for the AGPS interface. */
|
||||
typedef struct {
|
||||
agps_status_callback status_cb;
|
||||
} AGpsCallbacks;
|
||||
|
||||
|
||||
/** Extended interface for AGPS support. */
|
||||
typedef struct {
|
||||
/**
|
||||
* Opens the AGPS interface and provides the callback routines
|
||||
* to the implemenation of this interface.
|
||||
*/
|
||||
void (*init)( AGpsCallbacks* callbacks );
|
||||
/**
|
||||
* Notifies that a data connection is available and sets
|
||||
* the name of the APN to be used for SUPL.
|
||||
*/
|
||||
int (*data_conn_open)( const char* apn );
|
||||
/**
|
||||
* Notifies that the AGPS data connection has been closed.
|
||||
*/
|
||||
int (*data_conn_closed)();
|
||||
/**
|
||||
* Notifies that a data connection is not available for AGPS.
|
||||
*/
|
||||
int (*data_conn_failed)();
|
||||
/**
|
||||
* Sets the hostname and port for the AGPS server.
|
||||
*/
|
||||
int (*set_server)( AGpsType type, const char* hostname, int port );
|
||||
} AGpsInterface;
|
||||
|
||||
/** Extended interface for GPS privacy support. */
|
||||
typedef struct {
|
||||
/**
|
||||
* Opens the AGPS interface and provides the callback routines
|
||||
* to the implemenation of this interface.
|
||||
*/
|
||||
void (*set_privacy_lock)( int enable_lock );
|
||||
} GpsPrivacyInterface;
|
||||
|
||||
/** Returns the hardware GPS interface. */
|
||||
const GpsInterface* gps_get_hardware_interface();
|
||||
|
||||
/**
|
||||
* Returns the qemu emulated GPS interface.
|
||||
*/
|
||||
const GpsInterface* gps_get_qemu_interface();
|
||||
|
||||
/**
|
||||
* Returns the default GPS interface.
|
||||
*/
|
||||
const GpsInterface* gps_get_interface();
|
||||
|
||||
#if __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // _HARDWARE_GPS_H
|
||||
File diff suppressed because it is too large
Load Diff
+1357
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
#include <utils/SystemClock.h>
|
||||
|
||||
extern "C" int64_t elapsed_realtime() {
|
||||
|
||||
int64_t realtime = android::elapsedRealtime();
|
||||
|
||||
return realtime;
|
||||
}
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
|
||||
ifneq ($(TARGET_SIMULATOR),true)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := libhtc_ril_wrapper.c
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := liblog libdl libnetutils libcutils
|
||||
|
||||
LOCAL_CFLAGS := -std=c99
|
||||
LOCAL_CFLAGS += -DRIL_SHLIB
|
||||
|
||||
#build shared library
|
||||
LOCAL_MODULE:= libhtc_ril_wrapper
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_PRELINK_MODULE := false
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
endif # !TARGET_SIMULATOR
|
||||
Executable
+190
@@ -0,0 +1,190 @@
|
||||
|
||||
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
|
||||
|
||||
Executable
+763
@@ -0,0 +1,763 @@
|
||||
/*
|
||||
* Credits go to LeTama for the data connection code and phh for the wrapper code
|
||||
* Copyright (C) 2010 Sebastian Heinecke (gauner1986)
|
||||
*
|
||||
* 0.8 by cedesmith
|
||||
*/
|
||||
|
||||
#include <telephony/ril.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include <utils/Log.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/wait.h>
|
||||
#include <termios.h>
|
||||
#include <time.h>
|
||||
#include <poll.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#undef LOG_TAG
|
||||
#define LOG_TAG "RIL_WRAP"
|
||||
|
||||
#define RIL_onRequestComplete(t, e, response, responselen) s_rilenv->OnRequestComplete(t,e, response, responselen)
|
||||
#define msleep(x) usleep(x*1000);
|
||||
|
||||
static const struct RIL_Env *s_rilenv;
|
||||
static struct RIL_Env htcril_env;
|
||||
|
||||
static void *ril_handler=NULL;
|
||||
|
||||
static int rmnet_mode = 1;
|
||||
static int nand_init = 0;
|
||||
static volatile int pppd_pid;
|
||||
static volatile int delayedNetworkReady=0;
|
||||
static volatile RIL_Token request_registration_state_token = NULL;
|
||||
char current_apn[80];
|
||||
char current_user[80];
|
||||
char current_addr[16];
|
||||
static volatile int registrationState=0;
|
||||
static volatile int gprsRegistrationState=0;
|
||||
static volatile RIL_LastDataCallActivateFailCause lastDataError=PDP_FAIL_ERROR_UNSPECIFIED;
|
||||
|
||||
char* logtime()
|
||||
{
|
||||
static char sTime[10];
|
||||
time_t t = time(NULL);
|
||||
strftime(sTime, sizeof(sTime), "%H:%M:%S", localtime(&t));
|
||||
return sTime;
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
DATA_STATE_DISCONNECTED=0,
|
||||
DATA_STATE_DISCONNECTING,
|
||||
DATA_STATE_PPP_DIED,
|
||||
DATA_STATE_CONNECTING,
|
||||
DATA_STATE_CONNECTED,
|
||||
DATA_STATE_CONNECTION_KILL,
|
||||
} Wrap_DataCallState;
|
||||
static volatile Wrap_DataCallState dataConnectionState=DATA_STATE_DISCONNECTED;
|
||||
|
||||
static volatile int fd_smd=-1;
|
||||
int open_modem()
|
||||
{
|
||||
if(fd_smd!=-1) return fd_smd;
|
||||
|
||||
fd_smd = open ("/dev/smd0", O_RDWR);
|
||||
if(fd_smd == -1) {
|
||||
LOGE("%s: send_modem: Error opening smd0", logtime());
|
||||
return -1; //AT_ERROR_GENERIC;
|
||||
}
|
||||
|
||||
struct termios ios;
|
||||
tcgetattr( fd_smd, &ios );
|
||||
ios.c_lflag = 0; /* disable ECHO, ICANON, etc... */
|
||||
tcsetattr( fd_smd, TCSANOW, &ios );
|
||||
|
||||
//fcntl(fd_smd, F_SETFL, O_NONBLOCK | fcntl(fd_smd, F_GETFL, 0));
|
||||
|
||||
return fd_smd;
|
||||
}
|
||||
void close_modem(){
|
||||
if(fd_smd!=-1) {
|
||||
close(fd_smd);
|
||||
fd_smd=-1;
|
||||
}
|
||||
}
|
||||
int send_modem(const char * cmd)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
size_t cur = 0;
|
||||
ssize_t written;
|
||||
size_t len = strlen(cmd);
|
||||
|
||||
if(open_modem() == -1) return -1; //AT_ERROR_GENERIC;
|
||||
|
||||
LOGD("%s: AT> %s", logtime(), cmd);
|
||||
|
||||
/* the main string */
|
||||
while (cur < len) {
|
||||
do {
|
||||
written = write (fd_smd, cmd + cur, len - cur);
|
||||
} while (written < 0 && errno == EINTR);
|
||||
|
||||
if (written < 0) return -1;// AT_ERROR_GENERIC;
|
||||
|
||||
cur += written;
|
||||
}
|
||||
/* the \r */
|
||||
|
||||
do {
|
||||
written = write (fd_smd, "\r" , 1);
|
||||
} while ((written < 0 && errno == EINTR) || (written == 0));
|
||||
|
||||
if (written < 0) {
|
||||
LOGE("%s: send_modem: write failure", logtime());
|
||||
return -1; //AT_ERROR_GENERIC;
|
||||
}
|
||||
|
||||
return written;
|
||||
}
|
||||
|
||||
int read_modem(char* response, size_t responseLen)
|
||||
{
|
||||
if(open_modem() == -1) return -1;
|
||||
|
||||
char *pread=response;
|
||||
while( pread<response+responseLen){
|
||||
if(read(fd_smd, pread, 1)<=0) break;
|
||||
if((*pread=='\n' || *pread=='\r') && pread==response) continue;
|
||||
if(*pread=='\r') break;
|
||||
pread++;
|
||||
}
|
||||
*pread=0;
|
||||
|
||||
if(pread!=response) LOGD("%s: MODEM> %s", logtime(), response);
|
||||
else LOGD("%s MODEM>", logtime());
|
||||
|
||||
return pread-response;
|
||||
}
|
||||
|
||||
const char* requestToString(int request)
|
||||
{
|
||||
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_REGISTRATION_STATE: return "REGISTRATION_STATE";
|
||||
case RIL_REQUEST_GPRS_REGISTRATION_STATE: return "GPRS_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:return"CDMA_SET_SUBSCRIPTION";
|
||||
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_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_NETWORK_STATE_CHANGED: return "UNSOL_RESPONSE_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";
|
||||
default: return "<unknown request>";
|
||||
}
|
||||
}
|
||||
|
||||
struct RequestInfo
|
||||
{
|
||||
RIL_Token token;
|
||||
int request;
|
||||
time_t startTime;
|
||||
};
|
||||
|
||||
struct RequestInfo pendingRequests[200];
|
||||
void requestStarted(RIL_Token t, int request)
|
||||
{
|
||||
LOGD("%s: Request Received %p %s", logtime(), t, requestToString(request));
|
||||
for(size_t i=0; i<sizeof(pendingRequests)/sizeof(struct RequestInfo); i++) {
|
||||
if(pendingRequests[i].token==NULL) {
|
||||
pendingRequests[i].token=t;
|
||||
pendingRequests[i].request=request;
|
||||
pendingRequests[i].startTime=clock();
|
||||
return;
|
||||
}
|
||||
}
|
||||
LOGD("%s: Request list full", logtime());
|
||||
}
|
||||
void requestRemoveAt(int idx)
|
||||
{
|
||||
size_t i;
|
||||
for(i=idx+1; i<sizeof(pendingRequests)/sizeof(struct RequestInfo) && pendingRequests[i].token!=NULL; i++)
|
||||
pendingRequests[i-1]=pendingRequests[i];
|
||||
|
||||
pendingRequests[i-1].token=NULL;
|
||||
pendingRequests[i-1].request=0;
|
||||
pendingRequests[i-1].startTime=0;
|
||||
}
|
||||
struct RequestInfo requestCompleted(RIL_Token t)
|
||||
{
|
||||
struct RequestInfo r = { .token=NULL, .request=0, .startTime=0};
|
||||
for(size_t i=0; i<sizeof(pendingRequests)/sizeof(struct RequestInfo) && pendingRequests[i].token!=NULL; i++) {
|
||||
if(pendingRequests[i].token==t) {
|
||||
r=pendingRequests[i];
|
||||
LOGD("%s: Request Complete %p %s after %d ms", logtime(), r.token, requestToString(r.request), (unsigned int)(clock()-r.startTime)/(CLOCKS_PER_SEC/1000));
|
||||
requestRemoveAt(i);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
LOGD("%s: Request Complete %p not found in started list", logtime(),t);
|
||||
return r;
|
||||
}
|
||||
|
||||
unsigned requestsPending()
|
||||
{
|
||||
unsigned count=0;
|
||||
for(size_t i=0; i<sizeof(pendingRequests)/sizeof(struct RequestInfo) && pendingRequests[i].token!=NULL; i++) {
|
||||
if(pendingRequests[i].token!=NULL) {
|
||||
if((clock()-pendingRequests[i].startTime)/CLOCKS_PER_SEC > 10)
|
||||
{
|
||||
LOGD("%s: Request delete %p %s after %d ms", logtime(), pendingRequests[i].token, requestToString(pendingRequests[i].request), (unsigned int)(clock()-pendingRequests[i].startTime)/(CLOCKS_PER_SEC/1000));
|
||||
requestRemoveAt(i);
|
||||
i--;
|
||||
} else {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
void requestsLOGD()
|
||||
{
|
||||
for(size_t i=0; i<sizeof(pendingRequests)/sizeof(struct RequestInfo) && pendingRequests[i].token!=NULL; i++)
|
||||
LOGD(" %p %s for %d ms", pendingRequests[i].token, requestToString(pendingRequests[i].request), (unsigned int)(clock()-pendingRequests[i].startTime)/(CLOCKS_PER_SEC/1000));
|
||||
}
|
||||
|
||||
void requestsWaitComplete(char *msg){
|
||||
if(requestsPending()>0) {
|
||||
LOGD("%s: Request pending... waiting to complete", logtime());
|
||||
requestsLOGD();
|
||||
while(requestsPending()>0) msleep(1);
|
||||
LOGD("%s: Request completed... continue %s", logtime(), msg!=NULL ? msg : NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void* pppd_thread(void *param)
|
||||
{
|
||||
LOGD("%s: pppd_thread enter", logtime());
|
||||
|
||||
requestsWaitComplete("pppd_thread");
|
||||
|
||||
pppd_pid = fork();
|
||||
if(pppd_pid == 0) {
|
||||
|
||||
char buff[256];
|
||||
kill(getppid(), SIGSTOP); //stop stealing my mojo
|
||||
|
||||
int act=0;
|
||||
|
||||
send_modem("AT+CGACT?");
|
||||
do {
|
||||
read_modem(buff, sizeof(buff));
|
||||
char* actpos=strstr(buff, "+CGACT: 1,");
|
||||
if(actpos!=NULL) act=atoi(actpos+10);
|
||||
}while(buff[0]!='0');
|
||||
|
||||
if(act!=0) {
|
||||
kill(getppid(), SIGCONT);
|
||||
exit(202);
|
||||
}
|
||||
|
||||
sprintf(buff, "AT+CGDCONT=1,\"IP\",\"%s\",,0,0", current_apn);
|
||||
send_modem(buff);
|
||||
read_modem(buff, sizeof(buff));
|
||||
|
||||
send_modem("ATD*99***1#");
|
||||
//send_modem("AT+CGDATA=\"PPP\",1");
|
||||
while(read_modem(buff, sizeof(buff))>0 && buff[0]=='+');
|
||||
//read_modem(buff, sizeof(buff));
|
||||
|
||||
kill(getppid(), SIGCONT);
|
||||
|
||||
int atd=atoi(buff);
|
||||
if(atd!=1 && atd!=3) exit(201);
|
||||
|
||||
sleep(1);
|
||||
|
||||
close_modem(); //close modem handle before we transform to pppd
|
||||
int err = execl("/system/bin/pppd", "pppd", "/dev/smd1", "local","nodetach", "defaultroute", "noipdefault", "usepeerdns", "user", current_user, "debug", NULL);
|
||||
LOGE("%s: PPPD EXEC FAILED (%d)", logtime(),err);
|
||||
exit(200);
|
||||
} else {
|
||||
LOGD("%s: pppd pid is %d", logtime(),pppd_pid);
|
||||
|
||||
int status=0;
|
||||
time_t start = time(NULL);
|
||||
waitpid(pppd_pid, &status, 0);
|
||||
pppd_pid=0;
|
||||
int runTime = time(NULL)-start;
|
||||
LOGD("%s: PPPD DIED after %d seconds with status %d", logtime(), runTime, status);
|
||||
|
||||
if(lastDataError==PDP_FAIL_ERROR_UNSPECIFIED && WIFEXITED(status)){
|
||||
switch(WEXITSTATUS(status))
|
||||
{
|
||||
case 1: lastDataError=PDP_FAIL_INSUFFICIENT_RESOURCES; break;
|
||||
case 2: lastDataError=PDP_FAIL_SERVICE_OPTION_NOT_SUPPORTED; break;
|
||||
case 3:
|
||||
case 4:
|
||||
lastDataError=PDP_FAIL_PROTOCOL_ERRORS; break;
|
||||
case 19: lastDataError=PDP_FAIL_USER_AUTHENTICATION; break;
|
||||
}
|
||||
}
|
||||
|
||||
requestsWaitComplete("pppd_thread");
|
||||
send_modem("AT+CGACT=0,1");
|
||||
|
||||
if(dataConnectionState==DATA_STATE_CONNECTED || dataConnectionState==DATA_STATE_CONNECTION_KILL) {
|
||||
dataConnectionState=DATA_STATE_DISCONNECTED;
|
||||
RIL_Data_Call_Response dataCall={ .cid=1, .active=0, .type="IP", .apn=current_apn, .address=current_addr };
|
||||
s_rilenv->OnUnsolicitedResponse(RIL_UNSOL_DATA_CALL_LIST_CHANGED, &dataCall, sizeof(RIL_Data_Call_Response));
|
||||
}
|
||||
}
|
||||
|
||||
LOGD("%s: pppd_thread exit", logtime());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* DeactivateData(void* t)
|
||||
{
|
||||
dataConnectionState = DATA_STATE_DISCONNECTING;
|
||||
LOGD("%s: DeactivateData", logtime());
|
||||
|
||||
int pid=pppd_pid; //work with pppd_pid copy as thread will set it to 0 after kill
|
||||
if(pid!=0) {
|
||||
int status=0;
|
||||
LOGD(" waiting for pppd to end %d", pid);
|
||||
kill(pid, SIGTERM);
|
||||
waitpid(pid, &status, 0);
|
||||
LOGD("%s: DeactivateData: pppd ended", logtime());
|
||||
}
|
||||
|
||||
//clear dns entries
|
||||
property_set("net.ppp0.dns1", "");
|
||||
property_set("net.ppp0.dns2", "");
|
||||
|
||||
dataConnectionState = DATA_STATE_DISCONNECTED;
|
||||
RIL_onRequestComplete((RIL_Token) t, RIL_E_SUCCESS, NULL, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void hackDeactivateData(void *data, size_t datalen, RIL_Token t)
|
||||
{
|
||||
LOGD("%s: DeactivateData Request", logtime());
|
||||
char* cid = ((char **)data)[0];
|
||||
if(atoi(cid)!=1) {
|
||||
LOGE(" wrong CID %s expected 1", cid);
|
||||
return;
|
||||
}
|
||||
pthread_t tid;
|
||||
pthread_create(&tid, NULL, DeactivateData, t);
|
||||
}
|
||||
|
||||
int ifc_get_info(const char *name, unsigned *addr, unsigned *mask, unsigned *flags);
|
||||
int ifc_init(void);
|
||||
void ifc_close(void);
|
||||
void* SetupData(void* t)
|
||||
{
|
||||
//this should never happen but let's check
|
||||
if(pppd_pid!=0 ) {
|
||||
LOGD(" waiting pppd to die");
|
||||
int status=0;
|
||||
kill(pppd_pid, SIGTERM);
|
||||
waitpid(pppd_pid, &status, 0);
|
||||
}
|
||||
|
||||
//reset ppp.dns
|
||||
property_set("net.ppp0.dns1", "0.0.0.0");
|
||||
property_set("net.ppp0.dns2", "0.0.0.0");
|
||||
strcpy(current_addr, "255.255.255.255");
|
||||
|
||||
pthread_t thread;
|
||||
pthread_create(&thread, NULL, pppd_thread, NULL);
|
||||
|
||||
//wait for pppd connect
|
||||
if(ifc_init()) {
|
||||
LOGE("%s: IFC failed to init", logtime());
|
||||
sleep(7);
|
||||
} else {
|
||||
clock_t start=clock();
|
||||
//loop till timeout or connected
|
||||
while(1) {
|
||||
//check if ppp0 interface is up, if true break loop, else record dnschange value
|
||||
unsigned addr, mask, flags;
|
||||
ifc_get_info("ppp0", &addr, &mask, &flags);
|
||||
if(flags & 1)
|
||||
{
|
||||
struct in_addr in_addr = {.s_addr=addr};
|
||||
strcpy(current_addr, inet_ntoa(in_addr));
|
||||
LOGD("%s: IP: %s", logtime(),current_addr);
|
||||
break;
|
||||
}
|
||||
//if timeout goto error
|
||||
if ( (clock()-start)/CLOCKS_PER_SEC > 60 ){
|
||||
LOGE("%s: ppp0 connect timed out, giving up", logtime());
|
||||
ifc_close();
|
||||
goto error;
|
||||
}
|
||||
int status, pid=pppd_pid;
|
||||
if(pid==0 || waitpid(pid, &status, WNOHANG)>0){
|
||||
LOGE("%s: ppp0 connect timed out, giving up", logtime());
|
||||
ifc_close();
|
||||
goto error;
|
||||
}
|
||||
msleep(100);
|
||||
}
|
||||
}
|
||||
ifc_close();
|
||||
|
||||
//if ip-up exists wait for dns change
|
||||
char dns1[PROPERTY_VALUE_MAX];
|
||||
char dns2[PROPERTY_VALUE_MAX];
|
||||
struct stat sts;
|
||||
if(stat("/etc/ppp/ip-up", &sts)==0 && (S_ISREG(sts.st_mode) || S_ISLNK(sts.st_mode))) {
|
||||
clock_t start=clock();
|
||||
while(1) {
|
||||
//check if dnschange changed
|
||||
property_get("net.ppp0.dns1", dns1, "0.0.0.0");
|
||||
property_get("net.ppp0.dns2", dns2, "0.0.0.0");
|
||||
if(strcmp(dns1, "0.0.0.0")!=0 && strcmp(dns2, "0.0.0.0")!=0) break;
|
||||
|
||||
if((clock()-start)/CLOCKS_PER_SEC > 2) {
|
||||
LOGE("%s: timeout waiting for dns change", logtime());
|
||||
break;
|
||||
}
|
||||
msleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
//check ppp.dns values and set defaults if suspect wrong
|
||||
property_get("net.ppp0.dns1", dns1, "");
|
||||
if(strlen(dns1)<7 || strcmp(dns1,"0.0.0.0")==0 || strcmp(dns1, "10.11.12.13")==0) {
|
||||
LOGD("%s: DNS1: %s wrong setting to 8.8.8.8", logtime(),dns1);
|
||||
property_set("net.ppp0.dns1", "8.8.8.8");
|
||||
} else {
|
||||
LOGD("%s: DNS1: %s", logtime(),dns1);
|
||||
}
|
||||
property_get("net.ppp0.dns2", dns2, "");
|
||||
if(strlen(dns2)<7 || strcmp(dns2, "0.0.0.0")==0 || strcmp(dns2, "10.11.12.14")==0) {
|
||||
LOGD("%s: DNS2: %s wrong setting to 8.8.4.4", logtime(),dns2);
|
||||
property_set("net.ppp0.dns2", "8.8.4.4");
|
||||
} else {
|
||||
LOGD("%s: DNS2: %s", logtime(),dns2);
|
||||
}
|
||||
|
||||
char *response[3] = { "1", "ppp0", current_addr };
|
||||
dataConnectionState=DATA_STATE_CONNECTED;
|
||||
RIL_onRequestComplete(t, RIL_E_SUCCESS, response, sizeof(response));
|
||||
return NULL;
|
||||
|
||||
error:
|
||||
dataConnectionState=DATA_STATE_DISCONNECTED;
|
||||
RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0);
|
||||
return NULL;
|
||||
}
|
||||
void hackSetupData(char **data, size_t datalen, RIL_Token t)
|
||||
{
|
||||
LOGD("%s: SetupData(%s) Request", logtime(),((const char **)data)[2]);
|
||||
|
||||
lastDataError=PDP_FAIL_ERROR_UNSPECIFIED;
|
||||
|
||||
if(*data[0]=='0') {
|
||||
LOGE(" Android want us to connect as CDMA while we are a GSM phone !");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if(!registrationState) {
|
||||
LOGE(" network registration state wrong");
|
||||
lastDataError=PDP_FAIL_REGISTRATION_FAIL;
|
||||
goto error;
|
||||
}
|
||||
if(!gprsRegistrationState) {
|
||||
LOGE(" gprs registration state wrong");
|
||||
lastDataError=PDP_FAIL_GPRS_REGISTRATION_FAIL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
dataConnectionState = DATA_STATE_CONNECTING;
|
||||
char *apn = ((char **)data)[2];
|
||||
char *user = ((char **)data)[3];
|
||||
char *pass = ((char **)data)[4];
|
||||
if(apn==NULL) apn="";
|
||||
if(user==NULL || strlen(user)<2) user = "dummy";
|
||||
if(pass==NULL || strlen(pass)<2) pass = "dummy";
|
||||
strcpy(current_apn, apn);
|
||||
strcpy(current_user, user);
|
||||
|
||||
//save auth
|
||||
truncate("/etc/ppp/pap-secrets", 0);
|
||||
truncate("/etc/ppp/chap-secrets", 0);
|
||||
char buff[128];
|
||||
sprintf(buff, "%s * %s\n", user, pass);
|
||||
int fd;
|
||||
if((fd=creat("/etc/ppp/pap-secrets", S_IRUSR|S_IWUSR))==-1) {
|
||||
LOGE("Failed to create /etc/ppp/pap-secrets");
|
||||
lastDataError=PDP_FAIL_USER_AUTHENTICATION;
|
||||
goto error;
|
||||
}
|
||||
write(fd, buff, strlen(buff));
|
||||
close(fd);
|
||||
if((fd=creat("/etc/ppp/chap-secrets", S_IRUSR|S_IWUSR))==-1) {
|
||||
LOGE("Failed to create /etc/ppp/chap-secrets");
|
||||
lastDataError=PDP_FAIL_USER_AUTHENTICATION;
|
||||
goto error;
|
||||
}
|
||||
write(fd, buff, strlen(buff));
|
||||
close(fd);
|
||||
|
||||
pthread_t tid;
|
||||
pthread_create(&tid, NULL, SetupData, t);
|
||||
return;
|
||||
|
||||
error:
|
||||
dataConnectionState=DATA_STATE_DISCONNECTED;
|
||||
RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0);
|
||||
}
|
||||
|
||||
void interceptOnRequestComplete(RIL_Token t, RIL_Errno e, void *response, size_t responselen)
|
||||
{
|
||||
if(!rmnet_mode) {
|
||||
struct RequestInfo requestInfo= requestCompleted(t);
|
||||
if( requestInfo.request==RIL_REQUEST_REGISTRATION_STATE) {
|
||||
if(responselen>=14*sizeof(char *)) {
|
||||
char **strings = (char **)response;
|
||||
int registration = atoi(strings[0]); //1 - Registered, home network; 5 - Registered, roaming
|
||||
int radio = atoi(strings[3]); //0 == unknown
|
||||
registrationState=((registration==1 || registration==5) && radio!=0);
|
||||
LOGD("%s: Registration state %d %d = %d", logtime(), registration, radio, registrationState);
|
||||
if(!registrationState && pppd_pid!=0 && dataConnectionState==DATA_STATE_CONNECTED){
|
||||
LOGE("%s: data disconnect due to network registration state", logtime());
|
||||
lastDataError=PDP_FAIL_REGISTRATION_FAIL;
|
||||
dataConnectionState=DATA_STATE_CONNECTION_KILL;
|
||||
kill(pppd_pid, SIGTERM);
|
||||
}
|
||||
}
|
||||
}
|
||||
if( requestInfo.request==RIL_REQUEST_GPRS_REGISTRATION_STATE) {
|
||||
if(responselen>=4*sizeof(char *)) {
|
||||
char **strings = (char **)response;
|
||||
int registration = atoi(strings[0]); //1 - Registered, home network; 5 - Registered, roaming
|
||||
int radio = atoi(strings[3]); //0 == unknown; 4 ("unknown") is treated as "out of service" in the Android telephony system
|
||||
gprsRegistrationState=((registration==1 || registration==5) && (radio!=0 && radio!=4));
|
||||
LOGD("%s: Registration state %d %d = %d", logtime(), registration, radio, gprsRegistrationState);
|
||||
if(!gprsRegistrationState && pppd_pid!=0 && dataConnectionState==DATA_STATE_CONNECTED){
|
||||
LOGE("%s: data disconnect due to gprs registration state", logtime());
|
||||
lastDataError=PDP_FAIL_GPRS_REGISTRATION_FAIL;
|
||||
dataConnectionState=DATA_STATE_CONNECTION_KILL;
|
||||
kill(pppd_pid, SIGTERM);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
s_rilenv->OnRequestComplete(t, e, response, responselen);
|
||||
}
|
||||
|
||||
void hackDataCallList(char **data, size_t datalen, RIL_Token t)
|
||||
{
|
||||
RIL_Data_Call_Response dataCall={ .cid=1, .active=0, .type="IP", .apn=current_apn, .address=current_addr };
|
||||
LOGD("%s: DataCallList", logtime());
|
||||
LOGD(" cid=%d, active=%d, type=%s, apn=%s, add=%s", dataCall.cid, dataCall.active, dataCall.type, dataCall.apn, dataCall.address);
|
||||
s_rilenv->OnRequestComplete(t, RIL_E_SUCCESS, &dataCall, sizeof(RIL_Data_Call_Response));
|
||||
}
|
||||
|
||||
void interceptOnUnsolicitedResponse(int unsolResponse, const void *data, size_t datalen)
|
||||
{
|
||||
LOGD("%s: UNSOL %s", logtime(), requestToString(unsolResponse));
|
||||
s_rilenv->OnUnsolicitedResponse(unsolResponse, data, datalen);
|
||||
}
|
||||
|
||||
void (*htc_onRequest)(int request, void *data, size_t datalen, RIL_Token t);
|
||||
void onRequest(int request, void *data, size_t datalen, RIL_Token t) {
|
||||
if(!rmnet_mode) {
|
||||
switch(request) {
|
||||
case RIL_REQUEST_SETUP_DATA_CALL:
|
||||
return hackSetupData(data, datalen, t);
|
||||
case RIL_REQUEST_DEACTIVATE_DATA_CALL:
|
||||
return hackDeactivateData(data, datalen, t);
|
||||
case RIL_REQUEST_DATA_CALL_LIST:
|
||||
return hackDataCallList(data, datalen, t);
|
||||
case RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE:
|
||||
s_rilenv->OnRequestComplete(t, RIL_E_SUCCESS,(RIL_LastDataCallActivateFailCause*) &lastDataError, sizeof(RIL_LastDataCallActivateFailCause));
|
||||
return;
|
||||
}
|
||||
requestStarted(t, request);
|
||||
}
|
||||
return htc_onRequest(request, data, datalen, t);
|
||||
}
|
||||
|
||||
void writeAdditionalNandInit(){
|
||||
LOGD("NAND boot, writing additional init commands to /dev/smd0");
|
||||
send_modem("AT@BRIC=0");
|
||||
send_modem("AT+CFUN=0");
|
||||
send_modem("AT+COPS=2");
|
||||
}
|
||||
|
||||
const RIL_RadioFunctions *RIL_Init(const struct RIL_Env *env, int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
int ril_argc = 0;
|
||||
char **ril_argv;
|
||||
RIL_RadioFunctions *(*htc_RIL_Init)(const struct RIL_Env *env, int argc, char **argv);
|
||||
RIL_RadioFunctions *s_callbacks;
|
||||
|
||||
s_rilenv = env;
|
||||
LOGD("----------- HTC Ril Wrapper v0.8b5 starting ------------");
|
||||
// we never free this, but we can't tell if htc ril uses argv after init
|
||||
ril_argv = (char **)malloc(argc * sizeof(char*));
|
||||
|
||||
struct stat sts;
|
||||
if(stat("/system/ppp", &sts)==0 && (S_ISREG(sts.st_mode) || S_ISLNK(sts.st_mode))) rmnet_mode = 0;
|
||||
LOGD("rmnet_mode=%d", rmnet_mode);
|
||||
|
||||
// Parse command line and prepare ril command line
|
||||
for(i = 0; i < argc ; i++) {
|
||||
LOGW("RIL_Init arg[%d]=%s", i, argv[i]);
|
||||
if(strcmp(argv[i], "rmnet_mode") == 0) continue;
|
||||
if(strcmp(argv[i], "nand_init") == 0)
|
||||
nand_init = 1;
|
||||
else {
|
||||
ril_argv[ril_argc++] = argv[i];
|
||||
}
|
||||
}
|
||||
|
||||
if(nand_init) writeAdditionalNandInit();
|
||||
|
||||
ril_handler=dlopen("/system/lib/libhtc_ril.so", 0/*Need to RTFM, 0 seems fine*/);
|
||||
htc_RIL_Init = dlsym(ril_handler, "RIL_Init");
|
||||
|
||||
// re-route to our man in the middle functions
|
||||
htcril_env.OnRequestComplete = interceptOnRequestComplete;
|
||||
htcril_env.OnUnsolicitedResponse = interceptOnUnsolicitedResponse;
|
||||
htcril_env.RequestTimedCallback = s_rilenv->RequestTimedCallback;
|
||||
|
||||
s_callbacks = htc_RIL_Init(&htcril_env, ril_argc, ril_argv);
|
||||
|
||||
htc_onRequest = s_callbacks->onRequest;
|
||||
s_callbacks->onRequest=onRequest;
|
||||
return s_callbacks;
|
||||
}
|
||||
@@ -18,16 +18,14 @@ ifneq ($(TARGET_SIMULATOR),true)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := lights.htcleo
|
||||
LOCAL_MODULE := lights.$(TARGET_BOOTLOADER_BOARD_NAME)
|
||||
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
|
||||
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
LOCAL_SRC_FILES := lights_leo.c \
|
||||
events.c
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := liblog libcutils
|
||||
LOCAL_SRC_FILES := lights.c
|
||||
LOCAL_SHARED_LIBRARIES := liblog
|
||||
LOCAL_PRELINK_MODULE := false
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
|
||||
Copyright (c) 2005-2008, The Android Open Source Project
|
||||
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.
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2007 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/poll.h>
|
||||
|
||||
#include <linux/input.h>
|
||||
|
||||
#include "events.h"
|
||||
|
||||
#define MAX_DEVICES 16
|
||||
|
||||
static struct pollfd ev_fds[MAX_DEVICES];
|
||||
static unsigned ev_count = 0;
|
||||
|
||||
int ev_init(void)
|
||||
{
|
||||
DIR *dir;
|
||||
struct dirent *de;
|
||||
int fd;
|
||||
|
||||
dir = opendir("/dev/input");
|
||||
if(dir != 0) {
|
||||
while((de = readdir(dir))) {
|
||||
// fprintf(stderr,"/dev/input/%s\n", de->d_name);
|
||||
if(strncmp(de->d_name,"event",5)) continue;
|
||||
fd = openat(dirfd(dir), de->d_name, O_RDONLY);
|
||||
if(fd < 0) continue;
|
||||
|
||||
ev_fds[ev_count].fd = fd;
|
||||
ev_fds[ev_count].events = POLLIN;
|
||||
ev_count++;
|
||||
if(ev_count == MAX_DEVICES) break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ev_exit(void)
|
||||
{
|
||||
while (ev_count > 0) {
|
||||
close(ev_fds[--ev_count].fd);
|
||||
}
|
||||
}
|
||||
|
||||
int ev_get(struct input_event *ev, unsigned dont_wait)
|
||||
{
|
||||
int r;
|
||||
unsigned n;
|
||||
|
||||
do {
|
||||
r = poll(ev_fds, ev_count, dont_wait ? 0 : -1);
|
||||
|
||||
if(r > 0) {
|
||||
for(n = 0; n < ev_count; n++) {
|
||||
if(ev_fds[n].revents & POLLIN) {
|
||||
r = read(ev_fds[n].fd, ev, sizeof(*ev));
|
||||
if(r == sizeof(*ev)) return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while(dont_wait == 0);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2007 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 _EVENTS_H_
|
||||
#define _EVENTS_H_
|
||||
|
||||
|
||||
// input event structure, include <linux/input.h> for the definition.
|
||||
// see http://www.mjmwired.net/kernel/Documentation/input/ for info.
|
||||
struct input_event;
|
||||
|
||||
int ev_init(void);
|
||||
int ev_get(struct input_event *ev, unsigned dont_wait);
|
||||
void ev_exit(void);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,298 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
// #define LOG_NDEBUG 0
|
||||
#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_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
static struct light_state_t g_notification = {0,0,0,0,0};
|
||||
static struct light_state_t g_battery = {0,0,0,0,0};
|
||||
|
||||
static char const*const GREEN_LED_FILE
|
||||
= "/sys/class/leds/green/brightness";
|
||||
|
||||
static char const*const AMBER_LED_FILE
|
||||
= "/sys/class/leds/amber/brightness";
|
||||
|
||||
static char const*const RED_LED_FILE
|
||||
= "/sys/class/leds/red/brightness";
|
||||
|
||||
static char const*const LCD_FILE
|
||||
= "/sys/class/leds/lcd-backlight/brightness";
|
||||
|
||||
static char const*const AMBER_BLINK_FILE
|
||||
= "/sys/class/leds/amber/blink";
|
||||
|
||||
static char const*const GREEN_BLINK_FILE
|
||||
= "/sys/class/leds/green/blink";
|
||||
|
||||
static char const*const RED_BLINK_FILE
|
||||
= "/sys/class/leds/red/blink";
|
||||
|
||||
|
||||
static char const*const BUTTON_FILE
|
||||
= "/sys/class/leds/button-backlight/brightness";
|
||||
|
||||
|
||||
/**
|
||||
* device methods
|
||||
*/
|
||||
|
||||
static int
|
||||
write_int(char const* path, int value)
|
||||
{
|
||||
int fd;
|
||||
static int already_warned = 0;
|
||||
|
||||
fd = open(path, O_RDWR);
|
||||
if (fd >= 0) {
|
||||
char buffer[20];
|
||||
int bytes = sprintf(buffer, "%d\n", value);
|
||||
int amt = write(fd, buffer, bytes);
|
||||
close(fd);
|
||||
return amt == -1 ? -errno : 0;
|
||||
} else {
|
||||
if (already_warned == 0) {
|
||||
LOGE("write_int failed to open %s\n", path);
|
||||
already_warned = 1;
|
||||
}
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
is_lit(struct light_state_t const* state)
|
||||
{
|
||||
return state->color & 0x00ffffff;
|
||||
}
|
||||
|
||||
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);
|
||||
pthread_mutex_lock(&g_lock);
|
||||
err = write_int(LCD_FILE, brightness);
|
||||
pthread_mutex_unlock(&g_lock);
|
||||
return err;
|
||||
}
|
||||
|
||||
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 err;
|
||||
}
|
||||
|
||||
static int
|
||||
set_speaker_light_locked(struct light_device_t* dev,
|
||||
struct light_state_t const* state)
|
||||
{
|
||||
int len;
|
||||
int alpha, red, green, blue;
|
||||
int blink, freq, pwm;
|
||||
int onMS, offMS;
|
||||
unsigned int colorRGB;
|
||||
|
||||
switch (state->flashMode) {
|
||||
case LIGHT_FLASH_TIMED:
|
||||
blink = 1;
|
||||
onMS = state->flashOnMS;
|
||||
offMS = state->flashOffMS;
|
||||
break;
|
||||
case LIGHT_FLASH_HARDWARE:
|
||||
blink = 1;
|
||||
onMS = state->flashOnMS;
|
||||
offMS = state->flashOffMS;
|
||||
break;
|
||||
case LIGHT_FLASH_NONE:
|
||||
blink = 0;
|
||||
onMS = 0;
|
||||
offMS = 0;
|
||||
break;
|
||||
default:
|
||||
blink = 1;
|
||||
onMS = 0;
|
||||
offMS = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
colorRGB = state->color;
|
||||
|
||||
#if 0
|
||||
LOGD("set_speaker_light_locked colorRGB=%08X, onMS=%d, offMS=%d\n",
|
||||
colorRGB, onMS, offMS);
|
||||
#endif
|
||||
|
||||
red = (colorRGB >> 16) & 0xFF;
|
||||
green = (colorRGB >> 8) & 0xFF;
|
||||
blue = colorRGB & 0xFF;
|
||||
|
||||
if (red) {
|
||||
write_int(GREEN_LED_FILE, 0);
|
||||
write_int(AMBER_LED_FILE, 1);
|
||||
if (blink) {
|
||||
//blink must come after brightness change
|
||||
write_int(AMBER_BLINK_FILE, 1);
|
||||
}
|
||||
} else if (green || blue) {
|
||||
write_int(AMBER_LED_FILE, 0);
|
||||
write_int(GREEN_LED_FILE, 1);
|
||||
if (blink) {
|
||||
write_int(GREEN_BLINK_FILE, 1);
|
||||
}
|
||||
} else {
|
||||
write_int(GREEN_LED_FILE, 0);
|
||||
write_int(AMBER_LED_FILE, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
handle_speaker_battery_locked(struct light_device_t* dev)
|
||||
{
|
||||
|
||||
if (is_lit(&g_battery)) {
|
||||
set_speaker_light_locked(dev, &g_battery);
|
||||
} else {
|
||||
set_speaker_light_locked(dev, &g_notification);
|
||||
}
|
||||
}
|
||||
|
||||
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_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;
|
||||
}
|
||||
|
||||
|
||||
/** Close the lights device */
|
||||
static int
|
||||
close_lights(struct light_device_t *dev)
|
||||
{
|
||||
if (dev) {
|
||||
free(dev);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/**
|
||||
* module methods
|
||||
*/
|
||||
|
||||
/** Open a new instance of a lights device using name */
|
||||
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);
|
||||
|
||||
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_NOTIFICATIONS, name)) {
|
||||
set_light = set_light_notifications;
|
||||
}
|
||||
else {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
struct light_device_t *dev = calloc(1, 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,
|
||||
};
|
||||
|
||||
/*
|
||||
* The lights Module
|
||||
*/
|
||||
const struct hw_module_t HAL_MODULE_INFO_SYM = {
|
||||
.tag = HARDWARE_MODULE_TAG,
|
||||
.version_major = 1,
|
||||
.version_minor = 0,
|
||||
.id = LIGHTS_HARDWARE_MODULE_ID,
|
||||
.name = "QCT MSM7K lights Module",
|
||||
.author = "Google, Inc.",
|
||||
.methods = &lights_module_methods,
|
||||
};
|
||||
@@ -1,656 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2009 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 "lights_leo"
|
||||
|
||||
#include <cutils/log.h>
|
||||
#include <cutils/properties.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>
|
||||
|
||||
#include <linux/input.h>
|
||||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "events.h"
|
||||
|
||||
#define LIGHT_ATTENTION 1
|
||||
#define LIGHT_NOTIFY 2
|
||||
|
||||
//#define ENABLE_LCDSAVE
|
||||
//#define ENABLE_BATTERY_POOL
|
||||
|
||||
#define ENABLE_RADIO_POOL
|
||||
|
||||
#define LED_DEBUG 1
|
||||
|
||||
#if LED_DEBUG
|
||||
# define D(...) LOGD(__VA_ARGS__)
|
||||
#else
|
||||
# define D(...) ((void)0)
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
static struct light_state_t *g_notify;
|
||||
static struct light_state_t *g_attention;
|
||||
static pthread_once_t g_init = PTHREAD_ONCE_INIT;
|
||||
static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
#ifdef ENABLE_LCDSAVE
|
||||
static int g_current_backlight = 0;
|
||||
#endif
|
||||
|
||||
static int g_ts = 0;
|
||||
static int g_backlight = 255;
|
||||
static int g_buttons = 0;
|
||||
|
||||
struct led_prop {
|
||||
const char *filename;
|
||||
int fd;
|
||||
int value;
|
||||
};
|
||||
|
||||
struct led {
|
||||
struct led_prop brightness;
|
||||
struct led_prop blink;
|
||||
};
|
||||
|
||||
enum {
|
||||
BUTTONS_LED,
|
||||
GREEN_LED,
|
||||
AMBER_LED,
|
||||
LCD_BACKLIGHT,
|
||||
NUM_LEDS,
|
||||
};
|
||||
|
||||
struct led leds[NUM_LEDS] = {
|
||||
[BUTTONS_LED] = {
|
||||
.brightness = { "/sys/class/leds/button-backlight/brightness", 0, 0},
|
||||
.blink = {NULL, 0, 0},
|
||||
},
|
||||
[GREEN_LED] = {
|
||||
.brightness = { "/sys/class/leds/green/brightness", 0, 0},
|
||||
.blink = { "/sys/class/leds/green/blink", 0, 0},
|
||||
},
|
||||
[AMBER_LED] = {
|
||||
.brightness = { "/sys/class/leds/amber/brightness", 0, 0},
|
||||
.blink = { "/sys/class/leds/amber/blink", 0, 0},
|
||||
},
|
||||
[LCD_BACKLIGHT] = {
|
||||
.brightness = { "/sys/class/leds/lcd-backlight/brightness", 0, 0},
|
||||
.blink = {NULL, 0, 0},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* device methods
|
||||
*/
|
||||
|
||||
static int init_prop(struct led_prop *prop)
|
||||
{
|
||||
int fd;
|
||||
|
||||
prop->fd = -1;
|
||||
if (!prop->filename)
|
||||
return 0;
|
||||
fd = open(prop->filename, O_RDWR);
|
||||
if (fd < 0) {
|
||||
LOGE("init_prop: %s cannot be opened (%s)\n", prop->filename,
|
||||
strerror(errno));
|
||||
return -errno;
|
||||
}
|
||||
|
||||
prop->fd = fd;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void close_prop(struct led_prop *prop)
|
||||
{
|
||||
int fd;
|
||||
|
||||
if (prop->fd > 0)
|
||||
close(prop->fd);
|
||||
return;
|
||||
}
|
||||
|
||||
void init_globals(void)
|
||||
{
|
||||
int i;
|
||||
pthread_mutex_init(&g_lock, NULL);
|
||||
|
||||
for (i = 0; i < NUM_LEDS; ++i) {
|
||||
init_prop(&leds[i].brightness);
|
||||
if (leds[i].blink.filename) {
|
||||
init_prop(&leds[i].blink);
|
||||
}
|
||||
}
|
||||
g_attention = malloc(sizeof(struct light_state_t));
|
||||
memset(g_attention, 0, sizeof(*g_attention));
|
||||
g_notify = malloc(sizeof(struct light_state_t));
|
||||
memset(g_notify, 0, sizeof(*g_notify));
|
||||
}
|
||||
|
||||
static int
|
||||
write_int(struct led_prop *prop, int value)
|
||||
{
|
||||
char buffer[20];
|
||||
int bytes;
|
||||
int amt;
|
||||
|
||||
if (prop->fd < 0)
|
||||
return 0;
|
||||
if (prop->value != value) {
|
||||
//LOGV("%s %s: 0x%x\n", __func__, prop->filename, value);
|
||||
bytes = snprintf(buffer, sizeof(buffer), "%d\n", value);
|
||||
while (bytes > 0) {
|
||||
amt = write(prop->fd, buffer, bytes);
|
||||
if (amt < 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
return -errno;
|
||||
}
|
||||
bytes -= amt;
|
||||
}
|
||||
prop->value = value;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
is_lit(struct light_state_t const* state)
|
||||
{
|
||||
return state->color & 0x00ffffff;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
#ifdef ENABLE_BATTERY_POLL
|
||||
static pthread_t battery_check_t = 0;
|
||||
static int last_battery_state = 0;
|
||||
|
||||
void *battery_state_thread(void *arg){
|
||||
int fd,size, rs;
|
||||
char state[20];
|
||||
struct timespec t;
|
||||
t.tv_nsec = 0;
|
||||
t.tv_sec = 5;
|
||||
|
||||
fd = open("/sys/class/power_supply/battery/status",O_RDONLY | O_NDELAY);
|
||||
if(fd < 0) {
|
||||
LOGE("Couldn't open /sys/class/power_supply/battery/status\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
memset(&state[0], 0, sizeof(state));
|
||||
|
||||
read(fd, state,20);
|
||||
close(fd);
|
||||
|
||||
rs=0;
|
||||
rs = sprintf(state,"%s",state);
|
||||
|
||||
if ( last_battery_state != rs){
|
||||
last_battery_state=rs;
|
||||
|
||||
if ( rs == 9){ // Charging
|
||||
write_int(&leds[GREEN_LED].brightness, 0);
|
||||
write_int(&leds[AMBER_LED].brightness, 1);
|
||||
write_int(&leds[AMBER_LED].blink, 0);
|
||||
}else if(rs == 5){ // FULL
|
||||
write_int(&leds[GREEN_LED].brightness, 1);
|
||||
write_int(&leds[AMBER_LED].brightness, 0);
|
||||
write_int(&leds[GREEN_LED].blink, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
nanosleep(&t,NULL);
|
||||
}
|
||||
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void start_battery_thread(){
|
||||
if (battery_check_t == 0) //ensure only 1 thread
|
||||
pthread_create(&battery_check_t, NULL, battery_state_thread, NULL);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
//=====================================================================================
|
||||
#ifdef ENABLE_RADIO_POOL
|
||||
static int last_radio_state = 0;
|
||||
#endif
|
||||
|
||||
static pthread_t events_ct = 0;
|
||||
static time_t keys_tm;
|
||||
#ifdef ENABLE_LCDSAVE
|
||||
static time_t abs_tm;
|
||||
static time_t last_activity_tm;
|
||||
|
||||
static int user_activity_idle() {
|
||||
int fd;
|
||||
int ret =0;
|
||||
char tmp[20];
|
||||
|
||||
fd= open("/sys/android_power/auto_off_timeout",O_RDONLY);
|
||||
if(fd < 0) {
|
||||
LOGE("Couldn't open /sys/android_power/auto_off_timeout\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(&tmp[0], 0, sizeof(tmp));
|
||||
read(fd, tmp,20);
|
||||
|
||||
D("@@ %s->%s\n", __func__, tmp);
|
||||
|
||||
close(fd);
|
||||
return (ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
switch_led_button(int on) {
|
||||
int err = 0;
|
||||
if (g_buttons!=on) {
|
||||
//D("@@ %s->%s\n", __func__, g_buttons?"ON":"OFF");
|
||||
err = write_int(&leds[BUTTONS_LED].brightness, on);
|
||||
keys_tm = time(NULL) + (8*on); // switch off button keypad after 8 seconds
|
||||
g_buttons = on;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
static int
|
||||
set_led_backlight(int level) {
|
||||
int err = 0;
|
||||
//D("%s: [%d %d %d]\n", __func__, level, g_backlight, g_current_backlight);
|
||||
if (g_backlight != level ){
|
||||
err = write_int(&leds[LCD_BACKLIGHT].brightness, level);
|
||||
g_backlight = level;
|
||||
}
|
||||
#ifdef ENABLE_LCDSAVE
|
||||
if (level>=g_current_backlight){
|
||||
g_current_backlight=level;
|
||||
abs_tm = time(NULL) + (10);
|
||||
}
|
||||
#endif
|
||||
return err;
|
||||
}
|
||||
|
||||
void *events_cthread(void *arg) {
|
||||
#ifdef ENABLE_RADIO_POOL
|
||||
int radio_state = 0;
|
||||
char sim_state[PROPERTY_VALUE_MAX];
|
||||
#endif
|
||||
struct input_event ev;
|
||||
struct timespec t;
|
||||
time_t a_tm, k_tm;
|
||||
//int fd;
|
||||
t.tv_nsec= 10000*1000;
|
||||
t.tv_sec = 0;
|
||||
|
||||
ev_init();
|
||||
|
||||
for (;;) {
|
||||
/* radio events tracking */
|
||||
#ifdef ENABLE_RADIO_POOL
|
||||
radio_state = 0;
|
||||
if (property_get("gsm.sim.state", sim_state, NULL) && (strcmp(sim_state, "READY")==0)) {
|
||||
radio_state = 1;
|
||||
}
|
||||
//radio state changed
|
||||
if ( last_radio_state != radio_state){
|
||||
D("@@ %s: |%s| %d->%d\n", __func__, sim_state, last_radio_state, radio_state );
|
||||
//green blink if radio is on
|
||||
write_int(&leds[AMBER_LED].brightness, radio_state?0:1);
|
||||
write_int(&leds[GREEN_LED].brightness, radio_state?1:0);
|
||||
write_int(&leds[GREEN_LED].blink, radio_state?1:0);
|
||||
last_radio_state=radio_state;
|
||||
}
|
||||
#endif
|
||||
/* battery events tracking */
|
||||
|
||||
/* button events tracking */
|
||||
ev_get(&ev, 1);
|
||||
if (ev.type==EV_KEY) {
|
||||
if (ev.value == 1){
|
||||
switch (ev.code) {
|
||||
case BTN_TOUCH:
|
||||
#ifdef ENABLE_LCDSAVE
|
||||
if (g_backlight > 0) && (abs_tm==0)
|
||||
set_led_backlight(g_current_backlight);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case KEY_SEND:
|
||||
case KEY_MENU:
|
||||
case KEY_HOME:
|
||||
case KEY_BACK:
|
||||
case KEY_END:
|
||||
case KEY_POWER:
|
||||
#ifdef ENABLE_LCDSAVE
|
||||
if (abs_tm==0) {set_led_backlight(g_current_backlight);}
|
||||
#endif
|
||||
switch_led_button(1);
|
||||
sleep(1);
|
||||
break;
|
||||
#ifdef ENABLE_LCDSAVE
|
||||
case KEY_VOLUMEUP:
|
||||
case KEY_VOLUMEDOWN:
|
||||
if (abs_tm==0) { set_led_backlight(g_current_backlight);}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
/*LOGD("keys: code %d, value %d\n", ev.code, ev.value);*/
|
||||
sleep(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//=========================
|
||||
#ifdef ENABLE_LCDSAVE
|
||||
if (g_backlight > 0) {
|
||||
a_tm = time(NULL);
|
||||
//D("%ld %ld\n", a_tm, abs_tm);
|
||||
if ((abs_tm>0) && (a_tm >= abs_tm) && (user_activity_idle())) {
|
||||
//D("LCD_BACKLIGHT->down brightness\n");
|
||||
set_led_backlight(50);
|
||||
//write_int(&leds[LCD_BACKLIGHT].brightness, 50);
|
||||
abs_tm = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
k_tm = time(NULL);
|
||||
//D("[%ld][%ld][%d][%d %d %d][%d]\n", tm, keys_tm, ev.type, ev.code, ev.value, g_buttons, g_backlight);
|
||||
if (g_buttons==1) {
|
||||
if (k_tm == keys_tm || g_backlight == 0){
|
||||
switch_led_button(0);
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
//=========================
|
||||
nanosleep(&t,NULL); //avoid 100% CPU usage by system_server
|
||||
}
|
||||
|
||||
ev_exit();
|
||||
events_ct = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void start_events_thread() {
|
||||
if (events_ct == 0) //ensure only 1 thread
|
||||
pthread_create(&events_ct, NULL, events_cthread, NULL);
|
||||
return;
|
||||
}
|
||||
//=================================================================================================
|
||||
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);
|
||||
LOGV("%s brightness=%d color=0x%08x",
|
||||
__func__,brightness, state->color);
|
||||
pthread_mutex_lock(&g_lock);
|
||||
set_led_backlight(brightness);
|
||||
pthread_mutex_unlock(&g_lock);
|
||||
return err;
|
||||
}
|
||||
|
||||
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);
|
||||
LOGV("%s mode=%d color=0x%08x",
|
||||
__func__,state->flashMode, state->color);
|
||||
switch_led_button(on);
|
||||
pthread_mutex_unlock(&g_lock);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int
|
||||
set_speaker_light_locked(struct light_device_t* dev,
|
||||
struct light_state_t const* state) {
|
||||
int len;
|
||||
unsigned int colorRGB;
|
||||
|
||||
colorRGB = state->color & 0xFFFFFF;
|
||||
|
||||
D("@@ %s colorRGB=%08X, state->flashMode:%d\n", __func__, colorRGB, state->flashMode);
|
||||
|
||||
/*if (colorRGB ==0) return 0;*/
|
||||
|
||||
int red = (colorRGB >> 16)&0xFF;
|
||||
int green = (colorRGB >> 8)&0xFF;
|
||||
int blue = (colorRGB) & 0xFF;
|
||||
int g_blink = 0;
|
||||
|
||||
switch (state->flashMode) {
|
||||
case LIGHT_FLASH_HARDWARE:
|
||||
g_blink = 3;
|
||||
break;
|
||||
case LIGHT_FLASH_TIMED:
|
||||
g_blink = 1;
|
||||
break;
|
||||
case LIGHT_FLASH_NONE:
|
||||
g_blink = 0;
|
||||
break;
|
||||
default:
|
||||
LOGE("set_led_state colorRGB=%08X, unknown mode %d\n",
|
||||
colorRGB, state->flashMode);
|
||||
break;
|
||||
}
|
||||
|
||||
if (red) {
|
||||
D("@@ %s AMBER, blink: %d\n", __func__, g_blink);
|
||||
write_int(&leds[GREEN_LED].brightness, 0);
|
||||
write_int(&leds[AMBER_LED].brightness, 1);
|
||||
write_int(&leds[AMBER_LED].blink, g_blink);
|
||||
} else if (green) {
|
||||
D("@@ %s GREEN, blink: %d\n", __func__, g_blink);
|
||||
write_int(&leds[AMBER_LED].brightness, 0);
|
||||
write_int(&leds[GREEN_LED].brightness, 1);
|
||||
write_int(&leds[GREEN_LED].blink, g_blink);
|
||||
} else {
|
||||
write_int(&leds[GREEN_LED].brightness, 0);
|
||||
write_int(&leds[GREEN_LED].blink, 0);
|
||||
write_int(&leds[AMBER_LED].brightness, 0);
|
||||
write_int(&leds[AMBER_LED].blink, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
set_light_battery(struct light_device_t* dev,
|
||||
struct light_state_t const* state) {
|
||||
pthread_mutex_lock(&g_lock);
|
||||
LOGV("%s mode=%d color=0x%08x",
|
||||
__func__,state->flashMode, state->color);
|
||||
set_speaker_light_locked(dev, state);
|
||||
pthread_mutex_unlock(&g_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
set_light_notifications(struct light_device_t* dev,
|
||||
struct light_state_t const* state) {
|
||||
pthread_mutex_lock(&g_lock);
|
||||
LOGV("%s mode=%d color=0x%08x",
|
||||
__func__,state->flashMode, state->color);
|
||||
pthread_mutex_unlock(&g_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
set_light_attention(struct light_device_t* dev,
|
||||
struct light_state_t const* state) {
|
||||
LOGV("%s color=0x%08x mode=0x%08x submode=0x%08x",
|
||||
__func__, state->color, state->flashMode, state->flashOnMS);
|
||||
pthread_mutex_lock(&g_lock);
|
||||
/*
|
||||
/lights_leo( 252): set_light_attention color=0x00ffffff mode=0x00000002 submode=0x00000003
|
||||
/lights_leo( 252): set_light_attention color=0x00000000 mode=0x00000002 submode=0x00000000
|
||||
/lights_leo( 252): set_light_attention color=0x00ffffff mode=0x00000002 submode=0x00000007
|
||||
/lights_leo( 252): set_light_attention color=0x00ffffff mode=0x00000000 submode=0x00000000
|
||||
*/
|
||||
#if 0
|
||||
if (state->flashMode==2 && state->flashOnMS==7){
|
||||
write_int(&leds[GREEN_LED].brightness, 0);
|
||||
write_int(&leds[AMBER_LED].brightness, 1);
|
||||
write_int(&leds[AMBER_LED].blink, 2);
|
||||
} else {
|
||||
write_int(&leds[AMBER_LED].brightness, 0);
|
||||
write_int(&leds[GREEN_LED].brightness, 1);
|
||||
write_int(&leds[GREEN_LED].blink, 4);
|
||||
}
|
||||
#endif
|
||||
pthread_mutex_unlock(&g_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
set_light_flashlight(struct light_device_t* dev,
|
||||
struct light_state_t const* state) {
|
||||
LOGV("%s color=0x%08x mode=0x%08x submode=0x%08x",
|
||||
__func__, state->color, state->flashMode, state->flashOnMS);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
set_light_function(struct light_device_t* dev,
|
||||
struct light_state_t const* state) {
|
||||
LOGV("%s color=0x%08x mode=0x%08x submode=0x%08x",
|
||||
__func__, state->color, state->flashMode, state->flashOnMS);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Close the lights device */
|
||||
static int
|
||||
close_lights(struct light_device_t *dev)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_LEDS; ++i) {
|
||||
close_prop(&leds[i].brightness);
|
||||
close_prop(&leds[i].blink);
|
||||
}
|
||||
|
||||
if (dev) {
|
||||
free(dev);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/**
|
||||
* module methods
|
||||
*/
|
||||
|
||||
/** Open a new instance of a lights device using name */
|
||||
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);
|
||||
|
||||
LOGV("%s name=%s", __func__, name);
|
||||
|
||||
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;
|
||||
start_events_thread();
|
||||
}
|
||||
else if (0 == strcmp(LIGHT_ID_BATTERY, name)) {
|
||||
set_light = set_light_battery;
|
||||
#ifdef ENABLE_BATTERY_POLL
|
||||
start_battery_thread();
|
||||
#endif
|
||||
}
|
||||
else if (0 == strcmp(LIGHT_ID_NOTIFICATIONS, name)) {
|
||||
set_light = set_light_notifications;
|
||||
}
|
||||
else if (0 == strcmp(LIGHT_ID_ATTENTION, name)) {
|
||||
set_light = set_light_attention;
|
||||
}
|
||||
else if (0 == strcmp(LIGHT_ID_FLASHLIGHT, name)) {
|
||||
set_light = set_light_flashlight;
|
||||
}
|
||||
else if (0 == strcmp(LIGHT_ID_FUNC, name)) {
|
||||
set_light = set_light_function;
|
||||
}
|
||||
else {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
pthread_once(&g_init, init_globals);
|
||||
|
||||
struct light_device_t *dev = malloc(sizeof(struct light_device_t));
|
||||
memset(dev, 0, sizeof(*dev));
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
/*
|
||||
* The lights Module
|
||||
*/
|
||||
const struct hw_module_t HAL_MODULE_INFO_SYM = {
|
||||
.tag = HARDWARE_MODULE_TAG,
|
||||
.version_major = 1,
|
||||
.version_minor = 0,
|
||||
.id = LIGHTS_HARDWARE_MODULE_ID,
|
||||
.name = "htcleo lights Module",
|
||||
.author = "Google, Inc.",
|
||||
.methods = &lights_module_methods,
|
||||
};
|
||||
@@ -21,7 +21,7 @@ ifneq ($(TARGET_SIMULATOR),true)
|
||||
# hw/<SENSORS_HARDWARE_MODULE_ID>.<ro.product.board>.so
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := sensors.leo
|
||||
LOCAL_MODULE := sensors.$(TARGET_BOOTLOADER_BOARD_NAME)
|
||||
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -32,8 +32,6 @@
|
||||
<bool name="config_automatic_brightness_available">true</bool>
|
||||
|
||||
|
||||
<bool name="config_animateScreenLights">false</bool>
|
||||
|
||||
<!-- disable menu hard key on HD2 in non-pattern lockscreen -->
|
||||
<bool name="config_disableMenuKeyInLockScreen">true</bool>
|
||||
|
||||
@@ -154,6 +152,7 @@
|
||||
tethering on a new interface called "foo2" add <item>"foo\\d"</item> to the array -->
|
||||
<string-array translatable="false" name="config_tether_upstream_regexs">
|
||||
<item>"rmnet\\d"</item>
|
||||
<item>"ppp\\d"</item>
|
||||
<item>"eth\\d"</item>
|
||||
</string-array>
|
||||
|
||||
@@ -161,11 +160,7 @@
|
||||
Wifi interfaces. If the device doesn't want to support tethering over Wifi this
|
||||
should be empty. An example would be "softap.*" -->
|
||||
<string-array translatable="false" name="config_tether_wifi_regexs">
|
||||
<item>"rmnet\\d"</item>
|
||||
<item>"wl0.1"</item>
|
||||
</string-array>
|
||||
<string-array translatable="false" name="config_tether_usb_regexs">
|
||||
<item>"usb0"</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Vibrator pattern for a very short but reliable vibration for soft keyboard tap -->
|
||||
@@ -185,5 +180,12 @@
|
||||
<!-- Enable use of power animations -->
|
||||
<bool name="config_animateScreenLights">false</bool>
|
||||
|
||||
<!-- Enable Tablet tweaks -->
|
||||
<bool name="cm_default_has_soft_buttons">true</bool>
|
||||
<bool name="cm_default_show_soft_home">false</bool>
|
||||
<bool name="cm_default_show_soft_menu">false</bool>
|
||||
<bool name="cm_default_show_soft_back">false</bool>
|
||||
<bool name="cm_default_show_soft_search">false</bool>
|
||||
<bool name="cm_default_show_soft_quick_na">false</bool>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Whether or not to display the trackball settings -->
|
||||
<bool name="has_trackball">false</bool>
|
||||
<bool name="has_dual_notification_led">true</bool>
|
||||
<bool name="has_camera_button">false</bool>
|
||||
<bool name="has_rgb_notification_led">false</bool>
|
||||
<bool name="has_led_flash">true</bool>
|
||||
<bool name="has_search_button">false</bool>
|
||||
</resources>
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
** Copyright 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<!-- These resources are around just to allow their values to be customized
|
||||
for different hardware and product builds. -->
|
||||
<resources>
|
||||
<!-- Autofocus parameters -->
|
||||
<!-- <string name="touchFocusParameter">touch-focus</string> -->
|
||||
</resources>
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
<!-- Enable the onscreen touch UI for all states of the in-call UI. -->
|
||||
<bool name="allow_incoming_call_touch_ui">true</bool>
|
||||
<bool name="allow_in_call_touch_ui">false</bool>
|
||||
<bool name="allow_in_call_touch_ui">true</bool>
|
||||
|
||||
<!-- This is a device with capacitive buttons, so disable the feature
|
||||
where BACK rejects the current incoming call. (Since it's so
|
||||
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/sbin/sh
|
||||
|
||||
sleep 2
|
||||
|
||||
if [[ "`grep clk= /proc/cmdline`" == "" ]]; then
|
||||
sed -i 's/\/boot\t\tmtd/\/boot\t\tyaffs2/g' /etc/recovery.fstab
|
||||
fi
|
||||
|
||||
# Commented out as it may or may not require this
|
||||
#mount /dev/block/mmcblk0p2 /sd-ext | grep sd-ext | awk '{print $5}'
|
||||
#FS=`mount | grep sd-ext | awk '{print $5}'`
|
||||
#umount /sd-ext
|
||||
#sed -i 's/\/sd-ext\ \ \ \ \ auto/\/sd-ext\t\t'$FS'/g' /etc/recovery.fstab
|
||||
#cat >> /etc/fstab << EOF
|
||||
#/dev/block/mmcblk0p2 /sd-ext $FS rw
|
||||
#EOF
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/system/bin/sh
|
||||
#
|
||||
# Load MODULES
|
||||
sleep 1
|
||||
if [ -f /system/ppp ]
|
||||
then
|
||||
echo "Not loading RMNET module as /system/ppp exists"
|
||||
else
|
||||
echo "Loading RMNET module as /system/ppp doesn't exist"
|
||||
insmod /system/lib/modules/msm_rmnet.ko
|
||||
fi
|
||||
insmod /system/lib/modules/tun.ko
|
||||
insmod /system/lib/modules/cifs.ko
|
||||
insmod /system/lib/modules/nls_utf8.ko
|
||||
insmod /system/lib/modules/fuse.ko
|
||||
echo "+++ TUN / CIFS activated +++";
|
||||
@@ -0,0 +1,51 @@
|
||||
NTP_SERVER=north-america.pool.ntp.org
|
||||
XTRA_SERVER_1=http://xtra1.gpsonextra.net/xtra.bin
|
||||
XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra.bin
|
||||
XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra.bin
|
||||
NTP_SERVER=0.north-america.pool.ntp.org
|
||||
NTP_SERVER=1.north-america.pool.ntp.org
|
||||
NTP_SERVER=2.north-america.pool.ntp.org
|
||||
NTP_SERVER=3.north-america.pool.ntp.org
|
||||
XTRA_SERVER_1=http://xtra1.gpsonextra.net/xtra.bin
|
||||
XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra.bin
|
||||
XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra.bin
|
||||
SUPL_HOST=supl.google.com
|
||||
SUPL_PORT=7276
|
||||
SUPL_HOST=FQDN
|
||||
SUPL_PORT=7275
|
||||
SUPL_TLS_HOST=FQDN
|
||||
SUPL_TLS_CERT=/etc/SuplRootCert
|
||||
|
||||
###########################################
|
||||
# Enable/disable automatic (periodic) #
|
||||
# download requests of gpsOneXTRA #
|
||||
# assistance data to client #
|
||||
# Range: 0 to 1 #
|
||||
# Default: 0 (Disabled) #
|
||||
###########################################
|
||||
GPS1_XTRA_AUTO_DOWNLOAD_ENABLED=0
|
||||
|
||||
###########################################
|
||||
# Time (in hours) between automatic #
|
||||
# download requests of gpsOneXTRA #
|
||||
# assistance data to client #
|
||||
# Range: 1 to 168 (168 = hr in a week) #
|
||||
# Default: 24 hr #
|
||||
###########################################
|
||||
GPS1_XTRA_DOWNLOAD_INTERVAL=24
|
||||
|
||||
###########################################
|
||||
# Enable/disable to shutdown the gpsOne #
|
||||
# engine properly on GPS off #
|
||||
# Range: 0 to 1 #
|
||||
# Default: 1 (Enabled) #
|
||||
###########################################
|
||||
GPS1_CLEANUP_ENABLED=1
|
||||
|
||||
###########################################
|
||||
# Time (in seconds) between invoking #
|
||||
# pdsm_get_position() #
|
||||
# Range: 2 to 120 #
|
||||
# Default: 2 seconds #
|
||||
###########################################
|
||||
GPS1_SESSION_TIMEOUT=2
|
||||
@@ -0,0 +1,51 @@
|
||||
NTP_SERVER=europe.pool.ntp.org
|
||||
XTRA_SERVER_1=http://xtra1.gpsonextra.net/xtra.bin
|
||||
XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra.bin
|
||||
XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra.bin
|
||||
NTP_SERVER=0.europe.pool.ntp.org
|
||||
NTP_SERVER=1.europe.pool.ntp.org
|
||||
NTP_SERVER=2.europe.pool.ntp.org
|
||||
NTP_SERVER=3.europe.pool.ntp.org
|
||||
XTRA_SERVER_1=http://xtra1.gpsonextra.net/xtra.bin
|
||||
XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra.bin
|
||||
XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra.bin
|
||||
SUPL_HOST=supl.google.com
|
||||
SUPL_PORT=7276
|
||||
SUPL_HOST=FQDN
|
||||
SUPL_PORT=7275
|
||||
SUPL_TLS_HOST=FQDN
|
||||
SUPL_TLS_CERT=/etc/SuplRootCert
|
||||
|
||||
###########################################
|
||||
# Enable/disable automatic (periodic) #
|
||||
# download requests of gpsOneXTRA #
|
||||
# assistance data to client #
|
||||
# Range: 0 to 1 #
|
||||
# Default: 0 (Disabled) #
|
||||
###########################################
|
||||
GPS1_XTRA_AUTO_DOWNLOAD_ENABLED=0
|
||||
|
||||
###########################################
|
||||
# Time (in hours) between automatic #
|
||||
# download requests of gpsOneXTRA #
|
||||
# assistance data to client #
|
||||
# Range: 1 to 168 (168 = hr in a week) #
|
||||
# Default: 24 hr #
|
||||
###########################################
|
||||
GPS1_XTRA_DOWNLOAD_INTERVAL=24
|
||||
|
||||
###########################################
|
||||
# Enable/disable to shutdown the gpsOne #
|
||||
# engine properly on GPS off #
|
||||
# Range: 0 to 1 #
|
||||
# Default: 1 (Enabled) #
|
||||
###########################################
|
||||
GPS1_CLEANUP_ENABLED=1
|
||||
|
||||
###########################################
|
||||
# Time (in seconds) between invoking #
|
||||
# pdsm_get_position() #
|
||||
# Range: 2 to 120 #
|
||||
# Default: 2 seconds #
|
||||
###########################################
|
||||
GPS1_SESSION_TIMEOUT=2
|
||||
@@ -0,0 +1,257 @@
|
||||
on init
|
||||
export TERMINFO /system/etc/terminfo
|
||||
|
||||
symlink /dev/msm_camera/control0 /dev/msm_camera/control1
|
||||
symlink /dev/msm_camera/frame0 /dev/msm_camera/frame1
|
||||
symlink /dev/msm_camera/config0 /dev/msm_camera/config1
|
||||
|
||||
write /proc/sys/kernel/sched_min_granularity_ns 100000
|
||||
|
||||
on fs
|
||||
mount yaffs2 mtd@system /system remount
|
||||
mount rootfs rootfs / rw remount
|
||||
mkdir /sd-ext 0771 system system
|
||||
|
||||
# DRMv1 rights storage
|
||||
symlink /data/local /data/drm
|
||||
mkdir /data/local/rights 0777 shell shell
|
||||
chown shell shell /data/drm
|
||||
write /data/drm/rights/mid.txt 0
|
||||
chmod 0777 /data/drm/rights/mid.txt
|
||||
|
||||
on boot
|
||||
mount debugfs /sys/kernel/debug /sys/kernel/debug
|
||||
|
||||
mkdir /data/misc/wifi 0770 wifi wifi
|
||||
mkdir /data/misc/wifi/sockets 0770 wifi wifi
|
||||
mkdir /data/misc/dhcp 0770 dhcp dhcp
|
||||
chown dhcp dhcp /data/misc/dhcp
|
||||
|
||||
# bluetooth power up/down interface
|
||||
chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type
|
||||
chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
|
||||
chmod 0660 /sys/class/rfkill/rfkill0/state
|
||||
|
||||
# bluetooth MAC address programming
|
||||
chown bluetooth bluetooth /sys/module/board_htcleo/parameters/bdaddr
|
||||
setprop ro.bt.bdaddr_path /sys/module/board_htcleo/parameters/bdaddr
|
||||
|
||||
# bluetooth car dock pin
|
||||
chown system system /sys/class/switch/dock/bt_pin
|
||||
|
||||
chown radio radio /sys/module/pm/parameters/idle_sleep_mode
|
||||
|
||||
# Set error receiver
|
||||
setprop ro.error.receiver.htc.apps com.android.updater
|
||||
|
||||
# ruu
|
||||
write /data/misc/screen_lock_status 0
|
||||
chown system system /data/misc/screen_lock_status
|
||||
chmod 644 /data/misc/screen_lock_status
|
||||
|
||||
# Write value must be consistent with the above properties.
|
||||
# Note that the driver only supports 6 slots, so we have HOME_APP at the
|
||||
# same memory level as services.
|
||||
write /sys/module/lowmemorykiller/parameters/adj 0,1,2,7,14,15
|
||||
|
||||
# Permissions for 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/red/brightness
|
||||
chown system system /sys/class/leds/red/blink
|
||||
chown system system /sys/class/leds/blue/brightness
|
||||
chown system system /sys/class/leds/blue/blink
|
||||
chown system system /sys/class/leds/jogball-backlight/brightness
|
||||
chown system system /sys/class/leds/jogball-backlight/color
|
||||
chown system system /sys/class/leds/jogball-backlight/period
|
||||
chown system system /sys/class/leds/button-backlight/brightness
|
||||
chown system system /sys/class/leds/lcd-backlight/brightness
|
||||
|
||||
# Permissions for camera
|
||||
chown radio system /sys/camera_led_status/led_ril_status
|
||||
chown system system /sys/camera_led_status/led_wimax_status
|
||||
chown system system /sys/camera_led_status/led_hotspot_status
|
||||
chown media system /sys/android_camera/cam_mode
|
||||
|
||||
# enable the GPS
|
||||
setprop ro.ril.def.agps.mode 2
|
||||
|
||||
# performance tweaks for flash
|
||||
write /sys/block/mtdblock3/bdi/read_ahead_kb 2048
|
||||
write /sys/block/mtdblock4/bdi/read_ahead_kb 2048
|
||||
write /sys/block/mtdblock5/bdi/read_ahead_kb 2048
|
||||
# increase read throughput from sd card
|
||||
write /sys/block/mmcblk0/bdi/read_ahead_kb 204
|
||||
|
||||
# for wireless modem
|
||||
chown system system /sys/module/serial/parameters/modem_enabled
|
||||
chown system system /dev/ttyHSUSB0
|
||||
chown system system /dev/smd9
|
||||
chown media media /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
|
||||
|
||||
# Power Management
|
||||
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 245000
|
||||
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq 998400
|
||||
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ondemand
|
||||
write /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate 40000
|
||||
chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
|
||||
chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
|
||||
chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
|
||||
|
||||
# Wakelock debug
|
||||
write /sys/module/wakelock/parameters/debug_mask 7
|
||||
|
||||
# Fast dormancy settings
|
||||
setprop ro.ril.fast.dormancy.rule 1
|
||||
setprop ro.ril.fd.scron.timeout 4
|
||||
setprop ro.ril.fd.scroff.timeout 3
|
||||
|
||||
# GPRS class
|
||||
#setprop ro.ril.gprsclass 10
|
||||
|
||||
chown root radio /proc/cmdline
|
||||
chown system system /dev/ttyHS0
|
||||
chown system system /dev/smd0
|
||||
chown system system /dev/smd1
|
||||
chown system system /dev/smd27
|
||||
|
||||
chmod 0666 /dev/rfkill
|
||||
chmod 0666 /dev/q6venc
|
||||
chmod 0666 /dev/ttyHS0
|
||||
chmod 0666 /dev/ttyHS1
|
||||
chmod 666 /proc/cmdline
|
||||
|
||||
chmod 666 /dev/input/event0
|
||||
chmod 666 /dev/input/event1
|
||||
chmod 666 /dev/input/event2
|
||||
chmod 666 /dev/input/event3
|
||||
chmod 666 /dev/input/event4
|
||||
chmod 666 /dev/input/event5
|
||||
chmod 666 /dev/input/event6
|
||||
|
||||
chmod 666 /dev/uinput
|
||||
chmod 666 /dev/msm_aac_in
|
||||
chmod 666 /dev/msm_audio_ctl
|
||||
chmod 666 /dev/msm_audio_route
|
||||
chmod 666 /dev/msm_mp3
|
||||
chmod 666 /dev/msm_qcelp_in
|
||||
chmod 666 /dev/msm_snd
|
||||
chmod 666 /dev/msm_audpre
|
||||
|
||||
chmod 666 /dev/msm_pcm_in
|
||||
chmod 666 /dev/msm_pcm_out
|
||||
chmod 666 /dev/msm_pcm_ctl
|
||||
chmod 666 /dev/msm_hw3dm
|
||||
chmod 666 /dev/msm_hw3dc
|
||||
|
||||
chmod 666 /dev/qmi0
|
||||
chmod 666 /dev/qmi1
|
||||
chmod 666 /dev/qmi2
|
||||
|
||||
chmod 666 /etc/bluez/audio.conf
|
||||
chmod 666 /etc/bluez/hcid.conf
|
||||
chmod 666 /etc/bluez/input.conf
|
||||
|
||||
chmod 0777 /dev/kgsl
|
||||
chmod 0777 /dev/smd0
|
||||
chmod 0777 /dev/smd1
|
||||
chmod 0777 /dev/smd27
|
||||
chmod 0777 /dev/vfe
|
||||
chmod 0777 /dev/camera
|
||||
chmod 0777 /dev/msm_camera
|
||||
chmod 0777 /dev/vogue_gps
|
||||
chmod 0777 /dev/akm8973_aot
|
||||
chmod 0777 /dev/akm8973_daemon
|
||||
chmod 0777 /dev/compass
|
||||
chmod 0777 /dev/lightsensor
|
||||
chmod 0777 /dev/bma150
|
||||
chmod 0777 /dev/cm3602
|
||||
chmod 0777 /dev/htc-acoustic
|
||||
|
||||
# flashlight
|
||||
chown system camera /sys/class/leds/flashlight/brightness
|
||||
chmod 0666 /sys/class/leds/flashlight/brightness
|
||||
chmod 0666 /sys/class/leds/flashlight/max_brightness
|
||||
chown system camera /sys/devices/platform/flashlight.0/leds/flashlight/brightness
|
||||
chmod 0660 /sys/devices/platform/flashlight.0/leds/flashlight/brightness
|
||||
|
||||
|
||||
#720p cam support
|
||||
symlink /dev/msm_camera/control0 /dev/msm_camera/control1
|
||||
symlink /dev/msm_camera/frame0 /dev/msm_camera/frame1
|
||||
symlink /dev/msm_camera/config0 /dev/msm_camera/config1
|
||||
|
||||
chmod 666 /sys/class/i2c-adapter/i2c-0/0-0018/enable
|
||||
chmod 666 /sys/class/i2c-adapter/i2c-0/0-0019/enable
|
||||
chmod 666 /sys/class/i2c-adapter/i2c-0/0-0018/rate
|
||||
chmod 666 /sys/class/i2c-adapter/i2c-0/0-0019/rate
|
||||
chmod 666 /sys/class/i2c-adapter/i2c-0/0-0018/scale
|
||||
chmod 666 /sys/class/i2c-adapter/i2c-0/0-0019/scale
|
||||
|
||||
# Power Management
|
||||
# write /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate 40000
|
||||
|
||||
# Overwrite framework low memory killer minfree setting
|
||||
write /sys/module/lowmemorykiller/parameters/minfree 3584,4096,6144,7168,7680,8192
|
||||
|
||||
# Enable low memory killer to check file pages
|
||||
write /sys/module/lowmemorykiller/parameters/minfile 0,0,0,5120,5632,6144
|
||||
write /sys/module/lowmemorykiller/parameters/check_filepages
|
||||
|
||||
# PPP stuff
|
||||
chown radio radio /dev/smd1
|
||||
chown root radio /system/etc/ppp
|
||||
chown root root /system/bin/pppd;
|
||||
chmod 755 /system/etc/ppp/*
|
||||
chmod 4755 /system/bin/pppd
|
||||
|
||||
if [ -f /system/ppp ]
|
||||
then
|
||||
# PPP enabled, doing PPP specific stuff
|
||||
|
||||
# Create link for resolv.conf (generated by pppd)
|
||||
symlink /etc/ppp/resolv.conf /etc/resolv.conf
|
||||
|
||||
# Tweak kernel low memory handling
|
||||
write /proc/sys/vm/lowmem_reserve_ratio 8 8
|
||||
write /proc/sys/vm/min_free_kbytes 8192
|
||||
fi
|
||||
|
||||
service hciattach /system/bin/brcm_patchram_plus --enable_hci --enable_lpm \
|
||||
--baudrate 3000000 --patchram /etc/firmware/bcm4329.hcd /dev/ttyHS0
|
||||
user bluetooth
|
||||
group bluetooth net_bt_admin
|
||||
disabled
|
||||
|
||||
# compass/accelerometer daemon
|
||||
service akmd /system/bin/akmd
|
||||
user compass
|
||||
group compass misc input
|
||||
|
||||
service wpa_supplicant /system/bin/wpa_supplicant \
|
||||
-Dwext -ieth0 -c/data/misc/wifi/wpa_supplicant.conf
|
||||
#user wifi
|
||||
#group wifi inet
|
||||
socket wpa_eth0 dgram 660 wifi wifi
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service dhcpcd_eth0 /system/bin/dhcpcd -ABKL
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service iprenew_eth0 /system/bin/dhcpcd -n
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
# for USB internet sharing
|
||||
service udhcpd /system/bin/udhcpd
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
# Execute files in /etc/init.d before booting
|
||||
service sysinit /system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/init.d
|
||||
disabled
|
||||
oneshot
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
init.htcleo.rc
|
||||
Executable
BIN
Binary file not shown.
@@ -22,7 +22,7 @@
|
||||
AudioDecoderCap)>
|
||||
<!ELEMENT CamcorderProfiles (EncoderProfile+, ImageEncoding+, ImageDecoding, Camera)>
|
||||
<!ELEMENT EncoderProfile (Video, Audio)>
|
||||
<!ATTLIST EncoderProfile quality (high|low) #REQUIRED>
|
||||
<!ATTLIST EncoderProfile quality (hd|high|low) #REQUIRED>
|
||||
<!ATTLIST EncoderProfile fileFormat (mp4|3gp) #REQUIRED>
|
||||
<!ATTLIST EncoderProfile duration (30|60) #REQUIRED>
|
||||
<!ELEMENT Video EMPTY>
|
||||
@@ -77,10 +77,10 @@
|
||||
-->
|
||||
<MediaSettings>
|
||||
<!-- Each camcorder profile defines a set of predefined configuration parameters -->
|
||||
<CamcorderProfiles cameraId="0">
|
||||
<!--
|
||||
<CamcorderProfiles>
|
||||
|
||||
<EncoderProfile quality="hd" fileFormat="mp4" duration="60">
|
||||
<Video codec="m4v"
|
||||
<Video codec="h264"
|
||||
bitRate="6000000"
|
||||
width="1280"
|
||||
height="720"
|
||||
@@ -88,55 +88,21 @@
|
||||
|
||||
<Audio codec="aac"
|
||||
bitRate="96000"
|
||||
sampleRate="16000"
|
||||
sampleRate="48000"
|
||||
channels="1" />
|
||||
</EncoderProfile>
|
||||
-->
|
||||
|
||||
<EncoderProfile quality="high" fileFormat="mp4" duration="60">
|
||||
<Video codec="h264"
|
||||
bitRate="3000000"
|
||||
width="720"
|
||||
height="480"
|
||||
frameRate="24" />
|
||||
|
||||
<Audio codec="aac"
|
||||
bitRate="96000"
|
||||
sampleRate="16000"
|
||||
channels="1" />
|
||||
</EncoderProfile>
|
||||
|
||||
<EncoderProfile quality="low" fileFormat="3gp" duration="30">
|
||||
<Video codec="h263"
|
||||
bitRate="256000"
|
||||
width="176"
|
||||
height="144"
|
||||
frameRate="15" />
|
||||
|
||||
<Audio codec="amrnb"
|
||||
bitRate="12200"
|
||||
sampleRate="8000"
|
||||
channels="1" />
|
||||
|
||||
</EncoderProfile>
|
||||
|
||||
<ImageEncoding quality="90" />
|
||||
<ImageEncoding quality="80" />
|
||||
<ImageEncoding quality="70" />
|
||||
</CamcorderProfiles>
|
||||
|
||||
<CamcorderProfiles cameraId="1">
|
||||
<EncoderProfile quality="high" fileFormat="mp4" duration="60">
|
||||
<Video codec="h264"
|
||||
<Video codec="m4v"
|
||||
bitRate="2000000"
|
||||
width="640"
|
||||
width="800"
|
||||
height="480"
|
||||
frameRate="24" />
|
||||
frameRate="30" />
|
||||
|
||||
<Audio codec="aac"
|
||||
bitRate="96000"
|
||||
sampleRate="16000"
|
||||
bitRate="48000"
|
||||
sampleRate="22050"
|
||||
channels="1" />
|
||||
|
||||
</EncoderProfile>
|
||||
|
||||
<EncoderProfile quality="low" fileFormat="3gp" duration="30">
|
||||
@@ -150,17 +116,17 @@
|
||||
bitRate="12200"
|
||||
sampleRate="8000"
|
||||
channels="1" />
|
||||
|
||||
</EncoderProfile>
|
||||
|
||||
<ImageEncoding quality="90" />
|
||||
<ImageEncoding quality="80" />
|
||||
<ImageEncoding quality="70" />
|
||||
<ImageDecoding memCap="20000000" />
|
||||
|
||||
<ImageDecoding memCap="10000000" />
|
||||
|
||||
<Camera previewFrameRate="0" />
|
||||
</CamcorderProfiles>
|
||||
|
||||
|
||||
<EncoderOutputFileFormat name="3gp" />
|
||||
<EncoderOutputFileFormat name="mp4" />
|
||||
|
||||
@@ -171,25 +137,25 @@
|
||||
-->
|
||||
<VideoEncoderCap name="h264" enabled="true"
|
||||
minBitRate="64000" maxBitRate="6000000"
|
||||
minFrameWidth="176" maxFrameWidth="800"
|
||||
minFrameHeight="144" maxFrameHeight="480"
|
||||
minFrameWidth="176" maxFrameWidth="1280"
|
||||
minFrameHeight="144" maxFrameHeight="720"
|
||||
minFrameRate="1" maxFrameRate="30" />
|
||||
|
||||
<VideoEncoderCap name="h263" enabled="true"
|
||||
minBitRate="64000" maxBitRate="6000000"
|
||||
minBitRate="64000" maxBitRate="2000000"
|
||||
minFrameWidth="176" maxFrameWidth="800"
|
||||
minFrameHeight="144" maxFrameHeight="480"
|
||||
minFrameRate="1" maxFrameRate="30" />
|
||||
|
||||
<VideoEncoderCap name="m4v" enabled="true"
|
||||
minBitRate="64000" maxBitRate="8000000"
|
||||
minFrameWidth="176" maxFrameWidth="1280"
|
||||
minFrameHeight="144" maxFrameHeight="720"
|
||||
minBitRate="64000" maxBitRate="2000000"
|
||||
minFrameWidth="176" maxFrameWidth="800"
|
||||
minFrameHeight="144" maxFrameHeight="480"
|
||||
minFrameRate="1" maxFrameRate="30" />
|
||||
|
||||
<AudioEncoderCap name="aac" enabled="true"
|
||||
minBitRate="8192" maxBitRate="96000"
|
||||
minSampleRate="8000" maxSampleRate="16000"
|
||||
minSampleRate="8000" maxSampleRate="48000"
|
||||
minChannels="1" maxChannels="1" />
|
||||
|
||||
<AudioEncoderCap name="amrwb" enabled="true"
|
||||
@@ -211,4 +177,4 @@
|
||||
-->
|
||||
<VideoDecoderCap name="wmv" enabled="false"/>
|
||||
<AudioDecoderCap name="wma" enabled="false"/>
|
||||
</MediaSettings>
|
||||
</MediaSettings>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Symlink
+1
@@ -0,0 +1 @@
|
||||
ueventd.htcleo.rc
|
||||
@@ -0,0 +1,26 @@
|
||||
bin/akmd
|
||||
bin/parse_radio_log
|
||||
bin/vold
|
||||
etc/AudioBTID.csv
|
||||
etc/AdieHWCodecSetting.csv
|
||||
etc/firmware/BCM4329B1_002.002.023.0360.0362.hcd
|
||||
etc/firmware/BCM4329B1_002.002.023.0436.0439.hcd
|
||||
etc/firmware/BCM4329B1_002.002.023.0436.0439.hcd
|
||||
etc/firmware/BCM4329B1_002.002.023.0511.0538.hcd
|
||||
etc/firmware/bcm4329.hcd
|
||||
etc/firmware/default.acdb
|
||||
etc/firmware/yamato_pfp.fw
|
||||
etc/firmware/yamato_pm4.fw
|
||||
lib/egl/libEGL_adreno200.so
|
||||
lib/egl/libGLESv1_CM_adreno200.so
|
||||
lib/egl/libGLESv2_adreno200.so
|
||||
lib/egl/libq3dtools_adreno200.so
|
||||
lib/libaudio.so
|
||||
lib/libcamera.so
|
||||
lib/libgsl.so
|
||||
lib/libhtc_acoustic.so
|
||||
lib/libhtc_ril.so
|
||||
lib/liboemcamera.so
|
||||
lib/libOmxVdec.so
|
||||
lib/libOmxVidEnc.so
|
||||
lib/libOmxCore.so
|
||||
@@ -7,3 +7,4 @@
|
||||
/recovery mtd recovery
|
||||
/sdcard vfat /dev/block/mmcblk0p1 /dev/block/mmcblk0
|
||||
/system yaffs2 system
|
||||
/sd-ext auto /dev/block/mmcblk0p2 /dev/block/mmcblk0
|
||||
|
||||
Executable
+180
@@ -0,0 +1,180 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Squish a CM otapackage for distribution
|
||||
# cyanogen
|
||||
#
|
||||
|
||||
OUT_TARGET_HOST=`uname -a | grep Darwin`
|
||||
if [ -z "$OUT_TARGET_HOST" ]
|
||||
then
|
||||
OUT_TARGET_HOST=linux-x86
|
||||
MD5=md5sum
|
||||
XARGS="xargs --max-args=1 --max-procs `grep 'processor' /proc/cpuinfo|wc -l`"
|
||||
SED=sed
|
||||
else
|
||||
OUT_TARGET_HOST=darwin-x86
|
||||
MD5=md5
|
||||
XARGS="xargs -n 1 -P `sysctl hw.ncpu | awk '{print $2}'`"
|
||||
SED=gsed
|
||||
fi
|
||||
|
||||
if [ -z "$OUT" -o ! -d "$OUT" ]; then
|
||||
echo "ERROR: $0 only works with a full build environment. $OUT should exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$TARGET_BUILD_TYPE" = "debug" ]; then
|
||||
OTAPACKAGE=$OUT/${TARGET_PRODUCT}_debug-ota-$TARGET_BUILD_VARIANT.$USER.zip
|
||||
else
|
||||
OTAPACKAGE=$OUT/$TARGET_PRODUCT-ota-$TARGET_BUILD_VARIANT.$USER.zip
|
||||
fi
|
||||
if [ ! -f "$OTAPACKAGE" ]; then
|
||||
echo "$OTAPACKAGE doesn't exist!";
|
||||
exit 1
|
||||
fi
|
||||
|
||||
OPTICHARGER=$ANDROID_BUILD_TOP/vendor/cyanogen/tools/opticharger
|
||||
QUIET=-q
|
||||
DELETE_BINS="applypatch applypatch_static check_prereq recovery updater"
|
||||
|
||||
|
||||
# Some products want a squashfs for xbin for space
|
||||
case "$TARGET_PRODUCT" in
|
||||
cyanogen_dream_sapphire) WANT_SQUASHFS=1 ;;
|
||||
*) WANT_SQUASHFS=0 ;;
|
||||
esac
|
||||
|
||||
if [ "$WANT_SQUASHFS" -eq 1 ]; then
|
||||
fatal=0
|
||||
MKSQUASHFS_VER_REQ=4
|
||||
if type mksquashfs >/dev/null 2>&1; then
|
||||
if mksquashfs -version | grep -q "version $MKSQUASHFS_VER_REQ"; then :; else
|
||||
echo
|
||||
echo "ERROR: mksquashfs must be at least version $MKSQUASHFS_VER_REQ for this build."
|
||||
fatal=1
|
||||
fi
|
||||
else
|
||||
echo
|
||||
echo "ERROR: $TARGET_PRODUCT requires mksquashfs."
|
||||
fatal=1
|
||||
fi
|
||||
|
||||
if [ "$fatal" -ne 0 ]; then
|
||||
echo
|
||||
echo " Unoptimized package is still available at"
|
||||
echo " $OTAPACKAGE"
|
||||
exit $fatal
|
||||
fi
|
||||
fi
|
||||
|
||||
REPACK=$OUT/repack.d
|
||||
printf "Sanitizing environment..."
|
||||
rm -rf $REPACK
|
||||
mkdir -p $REPACK
|
||||
echo
|
||||
|
||||
|
||||
# Unpack the otapackage and opticharge all apks
|
||||
mkdir $REPACK/ota
|
||||
(
|
||||
cd $REPACK/ota
|
||||
printf "Unpacking $OTAPACKAGE..."
|
||||
unzip $QUIET $OTAPACKAGE
|
||||
echo
|
||||
cd $REPACK/ota/system/framework
|
||||
$OPTICHARGER framework-res.apk
|
||||
cd $REPACK/ota/system/app
|
||||
find ./ -name \*.apk | $XARGS $OPTICHARGER
|
||||
)
|
||||
|
||||
|
||||
if [ "$WANT_SQUASHFS" -eq 1 ]; then
|
||||
squash_opts="-force-uid 1000 -force-gid 1000 -no-progress -noappend -no-exports -no-recovery"
|
||||
updater=$REPACK/ota/META-INF/com/google/android/updater-script
|
||||
|
||||
# Relocate su
|
||||
cp -a $REPACK/ota/system/xbin $REPACK/_xbin/
|
||||
rm -f $REPACK/_xbin/su $REPACK/ota/system/bin/su
|
||||
mv $REPACK/ota/system/xbin/su $REPACK/ota/system/bin/su
|
||||
chmod -R 555 $REPACK/_xbin/*
|
||||
|
||||
# Create symlinks for su and busybox (since updater-script can't work on the squashfs filesystem).
|
||||
# Forgive me for the regex hell here.
|
||||
ln -s ../bin/su $REPACK/_xbin/su
|
||||
for link in `sed -n -e's/,//g' -e'/symlink(.*busybox/,/xbin.*);/p' $updater | tr '"' '\n' | sed -n -e'\,/system/xbin/,s,/system/xbin/,,p'`
|
||||
do
|
||||
ln -s busybox $REPACK/_xbin/$link
|
||||
done
|
||||
|
||||
# Create the squashfs with new and improved symlinkage!
|
||||
mksquashfs $REPACK/_xbin/* $REPACK/_xbin.sqf $squash_opts
|
||||
rm -rf $REPACK/ota/system/xbin/*
|
||||
mv $REPACK/_xbin.sqf $REPACK/ota/system/xbin/xbin.sqf
|
||||
chmod 444 $REPACK/ota/system/xbin/xbin.sqf
|
||||
|
||||
# Remove xbin stuff and fix up updater-script
|
||||
$SED -i -e's,system/xbin/su,system/bin/su,g' -e'/xbin/d' $updater
|
||||
fi
|
||||
|
||||
|
||||
# Fix build.prop
|
||||
$SED -i \
|
||||
-e '/ro\.kernel\.android\.checkjni/d' \
|
||||
-e '/ro\.build\.type/s/eng/user/' \
|
||||
$REPACK/ota/system/build.prop
|
||||
|
||||
# Include device specific script
|
||||
if [ "$TARGET_PRODUCT" = "cyanogen_leo" ]; then
|
||||
. $ANDROID_BUILD_TOP/device/htc/leo/releasetools/squisher.sh
|
||||
fi
|
||||
|
||||
|
||||
# Delete unnecessary binaries
|
||||
( cd $REPACK/ota/system/bin; echo $DELETE_BINS | xargs rm -f; )
|
||||
|
||||
# Delete leftover wireless driver
|
||||
# rm -rf $REPACK/ota/system/lib/modules/*/kernel/drivers/net
|
||||
|
||||
# No need for recovery
|
||||
rm -rf $REPACK/ota/recovery
|
||||
|
||||
# Strip modules
|
||||
[ -d $REPACK/ota/system/lib/modules ] && \
|
||||
find $REPACK/ota/system/lib/modules -name "*.ko" -print0 | xargs -0 arm-eabi-strip --strip-unneeded
|
||||
|
||||
# Determine what to name the new signed package
|
||||
if [ -z "$CYANOGEN_NIGHTLY" ]; then
|
||||
MODVERSION=`sed -n -e'/ro\.modversion/s/^.*CyanogenMod-//p' $REPACK/ota/system/build.prop`
|
||||
: ${MODVERSION:=nightly}
|
||||
OUTFILE=$OUT/update-cm-$MODVERSION-signed.zip
|
||||
else
|
||||
OUTFILE=$OUT/update-squished.zip
|
||||
fi
|
||||
|
||||
# Pack it up and sign
|
||||
printf "Zipping package..."
|
||||
( cd $REPACK/ota; zip $QUIET -r $REPACK/update.zip . )
|
||||
echo
|
||||
printf "Signing package..."
|
||||
SECURITYDIR=$ANDROID_BUILD_TOP/build/target/product/security
|
||||
java -Xmx512m \
|
||||
-jar $ANDROID_BUILD_TOP/out/host/$OUT_TARGET_HOST/framework/signapk.jar \
|
||||
-w $SECURITYDIR/testkey.x509.pem $SECURITYDIR/testkey.pk8 \
|
||||
$REPACK/update.zip $OUTFILE
|
||||
echo
|
||||
printf "Cleaning up..."
|
||||
rm -rf $REPACK
|
||||
echo
|
||||
|
||||
# Create a md5 checksum image of the repacked package
|
||||
(
|
||||
img=`basename $OUTFILE`
|
||||
cd `dirname $OUTFILE`
|
||||
$MD5 $img >$img.md5sum
|
||||
echo
|
||||
echo "Package complete: $OUTFILE"
|
||||
cat $img.md5sum
|
||||
echo
|
||||
)
|
||||
|
||||
exit 0
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
# This script is included in squisher
|
||||
# It is the final build step (after OTA package)
|
||||
|
||||
echo "updater-script: Making Compatible Update script"
|
||||
cd $REPACK/ota/META-INF/com/google/android
|
||||
echo 'mount("yaffs2", "MTD", "boot", "/boot");' >> temp
|
||||
echo 'package_extract_dir("boot", "/boot");' >> temp
|
||||
echo 'unmount("/boot");' >> temp
|
||||
grep -vw assert updater-script >> temp
|
||||
rm -rf updater-script
|
||||
grep -vw boot.img temp > updater-script
|
||||
rm -rf temp
|
||||
|
||||
cd $REPACK/ota
|
||||
echo "Removing: $REPACK/ota/boot.img"
|
||||
rm -rf $REPACK/ota/boot.img
|
||||
echo "Removing: $REPACK/ota/boot"
|
||||
rm -rf $REPACK/ota/boot
|
||||
|
||||
echo "Copying: $OUT/boot ($REPACK/ota/boot)"
|
||||
cp -a $OUT/boot $REPACK/ota/boot
|
||||
|
||||
if [ ! -e $REPACK/ota/boot/initrd.gz ] ; then
|
||||
echo "Copying: $OUT/ramdisk.img ($REPACK/ota/boot/initrd.gz)"
|
||||
cp -a $OUT/ramdisk.img $REPACK/ota/boot/initrd.gz
|
||||
fi
|
||||
|
||||
+46
-9
@@ -18,8 +18,10 @@ DEVICE=leo
|
||||
MANUFACTURER=htc
|
||||
|
||||
mkdir -p ../../../vendor/$MANUFACTURER/$DEVICE
|
||||
OUTDIR=vendor/$MANUFACTURER/$DEVICE
|
||||
MAKEFILE=../../../$OUTDIR/$DEVICE-vendor-blobs.mk
|
||||
|
||||
(cat << EOF) | sed s/__DEVICE__/$DEVICE/g | sed s/__MANUFACTURER__/$MANUFACTURER/g > ../../../vendor/$MANUFACTURER/$DEVICE/$DEVICE-vendor.mk
|
||||
(cat << EOF) > $MAKEFILE
|
||||
# Copyright (C) 2010 The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -34,7 +36,42 @@ mkdir -p ../../../vendor/$MANUFACTURER/$DEVICE
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# This file is generated by device/__MANUFACTURER__/__DEVICE__/setup-makefiles.sh
|
||||
# This file is generated by device/$MANUFACTURER/$DEVICE/setup-makefiles.sh - DO NOT EDIT
|
||||
|
||||
# Prebuilt libraries that are needed to build open-source libraries
|
||||
PRODUCT_COPY_FILES := \\
|
||||
$OUTDIR/proprietary/lib/libcamera.so:obj/lib/libcamera.so
|
||||
|
||||
# All the blobs necessary for leo
|
||||
PRODUCT_COPY_FILES += \\
|
||||
EOF
|
||||
|
||||
LINEEND=" \\"
|
||||
COUNT=`cat proprietary-files.txt | grep -v ^# | grep -v ^$ | wc -l | awk {'print $1'}`
|
||||
for FILE in `cat proprietary-files.txt | grep -v ^# | grep -v ^$`; do
|
||||
COUNT=`expr $COUNT - 1`
|
||||
if [ $COUNT = "0" ]; then
|
||||
LINEEND=""
|
||||
fi
|
||||
echo " $OUTDIR/proprietary/$FILE:system/$FILE$LINEEND" >> $MAKEFILE
|
||||
done
|
||||
|
||||
(cat << EOF) > ../../../$OUTDIR/$DEVICE-vendor.mk
|
||||
# Copyright (C) 2010 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.
|
||||
|
||||
# This file is generated by device/$MANUFACTURER/$DEVICE/setup-makefiles.sh
|
||||
|
||||
# Live wallpaper packages
|
||||
PRODUCT_PACKAGES := \\
|
||||
@@ -49,12 +86,12 @@ PRODUCT_COPY_FILES := \\
|
||||
packages/wallpapers/LivePicker/android.software.live_wallpaper.xml:/system/etc/permissions/android.software.live_wallpaper.xml
|
||||
|
||||
# Pick up overlay for features that depend on non-open-source files
|
||||
DEVICE_PACKAGE_OVERLAYS := vendor/__MANUFACTURER__/__DEVICE__/overlay
|
||||
DEVICE_PACKAGE_OVERLAYS := $OUTDIR/overlay
|
||||
|
||||
\$(call inherit-product, vendor/__MANUFACTURER__/__DEVICE__/device-vendor-blobs.mk)
|
||||
\$(call inherit-product, $OUTDIR/$DEVICE-vendor-blobs.mk)
|
||||
EOF
|
||||
|
||||
(cat << EOF) | sed s/__DEVICE__/$DEVICE/g | sed s/__MANUFACTURER__/$MANUFACTURER/g > ../../../vendor/$MANUFACTURER/$DEVICE/BoardConfigVendor.mk
|
||||
(cat << EOF) > ../../../$OUTDIR/BoardConfigVendor.mk
|
||||
# Copyright (C) 2010 The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -69,13 +106,13 @@ EOF
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# This file is generated by device/__MANUFACTURER__/__DEVICE__/setup-makefiles.sh
|
||||
# This file is generated by device/$MANUFACTURER/$DEVICE/setup-makefiles.sh
|
||||
|
||||
USE_CAMERA_STUB := false
|
||||
EOF
|
||||
|
||||
mkdir -p ../../../vendor/$MANUFACTURER/$DEVICE/overlay/packages/apps/Launcher2/res/layout
|
||||
(cat << EOF) | sed s/__DEVICE__/$DEVICE/g | sed s/__MANUFACTURER__/$MANUFACTURER/g > ../../../vendor/$MANUFACTURER/$DEVICE/overlay/packages/apps/Launcher2/res/layout/all_apps.xml
|
||||
mkdir -p ../../../$OUTDIR/overlay/packages/apps/Launcher2/res/layout
|
||||
(cat << EOF) > ../../../$OUTDIR/overlay/packages/apps/Launcher2/res/layout/all_apps.xml
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2010 The Android Open Source Project
|
||||
|
||||
@@ -92,7 +129,7 @@ mkdir -p ../../../vendor/$MANUFACTURER/$DEVICE/overlay/packages/apps/Launcher2/r
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!-- This file is generated by device/__MANUFACTURER__/__DEVICE__/setup-makefiles.sh -->
|
||||
<!-- This file is generated by device/$MANUFACTURER/$DEVICE/setup-makefiles.sh -->
|
||||
|
||||
<!-- switch to all_apps_3d on devices that support RenderScript -->
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
#
|
||||
# system.prop for leo
|
||||
#
|
||||
|
||||
# RIL specific configuration
|
||||
rild.libpath=/system/lib/libhtc_ril_wrapper.so
|
||||
rild.libargs=-d /dev/smd0 nand_init rmnet_mode
|
||||
ro.ril.ecc.HTC-ELL=92,93,94
|
||||
ro.ril.ecc.HTC-WWE=999
|
||||
ro.ril.enable.a52.HTC-ITA=1
|
||||
ro.ril.enable.a53.HTC-ITA=1
|
||||
ro.ril.enable.a52=0
|
||||
ro.ril.enable.a53=1
|
||||
ro.ril.enable.dtm=1
|
||||
ro.ril.gprsclass=12
|
||||
ro.ril.hsdpa.category=8
|
||||
ro.ril.hsupa.category=5
|
||||
ro.ril.hsxpa=2
|
||||
ro.ril.enable.prl.recognition=1
|
||||
|
||||
# Time between scans in seconds. Keep it high to minimize battery drain.
|
||||
# This only affects the case in which there are remembered access points,
|
||||
# but none are in range.
|
||||
wifi.interface=eth0
|
||||
wifi.supplicant_scan_interval=120
|
||||
|
||||
# Default network type.
|
||||
# 0 => WCDMA preferred.
|
||||
ro.telephony.default_network=0
|
||||
|
||||
# density in DPI of the LCD of this board. This is used to scale the UI
|
||||
# appropriately. If this property is not defined, the default value is 240 dpi.
|
||||
ro.sf.lcd_density=240
|
||||
|
||||
# All the interfaces which can use data on
|
||||
mobiledata.interfaces=rmnet0,rmnet1,rmnet2,ppp0
|
||||
|
||||
# This is a high density device with more memory, so larger vm heaps for it.
|
||||
dalvik.vm.heapsize=32m
|
||||
|
||||
# leo have huge 250Mb unwritable system and small 50Mb cache .
|
||||
dalvik.vm.dexopt-data-only=1
|
||||
|
||||
# The OpenGL ES API level that is natively supported by this device.
|
||||
# This is a 16.16 fixed point number
|
||||
ro.opengles.version=131072
|
||||
|
||||
ro.media.dec.jpeg.memcap=20000000
|
||||
|
||||
+11
-66
@@ -15,73 +15,18 @@
|
||||
# limitations under the License.
|
||||
|
||||
DEVICE=leo
|
||||
MANUFACTURER=htc
|
||||
|
||||
mkdir -p ../../../vendor/htc/$DEVICE/proprietary
|
||||
unzip -j -o ../../../${DEVICE}_update.zip system/bin/akmd system/bin/mm-venc-omx-test system/bin/parse_radio_log system/etc/01_qcomm_omx.cfg system/etc/AudioBTID.csv system/etc/firmware/bcm4329.hcd system/etc/firmware/default.acdb system/etc/firmware/default_nel.acdb system/etc/firmware/default_france.acdb system/etc/firmware/fw_bcm4329_apsta.bin system/etc/firmware/fw_bcm4329.bin system/etc/firmware/yamato_pfp.fw system/etc/firmware/yamato_pm4.fw system/lib/egl/libEGL_adreno200.so system/lib/egl/libGLESv1_CM_adreno200.so system/lib/egl/libGLESv2_adreno200.so system/lib/egl/libq3dtools_adreno200.so system/lib/libcamera.so system/lib/libgps.so system/lib/libgsl.so system/lib/libhtc_acoustic.so system/lib/libhtc_ril.so system/lib/liblvmxipc.so system/lib/liboemcamera.so system/lib/libOmxVdec.so system/lib/libomx_wmadec_sharedlibrary.so system/lib/libomx_wmvdec_sharedlibrary.so system/lib/libpvasfcommon.so system/lib/libpvasflocalpbreg.so system/lib/libpvasflocalpb.so system/etc/pvasflocal.cfg -d ../../../vendor/htc/$DEVICE/proprietary
|
||||
chmod 755 ../../../vendor/htc/$DEVICE/proprietary/akmd
|
||||
chmod 755 ../../../vendor/htc/$DEVICE/proprietary/mm-venc-omx-test
|
||||
chmod 755 ../../../vendor/htc/$DEVICE/proprietary/parse_radio_log
|
||||
OUTDIR=../../../vendor/$MANUFACTURER/$DEVICE
|
||||
BASE=$OUTDIR/proprietary
|
||||
rm -rf $BASE/*
|
||||
|
||||
(cat << EOF) | sed s/__DEVICE__/$DEVICE/g > ../../../vendor/htc/$DEVICE/$DEVICE-vendor-blobs.mk
|
||||
# Copyright (C) 2010 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.
|
||||
|
||||
# This file is generated by device/htc/__DEVICE__/extract-files.sh
|
||||
|
||||
# Prebuilt libraries that are needed to build open-source libraries
|
||||
PRODUCT_COPY_FILES := \\
|
||||
vendor/htc/__DEVICE__/proprietary/libgps.so:obj/lib/libgps.so \\
|
||||
vendor/htc/__DEVICE__/proprietary/libcamera.so:obj/lib/libcamera.so
|
||||
|
||||
# All the blobs necessary for leo
|
||||
PRODUCT_COPY_FILES += \\
|
||||
vendor/htc/__DEVICE__/proprietary/akmd:/system/bin/akmd \\
|
||||
vendor/htc/__DEVICE__/proprietary/mm-venc-omx-test:/system/bin/mm-venc-omx-test \\
|
||||
vendor/htc/__DEVICE__/proprietary/parse_radio_log:/system/bin/parse_radio_log \\
|
||||
vendor/htc/__DEVICE__/proprietary/01_qcomm_omx.cfg:/system/etc/01_qcomm_omx.cfg \\
|
||||
vendor/htc/__DEVICE__/proprietary/AudioBTID.csv:/system/etc/AudioBTID.csv \\
|
||||
vendor/htc/__DEVICE__/proprietary/bcm4329.hcd:/system/etc/firmware/bcm4329.hcd \\
|
||||
vendor/htc/__DEVICE__/proprietary/default.acdb:/system/etc/firmware/default.acdb \\
|
||||
vendor/htc/__DEVICE__/proprietary/default_france.acdb:/system/etc/firmware/default_france.acdb \\
|
||||
vendor/htc/__DEVICE__/proprietary/default_nel.acdb:/system/etc/firmware/default_nel.acdb \\
|
||||
vendor/htc/__DEVICE__/proprietary/fw_bcm4329_apsta.bin:/system/etc/firmware/fw_bcm4329_apsta.bin \\
|
||||
vendor/htc/__DEVICE__/proprietary/fw_bcm4329.bin:/system/etc/firmware/fw_bcm4329.bin \\
|
||||
vendor/htc/__DEVICE__/proprietary/yamato_pfp.fw:/system/etc/firmware/yamato_pfp.fw \\
|
||||
vendor/htc/__DEVICE__/proprietary/yamato_pm4.fw:/system/etc/firmware/yamato_pm4.fw \\
|
||||
vendor/htc/__DEVICE__/proprietary/libEGL_adreno200.so:/system/lib/egl/libEGL_adreno200.so \\
|
||||
vendor/htc/__DEVICE__/proprietary/libGLESv1_CM_adreno200.so:/system/lib/egl/libGLESv1_CM_adreno200.so \\
|
||||
vendor/htc/__DEVICE__/proprietary/libGLESv2_adreno200.so:/system/lib/egl/libGLESv2_adreno200.so \\
|
||||
vendor/htc/__DEVICE__/proprietary/libq3dtools_adreno200.so:/system/lib/egl/libq3dtools_adreno200.so \\
|
||||
vendor/htc/__DEVICE__/proprietary/libcamera.so:/system/lib/libcamera.so \\
|
||||
vendor/htc/__DEVICE__/proprietary/libgps.so:/system/lib/libgps.so \\
|
||||
vendor/htc/__DEVICE__/proprietary/libgsl.so:/system/lib/libgsl.so \\
|
||||
vendor/htc/__DEVICE__/proprietary/libhtc_acoustic.so:/system/lib/libhtc_acoustic.so \\
|
||||
vendor/htc/__DEVICE__/proprietary/libhtc_ril.so:/system/lib/libhtc_ril.so \\
|
||||
vendor/htc/__DEVICE__/proprietary/liblvmxipc.so:/system/lib/liblvmxipc.so \\
|
||||
vendor/htc/__DEVICE__/proprietary/liboemcamera.so:/system/lib/liboemcamera.so \\
|
||||
vendor/htc/__DEVICE__/proprietary/libOmxVdec.so:/system/lib/libOmxVdec.so
|
||||
|
||||
ifdef WITH_WINDOWS_MEDIA
|
||||
PRODUCT_COPY_FILES += \\
|
||||
vendor/htc/__DEVICE__/proprietary/libomx_wmadec_sharedlibrary.so:system/lib/libomx_wmadec_sharedlibrary.so \\
|
||||
vendor/htc/__DEVICE__/proprietary/libomx_wmvdec_sharedlibrary.so:system/lib/libomx_wmvdec_sharedlibrary.so \\
|
||||
vendor/htc/__DEVICE__/proprietary/libpvasfcommon.so:system/lib/libpvasfcommon.so \\
|
||||
vendor/htc/__DEVICE__/proprietary/libpvasflocalpbreg.so:system/lib/libpvasflocalpbreg.so \\
|
||||
vendor/htc/__DEVICE__/proprietary/libpvasflocalpb.so:system/lib/libpvasflocalpb.so \\
|
||||
vendor/htc/__DEVICE__/proprietary/pvasflocal.cfg:system/etc/pvasflocal.cfg
|
||||
endif
|
||||
|
||||
EOF
|
||||
for FILE in `cat proprietary-files.txt | grep -v ^# | grep -v ^$`; do
|
||||
DIR=`dirname $FILE`
|
||||
if [ ! -d $BASE/$DIR ]; then
|
||||
mkdir -p $BASE/$DIR
|
||||
fi
|
||||
unzip -j -o ../../../${DEVICE}_update.zip system/$FILE -d $BASE/$DIR
|
||||
done
|
||||
|
||||
./setup-makefiles.sh
|
||||
|
||||
Reference in New Issue
Block a user