diff options
author | Jean-Baptiste Queru <jbq@google.com> | 2010-03-11 10:11:36 -0800 |
---|---|---|
committer | Jean-Baptiste Queru <jbq@google.com> | 2010-03-11 10:44:00 -0800 |
commit | 9a53ed15da72904620b15db6f60d5bea33c033d8 (patch) | |
tree | a39983ae08844ee5640f26fa67e8cf6f3d90fb36 | |
parent | c592f9da311832110f11a192f21af7ef8b589dc5 (diff) | |
download | dream-9a53ed15da72904620b15db6f60d5bea33c033d8.tar.gz |
Open-source build configuration for dream
Change-Id: Iff59c6f8e3ab70f0f1cbfe4d980c3672317bc325
53 files changed, 3093 insertions, 0 deletions
diff --git a/Android.mk b/Android.mk new file mode 100644 index 0000000..17e745f --- /dev/null +++ b/Android.mk @@ -0,0 +1,15 @@ +# 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. + +include $(call my-dir)/recovery/Android.mk diff --git a/AndroidBoard.mk b/AndroidBoard.mk new file mode 100644 index 0000000..1441e13 --- /dev/null +++ b/AndroidBoard.mk @@ -0,0 +1,107 @@ +# 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) + +$(call add-radio-file,recovery/images/firmware_install.565) +$(call add-radio-file,recovery/images/firmware_error.565) +$(call add-radio-file,recovery/images/bitmap_size.txt) + +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_OUT_KEYLAYOUT)/h2w_headset.kl +ALL_PREBUILT += $(file) +$(file) : $(LOCAL_PATH)/h2w_headset.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) + +# to build the bootloader you need the common boot stuff, +# the architecture specific stuff, and the board specific stuff +include device/htc/dream/boot/Android.mk + +LOCAL_PATH := device/htc/dream + +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) + + +# This will install the file in /system/etc +# +include $(CLEAR_VARS) +LOCAL_MODULE_CLASS := ETC +LOCAL_MODULE := vold.fstab +LOCAL_SRC_FILES := $(LOCAL_MODULE) +include $(BUILD_PREBUILT) + +# WiFi driver and firmware + +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) + +# hardware modules +include device/htc/dream/libsensors/Android.mk + +# build subdirs +include $(call all-subdir-makefiles) + +-include vendor/htc/dream/AndroidBoardVendor.mk diff --git a/AndroidProducts.mk b/AndroidProducts.mk new file mode 100644 index 0000000..cf0c7ef --- /dev/null +++ b/AndroidProducts.mk @@ -0,0 +1,29 @@ +# +# 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 should set PRODUCT_MAKEFILES to a list of product makefiles +# to expose to the build system. LOCAL_DIR will already be set to +# the directory containing this file. +# +# This file may not rely on the value of any variable other than +# LOCAL_DIR; do not use any conditionals, and do not look up the +# value of any variable that isn't set in this file or in a file that +# it includes. +# + +PRODUCT_MAKEFILES := \ + $(LOCAL_DIR)/generic_dream.mk diff --git a/BoardConfig.mk b/BoardConfig.mk new file mode 100644 index 0000000..69b66d2 --- /dev/null +++ b/BoardConfig.mk @@ -0,0 +1,79 @@ +# 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/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 \ + libboot_arch_msm7k \ + libboot_arch_armv6 + +TARGET_BOOTLOADER_LINK_SCRIPT := \ + hardware/msm7k/boot/boot.ld + +TARGET_BOOTLOADER_BOARD_NAME := trout + +BOARD_KERNEL_CMDLINE := no_console_suspend=1 console=null + +BOARD_HAVE_BLUETOOTH := true + +BOARD_VENDOR_USE_AKMD := akm8976 + +BOARD_VENDOR_QCOM_AMSS_VERSION := 6220 + +# # cat /proc/mtd +# dev: size erasesize name +# mtd0: 000c0000 00020000 "hboot" +# mtd1: 00500000 00020000 "recovery" +# mtd2: 00280000 00020000 "boot" +# mtd3: 04380000 00020000 "system" +# mtd4: 04380000 00020000 "cache" +# mtd5: 04ac0000 00020000 "userdata" +BOARD_BOOTIMAGE_PARTITION_SIZE := 0x00280000 +BOARD_RECOVERYIMAGE_PARTITION_SIZE := 0x00500000 +BOARD_SYSTEMIMAGE_PARTITION_SIZE := 0x04380000 +BOARD_USERDATAIMAGE_PARTITION_SIZE := 0x04ac0000 +# 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/egl.cfg + +TARGET_RECOVERY_UI_LIB := librecovery_ui_dream librecovery_ui_htc + +TARGET_RECOVERY_UPDATER_LIBS += librecovery_updater_htc diff --git a/board-info.txt b/board-info.txt new file mode 100644 index 0000000..c57b3e7 --- /dev/null +++ b/board-info.txt @@ -0,0 +1,5 @@ +require board=trout +reject serialno=HT7*|HT80*|HT81* +require version-bootloader=1.33.2004|1.33.0004|0.95.3000|0.95.0000 +require version-baseband=2.22.19.26I +require version-cpld=4 diff --git a/boot/Android.mk b/boot/Android.mk new file mode 100644 index 0000000..c5994e5 --- /dev/null +++ b/boot/Android.mk @@ -0,0 +1,30 @@ +# 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) + +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 + +include $(BUILD_RAW_STATIC_LIBRARY) diff --git a/boot/board.c b/boot/board.c new file mode 100644 index 0000000..2741d88 --- /dev/null +++ b/boot/board.c @@ -0,0 +1,106 @@ +/* + * 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..70b8142 --- /dev/null +++ b/boot/keypad.c @@ -0,0 +1,75 @@ +/* + * 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..166aa64 --- /dev/null +++ b/boot/panel.c @@ -0,0 +1,30 @@ +/* + * 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.mk b/device_dream.mk new file mode 100644 index 0000000..57a76ae --- /dev/null +++ b/device_dream.mk @@ -0,0 +1,37 @@ +# +# 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. +# + +# To be included directly by a device_dream_*.mk makefile; +# do not use inherit-product on this file. + +$(call inherit-product-if-exists, vendor/htc/dream/device_dream-vendor.mk) +# stuff common to all HTC phones +$(call inherit-product, device/htc/common/common_small.mk) + +DEVICE_PACKAGE_OVERLAYS := device/htc/dream/overlay $(DEVICE_PACKAGE_OVERLAYS) + +# 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 + +# media profiles and capabilities spec +include device/htc/dream/media_profiles.mk + diff --git a/device_dream_eu.mk b/device_dream_eu.mk new file mode 100644 index 0000000..187bb4b --- /dev/null +++ b/device_dream_eu.mk @@ -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. +# + +# To be included directly by a product makefile; do not use inherit-product. + +PRODUCT_COPY_FILES += \ + device/htc/dream/gps.conf_EU:system/etc/gps.conf + +$(call inherit-product-if-exists, vendor/htc/dream/device_dream_eu-vendor.mk) +$(call inherit-product, device/htc/dream/device_dream.mk) diff --git a/device_dream_us.mk b/device_dream_us.mk new file mode 100644 index 0000000..be28033 --- /dev/null +++ b/device_dream_us.mk @@ -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. +# + +# To be included directly by a product makefile; do not use inherit-product. + +PRODUCT_COPY_FILES += \ + device/htc/dream/gps.conf_US:system/etc/gps.conf + +$(call inherit-product-if-exists, vendor/htc/dream/device_dream_us-vendor.mk) +$(call inherit-product, device/htc/dream/device_dream.mk) @@ -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/generic_dream.mk b/generic_dream.mk new file mode 100644 index 0000000..a0b890a --- /dev/null +++ b/generic_dream.mk @@ -0,0 +1,28 @@ +# 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 generic Android +# build for 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, device/htc/dream/device_dream_us.mk) +$(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk) + +# Discard inherited values and use our own instead. +PRODUCT_NAME := generic_dream +PRODUCT_DEVICE := dream diff --git a/gps.conf_EU b/gps.conf_EU new file mode 100644 index 0000000..926f884 --- /dev/null +++ b/gps.conf_EU @@ -0,0 +1,6 @@ +NTP_SERVER=europe.pool.ntp.org +XTRA_SERVER_1=http://xtra1.gpsonextra.net/xtra.bin +XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra.bin +XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra.bin +SUPL_HOST=supl.google.com +SUPL_PORT=7276 diff --git a/gps.conf_US b/gps.conf_US new file mode 100644 index 0000000..b766326 --- /dev/null +++ b/gps.conf_US @@ -0,0 +1,6 @@ +NTP_SERVER=north-america.pool.ntp.org +XTRA_SERVER_1=http://xtra1.gpsonextra.net/xtra.bin +XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra.bin +XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra.bin +SUPL_HOST=supl.google.com +SUPL_PORT=7276 diff --git a/h2w_headset.kl b/h2w_headset.kl new file mode 100644 index 0000000..8702475 --- /dev/null +++ b/h2w_headset.kl @@ -0,0 +1 @@ +key 226 HEADSETHOOK WAKE diff --git a/init.trout.rc b/init.trout.rc new file mode 100644 index 0000000..a9f0c64 --- /dev/null +++ b/init.trout.rc @@ -0,0 +1,84 @@ +# 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 +# dream 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 + +# 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 Binary files differdiff --git a/libsensors/Android.mk b/libsensors/Android.mk new file mode 100644 index 0000000..e3cc926 --- /dev/null +++ b/libsensors/Android.mk @@ -0,0 +1,26 @@ +# 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) + +# 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_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw +LOCAL_SHARED_LIBRARIES := liblog libcutils +LOCAL_SRC_FILES := sensors.c +LOCAL_MODULE := sensors.trout +include $(BUILD_SHARED_LIBRARY) diff --git a/libsensors/sensors.c b/libsensors/sensors.c new file mode 100644 index 0000000..39787f5 --- /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", + "The Android Open Source Project", + 1, SENSORS_HANDLE_BASE+ID_A, + SENSOR_TYPE_ACCELEROMETER, 2.8f, 1.0f/4032.0f, 3.0f, { } }, + { "AK8976A 3-axis Magnetic field sensor", + "The Android Open Source Project", + 1, SENSORS_HANDLE_BASE+ID_M, + SENSOR_TYPE_MAGNETIC_FIELD, 2000.0f, 1.0f, 6.7f, { } }, + { "AK8976A Orientation sensor", + "The Android Open Source Project", + 1, SENSORS_HANDLE_BASE+ID_O, + SENSOR_TYPE_ORIENTATION, 360.0f, 1.0f, 9.7f, { } }, + { "AK8976A Temperature sensor", + "The Android Open Source Project", + 1, SENSORS_HANDLE_BASE+ID_T, + SENSOR_TYPE_TEMPERATURE, 80.0f, 1.0f, 0.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.mk b/media_profiles.mk new file mode 100644 index 0000000..aed0c40 --- /dev/null +++ b/media_profiles.mk @@ -0,0 +1,65 @@ +# 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 describes the media capabilities and profiles
+# using system properties.
+#
+# Note: The property key and value has some length
+# limit as defined by PROPERTY_KEY_MAX and
+# PROPERTY_VALUE_MAX, respectively
+#
+# WARNING: We may not use system properties for specifying
+# media capabilities and profiles in the future
+#
+PRODUCT_PROPERTY_OVERRIDES += \
+ ro.media.enc.hprof.file.format = 3gp \
+ ro.media.enc.hprof.codec.vid = h263 \
+ ro.media.enc.hprof.codec.aud = amrnb \
+ ro.media.enc.hprof.vid.width = 352 \
+ ro.media.enc.hprof.vid.height = 288 \
+ ro.media.enc.hprof.vid.fps = 20 \
+ ro.media.enc.hprof.vid.bps = 360000 \
+ ro.media.enc.hprof.aud.bps = 12200 \
+ ro.media.enc.hprof.aud.hz = 8000 \
+ ro.media.enc.hprof.aud.ch = 1 \
+ ro.media.enc.hprof.duration = 60 \
+ ro.media.enc.lprof.file.format = 3gp \
+ ro.media.enc.lprof.codec.vid = h263 \
+ ro.media.enc.lprof.codec.aud = amrnb \
+ ro.media.enc.lprof.vid.width = 176 \
+ ro.media.enc.lprof.vid.height = 144 \
+ ro.media.enc.lprof.vid.fps = 20 \
+ ro.media.enc.lprof.vid.bps = 192000 \
+ ro.media.enc.lprof.aud.bps = 12200 \
+ ro.media.enc.lprof.aud.hz = 8000 \
+ ro.media.enc.lprof.aud.ch = 1 \
+ ro.media.enc.lprof.duration = 60 \
+ ro.media.enc.file.format = 3gp,mp4 \
+ ro.media.enc.vid.codec = m4v,h263 \
+ ro.media.enc.aud.codec = amrnb \
+ ro.media.enc.vid.h263.width = 176,352 \
+ ro.media.enc.vid.h263.height = 144,288 \
+ ro.media.enc.vid.h263.bps = 192000,420000 \
+ ro.media.enc.vid.h263.fps = 1,20 \
+ ro.media.enc.vid.m4v.width = 176,352 \
+ ro.media.enc.vid.m4v.height = 144,288 \
+ ro.media.enc.vid.m4v.bps = 192000,420000 \
+ ro.media.enc.vid.m4v.fps = 1,20 \
+ ro.media.enc.aud.amrnb.bps = 5525,12200 \
+ ro.media.enc.aud.amrnb.hz = 8000,8000 \
+ ro.media.enc.aud.amrnb.ch = 1,1 \
+ ro.media.dec.aud.wma.enabled = 1 \
+ ro.media.dec.vid.wmv.enabled = 1 \
+ ro.media.cam.preview.fps = 0
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..66695e2 --- /dev/null +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -0,0 +1,33 @@ +<?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 Dream 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> +</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..052c54e --- /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">44</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">150</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..e311b83 --- /dev/null +++ b/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml @@ -0,0 +1,22 @@ +<?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> + <string name="def_backup_transport">com.google.android.backup/.BackupTransportService</string> +</resources> diff --git a/overlay/frameworks/base/tests/ImfTest/res/values/config.xml b/overlay/frameworks/base/tests/ImfTest/res/values/config.xml new file mode 100644 index 0000000..5ae40a3 --- /dev/null +++ b/overlay/frameworks/base/tests/ImfTest/res/values/config.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_expect_ime_autopop">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..0cf6336 --- /dev/null +++ b/overlay/packages/inputmethods/LatinIME/res/values/bools.xml @@ -0,0 +1,24 @@ +<?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. +*/ +--> +<resources> + <!-- Whether or not auto-correction should be enabled by default. + Smaller dictionaries on Dream --> + <bool name="enable_autocorrect">false</bool> +</resources> diff --git a/overlay/packages/inputmethods/LatinIME/res/values/durations.xml b/overlay/packages/inputmethods/LatinIME/res/values/durations.xml new file mode 100644 index 0000000..edeba45 --- /dev/null +++ b/overlay/packages/inputmethods/LatinIME/res/values/durations.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> + <integer name="vibrate_duration_ms">20</integer> +</resources> diff --git a/recovery/Android.mk b/recovery/Android.mk new file mode 100644 index 0000000..b4a3c10 --- /dev/null +++ b/recovery/Android.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. + + +ifneq ($(TARGET_SIMULATOR),true) +ifeq ($(TARGET_ARCH),arm) + +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := eng + +LOCAL_C_INCLUDES += bootable/recovery +LOCAL_SRC_FILES := recovery_ui.c +# should match TARGET_RECOVERY_UI_LIB should be set in BoardConfig.mk +LOCAL_MODULE := librecovery_ui_dream + +include $(BUILD_STATIC_LIBRARY) + +endif # TARGET_ARCH == arm +endif # !TARGET_SIMULATOR diff --git a/recovery/images/README b/recovery/images/README new file mode 100644 index 0000000..9fb0081 --- /dev/null +++ b/recovery/images/README @@ -0,0 +1,18 @@ +This directory contains the firmware_install.565 and +firmware_error.565 bitmaps shown when installing a radio or hboot +update via OTA on a dream device. + +They were generated from the corresponding .png files by doing: + + convert -gravity center -extent 320x480 -background black -depth 8 icon_firmware_install.png temp.rgb + rgb2565 -w 320 < temp.rgb > firmware_install.565 + + convert -gravity center -extent 320x480 -background black -depth 8 icon_firmware_error.png temp.rgb + rgb2565 -w 320 < temp.rgb > firmware_error.565 + +(convert is part of ImageMagick; rgb2565 is built in the android +source tree.) + +bitmap_size.txt contains the width, height, and depth of the bitmaps +(320 x 480 x 16bpp). + diff --git a/recovery/images/bitmap_size.txt b/recovery/images/bitmap_size.txt new file mode 100644 index 0000000..017e67a --- /dev/null +++ b/recovery/images/bitmap_size.txt @@ -0,0 +1 @@ +320 480 16 diff --git a/recovery/images/firmware_error.565 b/recovery/images/firmware_error.565 Binary files differnew file mode 100644 index 0000000..f6303ff --- /dev/null +++ b/recovery/images/firmware_error.565 diff --git a/recovery/images/firmware_install.565 b/recovery/images/firmware_install.565 Binary files differnew file mode 100644 index 0000000..4168033 --- /dev/null +++ b/recovery/images/firmware_install.565 diff --git a/recovery/images/icon_firmware_error.png b/recovery/images/icon_firmware_error.png Binary files differnew file mode 100644 index 0000000..0c32c9e --- /dev/null +++ b/recovery/images/icon_firmware_error.png diff --git a/recovery/images/icon_firmware_install.png b/recovery/images/icon_firmware_install.png Binary files differnew file mode 100644 index 0000000..ee2afac --- /dev/null +++ b/recovery/images/icon_firmware_install.png diff --git a/recovery/recovery_ui.c b/recovery/recovery_ui.c new file mode 100644 index 0000000..450c076 --- /dev/null +++ b/recovery/recovery_ui.c @@ -0,0 +1,94 @@ +/* + * 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. + */ + +#include <unistd.h> +#include <linux/input.h> + +#include "recovery_ui.h" +#include "common.h" + +char* MENU_HEADERS[] = { "Use trackball to highlight;", + "click to select.", + "", + NULL }; + +char* MENU_ITEMS[] = { "reboot system now [Home+Back]", + "apply sdcard:update.zip [Alt+S]", + "wipe data/factory reset [Alt+W]", + "wipe cache partition", + NULL }; + +void recover_firmware_update_log(); + +int device_recovery_start() { + recover_firmware_update_log(); + return 0; +} + +int device_toggle_display(volatile char* key_pressed, int key_code) { + // home+end, or alt+L (either alt key) + return (key_pressed[KEY_HOME] && key_code == KEY_END) || + ((key_pressed[KEY_LEFTALT] || key_pressed[KEY_RIGHTALT]) && + key_code == KEY_L); +} + +int device_reboot_now(volatile char* key_pressed, int key_code) { + return key_pressed[KEY_MENU] && // menu + key_pressed[KEY_SEND] && // green + key_code == KEY_END; // red +} + +int device_handle_key(int key, int visible) { + int alt = ui_key_pressed(KEY_LEFTALT) || ui_key_pressed(KEY_RIGHTALT); + + if (key == KEY_BACK && ui_key_pressed(KEY_HOME)) { + // Wait for the keys to be released, to avoid triggering + // special boot modes (like coming back into recovery!). + while (ui_key_pressed(KEY_BACK) || + ui_key_pressed(KEY_HOME)) { + usleep(1000); + } + return ITEM_REBOOT; + } else if (alt && key == KEY_W) { + return ITEM_WIPE_DATA; + } else if (alt && key == KEY_S) { + return ITEM_APPLY_SDCARD; + } else if (visible) { + switch (key) { + case KEY_DOWN: + case KEY_VOLUMEDOWN: + return HIGHLIGHT_DOWN; + + case KEY_UP: + case KEY_VOLUMEUP: + return HIGHLIGHT_UP; + + case BTN_MOUSE: + case KEY_ENTER: + return SELECT_ITEM; + } + } + + return NO_ACTION; +} + +int device_perform_action(int which) { + return which; +} + +int device_wipe_data() { + return 0; +} diff --git a/recovery/res/images/icon_error.png b/recovery/res/images/icon_error.png Binary files differnew file mode 100644 index 0000000..7064c2e --- /dev/null +++ b/recovery/res/images/icon_error.png diff --git a/recovery/res/images/icon_installing.png b/recovery/res/images/icon_installing.png Binary files differnew file mode 100644 index 0000000..f24f2e3 --- /dev/null +++ b/recovery/res/images/icon_installing.png diff --git a/system.prop b/system.prop new file mode 100644 index 0000000..697f12c --- /dev/null +++ b/system.prop @@ -0,0 +1,32 @@ +# 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. + +# +# system.prop for dream +# + +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. +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. +ro.sf.lcd_density = 160 + +# Default network type +# 0 => WCDMA Preferred. +ro.telephony.default_network = 0 diff --git a/tools/Android.mk b/tools/Android.mk new file mode 100644 index 0000000..a31b2db --- /dev/null +++ b/tools/Android.mk @@ -0,0 +1,39 @@ +# 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. + +ifeq ($(TARGET_DEVICE),dream) +ifneq ($(BUILD_TINY_ANDROID),true) + +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) + +endif # not BUILD_TINY_ANDROID +endif # TARGET_DEVICE 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/vold.fstab b/vold.fstab new file mode 100644 index 0000000..564082d --- /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 +# +## - 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 + Binary files differ |