├── Android.mk
├── AndroidProducts.mk
├── BoardConfig.mk
├── CleanSpec.mk
├── audio_hal
├── Android.mk
├── Omap4ALSAManager.cpp
├── Omap4ALSAManager.h
├── alsa_omap3.cpp
├── alsa_omap3_modem.cpp
├── alsa_omap3_modem.h
├── alsa_omap4.cpp
├── alsa_omap4.h
├── alsa_omap4_modem.cpp
├── alsa_omap4_modem.h
└── audio_modem_interface.h
├── bluetooth
└── bdroid_buildcfg.h
├── clear_bootcnt.sh
├── cm.dependencies
├── cm.mk
├── egl.cfg
├── encore.mk
├── etc
├── audio_policy.conf
├── media_codecs.xml
├── media_profiles.xml
└── powervr.ini
├── extract-files.sh
├── firmware
└── TIInit_7.2.31.bts
├── fstab.encore
├── full_encore.mk
├── include
└── linux
│ ├── hal_public.h
│ ├── ion.h
│ └── omap_ion.h
├── init.encore.rc
├── init.encore.usb.rc
├── liblights
├── Android.mk
└── lights.c
├── libsensors
├── Android.mk
├── InputEventReader.cpp
├── InputEventReader.h
├── Kxtf9.cpp
├── Kxtf9.h
├── MODULE_LICENSE_APACHE2
├── NOTICE
├── SensorBase.cpp
├── SensorBase.h
├── nusensors.cpp
├── nusensors.h
└── sensors.c
├── log_battery_data.sh
├── overlay
├── frameworks
│ └── base
│ │ ├── core
│ │ └── res
│ │ │ └── res
│ │ │ ├── values-sw600dp-land
│ │ │ └── arrays.xml
│ │ │ ├── values
│ │ │ ├── arrays.xml
│ │ │ └── config.xml
│ │ │ └── xml
│ │ │ ├── eri.xml
│ │ │ ├── power_profile.xml
│ │ │ └── storage_list.xml
│ │ └── packages
│ │ └── SystemUI
│ │ └── res
│ │ └── values
│ │ └── config.xml
└── packages
│ └── apps
│ ├── Settings
│ └── res
│ │ └── values
│ │ └── config.xml
│ └── Trebuchet
│ └── res
│ └── values
│ └── config.xml
├── power
├── Android.mk
└── power.c
├── prebuilt
├── alsa
│ ├── alsa.omap3.so
│ ├── conf
│ │ ├── alsa.conf
│ │ ├── cards
│ │ │ └── aliases.conf
│ │ └── pcm
│ │ │ ├── center_lfe.conf
│ │ │ ├── default.conf
│ │ │ ├── dmix.conf
│ │ │ ├── dpl.conf
│ │ │ ├── dsnoop.conf
│ │ │ ├── front.conf
│ │ │ ├── iec958.conf
│ │ │ ├── modem.conf
│ │ │ ├── rear.conf
│ │ │ ├── side.conf
│ │ │ ├── surround40.conf
│ │ │ ├── surround41.conf
│ │ │ ├── surround50.conf
│ │ │ ├── surround51.conf
│ │ │ └── surround71.conf
│ ├── libasound.so
│ └── libaudio.so
├── boot
│ ├── MLO
│ └── u-boot.bin
├── bootanimation.zip
├── poetry
│ └── poem.txt
└── usr
│ ├── idc
│ ├── cyttsp-i2c.idc
│ └── ft5x06-i2c.idc
│ └── keylayout
│ └── gpio-keys.kl
├── proprietary-files.txt
├── ramdisk_tools.sh
├── recovery.fstab
├── recovery
├── postrecoveryboot.sh
└── recovery_ui.c
├── releasetools
├── encore_common.py
├── encore_edify_generator.py
├── encore_img_from_target_files
└── encore_ota_from_target_files
├── setup-makefiles.sh
├── system.prop
├── uboot-bootimg.mk
├── ueventd.encore.rc
├── unzip-files.sh
├── vendorsetup.sh
└── wlan-nvs-tools
├── Android.mk
└── store-mac-addr.sh
/Android.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2011 The Android Open Source Project
3 | # Copyright (C) 2012 The CyanogenMod Project
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 | #
17 |
18 | # WARNING: Everything listed here will be built on ALL platforms,
19 | # including x86, the emulator, and the SDK. Modules must be uniquely
20 | # named (liblights.encore), and must build everywhere, or limit themselves
21 | # to only building on ARM if they include assembly. Individual makefiles
22 | # are responsible for having their own logic, for fine-grained control.
23 |
24 | LOCAL_PATH := $(call my-dir)
25 |
26 | # if some modules are built directly from this directory (not subdirectories),
27 | # their rules should be written here.
28 |
29 | ifneq ($(filter encore,$(TARGET_DEVICE)),)
30 |
31 | ifneq ($(TARGET_SIMULATOR),true)
32 | include $(call all-makefiles-under,$(LOCAL_PATH))
33 | endif
34 |
35 | endif
36 |
--------------------------------------------------------------------------------
/AndroidProducts.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2008 The Android Open Source Project
3 | # Copyright (C) 2012 The CyanogenMod Project
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 | #
17 |
18 | #
19 | # This file should set PRODUCT_MAKEFILES to a list of product makefiles
20 | # to expose to the build system. LOCAL_DIR will already be set to
21 | # the directory containing this file.
22 | #
23 | # This file may not rely on the value of any variable other than
24 | # LOCAL_DIR; do not use any conditionals, and do not look up the
25 | # value of any variable that isn't set in this file or in a file that
26 | # it includes.
27 | #
28 |
29 | PRODUCT_MAKEFILES := \
30 | $(LOCAL_DIR)/full_encore.mk
31 |
--------------------------------------------------------------------------------
/BoardConfig.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2007 The Android Open Source Project
3 | # Copyright (C) 2012 The Cyanogenmod Project
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | # BoardConfig.mk
18 | #
19 | # Product-specific compile-time definitions.
20 | #
21 |
22 | BUILD_NETD := false
23 |
24 | # inherit from the proprietary version
25 | -include vendor/bn/encore/BoardConfigVendor.mk
26 |
27 | TARGET_ARCH := arm
28 | TARGET_BOARD_PLATFORM := omap3
29 | TARGET_CPU_ABI := armeabi-v7a
30 | ARCH_ARM_HAVE_ARMV7A := true
31 | TARGET_CPU_ABI2 := armeabi
32 | TARGET_ARCH_VARIANT := armv7-a-neon
33 | TARGET_CPU_VARIANT := cortex-a8
34 | TARGET_GLOBAL_CFLAGS += -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
35 | # -fmodulo-sched -fmodulo-sched-allow-regmoves
36 | TARGET_GLOBAL_CPPFLAGS += -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
37 | # -fmodulo-sched -fmodulo-sched-allow-regmoves
38 | TARGET_arm_CFLAGS := -O3 -fomit-frame-pointer -fstrict-aliasing -funswitch-loops \
39 | -fmodulo-sched -fmodulo-sched-allow-regmoves
40 | TARGET_thumb_CFLAGS := -mthumb \
41 | -Os \
42 | -fomit-frame-pointer \
43 | -fstrict-aliasing
44 | TARGET_BOOTLOADER_BOARD_NAME := encore
45 | TARGET_PROVIDES_INIT_TARGET_RC := true
46 | TARGET_USERIMAGES_USE_EXT4 := true
47 | TARGET_OMAP3 := true
48 | OMAP_ENHANCEMENT := true
49 |
50 | ifdef OMAP_ENHANCEMENT
51 | COMMON_GLOBAL_CFLAGS += -DOMAP_ENHANCEMENT -DTARGET_OMAP3 -DOMAP_ENHANCEMENT_CPCAM -DOMAP_ENHANCEMENT_VTC
52 | endif
53 |
54 | # Conserve memory in the Dalvik heap
55 | # Details: https://github.com/CyanogenMod/android_dalvik/commit/15726c81059b74bf2352db29a3decfc4ea9c1428
56 | TARGET_ARCH_LOWMEM := true
57 |
58 | # for frameworks/native/libs/gui
59 | # disable use of EGL_KHR_fence_sync extension, since it slows things down
60 | COMMON_GLOBAL_CFLAGS += -DDONT_USE_FENCE_SYNC
61 |
62 | # for frameworks/native/services/surfaceflinger
63 | # use EGL_IMG_context_priority extension, which helps performance
64 | COMMON_GLOBAL_CFLAGS += -DHAS_CONTEXT_PRIORITY
65 |
66 | TARGET_SPECIFIC_HEADER_PATH := device/bn/encore/include
67 |
68 | # Makefile variables and C/C++ macros to recognise current pastry
69 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 16 || echo 1),)
70 | ANDROID_API_JB_OR_LATER := true
71 | COMMON_GLOBAL_CFLAGS += -DANDROID_API_JB_OR_LATER
72 | endif
73 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 14 || echo 1),)
74 | ANDROID_API_ICS_OR_LATER := true
75 | COMMON_GLOBAL_CFLAGS += -DANDROID_API_ICS_OR_LATER
76 | endif
77 |
78 |
79 | BOARD_CUSTOM_BOOTIMG_MK := device/bn/encore/uboot-bootimg.mk
80 | TARGET_RELEASETOOL_IMG_FROM_TARGET_SCRIPT := ./device/bn/encore/releasetools/encore_img_from_target_files
81 | TARGET_RELEASETOOL_OTA_FROM_TARGET_SCRIPT := ./device/bn/encore/releasetools/encore_ota_from_target_files
82 | # Include a 2ndbootloader
83 | TARGET_BOOTLOADER_IS_2ND := true
84 |
85 | BOARD_KERNEL_CMDLINE := no_console_suspend=1 msmsdcc_sdioirq=1 wire.search_count=5
86 | BOARD_KERNEL_BASE := 0x20000000
87 | BOARD_PAGE_SIZE := 0x00000800
88 |
89 | TARGET_USERIMAGES_USE_EXT4 := true
90 | BOARD_SYSTEMIMAGE_PARTITION_SIZE := 461942784
91 | BOARD_USERDATAIMAGE_PARTITION_SIZE := 987648000
92 | BOARD_FLASH_BLOCK_SIZE := 4096
93 | BOARD_USES_UBOOT := true
94 |
95 | # Inline kernel building config
96 | TARGET_KERNEL_CONFIG := encore_cm10.1_defconfig
97 | TARGET_KERNEL_SOURCE := kernel/bn/encore
98 |
99 | # Connectivity - Wi-Fi
100 | USES_TI_MAC80211 := true
101 | ifdef USES_TI_MAC80211
102 | BOARD_WPA_SUPPLICANT_DRIVER := NL80211
103 | WPA_SUPPLICANT_VERSION := VER_0_8_X
104 | BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_wl12xx
105 | BOARD_WLAN_DEVICE := wl12xx_mac80211
106 | BOARD_SOFTAP_DEVICE := wl12xx_mac80211
107 | WIFI_DRIVER_MODULE_PATH := "/system/lib/modules/wl12xx_sdio.ko"
108 | WIFI_DRIVER_MODULE_NAME := "wl12xx_sdio"
109 | WIFI_FIRMWARE_LOADER := ""
110 | COMMON_GLOBAL_CFLAGS += -DUSES_TI_MAC80211
111 | endif
112 |
113 | TARGET_MODULES_SOURCE := "hardware/ti/wlan/mac80211/compat_wl12xx"
114 |
115 | wifi_modules:
116 | make -C $(TARGET_MODULES_SOURCE) KERNEL_DIR=$(KERNEL_OUT) KLIB=$(KERNEL_OUT) KLIB_BUILD=$(KERNEL_OUT) ARCH=$(TARGET_ARCH) $(ARM_CROSS_COMPILE)
117 | mv $(KERNEL_OUT)/lib/crc7.ko $(KERNEL_MODULES_OUT)
118 | mv hardware/ti/wlan/mac80211/compat_wl12xx/compat/compat.ko $(KERNEL_MODULES_OUT)
119 | mv hardware/ti/wlan/mac80211/compat_wl12xx/net/mac80211/mac80211.ko $(KERNEL_MODULES_OUT)
120 | mv hardware/ti/wlan/mac80211/compat_wl12xx/net/wireless/cfg80211.ko $(KERNEL_MODULES_OUT)
121 | mv hardware/ti/wlan/mac80211/compat_wl12xx/drivers/net/wireless/wl12xx/wl12xx.ko $(KERNEL_MODULES_OUT)
122 | mv hardware/ti/wlan/mac80211/compat_wl12xx/drivers/net/wireless/wl12xx/wl12xx_sdio.ko $(KERNEL_MODULES_OUT)
123 | $(ARM_EABI_TOOLCHAIN)/arm-eabi-strip --strip-debug $(KERNEL_MODULES_OUT)/crc7.ko $(KERNEL_MODULES_OUT)/compat.ko $(KERNEL_MODULES_OUT)/mac80211.ko $(KERNEL_MODULES_OUT)/cfg80211.ko $(KERNEL_MODULES_OUT)/wl12xx.ko $(KERNEL_MODULES_OUT)/wl12xx_sdio.ko
124 |
125 | TARGET_KERNEL_MODULES := wifi_modules
126 |
127 | BOARD_HAS_LARGE_FILESYSTEM := true
128 | BOARD_RECOVERY_IGNORE_BOOTABLES := true
129 | BOARD_CUSTOM_RECOVERY_KEYMAPPING := ../../device/bn/encore/recovery/recovery_ui.c
130 | TARGET_RECOVERY_PRE_COMMAND := "dd if=/dev/zero of=/rom/bcb bs=64 count=1 > /dev/null 2>&1 ; echo 'recovery' >> /rom/bcb ; sync"
131 | TARGET_RECOVERY_FSTAB := device/bn/encore/fstab.encore
132 | RECOVERY_FSTAB_VERSION := 2
133 |
134 | # Modem
135 | TARGET_NO_RADIOIMAGE := true
136 |
137 | # HW Graphics (EGL fixes + webkit fix)
138 | USE_OPENGL_RENDERER := true
139 | BOARD_EGL_CFG := device/bn/encore/egl.cfg
140 | ENABLE_WEBGL := true
141 |
142 | # Storage
143 | BOARD_HAS_SDCARD_INTERNAL := true
144 | BOARD_SDCARD_DEVICE_PRIMARY := /dev/block/mmcblk1p1
145 | BOARD_SDCARD_DEVICE_SECONDARY := /dev/block/mmcblk0p8
146 | BOARD_SDCARD_DEVICE_INTERNAL := /dev/block/mmcblk0p8
147 | BOARD_VOLD_MAX_PARTITIONS := 8
148 | BOARD_VOLD_EMMC_SHARES_DEV_MAJOR := true
149 | TARGET_USE_CUSTOM_LUN_FILE_PATH := "/sys/class/android_usb/android0/f_mass_storage/lun%d/file"
150 |
151 | # Bluetooth
152 | BOARD_HAVE_BLUETOOTH := true
153 | BOARD_WPAN_DEVICE := true
154 | BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/bn/encore/bluetooth
155 |
156 | BOARD_HAVE_FAKE_GPS := true
157 |
158 | # MultiMedia defines
159 | USE_CAMERA_STUB := true
160 | BOARD_USES_TI_OMAP_MODEM_AUDIO := false
161 | BOARD_HAS_NO_MISC_PARTITION := true
162 |
163 | # Audio
164 | # BOARD_USES_AUDIO_LEGACY := true
165 | # TARGET_PROVIDES_LIBAUDIO := true
166 | # BOARD_USES_GENERIC_AUDIO := false
167 | # BOARD_USES_ALSA_AUDIO := true
168 | BUILD_WITH_ALSA_UTILS := true
169 |
170 | # If you'd like to build the audio components from source instead of using
171 | # the prebuilts, uncomment BOARD_USES_ALSA_AUDIO := true above and add the
172 | # following repositories to your manifest:
173 | #
174 | #
175 | #
176 | #
177 | # Also see encore.mk for further instructions.
178 |
179 | HARDWARE_OMX := true
180 |
181 | ifdef HARDWARE_OMX
182 | OMX_JPEG := true
183 | OMX_VENDOR := ti
184 | TARGET_USE_OMX_RECOVERY := true
185 | TARGET_USE_OMAP_COMPAT := true
186 | BUILD_WITH_TI_AUDIO := 1
187 | BUILD_PV_VIDEO_ENCODERS := 1
188 | OMX_VENDOR_INCLUDES := \
189 | hardware/ti/omap3/omx/system/src/openmax_il/omx_core/inc \
190 | hardware/ti/omap3/omx/image/src/openmax_il/jpeg_enc/inc
191 | OMX_VENDOR_WRAPPER := TI_OMX_Wrapper
192 | BOARD_OPENCORE_LIBRARIES := libOMX_Core
193 | BOARD_OPENCORE_FLAGS := -DHARDWARE_OMX=1
194 | #BOARD_CAMERA_LIBRARIES := libcamera
195 | endif
196 |
197 |
198 | BOARD_USES_SECURE_SERVICES := true
199 | # Boot animation
200 | TARGET_SCREEN_HEIGHT := 1024
201 | TARGET_SCREEN_WIDTH := 600
202 | TARGET_BOOTANIMATION_PRELOAD := true
203 | TARGET_BOOTANIMATION_TEXTURE_CACHE := true
204 |
205 | #adb has root
206 | ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0
207 |
208 | #Config for building TWRP
209 | DEVICE_RESOLUTION := 1024x600
210 | RECOVERY_TOUCHSCREEN_SWAP_XY := true
211 | RECOVERY_TOUCHSCREEN_FLIP_Y := true
212 | TW_NO_REBOOT_BOOTLOADER := true
213 | TW_NO_REBOOT_RECOVERY := true
214 | TW_INTERNAL_STORAGE_PATH := "/emmc"
215 | TW_INTERNAL_STORAGE_MOUNT_POINT := "emmc"
216 | TW_EXTERNAL_STORAGE_PATH := "/sdc"
217 | TW_EXTERNAL_STORAGE_MOUNT_POINT := "sdc"
218 |
--------------------------------------------------------------------------------
/CleanSpec.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2007 The Android Open Source Project
3 | # Copyright (C) 2012 The CyanogenMod Project
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 | #
17 |
18 | # If you don't need to do a full clean build but would like to touch
19 | # a file or delete some intermediate files, add a clean step to the end
20 | # of the list. These steps will only be run once, if they haven't been
21 | # run before.
22 | #
23 | # E.g.:
24 | # $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
25 | # $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
26 | #
27 | # Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
28 | # files that are missing or have been moved.
29 | #
30 | # Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
31 | # Use $(OUT_DIR) to refer to the "out" directory.
32 | #
33 | # If you need to re-do something that's already mentioned, just copy
34 | # the command and add it to the bottom of the list. E.g., if a change
35 | # that you made last week required touching a file and a change you
36 | # made today requires touching the same file, just copy the old
37 | # touch step and add it to the end of the list.
38 | #
39 | # ************************************************
40 | # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
41 | # ************************************************
42 |
43 | # For example:
44 | #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
45 | #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
46 | #$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
47 | #$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
48 |
49 | # ************************************************
50 | # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
51 | # ************************************************
52 | $(call add-clean-step, rm -f $(PRODUCT_OUT)/system/build.prop)
53 | $(call add-clean-step, rm -f $(PRODUCT_OUT)/system/build.prop)
54 |
55 |
--------------------------------------------------------------------------------
/audio_hal/Android.mk:
--------------------------------------------------------------------------------
1 | # hardware/ti/omap3/modules/alsa/Android.mk
2 | #
3 | # Copyright 2009-2010 Texas Instruments
4 | #
5 |
6 | # This is the OMAP3 ALSA module for OMAP3
7 | ifeq ($(strip $(TARGET_BOOTLOADER_BOARD_NAME)),encore)
8 | ifeq ($(strip $(BOARD_USES_ALSA_AUDIO)),true)
9 | LOCAL_PATH := $(call my-dir)
10 |
11 | include $(CLEAR_VARS)
12 |
13 | LOCAL_PRELINK_MODULE := false
14 |
15 | LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
16 |
17 | LOCAL_CFLAGS := -D_POSIX_SOURCE -Wno-multichar
18 | ifeq ($(strip $(BOARD_USES_TI_OMAP_MODEM_AUDIO)),true)
19 | LOCAL_CFLAGS += -DAUDIO_MODEM_TI
20 | endif
21 | ifeq ($(BOARD_HAVE_BLUETOOTH),true)
22 | LOCAL_CFLAGS += -DAUDIO_BLUETOOTH
23 | endif
24 |
25 | LOCAL_C_INCLUDES += hardware/alsa_sound external/alsa-lib/include
26 | ifeq ($(strip $(BOARD_USES_TI_OMAP_MODEM_AUDIO)),true)
27 | LOCAL_C_INCLUDES += hardware/ti/omap3/modules/alsa
28 | ifeq ($(BOARD_HAVE_BLUETOOTH),true)
29 | LOCAL_C_INCLUDES += $(call include-path-for, bluez-libs) \
30 | external/bluetooth/bluez/include
31 | endif
32 | endif
33 |
34 | ifeq ($(strip $(TARGET_BOARD_PLATFORM)), omap3)
35 | LOCAL_SRC_FILES:= alsa_omap3.cpp
36 | ifeq ($(strip $(BOARD_USES_TI_OMAP_MODEM_AUDIO)),true)
37 | LOCAL_SRC_FILES += alsa_omap3_modem.cpp
38 | endif
39 | endif
40 | ifeq ($(strip $(TARGET_BOARD_PLATFORM)), omap4)
41 | LOCAL_SRC_FILES:= alsa_omap4.cpp \
42 | Omap4ALSAManager.cpp
43 | LOCAL_SHARED_LIBRARIES += libmedia
44 | ifeq ($(strip $(BOARD_USES_TI_OMAP_MODEM_AUDIO)),true)
45 | LOCAL_SRC_FILES += alsa_omap4_modem.cpp
46 | endif
47 | endif
48 |
49 | LOCAL_SHARED_LIBRARIES += \
50 | libaudio \
51 | libasound \
52 | liblog \
53 | libcutils \
54 | libutils \
55 | libdl
56 |
57 | ifeq ($(strip $(BOARD_USES_TI_OMAP_MODEM_AUDIO)),true)
58 | ifeq ($(strip $(BOARD_HAVE_BLUETOOTH)),true)
59 | LOCAL_SHARED_LIBRARIES += \
60 | libbluetooth
61 |
62 | #LOCAL_STATIC_LIBRARIES := \
63 | # libbluez-common-static
64 | endif
65 | endif
66 |
67 | LOCAL_MODULE_TAGS:= optional
68 | LOCAL_MODULE:= alsa.$(TARGET_BOARD_PLATFORM)
69 |
70 | # XXX For some reason, read-only relocations cause the world to blow up
71 | # when loading this module
72 | # No significant benefit to marking relocations RO for this (not a
73 | # security-sensitive component), but it'd be nice to figure out why this
74 | # happens anyway ...
75 | LOCAL_LDFLAGS := -Wl,-z,norelro
76 |
77 | include $(BUILD_SHARED_LIBRARY)
78 |
79 | endif
80 |
81 | # Build the audio.primary HAL which will be used by audioflinger to interface
82 | # with the rest of the ALSA audio stack
83 | # Makefile fragment comes from hardware/cm/audio/Android.mk
84 | # Note that we don't actually need any extra code!
85 | # XXX This really belongs inside the if BOARD_USES_ALSA_AUDIO, but as long as
86 | # libaudio.so is a prebuilt we don't want to enable that option.
87 |
88 | include $(CLEAR_VARS)
89 |
90 | LOCAL_MODULE := audio.primary.$(TARGET_BOOTLOADER_BOARD_NAME)
91 | LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
92 | LOCAL_MODULE_TAGS := optional
93 |
94 | LOCAL_SHARED_LIBRARIES := \
95 | libcutils \
96 | libutils \
97 | libmedia \
98 | libhardware_legacy
99 |
100 | LOCAL_SHARED_LIBRARIES += libdl
101 |
102 | LOCAL_SHARED_LIBRARIES += libaudio
103 |
104 | LOCAL_STATIC_LIBRARIES := \
105 | libmedia_helper
106 |
107 | LOCAL_WHOLE_STATIC_LIBRARIES := \
108 | libaudiohw_legacy
109 |
110 | include $(BUILD_SHARED_LIBRARY)
111 |
112 | endif
113 |
--------------------------------------------------------------------------------
/audio_hal/Omap4ALSAManager.cpp:
--------------------------------------------------------------------------------
1 | /* Omap4ALSAManager.cpp
2 | **
3 | ** Copyright 2011-2012 Texas Instruments
4 | **
5 | ** Licensed under the Apache License, Version 2.0 (the "License");
6 | ** you may not use this file except in compliance with the License.
7 | ** You may obtain a copy of the License at
8 | **
9 | ** http://www.apache.org/licenses/LICENSE-2.0
10 | **
11 | ** Unless required by applicable law or agreed to in writing, software
12 | ** distributed under the License is distributed on an "AS IS" BASIS,
13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | ** See the License for the specific language governing permissions and
15 | ** limitations under the License.
16 | */
17 |
18 | //includes
19 | #define LOG_TAG "Omap4ALSAManager"
20 | #include
21 |
22 | #include "Omap4ALSAManager.h"
23 |
24 | namespace android {
25 |
26 | const char *Omap4ALSAManager::MAIN_MIC = "omap.audio.mic.main";
27 | const char *Omap4ALSAManager::SUB_MIC = "omap.audio.mic.sub";
28 | const char *Omap4ALSAManager::POWER_MODE = "omap.audio.power";
29 |
30 | // Voice record during voice call voice uplink gain
31 | // value: -120dB..29dB step 1dB (-120 is mute)
32 | const char *Omap4ALSAManager::VOICEMEMO_VUL_GAIN =
33 | "omap.audio.voicerecord.vul.gain";
34 | // Voice record during voice call voice downling gain
35 | // value: -120dB..29dB step 1dB (-120 is mute)
36 | const char *Omap4ALSAManager::VOICEMEMO_VDL_GAIN =
37 | "omap.audio.voicerecord.vdl.gain";
38 | // Voice record during voice call multimedia gain
39 | // value: -120dB..29dB step 1dB (-120 is mute)
40 | const char *Omap4ALSAManager::VOICEMEMO_MM_GAIN =
41 | "omap.audio.voicerecord.mm.gain";
42 | // Voice record during voice call tone gain
43 | // value: -120dB..29dB step 1dB (-120 is mute)
44 | const char *Omap4ALSAManager::VOICEMEMO_TONE_GAIN =
45 | "omap.audio.voicerecord.tone.gain";
46 | const char *Omap4ALSAManager::DL2L_EQ_PROFILE = "omap.audio.dl2l.eq";
47 | const char *Omap4ALSAManager::DL2R_EQ_PROFILE = "omap.audio.dl2r.eq";
48 | const char *Omap4ALSAManager::DL1_EQ_PROFILE = "omap.audio.dl1.eq";
49 | const char *Omap4ALSAManager::AMIC_EQ_PROFILE = "omap.audio.amic.eq";
50 | const char *Omap4ALSAManager::DMIC_EQ_PROFILE = "omap.audio.dmic.eq";
51 | const char *Omap4ALSAManager::SDT_EQ_PROFILE = "omap.audio.sdt.eq";
52 |
53 | const char *Omap4ALSAManager::DL1_EAR_MONO_MIXER = "omap.audio.ear.DL1monomixer";
54 | const char *Omap4ALSAManager::DL1_HEAD_MONO_MIXER = "omap.audio.head.DL1monomixer";
55 | const char *Omap4ALSAManager::DL2_SPEAK_MONO_MIXER = "omap.audio.speak.DL2monomixer";
56 | const char *Omap4ALSAManager::DL2_AUX_MONO_MIXER = "omap.audio.aux.DL2monomixer";
57 |
58 | const char *Omap4ALSAManager::MicNameList[]= {
59 | "AMic0", // for Analog Main mic
60 | "AMic1", // for Analog Sub mic
61 | "DMic0L", // for Digital Left mic 0
62 | "DMic1L", // for Digital Left mic 1
63 | "DMic2L", // for Digital Left mic 2
64 | "DMic0R", // for Digital Right mic 0
65 | "DMic1R", // for Digital Right mic 1
66 | "DMic2R", // for Digital Right mic 2
67 | "eof"
68 | };
69 |
70 | const char *Omap4ALSAManager::PowerModeList[] = {
71 | "FIFO", // low latency 4 periods per buffer
72 | "PingPong", // low power ping pong using MM_LP_DEVICE
73 | "eof"
74 | };
75 |
76 | const char *Omap4ALSAManager::EqualizerProfileList[] = {
77 | "Flat response", // all-pass filter not used for AMIC and DMIC
78 | "High-pass 0dB",
79 | "High-pass -12dB",
80 | "High-pass -20dB",
81 | "eof"
82 | };
83 |
84 | status_t Omap4ALSAManager::set(const String8& key, const String8& value)
85 | {
86 | String8 temp = value;
87 | if (validateValueForKey(key, temp) == NO_ERROR) {
88 | ALOGV("set by Value:: %s::%s", key.string(), value.string());
89 | if (mParams.indexOfKey(key) < 0) {
90 | mParams.add(key, value);
91 | return NO_ERROR;
92 | } else {
93 | mParams.replaceValueFor(key, value);
94 | return ALREADY_EXISTS;
95 | }
96 | }
97 | return BAD_VALUE;
98 | }
99 |
100 | status_t Omap4ALSAManager::setFromProperty(const String8& key) {
101 | status_t status = NO_ERROR;
102 | char value[PROPERTY_VALUE_MAX];
103 |
104 | if (property_get(key.string(), value, ""))
105 | {
106 | ALOGV("setFromProperty:: %s::%s", key.string(), value);
107 | String8 temp = String8(value);
108 | if (validateValueForKey(key, temp) == NO_ERROR) {
109 | mParams.add(key, (String8)value);
110 | return NO_ERROR;
111 | }
112 | }
113 | return BAD_VALUE;
114 | }
115 |
116 | status_t Omap4ALSAManager::setFromProperty(const String8& key, const String8& init) {
117 | status_t status = NO_ERROR;
118 | char value[PROPERTY_VALUE_MAX];
119 |
120 | if (property_get(key.string(), value, init.string()))
121 | {
122 | ALOGV("setFromProperty:: %s::%s", key.string(), value);
123 | String8 temp = String8(value);
124 | if (validateValueForKey(key, temp) == NO_ERROR) {
125 | mParams.add(key, (String8)value);
126 | return NO_ERROR;
127 | }
128 | }
129 | return BAD_VALUE;
130 | }
131 |
132 | status_t Omap4ALSAManager::get(const String8& key, String8& value)
133 | {
134 | if (mParams.indexOfKey(key) >= 0) {
135 | value = mParams.valueFor(key);
136 | return NO_ERROR;
137 | } else {
138 | return BAD_VALUE;
139 | }
140 | }
141 |
142 | status_t Omap4ALSAManager::get(const String8& key, int& value)
143 | {
144 | String8 stringValue;
145 | if (mParams.indexOfKey(key) >= 0) {
146 | stringValue = mParams.valueFor(key);
147 | value = atoi((const char *)stringValue);
148 | return NO_ERROR;
149 | } else {
150 | return BAD_VALUE;
151 | }
152 | }
153 |
154 |
155 | status_t Omap4ALSAManager::validateValueForKey(const String8& key, String8& value)
156 | {
157 | int noMatch = 1;
158 | int i = 0;
159 | int gain;
160 |
161 | if (key == (String8)MAIN_MIC) {
162 | ALOGV("validate main mic");
163 |
164 | if ((mParams.indexOfKey((String8)SUB_MIC) >= 0) &&
165 | (value == mParams.valueFor((String8)SUB_MIC))) {
166 | // don't allow same mic for main and sub
167 | return BAD_VALUE;
168 | } else {
169 | while (noMatch && strcmp(MicNameList[i], "eof")) {
170 | noMatch = strcmp(MicNameList[i], value.string());
171 | if (noMatch) i++;
172 | else break;
173 | }
174 | if(noMatch)
175 | return BAD_VALUE;
176 | else
177 | return NO_ERROR;
178 | }
179 | }
180 | else if (key == (String8)SUB_MIC) {
181 | ALOGV("validate SUB mic");
182 | if ((mParams.indexOfKey((String8)MAIN_MIC) >= 0) &&
183 | (value == mParams.valueFor((String8)MAIN_MIC))) {
184 | // don't allow same mic for main and sub
185 | return BAD_VALUE;
186 | } else {
187 | while (noMatch && strcmp(MicNameList[i], "eof")) {
188 | noMatch = strcmp(MicNameList[i], value.string());
189 | if (noMatch) i++;
190 | else break;
191 | }
192 | if(noMatch)
193 | return BAD_VALUE;
194 | else
195 | return NO_ERROR;
196 | }
197 | }
198 | else if (key == (String8)POWER_MODE) {
199 | ALOGV("validate power mode");
200 | while (noMatch && strcmp(PowerModeList[i], "eof")) {
201 | noMatch = strcmp(PowerModeList[i], value.string());
202 | if (noMatch) i++;
203 | else break;
204 | }
205 | if(noMatch)
206 | return BAD_VALUE;
207 | else
208 | return NO_ERROR;
209 | }
210 | else if ((key == (String8)DL2L_EQ_PROFILE) ||
211 | (key == (String8)DL2R_EQ_PROFILE) ||
212 | (key == (String8)DL1_EQ_PROFILE) ||
213 | (key == (String8)SDT_EQ_PROFILE)) {
214 | ALOGV("validate equalizer profile");
215 | while (noMatch && strcmp(EqualizerProfileList[i], "eof")) {
216 | noMatch = strcmp(EqualizerProfileList[i], value.string());
217 | if (noMatch) i++;
218 | else break;
219 | }
220 | if(noMatch)
221 | return BAD_VALUE;
222 | else
223 | return NO_ERROR;
224 | }
225 | else if ((key == (String8)AMIC_EQ_PROFILE) ||
226 | (key == (String8)DMIC_EQ_PROFILE)) {
227 | ALOGV("validate DMIC/AMIC equalizer profile");
228 | i++; // "Flat response" is not supported by DMIC/AMIC
229 | while (noMatch && strcmp(EqualizerProfileList[i], "eof")) {
230 | noMatch = strcmp(EqualizerProfileList[i], value.string());
231 | if (noMatch) i++;
232 | else break;
233 | }
234 | if(noMatch)
235 | return BAD_VALUE;
236 | else
237 | return NO_ERROR;
238 | }
239 | else if ((key == (String8)VOICEMEMO_VUL_GAIN) ||
240 | (key == (String8)VOICEMEMO_VDL_GAIN) ||
241 | (key == (String8)VOICEMEMO_MM_GAIN) ||
242 | (key == (String8)VOICEMEMO_TONE_GAIN)) {
243 | ALOGV("validate Voice Memo gains");
244 | gain = atoi((const char *)value);
245 | if ((-120 <= gain) && (gain <= 29))
246 | return NO_ERROR;
247 | else
248 | return BAD_VALUE;
249 | }
250 | else {
251 | // @TODO: add constraints as required
252 | return NO_ERROR;
253 | }
254 | }
255 |
256 | status_t Omap4ALSAManager::remove(const String8& key)
257 | {
258 | if (mParams.indexOfKey(key) >= 0) {
259 | mParams.removeItem(key);
260 | return NO_ERROR;
261 | } else {
262 | return BAD_VALUE;
263 | }
264 | }
265 |
266 | Omap4ALSAManager::~Omap4ALSAManager()
267 | {
268 | mParams.clear();
269 | }
270 |
271 | }; //namespace Android
272 |
--------------------------------------------------------------------------------
/audio_hal/Omap4ALSAManager.h:
--------------------------------------------------------------------------------
1 | /* Omap4ALSAManager.h
2 | **
3 | ** Copyright 2011-2012 Texas Instruments
4 | **
5 | ** Licensed under the Apache License, Version 2.0 (the "License");
6 | ** you may not use this file except in compliance with the License.
7 | ** You may obtain a copy of the License at
8 | **
9 | ** http://www.apache.org/licenses/LICENSE-2.0
10 | **
11 | ** Unless required by applicable law or agreed to in writing, software
12 | ** distributed under the License is distributed on an "AS IS" BASIS,
13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | ** See the License for the specific language governing permissions and
15 | ** limitations under the License.
16 | */
17 |
18 | #include
19 | #include
20 | #include
21 | #include
22 |
23 | namespace android
24 | {
25 |
26 | class String8;
27 |
28 | class Omap4ALSAManager
29 | {
30 | public:
31 | Omap4ALSAManager() {}
32 | virtual ~Omap4ALSAManager();
33 |
34 | status_t remove(const String8& key);
35 | status_t get(const String8& key, String8& value);
36 | status_t get(const String8& key, int& value);
37 |
38 | status_t set(const String8& key, const String8& value);
39 | status_t setFromProperty(const String8& key);
40 | status_t setFromProperty(const String8& key, const String8& init);
41 |
42 | status_t validateValueForKey(const String8& key, String8& value);
43 |
44 | // the keys
45 | static const char* MAIN_MIC;
46 | static const char* SUB_MIC;
47 | static const char* POWER_MODE;
48 | static const char* DL2L_EQ_PROFILE;
49 | static const char* DL2R_EQ_PROFILE;
50 | static const char* DL1_EQ_PROFILE;
51 | static const char* AMIC_EQ_PROFILE;
52 | static const char* DMIC_EQ_PROFILE;
53 | static const char* SDT_EQ_PROFILE;
54 | static const char* VOICEMEMO_VUL_GAIN;
55 | static const char* VOICEMEMO_VDL_GAIN;
56 | static const char* VOICEMEMO_MM_GAIN;
57 | static const char* VOICEMEMO_TONE_GAIN;
58 | static const char *DL1_EAR_MONO_MIXER;
59 | static const char *DL1_HEAD_MONO_MIXER;
60 | static const char *DL2_SPEAK_MONO_MIXER;
61 | static const char *DL2_AUX_MONO_MIXER;
62 |
63 | // list of properties per devices
64 | KeyedVector mParams;
65 |
66 | size_t size() { return mParams.size(); }
67 |
68 | static const char *MicNameList[];
69 | static const char *PowerModeList[];
70 | static const char *EqualizerProfileList[];
71 |
72 | };
73 |
74 |
75 | }; // namespace android
76 |
--------------------------------------------------------------------------------
/audio_hal/alsa_omap3_modem.h:
--------------------------------------------------------------------------------
1 | /* alsa_omap3_modem.h
2 | **
3 | ** Copyright (C) 2009-2010, Texas Instruments
4 | **
5 | ** Licensed under the Apache License, Version 2.0 (the "License");
6 | ** you may not use this file except in compliance with the License.
7 | ** You may obtain a copy of the License at
8 | **
9 | ** http://www.apache.org/licenses/LICENSE-2.0
10 | **
11 | ** Unless required by applicable law or agreed to in writing, software
12 | ** distributed under the License is distributed on an "AS IS" BASIS,
13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | ** See the License for the specific language governing permissions and
15 | ** limitations under the License.
16 | */
17 |
18 | #ifndef ANDROID_ALSA_OMAP3_MODEM_H
19 | #define ANDROID_ALSA_OMAP3_MODEM_H
20 |
21 | #include
22 | #include
23 |
24 | namespace android
25 | {
26 | // The name of the audio modem properties keys is defined like below:
27 | // Note: property key is limited to 32 characters
28 | //
29 | // modem...
30 | //
31 | // with
32 | //
33 | // audio_mode:
34 | // hand for handset
35 | // free for handfree
36 | // head for headset
37 | // bt for bluetooth
38 | // aux for auxiliary
39 | //
40 | // stream:
41 | // voice for voice_call
42 | // audioi for audio_input
43 | // audioo for audio_output
44 | //
45 | // The list of the setting by order is:
46 | // Voicel Call multimic
47 | // Voicel Call sampleRate
48 | // Voicel Call nearEndVol
49 | // Voicel Call farEndVol
50 | //
51 | // Audio Input sampleRate
52 | // Audio Input nearEndVol
53 | // Audio Input farEndVol
54 | // Audio Input channel
55 | // Audio Input recordType
56 | //
57 | // Audio Output sampleRate
58 | // Audio Output nearEndVol
59 | // Audio Output farEndVol
60 | // Audio Output channel
61 | // Audio Output audioType
62 |
63 | // Possible value for each settings:
64 | // multimic : N, Y
65 | // sampleRate : 8KHZ, 16KHZ
66 | // nearEndVol : from 0.00 to 1.00 step 0.01
67 | // farEndVol : from 0.00 to 1.00 step 0.01
68 | // channel : I2S1, VOICE, VOICE_SECOND, VOICE_THIRD
69 | // audioType : SOUND, SOUND_NEAREND_VOICE, SOUND_FAREND_VOICE
70 | // recordType : NO_ECHO, ECHO
71 | //
72 |
73 | #define PROP_BASE_NAME "modem"
74 |
75 | static const char *audioModeName[] = {
76 | ".hand",
77 | ".free",
78 | ".head",
79 | ".bt",
80 | ".aux",
81 | };
82 | static const int audioModeNameLen = (sizeof(audioModeName) / sizeof(char *));
83 |
84 | static const char *modemStreamName[] = {
85 | ".voice",
86 | ".audioi",
87 | ".audioo"
88 | };
89 | static const int modemStreamNameLen = (sizeof(modemStreamName) / sizeof(char *));
90 |
91 | #define VOICE_CALL_STREAM (1<<0)
92 | #define AUDIO_INPUT_STREAM (1<<1)
93 | #define AUDIO_OUTPUT_STREAM (1<<2)
94 |
95 | #define AUDIO_MODEM_SETTING_DEFAULT "default"
96 |
97 | #define AUDIO_MODEM_SETTING_MAX 14
98 | #define AUDIO_MODEM_SETTING_LEN 15
99 |
100 | #define AUDIO_MODEM_VOICE_CALL_MULTIMIC 0
101 | #define AUDIO_MODEM_VOICE_CALL_SAMPLERATE 1
102 | #define AUDIO_MODEM_VOICE_CALL_NEARENDVOL 2
103 | #define AUDIO_MODEM_VOICE_CALL_FARENDVOL 3
104 | #define AUDIO_MODEM_AUDIO_IN_SAMPLERATE 4
105 | #define AUDIO_MODEM_AUDIO_IN_NEARENDVOL 5
106 | #define AUDIO_MODEM_AUDIO_IN_FARENDVOL 6
107 | #define AUDIO_MODEM_AUDIO_IN_CHANNEL 7
108 | #define AUDIO_MODEM_AUDIO_IN_RECORDTYPE 8
109 | #define AUDIO_MODEM_AUDIO_OUT_SAMPLERATE 9
110 | #define AUDIO_MODEM_AUDIO_OUT_NEARENDVOL 10
111 | #define AUDIO_MODEM_AUDIO_OUT_FARENDVOL 11
112 | #define AUDIO_MODEM_AUDIO_OUT_CHANNEL 12
113 | #define AUDIO_MODEM_AUDIO_OUT_AUDIOTYPE 13
114 |
115 | struct settingString_t {
116 | char name[AUDIO_MODEM_SETTING_LEN];
117 | };
118 |
119 | struct settingNameperStream_t {
120 | const char *name;
121 | const char streamUsed;
122 | };
123 |
124 | static settingNameperStream_t settingName[] = {
125 |
126 | { ".multimic", (VOICE_CALL_STREAM) },
127 | { ".sampleRate", (VOICE_CALL_STREAM | AUDIO_INPUT_STREAM | AUDIO_OUTPUT_STREAM) },
128 | { ".nearEndVol", (VOICE_CALL_STREAM | AUDIO_INPUT_STREAM | AUDIO_OUTPUT_STREAM) },
129 | { ".farEndVol", (VOICE_CALL_STREAM | AUDIO_INPUT_STREAM | AUDIO_OUTPUT_STREAM) },
130 | { ".channel", (AUDIO_INPUT_STREAM | AUDIO_OUTPUT_STREAM) },
131 | { ".audioType", (AUDIO_OUTPUT_STREAM) },
132 | { ".recordType", (AUDIO_INPUT_STREAM) }
133 | };
134 | static const int settingNameLen = (sizeof(settingName) / sizeof(settingNameperStream_t));
135 |
136 | // multimic : No, Yes
137 | // sampleRate : 8Khz, 16Khz
138 | // nearEndVol : from 0.00 to 1.00 step 0.01
139 | // farEndVol : from 0.00 to 1.00 step 0.01
140 | // channel : I2S1, Voice, Voice_second, Voice_third
141 | // audioType : Sound, Nearend_voice, Farend_voice
142 | // recordType : No_echo, Echo
143 |
144 | static const char *multimicValue[] = {
145 | "No",
146 | "Yes"
147 | };
148 | static const int multimicValueLen = (sizeof(multimicValue) / sizeof(char *));
149 |
150 | static const char *sampleRateValue[] = {
151 | "8Khz",
152 | "16Khz"
153 | };
154 | static const int sampleRateValueLen = (sizeof(sampleRateValue) / sizeof(char *));
155 |
156 | static const char *channelValue[] = {
157 | "I2S1",
158 | "Voice",
159 | "Voice_second",
160 | "Voice_third"
161 | };
162 | static const int channelValueLen = (sizeof(channelValue) / sizeof(char *));
163 |
164 | static const char *recordTypeValue[] = {
165 | "Sound",
166 | "Nearend_voice",
167 | "Farend_voice"
168 | };
169 | static const int recordTypeValueLen = (sizeof(recordTypeValue) / sizeof(char *));
170 |
171 | //
172 | // Audio Codec fine tuning paratemers:
173 | //
174 | // TODO put in property keys
175 | #define AUDIO_CODEC_ANAMIC_GAIN_HANDSET_L 3
176 | #define AUDIO_CODEC_ANAMIC_GAIN_HANDSET_R 3
177 | #define AUDIO_CODEC_ANAMIC_GAIN_HANDFREE_L 3
178 | #define AUDIO_CODEC_ANAMIC_GAIN_HANDFREE_R 3
179 | #define AUDIO_CODEC_ANAMIC_GAIN_HEADSET_L 3
180 | #define AUDIO_CODEC_ANAMIC_GAIN_HEADSET_R 3
181 |
182 | #define AUDIO_CODEC_TXL2_VOL_HANDSET 16
183 | #define AUDIO_CODEC_TXR2_VOL_HANDSET 16
184 | #define AUDIO_CODEC_TXL2_VOL_HANDFREE 16
185 | #define AUDIO_CODEC_TXR2_VOL_HANDFREE 16
186 | #define AUDIO_CODEC_TXL2_VOL_HEADSET 16
187 | #define AUDIO_CODEC_TXR2_VOL_HEADSET 16
188 |
189 | #define AUDIO_CODEC_VOICE_DIGITAL_VOL_HANDSET 42
190 | #define AUDIO_CODEC_VOICE_DIGITAL_VOL_HANDFREE 42
191 | #define AUDIO_CODEC_VOICE_DIGITAL_VOL_HEADSET 42
192 | #define AUDIO_CODEC_VOICE_DIGITAL_VOL_BLUETOOTH 12
193 |
194 | #define AUDIO_CODEC_SIDETONE_GAIN_HANDSET 20
195 | #define AUDIO_CODEC_SIDETONE_GAIN_HANDFREE 0
196 | #define AUDIO_CODEC_SIDETONE_GAIN_HEADSET 20
197 | #define AUDIO_CODEC_SIDETONE_GAIN_BLUETOOTH 20
198 |
199 | #define AUDIO_CODEC_VOICE_AUDIO_MIX_VOL_HANDSET 13
200 | #define AUDIO_CODEC_VOICE_AUDIO_MIX_VOL_HANDFREE 13
201 | #define AUDIO_CODEC_VOICE_AUDIO_MIX_VOL_HEADSET 13
202 |
203 | #define AUDIO_CODEC_VOICE_DIGITAL_CAPTURE_VOL_BLUETOOTH 12
204 |
205 |
206 | // Modem interface static library to use
207 | // are declared in the prop. key modem.audio.libpath
208 | // if not found the generic library is used
209 | #define AUDIO_MODEM_LIB_PATH_PROPERTY "modem.audio.libpath"
210 | #define AUDIO_MODEM_LIB_DEFAULT_PATH "/system/lib/libaudiomodemgeneric.so"
211 |
212 | // Voice Call Volume
213 | struct voiceCallVolumeInfo
214 | {
215 | unsigned int min;
216 | unsigned int max;
217 | };
218 |
219 | struct voiceCallVolumeList
220 | {
221 | const uint32_t device;
222 | const char *volumeName;
223 | voiceCallVolumeInfo *mInfo;
224 | };
225 |
226 | class AudioModemAlsa
227 | {
228 | public:
229 | AudioModemAlsa(ALSAControl *alsaControl);
230 | virtual ~AudioModemAlsa();
231 |
232 | class AudioModemDeviceProperties
233 | {
234 | public:
235 | AudioModemDeviceProperties(const char *audioModeName);
236 |
237 | void initProperties(int index,
238 | char *propValue,
239 | bool def);
240 |
241 | // The list of the setting by order is:
242 | // Voicel Call multimic
243 | // Voicel Call sampleRate
244 | // Voicel Call nearEndVol
245 | // Voicel Call farEndVol
246 | //
247 | // Audio Input sampleRate
248 | // Audio Input nearEndVol
249 | // Audio Input farEndVol
250 | // Audio Input channel
251 | // Audio Input recordType
252 | //
253 | // Audio Output sampleRate
254 | // Audio Output nearEndVol
255 | // Audio Output farEndVol
256 | // Audio Output channel
257 | // Audio Output audioType
258 | struct settingString_t settingsList[AUDIO_MODEM_SETTING_MAX];
259 |
260 | uint32_t audioMode;
261 | };
262 |
263 | enum audio_modem_voice_call_state {
264 | AUDIO_MODEM_VOICE_CALL_OFF = 0,
265 | AUDIO_MODEM_VOICE_CALL_ON,
266 | AUDIO_MODEM_VOICE_CALL_STATE_INVALID
267 | };
268 |
269 |
270 | AudioModemInterface *create(void);
271 | status_t audioModemSetProperties(void);
272 | status_t voiceCallControls(uint32_t devices, int mode,
273 | ALSAControl *alsaControl);
274 | status_t setCurrentAudioModemModes(uint32_t devices);
275 |
276 | status_t voiceCallCodecSet(void);
277 | status_t voiceCallCodecUpdate(void);
278 | status_t voiceCallCodecReset(void);
279 | status_t voiceCallCodecSetHandset(void);
280 | status_t voiceCallCodecSetHandfree(void);
281 | status_t voiceCallCodecSetHeadset(void);
282 | status_t voiceCallCodecUpdateHandset(void);
283 | status_t voiceCallCodecUpdateHandfree(void);
284 | status_t voiceCallCodecUpdateHeadset(void);
285 | status_t voiceCallCodecPCMSet(void);
286 | status_t voiceCallCodecPCMUpdate(void);
287 | status_t voiceCallCodecPCMReset(void);
288 | status_t voiceCallCodecStop(void);
289 |
290 | status_t voiceCallModemSet(void);
291 | status_t voiceCallModemUpdate(void);
292 | status_t voiceCallModemReset(void);
293 |
294 | status_t voiceCallBTDeviceEnable(void);
295 | status_t voiceCallBTDeviceDisable(void);
296 | #ifdef AUDIO_BLUETOOTH
297 | status_t voiceCallCodecSetBluetooth(void);
298 | status_t voiceCallCodecUpdateBluetooth(void);
299 | status_t voiceCallCodecBTPCMSet(void);
300 | status_t voiceCallCodecBTPCMReset(void);
301 | #endif
302 | status_t voiceCallVolume(ALSAControl *alsaControl, float volume);
303 |
304 | char *mBoardName;
305 | ALSAControl *mAlsaControl;
306 | int mVoiceCallState;
307 | uint32_t mCurrentAudioModemModes;
308 | uint32_t mPreviousAudioModemModes;
309 | // list of properties per devices
310 | KeyedVector mDevicePropList;
311 | AudioModemDeviceProperties *mDeviceProp;
312 | AudioModemDeviceProperties *mDevicePropPrevious;
313 |
314 | AudioModemInterface *mModem;
315 | };
316 | }; // namespace android
317 | #endif // ANDROID_ALSA_OMAP3_MODEM_H
318 |
--------------------------------------------------------------------------------
/audio_hal/alsa_omap4.h:
--------------------------------------------------------------------------------
1 | /* alsa_omap4.h
2 | **
3 | ** Copyright (C) 2009-2011, Texas Instruments
4 | **
5 | ** Licensed under the Apache License, Version 2.0 (the "License");
6 | ** you may not use this file except in compliance with the License.
7 | ** You may obtain a copy of the License at
8 | **
9 | ** http://www.apache.org/licenses/LICENSE-2.0
10 | **
11 | ** Unless required by applicable law or agreed to in writing, software
12 | ** distributed under the License is distributed on an "AS IS" BASIS,
13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | ** See the License for the specific language governing permissions and
15 | ** limitations under the License.
16 | */
17 |
18 | #ifndef ANDROID_ALSA_OMAP4
19 | #define ANDROID_ALSA_OMAP4
20 |
21 | #include "Omap4ALSAManager.h"
22 |
23 | #ifdef AUDIO_MODEM_TI
24 | #include "audio_modem_interface.h"
25 | #include "alsa_omap4_modem.h"
26 | #endif
27 |
28 | // alsa devices
29 | #define MM_DEFAULT_DEVICE "plughw:0,0"
30 | #define BLUETOOTH_SCO_DEVICE "plughw:0,0"
31 | #define FM_TRANSMIT_DEVICE "plughw:0,0"
32 | #define FM_CAPTURE_DEVICE "plughw:0,1"
33 | #define MM_LP_DEVICE "hw:0,6"
34 | #define HDMI_DEVICE "plughw:0,7"
35 |
36 | // omap4 outputs/inputs
37 | #define OMAP4_OUT_SCO (\
38 | AudioSystem::DEVICE_OUT_BLUETOOTH_SCO |\
39 | AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_HEADSET |\
40 | AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_CARKIT)
41 |
42 | #define OMAP4_OUT_FM (\
43 | AudioSystem::DEVICE_OUT_FM_TRANSMIT)
44 |
45 | #define OMAP4_OUT_HDMI (\
46 | AudioSystem::DEVICE_OUT_AUX_DIGITAL)
47 |
48 | #define OMAP4_OUT_LP (\
49 | AudioSystem::DEVICE_OUT_LOW_POWER)
50 |
51 | #define OMAP4_OUT_DEFAULT (\
52 | AudioSystem::DEVICE_OUT_ALL &\
53 | ~OMAP4_OUT_SCO &\
54 | ~OMAP4_OUT_FM &\
55 | ~OMAP4_OUT_LP &\
56 | ~OMAP4_OUT_HDMI)
57 |
58 | #define OMAP4_IN_SCO (\
59 | AudioSystem::DEVICE_IN_BLUETOOTH_SCO_HEADSET)
60 |
61 | #define OMAP4_IN_FM (\
62 | AudioSystem::DEVICE_IN_FM_ANALOG)
63 |
64 | #define OMAP4_IN_DEFAULT (\
65 | AudioSystem::DEVICE_IN_ALL &\
66 | ~OMAP4_IN_SCO)
67 |
68 |
69 | #ifndef ALSA_DEFAULT_SAMPLE_RATE
70 | #define ALSA_DEFAULT_SAMPLE_RATE 48000 // in Hz
71 | #endif
72 |
73 | #ifndef MM_LP_SAMPLE_RATE
74 | //not used for now
75 | #define MM_LP_SAMPLE_RATE 44100 // in Hz
76 | #endif
77 |
78 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
79 |
80 | #endif // ANDROID_ALSA_OMAP4
81 |
--------------------------------------------------------------------------------
/bluetooth/bdroid_buildcfg.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 The Android Open Source Project
3 | * Copyright (C) 2012 The CyanogenMod Project
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | #ifndef _BDROID_BUILDCFG_H
19 | #define _BDROID_BUILDCFG_H
20 |
21 | #define BTM_DEF_LOCAL_NAME "NookColor"
22 | #define BLE_INCLUDED FALSE
23 | #define BTA_GATT_INCLUDED FALSE
24 | #define SMP_INCLUDED FALSE
25 |
26 | #endif
27 |
--------------------------------------------------------------------------------
/clear_bootcnt.sh:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 |
3 | # clear the bootcount
4 | dd if=/dev/zero of=/rom/devconf/BootCnt bs=1c count=4
5 |
6 |
--------------------------------------------------------------------------------
/cm.dependencies:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "repository": "android_kernel_bn_encore",
4 | "target_path": "kernel/bn/encore",
5 | "branch": "encore-omap3-3"
6 | }
7 | ]
8 |
--------------------------------------------------------------------------------
/cm.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2012 The CyanogenMod Project
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | #
16 |
17 | $(call inherit-product, device/bn/encore/full_encore.mk)
18 |
19 | PRODUCT_RELEASE_NAME := NookColor
20 |
21 | # Inherit some common CM stuff.
22 | $(call inherit-product, vendor/cm/config/common_full_tablet_wifionly.mk)
23 |
24 | PRODUCT_BUILD_PROP_OVERRIDES += PRODUCT_NAME=encore BUILD_ID=JLS36I BUILD_DISPLAY_ID=JLS36I BUILD_FINGERPRINT="bn/bn_encore/encore:4.3.1/JLS36I/841738:user/release-keys" PRIVATE_BUILD_DESC="encore-user 4.3.1 JLS36I 841738 release-keys"
25 |
26 | PRODUCT_NAME := cm_encore
27 | PRODUCT_DEVICE := encore
28 |
--------------------------------------------------------------------------------
/egl.cfg:
--------------------------------------------------------------------------------
1 | 0 1 POWERVR_SGX530_125
2 |
3 |
--------------------------------------------------------------------------------
/etc/audio_policy.conf:
--------------------------------------------------------------------------------
1 | # Global configuration section: lists input and output devices always present on the device
2 | # as well as the output device selected by default.
3 | # Devices are designated by a string that corresponds to the enum in audio.h
4 |
5 | global_configuration {
6 | attached_output_devices AUDIO_DEVICE_OUT_SPEAKER
7 | default_output_device AUDIO_DEVICE_OUT_SPEAKER
8 | attached_input_devices AUDIO_DEVICE_IN_DEFAULT
9 | }
10 |
11 | # audio hardware module section: contains descriptors for all audio hw modules present on the
12 | # device. Each hw module node is named after the corresponding hw module library base name.
13 | # For instance, "primary" corresponds to audio.primary..so.
14 | # The "primary" module is mandatory and must include at least one output with
15 | # AUDIO_OUTPUT_FLAG_PRIMARY flag.
16 | # Each module descriptor contains one or more output profile descriptors and zero or more
17 | # input profile descriptors. Each profile lists all the parameters supported by a given output
18 | # or input stream category.
19 | # The "channel_masks", "formats", "devices" and "flags" are specified using strings corresponding
20 | # to enums in audio.h and audio_policy.h. They are concatenated by use of "|" without space or "\n".
21 |
22 | audio_hw_modules {
23 | primary {
24 | outputs {
25 | primary {
26 | sampling_rates 44100
27 | channel_masks AUDIO_CHANNEL_OUT_STEREO
28 | formats AUDIO_FORMAT_PCM_16_BIT
29 | devices AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|AUDIO_DEVICE_OUT_ALL_SCO
30 | flags AUDIO_OUTPUT_FLAG_PRIMARY
31 | }
32 | }
33 | inputs {
34 | primary {
35 | sampling_rates 8000|11025|16000|22050|32000|44100
36 | channel_masks AUDIO_CHANNEL_IN_MONO|AUDIO_CHANNEL_IN_STEREO
37 | formats AUDIO_FORMAT_PCM_16_BIT
38 | devices AUDIO_DEVICE_IN_DEFAULT|AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET
39 | }
40 | }
41 | }
42 | a2dp {
43 | outputs {
44 | a2dp {
45 | sampling_rates 44100
46 | channel_masks AUDIO_CHANNEL_OUT_STEREO
47 | formats AUDIO_FORMAT_PCM_16_BIT
48 | devices AUDIO_DEVICE_OUT_ALL_A2DP
49 | }
50 | }
51 | }
52 | usb {
53 | outputs {
54 | usb_accessory {
55 | sampling_rates 44100
56 | channel_masks AUDIO_CHANNEL_OUT_STEREO
57 | formats AUDIO_FORMAT_PCM_16_BIT
58 | devices AUDIO_DEVICE_OUT_USB_ACCESSORY
59 | }
60 | usb_device {
61 | sampling_rates 44100
62 | channel_masks AUDIO_CHANNEL_OUT_STEREO
63 | formats AUDIO_FORMAT_PCM_16_BIT
64 | devices AUDIO_DEVICE_OUT_USB_DEVICE
65 | }
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/etc/media_codecs.xml:
--------------------------------------------------------------------------------
1 |
15 |
16 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
--------------------------------------------------------------------------------
/etc/media_profiles.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 | ]>
75 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
140 |
145 |
146 |
151 |
152 |
157 |
158 |
162 |
163 |
167 |
168 |
172 |
173 |
174 |
175 |
176 |
--------------------------------------------------------------------------------
/etc/powervr.ini:
--------------------------------------------------------------------------------
1 | [default]
2 | HALFrameBufferHz=90
3 | ParamBufferSize=12582912
4 |
--------------------------------------------------------------------------------
/extract-files.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright (C) 2012 The CyanogenMod Project
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | DEVICE=encore
18 | MANUFACTURER=bn
19 |
20 | BASE=../../../vendor/$MANUFACTURER/$DEVICE/proprietary
21 |
22 | for FILE in `cat proprietary-files.txt`; do
23 | DIR=`dirname $FILE`
24 | if [ ! -d $BASE/$DIR ]; then
25 | mkdir -p $BASE/$DIR
26 | fi
27 | adb pull /system/$FILE $BASE/$FILE
28 | done
29 |
30 | ./setup-makefiles.sh
--------------------------------------------------------------------------------
/firmware/TIInit_7.2.31.bts:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CyanogenMod/android_device_bn_encore/b831ae56fe075e8bce7ae7853a76f771e4cca81c/firmware/TIInit_7.2.31.bts
--------------------------------------------------------------------------------
/fstab.encore:
--------------------------------------------------------------------------------
1 | #######################
2 | #
3 | # The filesystem that contains the filesystem checker binary (typically /system) cannot
4 | # specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
5 | ######################
6 | /dev/block/mmcblk0p5 /system ext4 ro,barrier=1 wait
7 | /dev/block/mmcblk0p6 /data ext4 noatime,nosuid,nodev,barrier=1,noauto_da_alloc wait,check
8 | /dev/block/mmcblk0p7 /cache ext4 noatime,nosuid,nodev,barrier=1 wait,check
9 | /dev/block/mmcblk0p2 /rom vfat sync,noatime,nodiratime,uid=1000,gid=1000,fmask=117,dmask=007 defaults
10 | /dev/block/mmcblk0p1 /boot vfat fmask=177,dmask=077 recoveryonly
11 |
12 | #
13 | # vold-managed volumes ("block device" is actually a sysfs devpath)
14 | #
15 | /devices/platform/omap/omap_hsmmc.0/mmc_host/mmc1 /storage/sdcard1 auto defaults voldmanaged=sdcard:auto
16 |
17 | ## nookcolor has two fat32 partitions, p1 is boot p8 is internal storage, so we have to specify here
18 | /devices/platform/omap/omap_hsmmc.1/mmc_host/mmc0 /storage/sdcard0 vfat defaults voldmanaged=emmc:8,nonremovable
19 |
20 | ## USB storage device
21 | /devices/platform/musb_hdrc /mnt/usbdisk auto defaults voldmanaged=usbdisk:auto
22 |
--------------------------------------------------------------------------------
/full_encore.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2009 The Android Open Source Project
3 | # Copyright (C) 2012 The CyanogenMod Project
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | #
18 | # This file is the build configuration for a full Android
19 | # build for encore hardware. This cleanly combines a set of
20 | # device-specific aspects (drivers) with a device-agnostic
21 | # product configuration (apps).
22 | #
23 |
24 | # Inherit from those products. Most specific first.
25 | $(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
26 | # This is where we'd set a backup provider if we had one
27 | #$(call inherit-product, device/sample/products/backup_overlay.mk)
28 | $(call inherit-product, device/bn/encore/encore.mk)
29 |
30 | # Discard inherited values and use our own instead.
31 | PRODUCT_NAME := full_encore
32 | PRODUCT_DEVICE := encore
33 | PRODUCT_BRAND := bn
34 | PRODUCT_MODEL := NookColor
35 | PRODUCT_MANUFACTURER := bn
36 |
--------------------------------------------------------------------------------
/include/linux/hal_public.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) Imagination Technologies Ltd.
2 | *
3 | * The contents of this file are subject to the MIT license as set out below.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the "Software"), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | * THE SOFTWARE.
22 | */
23 |
24 | #ifndef HAL_PUBLIC_H
25 | #define HAL_PUBLIC_H
26 |
27 | /* Authors of third party hardware composer (HWC) modules will need to include
28 | * this header to access functionality in the gralloc and framebuffer HALs.
29 | */
30 |
31 | #include
32 |
33 | #define ALIGN(x,a) (((x) + (a) - 1L) & ~((a) - 1L))
34 | #define HW_ALIGN 32
35 |
36 | /* This can be tuned down as appropriate for the SOC.
37 | *
38 | * IMG formats are usually a single sub-alloc.
39 | * Some OEM video formats are two sub-allocs (Y, UV planes).
40 | * Future OEM video formats might be three sub-allocs (Y, U, V planes).
41 | */
42 | #define MAX_SUB_ALLOCS 3
43 |
44 | typedef struct
45 | {
46 | native_handle_t base;
47 |
48 | /* These fields can be sent cross process. They are also valid
49 | * to duplicate within the same process.
50 | *
51 | * A table is stored within psPrivateData on gralloc_module_t (this
52 | * is obviously per-process) which maps stamps to a mapped
53 | * PVRSRV_CLIENT_MEM_INFO in that process. Each map entry has a lock
54 | * count associated with it, satisfying the requirements of the
55 | * Android API. This also prevents us from leaking maps/allocations.
56 | *
57 | * This table has entries inserted either by alloc()
58 | * (alloc_device_t) or map() (gralloc_module_t). Entries are removed
59 | * by free() (alloc_device_t) and unmap() (gralloc_module_t).
60 | *
61 | * As a special case for framebuffer_device_t, framebuffer_open()
62 | * will add and framebuffer_close() will remove from this table.
63 | */
64 |
65 | #define IMG_NATIVE_HANDLE_NUMFDS MAX_SUB_ALLOCS
66 | /* The `fd' field is used to "export" a meminfo to another process.
67 | * Therefore, it is allocated by alloc_device_t, and consumed by
68 | * gralloc_module_t. The framebuffer_device_t does not need a handle,
69 | * and the special value IMG_FRAMEBUFFER_FD is used instead.
70 | */
71 | int fd[MAX_SUB_ALLOCS];
72 |
73 | #define IMG_NATIVE_HANDLE_NUMINTS ((sizeof(unsigned long long) / sizeof(int)) + 5)
74 | /* A KERNEL unique identifier for any exported kernel meminfo. Each
75 | * exported kernel meminfo will have a unique stamp, but note that in
76 | * userspace, several meminfos across multiple processes could have
77 | * the same stamp. As the native_handle can be dup(2)'d, there could be
78 | * multiple handles with the same stamp but different file descriptors.
79 | */
80 | unsigned long long ui64Stamp;
81 |
82 | /* This is used for buffer usage validation when locking a buffer,
83 | * and also in WSEGL (for the composition bypass feature).
84 | */
85 | int usage;
86 |
87 | /* In order to do efficient cache flushes we need the buffer dimensions
88 | * and format. These are available on the ANativeWindowBuffer,
89 | * but the platform doesn't pass them down to the graphics HAL.
90 | *
91 | * These fields are also used in the composition bypass. In this
92 | * capacity, these are the "real" values for the backing allocation.
93 | */
94 | int iWidth;
95 | int iHeight;
96 | int iFormat;
97 | unsigned int uiBpp;
98 | }
99 | __attribute__((aligned(sizeof(int)),packed)) IMG_native_handle_t;
100 |
101 | typedef struct
102 | {
103 | framebuffer_device_t base;
104 |
105 | /* The HWC was loaded. post() is no longer responsible for presents */
106 | int bBypassPost;
107 |
108 | /* HWC path for present posts */
109 | int (*Post2)(framebuffer_device_t *fb, buffer_handle_t *buffers,
110 | int num_buffers, void *data, int data_length);
111 | }
112 | IMG_framebuffer_device_public_t;
113 |
114 | typedef struct IMG_gralloc_module_public_t
115 | {
116 | gralloc_module_t base;
117 |
118 | /* If the framebuffer has been opened, this will point to the
119 | * framebuffer device data required by the allocator, WSEGL
120 | * modules and composerhal.
121 | */
122 | IMG_framebuffer_device_public_t *psFrameBufferDevice;
123 |
124 | int (*GetPhyAddrs)(struct IMG_gralloc_module_public_t const* module,
125 | buffer_handle_t handle,
126 | unsigned int auiPhyAddr[MAX_SUB_ALLOCS]);
127 |
128 | /* Custom-blit components in lieu of overlay hardware */
129 | int (*Blit)(struct IMG_gralloc_module_public_t const *module,
130 | buffer_handle_t src,
131 | void *dest[MAX_SUB_ALLOCS], int format);
132 |
133 | int (*Blit2)(struct IMG_gralloc_module_public_t const *module,
134 | buffer_handle_t src, buffer_handle_t dest,
135 | int w, int h, int x, int y);
136 | }
137 | IMG_gralloc_module_public_t;
138 |
139 | typedef struct
140 | {
141 | int l, t, w, h;
142 | }
143 | IMG_write_lock_rect_t;
144 |
145 | typedef struct IMG_buffer_format_public_t
146 | {
147 | /* Buffer formats are returned as a linked list */
148 | struct IMG_buffer_format_public_t *psNext;
149 |
150 | /* HAL_PIXEL_FORMAT_... enumerant */
151 | int iHalPixelFormat;
152 |
153 | /* WSEGL_PIXELFORMAT_... enumerant */
154 | int iWSEGLPixelFormat;
155 |
156 | /* Friendly name for format */
157 | const char *const szName;
158 |
159 | /* Bits (not bytes) per pixel */
160 | unsigned int uiBpp;
161 |
162 | /* GPU output format (creates EGLConfig for format) */
163 | int bGPURenderable;
164 | }
165 | IMG_buffer_format_public_t;
166 |
167 | #endif /* HAL_PUBLIC_H */
168 |
--------------------------------------------------------------------------------
/include/linux/omap_ion.h:
--------------------------------------------------------------------------------
1 | /*
2 | * include/linux/omap_ion.h
3 | *
4 | * Copyright (C) 2011 Google, Inc.
5 | *
6 | * This software is licensed under the terms of the GNU General Public
7 | * License version 2, as published by the Free Software Foundation, and
8 | * may be copied, distributed, and modified under those terms.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | */
16 |
17 | #ifndef _LINUX_OMAP_ION_H
18 | #define _LINUX_OMAP_ION_H
19 |
20 | #include
21 |
22 | /**
23 | * struct omap_ion_tiler_alloc_data - metadata passed from userspace for allocations
24 | * @w: width of the allocation
25 | * @h: height of the allocation
26 | * @fmt: format of the data (8, 16, 32bit or page)
27 | * @flags: flags passed to heap
28 | * @stride: stride of the allocation, returned to caller from kernel
29 | * @handle: pointer that will be populated with a cookie to use to refer
30 | * to this allocation
31 | *
32 | * Provided by userspace as an argument to the ioctl
33 | */
34 | struct omap_ion_tiler_alloc_data {
35 | size_t w;
36 | size_t h;
37 | int fmt;
38 | unsigned int flags;
39 | struct ion_handle *handle;
40 | size_t stride;
41 | size_t offset;
42 | };
43 |
44 | #ifdef __KERNEL__
45 | int omap_ion_tiler_alloc(struct ion_client *client,
46 | struct omap_ion_tiler_alloc_data *data);
47 | int omap_ion_nonsecure_tiler_alloc(struct ion_client *client,
48 | struct omap_ion_tiler_alloc_data *data);
49 | /* given a handle in the tiler, return a list of tiler pages that back it */
50 | int omap_tiler_pages(struct ion_client *client, struct ion_handle *handle,
51 | int *n, u32 ** tiler_pages);
52 | #endif /* __KERNEL__ */
53 |
54 | int omap_ion_mem_alloc(struct ion_client *client,
55 | struct omap_ion_tiler_alloc_data *data);
56 | int omap_ion_get_pages(struct ion_client *client, struct ion_handle *handle,
57 | int *n, unsigned long *ion_addr,
58 | struct omap_ion_tiler_alloc_data *sAllocData);
59 | /* additional heaps used only on omap */
60 | enum {
61 | OMAP_ION_HEAP_TYPE_TILER = ION_HEAP_TYPE_CUSTOM + 1,
62 | };
63 |
64 | #define OMAP_ION_HEAP_TILER_MASK (1 << OMAP_ION_HEAP_TYPE_TILER)
65 |
66 | enum {
67 | OMAP_ION_TILER_ALLOC,
68 | };
69 |
70 | /**
71 | * These should match the defines in the tiler driver
72 | */
73 | enum {
74 | TILER_PIXEL_FMT_MIN = 0,
75 | TILER_PIXEL_FMT_8BIT = 0,
76 | TILER_PIXEL_FMT_16BIT = 1,
77 | TILER_PIXEL_FMT_32BIT = 2,
78 | TILER_PIXEL_FMT_PAGE = 3,
79 | TILER_PIXEL_FMT_MAX = 3
80 | };
81 |
82 | /**
83 | * List of heaps in the system
84 | */
85 | enum {
86 | OMAP_ION_HEAP_LARGE_SURFACES,
87 | OMAP_ION_HEAP_TILER,
88 | OMAP_ION_HEAP_SECURE_INPUT,
89 | OMAP_ION_HEAP_NONSECURE_TILER,
90 | };
91 |
92 | #endif /* _LINUX_ION_H */
93 |
94 |
--------------------------------------------------------------------------------
/init.encore.usb.rc:
--------------------------------------------------------------------------------
1 | on init
2 | write /sys/class/android_usb/android0/iSerial ${ro.serialno}
3 | write /sys/class/android_usb/android0/f_mass_storage/inquiry_string "NookColor"
4 | write /sys/class/android_usb/android0/f_rndis/manufacturer BN
5 | write /sys/class/android_usb/android0/f_rndis/vendorID 18d1
6 | write /sys/class/android_usb/android0/f_rndis/wceis 1
7 |
8 | on boot
9 | write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer}
10 | write /sys/class/android_usb/android0/iProduct ${ro.product.model}
11 |
12 | on property:sys.usb.config=mass_storage
13 | write /sys/class/android_usb/android0/enable 0
14 | write /sys/class/android_usb/android0/idVendor 2080
15 | write /sys/class/android_usb/android0/idProduct 0002
16 | write /sys/class/android_usb/android0/functions ${sys.usb.config}
17 | write /sys/class/android_usb/android0/enable 1
18 | setprop sys.usb.state ${sys.usb.config}
19 |
20 | on property:sys.usb.config=mass_storage,adb
21 | write /sys/class/android_usb/android0/enable 0
22 | write /sys/class/android_usb/android0/idVendor 2080
23 | write /sys/class/android_usb/android0/idProduct 0002
24 | write /sys/class/android_usb/android0/functions ${sys.usb.config}
25 | write /sys/class/android_usb/android0/enable 1
26 | start adbd
27 | setprop sys.usb.state ${sys.usb.config}
28 |
29 | on property:sys.usb.config=mtp
30 | write /sys/class/android_usb/android0/enable 0
31 | write /sys/class/android_usb/android0/idVendor 18d1
32 | write /sys/class/android_usb/android0/idProduct 2d02
33 | write /sys/class/android_usb/android0/functions ${sys.usb.config}
34 | write /sys/class/android_usb/android0/enable 1
35 | setprop sys.usb.state ${sys.usb.config}
36 |
37 | on property:sys.usb.config=mtp,adb
38 | write /sys/class/android_usb/android0/enable 0
39 | write /sys/class/android_usb/android0/idVendor 18d1
40 | write /sys/class/android_usb/android0/idProduct 2d03
41 | write /sys/class/android_usb/android0/functions ${sys.usb.config}
42 | write /sys/class/android_usb/android0/enable 1
43 | start adbd
44 | setprop sys.usb.state ${sys.usb.config}
45 |
46 | on property:sys.usb.config=ptp
47 | write /sys/class/android_usb/android0/enable 0
48 | write /sys/class/android_usb/android0/idVendor 18d1
49 | write /sys/class/android_usb/android0/idProduct 2d04
50 | write /sys/class/android_usb/android0/functions ${sys.usb.config}
51 | write /sys/class/android_usb/android0/enable 1
52 | setprop sys.usb.state ${sys.usb.config}
53 |
54 | on property:sys.usb.config=ptp,adb
55 | write /sys/class/android_usb/android0/enable 0
56 | write /sys/class/android_usb/android0/idVendor 18d1
57 | write /sys/class/android_usb/android0/idProduct 2d05
58 | write /sys/class/android_usb/android0/functions ${sys.usb.config}
59 | write /sys/class/android_usb/android0/enable 1
60 | start adbd
61 | setprop sys.usb.state ${sys.usb.config}
62 |
63 | on property:sys.usb.config=rndis
64 | write /sys/class/android_usb/android0/enable 0
65 | write /sys/class/android_usb/android0/idVendor 18d1
66 | write /sys/class/android_usb/android0/idProduct 2d06
67 | write /sys/class/android_usb/android0/functions ${sys.usb.config}
68 | write /sys/class/android_usb/android0/bDeviceClass 224
69 | write /sys/class/android_usb/android0/enable 1
70 | setprop sys.usb.state ${sys.usb.config}
71 |
72 | on property:sys.usb.config=rndis,adb
73 | write /sys/class/android_usb/android0/enable 0
74 | write /sys/class/android_usb/android0/idVendor 18d1
75 | write /sys/class/android_usb/android0/idProduct 2d07
76 | write /sys/class/android_usb/android0/functions ${sys.usb.config}
77 | write /sys/class/android_usb/android0/bDeviceClass 224
78 | write /sys/class/android_usb/android0/enable 1
79 | start adbd
80 | setprop sys.usb.state ${sys.usb.config}
81 |
--------------------------------------------------------------------------------
/liblights/Android.mk:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2008 The Android Open Source Project
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 |
16 | LOCAL_PATH:= $(call my-dir)
17 | # HAL module implemenation, not prelinked and stored in
18 | # hw/..so
19 | include $(CLEAR_VARS)
20 |
21 | LOCAL_SRC_FILES := lights.c
22 |
23 | LOCAL_PRELINK_MODULE := false
24 | LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
25 |
26 | LOCAL_SHARED_LIBRARIES := liblog
27 |
28 | LOCAL_MODULE := lights.encore
29 | LOCAL_MODULE_TAGS:= optional
30 |
31 | include $(BUILD_SHARED_LIBRARY)
32 |
--------------------------------------------------------------------------------
/liblights/lights.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 |
18 | #define LOG_TAG "lights"
19 |
20 | #include
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 |
29 | #include
30 | #include
31 |
32 | #include
33 |
34 | /******************************************************************************/
35 |
36 | static pthread_once_t g_init = PTHREAD_ONCE_INIT;
37 | static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER;
38 |
39 | char const*const LCD_FILE
40 | = "/sys/class/leds/lcd-backlight/brightness";
41 |
42 | void init_globals(void)
43 | {
44 | // init the mutex
45 | pthread_mutex_init(&g_lock, NULL);
46 | }
47 |
48 | static int
49 | write_int(char const* path, int value)
50 | {
51 | int fd;
52 | static int already_warned = 0;
53 |
54 | fd = open(path, O_RDWR);
55 | if (fd >= 0) {
56 | char buffer[20];
57 | int bytes = sprintf(buffer, "%d\n", value);
58 | int amt = write(fd, buffer, bytes);
59 | close(fd);
60 | return amt == -1 ? -errno : 0;
61 | } else {
62 | if (already_warned == 0) {
63 | ALOGE("write_int failed to open %s\n", path);
64 | already_warned = 1;
65 | }
66 | return -errno;
67 | }
68 | }
69 |
70 | static int
71 | is_lit(struct light_state_t const* state)
72 | {
73 | return state->color & 0x00ffffff;
74 | }
75 |
76 | static int
77 | rgb_to_brightness(struct light_state_t const* state)
78 | {
79 | int color = state->color & 0x00ffffff;
80 | return ((77*((color>>16)&0x00ff))
81 | + (150*((color>>8)&0x00ff)) + (29*(color&0x00ff))) >> 8;
82 | }
83 |
84 | static int
85 | set_light_backlight(struct light_device_t* dev,
86 | struct light_state_t const* state)
87 | {
88 | int err = 0;
89 |
90 | int brightness = rgb_to_brightness(state);
91 |
92 | pthread_mutex_lock(&g_lock);
93 | err = write_int(LCD_FILE, brightness);
94 | pthread_mutex_unlock(&g_lock);
95 |
96 | return err;
97 | }
98 |
99 | static int
100 | set_light_keyboard(struct light_device_t* dev,
101 | struct light_state_t const* state)
102 | {
103 | return 0;
104 | }
105 |
106 | static int
107 | set_light_buttons(struct light_device_t* dev,
108 | struct light_state_t const* state)
109 | {
110 | return 0;
111 | }
112 |
113 | static int
114 | set_light_battery(struct light_device_t* dev,
115 | struct light_state_t const* state)
116 | {
117 | return 0;
118 | }
119 |
120 | static int
121 | set_light_notification(struct light_device_t* dev,
122 | struct light_state_t const* state)
123 | {
124 | return 0;
125 | }
126 |
127 | static int
128 | set_light_attention(struct light_device_t* dev,
129 | struct light_state_t const* state)
130 | {
131 | return 0;
132 | }
133 |
134 | static int
135 | close_lights(struct light_device_t *dev)
136 | {
137 | if (dev) {
138 | free(dev);
139 | }
140 | return 0;
141 | }
142 |
143 |
144 | /******************************************************************************/
145 | static int open_lights(const struct hw_module_t* module, char const* name,
146 | struct hw_device_t** device)
147 | {
148 | int (*set_light)(struct light_device_t* dev,
149 | struct light_state_t const* state);
150 |
151 | if (0 == strcmp(LIGHT_ID_BACKLIGHT, name)) {
152 | set_light = set_light_backlight;
153 | }
154 | else if (0 == strcmp(LIGHT_ID_KEYBOARD, name)) {
155 | set_light = set_light_keyboard;
156 | }
157 | else if (0 == strcmp(LIGHT_ID_BUTTONS, name)) {
158 | set_light = set_light_buttons;
159 | }
160 | else if (0 == strcmp(LIGHT_ID_BATTERY, name)) {
161 | set_light = set_light_battery;
162 | }
163 | else if (0 == strcmp(LIGHT_ID_NOTIFICATIONS, name)) {
164 | set_light = set_light_notification;
165 | }
166 | else if (0 == strcmp(LIGHT_ID_ATTENTION, name)) {
167 | set_light = set_light_attention;
168 | }
169 | else {
170 | return -EINVAL;
171 | }
172 |
173 | pthread_once(&g_init, init_globals);
174 |
175 | struct light_device_t *dev = malloc(sizeof(struct light_device_t));
176 | memset(dev, 0, sizeof(*dev));
177 |
178 | dev->common.tag = HARDWARE_DEVICE_TAG;
179 | dev->common.version = 0;
180 | dev->common.module = (struct hw_module_t*)module;
181 | dev->common.close = (int (*)(struct hw_device_t*))close_lights;
182 | dev->set_light = set_light;
183 |
184 | *device = (struct hw_device_t*)dev;
185 | return 0;
186 | }
187 |
188 |
189 | static struct hw_module_methods_t lights_module_methods = {
190 | .open = open_lights,
191 | };
192 |
193 | struct hw_module_t HAL_MODULE_INFO_SYM = {
194 | .tag = HARDWARE_MODULE_TAG,
195 | .version_major = 1,
196 | .version_minor = 0,
197 | .id = LIGHTS_HARDWARE_MODULE_ID,
198 | .name = "Barnes and Noble Encore Lights Module",
199 | .author = "Austen Dicken",
200 | .methods = &lights_module_methods,
201 | };
202 |
--------------------------------------------------------------------------------
/libsensors/Android.mk:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2008 The Android Open Source Project
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 |
16 | LOCAL_PATH := $(call my-dir)
17 |
18 | ifneq ($(TARGET_SIMULATOR),true)
19 |
20 | # HAL module implemenation, not prelinked, and stored in
21 | # hw/..so
22 | include $(CLEAR_VARS)
23 |
24 | LOCAL_MODULE := sensors.encore
25 |
26 | LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
27 |
28 | LOCAL_MODULE_TAGS := optional
29 |
30 | LOCAL_CFLAGS := -DLOG_TAG=\"Sensors\"
31 | LOCAL_SRC_FILES := \
32 | sensors.c \
33 | nusensors.cpp \
34 | InputEventReader.cpp \
35 | SensorBase.cpp \
36 | Kxtf9.cpp
37 |
38 | LOCAL_SHARED_LIBRARIES := liblog libcutils
39 | LOCAL_PRELINK_MODULE := false
40 |
41 | include $(BUILD_SHARED_LIBRARY)
42 |
43 | endif # !TARGET_SIMULATOR
44 |
--------------------------------------------------------------------------------
/libsensors/InputEventReader.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #include
18 | #include
19 | #include
20 | #include
21 |
22 | #include
23 | #include
24 |
25 | #include
26 |
27 | #include
28 |
29 | #include "InputEventReader.h"
30 |
31 | /*****************************************************************************/
32 |
33 | struct input_event;
34 |
35 | InputEventCircularReader::InputEventCircularReader(size_t numEvents)
36 | : mBuffer(new input_event[numEvents * 2]),
37 | mBufferEnd(mBuffer + numEvents),
38 | mHead(mBuffer),
39 | mCurr(mBuffer),
40 | mFreeSpace(numEvents)
41 | {
42 | }
43 |
44 | InputEventCircularReader::~InputEventCircularReader()
45 | {
46 | delete [] mBuffer;
47 | }
48 |
49 | ssize_t InputEventCircularReader::fill(int fd)
50 | {
51 | size_t numEventsRead = 0;
52 | if (mFreeSpace) {
53 | const ssize_t nread = read(fd, mHead, mFreeSpace * sizeof(input_event));
54 | if (nread<0 || nread % sizeof(input_event)) {
55 | // we got a partial event!!
56 | return nread<0 ? -errno : -EINVAL;
57 | }
58 |
59 | numEventsRead = nread / sizeof(input_event);
60 | if (numEventsRead) {
61 | mHead += numEventsRead;
62 | mFreeSpace -= numEventsRead;
63 | if (mHead > mBufferEnd) {
64 | size_t s = mHead - mBufferEnd;
65 | memcpy(mBuffer, mBufferEnd, s * sizeof(input_event));
66 | mHead = mBuffer + s;
67 | }
68 | }
69 | }
70 |
71 | return numEventsRead;
72 | }
73 |
74 | ssize_t InputEventCircularReader::readEvent(input_event const** events)
75 | {
76 | *events = mCurr;
77 | ssize_t available = (mBufferEnd - mBuffer) - mFreeSpace;
78 | return available ? 1 : 0;
79 | }
80 |
81 | void InputEventCircularReader::next()
82 | {
83 | mCurr++;
84 | mFreeSpace++;
85 | if (mCurr >= mBufferEnd) {
86 | mCurr = mBuffer;
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/libsensors/InputEventReader.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef ANDROID_INPUT_EVENT_READER_H
18 | #define ANDROID_INPUT_EVENT_READER_H
19 |
20 | #include
21 | #include
22 | #include
23 | #include
24 |
25 | /*****************************************************************************/
26 |
27 | struct input_event;
28 |
29 | class InputEventCircularReader
30 | {
31 | struct input_event* const mBuffer;
32 | struct input_event* const mBufferEnd;
33 | struct input_event* mHead;
34 | struct input_event* mCurr;
35 | ssize_t mFreeSpace;
36 |
37 | public:
38 | InputEventCircularReader(size_t numEvents);
39 | ~InputEventCircularReader();
40 | ssize_t fill(int fd);
41 | ssize_t readEvent(input_event const** events);
42 | void next();
43 | };
44 |
45 | /*****************************************************************************/
46 |
47 | #endif // ANDROID_INPUT_EVENT_READER_H
48 |
--------------------------------------------------------------------------------
/libsensors/Kxtf9.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 |
26 | #include
27 |
28 | #include "Kxtf9.h"
29 |
30 | /*****************************************************************************/
31 |
32 | Kxtf9Sensor::Kxtf9Sensor()
33 | : SensorBase(KXTF9_DEVICE_NAME, "kxtf9_accel"),
34 | mEnabled(0),
35 | mInputReader(32)
36 | {
37 | mPendingEvent.version = sizeof(sensors_event_t);
38 | mPendingEvent.sensor = ID_A;
39 | mPendingEvent.type = SENSOR_TYPE_ACCELEROMETER;
40 | memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data));
41 | mPendingEvent.acceleration.status = SENSOR_STATUS_ACCURACY_HIGH;
42 |
43 | mEnabled = isEnabled();
44 | }
45 |
46 | Kxtf9Sensor::~Kxtf9Sensor() {
47 | }
48 |
49 | int Kxtf9Sensor::enable(int32_t handle, int en)
50 | {
51 | int err = 0;
52 |
53 | int newState = en ? 1 : 0;
54 |
55 | // don't set enable state if it's already valid
56 | if(mEnabled == newState) {
57 | return err;
58 | }
59 |
60 | // ok we need to set our enabled state
61 | int fd = open(KXTF9_ENABLE_FILE, O_WRONLY);
62 | if(fd >= 0) {
63 | char buffer[20];
64 | int bytes = sprintf(buffer, "%d\n", newState);
65 | err = write(fd, buffer, bytes);
66 | err = err < 0 ? -errno : 0;
67 | close(fd);
68 | } else {
69 | err = -errno;
70 | }
71 |
72 | ALOGE_IF(err < 0, "Error setting enable of kxtf9 accelerometer (%s)", strerror(-err));
73 |
74 | if (!err) {
75 | mEnabled = newState;
76 | setDelay(0, 100000000); // 100ms by default for faster re-orienting
77 | }
78 |
79 | return err;
80 | }
81 |
82 | int Kxtf9Sensor::setDelay(int32_t handle, int64_t ns)
83 | {
84 | int err = 0;
85 |
86 | if (mEnabled) {
87 | if (ns < 0)
88 | return -EINVAL;
89 |
90 | unsigned long delay = ns / 1000000;
91 |
92 | // ok we need to set our enabled state
93 | int fd = open(KXTF9_DELAY_FILE, O_WRONLY);
94 | if(fd >= 0) {
95 | char buffer[20];
96 | int bytes = sprintf(buffer, "%d\n", delay);
97 | err = write(fd, buffer, bytes);
98 | err = err < 0 ? -errno : 0;
99 | close(fd);
100 | } else {
101 | err = -errno;
102 | }
103 |
104 | ALOGE_IF(err < 0, "Error setting delay of kxtf9 accelerometer (%s)", strerror(-err));
105 | }
106 |
107 | return err;
108 | }
109 |
110 | int Kxtf9Sensor::readEvents(sensors_event_t* data, int count)
111 | {
112 | if (count < 1)
113 | return -EINVAL;
114 |
115 | ssize_t n = mInputReader.fill(data_fd);
116 | if (n < 0)
117 | return n;
118 |
119 | int numEventReceived = 0;
120 | input_event const* event;
121 |
122 | while (count && mInputReader.readEvent(&event)) {
123 | int type = event->type;
124 | if (type == EV_REL) {
125 | processEvent(event->code, event->value);
126 | } else if (type == EV_SYN) {
127 | mPendingEvent.timestamp = timevalToNano(event->time);
128 | *data++ = mPendingEvent;
129 | count--;
130 | numEventReceived++;
131 | } else {
132 | ALOGE("Kxtf9: unknown event (type=%d, code=%d)",
133 | type, event->code);
134 | }
135 | mInputReader.next();
136 | }
137 |
138 | return numEventReceived;
139 | }
140 |
141 | void Kxtf9Sensor::processEvent(int code, int value)
142 | {
143 | switch (code) {
144 | case EVENT_TYPE_ACCEL_X:
145 | mPendingEvent.acceleration.x = value * CONVERT_A_X;
146 | break;
147 | case EVENT_TYPE_ACCEL_Y:
148 | mPendingEvent.acceleration.y = value * CONVERT_A_Y;
149 | break;
150 | case EVENT_TYPE_ACCEL_Z:
151 | mPendingEvent.acceleration.z = value * CONVERT_A_Z;
152 | break;
153 | }
154 | }
155 |
156 | int Kxtf9Sensor::isEnabled()
157 | {
158 | int fd = open(KXTF9_ENABLE_FILE, O_RDONLY);
159 | if (fd >= 0) {
160 | char buffer[20];
161 | int amt = read(fd, buffer, 20);
162 | close(fd);
163 | if(amt > 0) {
164 | return (buffer[0] == '1');
165 | } else {
166 | ALOGE("Kxtf9: isEnable failed to read (%s)", strerror(errno));
167 | return 0;
168 | }
169 | } else {
170 | ALOGE("Kxtf9: isEnabled failed to open %s", KXTF9_ENABLE_FILE);
171 | return 0;
172 | }
173 | }
174 |
--------------------------------------------------------------------------------
/libsensors/Kxtf9.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef ANDROID_KXTF9_SENSOR_H
18 | #define ANDROID_KXTF9_SENSOR_H
19 |
20 | #include
21 | #include
22 | #include
23 | #include
24 |
25 |
26 | #include "nusensors.h"
27 | #include "SensorBase.h"
28 | #include "InputEventReader.h"
29 |
30 | #define KXTF9_ENABLE_FILE "/sys/bus/i2c/drivers/kxtf9/1-000f/enable"
31 | #define KXTF9_DELAY_FILE "/sys/bus/i2c/drivers/kxtf9/1-000f/delay"
32 |
33 | /*****************************************************************************/
34 |
35 | struct input_event;
36 |
37 | class Kxtf9Sensor : public SensorBase {
38 | public:
39 | Kxtf9Sensor();
40 | virtual ~Kxtf9Sensor();
41 |
42 | virtual int setDelay(int32_t handle, int64_t ns);
43 | virtual int enable(int32_t handle, int enabled);
44 | virtual int readEvents(sensors_event_t* data, int count);
45 | void processEvent(int code, int value);
46 |
47 | private:
48 | uint32_t mEnabled;
49 | InputEventCircularReader mInputReader;
50 | sensors_event_t mPendingEvent;
51 |
52 | int isEnabled();
53 | };
54 |
55 | /*****************************************************************************/
56 |
57 | #endif // ANDROID_AKM_SENSOR_H
58 |
--------------------------------------------------------------------------------
/libsensors/MODULE_LICENSE_APACHE2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CyanogenMod/android_device_bn_encore/b831ae56fe075e8bce7ae7853a76f771e4cca81c/libsensors/MODULE_LICENSE_APACHE2
--------------------------------------------------------------------------------
/libsensors/NOTICE:
--------------------------------------------------------------------------------
1 |
2 | Copyright (c) 2008, The Android Open Source Project
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 |
7 | Unless required by applicable law or agreed to in writing, software
8 | distributed under the License is distributed on an "AS IS" BASIS,
9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | See the License for the specific language governing permissions and
11 | limitations under the License.
12 |
13 |
14 | Apache License
15 | Version 2.0, January 2004
16 | http://www.apache.org/licenses/
17 |
18 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
19 |
20 | 1. Definitions.
21 |
22 | "License" shall mean the terms and conditions for use, reproduction,
23 | and distribution as defined by Sections 1 through 9 of this document.
24 |
25 | "Licensor" shall mean the copyright owner or entity authorized by
26 | the copyright owner that is granting the License.
27 |
28 | "Legal Entity" shall mean the union of the acting entity and all
29 | other entities that control, are controlled by, or are under common
30 | control with that entity. For the purposes of this definition,
31 | "control" means (i) the power, direct or indirect, to cause the
32 | direction or management of such entity, whether by contract or
33 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
34 | outstanding shares, or (iii) beneficial ownership of such entity.
35 |
36 | "You" (or "Your") shall mean an individual or Legal Entity
37 | exercising permissions granted by this License.
38 |
39 | "Source" form shall mean the preferred form for making modifications,
40 | including but not limited to software source code, documentation
41 | source, and configuration files.
42 |
43 | "Object" form shall mean any form resulting from mechanical
44 | transformation or translation of a Source form, including but
45 | not limited to compiled object code, generated documentation,
46 | and conversions to other media types.
47 |
48 | "Work" shall mean the work of authorship, whether in Source or
49 | Object form, made available under the License, as indicated by a
50 | copyright notice that is included in or attached to the work
51 | (an example is provided in the Appendix below).
52 |
53 | "Derivative Works" shall mean any work, whether in Source or Object
54 | form, that is based on (or derived from) the Work and for which the
55 | editorial revisions, annotations, elaborations, or other modifications
56 | represent, as a whole, an original work of authorship. For the purposes
57 | of this License, Derivative Works shall not include works that remain
58 | separable from, or merely link (or bind by name) to the interfaces of,
59 | the Work and Derivative Works thereof.
60 |
61 | "Contribution" shall mean any work of authorship, including
62 | the original version of the Work and any modifications or additions
63 | to that Work or Derivative Works thereof, that is intentionally
64 | submitted to Licensor for inclusion in the Work by the copyright owner
65 | or by an individual or Legal Entity authorized to submit on behalf of
66 | the copyright owner. For the purposes of this definition, "submitted"
67 | means any form of electronic, verbal, or written communication sent
68 | to the Licensor or its representatives, including but not limited to
69 | communication on electronic mailing lists, source code control systems,
70 | and issue tracking systems that are managed by, or on behalf of, the
71 | Licensor for the purpose of discussing and improving the Work, but
72 | excluding communication that is conspicuously marked or otherwise
73 | designated in writing by the copyright owner as "Not a Contribution."
74 |
75 | "Contributor" shall mean Licensor and any individual or Legal Entity
76 | on behalf of whom a Contribution has been received by Licensor and
77 | subsequently incorporated within the Work.
78 |
79 | 2. Grant of Copyright License. Subject to the terms and conditions of
80 | this License, each Contributor hereby grants to You a perpetual,
81 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
82 | copyright license to reproduce, prepare Derivative Works of,
83 | publicly display, publicly perform, sublicense, and distribute the
84 | Work and such Derivative Works in Source or Object form.
85 |
86 | 3. Grant of Patent License. Subject to the terms and conditions of
87 | this License, each Contributor hereby grants to You a perpetual,
88 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
89 | (except as stated in this section) patent license to make, have made,
90 | use, offer to sell, sell, import, and otherwise transfer the Work,
91 | where such license applies only to those patent claims licensable
92 | by such Contributor that are necessarily infringed by their
93 | Contribution(s) alone or by combination of their Contribution(s)
94 | with the Work to which such Contribution(s) was submitted. If You
95 | institute patent litigation against any entity (including a
96 | cross-claim or counterclaim in a lawsuit) alleging that the Work
97 | or a Contribution incorporated within the Work constitutes direct
98 | or contributory patent infringement, then any patent licenses
99 | granted to You under this License for that Work shall terminate
100 | as of the date such litigation is filed.
101 |
102 | 4. Redistribution. You may reproduce and distribute copies of the
103 | Work or Derivative Works thereof in any medium, with or without
104 | modifications, and in Source or Object form, provided that You
105 | meet the following conditions:
106 |
107 | (a) You must give any other recipients of the Work or
108 | Derivative Works a copy of this License; and
109 |
110 | (b) You must cause any modified files to carry prominent notices
111 | stating that You changed the files; and
112 |
113 | (c) You must retain, in the Source form of any Derivative Works
114 | that You distribute, all copyright, patent, trademark, and
115 | attribution notices from the Source form of the Work,
116 | excluding those notices that do not pertain to any part of
117 | the Derivative Works; and
118 |
119 | (d) If the Work includes a "NOTICE" text file as part of its
120 | distribution, then any Derivative Works that You distribute must
121 | include a readable copy of the attribution notices contained
122 | within such NOTICE file, excluding those notices that do not
123 | pertain to any part of the Derivative Works, in at least one
124 | of the following places: within a NOTICE text file distributed
125 | as part of the Derivative Works; within the Source form or
126 | documentation, if provided along with the Derivative Works; or,
127 | within a display generated by the Derivative Works, if and
128 | wherever such third-party notices normally appear. The contents
129 | of the NOTICE file are for informational purposes only and
130 | do not modify the License. You may add Your own attribution
131 | notices within Derivative Works that You distribute, alongside
132 | or as an addendum to the NOTICE text from the Work, provided
133 | that such additional attribution notices cannot be construed
134 | as modifying the License.
135 |
136 | You may add Your own copyright statement to Your modifications and
137 | may provide additional or different license terms and conditions
138 | for use, reproduction, or distribution of Your modifications, or
139 | for any such Derivative Works as a whole, provided Your use,
140 | reproduction, and distribution of the Work otherwise complies with
141 | the conditions stated in this License.
142 |
143 | 5. Submission of Contributions. Unless You explicitly state otherwise,
144 | any Contribution intentionally submitted for inclusion in the Work
145 | by You to the Licensor shall be under the terms and conditions of
146 | this License, without any additional terms or conditions.
147 | Notwithstanding the above, nothing herein shall supersede or modify
148 | the terms of any separate license agreement you may have executed
149 | with Licensor regarding such Contributions.
150 |
151 | 6. Trademarks. This License does not grant permission to use the trade
152 | names, trademarks, service marks, or product names of the Licensor,
153 | except as required for reasonable and customary use in describing the
154 | origin of the Work and reproducing the content of the NOTICE file.
155 |
156 | 7. Disclaimer of Warranty. Unless required by applicable law or
157 | agreed to in writing, Licensor provides the Work (and each
158 | Contributor provides its Contributions) on an "AS IS" BASIS,
159 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
160 | implied, including, without limitation, any warranties or conditions
161 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
162 | PARTICULAR PURPOSE. You are solely responsible for determining the
163 | appropriateness of using or redistributing the Work and assume any
164 | risks associated with Your exercise of permissions under this License.
165 |
166 | 8. Limitation of Liability. In no event and under no legal theory,
167 | whether in tort (including negligence), contract, or otherwise,
168 | unless required by applicable law (such as deliberate and grossly
169 | negligent acts) or agreed to in writing, shall any Contributor be
170 | liable to You for damages, including any direct, indirect, special,
171 | incidental, or consequential damages of any character arising as a
172 | result of this License or out of the use or inability to use the
173 | Work (including but not limited to damages for loss of goodwill,
174 | work stoppage, computer failure or malfunction, or any and all
175 | other commercial damages or losses), even if such Contributor
176 | has been advised of the possibility of such damages.
177 |
178 | 9. Accepting Warranty or Additional Liability. While redistributing
179 | the Work or Derivative Works thereof, You may choose to offer,
180 | and charge a fee for, acceptance of support, warranty, indemnity,
181 | or other liability obligations and/or rights consistent with this
182 | License. However, in accepting such obligations, You may act only
183 | on Your own behalf and on Your sole responsibility, not on behalf
184 | of any other Contributor, and only if You agree to indemnify,
185 | defend, and hold each Contributor harmless for any liability
186 | incurred by, or claims asserted against, such Contributor by reason
187 | of your accepting any such warranty or additional liability.
188 |
189 | END OF TERMS AND CONDITIONS
190 |
191 |
--------------------------------------------------------------------------------
/libsensors/SensorBase.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 |
25 | #include
26 |
27 | #include
28 |
29 | #include "SensorBase.h"
30 |
31 | /*****************************************************************************/
32 |
33 | SensorBase::SensorBase(
34 | const char* dev_name,
35 | const char* data_name)
36 | : dev_name(dev_name), data_name(data_name),
37 | dev_fd(-1), data_fd(-1)
38 | {
39 | data_fd = openInput(data_name);
40 | }
41 |
42 | SensorBase::~SensorBase() {
43 | if (data_fd >= 0) {
44 | close(data_fd);
45 | }
46 | if (dev_fd >= 0) {
47 | close(dev_fd);
48 | }
49 | }
50 |
51 | int SensorBase::open_device() {
52 | if (dev_fd<0 && dev_name) {
53 | dev_fd = open(dev_name, O_RDONLY);
54 | ALOGE_IF(dev_fd<0, "Couldn't open %s (%s)", dev_name, strerror(errno));
55 | }
56 | return 0;
57 | }
58 |
59 | int SensorBase::close_device() {
60 | if (dev_fd >= 0) {
61 | close(dev_fd);
62 | dev_fd = -1;
63 | }
64 | return 0;
65 | }
66 |
67 | int SensorBase::getFd() const {
68 | return data_fd;
69 | }
70 |
71 | int SensorBase::setDelay(int32_t handle, int64_t ns) {
72 | return 0;
73 | }
74 |
75 | bool SensorBase::hasPendingEvents() const {
76 | return false;
77 | }
78 |
79 | int64_t SensorBase::getTimestamp() {
80 | struct timespec t;
81 | t.tv_sec = t.tv_nsec = 0;
82 | clock_gettime(CLOCK_MONOTONIC, &t);
83 | return int64_t(t.tv_sec)*1000000000LL + t.tv_nsec;
84 | }
85 |
86 | int SensorBase::openInput(const char* inputName) {
87 | int fd = -1;
88 | const char *dirname = "/dev/input";
89 | char devname[PATH_MAX];
90 | char *filename;
91 | DIR *dir;
92 | struct dirent *de;
93 | dir = opendir(dirname);
94 | if(dir == NULL)
95 | return -1;
96 | strcpy(devname, dirname);
97 | filename = devname + strlen(devname);
98 | *filename++ = '/';
99 | while((de = readdir(dir))) {
100 | if(de->d_name[0] == '.' &&
101 | (de->d_name[1] == '\0' ||
102 | (de->d_name[1] == '.' && de->d_name[2] == '\0')))
103 | continue;
104 | strcpy(filename, de->d_name);
105 | fd = open(devname, O_RDONLY);
106 | if (fd>=0) {
107 | char name[80];
108 | if (ioctl(fd, EVIOCGNAME(sizeof(name) - 1), &name) < 1) {
109 | name[0] = '\0';
110 | }
111 | if (!strcmp(name, inputName)) {
112 | break;
113 | } else {
114 | close(fd);
115 | fd = -1;
116 | }
117 | }
118 | }
119 | closedir(dir);
120 | ALOGE_IF(fd<0, "couldn't find '%s' input device", inputName);
121 | return fd;
122 | }
123 |
--------------------------------------------------------------------------------
/libsensors/SensorBase.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef ANDROID_SENSOR_BASE_H
18 | #define ANDROID_SENSOR_BASE_H
19 |
20 | #include
21 | #include
22 | #include
23 | #include
24 |
25 |
26 | /*****************************************************************************/
27 |
28 | struct sensors_event_t;
29 |
30 | class SensorBase {
31 | protected:
32 | const char* dev_name;
33 | const char* data_name;
34 | int dev_fd;
35 | int data_fd;
36 |
37 | static int openInput(const char* inputName);
38 | static int64_t getTimestamp();
39 |
40 |
41 | static int64_t timevalToNano(timeval const& t) {
42 | return t.tv_sec*1000000000LL + t.tv_usec*1000;
43 | }
44 |
45 | int open_device();
46 | int close_device();
47 |
48 | public:
49 | SensorBase(
50 | const char* dev_name,
51 | const char* data_name);
52 |
53 | virtual ~SensorBase();
54 |
55 | virtual int readEvents(sensors_event_t* data, int count) = 0;
56 | virtual bool hasPendingEvents() const;
57 | virtual int getFd() const;
58 | virtual int setDelay(int32_t handle, int64_t ns);
59 | virtual int enable(int32_t handle, int enabled) = 0;
60 | };
61 |
62 | /*****************************************************************************/
63 |
64 | #endif // ANDROID_SENSOR_BASE_H
65 |
--------------------------------------------------------------------------------
/libsensors/nusensors.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | #define LOG_NDEBUG 0
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 |
23 | #include
24 | #include
25 |
26 | #include
27 |
28 | #include
29 | #include
30 |
31 | #include "nusensors.h"
32 | #include "Kxtf9.h"
33 | /*****************************************************************************/
34 |
35 | struct sensors_poll_context_t {
36 | struct sensors_poll_device_t device; // must be first
37 |
38 | sensors_poll_context_t();
39 | ~sensors_poll_context_t();
40 | int activate(int handle, int enabled);
41 | int setDelay(int handle, int64_t ns);
42 | int pollEvents(sensors_event_t* data, int count);
43 |
44 | private:
45 | enum {
46 | kxtf9 = 0,
47 | numSensorDrivers,
48 | numFds,
49 | };
50 |
51 | static const size_t wake = numFds - 1;
52 | static const char WAKE_MESSAGE = 'W';
53 | struct pollfd mPollFds[numFds];
54 | int mWritePipeFd;
55 | SensorBase* mSensors[numSensorDrivers];
56 |
57 | int handleToDriver(int handle) const {
58 | switch (handle) {
59 | case ID_A:
60 | return kxtf9;
61 | }
62 | return -EINVAL;
63 | }
64 | };
65 |
66 | /*****************************************************************************/
67 |
68 | sensors_poll_context_t::sensors_poll_context_t()
69 | {
70 | mSensors[kxtf9] = new Kxtf9Sensor();
71 | mPollFds[kxtf9].fd = mSensors[kxtf9]->getFd();
72 | mPollFds[kxtf9].events = POLLIN;
73 | mPollFds[kxtf9].revents = 0;
74 |
75 | int wakeFds[2];
76 | int result = pipe(wakeFds);
77 | ALOGE_IF(result<0, "error creating wake pipe (%s)", strerror(errno));
78 | fcntl(wakeFds[0], F_SETFL, O_NONBLOCK);
79 | fcntl(wakeFds[1], F_SETFL, O_NONBLOCK);
80 | mWritePipeFd = wakeFds[1];
81 |
82 | mPollFds[wake].fd = wakeFds[0];
83 | mPollFds[wake].events = POLLIN;
84 | mPollFds[wake].revents = 0;
85 | }
86 |
87 | sensors_poll_context_t::~sensors_poll_context_t() {
88 | for (int i=0 ; ienable(handle, enabled);
100 | if (enabled && !err) {
101 | const char wakeMessage(WAKE_MESSAGE);
102 | int result = write(mWritePipeFd, &wakeMessage, 1);
103 | ALOGE_IF(result<0, "error sending wake message (%s)", strerror(errno));
104 | }
105 | return err;
106 | }
107 |
108 | int sensors_poll_context_t::setDelay(int handle, int64_t ns) {
109 |
110 | int index = handleToDriver(handle);
111 | if (index < 0) return index;
112 | return mSensors[index]->setDelay(handle, ns);
113 | }
114 |
115 | int sensors_poll_context_t::pollEvents(sensors_event_t* data, int count)
116 | {
117 | int nbEvents = 0;
118 | int n = 0;
119 |
120 | do {
121 | // see if we have some leftover from the last poll()
122 | for (int i=0 ; count && ihasPendingEvents())) {
125 | int nb = sensor->readEvents(data, count);
126 | if (nb < count) {
127 | // no more data for this sensor
128 | mPollFds[i].revents = 0;
129 | }
130 | count -= nb;
131 | nbEvents += nb;
132 | data += nb;
133 | }
134 | }
135 |
136 | if (count) {
137 | // we still have some room, so try to see if we can get
138 | // some events immediately or just wait if we don't have
139 | // anything to return
140 | n = poll(mPollFds, numFds, nbEvents ? 0 : -1);
141 | if (n<0) {
142 | ALOGE("poll() failed (%s)", strerror(errno));
143 | return -errno;
144 | }
145 | if (mPollFds[wake].revents & POLLIN) {
146 | char msg;
147 | int result = read(mPollFds[wake].fd, &msg, 1);
148 | ALOGE_IF(result<0, "error reading from wake pipe (%s)", strerror(errno));
149 | ALOGE_IF(msg != WAKE_MESSAGE, "unknown message on wake queue (0x%02x)", int(msg));
150 | mPollFds[wake].revents = 0;
151 | }
152 | }
153 | // if we have events and space, go read them
154 | } while (n && count);
155 |
156 | return nbEvents;
157 | }
158 |
159 | /*****************************************************************************/
160 |
161 | static int poll__close(struct hw_device_t *dev)
162 | {
163 | sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev;
164 | if (ctx) {
165 | delete ctx;
166 | }
167 | return 0;
168 | }
169 |
170 | static int poll__activate(struct sensors_poll_device_t *dev,
171 | int handle, int enabled) {
172 | sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev;
173 | return ctx->activate(handle, enabled);
174 | }
175 |
176 | static int poll__setDelay(struct sensors_poll_device_t *dev,
177 | int handle, int64_t ns) {
178 | sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev;
179 | return ctx->setDelay(handle, ns);
180 | }
181 |
182 | static int poll__poll(struct sensors_poll_device_t *dev,
183 | sensors_event_t* data, int count) {
184 | sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev;
185 | return ctx->pollEvents(data, count);
186 | }
187 |
188 | /*****************************************************************************/
189 |
190 | int init_nusensors(hw_module_t const* module, hw_device_t** device)
191 | {
192 | int status = -EINVAL;
193 |
194 | sensors_poll_context_t *dev = new sensors_poll_context_t();
195 | memset(&dev->device, 0, sizeof(sensors_poll_device_t));
196 |
197 | dev->device.common.tag = HARDWARE_DEVICE_TAG;
198 | dev->device.common.version = 0;
199 | dev->device.common.module = const_cast(module);
200 | dev->device.common.close = poll__close;
201 | dev->device.activate = poll__activate;
202 | dev->device.setDelay = poll__setDelay;
203 | dev->device.poll = poll__poll;
204 |
205 | *device = &dev->device.common;
206 | status = 0;
207 | return status;
208 | }
209 |
--------------------------------------------------------------------------------
/libsensors/nusensors.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef ANDROID_SENSORS_H
18 | #define ANDROID_SENSORS_H
19 |
20 | #include
21 | #include
22 | #include
23 | #include
24 |
25 | #include
26 |
27 | #include
28 | #include
29 |
30 | __BEGIN_DECLS
31 |
32 | /*****************************************************************************/
33 |
34 | int init_nusensors(hw_module_t const* module, hw_device_t** device);
35 |
36 | /*****************************************************************************/
37 |
38 | #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
39 |
40 | #define ID_A (0)
41 |
42 | /*****************************************************************************/
43 |
44 | /*
45 | * The SENSORS Module
46 | */
47 |
48 | /*****************************************************************************/
49 |
50 | #define KXTF9_DEVICE_NAME "/dev"
51 |
52 | #define EVENT_TYPE_ACCEL_X ABS_X
53 | #define EVENT_TYPE_ACCEL_Y ABS_Y
54 | #define EVENT_TYPE_ACCEL_Z ABS_Z
55 | #define EVENT_TYPE_ACCEL_STATUS ABS_WHEEL
56 |
57 | // 1000 LSG = 1G
58 | #define LSG (1000.0f)
59 |
60 |
61 | // conversion of acceleration data to SI units (m/s^2)
62 | #define CONVERT_A (GRAVITY_EARTH / LSG)
63 | #define CONVERT_A_X (CONVERT_A)
64 | #define CONVERT_A_Y (CONVERT_A)
65 | #define CONVERT_A_Z (CONVERT_A)
66 |
67 | #define SENSOR_STATE_MASK (0x7FFF)
68 |
69 | /*****************************************************************************/
70 |
71 | __END_DECLS
72 |
73 | #endif // ANDROID_SENSORS_H
74 |
--------------------------------------------------------------------------------
/libsensors/sensors.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #include
18 |
19 | #include "nusensors.h"
20 |
21 | /*****************************************************************************/
22 |
23 | /*
24 | * The SENSORS Module
25 | */
26 |
27 | /*
28 | * the AK8973 has a 8-bit ADC but the firmware seems to average 16 samples,
29 | * or at least makes its calibration on 12-bits values. This increases the
30 | * resolution by 4 bits.
31 | */
32 |
33 | static const struct sensor_t sSensorList[] = {
34 | { "KXTF9 3-axis Accelerometer",
35 | "Kionix",
36 | 1, SENSORS_HANDLE_BASE+ID_A,
37 | SENSOR_TYPE_ACCELEROMETER, 8.0f*9.81f, (8.0f*9.81f)/2048.0f, 0.57f, 0, { } },
38 | };
39 |
40 | static int open_sensors(const struct hw_module_t* module, const char* name,
41 | struct hw_device_t** device);
42 |
43 | static int sensors__get_sensors_list(struct sensors_module_t* module,
44 | struct sensor_t const** list)
45 | {
46 | *list = sSensorList;
47 | return ARRAY_SIZE(sSensorList);
48 | }
49 |
50 | static struct hw_module_methods_t sensors_module_methods = {
51 | .open = open_sensors
52 | };
53 |
54 | struct sensors_module_t HAL_MODULE_INFO_SYM = {
55 | .common = {
56 | .tag = HARDWARE_MODULE_TAG,
57 | .version_major = 1,
58 | .version_minor = 0,
59 | .id = SENSORS_HARDWARE_MODULE_ID,
60 | .name = "Barnes and Noble Encore Sensors Module",
61 | .author = "Austen Dicken",
62 | .methods = &sensors_module_methods,
63 | },
64 | .get_sensors_list = sensors__get_sensors_list
65 | };
66 |
67 | /*****************************************************************************/
68 |
69 | static int open_sensors(const struct hw_module_t* module, const char* name,
70 | struct hw_device_t** device)
71 | {
72 | return init_nusensors(module, device);
73 | }
74 |
--------------------------------------------------------------------------------
/log_battery_data.sh:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 |
3 | # log battery data
4 | while :;
5 | do
6 | cat /sys/bus/i2c/drivers/max17042/1-0036/histdata > /rom/max17042.bin
7 | sleep 3600
8 | done
9 |
10 |
--------------------------------------------------------------------------------
/overlay/frameworks/base/core/res/res/values-sw600dp-land/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
21 |
22 |
23 | - @drawable/ic_lockscreen_unlock
24 | - @null
25 | - @null
26 | - @null
27 |
28 |
29 |
30 | - @string/description_target_unlock
31 | - @null
32 | - @null
33 | - @null
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/overlay/frameworks/base/core/res/res/values/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
21 |
22 |
23 | - @drawable/ic_lockscreen_unlock
24 | - @null
25 | - @null
26 | - @null
27 |
28 |
29 |
30 | - @string/description_target_unlock
31 | - @null
32 | - @null
33 | - @null
34 |
35 |
36 |
37 |
38 | - @string/reboot_reboot
39 | - @string/reboot_recovery
40 |
41 |
42 |
44 |
45 |
46 | - recovery
47 |
48 |
49 |
--------------------------------------------------------------------------------
/overlay/frameworks/base/core/res/res/values/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
22 |
23 |
24 |
25 | false
26 |
27 |
28 | false
29 |
30 |
32 |
33 |
36 |
38 |
41 |
42 |
43 | - "wifi,1,1,1,-1,true"
44 | - "bluetooth,7,7,0,-1,true"
45 |
46 |
47 |
48 |
51 |
53 |
54 | - "1,1"
55 | - "7,1"
56 |
57 |
58 |
59 |
60 |
61 | - 0
62 | - 0
63 | - 0
64 | - 0
65 |
66 |
67 |
68 |
69 | - 0
70 | - 0
71 | - 0
72 | - 0
73 |
74 |
75 |
76 |
77 | - 0
78 |
79 |
80 |
81 |
82 | - 0
83 | - 0
84 | - 0
85 | - 0
86 |
87 |
88 |
89 |
90 | - 0
91 | - 0
92 | - 0
93 | - 0
94 | - 0
95 | - 0
96 |
97 |
98 |
99 |
100 | - 0
101 | - 0
102 | - 0
103 | - 0
104 |
105 |
106 |
108 | true
109 |
110 |
111 | true
112 |
113 |
114 | true
115 |
116 |
117 | true
118 |
119 |
120 |
--------------------------------------------------------------------------------
/overlay/frameworks/base/core/res/res/xml/eri.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
19 |
20 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/overlay/frameworks/base/core/res/res/xml/power_profile.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
19 | - 0
20 | - 55
21 | - 142
22 | - 1
23 | - 115
24 | - 4
25 | - 130
26 | - 104
27 | - 75
28 | - 75
29 | - 300
30 |
31 | - 70
32 | - 170
33 |
34 |
35 | 3
36 | 3
37 |
38 |
40 |
41 | 925000
42 | 800000
43 | 600000
44 | 300000
45 |
46 |
47 | - 4
48 |
49 |
50 | 300
51 | 280
52 | 200
53 | 160
54 |
55 |
56 | - 4000
57 |
58 |
--------------------------------------------------------------------------------
/overlay/frameworks/base/core/res/res/xml/storage_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
34 |
35 |
36 |
37 |
42 |
43 |
48 |
49 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/overlay/frameworks/base/packages/SystemUI/res/values/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
22 |
23 |
24 |
26 | true
27 |
28 |
--------------------------------------------------------------------------------
/overlay/packages/apps/Settings/res/values/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
19 |
21 | true
22 |
23 |
25 | true
26 |
27 |
28 | true
29 |
30 |
31 |
--------------------------------------------------------------------------------
/overlay/packages/apps/Trebuchet/res/values/config.xml:
--------------------------------------------------------------------------------
1 |
2 | true
3 |
4 |
5 | 11
6 | 10
7 |
8 |
9 | true
10 |
11 |
--------------------------------------------------------------------------------
/power/Android.mk:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2012 The Android Open Source Project
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 |
16 | LOCAL_PATH := $(call my-dir)
17 |
18 | # HAL module implemenation stored in
19 | # hw/..so
20 | include $(CLEAR_VARS)
21 |
22 | LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
23 | LOCAL_SHARED_LIBRARIES := liblog libcutils
24 | LOCAL_SRC_FILES := power.c
25 | LOCAL_MODULE := power.$(TARGET_BOOTLOADER_BOARD_NAME)
26 | LOCAL_MODULE_TAGS := optional
27 | include $(BUILD_SHARED_LIBRARY)
28 |
--------------------------------------------------------------------------------
/power/power.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | #include
17 | #include
18 |
19 | #define LOG_TAG "Encore PowerHAL"
20 | #include
21 |
22 | #include
23 | #include
24 |
25 | #define PIN_CORE_CLK_CTRL "/sys/devices/platform/omap/pvrsrvkm.0/pin_core_clk"
26 |
27 | static void encore_power_init(struct power_module *module)
28 | {
29 | }
30 |
31 | static void encore_power_set_interactive(struct power_module *module, int on)
32 | {
33 | FILE *pin_core_clk_fp;
34 |
35 | /* Enable/disable pinning the memory bus clock */
36 | ALOGI("Setting pin_core_clk to %d", on);
37 | if (!(pin_core_clk_fp = fopen(PIN_CORE_CLK_CTRL, "w"))) {
38 | ALOGE("Failed to open " PIN_CORE_CLK_CTRL ": %d", errno);
39 | return;
40 | }
41 | fprintf(pin_core_clk_fp, "%d\n", on ? 1 : 0);
42 | fclose(pin_core_clk_fp);
43 | }
44 |
45 | static void encore_power_hint(struct power_module *module, power_hint_t hint,
46 | void *data) {
47 | switch (hint) {
48 | default:
49 | break;
50 | }
51 | }
52 |
53 | static struct hw_module_methods_t encore_power_module_methods = {
54 | .open = NULL,
55 | };
56 |
57 | struct power_module HAL_MODULE_INFO_SYM = {
58 | .common = {
59 | .tag = HARDWARE_MODULE_TAG,
60 | .module_api_version = POWER_MODULE_API_VERSION_0_2,
61 | .hal_api_version = HARDWARE_HAL_API_VERSION,
62 | .id = POWER_HARDWARE_MODULE_ID,
63 | .name = "Encore Power HAL",
64 | .author = "NookieDevs",
65 | .methods = &encore_power_module_methods,
66 | },
67 |
68 | .init = encore_power_init,
69 | .setInteractive = encore_power_set_interactive,
70 | .powerHint = encore_power_hint,
71 | };
72 |
--------------------------------------------------------------------------------
/prebuilt/alsa/alsa.omap3.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CyanogenMod/android_device_bn_encore/b831ae56fe075e8bce7ae7853a76f771e4cca81c/prebuilt/alsa/alsa.omap3.so
--------------------------------------------------------------------------------
/prebuilt/alsa/conf/cards/aliases.conf:
--------------------------------------------------------------------------------
1 | #
2 | # Define aliases for various drivers
3 | #
4 |
5 | YMF724 cards.YMF744
6 | YMF724F cards.YMF744
7 | YMF740 cards.YMF744
8 | YMF740C cards.YMF744
9 | YMF754 cards.YMF744
10 | CMIPCI cards.CMI8338
11 | CMI8738 cards.CMI8338
12 | CMI8738-SWIEC cards.CMI8338-SWIEC
13 | CMI8738-MC4 cards.CMI8738-MC6
14 | 'E-mu APS' cards.EMU10K1
15 | 'GUS MAX' cards.GUS
16 | 'GUS ACE' cards.GUS
17 | 'GUS Extreme' cards.GUS
18 | 'AMD InterWave' cards.GUS
19 | 'Dynasonic 3-D' cards.GUS
20 | 'InterWave STB' cards.GUS
21 | au8810 cards.AU8810
22 | au8820 cards.AU8820
23 | au8830 cards.AU8830
24 | Prodigy71 cards.Aureon71
25 | Prodigy71LT cards.Aureon71
26 | Prodigy71HIFI cards.Aureon71
27 | Aureon71Univ cards.Aureon71
28 | VIA82XX-MODEM cards.ICH-MODEM
29 | 'MPU-401 UART' cards.MPU-401
30 | 'VX222/Old' cards.VX222
31 | 'VX222/v2' cards.VX222
32 | 'VX222/Mic' cards.VX222
33 | 'CMI8330/C3D' cards.CMI8330
34 | 'SB AWE' cards.SBAWE
35 | 'SB Pro' cards.SBPro
36 | 'PMac Burgundy' cards.PMac
37 | 'PMac DACA' cards.PMac
38 | 'PMac Tumbler' cards.PMac
39 | 'PMac Snapper' cards.PMac
40 | 'PMac Screamer' cards.PMac
41 | 'PMac AWACS' cards.PMac
42 | 'PMac Toonie' cards.PMacToonie
43 | AppleOnbdAudio cards.PMacToonie
44 | 'USB US-X2Y' cards.US-X2Y
45 | 'Serial MIDI' cards.SerialMIDI
46 | 'Prodif Plus' cards.ProdifPlus
47 | ESM1 cards.ES1968
48 | ES1978 cards.ES1968
49 | Allegro cards.Maestro3
50 | Canyon3D-2 cards.Maestro3
51 | Azalia cards.HDA-Intel
52 | aaci-pl041 cards.AACI
53 | AV66 cards.CMI8788
54 | AV100 cards.CMI8788
55 | AV200 cards.CMI8788
56 | CMI8786 cards.CMI8788
57 | CMI8787 cards.CMI8788
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/prebuilt/alsa/conf/pcm/center_lfe.conf:
--------------------------------------------------------------------------------
1 | #
2 | # Hardware output from center & lfe speakers
3 | #
4 |
5 | pcm.!center_lfe {
6 | @args [ CARD DEV ]
7 | @args.CARD {
8 | type string
9 | default {
10 | @func getenv
11 | vars [
12 | ALSA_CENTER_LFE_CARD
13 | ALSA_PCM_CARD
14 | ALSA_CARD
15 | ]
16 | default {
17 | @func refer
18 | name defaults.pcm.center_lfe.card
19 | }
20 | }
21 | }
22 | @args.DEV {
23 | type integer
24 | default {
25 | @func igetenv
26 | vars [
27 | ALSA_CENTER_LFE_DEVICE
28 | ]
29 | default {
30 | @func refer
31 | name defaults.pcm.center_lfe.device
32 | }
33 | }
34 | }
35 | type empty
36 | slave.pcm {
37 | @func refer
38 | name {
39 | @func concat
40 | strings [
41 | "cards."
42 | {
43 | @func card_driver
44 | card $CARD
45 | }
46 | ".pcm.center_lfe." $DEV ":CARD=" $CARD
47 | ]
48 | }
49 | }
50 | hint {
51 | show {
52 | @func refer
53 | name defaults.namehint.basic
54 | }
55 | description "Center and Subwoofer speakers"
56 | device $DEV
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/prebuilt/alsa/conf/pcm/default.conf:
--------------------------------------------------------------------------------
1 | #
2 | # Default output
3 | #
4 |
5 | pcm.!default {
6 | @args [ CARD ]
7 | @args.CARD {
8 | type string
9 | default {
10 | @func getenv
11 | vars [
12 | ALSA_PCM_CARD
13 | ALSA_CARD
14 | ]
15 | default {
16 | @func refer
17 | name defaults.pcm.card
18 | }
19 | }
20 | }
21 | type empty
22 | slave.pcm {
23 | # use card-specific definition if exists
24 | @func refer
25 | name {
26 | @func concat
27 | strings [
28 | "cards."
29 | {
30 | @func card_driver
31 | card $CARD
32 | }
33 | ".pcm.default:CARD=" $CARD
34 | ]
35 | }
36 | default {
37 | # use plughw as default
38 | type plug
39 | slave.pcm {
40 | type hw
41 | card $CARD
42 | }
43 | hint.device 0
44 | }
45 | }
46 | hint {
47 | description "Default Audio Device"
48 | device_output {
49 | @func refer
50 | name defaults.pcm.dmix.device
51 | }
52 | device_input {
53 | @func refer
54 | name defaults.pcm.dsnoop.device
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/prebuilt/alsa/conf/pcm/dmix.conf:
--------------------------------------------------------------------------------
1 | #
2 | # dmix output
3 | #
4 |
5 | pcm.!dmix {
6 | @args [ CARD DEV SUBDEV FORMAT RATE ]
7 | @args.CARD {
8 | type string
9 | default {
10 | @func refer
11 | name defaults.pcm.dmix.card
12 | }
13 | }
14 | @args.DEV {
15 | type integer
16 | default {
17 | @func refer
18 | name defaults.pcm.dmix.device
19 | }
20 | }
21 | @args.SUBDEV {
22 | type integer
23 | default 0
24 | }
25 | @args.FORMAT {
26 | type string
27 | default {
28 | @func refer
29 | name defaults.pcm.dmix.format
30 | }
31 | }
32 | @args.RATE {
33 | type integer
34 | default {
35 | @func refer
36 | name defaults.pcm.dmix.rate
37 | }
38 | }
39 | type dmix
40 | ipc_key {
41 | @func refer
42 | name defaults.pcm.ipc_key
43 | }
44 | ipc_gid {
45 | @func refer
46 | name defaults.pcm.ipc_gid
47 | }
48 | ipc_perm {
49 | @func refer
50 | name defaults.pcm.ipc_perm
51 | }
52 | slave {
53 | pcm {
54 | type hw
55 | card $CARD
56 | device $DEV
57 | subdevice $SUBDEV
58 | }
59 | format $FORMAT
60 | rate $RATE
61 | period_size {
62 | @func refer
63 | name {
64 | @func concat
65 | strings [
66 | "defaults.dmix."
67 | {
68 | @func card_driver
69 | card $CARD
70 | }
71 | ".period_size"
72 | ]
73 | }
74 | default 1024
75 | }
76 | period_time {
77 | @func refer
78 | name {
79 | @func concat
80 | strings [
81 | "defaults.dmix."
82 | {
83 | @func card_driver
84 | card $CARD
85 | }
86 | ".period_time"
87 | ]
88 | }
89 | default -1
90 | }
91 | periods {
92 | @func refer
93 | name {
94 | @func concat
95 | strings [
96 | "defaults.dmix."
97 | {
98 | @func card_driver
99 | card $CARD
100 | }
101 | ".periods"
102 | ]
103 | }
104 | default 16
105 | }
106 | }
107 | hint {
108 | show {
109 | @func refer
110 | name defaults.namehint.extended
111 | }
112 | description "Direct sample mixing device"
113 | device $DEV
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/prebuilt/alsa/conf/pcm/dpl.conf:
--------------------------------------------------------------------------------
1 | pcm.!dpl {
2 | @args [ SLAVE ]
3 | @args.SLAVE {
4 | type string
5 | }
6 | type route
7 | slave.pcm $SLAVE
8 | slave.channels 2
9 | # input: FL/FR/SL/SR/C/LFE
10 | # S=SL+SR, LFE not used
11 | ttable.0.0 1
12 | ttable.1.1 1
13 | ttable.2.0 0.707
14 | ttable.2.1 -0.707
15 | ttable.3.0 0.707
16 | ttable.3.1 -0.707
17 | ttable.4.0 0.707
18 | ttable.4.1 0.707
19 | ttable.5.0 0
20 | ttable.5.1 0
21 | }
22 |
23 | pcm.!dpl2 {
24 | @args [SLAVE]
25 | @args.SLAVE {
26 | type string
27 | }
28 | type route
29 | slave.pcm $SLAVE
30 | slave.channels 2
31 | # input: FL/FR/SL/SR/C/LFE
32 | # LFE not used
33 | ttable.0.0 1
34 | ttable.1.1 1
35 | ttable.2.0 0.866
36 | ttable.2.1 -0.5
37 | ttable.3.0 0.5
38 | ttable.3.1 -0.866
39 | ttable.4.0 0.707
40 | ttable.4.1 0.707
41 | ttable.5.0 0
42 | ttable.5.1 0
43 | }
44 |
--------------------------------------------------------------------------------
/prebuilt/alsa/conf/pcm/dsnoop.conf:
--------------------------------------------------------------------------------
1 | #
2 | # dsnoop
3 | #
4 |
5 | pcm.!dsnoop {
6 | @args [ CARD DEV SUBDEV FORMAT RATE ]
7 | @args.CARD {
8 | type string
9 | default {
10 | @func refer
11 | name defaults.pcm.dsnoop.card
12 | }
13 | }
14 | @args.DEV {
15 | type integer
16 | default {
17 | @func refer
18 | name defaults.pcm.dsnoop.device
19 | }
20 | }
21 | @args.SUBDEV {
22 | type integer
23 | default 0
24 | }
25 | @args.FORMAT {
26 | type string
27 | default {
28 | @func refer
29 | name defaults.pcm.dmix.format
30 | }
31 | }
32 | @args.RATE {
33 | type integer
34 | default {
35 | @func refer
36 | name defaults.pcm.dmix.rate
37 | }
38 | }
39 | type dsnoop
40 | ipc_key {
41 | @func refer
42 | name defaults.pcm.ipc_key
43 | }
44 | ipc_gid {
45 | @func refer
46 | name defaults.pcm.ipc_gid
47 | }
48 | ipc_perm {
49 | @func refer
50 | name defaults.pcm.ipc_perm
51 | }
52 | slave {
53 | pcm {
54 | type hw
55 | card $CARD
56 | device $DEV
57 | subdevice $SUBDEV
58 | }
59 | format $FORMAT
60 | rate $RATE
61 | period_size {
62 | @func refer
63 | name {
64 | @func concat
65 | strings [
66 | "cards."
67 | {
68 | @func card_driver
69 | card $CARD
70 | }
71 | ".pcm.dsnoop.period_size"
72 | ]
73 | }
74 | default 1024
75 | }
76 | period_time {
77 | @func refer
78 | name {
79 | @func concat
80 | strings [
81 | "cards."
82 | {
83 | @func card_driver
84 | card $CARD
85 | }
86 | ".pcm.dsnoop.period_time"
87 | ]
88 | }
89 | default -1
90 | }
91 | periods {
92 | @func refer
93 | name {
94 | @func concat
95 | strings [
96 | "cards."
97 | {
98 | @func card_driver
99 | card $CARD
100 | }
101 | ".pcm.dsnoop.periods"
102 | ]
103 | }
104 | default 16
105 | }
106 | }
107 | hint {
108 | show {
109 | @func refer
110 | name defaults.namehint.extended
111 | }
112 | description "Direct sample snooping device"
113 | device $DEV
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/prebuilt/alsa/conf/pcm/front.conf:
--------------------------------------------------------------------------------
1 | #
2 | # Hardware output from front speakers
3 | #
4 |
5 | pcm.!front {
6 | @args [ CARD DEV ]
7 | @args.CARD {
8 | type string
9 | default {
10 | @func getenv
11 | vars [
12 | ALSA_FRONT_CARD
13 | ALSA_PCM_CARD
14 | ALSA_CARD
15 | ]
16 | default {
17 | @func refer
18 | name defaults.pcm.front.card
19 | }
20 | }
21 | }
22 | @args.DEV {
23 | type integer
24 | default {
25 | @func igetenv
26 | vars [
27 | ALSA_FRONT_DEVICE
28 | ]
29 | default {
30 | @func refer
31 | name defaults.pcm.front.device
32 | }
33 | }
34 | }
35 | type empty
36 | slave.pcm {
37 | @func refer
38 | name {
39 | @func concat
40 | strings [
41 | "cards."
42 | {
43 | @func card_driver
44 | card $CARD
45 | }
46 | ".pcm.front." $DEV ":CARD=" $CARD
47 | ]
48 | }
49 | }
50 | hint {
51 | show {
52 | @func refer
53 | name defaults.namehint.basic
54 | }
55 | description "Front speakers"
56 | device $DEV
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/prebuilt/alsa/conf/pcm/iec958.conf:
--------------------------------------------------------------------------------
1 | #
2 | # Hardware output from iec958
3 | #
4 |
5 | pcm.!iec958 {
6 | @args [ CARD DEV AES0 AES1 AES2 AES3 ]
7 | @args.CARD {
8 | type string
9 | default {
10 | @func getenv
11 | vars [
12 | ALSA_IEC958_CARD
13 | ALSA_PCM_CARD
14 | ALSA_CARD
15 | ]
16 | default {
17 | @func refer
18 | name defaults.pcm.iec958.card
19 | }
20 | }
21 | }
22 | @args.DEV {
23 | type integer
24 | default {
25 | @func igetenv
26 | vars [
27 | ALSA_IEC958_DEVICE
28 | ]
29 | default {
30 | @func refer
31 | name defaults.pcm.iec958.device
32 | }
33 | }
34 | }
35 | @args.AES0 {
36 | type integer
37 | # consumer, not-copyright, emphasis-none, mode=0
38 | default 0x04
39 | }
40 | @args.AES1 {
41 | type integer
42 | # original, PCM coder
43 | default 0x82
44 | }
45 | @args.AES2 {
46 | type integer
47 | # source and channel
48 | default 0x00
49 | }
50 | @args.AES3 {
51 | type integer
52 | # fs=48000Hz, clock accuracy=1000ppm
53 | default 0x02
54 | }
55 | type empty
56 | slave.pcm {
57 | @func refer
58 | name {
59 | @func concat
60 | strings [
61 | "cards."
62 | {
63 | @func card_driver
64 | card $CARD
65 | }
66 | ".pcm.iec958." $DEV ":"
67 | "CARD=" $CARD ","
68 | "AES0=" $AES0 ","
69 | "AES1=" $AES1 ","
70 | "AES2=" $AES2 ","
71 | "AES3=" $AES3
72 | ]
73 | }
74 | }
75 | hint {
76 | show {
77 | @func refer
78 | name defaults.namehint.basic
79 | }
80 | description "IEC958 (S/PDIF) Digital Audio Output"
81 | device $DEV
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/prebuilt/alsa/conf/pcm/modem.conf:
--------------------------------------------------------------------------------
1 | #
2 | # "raw" modem - phoneline
3 | #
4 |
5 | pcm.!phoneline {
6 | @args [ CARD DEV ]
7 | @args.CARD {
8 | type string
9 | default {
10 | @func getenv
11 | vars [
12 | ALSA_MODEM_CARD
13 | ALSA_PCM_CARD
14 | ALSA_CARD
15 | ]
16 | default {
17 | @func refer
18 | name defaults.pcm.modem.card
19 | }
20 | }
21 | }
22 | @args.DEV {
23 | type integer
24 | default {
25 | @func igetenv
26 | vars [
27 | ALSA_MODEM_DEVICE
28 | ]
29 | default {
30 | @func refer
31 | name defaults.pcm.modem.device
32 | }
33 | }
34 | }
35 | @func refer
36 | name {
37 | @func concat
38 | strings [
39 | "cards."
40 | {
41 | @func card_driver
42 | card $CARD
43 | }
44 | ".pcm.modem." $DEV ":CARD=" $CARD
45 | ]
46 | }
47 | hint.show off
48 | }
49 |
50 | #
51 | # "autohooked" modem
52 | #
53 |
54 | pcm.!modem {
55 | @args [ CARD DEV ]
56 | @args.CARD {
57 | type string
58 | default {
59 | @func getenv
60 | vars [
61 | ALSA_MODEM_CARD
62 | ALSA_PCM_CARD
63 | ALSA_CARD
64 | ]
65 | default {
66 | @func refer
67 | name defaults.pcm.modem.card
68 | }
69 | }
70 | }
71 | @args.DEV {
72 | type integer
73 | default {
74 | @func igetenv
75 | vars [
76 | ALSA_MODEM_DEVICE
77 | ]
78 | default {
79 | @func refer
80 | name defaults.pcm.modem.device
81 | }
82 | }
83 | }
84 | type hooks
85 | slave {
86 | pcm {
87 | @func concat
88 | strings [
89 | "cards.pcm.phoneline:CARD=" $CARD ",DEV=" $DEV
90 | ]
91 | }
92 | }
93 | hooks.0 {
94 | type ctl_elems
95 | hook_args [
96 | {
97 | name "Off-hook Switch"
98 | preserve true
99 | value "on"
100 | lock false
101 | optional true
102 | }
103 | ]
104 | }
105 | hint.show off
106 | }
107 |
--------------------------------------------------------------------------------
/prebuilt/alsa/conf/pcm/rear.conf:
--------------------------------------------------------------------------------
1 | #
2 | # Hardware output from rear speakers
3 | #
4 |
5 | pcm.!rear {
6 | @args [ CARD DEV ]
7 | @args.CARD {
8 | type string
9 | default {
10 | @func getenv
11 | vars [
12 | ALSA_REAR_CARD
13 | ALSA_PCM_CARD
14 | ALSA_CARD
15 | ]
16 | default {
17 | @func refer
18 | name defaults.pcm.rear.card
19 | }
20 | }
21 | }
22 | @args.DEV {
23 | type integer
24 | default {
25 | @func igetenv
26 | vars [
27 | ALSA_REAR_DEVICE
28 | ]
29 | default {
30 | @func refer
31 | name defaults.pcm.rear.device
32 | }
33 | }
34 | }
35 | type empty
36 | slave.pcm {
37 | @func refer
38 | name {
39 | @func concat
40 | strings [
41 | "cards."
42 | {
43 | @func card_driver
44 | card $CARD
45 | }
46 | ".pcm.rear." $DEV ":CARD=" $CARD
47 | ]
48 | }
49 | }
50 | hint {
51 | show {
52 | @func refer
53 | name defaults.namehint.basic
54 | }
55 | description "Rear speakers"
56 | device $DEV
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/prebuilt/alsa/conf/pcm/side.conf:
--------------------------------------------------------------------------------
1 | #
2 | # Hardware output from side speakers
3 | #
4 |
5 | pcm.!side {
6 | @args [ CARD DEV ]
7 | @args.CARD {
8 | type string
9 | default {
10 | @func getenv
11 | vars [
12 | ALSA_SIDE_CARD
13 | ALSA_PCM_CARD
14 | ALSA_CARD
15 | ]
16 | default {
17 | @func refer
18 | name defaults.pcm.side.card
19 | }
20 | }
21 | }
22 | @args.DEV {
23 | type integer
24 | default {
25 | @func igetenv
26 | vars [
27 | ALSA_SIDE_DEVICE
28 | ]
29 | default {
30 | @func refer
31 | name defaults.pcm.side.device
32 | }
33 | }
34 | }
35 | type empty
36 | slave.pcm {
37 | @func refer
38 | name {
39 | @func concat
40 | strings [
41 | "cards."
42 | {
43 | @func card_driver
44 | card $CARD
45 | }
46 | ".pcm.side." $DEV ":CARD=" $CARD
47 | ]
48 | }
49 | }
50 | hint {
51 | show {
52 | @func refer
53 | name defaults.namehint.basic
54 | }
55 | description "Side speakers"
56 | device $DEV
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/prebuilt/alsa/conf/pcm/surround40.conf:
--------------------------------------------------------------------------------
1 | #
2 | # Hardware output from 4.0 speakers.
3 | # Samples must be positioned:
4 | # chn0 - front left
5 | # chn1 - front right
6 | # chn2 - rear left
7 | # chn3 - rear right
8 | #
9 |
10 | pcm.!surround40 {
11 | @args [ CARD DEV ]
12 | @args.CARD {
13 | type string
14 | default {
15 | @func getenv
16 | vars [
17 | ALSA_SURROUND40_CARD
18 | ALSA_PCM_CARD
19 | ALSA_CARD
20 | ]
21 | default {
22 | @func refer
23 | name defaults.pcm.surround40.card
24 | }
25 | }
26 | }
27 | @args.DEV {
28 | type integer
29 | default {
30 | @func igetenv
31 | vars [
32 | ALSA_SURROUND40_DEVICE
33 | ]
34 | default {
35 | @func refer
36 | name defaults.pcm.surround40.device
37 | }
38 | }
39 | }
40 | type empty
41 | slave.pcm {
42 | @func refer
43 | name {
44 | @func concat
45 | strings [
46 | "cards."
47 | {
48 | @func card_driver
49 | card $CARD
50 | }
51 | ".pcm.surround40." $DEV ":CARD=" $CARD
52 | ]
53 | }
54 | }
55 | hint {
56 | description "4.0 Surround output to Front and Rear speakers"
57 | device $DEV
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/prebuilt/alsa/conf/pcm/surround41.conf:
--------------------------------------------------------------------------------
1 | #
2 | # Hardware output from 4.1 speakers.
3 | # Samples must be positioned:
4 | # chn0 - front left
5 | # chn1 - front right
6 | # chn2 - rear left
7 | # chn3 - rear right
8 | # chn4 - LFE
9 | #
10 |
11 | pcm.!surround41 {
12 | @args [ CARD DEV ]
13 | @args.CARD {
14 | type string
15 | default {
16 | @func getenv
17 | vars [
18 | ALSA_SURROUND41_CARD
19 | ALSA_PCM_CARD
20 | ALSA_CARD
21 | ]
22 | default {
23 | @func refer
24 | name defaults.pcm.surround41.card
25 | }
26 | }
27 | }
28 | @args.DEV {
29 | type integer
30 | default {
31 | @func igetenv
32 | vars [
33 | ALSA_SURROUND41_DEVICE
34 | ]
35 | default {
36 | @func refer
37 | name defaults.pcm.surround41.device
38 | }
39 | }
40 | }
41 | type route
42 | slave.pcm {
43 | @func refer
44 | name {
45 | @func concat
46 | strings [
47 | "cards."
48 | {
49 | @func card_driver
50 | card $CARD
51 | }
52 | ".pcm.surround51." $DEV ":CARD=" $CARD
53 | ]
54 | }
55 | }
56 | slave.channels 6
57 | ttable.0.0 1
58 | ttable.1.1 1
59 | ttable.2.2 1
60 | ttable.3.3 1
61 | ttable.4.5 1
62 | hint {
63 | description "4.1 Surround output to Front, Rear and Subwoofer speakers"
64 | device $DEV
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/prebuilt/alsa/conf/pcm/surround50.conf:
--------------------------------------------------------------------------------
1 | #
2 | # Hardware output from 5.0 speakers.
3 | # Samples must be positioned:
4 | # chn0 - front left
5 | # chn1 - front right
6 | # chn2 - rear left
7 | # chn3 - rear right
8 | # chn4 - center
9 | #
10 |
11 | pcm.!surround50 {
12 | @args [ CARD DEV ]
13 | @args.CARD {
14 | type string
15 | default {
16 | @func getenv
17 | vars [
18 | ALSA_SURROUND50_CARD
19 | ALSA_PCM_CARD
20 | ALSA_CARD
21 | ]
22 | default {
23 | @func refer
24 | name defaults.pcm.surround50.card
25 | }
26 | }
27 | }
28 | @args.DEV {
29 | type integer
30 | default {
31 | @func igetenv
32 | vars [
33 | ALSA_SURROUND50_DEVICE
34 | ]
35 | default {
36 | @func refer
37 | name defaults.pcm.surround50.device
38 | }
39 | }
40 | }
41 | type route
42 | slave.pcm {
43 | @func refer
44 | name {
45 | @func concat
46 | strings [
47 | "cards."
48 | {
49 | @func card_driver
50 | card $CARD
51 | }
52 | ".pcm.surround51." $DEV ":CARD=" $CARD
53 | ]
54 | }
55 | }
56 | slave.channels 6
57 | ttable.0.0 1
58 | ttable.1.1 1
59 | ttable.2.2 1
60 | ttable.3.3 1
61 | ttable.4.4 1
62 | hint {
63 | description "5.0 Surround output to Front, Center and Rear speakers"
64 | device $DEV
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/prebuilt/alsa/conf/pcm/surround51.conf:
--------------------------------------------------------------------------------
1 | #
2 | # Hardware output from 5.1 speakers
3 | # Samples must be positioned:
4 | # chn0 - front left
5 | # chn1 - front right
6 | # chn2 - rear left
7 | # chn3 - rear right
8 | # chn4 - center
9 | # chn5 - lfe
10 | #
11 |
12 | pcm.!surround51 {
13 | @args [ CARD DEV ]
14 | @args.CARD {
15 | type string
16 | default {
17 | @func getenv
18 | vars [
19 | ALSA_SURROUND51_CARD
20 | ALSA_PCM_CARD
21 | ALSA_CARD
22 | ]
23 | default {
24 | @func refer
25 | name defaults.pcm.surround51.card
26 | }
27 | }
28 | }
29 | @args.DEV {
30 | type integer
31 | default {
32 | @func igetenv
33 | vars [
34 | ALSA_SURROUND51_DEVICE
35 | ]
36 | default {
37 | @func refer
38 | name defaults.pcm.surround51.device
39 | }
40 | }
41 | }
42 | type empty
43 | slave.pcm {
44 | @func refer
45 | name {
46 | @func concat
47 | strings [
48 | "cards."
49 | {
50 | @func card_driver
51 | card $CARD
52 | }
53 | ".pcm.surround51." $DEV ":CARD=" $CARD
54 | ]
55 | }
56 | }
57 | hint {
58 | description "5.1 Surround output to Front, Center, Rear and Subwoofer speakers"
59 | device $DEV
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/prebuilt/alsa/conf/pcm/surround71.conf:
--------------------------------------------------------------------------------
1 | #
2 | # Hardware output from 7.1 speakers
3 | # Samples must be positioned:
4 | # chn0 - front left
5 | # chn1 - front right
6 | # chn2 - rear left
7 | # chn3 - rear right
8 | # chn4 - center
9 | # chn5 - lfe
10 | # chn7 - side left
11 | # chn8 - side right
12 | #
13 |
14 | pcm.!surround71 {
15 | @args [ CARD DEV ]
16 | @args.CARD {
17 | type string
18 | default {
19 | @func getenv
20 | vars [
21 | ALSA_SURROUND71_CARD
22 | ALSA_PCM_CARD
23 | ALSA_CARD
24 | ]
25 | default {
26 | @func refer
27 | name defaults.pcm.surround71.card
28 | }
29 | }
30 | }
31 | @args.DEV {
32 | type integer
33 | default {
34 | @func igetenv
35 | vars [
36 | ALSA_SURROUND71_DEVICE
37 | ]
38 | default {
39 | @func refer
40 | name defaults.pcm.surround71.device
41 | }
42 | }
43 | }
44 | type empty
45 | slave.pcm {
46 | @func refer
47 | name {
48 | @func concat
49 | strings [
50 | "cards."
51 | {
52 | @func card_driver
53 | card $CARD
54 | }
55 | ".pcm.surround71." $DEV ":CARD=" $CARD
56 | ]
57 | }
58 | }
59 | hint {
60 | description "7.1 Surround output to Front, Center, Side, Rear and Woofer speakers"
61 | device $DEV
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/prebuilt/alsa/libasound.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CyanogenMod/android_device_bn_encore/b831ae56fe075e8bce7ae7853a76f771e4cca81c/prebuilt/alsa/libasound.so
--------------------------------------------------------------------------------
/prebuilt/alsa/libaudio.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CyanogenMod/android_device_bn_encore/b831ae56fe075e8bce7ae7853a76f771e4cca81c/prebuilt/alsa/libaudio.so
--------------------------------------------------------------------------------
/prebuilt/boot/MLO:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CyanogenMod/android_device_bn_encore/b831ae56fe075e8bce7ae7853a76f771e4cca81c/prebuilt/boot/MLO
--------------------------------------------------------------------------------
/prebuilt/boot/u-boot.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CyanogenMod/android_device_bn_encore/b831ae56fe075e8bce7ae7853a76f771e4cca81c/prebuilt/boot/u-boot.bin
--------------------------------------------------------------------------------
/prebuilt/bootanimation.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CyanogenMod/android_device_bn_encore/b831ae56fe075e8bce7ae7853a76f771e4cca81c/prebuilt/bootanimation.zip
--------------------------------------------------------------------------------
/prebuilt/poetry/poem.txt:
--------------------------------------------------------------------------------
1 | Thought For The Day (A Beautiful Poem)
2 | by Fattire
3 |
4 |
5 | Puppies playing puppily
6 | Monkeys swinging from a tree,
7 | Fishes swimming in the sea,
8 | Reminding me
9 | Some best things in life...
10 | are free.
11 |
12 | Did you choke your puppy with a collar,
13 | Monkeys, boxed up, wail and holler,
14 | Net those guppies with your trawler?
15 | Cuz see, selling what once was free,
16 | Makes you...
17 | smaller.
18 |
19 |
20 | Copyright (C) 2012 Fattire- This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. This silly little poem isn't a contribution to the CyanogenMod project.
21 |
--------------------------------------------------------------------------------
/prebuilt/usr/idc/cyttsp-i2c.idc:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010 The Android Open Source Project
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | #
16 | # Input Device Calibration File for the Encore touch screen.
17 | #
18 | # These calibration values are derived from empirical measurements
19 | # and may not be appropriate for use with other touch screens.
20 | # Refer to the input device calibration documentation for more details.
21 | #
22 |
23 | # Basic Parameters
24 | touch.deviceType = touchScreen
25 |
26 | # Touch Size
27 | touch.touchSize.calibration = pressure
28 |
29 | # Tool Size
30 | # Driver reports tool size as an area measurement.
31 | #
32 | # Based on empirical measurements, we estimate the size of the tool
33 | # using size = sqrt(22 * rawToolArea + 0) * 9.2 + 0.
34 | touch.toolSize.calibration = area
35 | touch.toolSize.areaScale = 22
36 | touch.toolSize.areaBias = 0
37 | touch.toolSize.linearScale = 9.2
38 | touch.toolSize.linearBias = 0
39 | touch.toolSize.isSummed = 0
40 |
41 | # Pressure
42 | # Driver reports signal strength as pressure.
43 | #
44 | # A normal thumb touch while touching the back of the device
45 | # typically registers about 100 signal strength units although
46 | # this value is highly variable and is sensitive to contact area,
47 | # manner of contact and environmental conditions. We set the
48 | # scale so that a normal touch with good signal strength will be
49 | # reported as having a pressure somewhere in the vicinity of 1.0,
50 | # a featherlight touch will be below 1.0 and a heavy or large touch
51 | # will be above 1.0. We don't expect these values to be accurate.
52 | touch.pressure.calibration = amplitude
53 | touch.pressure.source = default
54 | touch.pressure.scale = 0.01
55 |
56 | # Size
57 | touch.size.calibration = default
58 |
59 | # Orientation
60 | touch.orientation.calibration = none
61 |
--------------------------------------------------------------------------------
/prebuilt/usr/idc/ft5x06-i2c.idc:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010 The Android Open Source Project
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | #
16 | # Input Device Calibration File for the Encore touch screen.
17 | #
18 | # These calibration values are derived from empirical measurements
19 | # and may not be appropriate for use with other touch screens.
20 | # Refer to the input device calibration documentation for more details.
21 | #
22 |
23 | # Basic Parameters
24 | touch.deviceType = touchScreen
25 |
26 | # Touch Size
27 | touch.touchSize.calibration = pressure
28 |
29 | # Tool Size
30 | # Driver reports tool size as an area measurement.
31 | #
32 | # Based on empirical measurements, we estimate the size of the tool
33 | # using size = sqrt(22 * rawToolArea + 0) * 9.2 + 0.
34 | touch.toolSize.calibration = area
35 | touch.toolSize.areaScale = 22
36 | touch.toolSize.areaBias = 0
37 | touch.toolSize.linearScale = 9.2
38 | touch.toolSize.linearBias = 0
39 | touch.toolSize.isSummed = 0
40 |
41 | # Pressure
42 | # Driver reports signal strength as pressure.
43 | #
44 | # A normal thumb touch while touching the back of the device
45 | # typically registers about 100 signal strength units although
46 | # this value is highly variable and is sensitive to contact area,
47 | # manner of contact and environmental conditions. We set the
48 | # scale so that a normal touch with good signal strength will be
49 | # reported as having a pressure somewhere in the vicinity of 1.0,
50 | # a featherlight touch will be below 1.0 and a heavy or large touch
51 | # will be above 1.0. We don't expect these values to be accurate.
52 | touch.pressure.calibration = amplitude
53 | touch.pressure.source = default
54 | touch.pressure.scale = 0.01
55 |
56 | # Size
57 | touch.size.calibration = default
58 |
59 | # Orientation
60 | touch.orientation.calibration = none
61 |
--------------------------------------------------------------------------------
/prebuilt/usr/keylayout/gpio-keys.kl:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010 The Android Open Source Project
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | # gpio-keys.kl
16 | # This is the keylayout for the hardware buttons on the Nook Color.
17 |
18 | key 102 HOME WAKE
19 | key 114 VOLUME_DOWN
20 | key 115 VOLUME_UP
21 | key 116 POWER WAKE
22 |
--------------------------------------------------------------------------------
/proprietary-files.txt:
--------------------------------------------------------------------------------
1 | bin/pvrsrvinit
2 | vendor/lib/libbltsville_cpu.so
3 | vendor/lib/libbltsville_ticpu.so
4 | lib/dsp/g729enc_sn.dll64P
5 | lib/dsp/nbamrdec_sn.dll64P
6 | lib/dsp/monitor_tiomap3430.dof64P
7 | lib/dsp/star.l64P
8 | lib/dsp/h264vdec_sn.dll64P
9 | lib/dsp/conversions.dll64P
10 | lib/dsp/m4venc_sn.dll64P
11 | lib/dsp/g729dec_sn.dll64P
12 | lib/dsp/qosdyn_3430.dll64P
13 | lib/dsp/720p_divx_mp4vdec_sn.dll64P
14 | lib/dsp/mpeg4aacdec_sn.dll64P
15 | lib/dsp/720p_h264venc_sn.dll64P
16 | lib/dsp/g722enc_sn.dll64P
17 | lib/dsp/dctn_dyn.dll64P
18 | lib/dsp/dfgm.dll64P
19 | lib/dsp/ilbcdec_sn.dll64P
20 | lib/dsp/mp3dec_sn.dll64P
21 | lib/dsp/wbamrdec_sn.dll64P
22 | lib/dsp/g722dec_sn.dll64P
23 | lib/dsp/wmv9dec_sn.dll64P
24 | lib/dsp/g726enc_sn.dll64P
25 | lib/dsp/jpegenc_sn.dll64P
26 | lib/dsp/yuvconvert.l64p
27 | lib/dsp/720p_h264vdec_sn.dll64P
28 | lib/dsp/chromasuppress.l64p
29 | lib/dsp/ddspbase_tiomap3430.dof64P
30 | lib/dsp/wbamrenc_sn.dll64P
31 | lib/dsp/dynbase_tiomap3430.dof64P
32 | lib/dsp/ringio.dll64P
33 | lib/dsp/g711enc_sn.dll64P
34 | lib/dsp/h264venc_sn.dll64P
35 | lib/dsp/720p_wmv9vdec_sn.dll64P
36 | lib/dsp/wmadec_sn.dll64P
37 | lib/dsp/eenf_ti.l64P
38 | lib/dsp/ipp_sn.dll64P
39 | lib/dsp/ittiam_divx3vdec_sn.dll64P
40 | lib/dsp/g726dec_sn.dll64P
41 | lib/dsp/sparkdec_sn.dll64P
42 | lib/dsp/nbamrenc_sn.dll64P
43 | lib/dsp/usn.dll64P
44 | lib/dsp/720p_mp4vdec_sn.dll64P
45 | lib/dsp/baseimage.map
46 | lib/dsp/vpp_sn.dll64P
47 | lib/dsp/g711dec_sn.dll64P
48 | lib/dsp/ilbcenc_sn.dll64P
49 | lib/dsp/baseimage.dof
50 | lib/dsp/mp4vdec_sn.dll64P
51 | lib/dsp/postprocessor_dualout.dll64P
52 | lib/dsp/720p_mp4venc_sn.dll64P
53 | lib/dsp/jpegdec_sn.dll64P
54 | lib/dsp/mpeg4aacenc_sn.dll64P
55 | vendor/lib/egl/libEGL_POWERVR_SGX530_125.so
56 | vendor/lib/egl/libGLESv1_CM_POWERVR_SGX530_125.so
57 | vendor/lib/egl/libGLESv2_POWERVR_SGX530_125.so
58 | vendor/lib/hw/gralloc.omap3.so
59 | vendor/lib/libIMGegl.so
60 | lib/libOMX.TI.720P.Decoder.so
61 | vendor/lib/libOpenVG.so
62 | vendor/lib/libOpenVGU.so
63 | vendor/lib/libPVRScopeServices.so
64 | vendor/lib/libglslcompiler.so
65 | lib/libomap_mm_library_jni.so
66 | vendor/lib/libpvr2d.so
67 | vendor/lib/libpvrANDROID_WSEGL.so
68 | vendor/lib/libsrv_init.so
69 | vendor/lib/libsrv_um.so
70 | vendor/lib/libusc.so
71 |
--------------------------------------------------------------------------------
/ramdisk_tools.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # ramdisk_tools.sh
4 | #
5 | # (C) 2010-2011 fattire
6 | # (C) 2011 Gerad Munsch
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU General Public License as published by
10 | # the Free Software Foundation, either version 3 of the License, or
11 | # (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU General Public License for more details.
17 |
18 | # So what does this do? It creates an encore initramfs (ramdisk) from
19 | # the files provided in ./root/. It automatically replaces the mount
20 | # points in init.encore.rc, based on which argument is passed to the
21 | # script. It supports creating ramdisks for internal, SD card, and
22 | # alternate internal boot setups.
23 | #
24 | # Run this file script from $OUT -- (basically) the place you found it.
25 | #
26 | # Arguments:
27 | # --internal : creates ramdisk.ub for use on standard internal
28 | # emmc partitions
29 | #
30 | # --sdcard : creates ramdisk-sdcard.ub for use on SD card setups
31 | #
32 | # --alternate : create ramdisk-alternate.ub for use on the alternate
33 | # internal emmc partitions (9,10,11)
34 | #
35 | # --recovery : creates a recovery image (ramdisk-recovery.ub)
36 | #
37 | # Place the resultant file in the appropriate /boot partition, with
38 | # the appropriate name, reboot, and enjoy!
39 |
40 | ### CONSTANTS ###
41 |
42 | # files
43 | ROOT="root"
44 | INIT="root/init.encore.rc"
45 | INT_OUT="ramdisk.ub"
46 | SD_OUT="ramdisk-sdcard.ub"
47 | ALT_OUT="ramdisk-alternate.ub"
48 | REC_OUT="ramdisk-recovery.ub"
49 | REC_ROOT="recovery/root"
50 |
51 | # partitions
52 | INT_SYSTEM="mmcblk0p5"
53 | INT_USERDATA="mmcblk0p6"
54 | INT_CACHE="mmcblk0p7"
55 | SD_SYSTEM="mmcblk1p2"
56 | SD_USERDATA="mmcblk1p3"
57 | SD_CACHE="mmcblk1p5"
58 | ALT_SYSTEM="mmcblk0p9"
59 | ALT_USERDATA="mmcblk0p10"
60 | ALT_CACHE="mmcblk0p11"
61 |
62 | # strings
63 | INT_NAME_1="internal"
64 | INT_NAME_2="emmc"
65 | SD_NAME_1="SD"
66 | SD_NAME_2="card"
67 | ALT_NAME_1="alternate"
68 | ALT_NAME_2="internal/emmc"
69 | INT_BOOT="mmcblk0p1"
70 | SD_BOOT="mmcblk1p1"
71 | ALT_BOOT="mmcblk0p1"
72 | INT_RAMDISK_NAME="uRamdisk"
73 | SD_RAMDISK_NAME="uRamdisk"
74 | ALT_RAMDISK_NAME="uAltRam"
75 | REC_NAME_1="recovery"
76 | REC_NAME_2="internal/emmc"
77 | REC_BOOT="mmcblk0p1"
78 | REC_RAMDISK_NAME="uRecRam"
79 |
80 | ### END CONSTANTS ###
81 | ### FUNCTION DEFINITIONS ###
82 |
83 | ## display help information
84 | function display_help {
85 | echo -e "\033[1m$0\033[0m\n"
86 | echo -e "This is a combination script, used for building ramdisks for use with the Nook Color. It covers"
87 | echo -e "use with standard emmc, alternate emmc, and SD card partition setups. It uses the ./root/ folder"
88 | echo -e "for its input. The init file, \033[1minit.encore.rc\033[0m will automatically be modified to contain the"
89 | echo -e "appropriate mount points.\n"
90 | echo -e "\033[1mUSAGE:\033[0m"
91 | echo -e "\033[1m$0 --internal\033[0m - rebuilds your ramdisk, setup for the default internal emmc partitions.\n Output: \033[1mramdisk.ub\033[0m"
92 | echo -e "\033[1m$0 --sdcard\033[0m - rebuilds your ramdisk, setup for installations on MicroSD cards.\n Output: \033[1mramdisk-sdcard.ub\033[0m"
93 | echo -e "\033[1m$0 --alternate\033[0m - rebuilds your ramdisk, setup for the alternate internal emmc partitions.\n Output: \033[1mramdisk-alternate.ub\033[0m"
94 | return 0
95 | } # end function 'help_info' #
96 |
97 | ## check for existance of mkimage
98 | function check_mkimage {
99 | which mkimage &> /dev/null
100 | if [ $? -ne 0 ]; then
101 | echo -e "\n\033[1mY U NO have mkimage??\033[0m\n"
102 | echo -e "Please install mkimage from your distributions repositories, or elsewhere.\n"
103 | echo -e "Older Debian/Ubuntu: \033[1m(sudo) apt-get install uboot-mkimage\033[0m"
104 | echo -e "Newer Debian/Ubuntu: \033[1m(sudo) apt-get install u-boot-tools\033[0m\n"
105 | echo -e "Mac users : Not available via ports. You'll need to compile it.\n"
106 | echo -e "Please try again once mkimage is accessible from your path/shell, and try again."
107 | return 1
108 | else
109 | echo -e "\n\033[1m* Found mkimage, proceeding.\033[0m"
110 | return 0
111 | fi
112 | } # end function 'check_mkimage' #
113 |
114 | ## update init.encore.rc with proper partition names
115 | function update_init {
116 | sed -i 's/.*mount.*\/system.*/ mount ext4 \/dev\/block\/'$1' \/system wait ro barrier=1/' $INIT
117 | sed -i 's/.*mount.*\/data.*/ mount ext4 \/dev\/block\/'$2' \/data wait noatime nosuid nodev barrier=1 noauto_da_alloc/' $INIT
118 | sed -i 's/.*mount.*\/cache.*/ mount ext4 \/dev\/block\/'$3' \/cache wait noatime nosuid nodev barrier=1/' $INIT
119 | } # end function 'update_init' #
120 |
121 | ## create new ramdisk from ./root/ folder
122 | function create_ramdisk {
123 |
124 | if [ ! -d "$ROOT" ]; then
125 | echo "Whoops! The directory ./$ROOT, which is used to make the ramdisk, is missing. Are you running this script from the right place?"
126 | exit 1
127 | fi
128 | # enter initramfs (ramdisk) root
129 | cd $ROOT
130 |
131 | # collect files to be added to initramfs (ramdisk), and add them
132 | echo -e "\n\033[1m* Adding files:\033[0m"
133 | find . -regex "./.*" | cpio -ov -H newc | gzip > ../repacked-ramdisk.cpio.gz
134 |
135 | # create new initramfs (ramdisk) image using mkimage (u-boot-tools)
136 | echo -e "\n\033[1m* Creating ramdisk:\033[0m"
137 | mkimage -A ARM -T RAMDisk -n Image -d ../repacked-ramdisk.cpio.gz ../$1
138 | } # end function 'create_ramdisk' #
139 |
140 | ## cleanup our mess
141 | function cleanup_mess {
142 | rm ../repacked-ramdisk.cpio.gz
143 | } # end function 'cleanup_mess' #
144 |
145 | ## display helpful info
146 | function output_info {
147 | echo -e "\n\033[1m* Created ramdisk for $1 $2 boot. To install this ramdisk on your device, boot into your NC, then:\033[0m"
148 | echo -e "adb shell"
149 | echo -e "mount -o rw,remount /"
150 | echo -e "mkdir -p /mnt/boot"
151 | echo -e "mount -t vfat /dev/block/$3 /mnt/boot"
152 | echo -e "exit"
153 | echo -e "adb push $4 /mnt/boot/$5"
154 | echo -e "adb shell sync"
155 | echo -e "adb reboot"
156 | } # end function 'output_info' #
157 |
158 | ## display extra info for alternate boot
159 | function alt_boot_info {
160 | echo -e "\n\033[1m* Please keep in mind, you need uAltImg in place as well.\033[0m"
161 | echo "To set the default boot device to alternate eMMC partitions, do:"
162 | echo "adb shell"
163 | echo "mount -o rw,remount /rom"
164 | echo "cd /rom"
165 | echo "touch u-boot.altboot"
166 | echo "echo 1 > u-boot.altboot"
167 | echo "sync"
168 | echo "mount -o ro,remount /rom"
169 | echo -e "\n\033[1m* Your alternate boot image/ramdisk are now the default.\033[0m"
170 | } # end function 'alt_boot_info' #
171 |
172 | ### END FUNCTION DEFINITIONS ###
173 | ### MAIN PROGRAM ###
174 |
175 | # check for arguments -- if none exist, assume --internal
176 | if [ $# -lt 1 ]; then
177 | cmd="--internal"
178 | else
179 | cmd=$1
180 | fi
181 |
182 | case $cmd in
183 |
184 | --internal|-internal|-int|-i)
185 | # rebuild ramdisk for use on standard emmc partitions
186 | check_mkimage
187 | create_ramdisk $INT_OUT
188 | cleanup_mess
189 | output_info $INT_NAME_1 $INT_NAME_2 $INT_BOOT $INT_OUT $INT_RAMDISK_NAME
190 | ;; # end case '--internal' #
191 |
192 | --sdcard|-sdcard|-s|-sd)
193 | # rebuild ramdisk for use on SD card
194 | check_mkimage
195 | update_init $SD_SYSTEM $SD_USERDATA $SD_CACHE
196 | create_ramdisk $SD_OUT
197 | cleanup_mess
198 | output_info $SD_NAME_1 $SD_NAME_2 $SD_BOOT $SD_OUT $SD_RAMDISK_NAME
199 | ;; # end case '--sdcard' #
200 |
201 | --alternate|-alternate|-alt|-a)
202 | # rebuild ramdisk for use on alternate emmc partitions
203 | check_mkimage
204 | update_init $ALT_SYSTEM $ALT_USERDATA $ALT_CACHE
205 | create_ramdisk $ALT_OUT
206 | cleanup_mess
207 | output_info $ALT_NAME_1 $ALT_NAME_2 $ALT_BOOT $ALT_OUT $ALT_RAMDISK_NAME
208 | alt_boot_info
209 | ;; # end case '--alternate' #
210 |
211 | --recovery|-recovery|-rec|-r)
212 | # rebuild recovery
213 | check_mkimage
214 | ROOT=$REC_ROOT
215 | create_ramdisk $REC_OUT
216 | cleanup_mess
217 | mv ../${REC_OUT} ../../${REC_OUT}
218 | output_info $REC_NAME_1 $REC_NAME_2 $REC_BOOT $REC_OUT $REC_RAMDISK_NAME
219 | ;; # end case '--recovery' #
220 |
221 | --help|-help|-h)
222 | # display help
223 | display_help
224 | ;; # end case '--help' #
225 |
226 | esac
227 |
228 | ### END MAIN PROGRAM ###
229 |
--------------------------------------------------------------------------------
/recovery.fstab:
--------------------------------------------------------------------------------
1 | # mount point fstype device
2 |
3 | /boot vfat /dev/block/mmcblk0p1
4 | /system ext4 /dev/block/mmcblk0p5 fstype2=ext2
5 | /data ext4 /dev/block/mmcblk0p6 fstype2=ext3
6 | /cache ext4 /dev/block/mmcblk0p7 fstype2=ext3
7 | /emmc vfat /dev/block/mmcblk0p8
8 |
9 | /sdcard vfat /dev/block/mmcblk1p1
10 | /sd-ext ext4 /dev/block/mmcblk1p2 fstype2=ext3
11 |
--------------------------------------------------------------------------------
/recovery/postrecoveryboot.sh:
--------------------------------------------------------------------------------
1 | #!/sbin/sh
2 |
3 | # Resets the boot counter and the bcb instructions
4 | mkdir /rom
5 | mount /dev/block/mmcblk0p2 /rom
6 | mount -o rw,remount /rom
7 |
8 | # Zero out the boot counter
9 | dd if=/dev/zero of=/rom/devconf/BootCnt bs=1 count=4
10 |
11 | # Reset the bootloader control block (bcb) file
12 | dd if=/dev/zero of=/rom/bcb bs=1 count=1088
13 |
14 | umount /rom
15 | rmdir /rom
16 |
17 |
--------------------------------------------------------------------------------
/recovery/recovery_ui.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #include
18 |
19 | #include "recovery_ui.h"
20 | #include "common.h"
21 | #include "extendedcommands.h"
22 |
23 | int device_toggle_display(volatile char* key_pressed, int key_code) {
24 | int alt = key_pressed[KEY_LEFTALT] || key_pressed[KEY_RIGHTALT];
25 | if (alt && key_code == KEY_L)
26 | return 1;
27 | // allow toggling of the display if the correct key is pressed, and the display toggle is allowed or the display is currently off
28 | if (ui_get_showing_back_button()) {
29 | return get_allow_toggle_display() && (key_code == KEY_MENU || key_code == KEY_END);
30 | }
31 | return get_allow_toggle_display() && (key_code == KEY_MENU || key_code == KEY_POWER || key_code == KEY_END);
32 | }
33 |
34 |
35 | int device_handle_key(int key_code, int visible) {
36 | if (visible) {
37 | switch (key_code) {
38 | case KEY_CAPSLOCK:
39 | case KEY_VOLUMEDOWN:
40 | return HIGHLIGHT_DOWN;
41 |
42 | case KEY_LEFTSHIFT:
43 | case KEY_VOLUMEUP:
44 | return HIGHLIGHT_UP;
45 |
46 | case KEY_POWER:
47 | if (ui_get_showing_back_button()) {
48 | return SELECT_ITEM;
49 | }
50 | if (!get_allow_toggle_display())
51 | return GO_BACK;
52 | break;
53 | case KEY_HOME:
54 | case KEY_LEFTBRACE:
55 | case KEY_ENTER:
56 | case BTN_MOUSE:
57 | case KEY_CAMERA:
58 | case KEY_F21:
59 | case KEY_SEND:
60 | return SELECT_ITEM;
61 |
62 | case KEY_END:
63 | case KEY_BACKSPACE:
64 | case KEY_BACK:
65 | if (!get_allow_toggle_display())
66 | return GO_BACK;
67 | }
68 | }
69 |
70 | return NO_ACTION;
71 | }
72 |
--------------------------------------------------------------------------------
/releasetools/encore_common.py:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2008 The Android Open Source Project
3 | # Copyright (C) 2012 The CyanogenMod Project
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | import os, sys
18 |
19 | LOCAL_DIR = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
20 | RELEASETOOLS_DIR = os.path.abspath(os.path.join(LOCAL_DIR, '../../../build/tools/releasetools'))
21 |
22 | # Add releasetools directory to python path
23 | sys.path.append(RELEASETOOLS_DIR)
24 |
25 | from common import *
26 |
27 | def load_module_from_file(module_name, filename):
28 | import imp
29 | f = open(filename, 'r')
30 | module = imp.load_module(module_name, f, filename, ('', 'U', 1))
31 | f.close()
32 | return module
33 |
--------------------------------------------------------------------------------
/releasetools/encore_edify_generator.py:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2008 The Android Open Source Project
3 | # Copyright (C) 2012 The CyanogenMod Project
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | import os, sys
18 |
19 | LOCAL_DIR = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
20 | RELEASETOOLS_DIR = os.path.abspath(os.path.join(LOCAL_DIR, '../../../build/tools/releasetools'))
21 |
22 | import edify_generator
23 |
24 | class EdifyGenerator(edify_generator.EdifyGenerator):
25 | def UnpackPackageFile(self, src, dst):
26 | """Unpack a given file from the OTA package into the given
27 | destination file."""
28 | self.script.append('package_extract_file("%s", "%s");' % (src, dst))
29 |
--------------------------------------------------------------------------------
/releasetools/encore_img_from_target_files:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #
3 | # Copyright (C) 2008 The Android Open Source Project
4 | # Copyright (C) 2012 The CyanogenMod Project
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 |
18 | import sys
19 | import os
20 | import encore_common as common
21 |
22 | LOCAL_DIR = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
23 | RELEASETOOLS_DIR = os.path.abspath(os.path.join(LOCAL_DIR, '../../../build/tools/releasetools'))
24 |
25 | # Add releasetools directory to python path
26 | sys.path.append(RELEASETOOLS_DIR)
27 |
28 | # Import the existing file so we just have to rewrite the modules we need.
29 | # This is a nasty hack as the filename doesn't end in .py, but it works
30 | filename = os.path.join(RELEASETOOLS_DIR, "img_from_target_files")
31 | img_from_target_files = common.load_module_from_file('img_from_target_files', filename)
32 | from img_from_target_files import *
33 |
34 | __doc__ = img_from_target_files.__doc__
35 |
36 | import zipfile
37 |
38 | OPTIONS = common.OPTIONS
39 |
40 | #
41 | # Redfine our main functiont to not build the boot and recovery images as
42 | # they are just files on the encore platform
43 | #
44 | def main(argv):
45 | bootable_only = [False]
46 |
47 | def option_handler(o, a):
48 | if o in ("-b", "--board_config"):
49 | pass # deprecated
50 | else:
51 | return False
52 | return True
53 |
54 | args = common.ParseOptions(argv, __doc__,
55 | extra_opts="b:z",
56 | extra_long_opts=["board_config=",
57 | "bootable_zip"],
58 | extra_option_handler=option_handler)
59 |
60 | bootable_only = bootable_only[0]
61 |
62 | if len(args) != 2:
63 | common.Usage(__doc__)
64 | sys.exit(1)
65 |
66 | OPTIONS.input_tmp, input_zip = common.UnzipTemp(args[0])
67 | OPTIONS.info_dict = common.LoadInfoDict(input_zip)
68 |
69 | output_zip = zipfile.ZipFile(args[1], "w", compression=zipfile.ZIP_DEFLATED)
70 |
71 | # -- encore build changes starting
72 | #common.GetBootableImage(
73 | # "boot.img", "boot.img", OPTIONS.input_tmp, "BOOT").AddToZip(output_zip)
74 | #common.GetBootableImage(
75 | # "recovery.img", "recovery.img", OPTIONS.input_tmp,
76 | # "RECOVERY").AddToZip(output_zip)
77 | # -- encor build changes end
78 |
79 | if not bootable_only:
80 | AddSystem(output_zip)
81 | AddUserdata(output_zip)
82 | CopyInfo(output_zip)
83 |
84 | print "cleaning up..."
85 | output_zip.close()
86 | shutil.rmtree(OPTIONS.input_tmp)
87 |
88 | print "done."
89 |
90 | if __name__ == '__main__':
91 | print "Info: Using encore specific release tools"
92 | try:
93 | main(sys.argv[1:])
94 | except common.ExternalError, e:
95 | print
96 | print " ERROR: %s" % (e,)
97 | print
98 | sys.exit(1)
99 |
--------------------------------------------------------------------------------
/releasetools/encore_ota_from_target_files:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #
3 | # Copyright (C) 2008 The Android Open Source Project
4 | # Copyright (C) 2012 The CyanogenMod Project
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 |
18 | import sys
19 | import os
20 | import encore_common as common
21 |
22 |
23 | LOCAL_DIR = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
24 | RELEASETOOLS_DIR = os.path.abspath(os.path.join(LOCAL_DIR, '../../../build/tools/releasetools'))
25 |
26 | # Add releasetools directory to python path
27 | sys.path.append(RELEASETOOLS_DIR)
28 |
29 | # Import the existing file so we just have to rewrite the modules we need.
30 | # This is a nasty hack as the filename doesn't end in .py, but it works
31 | filename = os.path.join(RELEASETOOLS_DIR, "ota_from_target_files")
32 | ota_from_target_files = common.load_module_from_file('ota_from_target_files', filename)
33 |
34 | from ota_from_target_files import *
35 | import encore_edify_generator as edify_generator
36 |
37 | __doc__ = ota_from_target_files.__doc__
38 |
39 | def CopyBootFiles(input_zip, output_zip):
40 | output_zip.writestr("MLO", input_zip.read("BOOT/bootloader"))
41 | output_zip.writestr("u-boot.bin", input_zip.read("BOOT/second"))
42 | output_zip.writestr("kernel", input_zip.read("BOOT/kernel"))
43 | output_zip.writestr("ramdisk.img", input_zip.read("BOOT/ramdisk.img"))
44 |
45 | def WriteFullOTAPackage(input_zip, output_zip):
46 | # TODO: how to determine this? We don't know what version it will
47 | # be installed on top of. For now, we expect the API just won't
48 | # change very often.
49 | script = edify_generator.EdifyGenerator(3, OPTIONS.info_dict)
50 |
51 | metadata = {"post-build": GetBuildProp("ro.build.fingerprint", OPTIONS.info_dict),
52 | "pre-device": GetBuildProp("ro.product.device", OPTIONS.info_dict),
53 | "post-timestamp": GetBuildProp("ro.build.date.utc", OPTIONS.info_dict),
54 | }
55 |
56 | device_specific = common.DeviceSpecificParams(
57 | input_zip=input_zip,
58 | input_version=OPTIONS.info_dict["recovery_api_version"],
59 | output_zip=output_zip,
60 | script=script,
61 | input_tmp=OPTIONS.input_tmp,
62 | metadata=metadata,
63 | info_dict=OPTIONS.info_dict)
64 |
65 | # if not OPTIONS.omit_prereq:
66 | # ts = GetBuildProp("ro.build.date.utc", input_zip)
67 | # script.AssertOlderBuild(ts)
68 |
69 | AppendAssertions(script, OPTIONS.info_dict)
70 | device_specific.FullOTA_Assertions()
71 | device_specific.FullOTA_InstallBegin()
72 |
73 | if OPTIONS.backuptool:
74 | script.Mount("/system")
75 | script.RunBackup("backup")
76 | script.Unmount("/system")
77 |
78 | script.ShowProgress(0.5, 0)
79 |
80 | if OPTIONS.wipe_user_data:
81 | script.FormatPartition("/data")
82 |
83 | if "selinux_fc" in OPTIONS.info_dict:
84 | WritePolicyConfig(OPTIONS.info_dict["selinux_fc"], output_zip)
85 |
86 | script.FormatPartition("/system")
87 | script.Mount("/system")
88 | #script.UnpackPackageDir("recovery", "/system")
89 | script.UnpackPackageDir("system", "/system")
90 |
91 | symlinks = CopySystemFiles(input_zip, output_zip)
92 | script.MakeSymlinks(symlinks)
93 |
94 | # -- encore build change starting
95 | #boot_img = common.File("boot.img", common.BuildBootableImage(
96 | # os.path.join(OPTIONS.input_tmp, "BOOT")))
97 | #recovery_img = common.File("recovery.img", common.BuildBootableImage(
98 | # os.path.join(OPTIONS.input_tmp, "RECOVERY")))
99 | #MakeRecoveryPatch(output_zip, recovery_img, boot_img)
100 | # -- encore build change done
101 |
102 | Item.GetMetadata(input_zip)
103 | Item.Get("system").SetPermissions(script)
104 |
105 | # -- encore build change starting
106 | #common.CheckSize(boot_img.data, "boot.img", OPTIONS.info_dict)
107 | #common.ZipWriteStr(output_zip, "boot.img", boot_img.data)
108 | # -- encore build change done
109 | script.ShowProgress(0.2, 0)
110 |
111 | if OPTIONS.backuptool:
112 | script.ShowProgress(0.2, 10)
113 | script.RunBackup("restore")
114 |
115 | script.ShowProgress(0.2, 10)
116 | # -- encore build change starting
117 | #script.WriteRawImage("/boot", "boot.img")
118 |
119 | CopyBootFiles(input_zip, output_zip)
120 |
121 | # This mimics how the official B&N updates work and seems pretty elegant to me
122 | script.Mount("/boot")
123 | script.UnpackPackageFile("MLO", "/boot/MLO")
124 | script.UnpackPackageFile("u-boot.bin", "/boot/u-boot.bin")
125 | script.UnpackPackageFile("kernel", "/boot/uImage")
126 | script.UnpackPackageFile("ramdisk.img", "/boot/uRamdisk")
127 | # -- encore build change done
128 |
129 | script.ShowProgress(0.1, 0)
130 | device_specific.FullOTA_InstallEnd()
131 |
132 | if OPTIONS.extra_script is not None:
133 | script.AppendExtra(OPTIONS.extra_script)
134 |
135 | script.UnmountAll()
136 | script.AddToZip(input_zip, output_zip)
137 | WriteMetadata(metadata, output_zip)
138 | ota_from_target_files.WriteFullOTAPackage = WriteFullOTAPackage
139 |
140 |
141 | def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
142 | print "Incremental OTA Packages are not support on the B&N Encore at this time"
143 | sys.exit(1)
144 | ota_from_target_files.WriteIncrementalOTAPackage = WriteIncrementalOTAPackage
145 |
146 | if __name__ == '__main__':
147 | try:
148 | # common.CloseInheritedPipes()
149 | main(sys.argv[1:])
150 | except common.ExternalError, e:
151 | print
152 | print " ERROR: %s" % (e,)
153 | print
154 | sys.exit(1)
155 |
--------------------------------------------------------------------------------
/setup-makefiles.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Copyright (C) 2012 The CyanogenMod Project
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | DEVICE=encore
18 | MANUFACTURER=bn
19 | OUTDIR=vendor/$MANUFACTURER/$DEVICE
20 | MAKEFILE=../../../$OUTDIR/$DEVICE-vendor-blobs.mk
21 |
22 | (cat << EOF) > $MAKEFILE
23 | # Copyright (C) 2012 The CyanogenMod Project
24 | #
25 | # Licensed under the Apache License, Version 2.0 (the "License");
26 | # you may not use this file except in compliance with the License.
27 | # You may obtain a copy of the License at
28 | #
29 | # http://www.apache.org/licenses/LICENSE-2.0
30 | #
31 | # Unless required by applicable law or agreed to in writing, software
32 | # distributed under the License is distributed on an "AS IS" BASIS,
33 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34 | # See the License for the specific language governing permissions and
35 | # limitations under the License.
36 |
37 | # This file is generated by device/$MANUFACTURER/$DEVICE/setup-makefiles.sh
38 |
39 | # Pick up overlay for features that depend on non-open-source files
40 | DEVICE_PACKAGE_OVERLAYS += vendor/$MANUFACTURER/$DEVICE/overlay
41 |
42 |
43 | # Proprietary Blobs
44 | PRODUCT_COPY_FILES += \\
45 | EOF
46 |
47 | LINEEND=" \\"
48 | COUNT=`wc -l proprietary-files.txt | awk {'print $1'}`
49 | for FILE in `cat proprietary-files.txt`; do
50 | COUNT=`expr $COUNT - 1`
51 | if [ $COUNT = "0" ]; then
52 | LINEEND=""
53 | fi
54 | echo " $OUTDIR/proprietary/$FILE:system/$FILE$LINEEND" >> $MAKEFILE
55 | done
56 |
57 | (cat << EOF) > ../../../$OUTDIR/$DEVICE-vendor.mk
58 | # Copyright (C) 2012 The CyanogenMod Project
59 | #
60 | # Licensed under the Apache License, Version 2.0 (the "License");
61 | # you may not use this file except in compliance with the License.
62 | # You may obtain a copy of the License at
63 | #
64 | # http://www.apache.org/licenses/LICENSE-2.0
65 | #
66 | # Unless required by applicable law or agreed to in writing, software
67 | # distributed under the License is distributed on an "AS IS" BASIS,
68 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
69 | # See the License for the specific language governing permissions and
70 | # limitations under the License.
71 |
72 | # This file is generated by device/$MANUFACTURER/$DEVICE/setup-makefiles.sh
73 |
74 | # Pick up overlay for features that depend on non-open-source files
75 | DEVICE_PACKAGE_OVERLAYS := vendor/$MANUFACTURER/$DEVICE/overlay
76 |
77 | \$(call inherit-product, vendor/$MANUFACTURER/$DEVICE/$DEVICE-vendor-blobs.mk)
78 | EOF
79 |
80 | (cat << EOF) > ../../../$OUTDIR/BoardConfigVendor.mk
81 | # Copyright (C) 2012 The CyanogenMod Project
82 | #
83 | # Licensed under the Apache License, Version 2.0 (the "License");
84 | # you may not use this file except in compliance with the License.
85 | # You may obtain a copy of the License at
86 | #
87 | # http://www.apache.org/licenses/LICENSE-2.0
88 | #
89 | # Unless required by applicable law or agreed to in writing, software
90 | # distributed under the License is distributed on an "AS IS" BASIS,
91 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
92 | # See the License for the specific language governing permissions and
93 | # limitations under the License.
94 |
95 | # This file is generated by device/$MANUFACTURER/$DEVICE/setup-makefiles.sh
96 | USE_CAMERA_STUB := true
97 | EOF
98 |
--------------------------------------------------------------------------------
/system.prop:
--------------------------------------------------------------------------------
1 | #
2 | # system.prop for encore
3 | #
4 | wifi.interface=wlan0
5 | wifi.supplicant_scan_interval=30
6 |
7 | ro.vold.switchablepair=/storage/sdcard1,/storage/sdcard0
8 | ro.cwm.forbid_format=/boot
9 | persist.sys.usb.config=mtp,adb
10 | ro.emmc=1
11 |
12 | ro.opengles.version=131072
13 | #ro.sf.hwrotation=270
14 | ro.sf.lcd_density=160
15 |
16 | # XXX This optimization slows down SGX540; is this true of SGX530 too?
17 | ro.hwui.disable_scissor_opt=true
18 | # GPU producer to CPU consumer not supported
19 | ro.bq.gpu_to_cpu_unsupported=1
20 |
--------------------------------------------------------------------------------
/uboot-bootimg.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2012 The Cyanogenmod Project
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | #
16 |
17 | #
18 | # To use this bootimg
19 | #
20 | # Add to your BoardConfig.mk:
21 | # BOARD_CUSTOM_BOOTIMG_MK := device/common/uboot-bootimg.mk
22 | # If using uboot multiimage add:
23 | # BOARD_USES_UBOOT_MULTIIMAGE := true
24 | #
25 |
26 | #
27 | # Ramdisk/boot image
28 | #
29 | LOCAL_PATH := $(call my-dir)
30 |
31 | PRODUCT_VERSION = CM-$(PRODUCT_VERSION_MAJOR).$(PRODUCT_VERSION_MINOR).$(PRODUCT_VERSION_MAINTENANCE)$(PRODUCT_VERSION_DEVICE_SPECIFIC)
32 | INTERNAL_UBOOT_IMAGENAME := $(PRODUCT_VERSION) $(TARGET_DEVICE) Ramdisk
33 |
34 | INTERNAL_URAMDISKIMAGE_ARGS := -A ARM -O Linux -T RAMDisk -C none -n "$(INTERNAL_UBOOT_IMAGENAME)" -d $(BUILT_RAMDISK_TARGET)
35 | ZIP_SAVE_UBOOTIMG_ARGS := $(INTERNAL_URAMDISKIMAGE_ARGS)
36 | BUILT_UBOOT_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET:%.img=%.ub)
37 |
38 | $(BUILT_UBOOT_RAMDISK_TARGET): $(INSTALLED_RAMDISK_TARGET) $(MKIMAGE)
39 | $(MKIMAGE) $(INTERNAL_URAMDISKIMAGE_ARGS) $@
40 | @echo ----- Made uboot ramdisk -------- $@
41 |
42 | INSTALLED_RAMDISK_TARGET := $(BUILT_UBOOT_RAMDISK_TARGET)
43 |
44 | ifeq ($(BOARD_USES_UBOOT_MULTIIMAGE),true)
45 | ifneq ($(strip $(TARGET_NO_KERNEL)),true)
46 |
47 | INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
48 |
49 | INTERNAL_UBOOT_MULTIIMAGENAME := $(PRODUCT_VERSION) $(TARGET_DEVICE) Multiboot
50 |
51 | INTERNAL_UMULTIIMAGE_ARGS := -A ARM -O Linux -T multi -C none -n "$(INTERNAL_UBOOT_MULTIIMAGENAME)"
52 |
53 | BOARD_UBOOT_ENTRY := $(strip $(BOARD_UBOOT_ENTRY))
54 | ifdef BOARD_UBOOT_ENTRY
55 | INTERNAL_UMULTIIMAGE_ARGS += -e $(BOARD_UBOOT_ENTRY)
56 | endif
57 |
58 | BOARD_UBOOT_LOAD := $(strip $(BOARD_UBOOT_LOAD))
59 | ifdef BOARD_UBOOT_LOAD
60 | INTERNAL_UMULTIIMAGE_ARGS += -a $(BOARD_UBOOT_LOAD)
61 | endif
62 |
63 | INTERNAL_UMULTIIMAGE_ARGS += -d $(INSTALLED_KERNEL_TARGET):$(BUILT_UBOOT_RAMDISK_TARGET)
64 | ZIP_SAVE_UBOOTIMG_ARGS := $(INTERNAL_UMULTIIMAGE_ARGS)
65 | $(INSTALLED_BOOTIMAGE_TARGET): $(MKIMAGE) $(INTERNAL_RAMDISK_FILES) $(BUILT_UBOOT_RAMDISK_TARGET) $(INSTALLED_KERNEL_TARGET)
66 | $(MKIMAGE) $(INTERNAL_UMULTIIMAGE_ARGS) $@
67 | @echo ----- Made uboot multiimage -------- $@
68 |
69 | endif #!TARGET_NO_KERNEL
70 | else # Seperate uboot images kernel/ramdisk
71 | # HACK: Redefine the bootimage target to just build the ramdisk
72 | $(INSTALLED_BOOTIMAGE_TARGET): $(BUILT_UBOOT_RAMDISK_TARGET)
73 | endif
74 |
75 |
76 | #
77 | # Recovery Image
78 | #
79 | INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
80 | INTERNAL_RECOVERYRAMDISK_IMAGENAME := CWM $(TARGET_DEVICE) Ramdisk
81 | INTERNAL_RECOVERYRAMDISKIMAGE_ARGS := -A ARM -O Linux -T RAMDisk -C none -n "$(INTERNAL_RECOVERYRAMDISK_IMAGENAME)" -d $(recovery_ramdisk)
82 | recovery_uboot_ramdisk := $(recovery_ramdisk:%.img=%.ub)
83 |
84 | $(recovery_uboot_ramdisk): $(MKIMAGE) $(recovery_ramdisk)
85 | @echo ----- Making recovery image ------
86 | $(MKIMAGE) $(INTERNAL_RECOVERYRAMDISKIMAGE_ARGS) $@
87 | @echo ----- Made recovery uboot ramdisk -------- $@
88 |
89 | ifeq ($(BOARD_USES_UBOOT_MULTIIMAGE),true)
90 | $(warning We are here.)
91 | INTERNAL_RECOVERYIMAGE_IMAGENAME := CWM $(TARGET_DEVICE) Multiboot
92 | INTERNAL_RECOVERYIMAGE_ARGS := -A ARM -O Linux -T multi -C none -n "$(INTERNAL_RECOVERYIMAGE_IMAGENAME)"
93 |
94 | BOARD_UBOOT_ENTRY := $(strip $(BOARD_UBOOT_ENTRY))
95 | ifdef BOARD_UBOOT_ENTRY
96 | INTERNAL_RECOVERYIMAGE_ARGS += -e $(BOARD_UBOOT_ENTRY)
97 | endif
98 |
99 | BOARD_UBOOT_LOAD := $(strip $(BOARD_UBOOT_LOAD))
100 | ifdef BOARD_UBOOT_LOAD
101 | INTERNAL_RECOVERYIMAGE_ARGS += -a $(BOARD_UBOOT_LOAD)
102 | endif
103 |
104 | INTERNAL_RECOVERYIMAGE_ARGS += -d $(strip $(recovery_kernel)):$(strip $(recovery_uboot_ramdisk))
105 |
106 | $(INSTALLED_RECOVERYIMAGE_TARGET): $(MKIMAGE) $(recovery_uboot_ramdisk) $(recovery_kernel)
107 | $(MKIMAGE) $(INTERNAL_RECOVERYIMAGE_ARGS) $@
108 | @echo ----- Made recovery uboot multiimage -------- $@
109 |
110 | else #!BOARD_USES_UBOOT_MULTIIMAGE
111 | # If we are not on a multiimage platform lets zip the kernel with the ramdisk
112 | # for Rom Manager
113 | $(INSTALLED_RECOVERYIMAGE_TARGET): $(recovery_uboot_ramdisk) $(recovery_kernel)
114 | $(hide) rm -f $@
115 | zip -qDj $@ $(recovery_uboot_ramdisk) $(recovery_kernel)
116 | @echo ----- Made recovery image \(zip\) -------- $@
117 |
118 | endif
119 |
--------------------------------------------------------------------------------
/ueventd.encore.rc:
--------------------------------------------------------------------------------
1 | /dev/ttyUSB0 0660 system system
2 |
3 | #for DSSCOMP
4 | /dev/dsscomp 0660 system system
5 | /dev/ion 0660 media system
6 |
7 | /dev/pvrsrvkm 0666 system system
8 | /dev/video6 0660 system camera
9 | /dev/video10 0660 system camera
10 |
11 | /dev/DspBridge 0660 media system
12 |
13 | # Bluetooth
14 | /dev/hci_tty 0600 bluetooth bluetooth
15 |
16 | /dev/i2c-2 0660 media media
17 |
--------------------------------------------------------------------------------
/unzip-files.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Copyright (C) 2012 The CyanogenMod Project
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | DEVICE=encore
18 | MANUFACTURER=bn
19 |
20 | BASE=../../../vendor/$MANUFACTURER/$DEVICE/proprietary
21 |
22 | if [ $1 ]; then
23 | ZIPFILE=$1
24 | else
25 | ZIPFILE=../../../${DEVICE}_update.zip
26 | fi
27 |
28 | if [ ! -f "$1" ]; then
29 | echo "Cannot find $ZIPFILE. Try specifify the stock update.zip with $0 "
30 | exit 1
31 | fi
32 |
33 | for FILE in `cat proprietary-files.txt`; do
34 | DIR=`dirname $FILE`
35 | if [ ! -d $BASE/$DIR ]; then
36 | mkdir -p $BASE/$DIR
37 | fi
38 | unzip -j -o $ZIPFILE system/$FILE -d $BASE/$DIR/
39 | done
40 |
41 | ./setup-makefiles.sh
42 |
--------------------------------------------------------------------------------
/vendorsetup.sh:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2008 The Android Open Source Project
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | #
16 |
17 | # This file is executed by build/envsetup.sh, and can use anything
18 | # defined in envsetup.sh.
19 | #
20 | # In particular, you can add lunch options with the add_lunch_combo
21 | # function: add_lunch_combo generic-eng
22 |
23 | #add_lunch_combo generic_encore-userdebug
24 | add_lunch_combo full_encore-eng
25 | add_lunch_combo cm_encore-userdebug
26 | #add_lunch_combo cyanogen_encore-eng
27 |
--------------------------------------------------------------------------------
/wlan-nvs-tools/Android.mk:
--------------------------------------------------------------------------------
1 | ifeq ($(strip $(TARGET_BOOTLOADER_BOARD_NAME)),encore)
2 |
3 | LOCAL_PATH := $(call my-dir)
4 | include $(CLEAR_VARS)
5 |
6 | LOCAL_MODULE := store-mac-addr.sh
7 | LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
8 | LOCAL_MODULE_CLASS := EXECUTABLES
9 | LOCAL_MODULE_TAGS := optional
10 |
11 | LOCAL_SRC_FILES := $(LOCAL_MODULE)
12 | include $(BUILD_PREBUILT)
13 |
14 | #
15 | # Install a symlink in /system/etc/firmware pointing to the eventual location
16 | # of the modified nvs file on the device. Snippet shamelessly stolen from
17 | # external/busybox/Android.mk.
18 | #
19 | # If we didn't need this, there would be no need for this Makefile -- we'd just
20 | # add the shell script to PRODUCT_COPY_FILES and be done with it.
21 | #
22 |
23 | NVS_FILENAME := wl1271-nvs.bin
24 | NVS_SYMLINK_TARGET := /data/misc/wifi/$(NVS_FILENAME)
25 | NVS_SYMLINK_DIR := $(TARGET_OUT_ETC)/firmware/ti-connectivity
26 | NVS_SYMLINK := $(NVS_SYMLINK_DIR)/$(NVS_FILENAME)
27 | $(NVS_SYMLINK): $(LOCAL_INSTALLED_MODULE)
28 | @rm -rf $@
29 | @mkdir -p $(NVS_SYMLINK_DIR)
30 | ln -sf $(NVS_SYMLINK_TARGET) $@
31 |
32 | ALL_DEFAULT_INSTALLED_MODULES += $(NVS_SYMLINK)
33 | ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
34 | $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(NVS_SYMLINK)
35 |
36 | endif
37 |
--------------------------------------------------------------------------------
/wlan-nvs-tools/store-mac-addr.sh:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 |
3 | # store-mac-addr -- reads configured wifi MAC address and writes it into nvs
4 | # file for use by the wl12xx driver
5 |
6 | ROM_NVS=/system/etc/firmware/ti-connectivity/wl1271-nvs_127x.bin
7 | ORIG_NVS=/data/misc/wifi/wl1271-nvs.bin.orig
8 | NEW_NVS=/data/misc/wifi/wl1271-nvs.bin
9 |
10 | PATH=/vendor/bin:/system/bin:/system/xbin
11 | umask 0022
12 |
13 | # Don't bother updating the nvs file if the one shipped in the ROM hasn't
14 | # changed since the last boot
15 | cmp "$ROM_NVS" "$ORIG_NVS" > /dev/null 2>&1 && exit 0
16 |
17 | # Get the MAC address
18 | macaddr=$(cat /rom/devconf/MACAddress)
19 | [ $macaddr ] || exit 1
20 |
21 | # The MAC address is stored in the nvs file in two pieces: the four
22 | # least-significant bytes in little-endian order starting at byte offset 3
23 | # (indexed to 0), and the two most-significant bytes in little-endian order
24 | # starting at byte offset 10.
25 | #
26 | # We're using printf to write these bytes to the file, so parse the MAC
27 | # address to produce the escape sequences we'll use as arguments to printf.
28 | lowbytes=$(echo "$macaddr" | sed -e 's#^\(..\)\(..\)\(..\)\(..\)\(..\)\(..\)$#\\x\6\\x\5\\x\4\\x\3#')
29 | highbytes=$(echo "$macaddr" | sed -e 's#^\(..\)\(..\)\(..\)\(..\)\(..\)\(..\)$#\\x\2\\x\1#')
30 |
31 | # Create the new nvs file by copying over the ROM's copy byte by byte,
32 | # replacing only the pieces containing the MAC address
33 | dd if="$ROM_NVS" of="$NEW_NVS" bs=1 count=3
34 | printf "$lowbytes" >> "$NEW_NVS"
35 | dd if="$ROM_NVS" of="$NEW_NVS" bs=1 skip=7 seek=7 count=3
36 | printf "$highbytes" >> "$NEW_NVS"
37 | dd if="$ROM_NVS" of="$NEW_NVS" bs=1 skip=12 seek=12
38 |
39 | # Store the unmodified nvs file for reference
40 | cp "$ROM_NVS" "$ORIG_NVS"
41 |
42 | exit 0
43 |
--------------------------------------------------------------------------------