summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.mk16
-rw-r--r--AndroidBoard.mk77
-rw-r--r--AndroidBoardCommon.mk45
-rw-r--r--BoardConfig.mk45
-rw-r--r--BoardConfigCommon.mk69
-rw-r--r--CleanSpec.mk49
-rw-r--r--board-info.txt2
-rw-r--r--boot/Android.mk35
-rw-r--r--boot/board.c105
-rw-r--r--boot/keypad.c74
-rw-r--r--boot/panel.c29
-rw-r--r--boot/usb.c38
-rw-r--r--device_dream_sapphire.mk63
-rw-r--r--device_dream_sapphire_us.mk19
-rw-r--r--egl.cfg33
-rwxr-xr-xextract-files.sh85
-rw-r--r--full_dream_sapphire.mk32
-rw-r--r--h2w_headset.kl9
-rw-r--r--init.sapphire.rc90
-rw-r--r--init.trout.rc90
-rw-r--r--kernelbin0 -> 2115204 bytes
-rw-r--r--libsensors/Android.mk31
-rw-r--r--libsensors/sensors.c592
-rw-r--r--media_profiles.xml153
-rw-r--r--overlay/frameworks/base/core/res/res/values/config.xml68
-rw-r--r--overlay/frameworks/base/core/res/res/xml/power_profile.xml58
-rw-r--r--overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml21
-rw-r--r--overlay/packages/apps/Bluetooth/res/values/strings.xml25
-rw-r--r--overlay/packages/apps/Launcher2/res/values/config.xml6
-rw-r--r--overlay/packages/apps/Launcher2/res/values/strings.xml24
-rw-r--r--overlay/packages/apps/Phone/res/values/config.xml20
-rw-r--r--overlay/packages/inputmethods/LatinIME/res/values/bools.xml23
-rw-r--r--sapphire-keypad.kcm64
-rw-r--r--sapphire-keypad.kl85
-rwxr-xr-xsetup-makefiles.sh61
-rw-r--r--tools/Android.mk33
-rw-r--r--tools/MODULE_LICENSE_APACHE20
-rw-r--r--tools/btconfig.c615
-rw-r--r--trout-keypad-qwertz.kcm67
-rw-r--r--trout-keypad-qwertz.kl87
-rw-r--r--trout-keypad-v2.kcm67
-rw-r--r--trout-keypad-v2.kl86
-rw-r--r--trout-keypad-v3.kcm67
-rw-r--r--trout-keypad-v3.kl87
-rw-r--r--trout-keypad.kcm64
-rw-r--r--trout-keypad.kl85
-rwxr-xr-xunzip-files.sh92
-rw-r--r--vendorsetup.sh23
-rw-r--r--vold.fstab33
-rw-r--r--wlan.kobin0 -> 710841 bytes
50 files changed, 3642 insertions, 0 deletions
diff --git a/Android.mk b/Android.mk
new file mode 100644
index 0000000..56de54f
--- /dev/null
+++ b/Android.mk
@@ -0,0 +1,16 @@
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+include $(call all-named-subdir-makefiles, boot libsensors)
diff --git a/AndroidBoard.mk b/AndroidBoard.mk
new file mode 100644
index 0000000..4429839
--- /dev/null
+++ b/AndroidBoard.mk
@@ -0,0 +1,77 @@
+# Copyright (C) 2007 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+# from device/htc/sapphire
+file := $(TARGET_OUT_KEYLAYOUT)/sapphire-keypad.kl
+ALL_PREBUILT += $(file)
+$(file) : $(LOCAL_PATH)/sapphire-keypad.kl | $(ACP)
+ $(transform-prebuilt-to-target)
+
+file := $(TARGET_ROOT_OUT)/init.sapphire.rc
+ALL_PREBUILT += $(file)
+$(file) : $(LOCAL_PATH)/init.sapphire.rc | $(ACP)
+ $(transform-prebuilt-to-target)
+
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := sapphire-keypad.kcm
+include $(BUILD_KEY_CHAR_MAP)
+
+# from device/htc/dream
+file := $(TARGET_OUT_KEYLAYOUT)/trout-keypad.kl
+ALL_PREBUILT += $(file)
+$(file) : $(LOCAL_PATH)/trout-keypad.kl | $(ACP)
+ $(transform-prebuilt-to-target)
+
+file := $(TARGET_OUT_KEYLAYOUT)/trout-keypad-v2.kl
+ALL_PREBUILT += $(file)
+$(file) : $(LOCAL_PATH)/trout-keypad-v2.kl | $(ACP)
+ $(transform-prebuilt-to-target)
+
+file := $(TARGET_OUT_KEYLAYOUT)/trout-keypad-v3.kl
+ALL_PREBUILT += $(file)
+$(file) : $(LOCAL_PATH)/trout-keypad-v3.kl | $(ACP)
+ $(transform-prebuilt-to-target)
+
+file := $(TARGET_OUT_KEYLAYOUT)/trout-keypad-qwertz.kl
+ALL_PREBUILT += $(file)
+$(file) : $(LOCAL_PATH)/trout-keypad-qwertz.kl | $(ACP)
+ $(transform-prebuilt-to-target)
+
+file := $(TARGET_ROOT_OUT)/init.trout.rc
+ALL_PREBUILT += $(file)
+$(file) : $(LOCAL_PATH)/init.trout.rc | $(ACP)
+ $(transform-prebuilt-to-target)
+
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := trout-keypad.kcm
+include $(BUILD_KEY_CHAR_MAP)
+
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := trout-keypad-v2.kcm
+include $(BUILD_KEY_CHAR_MAP)
+
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := trout-keypad-v3.kcm
+include $(BUILD_KEY_CHAR_MAP)
+
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := trout-keypad-qwertz.kcm
+include $(BUILD_KEY_CHAR_MAP)
+
+include device/htc/dream_sapphire/AndroidBoardCommon.mk
+
+-include vendor/htc/dream_sapphire/AndroidBoardVendor.mk
+
diff --git a/AndroidBoardCommon.mk b/AndroidBoardCommon.mk
new file mode 100644
index 0000000..33f742f
--- /dev/null
+++ b/AndroidBoardCommon.mk
@@ -0,0 +1,45 @@
+# Copyright (C) 2007 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+ifeq ($(TARGET_PREBUILT_KERNEL),)
+TARGET_PREBUILT_KERNEL := $(LOCAL_PATH)/kernel
+endif
+
+file := $(INSTALLED_KERNEL_TARGET)
+ALL_PREBUILT += $(file)
+$(file): $(TARGET_PREBUILT_KERNEL) | $(ACP)
+ $(transform-prebuilt-to-target)
+
+file := $(TARGET_OUT_KEYLAYOUT)/h2w_headset.kl
+ALL_PREBUILT += $(file)
+$(file) : $(LOCAL_PATH)/h2w_headset.kl | $(ACP)
+ $(transform-prebuilt-to-target)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE := vold.fstab
+LOCAL_SRC_FILES := $(LOCAL_MODULE)
+include $(BUILD_PREBUILT)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := wlan.ko
+LOCAL_MODULE_TAGS := user
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/modules
+LOCAL_SRC_FILES := $(LOCAL_MODULE)
+include $(BUILD_PREBUILT)
+
+-include vendor/htc/dream-sapphire/AndroidBoardCommonVendor.mk
diff --git a/BoardConfig.mk b/BoardConfig.mk
new file mode 100644
index 0000000..67de3f8
--- /dev/null
+++ b/BoardConfig.mk
@@ -0,0 +1,45 @@
+# Copyright (C) 2007 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# config.mk
+#
+# Product-specific compile-time definitions.
+#
+
+# WARNING: This line must come *before* including the proprietary
+# variant, so that it gets overwritten by the parent (which goes
+# against the traditional rules of inheritance).
+USE_CAMERA_STUB := true
+
+-include vendor/htc/dream_sapphire/BoardConfigVendor.mk
+
+TARGET_BOOTLOADER_BOARD_NAME := sapphire
+
+# # cat /proc/mtd
+# dev: size erasesize name
+# mtd0: 00040000 00020000 "misc"
+# mtd1: 00500000 00020000 "recovery"
+# mtd2: 00280000 00020000 "boot"
+# mtd3: 05a00000 00020000 "system"
+# mtd4: 05000000 00020000 "cache"
+# mtd5: 127c0000 00020000 "userdata"
+BOARD_BOOTIMAGE_PARTITION_SIZE := 0x00280000
+BOARD_RECOVERYIMAGE_PARTITION_SIZE := 0x00500000
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 0x05a00000
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 0x127c0000
+
+#TARGET_RECOVERY_UI_LIB := librecovery_ui_sapphire librecovery_ui_htc
+
+include device/htc/dream_sapphire/BoardConfigCommon.mk
+
diff --git a/BoardConfigCommon.mk b/BoardConfigCommon.mk
new file mode 100644
index 0000000..ed71bea
--- /dev/null
+++ b/BoardConfigCommon.mk
@@ -0,0 +1,69 @@
+# Copyright (C) 2007 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# config.mk
+#
+# Product-specific compile-time definitions.
+#
+
+# WARNING: This line must come *before* including the proprietary
+# variant, so that it gets overwritten by the parent (which goes
+# against the traditional rules of inheritance).
+USE_CAMERA_STUB := true
+
+-include vendor/htc/dream_sapphire/BoardConfigVendor.mk
+
+TARGET_BOARD_PLATFORM := msm7k
+TARGET_CPU_ABI := armeabi
+
+TARGET_NO_BOOTLOADER := true
+
+# Wifi related defines
+BOARD_WPA_SUPPLICANT_DRIVER := CUSTOM
+BOARD_WPA_SUPPLICANT_PRIVATE_LIB := libWifiApi
+BOARD_WLAN_TI_STA_DK_ROOT := system/wlan/ti/sta_dk_4_0_4_32
+WIFI_DRIVER_MODULE_PATH := "/system/lib/modules/wlan.ko"
+WIFI_DRIVER_MODULE_ARG := ""
+WIFI_DRIVER_MODULE_NAME := "wlan"
+WIFI_FIRMWARE_LOADER := "wlan_loader"
+
+TARGET_BOOTLOADER_LIBS := \
+ libboot_board_dream_sapphire_combined \
+ libboot_arch_msm7k \
+ libboot_arch_armv6
+
+TARGET_BOOTLOADER_LINK_SCRIPT := \
+ hardware/msm7k/boot/boot.ld
+
+BOARD_KERNEL_CMDLINE := no_console_suspend=1 console=null
+
+BOARD_HAVE_BLUETOOTH := true
+
+BOARD_VENDOR_USE_AKMD := akm8976
+
+BOARD_VENDOR_QCOM_AMSS_VERSION := 6220
+
+# The size of a block that can be marked bad.
+BOARD_FLASH_BLOCK_SIZE := 131072
+
+# OpenGL drivers config file path
+BOARD_EGL_CFG := device/htc/dream-sapphire/egl.cfg
+
+# Use libcamera2
+BOARD_USES_OLD_CAMERA_HACK := true
+
+# No fallback font by default (space savings)
+NO_FALLBACK_FONT:=true
+
+TARGET_RELEASETOOLS_EXTENSIONS := device/htc/common
diff --git a/CleanSpec.mk b/CleanSpec.mk
new file mode 100644
index 0000000..b84e1b6
--- /dev/null
+++ b/CleanSpec.mk
@@ -0,0 +1,49 @@
+# Copyright (C) 2007 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# If you don't need to do a full clean build but would like to touch
+# a file or delete some intermediate files, add a clean step to the end
+# of the list. These steps will only be run once, if they haven't been
+# run before.
+#
+# E.g.:
+# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
+# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
+#
+# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
+# files that are missing or have been moved.
+#
+# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
+# Use $(OUT_DIR) to refer to the "out" directory.
+#
+# If you need to re-do something that's already mentioned, just copy
+# the command and add it to the bottom of the list. E.g., if a change
+# that you made last week required touching a file and a change you
+# made today requires touching the same file, just copy the old
+# touch step and add it to the end of the list.
+#
+# ************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+# ************************************************
+
+# For example:
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
+#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
+#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
+
+# ************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+# ************************************************
diff --git a/board-info.txt b/board-info.txt
new file mode 100644
index 0000000..fb1ce5d
--- /dev/null
+++ b/board-info.txt
@@ -0,0 +1,2 @@
+require board=sapphire|trout
+require version-bootloader=1.33.2005|1.33.0004|1.33.2004|1.33.3004|1.33.0005|1.33.2005|1.33.3005|1.33.0006|1.33.2006|1.33.3006|1.33.0007|1.33.2007|1.33.3007|1.33.0008|1.33.2008|1.33.3008|1.33.0011|1.33.2011|1.33.3011|1.33.0013|1.33.2013|1.33.3013
diff --git a/boot/Android.mk b/boot/Android.mk
new file mode 100644
index 0000000..4f394f9
--- /dev/null
+++ b/boot/Android.mk
@@ -0,0 +1,35 @@
+# Copyright (C) 2007 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifneq ($(TARGET_SIMULATOR),true)
+
+include $(CLEAR_VARS)
+
+LOCAL_ARM_MODE := arm
+
+LOCAL_SRC_FILES := board.c panel.c keypad.c usb.c
+
+LOCAL_C_INCLUDES := $(call include-path-for, bootloader)
+
+LOCAL_CFLAGS := -O2 -g -W -Wall
+LOCAL_CFLAGS += -march=armv6
+
+LOCAL_MODULE := libboot_board_dream_sapphire_combined
+
+include $(BUILD_RAW_STATIC_LIBRARY)
+
+endif # !TARGET_SIMULATOR
+
diff --git a/boot/board.c b/boot/board.c
new file mode 100644
index 0000000..f2b4daf
--- /dev/null
+++ b/boot/board.c
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <boot/boot.h>
+#include <boot/flash.h>
+
+ptentry PTABLE[] = {
+ {
+ .start = 310,
+ .length = 40,
+ .name = "recovery",
+ },
+ {
+ .start = 350,
+ .length = 20,
+ .name = "boot",
+ },
+ {
+ .start = 370,
+ .length = 540,
+ .name = "system",
+ },
+ {
+ .start = 910,
+ .length = 1138,
+ .name = "userdata",
+ },
+ {
+ .start = 0,
+ .length = 0,
+ .name = "",
+ },
+};
+
+#define MISC2_CHARGER_OFF 0x01 /* DISABLE charge circuitry */
+#define MISC2_ISET 0x02 /* Enable Current Limit */
+
+#define MISC2_H2W_MASK 0xC0
+#define MISC2_H2W_GPIO 0x00
+#define MISC2_H2W_UART1 0x40
+#define MISC2_H2W_UART3 0x80
+#define MISC2_H2W_BT 0xC0
+
+void board_init()
+{
+ unsigned n;
+
+ /* if we already have partitions from elsewhere,
+ ** don't use the hardcoded ones
+ */
+ if(flash_get_ptn_count() == 0) {
+ for(n = 0; PTABLE[n].name[0]; n++) {
+ flash_add_ptn(PTABLE + n);
+ }
+ }
+
+ /* UART configuration */
+#if 1
+ /* UART3 */
+ writeb(MISC2_H2W_UART3, 0x98000000);
+ uart_init(2);
+#else
+ /* UART1 */
+ writeb(MISC2_H2W_UART1, 0x98000000);
+ uart_init(0);
+#endif
+ mdelay(100);
+}
+
+const char *board_cmdline(void)
+{
+ return "mem=112M console=ttyMSM0 androidboot.console=ttyMSM0";
+};
+
+unsigned board_machtype(void)
+{
+ return 1440;
+}
+
+void board_reboot(void)
+{
+ gpio_set(25, 0);
+}
+
+void board_getvar(const char *name, char *value)
+{
+ if(!strcmp(name, "version.amss")) {
+ get_version_modem(value);
+ } else if(!strcmp(name, "version.amss.sbl")) {
+ get_version_modem_sbl(value);
+ }
+}
diff --git a/boot/keypad.c b/boot/keypad.c
new file mode 100644
index 0000000..b1de09d
--- /dev/null
+++ b/boot/keypad.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <boot/boot.h>
+#include <boot/board.h>
+#include <boot/gpio_keypad.h>
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+static unsigned int dream_row_gpios[] = {
+#if 0 // unused?
+ 35, /* KP_MKOUT0 */
+ 34, /* KP_MKOUT1 */
+ 33, /* KP_MKOUT2 */
+ 32, /* KP_MKOUT3 */
+ 31, /* KP_MKOUT4 */
+ 23, /* KP_MKOUT5 */
+#endif
+#if 1
+ 30, /* KP_MKOUT6 */
+ 78, /* KP_MKOUT7 */
+#endif
+};
+
+static unsigned int dream_col_gpios[] = {
+#if 1 // main buttons
+ 42, /* KP_MKIN0 */
+ 41, /* KP_MKIN1 */
+ 40, /* KP_MKIN2 */
+ 39, /* KP_MKIN3 */
+#endif
+#if 1 // side buttons
+ 38, /* KP_MKIN4 */
+ 37, /* KP_MKIN5 */
+ 36, /* KP_MKIN6 */
+#endif
+};
+static gpio_keypad_info dream_keypad = {
+ .output_gpios = dream_row_gpios,
+ .input_gpios = dream_col_gpios,
+ .noutputs = ARRAY_SIZE(dream_row_gpios),
+ .ninputs = ARRAY_SIZE(dream_col_gpios),
+ .settle_time = 5000,
+ .polarity = 0
+};
+
+static void keypad_poll()
+{
+ static int skip = 0;
+ skip++;
+ if(skip > 10) {
+ gpio_keypad_scan_keys(&dream_keypad);
+ skip = 0;
+ }
+}
+
+
+void keypad_init(void)
+{
+ gpio_keypad_init(&dream_keypad);
+ boot_register_poll_func(keypad_poll);
+}
diff --git a/boot/panel.c b/boot/panel.c
new file mode 100644
index 0000000..e264027
--- /dev/null
+++ b/boot/panel.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <boot/board.h>
+
+void panel_init(struct mddi_client_caps *caps)
+{
+}
+
+void panel_poweron(void)
+{
+}
+
+void panel_backlight(int on)
+{
+}
diff --git a/boot/usb.c b/boot/usb.c
new file mode 100644
index 0000000..d2856c3
--- /dev/null
+++ b/boot/usb.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <boot/boot.h>
+
+void ulpi_write(unsigned val, unsigned reg);
+unsigned ulpi_read(unsigned reg);
+
+void board_usb_init(void)
+{
+ writeb(0, 0x98000004);
+ mdelay(100);
+ writeb((1 << 5), 0x98000004);
+ mdelay(100);
+}
+
+void board_ulpi_init(void)
+{
+ /* adjust eye diagram */
+ ulpi_write(0x40, 0x31);
+
+ /* disable VBUS interrupt to avoid stuck PHY issue */
+ ulpi_write(0x1D, 0x0D);
+ ulpi_write(0x1D, 0x10);
+}
diff --git a/device_dream_sapphire.mk b/device_dream_sapphire.mk
new file mode 100644
index 0000000..88e96fb
--- /dev/null
+++ b/device_dream_sapphire.mk
@@ -0,0 +1,63 @@
+#
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+DEVICE_PACKAGE_OVERLAYS := device/htc/dream_sapphire/overlay
+
+PRODUCT_PACKAGES := \
+ sensors.msm7k
+
+# proprietary side of the device
+$(call inherit-product-if-exists, vendor/htc/dream_sapphire/device_dream_sapphire-vendor.mk)
+
+# stuff common to all HTC phones
+$(call inherit-product, device/htc/common/common.mk)
+
+# Install the features available on this device.
+PRODUCT_COPY_FILES := \
+ frameworks/base/data/etc/handheld_core_hardware.xml:system/etc/permissions/handheld_core_hardware.xml \
+ frameworks/base/data/etc/android.hardware.camera.autofocus.xml:system/etc/permissions/android.hardware.camera.autofocus.xml \
+ frameworks/base/data/etc/android.hardware.telephony.gsm.xml:system/etc/permissions/android.hardware.telephony.gsm.xml \
+ frameworks/base/data/etc/android.hardware.location.gps.xml:system/etc/permissions/android.hardware.location.gps.xml \
+ frameworks/base/data/etc/android.hardware.wifi.xml:system/etc/permissions/android.hardware.wifi.xml \
+ frameworks/base/data/etc/android.hardware.touchscreen.multitouch.xml:system/etc/permissions/android.hardware.touchscreen.multitouch.xml
+
+PRODUCT_PROPERTY_OVERRIDES := \
+ ro.media.dec.jpeg.memcap=10000000
+
+PRODUCT_PROPERTY_OVERRIDES += \
+ rild.libpath=/system/lib/libhtc_ril.so \
+ wifi.interface=tiwlan0
+
+# Time between scans in seconds. Keep it high to minimize battery drain.
+# This only affects the case in which there are remembered access points,
+# but none are in range.
+PRODUCT_PROPERTY_OVERRIDES += \
+ wifi.supplicant_scan_interval=15
+
+# density in DPI of the LCD of this board. This is used to scale the UI
+# appropriately. If this property is not defined, the default value is 160 dpi.
+PRODUCT_PROPERTY_OVERRIDES += \
+ ro.sf.lcd_density=160
+
+# Default network type
+# 0 => WCDMA Preferred.
+PRODUCT_PROPERTY_OVERRIDES += \
+ ro.telephony.default_network=0
+
+# media configuration xml file
+PRODUCT_COPY_FILES += \
+ device/htc/dream_sapphire/media_profiles.xml:/system/etc/media_profiles.xml
+
diff --git a/device_dream_sapphire_us.mk b/device_dream_sapphire_us.mk
new file mode 100644
index 0000000..bed84af
--- /dev/null
+++ b/device_dream_sapphire_us.mk
@@ -0,0 +1,19 @@
+#
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+$(call inherit-product, device/common/gps/gps_us_supl.mk)
+$(call inherit-product-if-exists, vendor/htc/dream_sapphire/device_dream_sapphire_us-vendor.mk)
+$(call inherit-product, device/htc/dream_sapphire/device_dream_sapphire.mk)
diff --git a/egl.cfg b/egl.cfg
new file mode 100644
index 0000000..f67bfa2
--- /dev/null
+++ b/egl.cfg
@@ -0,0 +1,33 @@
+#
+# Copyright (C) 2009 The Android Open-Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# One line per configuration, of the form:
+#
+# D I TAG
+#
+# D: display (0: default)
+# I: implementation (0: software, 1: hardware)
+# TAG: a unique tag
+#
+# The library name loaded by EGL is constructed as (in that order):
+#
+# /system/lib/egl/libGLES_$TAG.so
+# /system/lib/egl/lib{EGL|GLESv1_CM|GLESv2}_$TAG.so
+#
+
+
+0 0 android
+0 1 qcom
diff --git a/extract-files.sh b/extract-files.sh
new file mode 100755
index 0000000..915f74d
--- /dev/null
+++ b/extract-files.sh
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+# Copyright (C) 2010 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This file is generated by device/htc/common/generate-blob-scripts.sh - DO NOT EDIT
+
+DEVICE=dream_sapphire
+
+mkdir -p ../../../vendor/htc/$DEVICE/proprietary
+adb pull /system/bin/akmd ../../../vendor/htc/$DEVICE/proprietary/akmd
+chmod 755 ../../../vendor/htc/$DEVICE/proprietary/akmd
+adb pull /system/etc/AudioFilter.csv ../../../vendor/htc/$DEVICE/proprietary/AudioFilter.csv
+adb pull /system/etc/AudioPara4.csv ../../../vendor/htc/$DEVICE/proprietary/AudioPara4.csv
+adb pull /system/etc/AudioPreProcess.csv ../../../vendor/htc/$DEVICE/proprietary/AudioPreProcess.csv
+adb pull /system/etc/firmware/brf6300.bin ../../../vendor/htc/$DEVICE/proprietary/brf6300.bin
+adb pull /system/etc/wifi/Fw1251r1c.bin ../../../vendor/htc/$DEVICE/proprietary/Fw1251r1c.bin
+adb pull /system/lib/egl/libGLES_qcom.so ../../../vendor/htc/$DEVICE/proprietary/libGLES_qcom.so
+adb pull /system/lib/libaudioeq.so ../../../vendor/htc/$DEVICE/proprietary/libaudioeq.so
+adb pull /system/lib/libgps.so ../../../vendor/htc/$DEVICE/proprietary/libgps.so
+adb pull /system/lib/libhtc_acoustic.so ../../../vendor/htc/$DEVICE/proprietary/libhtc_acoustic.so
+adb pull /system/lib/libhtc_ril.so ../../../vendor/htc/$DEVICE/proprietary/libhtc_ril.so
+adb pull /system/lib/liblvmxipc.so ../../../vendor/htc/$DEVICE/proprietary/liblvmxipc.so
+adb pull /system/lib/libmm-adspsvc.so ../../../vendor/htc/$DEVICE/proprietary/libmm-adspsvc.so
+adb pull /system/lib/liboemcamera.so ../../../vendor/htc/$DEVICE/proprietary/liboemcamera.so
+adb pull /system/lib/libOmxCore.so ../../../vendor/htc/$DEVICE/proprietary/libOmxCore.so
+adb pull /system/lib/libOmxH264Dec.so ../../../vendor/htc/$DEVICE/proprietary/libOmxH264Dec.so
+adb pull /system/lib/libOmxMpeg4Dec.so ../../../vendor/htc/$DEVICE/proprietary/libOmxMpeg4Dec.so
+adb pull /system/lib/libOmxVidEnc.so ../../../vendor/htc/$DEVICE/proprietary/libOmxVidEnc.so
+
+(cat << EOF) | sed s/__DEVICE__/$DEVICE/g > ../../../vendor/htc/$DEVICE/device_$DEVICE-vendor-blobs.mk
+# Copyright (C) 2010 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This file is generated by device/htc/__DEVICE__/extract-files.sh - DO NOT EDIT
+
+# Prebuilt libraries that are needed to build open-source libraries
+PRODUCT_COPY_FILES := \\
+ vendor/htc/__DEVICE__/proprietary/libgps.so:obj/lib/libgps.so
+
+# All the blobs necessary for sapphire
+PRODUCT_COPY_FILES += \\
+ vendor/htc/__DEVICE__/proprietary/akmd:system/bin/akmd \\
+ vendor/htc/__DEVICE__/proprietary/AudioFilter.csv:system/etc/AudioFilter.csv \\
+ vendor/htc/__DEVICE__/proprietary/AudioPara4.csv:system/etc/AudioPara4.csv \\
+ vendor/htc/__DEVICE__/proprietary/AudioPreProcess.csv:system/etc/AudioPreProcess.csv \\
+ vendor/htc/__DEVICE__/proprietary/brf6300.bin:system/etc/firmware/brf6300.bin \\
+ vendor/htc/__DEVICE__/proprietary/Fw1251r1c.bin:system/etc/wifi/Fw1251r1c.bin \\
+ vendor/htc/__DEVICE__/proprietary/libGLES_qcom.so:system/lib/egl/libGLES_qcom.so \\
+ vendor/htc/__DEVICE__/proprietary/libaudioeq.so:system/lib/libaudioeq.so \\
+ vendor/htc/__DEVICE__/proprietary/libgps.so:system/lib/libgps.so \\
+ vendor/htc/__DEVICE__/proprietary/libhtc_acoustic.so:system/lib/libhtc_acoustic.so \\
+ vendor/htc/__DEVICE__/proprietary/libhtc_ril.so:system/lib/libhtc_ril.so \\
+ vendor/htc/__DEVICE__/proprietary/liblvmxipc.so:system/lib/liblvmxipc.so \\
+ vendor/htc/__DEVICE__/proprietary/libmm-adspsvc.so:system/lib/libmm-adspsvc.so \\
+ vendor/htc/__DEVICE__/proprietary/liboemcamera.so:system/lib/liboemcamera.so \\
+ vendor/htc/__DEVICE__/proprietary/libOmxCore.so:system/lib/libOmxCore.so \\
+ vendor/htc/__DEVICE__/proprietary/libOmxH264Dec.so:system/lib/libOmxH264Dec.so \\
+ vendor/htc/__DEVICE__/proprietary/libOmxMpeg4Dec.so:system/lib/libOmxMpeg4Dec.so \\
+ vendor/htc/__DEVICE__/proprietary/libOmxVidEnc.so:system/lib/libOmxVidEnc.so
+EOF
+
+./setup-makefiles.sh
diff --git a/full_dream_sapphire.mk b/full_dream_sapphire.mk
new file mode 100644
index 0000000..43e21dc
--- /dev/null
+++ b/full_dream_sapphire.mk
@@ -0,0 +1,32 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# This file is the build configuration for a full Android
+# build for dream/sapphire hardware. This cleanly combines a set of
+# device-specific aspects (drivers) with a device-agnostic
+# product configuration (apps).
+#
+
+# Inherit from those products. Most specific first.
+$(call inherit-product, $(SRC_TARGET_DIR)/product/languages_small.mk)
+# This is where we'd set a backup provider if we had one
+#$(call inherit-product, device/sample/products/backup_overlay.mk)
+$(call inherit-product, device/htc/dream_sapphire/device_dream_sapphire_us.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/full.mk)
+
+# Discard inherited values and use our own instead.
+PRODUCT_NAME := full_dream_sapphire
+PRODUCT_DEVICE := dream_sapphire
+PRODUCT_MODEL := Full Android on Dream/Sapphire
diff --git a/h2w_headset.kl b/h2w_headset.kl
new file mode 100644
index 0000000..14f4382
--- /dev/null
+++ b/h2w_headset.kl
@@ -0,0 +1,9 @@
+key 107 ENDCALL WAKE_DROPPED
+key 113 MUTE
+key 114 VOLUME_DOWN
+key 115 VOLUME_UP
+key 163 MEDIA_NEXT
+key 164 MEDIA_PLAY_PAUSE
+key 165 MEDIA_PREVIOUS
+key 226 HEADSETHOOK WAKE
+key 231 CALL WAKE_DROPPED
diff --git a/init.sapphire.rc b/init.sapphire.rc
new file mode 100644
index 0000000..17cb216
--- /dev/null
+++ b/init.sapphire.rc
@@ -0,0 +1,90 @@
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+on early-init
+ device mtd@misc 0460 radio diag
+
+# Set timeout value for rmnet stats.
+ write /sys/devices/virtual/net/rmnet0/timeout_suspend 5000000
+ write /sys/devices/virtual/net/rmnet0/timeout 18000000
+
+on boot
+# unmap left alt to avoid console switch
+ setkey 0x0 0x38 0x0
+# reset SEND+MENU+END
+ setkey 0x0 0xe7 0x706
+ setkey 0x0 0x8b 0x707
+
+ setkey 0x40 0xe7 0x706
+ setkey 0x40 0x8b 0x707
+
+ setkey 0x80 0xe7 0x706
+ setkey 0x80 0x8b 0x707
+
+ setkey 0xc0 0xe7 0x706
+ setkey 0xc0 0x8b 0x707
+ setkey 0xc0 0x6b 0x20c
+
+ mkdir /data/misc/wifi 0770 wifi wifi
+ mkdir /data/misc/wifi/sockets 0770 wifi wifi
+ mkdir /data/misc/dhcp 0770 dhcp dhcp
+ chown dhcp dhcp /data/misc/dhcp
+
+ # bluetooth power up/down interface
+ chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type
+ chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
+ chmod 0660 /sys/class/rfkill/rfkill0/state
+
+ # cpufreq configurations
+ write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 245760
+ write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ondemand
+ write /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate 40000
+ write /sys/devices/system/cpu/cpufreq/ondemand/up_threshold 85
+
+# compass/accelerometer daemon
+service akmd /system/bin/akmd
+ user compass
+ group compass misc input
+
+service wlan_loader /system/bin/wlan_loader \
+ -f /system/etc/wifi/Fw1251r1c.bin -e /proc/calibration \
+ -i /system/etc/wifi/tiwlan.ini
+ disabled
+ oneshot
+
+service wpa_supplicant /system/bin/wpa_supplicant \
+ -Dtiwlan0 -itiwlan0 -c/data/misc/wifi/wpa_supplicant.conf -q
+# we will start as root and wpa_supplicant will switch to user wifi
+# after setting up the capabilities required for WEXT
+# user wifi
+# group wifi inet keystore
+ socket wpa_tiwlan0 dgram 660 wifi wifi
+ disabled
+ oneshot
+
+service dhcpcd /system/bin/dhcpcd -ABKL
+ disabled
+ oneshot
+
+service hciattach /system/bin/hciattach \
+ -n -s 115200 /dev/ttyHS0 texasalt 4000000 flow
+ user bluetooth
+ group bluetooth net_bt_admin
+ disabled
+
+# bugreport is triggered by the KEY_BACK and KEY_MENU keycodes
+service bugreport /system/bin/dumpstate -d -v -o /sdcard/bugreports/bugreport
+ disabled
+ oneshot
+ keycodes 158 139
diff --git a/init.trout.rc b/init.trout.rc
new file mode 100644
index 0000000..5c757a5
--- /dev/null
+++ b/init.trout.rc
@@ -0,0 +1,90 @@
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+on early-init
+ device mtd@misc 0460 radio diag
+
+# Set timeout value for rmnet stats.
+ write /sys/devices/virtual/net/rmnet0/timeout_suspend 5000000
+ write /sys/devices/virtual/net/rmnet0/timeout 18000000
+
+on boot
+# unmap left alt to avoid console switch
+ setkey 0x0 0x38 0x0
+# reset SEND+MENU+END
+ setkey 0x0 0xe7 0x706
+ setkey 0x0 0x8b 0x707
+
+ setkey 0x40 0xe7 0x706
+ setkey 0x40 0x8b 0x707
+
+ setkey 0x80 0xe7 0x706
+ setkey 0x80 0x8b 0x707
+
+ setkey 0xc0 0xe7 0x706
+ setkey 0xc0 0x8b 0x707
+ setkey 0xc0 0x6b 0x20c
+
+ mkdir /data/misc/wifi 0770 wifi wifi
+ mkdir /data/misc/wifi/sockets 0770 wifi wifi
+ mkdir /data/misc/dhcp 0770 dhcp dhcp
+ chown dhcp dhcp /data/misc/dhcp
+
+ # bluetooth power up/down interface
+ chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type
+ chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
+ chmod 0660 /sys/class/rfkill/rfkill0/state
+
+ # cpufreq configurations
+ write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 245760
+ write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ondemand
+ write /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate 40000
+ write /sys/devices/system/cpu/cpufreq/ondemand/up_threshold 85
+
+# compass/accelerometer daemon
+service akmd /system/bin/akmd
+ user compass
+ group compass misc input
+
+service wlan_loader /system/bin/wlan_loader \
+ -f /system/etc/wifi/Fw1251r1c.bin -e /proc/calibration \
+ -i /system/etc/wifi/tiwlan.ini
+ disabled
+ oneshot
+
+service wpa_supplicant /system/bin/wpa_supplicant \
+ -Dtiwlan0 -itiwlan0 -c/data/misc/wifi/wpa_supplicant.conf -q
+# we will start as root and wpa_supplicant will switch to user wifi
+# after setting up the capabilities required for WEXT
+# user wifi
+# group wifi inet keystore
+ socket wpa_tiwlan0 dgram 660 wifi wifi
+ disabled
+ oneshot
+
+service dhcpcd /system/bin/dhcpcd -ABKL
+ disabled
+ oneshot
+
+service hciattach /system/bin/hciattach \
+ -n -s 115200 /dev/ttyHS0 texasalt 4000000 flow
+ user bluetooth
+ group bluetooth net_bt_admin
+ disabled
+
+# bugreport is triggered by the KEY_LEFTSHIFT and KEY_MENU keycodes
+service bugreport /system/bin/dumpstate -d -v -o /sdcard/bugreports/bugreport
+ disabled
+ oneshot
+ keycodes 42 139
diff --git a/kernel b/kernel
new file mode 100644
index 0000000..9911d8d
--- /dev/null
+++ b/kernel
Binary files differ
diff --git a/libsensors/Android.mk b/libsensors/Android.mk
new file mode 100644
index 0000000..2773fae
--- /dev/null
+++ b/libsensors/Android.mk
@@ -0,0 +1,31 @@
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+LOCAL_PATH := $(call my-dir)
+
+ifneq ($(TARGET_SIMULATOR),true)
+
+# HAL module implemenation, not prelinked and stored in
+# hw/<SENSORS_HARDWARE_MODULE_ID>.<ro.product.board>.so
+include $(CLEAR_VARS)
+LOCAL_PRELINK_MODULE := false
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
+LOCAL_SHARED_LIBRARIES := liblog libcutils
+LOCAL_SRC_FILES := sensors.c
+LOCAL_MODULE := sensors.msm7k
+include $(BUILD_SHARED_LIBRARY)
+
+endif # !TARGET_SIMULATOR
diff --git a/libsensors/sensors.c b/libsensors/sensors.c
new file mode 100644
index 0000000..2e57929
--- /dev/null
+++ b/libsensors/sensors.c
@@ -0,0 +1,592 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "Sensors"
+
+#include <hardware/sensors.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <dirent.h>
+#include <math.h>
+#include <poll.h>
+#include <pthread.h>
+
+#include <linux/input.h>
+#include <linux/akm8976.h>
+
+#include <cutils/atomic.h>
+#include <cutils/log.h>
+#include <cutils/native_handle.h>
+
+/*****************************************************************************/
+
+#define MAX_NUM_SENSORS 4
+
+#define SUPPORTED_SENSORS ((1<<MAX_NUM_SENSORS)-1)
+
+#define ID_A (0)
+#define ID_M (1)
+#define ID_O (2)
+#define ID_T (3)
+
+#define SENSORS_ACCELERATION (1<<ID_A)
+#define SENSORS_MAGNETIC_FIELD (1<<ID_M)
+#define SENSORS_ORIENTATION (1<<ID_O)
+#define SENSORS_TEMPERATURE (1<<ID_T)
+
+/*****************************************************************************/
+
+struct sensors_control_context_t {
+ struct sensors_control_device_t device;
+ int akmd_fd;
+ uint32_t active_sensors;
+};
+
+struct sensors_data_context_t {
+ struct sensors_data_device_t device;
+ int events_fd;
+ sensors_data_t sensors[MAX_NUM_SENSORS];
+ uint32_t pendingSensors;
+};
+
+/*
+ * The SENSORS Module
+ */
+
+static const struct sensor_t sSensorList[] = {
+ { "AK8976A 3-axis Accelerometer",
+ "Asahi Kasei",
+ 1, SENSORS_HANDLE_BASE+ID_A,
+ SENSOR_TYPE_ACCELEROMETER, 2.8f*9.81f, 9.81f/45.0f, 3.0f, { } },
+ { "AK8976A 3-axis Magnetic field sensor",
+ "Asahi Kasei",
+ 1, SENSORS_HANDLE_BASE+ID_M,
+ SENSOR_TYPE_MAGNETIC_FIELD, 2000.0f, 1.0f, 6.7f, { } },
+ { "AK8976A Orientation sensor",
+ "Asahi Kasei",
+ 1, SENSORS_HANDLE_BASE+ID_O,
+ SENSOR_TYPE_ORIENTATION, 360.0f, 1.0f, 9.7f, { } },
+ { "AK8976A Temperature sensor",
+ "Asahi Kasei",
+ 1, SENSORS_HANDLE_BASE+ID_T,
+ SENSOR_TYPE_TEMPERATURE, 115.0f, 1.6f, 3.0f, { } },
+};
+
+static int open_sensors(const struct hw_module_t* module, const char* name,
+ struct hw_device_t** device);
+
+static uint32_t sensors__get_sensors_list(struct sensors_module_t* module,
+ struct sensor_t const** list)
+{
+ *list = sSensorList;
+ return sizeof(sSensorList)/sizeof(sSensorList[0]);
+}
+
+static struct hw_module_methods_t sensors_module_methods = {
+ .open = open_sensors
+};
+
+struct sensors_module_t HAL_MODULE_INFO_SYM = {
+ .common = {
+ .tag = HARDWARE_MODULE_TAG,
+ .version_major = 1,
+ .version_minor = 0,
+ .id = SENSORS_HARDWARE_MODULE_ID,
+ .name = "AK8976A SENSORS Module",
+ .author = "The Android Open Source Project",
+ .methods = &sensors_module_methods,
+ },
+ .get_sensors_list = sensors__get_sensors_list
+};
+
+/*****************************************************************************/
+
+#define AKM_DEVICE_NAME "/dev/akm8976_aot"
+
+
+// sensor IDs must be a power of two and
+// must match values in SensorManager.java
+#define EVENT_TYPE_ACCEL_X ABS_X
+#define EVENT_TYPE_ACCEL_Y ABS_Z
+#define EVENT_TYPE_ACCEL_Z ABS_Y
+#define EVENT_TYPE_ACCEL_STATUS ABS_WHEEL
+
+#define EVENT_TYPE_YAW ABS_RX
+#define EVENT_TYPE_PITCH ABS_RY
+#define EVENT_TYPE_ROLL ABS_RZ
+#define EVENT_TYPE_ORIENT_STATUS ABS_RUDDER
+
+#define EVENT_TYPE_MAGV_X ABS_HAT0X
+#define EVENT_TYPE_MAGV_Y ABS_HAT0Y
+#define EVENT_TYPE_MAGV_Z ABS_BRAKE
+
+#define EVENT_TYPE_TEMPERATURE ABS_THROTTLE
+#define EVENT_TYPE_STEP_COUNT ABS_GAS
+
+// 720 LSG = 1G
+#define LSG (720.0f)
+
+// conversion of acceleration data to SI units (m/s^2)
+#define CONVERT_A (GRAVITY_EARTH / LSG)
+#define CONVERT_A_X (-CONVERT_A)
+#define CONVERT_A_Y (CONVERT_A)
+#define CONVERT_A_Z (-CONVERT_A)
+
+// conversion of magnetic data to uT units
+#define CONVERT_M (1.0f/16.0f)
+#define CONVERT_M_X (-CONVERT_M)
+#define CONVERT_M_Y (-CONVERT_M)
+#define CONVERT_M_Z (CONVERT_M)
+
+#define SENSOR_STATE_MASK (0x7FFF)
+
+/*****************************************************************************/
+
+static int open_input(int mode)
+{
+ /* scan all input drivers and look for "compass" */
+ int fd = -1;
+ const char *dirname = "/dev/input";
+ char devname[PATH_MAX];
+ char *filename;
+ DIR *dir;
+ struct dirent *de;
+ dir = opendir(dirname);
+ if(dir == NULL)
+ return -1;
+ strcpy(devname, dirname);
+ filename = devname + strlen(devname);
+ *filename++ = '/';
+ while((de = readdir(dir))) {
+ if(de->d_name[0] == '.' &&
+ (de->d_name[1] == '\0' ||
+ (de->d_name[1] == '.' && de->d_name[2] == '\0')))
+ continue;
+ strcpy(filename, de->d_name);
+ fd = open(devname, mode);
+ if (fd>=0) {
+ char name[80];
+ if (ioctl(fd, EVIOCGNAME(sizeof(name) - 1), &name) < 1) {
+ name[0] = '\0';
+ }
+ if (!strcmp(name, "compass")) {
+ //LOGD("using %s (name=%s)", devname, name);
+ break;
+ }
+ close(fd);
+ fd = -1;
+ }
+ }
+ closedir(dir);
+
+ if (fd < 0) {
+ LOGE("Couldn't find or open 'compass' driver (%s)", strerror(errno));
+ }
+ return fd;
+}
+
+static int open_akm(struct sensors_control_context_t* dev)
+{
+ if (dev->akmd_fd <= 0) {
+ dev->akmd_fd = open(AKM_DEVICE_NAME, O_RDONLY);
+ //LOGD("%s, fd=%d", __PRETTY_FUNCTION__, dev->akmd_fd);
+ LOGE_IF(dev->akmd_fd<0, "Couldn't open %s (%s)",
+ AKM_DEVICE_NAME, strerror(errno));
+ if (dev->akmd_fd >= 0) {
+ dev->active_sensors = 0;
+ }
+ }
+ return dev->akmd_fd;
+}
+
+static void close_akm(struct sensors_control_context_t* dev)
+{
+ if (dev->akmd_fd > 0) {
+ //LOGD("%s, fd=%d", __PRETTY_FUNCTION__, dev->akmd_fd);
+ close(dev->akmd_fd);
+ dev->akmd_fd = -1;
+ }
+}
+
+static void enable_disable(int fd, uint32_t sensors, uint32_t mask)
+{
+ if (fd<0) return;
+ short flags;
+
+ if (mask & SENSORS_ORIENTATION) {
+ flags = (sensors & SENSORS_ORIENTATION) ? 1 : 0;
+ if (ioctl(fd, ECS_IOCTL_APP_SET_MFLAG, &flags) < 0) {
+ LOGE("ECS_IOCTL_APP_SET_MFLAG error (%s)", strerror(errno));
+ }
+ }
+ if (mask & SENSORS_ACCELERATION) {
+ flags = (sensors & SENSORS_ACCELERATION) ? 1 : 0;
+ if (ioctl(fd, ECS_IOCTL_APP_SET_AFLAG, &flags) < 0) {
+ LOGE("ECS_IOCTL_APP_SET_AFLAG error (%s)", strerror(errno));
+ }
+ }
+ if (mask & SENSORS_TEMPERATURE) {
+ flags = (sensors & SENSORS_TEMPERATURE) ? 1 : 0;
+ if (ioctl(fd, ECS_IOCTL_APP_SET_TFLAG, &flags) < 0) {
+ LOGE("ECS_IOCTL_APP_SET_TFLAG error (%s)", strerror(errno));
+ }
+ }
+ if (mask & SENSORS_MAGNETIC_FIELD) {
+ flags = (sensors & SENSORS_MAGNETIC_FIELD) ? 1 : 0;
+ if (ioctl(fd, ECS_IOCTL_APP_SET_MVFLAG, &flags) < 0) {
+ LOGE("ECS_IOCTL_APP_SET_MVFLAG error (%s)", strerror(errno));
+ }
+ }
+}
+
+static uint32_t read_sensors_state(int fd)
+{
+ if (fd<0) return 0;
+ short flags;
+ uint32_t sensors = 0;
+ // read the actual value of all sensors
+ if (!ioctl(fd, ECS_IOCTL_APP_GET_MFLAG, &flags)) {
+ if (flags) sensors |= SENSORS_ORIENTATION;
+ else sensors &= ~SENSORS_ORIENTATION;
+ }
+ if (!ioctl(fd, ECS_IOCTL_APP_GET_AFLAG, &flags)) {
+ if (flags) sensors |= SENSORS_ACCELERATION;
+ else sensors &= ~SENSORS_ACCELERATION;
+ }
+ if (!ioctl(fd, ECS_IOCTL_APP_GET_TFLAG, &flags)) {
+ if (flags) sensors |= SENSORS_TEMPERATURE;
+ else sensors &= ~SENSORS_TEMPERATURE;
+ }
+ if (!ioctl(fd, ECS_IOCTL_APP_GET_MVFLAG, &flags)) {
+ if (flags) sensors |= SENSORS_MAGNETIC_FIELD;
+ else sensors &= ~SENSORS_MAGNETIC_FIELD;
+ }
+ return sensors;
+}
+
+/*****************************************************************************/
+
+static native_handle_t* control__open_data_source(struct sensors_control_context_t *dev)
+{
+ native_handle_t* handle;
+ int fd = open_input(O_RDONLY);
+ if (fd < 0) {
+ return NULL;
+ }
+
+ handle = native_handle_create(1, 0);
+ handle->data[0] = fd;
+ return handle;
+}
+
+static int control__activate(struct sensors_control_context_t *dev,
+ int handle, int enabled)
+{
+ if ((handle<SENSORS_HANDLE_BASE) ||
+ (handle>=SENSORS_HANDLE_BASE+MAX_NUM_SENSORS)) {
+ return -1;
+ }
+
+ uint32_t mask = (1<<handle);
+ uint32_t sensors = enabled ? mask : 0;
+
+ uint32_t active = dev->active_sensors;
+ uint32_t new_sensors = (active & ~mask) | (sensors & mask);
+ uint32_t changed = active ^ new_sensors;
+ if (changed) {
+ int fd = open_akm(dev);
+ if (fd >= 0) {
+ if (!active && new_sensors) {
+ // force all sensors to be updated
+ changed = SUPPORTED_SENSORS;
+ }
+
+ enable_disable(fd, new_sensors, changed);
+
+ LOGD("sensors=%08x, real=%08x",
+ new_sensors, read_sensors_state(fd));
+
+ if (active && !new_sensors) {
+ // close the driver
+ close_akm(dev);
+ }
+ dev->active_sensors = active = new_sensors;
+ } else {
+ active = -1;
+ }
+ }
+ return 0;
+}
+
+static int control__set_delay(struct sensors_control_context_t *dev, int32_t ms)
+{
+#ifdef ECS_IOCTL_APP_SET_DELAY
+ if (dev->akmd_fd <= 0) {
+ return -1;
+ }
+ short delay = ms;
+ if (!ioctl(dev->akmd_fd, ECS_IOCTL_APP_SET_DELAY, &delay)) {
+ return -errno;
+ }
+ return 0;
+#else
+ return -1;
+#endif
+}
+
+static int control__wake(struct sensors_control_context_t *dev)
+{
+ int err = 0;
+ int fd = open_input(O_WRONLY);
+ if (fd > 0) {
+ struct input_event event[1];
+ event[0].type = EV_SYN;
+ event[0].code = SYN_CONFIG;
+ event[0].value = 0;
+ err = write(fd, event, sizeof(event));
+ LOGD_IF(err<0, "control__wake, err=%d (%s)", errno, strerror(errno));
+ close(fd);
+ }
+ return err;
+}
+
+/*****************************************************************************/
+
+static int data__data_open(struct sensors_data_context_t *dev, native_handle_t* handle)
+{
+ int i;
+ memset(&dev->sensors, 0, sizeof(dev->sensors));
+
+ for (i=0 ; i<MAX_NUM_SENSORS ; i++) {
+ // by default all sensors have high accuracy
+ // (we do this because we don't get an update if the value doesn't
+ // change).
+ dev->sensors[i].vector.status = SENSOR_STATUS_ACCURACY_HIGH;
+ }
+ dev->pendingSensors = 0;
+ dev->events_fd = dup(handle->data[0]);
+ //LOGD("data__data_open: fd = %d", handle->data[0]);
+ native_handle_close(handle);
+ native_handle_delete(handle);
+ return 0;
+}
+
+static int data__data_close(struct sensors_data_context_t *dev)
+{
+ if (dev->events_fd > 0) {
+ //LOGD("(data close) about to close fd=%d", dev->events_fd);
+ close(dev->events_fd);
+ dev->events_fd = -1;
+ }
+ return 0;
+}
+
+static int pick_sensor(struct sensors_data_context_t *dev,
+ sensors_data_t* values)
+{
+ uint32_t mask = SUPPORTED_SENSORS;
+ while (mask) {
+ uint32_t i = 31 - __builtin_clz(mask);
+ mask &= ~(1<<i);
+ if (dev->pendingSensors & (1<<i)) {
+ dev->pendingSensors &= ~(1<<i);
+ *values = dev->sensors[i];
+ values->sensor = (1<<i);
+ LOGD_IF(0, "%d [%f, %f, %f]", (1<<i),
+ values->vector.x,
+ values->vector.y,
+ values->vector.z);
+ return i;
+ }
+ }
+ LOGE("No sensor to return!!! pendingSensors=%08x", dev->pendingSensors);
+ // we may end-up in a busy loop, slow things down, just in case.
+ usleep(100000);
+ return -1;
+}
+
+static int data__poll(struct sensors_data_context_t *dev, sensors_data_t* values)
+{
+ int fd = dev->events_fd;
+ if (fd < 0) {
+ LOGE("invalid file descriptor, fd=%d", fd);
+ return -1;
+ }
+
+ // there are pending sensors, returns them now...
+ if (dev->pendingSensors) {
+ return pick_sensor(dev, values);
+ }
+
+ // wait until we get a complete event for an enabled sensor
+ uint32_t new_sensors = 0;
+ while (1) {
+ /* read the next event */
+ struct input_event event;
+ int nread = read(fd, &event, sizeof(event));
+ if (nread == sizeof(event)) {
+ uint32_t v;
+ if (event.type == EV_ABS) {
+ //LOGD("type: %d code: %d value: %-5d time: %ds",
+ // event.type, event.code, event.value,
+ // (int)event.time.tv_sec);
+ switch (event.code) {
+
+ case EVENT_TYPE_ACCEL_X:
+ new_sensors |= SENSORS_ACCELERATION;
+ dev->sensors[ID_A].acceleration.x = event.value * CONVERT_A_X;
+ break;
+ case EVENT_TYPE_ACCEL_Y:
+ new_sensors |= SENSORS_ACCELERATION;
+ dev->sensors[ID_A].acceleration.y = event.value * CONVERT_A_Y;
+ break;
+ case EVENT_TYPE_ACCEL_Z:
+ new_sensors |= SENSORS_ACCELERATION;
+ dev->sensors[ID_A].acceleration.z = event.value * CONVERT_A_Z;
+ break;
+
+ case EVENT_TYPE_MAGV_X:
+ new_sensors |= SENSORS_MAGNETIC_FIELD;
+ dev->sensors[ID_M].magnetic.x = event.value * CONVERT_M_X;
+ break;
+ case EVENT_TYPE_MAGV_Y:
+ new_sensors |= SENSORS_MAGNETIC_FIELD;
+ dev->sensors[ID_M].magnetic.y = event.value * CONVERT_M_Y;
+ break;
+ case EVENT_TYPE_MAGV_Z:
+ new_sensors |= SENSORS_MAGNETIC_FIELD;
+ dev->sensors[ID_M].magnetic.z = event.value * CONVERT_M_Z;
+ break;
+
+ case EVENT_TYPE_YAW:
+ new_sensors |= SENSORS_ORIENTATION;
+ dev->sensors[ID_O].orientation.azimuth = event.value;
+ break;
+ case EVENT_TYPE_PITCH:
+ new_sensors |= SENSORS_ORIENTATION;
+ dev->sensors[ID_O].orientation.pitch = event.value;
+ break;
+ case EVENT_TYPE_ROLL:
+ new_sensors |= SENSORS_ORIENTATION;
+ dev->sensors[ID_O].orientation.roll = -event.value;
+ break;
+
+ case EVENT_TYPE_TEMPERATURE:
+ new_sensors |= SENSORS_TEMPERATURE;
+ dev->sensors[ID_T].temperature = event.value;
+ break;
+
+ case EVENT_TYPE_STEP_COUNT:
+ // step count (only reported in MODE_FFD)
+ // we do nothing with it for now.
+ break;
+ case EVENT_TYPE_ACCEL_STATUS:
+ // accuracy of the calibration (never returned!)
+ //LOGD("G-Sensor status %d", event.value);
+ break;
+ case EVENT_TYPE_ORIENT_STATUS:
+ // accuracy of the calibration
+ v = (uint32_t)(event.value & SENSOR_STATE_MASK);
+ LOGD_IF(dev->sensors[ID_O].orientation.status != (uint8_t)v,
+ "M-Sensor status %d", v);
+ dev->sensors[ID_O].orientation.status = (uint8_t)v;
+ break;
+ }
+ } else if (event.type == EV_SYN) {
+ if (event.code == SYN_CONFIG) {
+ // we use SYN_CONFIG to signal that we need to exit the
+ // main loop.
+ //LOGD("got empty message: value=%d", event.value);
+ return 0x7FFFFFFF;
+ }
+ if (new_sensors) {
+ dev->pendingSensors = new_sensors;
+ int64_t t = event.time.tv_sec*1000000000LL +
+ event.time.tv_usec*1000;
+ while (new_sensors) {
+ uint32_t i = 31 - __builtin_clz(new_sensors);
+ new_sensors &= ~(1<<i);
+ dev->sensors[i].time = t;
+ }
+ return pick_sensor(dev, values);
+ }
+ }
+ }
+ }
+}
+
+/*****************************************************************************/
+
+static int control__close(struct hw_device_t *dev)
+{
+ struct sensors_control_context_t* ctx = (struct sensors_control_context_t*)dev;
+ if (ctx) {
+ if (ctx->akmd_fd > 0)
+ close(ctx->akmd_fd);
+ free(ctx);
+ }
+ return 0;
+}
+
+static int data__close(struct hw_device_t *dev)
+{
+ struct sensors_data_context_t* ctx = (struct sensors_data_context_t*)dev;
+ if (ctx) {
+ if (ctx->events_fd > 0) {
+ //LOGD("(device close) about to close fd=%d", ctx->events_fd);
+ close(ctx->events_fd);
+ }
+ free(ctx);
+ }
+ return 0;
+}
+
+
+/** Open a new instance of a sensor device using name */
+static int open_sensors(const struct hw_module_t* module, const char* name,
+ struct hw_device_t** device)
+{
+ int status = -EINVAL;
+ if (!strcmp(name, SENSORS_HARDWARE_CONTROL)) {
+ struct sensors_control_context_t *dev;
+ dev = malloc(sizeof(*dev));
+ memset(dev, 0, sizeof(*dev));
+ dev->akmd_fd = -1;
+ dev->device.common.tag = HARDWARE_DEVICE_TAG;
+ dev->device.common.version = 0;
+ dev->device.common.module = module;
+ dev->device.common.close = control__close;
+ dev->device.open_data_source = control__open_data_source;
+ dev->device.activate = control__activate;
+ dev->device.set_delay= control__set_delay;
+ dev->device.wake = control__wake;
+ *device = &dev->device.common;
+ } else if (!strcmp(name, SENSORS_HARDWARE_DATA)) {
+ struct sensors_data_context_t *dev;
+ dev = malloc(sizeof(*dev));
+ memset(dev, 0, sizeof(*dev));
+ dev->events_fd = -1;
+ dev->device.common.tag = HARDWARE_DEVICE_TAG;
+ dev->device.common.version = 0;
+ dev->device.common.module = module;
+ dev->device.common.close = data__close;
+ dev->device.data_open = data__data_open;
+ dev->device.data_close = data__data_close;
+ dev->device.poll = data__poll;
+ *device = &dev->device.common;
+ }
+ return status;
+}
diff --git a/media_profiles.xml b/media_profiles.xml
new file mode 100644
index 0000000..d683b1f
--- /dev/null
+++ b/media_profiles.xml
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE MediaSettings [
+<!ELEMENT MediaSettings (CamcorderProfiles,
+ EncoderOutputFileFormat+,
+ VideoEncoderCap+,
+ AudioEncoderCap+,
+ VideoDecoderCap,
+ AudioDecoderCap)>
+<!ELEMENT CamcorderProfiles (EncoderProfile+, ImageEncoding+, ImageDecoding, Camera)>
+<!ELEMENT EncoderProfile (Video, Audio)>
+<!ATTLIST EncoderProfile quality (high|low) #REQUIRED>
+<!ATTLIST EncoderProfile fileFormat (mp4|3gp) #REQUIRED>
+<!ATTLIST EncoderProfile duration (30|60) #REQUIRED>
+<!ELEMENT Video EMPTY>
+<!ATTLIST Video codec (h264|h263|m4v) #REQUIRED>
+<!ATTLIST Video bitRate CDATA #REQUIRED>
+<!ATTLIST Video width CDATA #REQUIRED>
+<!ATTLIST Video height CDATA #REQUIRED>
+<!ATTLIST Video frameRate CDATA #REQUIRED>
+<!ELEMENT Audio EMPTY>
+<!ATTLIST Audio codec (amrnb|amrwb|aac) #REQUIRED>
+<!ATTLIST Audio bitRate CDATA #REQUIRED>
+<!ATTLIST Audio sampleRate CDATA #REQUIRED>
+<!ATTLIST Audio channels (1|2) #REQUIRED>
+<!ELEMENT ImageEncoding EMPTY>
+<!ATTLIST ImageEncoding quality (90|80|70|60|50|40) #REQUIRED>
+<!ELEMENT ImageDecoding EMPTY>
+<!ATTLIST ImageDecoding memCap CDATA #REQUIRED>
+<!ELEMENT Camera EMPTY>
+<!ATTLIST Camera previewFrameRate CDATA #REQUIRED>
+<!ELEMENT EncoderOutputFileFormat EMPTY>
+<!ATTLIST EncoderOutputFileFormat name (mp4|3gp) #REQUIRED>
+<!ELEMENT VideoEncoderCap EMPTY>
+<!ATTLIST VideoEncoderCap name (h264|h263|m4v|wmv) #REQUIRED>
+<!ATTLIST VideoEncoderCap enabled (true|false) #REQUIRED>
+<!ATTLIST VideoEncoderCap minBitRate CDATA #REQUIRED>
+<!ATTLIST VideoEncoderCap maxBitRate CDATA #REQUIRED>
+<!ATTLIST VideoEncoderCap minFrameWidth CDATA #REQUIRED>
+<!ATTLIST VideoEncoderCap maxFrameWidth CDATA #REQUIRED>
+<!ATTLIST VideoEncoderCap minFrameHeight CDATA #REQUIRED>
+<!ATTLIST VideoEncoderCap maxFrameHeight CDATA #REQUIRED>
+<!ATTLIST VideoEncoderCap minFrameRate CDATA #REQUIRED>
+<!ATTLIST VideoEncoderCap maxFrameRate CDATA #REQUIRED>
+<!ELEMENT AudioEncoderCap EMPTY>
+<!ATTLIST AudioEncoderCap name (amrnb|amrwb|aac|wma) #REQUIRED>
+<!ATTLIST AudioEncoderCap enabled (true|false) #REQUIRED>
+<!ATTLIST AudioEncoderCap minBitRate CDATA #REQUIRED>
+<!ATTLIST AudioEncoderCap maxBitRate CDATA #REQUIRED>
+<!ATTLIST AudioEncoderCap minSampleRate CDATA #REQUIRED>
+<!ATTLIST AudioEncoderCap maxSampleRate CDATA #REQUIRED>
+<!ATTLIST AudioEncoderCap minChannels (1|2) #REQUIRED>
+<!ATTLIST AudioEncoderCap maxChannels (1|2) #REQUIRED>
+<!ELEMENT VideoDecoderCap EMPTY>
+<!ATTLIST VideoDecoderCap name (wmv) #REQUIRED>
+<!ATTLIST VideoDecoderCap enabled (true|false) #REQUIRED>
+<!ELEMENT AudioDecoderCap EMPTY>
+<!ATTLIST AudioDecoderCap name (wma) #REQUIRED>
+<!ATTLIST AudioDecoderCap enabled (true|false) #REQUIRED>
+]>
+<!--
+ This file is used to declare the multimedia profiles and capabilities
+ on an android-powered device.
+-->
+<MediaSettings>
+ <!-- Each camcorder profile defines a set of predefined configuration parameters -->
+ <CamcorderProfiles>
+
+ <EncoderProfile quality="high" fileFormat="3gp" duration="60">
+ <Video codec="h263"
+ bitRate="360000"
+ width="352"
+ height="288"
+ frameRate="20" />
+
+ <Audio codec="amrnb"
+ bitRate="12200"
+ sampleRate="8000"
+ channels="1" />
+ </EncoderProfile>
+
+ <EncoderProfile quality="low" fileFormat="3gp" duration="60">
+ <Video codec="h263"
+ bitRate="192000"
+ width="176"
+ height="144"
+ frameRate="20" />
+
+ <Audio codec="amrnb"
+ bitRate="12200"
+ sampleRate="8000"
+ channels="1" />
+
+ </EncoderProfile>
+
+ <ImageEncoding quality="90" />
+ <ImageEncoding quality="80" />
+ <ImageEncoding quality="70" />
+ <ImageDecoding memCap="20000000" />
+
+ <Camera previewFrameRate="0" />
+
+ </CamcorderProfiles>
+
+
+ <EncoderOutputFileFormat name="3gp" />
+ <EncoderOutputFileFormat name="mp4" />
+
+ <!--
+ If a codec is not enabled, it is invisible to the applications
+ In other words, the applications won't be able to use the codec
+ or query the capabilities of the codec at all if it is disabled
+ -->
+ <VideoEncoderCap name="h263" enabled="true"
+ minBitRate="192000" maxBitRate="420000"
+ minFrameWidth="176" maxFrameWidth="352"
+ minFrameHeight="144" maxFrameHeight="288"
+ minFrameRate="1" maxFrameRate="20" />
+
+ <VideoEncoderCap name="m4v" enabled="true"
+ minBitRate="192000" maxBitRate="420000"
+ minFrameWidth="176" maxFrameWidth="352"
+ minFrameHeight="144" maxFrameHeight="288"
+ minFrameRate="1" maxFrameRate="20" />
+
+ <AudioEncoderCap name="amrnb" enabled="true"
+ minBitRate="5525" maxBitRate="12200"
+ minSampleRate="8000" maxSampleRate="8000"
+ minChannels="1" maxChannels="1" />
+
+ <!--
+ FIXME:
+ We do not check decoder capabilities at present
+ At present, we only check whether windows media is visible
+ for TEST applications. For other applications, we do
+ not perform any checks at all.
+ -->
+ <VideoDecoderCap name="wmv" enabled="true"/>
+ <AudioDecoderCap name="wma" enabled="true"/>
+</MediaSettings>
diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml
new file mode 100644
index 0000000..48a32ab
--- /dev/null
+++ b/overlay/frameworks/base/core/res/res/values/config.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources>
+ <!-- The 2d accelerator can't do an alpha transformation of
+ a surface with an alpha channel, so enable this special mode
+ to avoid going into software rendering. -->
+ <bool name="config_sf_limitedAlpha">true</bool>
+
+ <!-- Component name of the service providing network location support. -->
+ <string name="config_networkLocationProvider">com.google.android.location.NetworkLocationProvider</string>
+
+ <!-- Component name of the service providing geocoder API support. -->
+ <string name="config_geocodeProvider">com.google.android.location.GeocodeProvider</string>
+
+ <!-- XXXXX NOTE THE FOLLOWING RESOURCES USE THE WRONG NAMING CONVENTION.
+ Please don't copy them, copy anything else. -->
+
+ <!-- This string array should be overridden by the device to present a list of network
+ attributes. This is used by the connectivity manager to decide which networks can coexist
+ based on the hardware -->
+ <!-- An Array of "[Connection name],[ConnectivityManager connection type],
+ [associated radio-type],[priority] -->
+ <string-array translatable="false" name="networkAttributes">
+ <item>"wifi,1,1,1"</item>
+ <item>"mobile,0,0,0"</item>
+ <item>"mobile_mms,2,0,2"</item>
+ <item>"mobile_supl,3,0,2"</item>
+ <item>"mobile_dun,4,0,4"</item>
+ <item>"mobile_hipri,5,0,3"</item>
+ </string-array>
+
+ <!-- List of regexpressions describing the interface (if any) that represent tetherable
+ USB interfaces. If the device doesn't want to support tething over USB this should
+ be empty. An example would be "usb.*" -->
+ <string-array translatable="false" name="config_tether_usb_regexs">
+ <item>"usb0"</item>
+ </string-array>
+
+ <!-- Regex array of allowable upstream ifaces for tethering - for example if you want
+ tethering on a new interface called "foo2" add <item>"foo\\d"</item> to the array -->
+ <string-array translatable="false" name="config_tether_upstream_regexs">
+ <item>"rmnet\\d"</item>
+ <item>"tiwlan\\d"</item>
+ </string-array>
+
+ <!-- Boolean indicating if we require the use of DUN on mobile for tethering -->
+ <bool translatable="false" name="config_tether_dun_required">false</bool>
+
+</resources>
diff --git a/overlay/frameworks/base/core/res/res/xml/power_profile.xml b/overlay/frameworks/base/core/res/res/xml/power_profile.xml
new file mode 100644
index 0000000..d56d5a3
--- /dev/null
+++ b/overlay/frameworks/base/core/res/res/xml/power_profile.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+**
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License")
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<device name="Android">
+ <item name="none">0</item>
+ <item name="screen.on">30</item>
+ <item name="bluetooth.active">103</item>
+ <item name="bluetooth.on">0.8</item>
+ <!-- CPU wakelock held for 830ms on bluetooth headset at command. 43mA * 830 -->
+ <item name="bluetooth.at">35690</item>
+ <item name="screen.full">114</item>
+ <item name="wifi.on">23</item>
+ <item name="wifi.active">200</item>
+ <item name="wifi.scan">200</item>
+ <item name="dsp.audio">70</item>
+ <item name="dsp.video">100</item>
+ <item name="radio.active">230</item>
+ <item name="gps.on">120</item>
+ <array name="radio.on"> <!-- Strength 0 to BINS-1 -->
+ <value>90</value>
+ <value>3</value>
+ </array>
+ <array name="cpu.speeds">
+ <value>19200</value>
+ <value>122880</value>
+ <value>128000</value>
+ <value>245760</value>
+ <value>384000</value>
+ <value>528000</value>
+ </array>
+ <!-- Power consumption when CPU is idle -->
+ <item name="cpu.idle">1.7</item>
+ <!-- Power consumption at different speeds -->
+ <array name="cpu.active">
+ <value>0</value>
+ <value>0</value>
+ <value>0</value>
+ <value>45</value>
+ <value>100</value>
+ <value>140</value>
+ </array>
+</device>
diff --git a/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml b/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
new file mode 100644
index 0000000..01e6049
--- /dev/null
+++ b/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * Copyright (c) 2009, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<resources>
+ <bool name="def_accelerometer_rotation">true</bool>
+</resources>
diff --git a/overlay/packages/apps/Bluetooth/res/values/strings.xml b/overlay/packages/apps/Bluetooth/res/values/strings.xml
new file mode 100644
index 0000000..2040d11
--- /dev/null
+++ b/overlay/packages/apps/Bluetooth/res/values/strings.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+* Copyright (C) 2010 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Make Bluetooth activity run in phone process. -->
+
+ <string name="sharedUserId" translate="false"> <xliff:g id="x">android.uid.phone</xliff:g> </string>
+ <string name="process" translate="false"> <xliff:g id="x">com.android.phone</xliff:g> </string>
+</resources>
diff --git a/overlay/packages/apps/Launcher2/res/values/config.xml b/overlay/packages/apps/Launcher2/res/values/config.xml
new file mode 100644
index 0000000..f4dd0b9
--- /dev/null
+++ b/overlay/packages/apps/Launcher2/res/values/config.xml
@@ -0,0 +1,6 @@
+<resources>
+ <integer name="config_allAppsFadeInTime">@android:integer/config_mediumAnimTime</integer>
+ <integer name="config_allAppsFadeOutTime">@android:integer/config_shortAnimTime</integer>
+ <integer name="config_allAppsBatchLoadDelay">100</integer>
+ <integer name="config_allAppsBatchSize">4</integer>
+</resources>
diff --git a/overlay/packages/apps/Launcher2/res/values/strings.xml b/overlay/packages/apps/Launcher2/res/values/strings.xml
new file mode 100644
index 0000000..5c9850a
--- /dev/null
+++ b/overlay/packages/apps/Launcher2/res/values/strings.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+* Copyright (C) 2010 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Make launcher run in acore. -->
+ <string name="sharedUserId" translate="false"><xliff:g id="x">android.uid.shared</xliff:g></string>
+ <string name="process" translate="false"><xliff:g id="x">android.process.acore</xliff:g></string>
+</resources>
diff --git a/overlay/packages/apps/Phone/res/values/config.xml b/overlay/packages/apps/Phone/res/values/config.xml
new file mode 100644
index 0000000..729450c
--- /dev/null
+++ b/overlay/packages/apps/Phone/res/values/config.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+ <bool name="allow_incoming_call_touch_ui">false</bool>
+ <bool name="allow_in_call_touch_ui">false</bool>
+</resources>
diff --git a/overlay/packages/inputmethods/LatinIME/res/values/bools.xml b/overlay/packages/inputmethods/LatinIME/res/values/bools.xml
new file mode 100644
index 0000000..948290f
--- /dev/null
+++ b/overlay/packages/inputmethods/LatinIME/res/values/bools.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2008, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources>
+ <!-- Whether or not auto-correction should be enabled by default -->
+ <bool name="enable_autocorrect">true</bool>
+</resources>
diff --git a/sapphire-keypad.kcm b/sapphire-keypad.kcm
new file mode 100644
index 0000000..2f9af21
--- /dev/null
+++ b/sapphire-keypad.kcm
@@ -0,0 +1,64 @@
+[type=QWERTY]
+
+# keycode display number base caps fn caps_fn
+
+A 'A' '2' 'a' 'A' 'a' 'A'
+B 'B' '2' 'b' 'B' 'b' 'B'
+C 'C' '2' 'c' 'C' 'c' 0x00E7
+D 'D' '3' 'd' 'D' ''' 0x00
+E 'E' '3' 'e' 'E' '"' 0x0301
+F 'F' '3' 'f' 'F' '[' 0x00A5
+G 'G' '4' 'g' 'G' ']' '_'
+H 'H' '4' 'h' 'H' '<' '{'
+I 'I' '4' 'i' 'I' '-' 0x0302
+J 'J' '5' 'j' 'J' '>' '}'
+K 'K' '5' 'k' 'K' ';' '~'
+L 'L' '5' 'l' 'L' ':' '`'
+M 'M' '6' 'm' 'M' '!' 0x00
+N 'N' '6' 'n' 'N' 'n' 0x0303
+O 'O' '6' 'o' 'O' '+' 0x00
+P 'P' '7' 'p' 'P' '=' 0x00
+Q 'Q' '7' 'q' 'Q' '|' 0x0300
+R 'R' '7' 'r' 'R' '`' 0x20AC
+S 'S' '7' 's' 'S' '\' 0x00DF
+T 'T' '8' 't' 'T' '{' 0x00A3
+U 'U' '8' 'u' 'U' '_' 0x0308
+V 'V' '8' 'v' 'V' 'v' 'V'
+W 'W' '9' 'w' 'W' '~' 0x00
+X 'X' '9' 'x' 'X' 'x' 0xEF00
+Y 'Y' '9' 'y' 'Y' '}' 0x00A1
+Z 'Z' '9' 'z' 'Z' 'z' 'Z'
+
+# on pc keyboards
+COMMA ',' ',' ',' ',' ',' ','
+PERIOD '.' '.' '.' '.' '.' 0x2026
+AT '@' 0x00 '@' '@' '@' 0x2022
+SLASH '/' '/' '/' '?' '?' '\'
+
+SPACE 0x20 0x20 0x20 0x20 0xEF01 0xEF01
+ENTER 0xa 0xa 0xa 0xa 0xa 0xa
+
+TAB 0x9 0x9 0x9 0x9 0x9 0x9
+0 '0' '0' '0' ')' ')' ')'
+1 '1' '1' '1' '!' '!' '!'
+2 '2' '2' '2' '"' '"' '"'
+3 '3' '3' '3' '#' '#' '#'
+4 '4' '4' '4' '$' '$' '$'
+5 '5' '5' '5' '%' '%' '%'
+6 '6' '6' '6' '^' '^' '^'
+7 '7' '7' '7' '&' '&' '&'
+8 '8' '8' '8' '*' '*' '*'
+9 '9' '9' '9' '(' '(' '('
+GRAVE '`' '`' '`' '~' '`' '~'
+MINUS '-' '-' '-' '_' '-' '_'
+EQUALS '=' '=' '=' '+' '=' '+'
+LEFT_BRACKET '[' '[' '[' '{' '[' '{'
+RIGHT_BRACKET ']' ']' ']' '}' ']' '}'
+BACKSLASH '\' '\' '\' '|' '\' '|'
+SEMICOLON ';' ';' ';' ':' ';' ':'
+APOSTROPHE ''' ''' ''' '"' ''' '"'
+STAR '*' '*' '*' '*' '*' '*'
+POUND '#' '#' '#' '#' '#' '#'
+PLUS '+' '+' '+' '+' '+' '+'
+
+
diff --git a/sapphire-keypad.kl b/sapphire-keypad.kl
new file mode 100644
index 0000000..d924344
--- /dev/null
+++ b/sapphire-keypad.kl
@@ -0,0 +1,85 @@
+key 399 GRAVE
+key 2 1
+key 3 2
+key 4 3
+key 5 4
+key 6 5
+key 7 6
+key 8 7
+key 9 8
+key 10 9
+key 11 0
+key 158 BACK WAKE_DROPPED
+key 230 SOFT_RIGHT WAKE
+key 60 SOFT_RIGHT WAKE
+key 107 ENDCALL WAKE_DROPPED
+key 62 ENDCALL WAKE_DROPPED
+key 229 MENU WAKE_DROPPED
+key 59 MENU WAKE_DROPPED
+key 139 MENU WAKE_DROPPED
+key 127 SEARCH WAKE_DROPPED
+key 228 POUND
+key 227 STAR
+key 231 CALL WAKE_DROPPED
+key 61 CALL WAKE_DROPPED
+key 232 DPAD_CENTER WAKE_DROPPED
+key 108 DPAD_DOWN WAKE_DROPPED
+key 103 DPAD_UP WAKE_DROPPED
+key 102 HOME WAKE
+key 105 DPAD_LEFT WAKE_DROPPED
+key 106 DPAD_RIGHT WAKE_DROPPED
+key 115 VOLUME_UP WAKE
+key 114 VOLUME_DOWN WAKE
+key 116 POWER WAKE
+key 211 FOCUS
+key 212 CAMERA
+
+key 16 Q
+key 17 W
+key 18 E
+key 19 R
+key 20 T
+key 21 Y
+key 22 U
+key 23 I
+key 24 O
+key 25 P
+key 26 LEFT_BRACKET
+key 27 RIGHT_BRACKET
+key 43 BACKSLASH
+
+key 30 A
+key 31 S
+key 32 D
+key 33 F
+key 34 G
+key 35 H
+key 36 J
+key 37 K
+key 38 L
+key 39 SEMICOLON
+key 40 APOSTROPHE
+key 14 DEL
+
+key 44 Z
+key 45 X
+key 46 C
+key 47 V
+key 48 B
+key 49 N
+key 50 M
+key 51 COMMA
+key 52 PERIOD
+key 53 SLASH
+key 28 ENTER
+
+key 56 ALT_LEFT
+key 42 SHIFT_LEFT
+key 15 TAB
+key 57 SPACE
+key 150 EXPLORER
+key 155 ENVELOPE
+
+key 12 MINUS
+key 13 EQUALS
+key 215 AT
diff --git a/setup-makefiles.sh b/setup-makefiles.sh
new file mode 100755
index 0000000..63e4985
--- /dev/null
+++ b/setup-makefiles.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+# Copyright (C) 2010 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+DEVICE=dream_sapphire
+
+mkdir -p ../../../vendor/htc/$DEVICE
+
+(cat << EOF) | sed s/__DEVICE__/$DEVICE/g > ../../../vendor/htc/$DEVICE/device_$DEVICE-vendor.mk
+# Copyright (C) 2010 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This file is generated by device/htc/__DEVICE__/setup-makefiles.sh
+
+\$(call inherit-product, vendor/htc/__DEVICE__/device___DEVICE__-vendor-blobs.mk)
+EOF
+
+(cat << EOF) | sed s/__DEVICE__/$DEVICE/g > ../../../vendor/htc/$DEVICE/BoardConfigVendor.mk
+# Copyright (C) 2010 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This file is generated by device/htc/__DEVICE__/setup-makefiles.sh
+
+BOARD_GPS_LIBRARIES := libgps
+
+USE_CAMERA_STUB := false
+EOF
diff --git a/tools/Android.mk b/tools/Android.mk
new file mode 100644
index 0000000..e664f6c
--- /dev/null
+++ b/tools/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+#
+# btconfig
+#
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES:= btconfig.c
+
+LOCAL_SHARED_LIBRARIES += libbluetooth
+
+LOCAL_C_INCLUDES:= $(call include-path-for, bluez-libs)
+
+LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
+LOCAL_MODULE_TAGS := eng
+LOCAL_MODULE:= btconfig
+
+include $(BUILD_EXECUTABLE)
diff --git a/tools/MODULE_LICENSE_APACHE2 b/tools/MODULE_LICENSE_APACHE2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/MODULE_LICENSE_APACHE2
diff --git a/tools/btconfig.c b/tools/btconfig.c
new file mode 100644
index 0000000..0e25915
--- /dev/null
+++ b/tools/btconfig.c
@@ -0,0 +1,615 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Bluetooth configuration for dream (debug only) */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <sys/uio.h>
+#include <unistd.h>
+
+#include <bluetooth/bluetooth.h>
+#include <bluetooth/hci.h>
+#include <bluetooth/hci_lib.h>
+#include <bluetooth/sco.h>
+
+int vendor_setup_pcm(int sock) {
+ /* Use vendor-specific HCI commands to set up SCO over HCI pr PCM */
+ int rc;
+ unsigned char type = HCI_COMMAND_PKT;
+ hci_command_hdr hdr;
+ /* HCI_VS_Write_SCO_Configuration_Island3
+ * This command is used to configure the codec interface paramters and
+ * includes configuration of the PCM clock rate which is relevant when BT
+ * core is generating the clock. This command MUST be used by the host in
+ * order to use PCM interface.
+ * */
+ hdr.opcode = 0xFD06;
+ unsigned char cmd[] = {
+ 0x00, 0x08, // clock rate: 2048 kHz
+ 0x01, // BRF6300 is input (slave)
+ 0x40, 0x1f, 00, 00, // frame sync frequency: 8kHz
+ 0x01, 00, // frame sync duty cycle: 1 PCM clock
+ 0x01, // frame sync edge: falling
+ 0x00, // frame sync polarity: active high
+ 0x00, // reserved
+ // CHANNEL 1
+ 0x10, 0x00, // out sample size: 16 bits
+ 0x00, 0x00, // out sample offset in frame: 0 PCM clock cycle
+ 0x00, // out edge: rising
+ 0x0E, 0x00, // in sample size: 14 bits
+ 0x01, 0x00, // in sample offset in frame: 1 PCM clock cycle
+ 0x00, // in edge: rising
+ 0x00, // reserved
+ // CHANNEL 2 (not used)
+ 0x00, 0x00,
+ 0x00, 0x00,
+ 0x00,
+ 0x00, 0x00,
+ 0x00, 0x00,
+ 0x00,
+ 0x00,
+ };
+ hdr.plen = sizeof(cmd);
+ struct iovec iov[] = {
+ { &type, 1 },
+ { &hdr, sizeof(hdr) },
+ { &cmd, sizeof(cmd) },
+ };
+ int total_len = 1 + sizeof(hdr) + sizeof(cmd);
+ errno = 0;
+ rc = writev(sock, iov, sizeof(iov)/sizeof(iov[0]));
+ if (rc != total_len) {
+ printf("Can't write %d bytes (wrote %d) to HCI socket: %s (%d)!\n",
+ total_len, rc, strerror(errno), errno);
+ return -1;
+ }
+ return 0;
+}
+
+int vendor_status(int sock) {
+ /* Use vendor-specific HCI command to get system status */
+ int rc;
+ unsigned char type = HCI_COMMAND_PKT;
+ hci_command_hdr hdr;
+ /* HCI_VS_Get_System_Status */
+ hdr.opcode = 0xFE1F;
+ unsigned char cmd[] = {};
+ hdr.plen = sizeof(cmd);
+ struct iovec iov[] = {
+ { &type, 1 },
+ { &hdr, sizeof(hdr) },
+ { &cmd, sizeof(cmd) },
+ };
+ int total_len = 1 + sizeof(hdr) + sizeof(cmd);
+ errno = 0;
+ rc = writev(sock, iov, sizeof(iov)/sizeof(iov[0]));
+ if (rc != total_len) {
+ printf("Can't write %d bytes (wrote %d) to HCI socket: %s (%d)!\n",
+ total_len, rc, strerror(errno), errno);
+ return -1;
+ }
+ return 0;
+}
+
+int vendor_sleep(int sock, int enable) {
+ /* Use vendor-specific HCI command to go into deep sleep mode */
+ int rc;
+ unsigned char type = HCI_COMMAND_PKT;
+ hci_command_hdr hdr;
+ /* HCI_VS_Sleep_Mode_Configuration */
+ hdr.opcode = 0xFD0C;
+ unsigned char cmd[] = {
+ 0x01, // big sleep (1 enable)
+ enable ? 0x01 : 0x00, // deep sleep (1 enable)
+ 0x00, // deep sleep protocol mode: HCILL
+ 0xFF, // reserved
+ 0xFF, // output pull: don't change
+ 0xFF, // input pull: don't change
+ 0x00, // reserved
+ 0x00, // deep sleep timeouut: 0
+ };
+ hdr.plen = sizeof(cmd);
+ struct iovec iov[] = {
+ { &type, 1 },
+ { &hdr, sizeof(hdr) },
+ { &cmd, sizeof(cmd) },
+ };
+ int total_len = 1 + sizeof(hdr) + sizeof(cmd);
+ errno = 0;
+ rc = writev(sock, iov, sizeof(iov)/sizeof(iov[0]));
+ if (rc != total_len) {
+ printf("Can't write %d bytes (wrote %d) to HCI socket: %s (%d)!\n",
+ total_len, rc, strerror(errno), errno);
+ return -1;
+ }
+ return 0;
+}
+
+int vendor_uart_baudrate(int sock, uint32_t rate) {
+ /* Use vendor-specific HCI command to set uart baud rate */
+ int rc;
+ unsigned char type = HCI_COMMAND_PKT;
+ hci_command_hdr hdr;
+ printf("Setting baud rate to %d\n", rate);
+ /* HCI_VS_Sleep_Mode_Configuration */
+ hdr.opcode = 0xFF36;
+ hdr.plen = sizeof(rate);
+ struct iovec iov[] = {
+ { &type, 1 },
+ { &hdr, sizeof(hdr) },
+ { &rate, sizeof(rate) },
+ };
+ int total_len = 1 + sizeof(hdr) + sizeof(rate);
+ errno = 0;
+ rc = writev(sock, iov, sizeof(iov)/sizeof(iov[0]));
+ if (rc != total_len) {
+ printf("Can't write %d bytes (wrote %d) to HCI socket: %s (%d)!\n",
+ total_len, rc, strerror(errno), errno);
+ return -1;
+ }
+ return 0;
+}
+
+int vendor_setup_pcm2(int sock) {
+ int rc;
+ unsigned char type = HCI_COMMAND_PKT;
+ hci_command_hdr hdr;
+ // HCI_VS_Write_CODEC_Config_Enhanced_Island3
+ hdr.opcode = 0xFD07;
+ unsigned char cmd[] = {
+ 0x00, // PCM clock shutdown: disabled
+ 0x00, 0x00, // PCM clock start
+ 0x00, 0x00, // PCM clock stop
+ 0x00, // reserved
+ // Channel 1
+ 0x04, // din order: MSB first, don't swap bytes, shift sample
+ 0x04, // dout order: MSB first, don't swap bytes, shift sample
+ 0x02, // dout mode: Hi-Z when idle
+ 0x00, // dout duplication: disabled
+ 0x00, 0x00, 0x00, 0x00, // tx_dup_value
+ 0x00, // data quant: bitwise
+ 0x00, // reserved
+ // Channel 2
+ 0x00, // din order
+ 0x00, // dout order
+ 0x00, // dout mode
+ 0x00, // dout duplication
+ 0x00, 0x00, 0x00, 0x00, // tx_dup_value
+ 0x00, // data quant
+ 0x00, // reserved
+ };
+ hdr.plen = sizeof(cmd);
+ struct iovec iov[] = {
+ { &type, 1 },
+ { &hdr, sizeof(hdr) },
+ { &cmd, sizeof(cmd) },
+ };
+ int total_len = 1 + sizeof(hdr) + sizeof(cmd);
+ errno = 0;
+ rc = writev(sock, iov, sizeof(iov)/sizeof(iov[0]));
+ if (rc != total_len) {
+ printf("Can't write %d bytes (wrote %d) to HCI socket: %s (%d)!\n",
+ total_len, rc, strerror(errno), errno);
+ return -1;
+ }
+ return 0;
+}
+
+int vendor_coexist(int sock, int enable) {
+ /* Use vendor-specific HCI command to set up WIFI coexistance*/
+ int rc;
+ unsigned char type = HCI_COMMAND_PKT;
+ hci_command_hdr hdr;
+ /* HCI_VS_Write_Wlan_Configuration */
+ hdr.opcode = 0xFD1D;
+ unsigned char cmd[] = {
+ 0x04, // enable: SG2.0
+ 0x01, // polarity: active high
+ 0xE9, 0x05, // priority: TDD, page, page scan, inquiry, inquiry scan, sniff, SCO/eSCO
+ 0x00, 0x00, // connection handle select
+ 0x00, // connection handle: disable
+ 0x00, // frequency mask: disable
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // freq mask: dont change
+ 0x04, // wlan0 mux: IO14
+ 0x01, // wlan0 input pull: enabled
+ 0x00, // wlan1 mux: IO4
+ 0x01, // wlan1 input pull: enabled
+ 0x02, // wlan2 mux: IO3
+ 0x01, // wlan2 input pull: enabled
+ 0x00, // wlan3 mux: PA_OFF on IO1
+ 0xFF, // wlan3 input pull: don't cahnge
+ enable? 0x00 : 0x01, // wlan interface: enable/disable
+ };
+ hdr.plen = sizeof(cmd);
+ struct iovec iov[] = {
+ { &type, 1 },
+ { &hdr, sizeof(hdr) },
+ { &cmd, sizeof(cmd) },
+ };
+ int total_len = 1 + sizeof(hdr) + sizeof(cmd);
+ errno = 0;
+ rc = writev(sock, iov, sizeof(iov)/sizeof(iov[0]));
+ if (rc != total_len) {
+ printf("Can't write %d bytes (wrote %d) to HCI socket: %s (%d)!\n",
+ total_len, rc, strerror(errno), errno);
+ return -1;
+ }
+ return 0;
+}
+
+int setup_loopback1(int sock) {
+ int rc;
+ unsigned char type = HCI_COMMAND_PKT;
+ hci_command_hdr hdr;
+ // HCI_VS_Set_PCM_Loopback_Configuration_Island3 (0xFD04)
+ hdr.opcode = 0xFD04;
+ unsigned char cmd[] = {
+ 0xFF, 0x00, // delay: 255 frame's
+ };
+ hdr.plen = sizeof(cmd);
+ struct iovec iov[] = {
+ { &type, 1 },
+ { &hdr, sizeof(hdr) },
+ { &cmd, sizeof(cmd) },
+ };
+ int total_len = 1 + sizeof(hdr) + sizeof(cmd);
+ errno = 0;
+ rc = writev(sock, iov, sizeof(iov)/sizeof(iov[0]));
+ if (rc != total_len) {
+ printf("Can't write %d bytes (wrote %d) to HCI socket: %s (%d)!\n",
+ total_len, rc, strerror(errno), errno);
+ return -1;
+ }
+ return 0;
+}
+
+int setup_loopback2(int sock, int on) {
+ int rc;
+ unsigned char type = HCI_COMMAND_PKT;
+ hci_command_hdr hdr;
+ // HCI_VS_Set_PCM_Loopback_Enable (0xFE28)
+ hdr.opcode = 0xFE28;
+ printf("loopback %s\n", on ? "ON" : "OFF");
+ unsigned char cmd[] = {
+ on ? 0x01 : 0x00, // enable
+ };
+ hdr.plen = sizeof(cmd);
+ struct iovec iov[] = {
+ { &type, 1 },
+ { &hdr, sizeof(hdr) },
+ { &cmd, sizeof(cmd) },
+ };
+ int total_len = 1 + sizeof(hdr) + sizeof(cmd);
+ errno = 0;
+ rc = writev(sock, iov, sizeof(iov)/sizeof(iov[0]));
+ if (rc != total_len) {
+ printf("Can't write %d bytes (wrote %d) to HCI socket: %s (%d)!\n",
+ total_len, rc, strerror(errno), errno);
+ return -1;
+ }
+ return 0;
+}
+
+
+int write_voice_setting(int sock) {
+ int rc;
+ unsigned char type = HCI_COMMAND_PKT;
+ hci_command_hdr hdr;
+ // HCI_Write_Voice_Setting (0x0026)
+ hdr.opcode = 0x0026;
+ unsigned char cmd[] = {
+ 0x00, 0x00,
+ };
+ hdr.plen = sizeof(cmd);
+ struct iovec iov[] = {
+ { &type, 1 },
+ { &hdr, sizeof(hdr) },
+ { &cmd, sizeof(cmd) },
+ };
+ int total_len = 1 + sizeof(hdr) + sizeof(cmd);
+ errno = 0;
+ rc = writev(sock, iov, sizeof(iov)/sizeof(iov[0]));
+ if (rc != total_len) {
+ printf("Can't write %d bytes (wrote %d) to HCI socket: %s (%d)!\n",
+ total_len, rc, strerror(errno), errno);
+ return -1;
+ }
+ return 0;
+}
+
+static int vendor_specific_sco_setup(int hcifd, int over_hci) {
+ /* Use vendor-specific HCI commands to set up SCO over HCI or PCM */
+ int rc;
+ unsigned char type = HCI_COMMAND_PKT;
+ hci_command_hdr hdr;
+ /* HCI_VS_Write_SCO_Configuration.
+ * Once this command is issued, it is valid for all new SCO channels
+ * created. It is used to determine the following paramters
+ * SCO Connection type - Host (voice over HCI) or Codec
+ * TX packet length used for flow control calculations
+ * TX Buffer max latency determines how much time the data can be in the TX
+ * buffer before being flushed out. Applicable only if flow control is
+ * disabled.
+ */
+ hdr.opcode = 0xFE10;
+ hdr.plen = 0x05;
+ struct hci_sco_t {
+ unsigned char conn_type;
+ unsigned char packet_size;
+ unsigned char max_latency[2];
+ unsigned char bad_crc;
+ } __attribute__((packed)) hci_sco;
+ hci_sco.packet_size = 0x00; /* packet size--keep current setting */
+ hci_sco.max_latency[0] = 0x00;
+ hci_sco.max_latency[1] = 0x00; /* max latency--keep current setting */
+ hci_sco.bad_crc = 0xFF; /* bad CRC handling--keep current setting */
+ struct iovec iov[3] = {
+ { &type, 1 },
+ { &hdr, sizeof(hdr) },
+ { &hci_sco, sizeof(hci_sco) }
+ };
+ int total_len = 1 + sizeof(hdr) + sizeof(hci_sco);
+ printf("Setting Vendor-specific SCO over %s.\n",
+ (over_hci ? "HCI" : "PCM"));
+ errno = 0;
+ hci_sco.conn_type = (unsigned char)(over_hci ? 0x01 : 0x00);
+ rc = writev(hcifd, iov, sizeof(iov)/sizeof(iov[0]));
+ if (rc != total_len) {
+ printf("Can't write %d bytes (wrote %d) to HCI socket: %s (%d)!\n",
+ total_len, rc, strerror(errno), errno);
+ return -1;
+ }
+ return 0;
+}
+
+int get_hci_sock() {
+ int sock = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
+ struct sockaddr_hci addr;
+ int opt;
+
+ if(sock < 0) {
+ printf("Can't create raw socket!\n");
+ return -1;
+ }
+
+ opt = 1;
+ printf("Setting data direction.\n");
+ if (setsockopt(sock, SOL_HCI, HCI_DATA_DIR, &opt, sizeof(opt)) < 0) {
+ printf("Error setting data direction\n");
+ return -1;
+ }
+
+ /* Bind socket to the HCI device */
+ addr.hci_family = AF_BLUETOOTH;
+ addr.hci_dev = 0; // hci0
+ printf("Binding to HCI device.\n");
+ if(bind(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
+ printf("Can't attach to device hci0. %s(%d)\n",
+ strerror(errno),
+ errno);
+ return -1;
+ }
+ return sock;
+}
+
+static const int num_devices = 3;
+static const char device_names[3][20] = {
+ "moto",
+ "jabra250",
+ "jabra125",
+};
+static const bdaddr_t device_addrs[3] = {
+ {0xE1, 0x9C, 0x97, 0x2E, 0x0B, 0x00},
+ {0x5E, 0x88, 0x26, 0xA4, 0x07, 0x00},
+ {0xE3, 0xFD, 0x93, 0x8F, 0x16, 0x00},
+};
+
+void print_bdaddr(const bdaddr_t* bdaddr) {
+ uint8_t* b = (uint8_t*)bdaddr;
+ printf("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
+ b[5], b[4], b[3], b[2], b[1], b[0]);
+}
+
+const bdaddr_t* get_remote_address(char* name) {
+ int i;
+ for (i=0; i<num_devices; i++) {
+ if (strcmp(name, device_names[i]) == 0) {
+ printf("Using ");
+ print_bdaddr(&device_addrs[i]);
+ return &device_addrs[i];
+ }
+ }
+ printf("Unknown device: %s\n", name);
+ for (i=0; i<num_devices; i++) {
+ printf("%s ", device_names[i]);
+ print_bdaddr(&device_addrs[i]);
+ }
+ exit(1);
+}
+
+void sco_setup(char *device_name) {
+ struct sockaddr_sco sco_addr;
+ int sco_sock;
+
+ sco_sock = socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_SCO);
+ if (sco_sock < 0) {
+ printf("Could not create SCO socket\n");
+ return;
+ }
+
+ /* Bind to local address */
+ memset(&sco_addr, 0, sizeof(sco_addr));
+ sco_addr.sco_family = AF_BLUETOOTH;
+ hci_devba(0, &sco_addr.sco_bdaddr);
+ printf("Local BDADDR is: ");
+ print_bdaddr(&sco_addr.sco_bdaddr);
+ printf("Binding...\n");
+ if (bind(sco_sock, (struct sockaddr *) &sco_addr, sizeof(sco_addr)) < 0) {
+ printf("Could not bind SCO socket\n");
+ return;
+ }
+
+ memset(&sco_addr, 0, sizeof(sco_addr));
+ sco_addr.sco_family = AF_BLUETOOTH;
+ memcpy(&sco_addr.sco_bdaddr, get_remote_address(device_name), sizeof(bdaddr_t));
+ printf("Connecting SCO socket...\n");
+ print_bdaddr(&sco_addr.sco_bdaddr);
+ if(connect(sco_sock, (struct sockaddr *)&sco_addr, sizeof(sco_addr)) < 0) {
+ printf("Could not connect to SCO socket\n");
+ return;
+ }
+
+ printf("SCO socket connected\n");
+
+ struct sco_options opts;
+ struct sco_conninfo conninfo;
+
+ socklen_t len = sizeof(opts);
+
+ if (getsockopt(sco_sock, SOL_SCO, SCO_OPTIONS, &opts, &len) < 0) {
+ printf("Couldn't not get SCO socket options\n");
+ return;
+ }
+ printf("SCO MTU: %d\n", opts.mtu);
+
+ len = sizeof(conninfo);
+ if (getsockopt(sco_sock, SOL_SCO, SCO_CONNINFO, &conninfo, &len) < 0) {
+ printf("Couldn't get SCO connection options\n");
+ return;
+ }
+ printf("SCO HCI handle: %d\n", conninfo.hci_handle);
+ printf("SCO HCI device class: %02x%02x%02x\n",
+ conninfo.dev_class[0],
+ conninfo.dev_class[1],
+ conninfo.dev_class[2]);
+}
+
+
+
+int main(int argc, char **argv) {
+ if (argc == 1) {
+ goto usage;
+ }
+
+ if (argc >= 2 && strcmp(argv[1], "pcm_setup") == 0 ) {
+ int sock = get_hci_sock();
+ if (sock < 0) {
+ printf("Could not open hci socket\n");
+ return -1;
+ }
+ if (vendor_specific_sco_setup(sock, 0 /* set up over PCM */) < 0) {
+ printf("Could not set up SCO\n");
+ return -1;
+ }
+ sleep(1);
+ if (vendor_setup_pcm(sock) < 0) {
+ printf("Could not setup up PCM\n");
+ return -1;
+ }
+ sleep(1);
+ } else if (argc >= 2 && strcmp(argv[1], "pcm_setup2") == 0 ) {
+ int sock = get_hci_sock();
+ if (sock < 0) {
+ printf("Could not open hci socket\n");
+ return -1;
+ }
+ if (vendor_setup_pcm2(sock) < 0) {
+ printf("Could not setup up PCM\n");
+ return -1;
+ }
+ sleep(1);
+ } else if (argc >= 2 && strcmp(argv[1], "loopback") == 0 ) {
+ int enable = 1;
+ if (argc > 2) {
+ if (strcmp(argv[2], "off") == 0) {
+ enable = 0;
+ }
+ }
+ int sock = get_hci_sock();
+ if (sock < 0) {
+ printf("Could not open hci socket\n");
+ return -1;
+ }
+ setup_loopback1(sock);
+ setup_loopback2(sock, enable);
+ sleep(1);
+ } else if (argc >= 2 && strcmp(argv[1], "sleep") == 0 ) {
+ int enable = 1;
+ if (argc > 2) {
+ if (strcmp(argv[2], "off") == 0) {
+ enable = 0;
+ }
+ }
+ int sock = get_hci_sock();
+ if (sock < 0) {
+ printf("Could not open hci socket\n");
+ return -1;
+ }
+ vendor_sleep(sock, enable);
+ sleep(1);
+ } else if (argc >= 2 && strcmp(argv[1], "coed") == 0 ) {
+ int enable = 1;
+ if (argc > 2) {
+ if (strcmp(argv[2], "off") == 0) {
+ enable = 0;
+ }
+ }
+ int sock = get_hci_sock();
+ if (sock < 0) {
+ printf("Could not open hci socket\n");
+ return -1;
+ }
+ vendor_coexist(sock, enable);
+ sleep(1);
+ } else if (argc >= 3 && strcmp(argv[1], "rate") == 0 ) {
+ uint32_t rate = atoi(argv[2]);
+ int sock = get_hci_sock();
+ if (sock < 0) {
+ printf("Could not open hci socket\n");
+ return -1;
+ }
+ vendor_uart_baudrate(sock, rate);
+ sleep(1);
+ } else if (argc >= 2 && strcmp(argv[1], "vs_status") == 0 ) {
+ int sock = get_hci_sock();
+ if (sock < 0) {
+ printf("Could not open hci socket\n");
+ return -1;
+ }
+ vendor_status(sock);
+ sleep(1);
+ } else if (argc >= 3 && strcmp(argv[1], "sco_setup") == 0 ) {
+ sco_setup(argv[2]);
+ sleep(100000000);
+ } else {
+usage:
+ printf("Usage:\n");
+ printf("\tbtconfig sleep [on|off]\n");
+ printf("\tbtconfig vs_status\n");
+ printf("\tbtconfig pcm_setup\n");
+ printf("\tbtconfig pcm_setup2\n");
+ printf("\tbtconfig sco_setup DEVICE_ALIAS\n");
+ printf("\tbtconfig loopback [on|off]\n");
+ printf("\tbtconfig coed [on|off]\n");
+ printf("\tbtconfig rate RATE\n");
+ printf("\n");
+ return 0;
+ }
+
+ return 0;
+}
diff --git a/trout-keypad-qwertz.kcm b/trout-keypad-qwertz.kcm
new file mode 100644
index 0000000..3244f11
--- /dev/null
+++ b/trout-keypad-qwertz.kcm
@@ -0,0 +1,67 @@
+[type=QWERTY]
+
+# keycode display number base caps fn caps_fn
+
+A 'A' '2' 'a' 'A' 0x00E4 0x00C4
+B 'B' '2' 'b' 'B' '>' 'B'
+C 'C' '2' 'c' 'C' ']' 0x00E7
+D 'D' '3' 'd' 'D' '\' 0x00
+E 'E' '3' 'e' 'E' 0x20AC 0x0301
+F 'F' '3' 'f' 'F' '{' 0x00A5
+G 'G' '4' 'g' 'G' '}' '_'
+H 'H' '4' 'h' 'H' 0x00D7 '{'
+I 'I' '4' 'i' 'I' '-' 0x0302
+J 'J' '5' 'j' 'J' ':' '}'
+K 'K' '5' 'k' 'K' '+' '~'
+L 'L' '5' 'l' 'L' ''' '`'
+M 'M' '6' 'm' 'M' '"' 0x00
+N 'N' '6' 'n' 'N' ';' 0x0303
+O 'O' '6' 'o' 'O' 0x00F6 0x00D6
+P 'P' '7' 'p' 'P' '=' 0x00
+Q 'Q' '7' 'q' 'Q' 0x9 0x0300
+R 'R' '7' 'r' 'R' '_' 0x00
+S 'S' '7' 's' 'S' 0x00DF 'S'
+T 'T' '8' 't' 'T' 0x00A3 0x00A3
+U 'U' '8' 'u' 'U' 0x00FC 0x00DC
+V 'V' '8' 'v' 'V' '<' 'V'
+W 'W' '9' 'w' 'W' '`' 0x00
+X 'X' '9' 'x' 'X' '[' 0xEF00
+Y 'Y' '9' 'y' 'Y' '|' 0x00
+Z 'Z' '9' 'z' 'Z' 0x00F7 0x00A1
+
+COMMA ',' ',' ',' '?' '?' ','
+PERIOD '.' '.' '.' '/' '/' 0x2026
+AT '@' 0x00 '@' '~' '~' 0x2022
+SLASH '/' '/' '/' '?' '?' '\'
+
+SPACE 0x20 0x20 0x20 0x20 0xEF01 0xEF01
+ENTER 0xa 0xa 0xa 0xa 0xa 0xa
+
+0 '0' '0' '0' ')' ')' ')'
+1 '1' '1' '1' '!' '!' '!'
+2 '2' '2' '2' '@' '@' '@'
+3 '3' '3' '3' '#' '#' '#'
+4 '4' '4' '4' '$' '$' '$'
+5 '5' '5' '5' '%' '%' '%'
+6 '6' '6' '6' '^' '^' '^'
+7 '7' '7' '7' '&' '&' '&'
+8 '8' '8' '8' '*' '*' '*'
+9 '9' '9' '9' '(' '(' '('
+
+
+# these are not actually on the Dream keypad... remove?
+TAB 0x9 0x9 0x9 0x9 0x9 0x9
+GRAVE '`' '`' '`' '~' '`' '~'
+MINUS '-' '-' '-' '_' '-' '_'
+EQUALS '=' '=' '=' '+' '=' '+'
+LEFT_BRACKET '[' '[' '[' '{' '[' '{'
+RIGHT_BRACKET ']' ']' ']' '}' ']' '}'
+BACKSLASH '\' '\' '\' '|' '\' '|'
+SEMICOLON ';' ';' ';' ':' ';' ':'
+APOSTROPHE ''' ''' ''' '"' ''' '"'
+STAR '*' '*' '*' '*' '*' '*'
+POUND '#' '#' '#' '#' '#' '#'
+PLUS '+' '+' '+' '+' '+' '+'
+
+
+
diff --git a/trout-keypad-qwertz.kl b/trout-keypad-qwertz.kl
new file mode 100644
index 0000000..abd264a
--- /dev/null
+++ b/trout-keypad-qwertz.kl
@@ -0,0 +1,87 @@
+key 399 GRAVE
+key 2 1 WAKE_DROPPED
+key 3 2 WAKE_DROPPED
+key 4 3 WAKE_DROPPED
+key 5 4 WAKE_DROPPED
+key 6 5 WAKE_DROPPED
+key 7 6 WAKE_DROPPED
+key 8 7 WAKE_DROPPED
+key 9 8 WAKE_DROPPED
+key 10 9 WAKE_DROPPED
+key 11 0 WAKE_DROPPED
+key 158 BACK WAKE_DROPPED
+key 230 SOFT_RIGHT WAKE
+key 60 SOFT_RIGHT WAKE
+key 107 ENDCALL WAKE_DROPPED
+key 62 ENDCALL WAKE_DROPPED
+key 229 MENU WAKE_DROPPED
+key 59 MENU WAKE_DROPPED
+key 139 MENU WAKE_DROPPED
+key 127 SEARCH WAKE_DROPPED
+key 228 POUND WAKE_DROPPED
+key 227 STAR
+key 231 CALL WAKE_DROPPED
+key 61 CALL WAKE_DROPPED
+key 232 DPAD_CENTER WAKE_DROPPED
+key 108 DPAD_DOWN WAKE_DROPPED
+key 103 DPAD_UP WAKE_DROPPED
+key 102 HOME WAKE
+key 105 DPAD_LEFT WAKE_DROPPED
+key 106 DPAD_RIGHT WAKE_DROPPED
+key 115 VOLUME_UP WAKE
+key 114 VOLUME_DOWN WAKE
+key 116 POWER WAKE
+key 211 FOCUS
+key 212 CAMERA
+
+key 16 Q WAKE_DROPPED
+key 17 W WAKE_DROPPED
+key 18 E WAKE_DROPPED
+key 19 R WAKE_DROPPED
+key 20 T WAKE_DROPPED
+key 21 Z WAKE_DROPPED
+key 22 U WAKE_DROPPED
+key 23 I WAKE_DROPPED
+key 24 O WAKE_DROPPED
+key 25 P WAKE_DROPPED
+key 26 LEFT_BRACKET WAKE_DROPPED
+key 27 RIGHT_BRACKET WAKE_DROPPED
+key 43 BACKSLASH WAKE_DROPPED
+
+key 30 A WAKE_DROPPED
+key 31 S WAKE_DROPPED
+key 32 D WAKE_DROPPED
+key 33 F WAKE_DROPPED
+key 34 G WAKE_DROPPED
+key 35 H WAKE_DROPPED
+key 36 J WAKE_DROPPED
+key 37 K WAKE_DROPPED
+key 38 L WAKE_DROPPED
+key 39 SEMICOLON WAKE_DROPPED
+key 40 APOSTROPHE WAKE_DROPPED
+key 14 DEL WAKE_DROPPED
+
+key 44 Y WAKE_DROPPED
+key 45 X WAKE_DROPPED
+key 46 C WAKE_DROPPED
+key 47 V WAKE_DROPPED
+key 48 B WAKE_DROPPED
+key 49 N WAKE_DROPPED
+key 50 M WAKE_DROPPED
+key 51 COMMA WAKE_DROPPED
+key 52 PERIOD WAKE_DROPPED
+key 53 SLASH WAKE_DROPPED
+key 28 ENTER WAKE_DROPPED
+
+key 56 ALT_LEFT WAKE
+key 100 ALT_RIGHT WAKE
+key 42 SHIFT_LEFT WAKE
+key 54 SHIFT_RIGHT WAKE
+key 15 TAB WAKE_DROPPED
+key 57 SPACE WAKE_DROPPED
+key 150 EXPLORER
+key 155 ENVELOPE
+
+key 12 MINUS WAKE_DROPPED
+key 13 EQUALS WAKE_DROPPED
+key 215 AT WAKE_DROPPED
diff --git a/trout-keypad-v2.kcm b/trout-keypad-v2.kcm
new file mode 100644
index 0000000..1da7069
--- /dev/null
+++ b/trout-keypad-v2.kcm
@@ -0,0 +1,67 @@
+[type=QWERTY]
+
+# keycode display number base caps fn caps_fn
+
+A 'A' '2' 'a' 'A' 'a' 'A'
+B 'B' '2' 'b' 'B' 'b' 'B'
+C 'C' '2' 'c' 'C' 'c' 0x00E7
+D 'D' '3' 'd' 'D' 'd' 0x00
+E 'E' '3' 'e' 'E' '|' 0x0301
+F 'F' '3' 'f' 'F' '[' 0x00A5
+G 'G' '4' 'g' 'G' ']' '_'
+H 'H' '4' 'h' 'H' ':' '{'
+I 'I' '4' 'i' 'I' '-' 0x0302
+J 'J' '5' 'j' 'J' ';' '}'
+K 'K' '5' 'k' 'K' '"' '~'
+L 'L' '5' 'l' 'L' ''' '`'
+M 'M' '6' 'm' 'M' '>' 0x00
+N 'N' '6' 'n' 'N' '<' 0x0303
+O 'O' '6' 'o' 'O' '+' 0x00
+P 'P' '7' 'p' 'P' '=' 0x00
+Q 'Q' '7' 'q' 'Q' 'q' 0x0300
+R 'R' '7' 'r' 'R' '\' 0x20AC
+S 'S' '7' 's' 'S' 's' 0x00DF
+T 'T' '8' 't' 'T' '{' 0x00A3
+U 'U' '8' 'u' 'U' '_' 0x0308
+V 'V' '8' 'v' 'V' 'v' 'V'
+W 'W' '9' 'w' 'W' '`' 0x00
+X 'X' '9' 'x' 'X' 'x' 0xEF00
+Y 'Y' '9' 'y' 'Y' '}' 0x00A1
+Z 'Z' '9' 'z' 'Z' 'z' 'Z'
+
+COMMA ',' ',' ',' ',' ',' ','
+PERIOD '.' '.' '.' '.' '.' 0x2026
+AT '@' 0x00 '@' '~' '~' 0x2022
+SLASH '/' '/' '/' '?' '?' '\'
+
+SPACE 0x20 0x20 0x20 0x20 0xEF01 0xEF01
+ENTER 0xa 0xa 0xa 0xa 0xa 0xa
+
+0 '0' '0' '0' ')' ')' ')'
+1 '1' '1' '1' '!' '!' '!'
+2 '2' '2' '2' '@' '@' '@'
+3 '3' '3' '3' '#' '#' '#'
+4 '4' '4' '4' '$' '$' '$'
+5 '5' '5' '5' '%' '%' '%'
+6 '6' '6' '6' '^' '^' '^'
+7 '7' '7' '7' '&' '&' '&'
+8 '8' '8' '8' '*' '*' '*'
+9 '9' '9' '9' '(' '(' '('
+
+
+# these are not actually on the Dream keypad... remove?
+TAB 0x9 0x9 0x9 0x9 0x9 0x9
+GRAVE '`' '`' '`' '~' '`' '~'
+MINUS '-' '-' '-' '_' '-' '_'
+EQUALS '=' '=' '=' '+' '=' '+'
+LEFT_BRACKET '[' '[' '[' '{' '[' '{'
+RIGHT_BRACKET ']' ']' ']' '}' ']' '}'
+BACKSLASH '\' '\' '\' '|' '\' '|'
+SEMICOLON ';' ';' ';' ':' ';' ':'
+APOSTROPHE ''' ''' ''' '"' ''' '"'
+STAR '*' '*' '*' '*' '*' '*'
+POUND '#' '#' '#' '#' '#' '#'
+PLUS '+' '+' '+' '+' '+' '+'
+
+
+
diff --git a/trout-keypad-v2.kl b/trout-keypad-v2.kl
new file mode 100644
index 0000000..aa9f7bf
--- /dev/null
+++ b/trout-keypad-v2.kl
@@ -0,0 +1,86 @@
+key 399 GRAVE
+key 2 1 WAKE_DROPPED
+key 3 2 WAKE_DROPPED
+key 4 3 WAKE_DROPPED
+key 5 4 WAKE_DROPPED
+key 6 5 WAKE_DROPPED
+key 7 6 WAKE_DROPPED
+key 8 7 WAKE_DROPPED
+key 9 8 WAKE_DROPPED
+key 10 9 WAKE_DROPPED
+key 11 0 WAKE_DROPPED
+key 158 BACK WAKE_DROPPED
+key 230 SOFT_RIGHT WAKE
+key 60 SOFT_RIGHT WAKE
+key 107 ENDCALL WAKE_DROPPED
+key 62 ENDCALL WAKE_DROPPED
+key 229 MENU WAKE_DROPPED
+key 59 MENU WAKE_DROPPED
+key 139 MENU WAKE_DROPPED
+key 127 SEARCH WAKE_DROPPED
+key 228 POUND WAKE_DROPPED
+key 227 STAR
+key 231 CALL WAKE_DROPPED
+key 61 CALL WAKE_DROPPED
+key 232 DPAD_CENTER WAKE_DROPPED
+key 108 DPAD_DOWN WAKE_DROPPED
+key 103 DPAD_UP WAKE_DROPPED
+key 102 HOME WAKE
+key 105 DPAD_LEFT WAKE_DROPPED
+key 106 DPAD_RIGHT WAKE_DROPPED
+key 115 VOLUME_UP WAKE
+key 114 VOLUME_DOWN WAKE
+key 116 POWER WAKE
+key 211 FOCUS
+key 212 CAMERA
+
+key 16 Q WAKE_DROPPED
+key 17 W WAKE_DROPPED
+key 18 E WAKE_DROPPED
+key 19 R WAKE_DROPPED
+key 20 T WAKE_DROPPED
+key 21 Y WAKE_DROPPED
+key 22 U WAKE_DROPPED
+key 23 I WAKE_DROPPED
+key 24 O WAKE_DROPPED
+key 25 P WAKE_DROPPED
+key 26 LEFT_BRACKET WAKE_DROPPED
+key 27 RIGHT_BRACKET WAKE_DROPPED
+key 43 BACKSLASH WAKE_DROPPED
+
+key 30 A WAKE_DROPPED
+key 31 S WAKE_DROPPED
+key 32 D WAKE_DROPPED
+key 33 F WAKE_DROPPED
+key 34 G WAKE_DROPPED
+key 35 H WAKE_DROPPED
+key 36 J WAKE_DROPPED
+key 37 K WAKE_DROPPED
+key 38 L WAKE_DROPPED
+key 39 SEMICOLON WAKE_DROPPED
+key 40 APOSTROPHE WAKE_DROPPED
+key 14 DEL WAKE_DROPPED
+
+key 44 Z WAKE_DROPPED
+key 45 X WAKE_DROPPED
+key 46 C WAKE_DROPPED
+key 47 V WAKE_DROPPED
+key 48 B WAKE_DROPPED
+key 49 N WAKE_DROPPED
+key 50 M WAKE_DROPPED
+key 51 COMMA WAKE_DROPPED
+key 52 PERIOD WAKE_DROPPED
+key 53 SLASH WAKE_DROPPED
+key 28 ENTER WAKE_DROPPED
+
+key 56 ALT_LEFT WAKE
+key 42 SHIFT_LEFT WAKE
+key 54 SHIFT_RIGHT WAKE
+key 15 TAB WAKE_DROPPED
+key 57 SPACE WAKE_DROPPED
+key 150 EXPLORER
+key 155 ENVELOPE
+
+key 12 MINUS WAKE_DROPPED
+key 13 EQUALS WAKE_DROPPED
+key 215 AT WAKE_DROPPED
diff --git a/trout-keypad-v3.kcm b/trout-keypad-v3.kcm
new file mode 100644
index 0000000..af13ef2
--- /dev/null
+++ b/trout-keypad-v3.kcm
@@ -0,0 +1,67 @@
+[type=QWERTY]
+
+# keycode display number base caps alt caps_alt
+
+A 'A' '2' 'a' 'A' 'a' 'A'
+B 'B' '2' 'b' 'B' ']' ']'
+C 'C' '2' 'c' 'C' 'c' 0x00E7
+D 'D' '3' 'd' 'D' '\' '\'
+E 'E' '3' 'e' 'E' '_' 0x0301
+F 'F' '3' 'f' 'F' '{' '{'
+G 'G' '4' 'g' 'G' '}' '}'
+H 'H' '4' 'h' 'H' ':' ':'
+I 'I' '4' 'i' 'I' '-' 0x0302
+J 'J' '5' 'j' 'J' ';' ';'
+K 'K' '5' 'k' 'K' '"' '"'
+L 'L' '5' 'l' 'L' ''' '''
+M 'M' '6' 'm' 'M' '>' '>'
+N 'N' '6' 'n' 'N' '<' 0x0303
+O 'O' '6' 'o' 'O' '+' '+'
+P 'P' '7' 'p' 'P' '=' '='
+Q 'Q' '7' 'q' 'Q' 0x9 0x09
+R 'R' '7' 'r' 'R' 0x00A3 0x00A3
+S 'S' '7' 's' 'S' '|' 0x00DF
+T 'T' '8' 't' 'T' 0x20AC 0x20AC
+U 'U' '8' 'u' 'U' 0xd7 0x0308
+V 'V' '8' 'v' 'V' '[' '['
+W 'W' '9' 'w' 'W' '`' 0x0300
+X 'X' '9' 'x' 'X' 'x' 0xEF00
+Y 'Y' '9' 'y' 'Y' 0xf7 0x00A5
+Z 'Z' '9' 'z' 'Z' 'z' 'Z'
+
+COMMA ',' ',' ',' '?' '?' 0x00BF
+PERIOD '.' '.' '.' '/' '/' 0x2026
+AT '@' 0x00 '@' '~' '~' 0x2022
+
+SPACE 0x20 0x20 0x20 0x20 0xEF01 0xEF01
+ENTER 0xa 0xa 0xa 0xa 0xa 0xa
+
+0 '0' '0' '0' ')' ')' ')'
+1 '1' '1' '1' '!' '!' 0x00A1
+2 '2' '2' '2' '@' '@' '@'
+3 '3' '3' '3' '#' '#' '#'
+4 '4' '4' '4' '$' '$' 0x00A2
+5 '5' '5' '5' '%' '%' '%'
+6 '6' '6' '6' '^' '^' '^'
+7 '7' '7' '7' '&' '&' '&'
+8 '8' '8' '8' '*' '*' '*'
+9 '9' '9' '9' '(' '(' '('
+
+
+# these are not actually on the Dream keypad... remove?
+TAB 0x9 0x9 0x9 0x9 0x9 0x9
+GRAVE '`' '`' '`' '~' '`' '~'
+MINUS '-' '-' '-' '_' '-' '_'
+EQUALS '=' '=' '=' '+' '=' '+'
+LEFT_BRACKET '[' '[' '[' '{' '[' '{'
+RIGHT_BRACKET ']' ']' ']' '}' ']' '}'
+BACKSLASH '\' '\' '\' '|' '\' '|'
+SEMICOLON ';' ';' ';' ':' ';' ':'
+APOSTROPHE ''' ''' ''' '"' ''' '"'
+STAR '*' '*' '*' '*' '*' '*'
+POUND '#' '#' '#' '#' '#' '#'
+PLUS '+' '+' '+' '+' '+' '+'
+SLASH '/' '/' '/' '?' '?' '\'
+
+
+
diff --git a/trout-keypad-v3.kl b/trout-keypad-v3.kl
new file mode 100644
index 0000000..3fdbd97
--- /dev/null
+++ b/trout-keypad-v3.kl
@@ -0,0 +1,87 @@
+key 399 GRAVE
+key 2 1 WAKE_DROPPED
+key 3 2 WAKE_DROPPED
+key 4 3 WAKE_DROPPED
+key 5 4 WAKE_DROPPED
+key 6 5 WAKE_DROPPED
+key 7 6 WAKE_DROPPED
+key 8 7 WAKE_DROPPED
+key 9 8 WAKE_DROPPED
+key 10 9 WAKE_DROPPED
+key 11 0 WAKE_DROPPED
+key 158 BACK WAKE_DROPPED
+key 230 SOFT_RIGHT WAKE
+key 60 SOFT_RIGHT WAKE
+key 107 ENDCALL WAKE_DROPPED
+key 62 ENDCALL WAKE_DROPPED
+key 229 MENU WAKE_DROPPED
+key 59 MENU WAKE_DROPPED
+key 139 MENU WAKE_DROPPED
+key 127 SEARCH WAKE_DROPPED
+key 228 POUND WAKE_DROPPED
+key 227 STAR
+key 231 CALL WAKE_DROPPED
+key 61 CALL WAKE_DROPPED
+key 232 DPAD_CENTER WAKE_DROPPED
+key 108 DPAD_DOWN WAKE_DROPPED
+key 103 DPAD_UP WAKE_DROPPED
+key 102 HOME WAKE
+key 105 DPAD_LEFT WAKE_DROPPED
+key 106 DPAD_RIGHT WAKE_DROPPED
+key 115 VOLUME_UP WAKE
+key 114 VOLUME_DOWN WAKE
+key 116 POWER WAKE
+key 211 FOCUS
+key 212 CAMERA
+
+key 16 Q WAKE_DROPPED
+key 17 W WAKE_DROPPED
+key 18 E WAKE_DROPPED
+key 19 R WAKE_DROPPED
+key 20 T WAKE_DROPPED
+key 21 Y WAKE_DROPPED
+key 22 U WAKE_DROPPED
+key 23 I WAKE_DROPPED
+key 24 O WAKE_DROPPED
+key 25 P WAKE_DROPPED
+key 26 LEFT_BRACKET WAKE_DROPPED
+key 27 RIGHT_BRACKET WAKE_DROPPED
+key 43 BACKSLASH WAKE_DROPPED
+
+key 30 A WAKE_DROPPED
+key 31 S WAKE_DROPPED
+key 32 D WAKE_DROPPED
+key 33 F WAKE_DROPPED
+key 34 G WAKE_DROPPED
+key 35 H WAKE_DROPPED
+key 36 J WAKE_DROPPED
+key 37 K WAKE_DROPPED
+key 38 L WAKE_DROPPED
+key 39 SEMICOLON WAKE_DROPPED
+key 40 APOSTROPHE WAKE_DROPPED
+key 14 DEL WAKE_DROPPED
+
+key 44 Z WAKE_DROPPED
+key 45 X WAKE_DROPPED
+key 46 C WAKE_DROPPED
+key 47 V WAKE_DROPPED
+key 48 B WAKE_DROPPED
+key 49 N WAKE_DROPPED
+key 50 M WAKE_DROPPED
+key 51 COMMA WAKE_DROPPED
+key 52 PERIOD WAKE_DROPPED
+key 53 SLASH WAKE_DROPPED
+key 28 ENTER WAKE_DROPPED
+
+key 56 ALT_LEFT WAKE
+key 100 ALT_RIGHT WAKE
+key 42 SHIFT_LEFT WAKE
+key 54 SHIFT_RIGHT WAKE
+key 15 TAB WAKE_DROPPED
+key 57 SPACE WAKE_DROPPED
+key 150 EXPLORER
+key 155 ENVELOPE
+
+key 12 MINUS WAKE_DROPPED
+key 13 EQUALS WAKE_DROPPED
+key 215 AT WAKE_DROPPED
diff --git a/trout-keypad.kcm b/trout-keypad.kcm
new file mode 100644
index 0000000..2f9af21
--- /dev/null
+++ b/trout-keypad.kcm
@@ -0,0 +1,64 @@
+[type=QWERTY]
+
+# keycode display number base caps fn caps_fn
+
+A 'A' '2' 'a' 'A' 'a' 'A'
+B 'B' '2' 'b' 'B' 'b' 'B'
+C 'C' '2' 'c' 'C' 'c' 0x00E7
+D 'D' '3' 'd' 'D' ''' 0x00
+E 'E' '3' 'e' 'E' '"' 0x0301
+F 'F' '3' 'f' 'F' '[' 0x00A5
+G 'G' '4' 'g' 'G' ']' '_'
+H 'H' '4' 'h' 'H' '<' '{'
+I 'I' '4' 'i' 'I' '-' 0x0302
+J 'J' '5' 'j' 'J' '>' '}'
+K 'K' '5' 'k' 'K' ';' '~'
+L 'L' '5' 'l' 'L' ':' '`'
+M 'M' '6' 'm' 'M' '!' 0x00
+N 'N' '6' 'n' 'N' 'n' 0x0303
+O 'O' '6' 'o' 'O' '+' 0x00
+P 'P' '7' 'p' 'P' '=' 0x00
+Q 'Q' '7' 'q' 'Q' '|' 0x0300
+R 'R' '7' 'r' 'R' '`' 0x20AC
+S 'S' '7' 's' 'S' '\' 0x00DF
+T 'T' '8' 't' 'T' '{' 0x00A3
+U 'U' '8' 'u' 'U' '_' 0x0308
+V 'V' '8' 'v' 'V' 'v' 'V'
+W 'W' '9' 'w' 'W' '~' 0x00
+X 'X' '9' 'x' 'X' 'x' 0xEF00
+Y 'Y' '9' 'y' 'Y' '}' 0x00A1
+Z 'Z' '9' 'z' 'Z' 'z' 'Z'
+
+# on pc keyboards
+COMMA ',' ',' ',' ',' ',' ','
+PERIOD '.' '.' '.' '.' '.' 0x2026
+AT '@' 0x00 '@' '@' '@' 0x2022
+SLASH '/' '/' '/' '?' '?' '\'
+
+SPACE 0x20 0x20 0x20 0x20 0xEF01 0xEF01
+ENTER 0xa 0xa 0xa 0xa 0xa 0xa
+
+TAB 0x9 0x9 0x9 0x9 0x9 0x9
+0 '0' '0' '0' ')' ')' ')'
+1 '1' '1' '1' '!' '!' '!'
+2 '2' '2' '2' '"' '"' '"'
+3 '3' '3' '3' '#' '#' '#'
+4 '4' '4' '4' '$' '$' '$'
+5 '5' '5' '5' '%' '%' '%'
+6 '6' '6' '6' '^' '^' '^'
+7 '7' '7' '7' '&' '&' '&'
+8 '8' '8' '8' '*' '*' '*'
+9 '9' '9' '9' '(' '(' '('
+GRAVE '`' '`' '`' '~' '`' '~'
+MINUS '-' '-' '-' '_' '-' '_'
+EQUALS '=' '=' '=' '+' '=' '+'
+LEFT_BRACKET '[' '[' '[' '{' '[' '{'
+RIGHT_BRACKET ']' ']' ']' '}' ']' '}'
+BACKSLASH '\' '\' '\' '|' '\' '|'
+SEMICOLON ';' ';' ';' ':' ';' ':'
+APOSTROPHE ''' ''' ''' '"' ''' '"'
+STAR '*' '*' '*' '*' '*' '*'
+POUND '#' '#' '#' '#' '#' '#'
+PLUS '+' '+' '+' '+' '+' '+'
+
+
diff --git a/trout-keypad.kl b/trout-keypad.kl
new file mode 100644
index 0000000..d83384a
--- /dev/null
+++ b/trout-keypad.kl
@@ -0,0 +1,85 @@
+key 399 GRAVE
+key 2 1
+key 3 2
+key 4 3
+key 5 4
+key 6 5
+key 7 6
+key 8 7
+key 9 8
+key 10 9
+key 11 0
+key 158 BACK WAKE_DROPPED
+key 230 SOFT_RIGHT WAKE
+key 60 SOFT_RIGHT WAKE
+key 107 ENDCALL WAKE_DROPPED
+key 62 ENDCALL WAKE_DROPPED
+key 229 MENU WAKE_DROPPED
+key 59 MENU WAKE_DROPPED
+key 139 MENU WAKE_DROPPED
+key 127 SEARCH WAKE_DROPPED
+key 228 POUND
+key 227 STAR
+key 231 CALL WAKE_DROPPED
+key 61 CALL WAKE_DROPPED
+key 232 DPAD_CENTER WAKE_DROPPED
+key 108 DPAD_DOWN WAKE_DROPPED
+key 103 DPAD_UP WAKE_DROPPED
+key 102 HOME WAKE
+key 105 DPAD_LEFT WAKE_DROPPED
+key 106 DPAD_RIGHT WAKE_DROPPED
+key 115 VOLUME_UP
+key 114 VOLUME_DOWN
+key 116 POWER WAKE
+key 211 FOCUS
+key 212 CAMERA
+
+key 16 Q
+key 17 W
+key 18 E
+key 19 R
+key 20 T
+key 21 Y
+key 22 U
+key 23 I
+key 24 O
+key 25 P
+key 26 LEFT_BRACKET
+key 27 RIGHT_BRACKET
+key 43 BACKSLASH
+
+key 30 A
+key 31 S
+key 32 D
+key 33 F
+key 34 G
+key 35 H
+key 36 J
+key 37 K
+key 38 L
+key 39 SEMICOLON
+key 40 APOSTROPHE
+key 14 DEL
+
+key 44 Z
+key 45 X
+key 46 C
+key 47 V
+key 48 B
+key 49 N
+key 50 M
+key 51 COMMA
+key 52 PERIOD
+key 53 SLASH
+key 28 ENTER
+
+key 56 ALT_LEFT
+key 42 SHIFT_LEFT
+key 15 TAB
+key 57 SPACE
+key 150 EXPLORER
+key 155 ENVELOPE
+
+key 12 MINUS
+key 13 EQUALS
+key 215 AT
diff --git a/unzip-files.sh b/unzip-files.sh
new file mode 100755
index 0000000..0c5b41a
--- /dev/null
+++ b/unzip-files.sh
@@ -0,0 +1,92 @@
+#!/bin/sh
+
+# Copyright (C) 2010 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This file is generated by device/htc/common/generate-blob-scripts.sh - DO NOT EDIT
+
+DEVICE=dream_sapphire
+
+mkdir -p ../../../vendor/htc/$DEVICE/proprietary
+unzip -j -o ../../../${DEVICE}_update.zip system/bin/akmd -d ../../../vendor/htc/$DEVICE/proprietary
+chmod 755 ../../../vendor/htc/$DEVICE/proprietary/akmd
+unzip -j -o ../../../${DEVICE}_update.zip system/etc/01_qcomm_omx.cfg -d ../../../vendor/htc/$DEVICE/proprietary
+unzip -j -o ../../../${DEVICE}_update.zip system/etc/AudioFilter.csv -d ../../../vendor/htc/$DEVICE/proprietary
+unzip -j -o ../../../${DEVICE}_update.zip system/etc/AudioPara4.csv -d ../../../vendor/htc/$DEVICE/proprietary
+unzip -j -o ../../../${DEVICE}_update.zip system/etc/AudioPreProcess.csv -d ../../../vendor/htc/$DEVICE/proprietary
+unzip -j -o ../../../${DEVICE}_update.zip system/etc/firmware/brf6300.bin -d ../../../vendor/htc/$DEVICE/proprietary
+unzip -j -o ../../../${DEVICE}_update.zip system/etc/wifi/Fw1251r1c.bin -d ../../../vendor/htc/$DEVICE/proprietary
+unzip -j -o ../../../${DEVICE}_update.zip system/lib/egl/libGLES_qcom.so -d ../../../vendor/htc/$DEVICE/proprietary
+unzip -j -o ../../../${DEVICE}_update.zip system/lib/libaudioeq.so -d ../../../vendor/htc/$DEVICE/proprietary
+unzip -j -o ../../../${DEVICE}_update.zip system/lib/libcamera.so -d ../../../vendor/htc/$DEVICE/proprietary
+unzip -j -o ../../../${DEVICE}_update.zip system/lib/libgps.so -d ../../../vendor/htc/$DEVICE/proprietary
+unzip -j -o ../../../${DEVICE}_update.zip system/lib/libhtc_acoustic.so -d ../../../vendor/htc/$DEVICE/proprietary
+unzip -j -o ../../../${DEVICE}_update.zip system/lib/libhtc_ril.so -d ../../../vendor/htc/$DEVICE/proprietary
+unzip -j -o ../../../${DEVICE}_update.zip system/lib/liblvmxipc.so -d ../../../vendor/htc/$DEVICE/proprietary
+unzip -j -o ../../../${DEVICE}_update.zip system/lib/libmm-adspsvc.so -d ../../../vendor/htc/$DEVICE/proprietary
+unzip -j -o ../../../${DEVICE}_update.zip system/lib/liboemcamera.so -d ../../../vendor/htc/$DEVICE/proprietary
+unzip -j -o ../../../${DEVICE}_update.zip system/lib/libOmxCore.so -d ../../../vendor/htc/$DEVICE/proprietary
+unzip -j -o ../../../${DEVICE}_update.zip system/lib/libOmxH264Dec.so -d ../../../vendor/htc/$DEVICE/proprietary
+unzip -j -o ../../../${DEVICE}_update.zip system/lib/libOmxMpeg4Dec.so -d ../../../vendor/htc/$DEVICE/proprietary
+unzip -j -o ../../../${DEVICE}_update.zip system/lib/libOmxVidEnc.so -d ../../../vendor/htc/$DEVICE/proprietary
+unzip -j -o ../../../${DEVICE}_update.zip system/lib/libqcomm_omx.so -d ../../../vendor/htc/$DEVICE/proprietary
+
+(cat << EOF) | sed s/__DEVICE__/$DEVICE/g > ../../../vendor/htc/$DEVICE/device_$DEVICE-vendor-blobs.mk
+# Copyright (C) 2010 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This file is generated by device/htc/__DEVICE__/unzip-files.sh - DO NOT EDIT
+
+# Prebuilt libraries that are needed to build open-source libraries
+PRODUCT_COPY_FILES := \\
+ vendor/htc/__DEVICE__/proprietary/libcamera.so:obj/lib/libcamera.so \\
+ vendor/htc/__DEVICE__/proprietary/libgps.so:obj/lib/libgps.so
+
+# All the blobs necessary for sapphire
+PRODUCT_COPY_FILES += \\
+ vendor/htc/__DEVICE__/proprietary/akmd:system/bin/akmd \\
+ vendor/htc/__DEVICE__/proprietary/01_qcomm_omx.cfg:system/etc/01_qcomm_omx.cfg \\
+ vendor/htc/__DEVICE__/proprietary/AudioFilter.csv:system/etc/AudioFilter.csv \\
+ vendor/htc/__DEVICE__/proprietary/AudioPara4.csv:system/etc/AudioPara4.csv \\
+ vendor/htc/__DEVICE__/proprietary/AudioPreProcess.csv:system/etc/AudioPreProcess.csv \\
+ vendor/htc/__DEVICE__/proprietary/brf6300.bin:system/etc/firmware/brf6300.bin \\
+ vendor/htc/__DEVICE__/proprietary/Fw1251r1c.bin:system/etc/wifi/Fw1251r1c.bin \\
+ vendor/htc/__DEVICE__/proprietary/libGLES_qcom.so:system/lib/egl/libGLES_qcom.so \\
+ vendor/htc/__DEVICE__/proprietary/libaudioeq.so:system/lib/libaudioeq.so \\
+ vendor/htc/__DEVICE__/proprietary/libcamera.so:system/lib/libcamera.so \\
+ vendor/htc/__DEVICE__/proprietary/libgps.so:system/lib/libgps.so \\
+ vendor/htc/__DEVICE__/proprietary/libhtc_acoustic.so:system/lib/libhtc_acoustic.so \\
+ vendor/htc/__DEVICE__/proprietary/libhtc_ril.so:system/lib/libhtc_ril.so \\
+ vendor/htc/__DEVICE__/proprietary/liblvmxipc.so:system/lib/liblvmxipc.so \\
+ vendor/htc/__DEVICE__/proprietary/libmm-adspsvc.so:system/lib/libmm-adspsvc.so \\
+ vendor/htc/__DEVICE__/proprietary/liboemcamera.so:system/lib/liboemcamera.so \\
+ vendor/htc/__DEVICE__/proprietary/libOmxCore.so:system/lib/libOmxCore.so \\
+ vendor/htc/__DEVICE__/proprietary/libOmxH264Dec.so:system/lib/libOmxH264Dec.so \\
+ vendor/htc/__DEVICE__/proprietary/libOmxMpeg4Dec.so:system/lib/libOmxMpeg4Dec.so \\
+ vendor/htc/__DEVICE__/proprietary/libOmxVidEnc.so:system/lib/libOmxVidEnc.so \\
+ vendor/htc/__DEVICE__/proprietary/libqcomm_omx.so:system/lib/libqcomm_omx.so
+EOF
+
+./setup-makefiles.sh
diff --git a/vendorsetup.sh b/vendorsetup.sh
new file mode 100644
index 0000000..d4aac3d
--- /dev/null
+++ b/vendorsetup.sh
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This file is executed by build/envsetup.sh, and can use anything
+# defined in envsetup.sh.
+#
+# In particular, you can add lunch options with the add_lunch_combo
+# function: add_lunch_combo generic-eng
+
+add_lunch_combo full_dream_sapphire-userdebug
diff --git a/vold.fstab b/vold.fstab
new file mode 100644
index 0000000..a48b0ce
--- /dev/null
+++ b/vold.fstab
@@ -0,0 +1,33 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+## Vold 2.0 fstab for HTC Dream or Sapphire
+#
+## - San Mehat (san@android.com)
+##
+
+#######################
+## Regular device mount
+##
+## Format: dev_mount <label> <mount_point> <part> <sysfs_path1...>
+## label - Label for the volume
+## mount_point - Where the volume will be mounted
+## part - Partition # (1 based), or 'auto' for first usable partition.
+## <sysfs_path> - List of sysfs paths to source devices
+######################
+
+# Mounts the first usable partition of the specified device
+dev_mount sdcard /mnt/sdcard auto /devices/platform/goldfish_mmc.0 /devices/platform/msm_sdcc.2/mmc_host/mmc1
+
diff --git a/wlan.ko b/wlan.ko
new file mode 100644
index 0000000..954e620
--- /dev/null
+++ b/wlan.ko
Binary files differ