initial commit
23
Android.mk
Normal file
@ -0,0 +1,23 @@
|
||||
#
|
||||
# Copyright (C) 2012 The CyanogenMod Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
ifneq ($(filter i777 i9100 n7000,$(TARGET_DEVICE)),)
|
||||
|
||||
include $(call all-makefiles-under,$(LOCAL_PATH))
|
||||
|
||||
endif
|
149
BoardCommonConfig.mk
Normal file
@ -0,0 +1,149 @@
|
||||
#
|
||||
# Copyright (C) 2012 The Android Open-Source Project
|
||||
# Copyright (C) 2012 The CyanogenMod Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
# This variable is set first, so it can be overridden
|
||||
# by BoardConfigVendor.mk
|
||||
USE_CAMERA_STUB := true
|
||||
BOARD_USES_GENERIC_AUDIO := false
|
||||
BOARD_USES_LIBSECRIL_STUB := true
|
||||
|
||||
TARGET_CPU_ABI := armeabi-v7a
|
||||
TARGET_CPU_ABI2 := armeabi
|
||||
TARGET_CPU_SMP := true
|
||||
TARGET_ARCH_VARIANT := armv7-a-neon
|
||||
TARGET_ARCH_VARIANT_CPU := cortex-a9
|
||||
ARCH_ARM_HAVE_NEON := true
|
||||
ARCH_ARM_HAVE_TLS_REGISTER := true
|
||||
EXYNOS4210_ENHANCEMENTS := true
|
||||
|
||||
ifdef EXYNOS4210_ENHANCEMENTS
|
||||
COMMON_GLOBAL_CFLAGS += -DEXYNOS4_ENHANCEMENTS
|
||||
COMMON_GLOBAL_CFLAGS += -DEXYNOS4210_ENHANCEMENTS
|
||||
COMMON_GLOBAL_CFLAGS += -DSURFACEFLINGER_FORCE_SCREEN_RELEASE
|
||||
endif
|
||||
|
||||
TARGET_BOARD_PLATFORM := exynos4
|
||||
TARGET_SOC := exynos4210
|
||||
TARGET_BOOTLOADER_BOARD_NAME := smdk4210
|
||||
|
||||
TARGET_NO_BOOTLOADER := true
|
||||
TARGET_NO_RADIOIMAGE := true
|
||||
|
||||
TARGET_PROVIDES_INIT := true
|
||||
TARGET_PROVIDES_INIT_TARGET_RC := true
|
||||
TARGET_RECOVERY_INITRC := device/samsung/galaxys2-common/recovery.rc
|
||||
|
||||
BOARD_NAND_PAGE_SIZE := 4096
|
||||
BOARD_NAND_SPARE_SIZE := 128
|
||||
BOARD_KERNEL_PAGESIZE := 4096
|
||||
BOARD_KERNEL_BASE := 0x40000000
|
||||
BOARD_KERNEL_CMDLINE := console=ttySAC2,115200 consoleblank=0
|
||||
|
||||
# Filesystem
|
||||
TARGET_USERIMAGES_USE_EXT4 := true
|
||||
BOARD_BOOTIMAGE_PARTITION_SIZE := 8388608
|
||||
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 536870912
|
||||
BOARD_USERDATAIMAGE_PARTITION_SIZE := 2147483648
|
||||
BOARD_FLASH_BLOCK_SIZE := 4096
|
||||
|
||||
# Releasetools
|
||||
TARGET_RELEASETOOL_OTA_FROM_TARGET_SCRIPT := ./device/samsung/galaxys2-common/releasetools/galaxys2_ota_from_target_files
|
||||
TARGET_RELEASETOOL_IMG_FROM_TARGET_SCRIPT := ./device/samsung/galaxys2-common/releasetools/galaxys2_img_from_target_files
|
||||
|
||||
# Graphics
|
||||
BOARD_EGL_CFG := device/samsung/galaxys2-common/configs/egl.cfg
|
||||
USE_OPENGL_RENDERER := true
|
||||
|
||||
# Enable WEBGL in WebKit
|
||||
ENABLE_WEBGL := true
|
||||
|
||||
# HWComposer
|
||||
BOARD_USES_HWCOMPOSER := true
|
||||
BOARD_USE_SECTVOUT := true
|
||||
BOARD_USES_FIMGAPI := true
|
||||
|
||||
# OMX
|
||||
BOARD_USE_SAMSUNG_COLORFORMAT := true
|
||||
BOARD_FIX_NATIVE_COLOR_FORMAT := true
|
||||
BOARD_HAVE_CODEC_SUPPORT := SAMSUNG_CODEC_SUPPORT
|
||||
COMMON_GLOBAL_CFLAGS += -DSAMSUNG_CODEC_SUPPORT
|
||||
BOARD_NONBLOCK_MODE_PROCESS := true
|
||||
BOARD_USE_STOREMETADATA := true
|
||||
BOARD_USE_METADATABUFFERTYPE := true
|
||||
BOARD_USES_MFC_FPS := true
|
||||
|
||||
# Audio
|
||||
BOARD_USE_YAMAHAPLAYER := true
|
||||
BOARD_USE_SAMSUNG_SEPARATEDSTREAM := true
|
||||
COMMON_GLOBAL_CFLAGS += -DICS_AUDIO_BLOB
|
||||
|
||||
# RIL
|
||||
BOARD_MOBILEDATA_INTERFACE_NAME := "pdp0"
|
||||
|
||||
# Camera
|
||||
BOARD_USES_PROPRIETARY_LIBCAMERA := true
|
||||
BOARD_USES_PROPRIETARY_LIBFIMC := true
|
||||
COMMON_GLOBAL_CFLAGS += -DDISABLE_HW_ID_MATCH_CHECK
|
||||
COMMON_GLOBAL_CFLAGS += -DSAMSUNG_CAMERA_HARDWARE
|
||||
|
||||
# Wifi
|
||||
BOARD_WLAN_DEVICE := bcmdhd
|
||||
BOARD_WLAN_DEVICE_REV := bcm4330_b1
|
||||
WPA_SUPPLICANT_VERSION := VER_0_8_X
|
||||
BOARD_WPA_SUPPLICANT_DRIVER := NL80211
|
||||
BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_bcmdhd
|
||||
BOARD_HOSTAPD_DRIVER := NL80211
|
||||
BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_bcmdhd
|
||||
WIFI_DRIVER_MODULE_PATH := "/system/lib/modules/dhd.ko"
|
||||
WIFI_DRIVER_FW_PATH_PARAM := "/sys/module/dhd/parameters/firmware_path"
|
||||
WIFI_DRIVER_FW_PATH_STA := "/system/etc/wifi/bcm4330_sta.bin"
|
||||
WIFI_DRIVER_FW_PATH_AP := "/system/etc/wifi/bcm4330_apsta.bin"
|
||||
WIFI_DRIVER_FW_PATH_P2P := "/system/etc/wifi/bcm4330_p2p.bin"
|
||||
WIFI_DRIVER_MODULE_NAME := "dhd"
|
||||
WIFI_DRIVER_MODULE_ARG := "firmware_path=/system/etc/wifi/bcm4330_sta.bin nvram_path=/system/etc/wifi/nvram_net.txt"
|
||||
WIFI_BAND := 802_11_ABG
|
||||
|
||||
# Bluetooth
|
||||
BOARD_HAVE_BLUETOOTH := true
|
||||
BOARD_HAVE_BLUETOOTH_BCM := true
|
||||
|
||||
# Vold
|
||||
BOARD_VOLD_MAX_PARTITIONS := 12
|
||||
BOARD_VOLD_EMMC_SHARES_DEV_MAJOR := true
|
||||
BOARD_VOLD_DISC_HAS_MULTIPLE_MAJORS := true
|
||||
TARGET_USE_CUSTOM_LUN_FILE_PATH := "/sys/devices/platform/s3c-usbgadget/gadget/lun%d/file"
|
||||
|
||||
# Recovery
|
||||
BOARD_CUSTOM_RECOVERY_KEYMAPPING := ../../device/samsung/galaxys2-common/recovery/recovery_keys.c
|
||||
BOARD_CUSTOM_GRAPHICS := ../../../device/samsung/galaxys2-common/recovery/graphics.c
|
||||
BOARD_UMS_LUNFILE := "/sys/class/android_usb/android0/f_mass_storage/lun0/file"
|
||||
BOARD_USES_MMCUTILS := true
|
||||
BOARD_HAS_NO_MISC_PARTITION := true
|
||||
BOARD_HAS_NO_SELECT_BUTTON := true
|
||||
BOARD_SUPPRESS_EMMC_WIPE := true
|
||||
|
||||
TARGET_SPECIFIC_HEADER_PATH := device/samsung/galaxys2-common/overlay/include
|
||||
|
||||
# Charging mode
|
||||
BOARD_CHARGING_MODE_BOOTING_LPM := /sys/class/power_supply/battery/batt_lp_charging
|
||||
BOARD_BATTERY_DEVICE_NAME := "battery"
|
||||
BOARD_CHARGER_RES := device/samsung/galaxys2-common/res/charger
|
||||
|
||||
BOARD_CUSTOM_BOOTIMG_MK := device/samsung/galaxys2-common/shbootimg.mk
|
||||
|
||||
# Use the non-open-source parts, if they're present
|
||||
-include vendor/samsung/galaxys2-common/BoardConfigVendor.mk
|
15
camera/Android.mk
Normal file
@ -0,0 +1,15 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
CameraWrapper.cpp
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
libhardware liblog libcamera_client libutils
|
||||
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
|
||||
LOCAL_MODULE := camera.$(TARGET_BOARD_PLATFORM)
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
#include $(BUILD_HEAPTRACKED_SHARED_LIBRARY)
|
585
camera/CameraWrapper.cpp
Normal file
@ -0,0 +1,585 @@
|
||||
/*
|
||||
* Copyright (C) 2012, The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file CameraWrapper.cpp
|
||||
*
|
||||
* This file wraps a vendor camera module.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#define LOG_NDEBUG 0
|
||||
//#define LOG_PARAMETERS
|
||||
|
||||
#define LOG_TAG "CameraWrapper"
|
||||
#include <cutils/log.h>
|
||||
|
||||
#include <utils/threads.h>
|
||||
#include <utils/String8.h>
|
||||
#include <hardware/hardware.h>
|
||||
#include <hardware/camera.h>
|
||||
#include <camera/Camera.h>
|
||||
#include <camera/CameraParameters.h>
|
||||
|
||||
static android::Mutex gCameraWrapperLock;
|
||||
static camera_module_t *gVendorModule = 0;
|
||||
|
||||
static int camera_device_open(const hw_module_t* module, const char* name,
|
||||
hw_device_t** device);
|
||||
static int camera_device_close(hw_device_t* device);
|
||||
static int camera_get_number_of_cameras(void);
|
||||
static int camera_get_camera_info(int camera_id, struct camera_info *info);
|
||||
|
||||
static struct hw_module_methods_t camera_module_methods = {
|
||||
open: camera_device_open
|
||||
};
|
||||
|
||||
camera_module_t HAL_MODULE_INFO_SYM = {
|
||||
common: {
|
||||
tag: HARDWARE_MODULE_TAG,
|
||||
version_major: 1,
|
||||
version_minor: 0,
|
||||
id: CAMERA_HARDWARE_MODULE_ID,
|
||||
name: "Exynos4x12 Camera Wrapper",
|
||||
author: "Teamhacksung <info@teamhacksung.org>",
|
||||
methods: &camera_module_methods,
|
||||
dso: NULL, /* remove compilation warnings */
|
||||
reserved: {0}, /* remove compilation warnings */
|
||||
},
|
||||
get_number_of_cameras: camera_get_number_of_cameras,
|
||||
get_camera_info: camera_get_camera_info,
|
||||
};
|
||||
|
||||
typedef struct wrapper_camera_device {
|
||||
camera_device_t base;
|
||||
int id;
|
||||
camera_device_t *vendor;
|
||||
} wrapper_camera_device_t;
|
||||
|
||||
#define VENDOR_CALL(device, func, ...) ({ \
|
||||
wrapper_camera_device_t *__wrapper_dev = (wrapper_camera_device_t*) device; \
|
||||
__wrapper_dev->vendor->ops->func(__wrapper_dev->vendor, ##__VA_ARGS__); \
|
||||
})
|
||||
|
||||
#define CAMERA_ID(device) (((wrapper_camera_device_t *)(device))->id)
|
||||
|
||||
static int check_vendor_module()
|
||||
{
|
||||
int rv = 0;
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
|
||||
if(gVendorModule)
|
||||
return 0;
|
||||
|
||||
rv = hw_get_module("vendor-camera", (const hw_module_t **)&gVendorModule);
|
||||
if (rv)
|
||||
ALOGE("failed to open vendor camera module");
|
||||
return rv;
|
||||
}
|
||||
|
||||
const static char * iso_values[] = {"auto,ISO100,ISO200,ISO400,ISO800","auto"};
|
||||
|
||||
static char * camera_fixup_getparams(int id, const char * settings)
|
||||
{
|
||||
android::CameraParameters params;
|
||||
params.unflatten(android::String8(settings));
|
||||
|
||||
// fix params here
|
||||
#warning "Reimplement KEY_SUPPORTED_ISO_MODES"
|
||||
// params.set(android::CameraParameters::KEY_SUPPORTED_ISO_MODES, iso_values[id]);
|
||||
|
||||
android::String8 strParams = params.flatten();
|
||||
char *ret = strdup(strParams.string());
|
||||
|
||||
ALOGD("%s: get parameters fixed up", __FUNCTION__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
char * camera_fixup_setparams(int id, const char * settings)
|
||||
{
|
||||
android::CameraParameters params;
|
||||
params.unflatten(android::String8(settings));
|
||||
|
||||
/*
|
||||
// fix params here
|
||||
if(params.get("iso")) {
|
||||
const char* isoMode = params.get(android::CameraParameters::KEY_ISO_MODE);
|
||||
if(strcmp(isoMode, "ISO100") == 0)
|
||||
params.set(android::CameraParameters::KEY_ISO_MODE, "100");
|
||||
else if(strcmp(isoMode, "ISO200") == 0)
|
||||
params.set(android::CameraParameters::KEY_ISO_MODE, "200");
|
||||
else if(strcmp(isoMode, "ISO400") == 0)
|
||||
params.set(android::CameraParameters::KEY_ISO_MODE, "400");
|
||||
else if(strcmp(isoMode, "ISO800") == 0)
|
||||
params.set(android::CameraParameters::KEY_ISO_MODE, "800");
|
||||
}
|
||||
*/
|
||||
android::String8 strParams = params.flatten();
|
||||
char *ret = strdup(strParams.string());
|
||||
|
||||
ALOGD("%s: set parameters fixed up", __FUNCTION__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* implementation of camera_device_ops functions
|
||||
*******************************************************************/
|
||||
|
||||
int camera_set_preview_window(struct camera_device * device,
|
||||
struct preview_stream_ops *window)
|
||||
{
|
||||
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
|
||||
|
||||
if(!device)
|
||||
return -EINVAL;
|
||||
|
||||
return VENDOR_CALL(device, set_preview_window, window);
|
||||
}
|
||||
|
||||
void camera_set_callbacks(struct camera_device * device,
|
||||
camera_notify_callback notify_cb,
|
||||
camera_data_callback data_cb,
|
||||
camera_data_timestamp_callback data_cb_timestamp,
|
||||
camera_request_memory get_memory,
|
||||
void *user)
|
||||
{
|
||||
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
|
||||
if(!device)
|
||||
return;
|
||||
|
||||
VENDOR_CALL(device, set_callbacks, notify_cb, data_cb, data_cb_timestamp, get_memory, user);
|
||||
}
|
||||
|
||||
void camera_enable_msg_type(struct camera_device * device, int32_t msg_type)
|
||||
{
|
||||
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
|
||||
if(!device)
|
||||
return;
|
||||
|
||||
VENDOR_CALL(device, enable_msg_type, msg_type);
|
||||
}
|
||||
|
||||
void camera_disable_msg_type(struct camera_device * device, int32_t msg_type)
|
||||
{
|
||||
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
|
||||
if(!device)
|
||||
return;
|
||||
|
||||
VENDOR_CALL(device, disable_msg_type, msg_type);
|
||||
}
|
||||
|
||||
int camera_msg_type_enabled(struct camera_device * device, int32_t msg_type)
|
||||
{
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
|
||||
|
||||
if(!device)
|
||||
return 0;
|
||||
|
||||
return VENDOR_CALL(device, msg_type_enabled, msg_type);
|
||||
}
|
||||
|
||||
int camera_start_preview(struct camera_device * device)
|
||||
{
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
|
||||
|
||||
if(!device)
|
||||
return -EINVAL;
|
||||
|
||||
return VENDOR_CALL(device, start_preview);
|
||||
}
|
||||
|
||||
void camera_stop_preview(struct camera_device * device)
|
||||
{
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
|
||||
|
||||
if(!device)
|
||||
return;
|
||||
|
||||
VENDOR_CALL(device, stop_preview);
|
||||
}
|
||||
|
||||
int camera_preview_enabled(struct camera_device * device)
|
||||
{
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
|
||||
|
||||
if(!device)
|
||||
return -EINVAL;
|
||||
|
||||
return VENDOR_CALL(device, preview_enabled);
|
||||
}
|
||||
|
||||
int camera_store_meta_data_in_buffers(struct camera_device * device, int enable)
|
||||
{
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
|
||||
|
||||
if(!device)
|
||||
return -EINVAL;
|
||||
|
||||
return VENDOR_CALL(device, store_meta_data_in_buffers, enable);
|
||||
}
|
||||
|
||||
int camera_start_recording(struct camera_device * device)
|
||||
{
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
|
||||
|
||||
if(!device)
|
||||
return EINVAL;
|
||||
|
||||
return VENDOR_CALL(device, start_recording);
|
||||
}
|
||||
|
||||
void camera_stop_recording(struct camera_device * device)
|
||||
{
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
|
||||
|
||||
if(!device)
|
||||
return;
|
||||
|
||||
|
||||
VENDOR_CALL(device, stop_recording);
|
||||
}
|
||||
|
||||
int camera_recording_enabled(struct camera_device * device)
|
||||
{
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
|
||||
|
||||
if(!device)
|
||||
return -EINVAL;
|
||||
|
||||
return VENDOR_CALL(device, recording_enabled);
|
||||
}
|
||||
|
||||
void camera_release_recording_frame(struct camera_device * device,
|
||||
const void *opaque)
|
||||
{
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
|
||||
|
||||
if(!device)
|
||||
return;
|
||||
|
||||
VENDOR_CALL(device, release_recording_frame, opaque);
|
||||
}
|
||||
|
||||
int camera_auto_focus(struct camera_device * device)
|
||||
{
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
|
||||
|
||||
if(!device)
|
||||
return -EINVAL;
|
||||
|
||||
|
||||
return VENDOR_CALL(device, auto_focus);
|
||||
}
|
||||
|
||||
int camera_cancel_auto_focus(struct camera_device * device)
|
||||
{
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
|
||||
|
||||
if(!device)
|
||||
return -EINVAL;
|
||||
|
||||
// Samsung camera HAL restarts focus (CAF_RESTART) when we cancel auto focus.
|
||||
// Cancel auto focus is called just before pic is taken in autofocus mode, thus
|
||||
// the HAL crashes.
|
||||
return 0;
|
||||
//return VENDOR_CALL(device, cancel_auto_focus);
|
||||
}
|
||||
|
||||
int camera_take_picture(struct camera_device * device)
|
||||
{
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
|
||||
|
||||
if(!device)
|
||||
return -EINVAL;
|
||||
|
||||
return VENDOR_CALL(device, take_picture);
|
||||
}
|
||||
|
||||
int camera_cancel_picture(struct camera_device * device)
|
||||
{
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
|
||||
|
||||
if(!device)
|
||||
return -EINVAL;
|
||||
|
||||
return VENDOR_CALL(device, take_picture);
|
||||
}
|
||||
|
||||
int camera_set_parameters(struct camera_device * device, const char *params)
|
||||
{
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
|
||||
|
||||
if(!device)
|
||||
return -EINVAL;
|
||||
|
||||
char *tmp = NULL;
|
||||
tmp = camera_fixup_setparams(CAMERA_ID(device), params);
|
||||
|
||||
#ifdef LOG_PARAMETERS
|
||||
__android_log_write(ANDROID_LOG_VERBOSE, LOG_TAG, tmp);
|
||||
#endif
|
||||
|
||||
int ret = VENDOR_CALL(device, set_parameters, tmp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
char* camera_get_parameters(struct camera_device * device)
|
||||
{
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
|
||||
|
||||
if(!device)
|
||||
return NULL;
|
||||
|
||||
char* params = VENDOR_CALL(device, get_parameters);
|
||||
|
||||
#ifdef LOG_PARAMETERS
|
||||
__android_log_write(ANDROID_LOG_VERBOSE, LOG_TAG, params);
|
||||
#endif
|
||||
|
||||
char * tmp = camera_fixup_getparams(CAMERA_ID(device), params);
|
||||
VENDOR_CALL(device, put_parameters, params);
|
||||
params = tmp;
|
||||
|
||||
#ifdef LOG_PARAMETERS
|
||||
__android_log_write(ANDROID_LOG_VERBOSE, LOG_TAG, params);
|
||||
#endif
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
static void camera_put_parameters(struct camera_device *device, char *params)
|
||||
{
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
|
||||
|
||||
if(params)
|
||||
free(params);
|
||||
}
|
||||
|
||||
int camera_send_command(struct camera_device * device,
|
||||
int32_t cmd, int32_t arg1, int32_t arg2)
|
||||
{
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
|
||||
|
||||
if(!device)
|
||||
return -EINVAL;
|
||||
|
||||
/* send_command causes the camera hal do to unexpected things like lockups.
|
||||
* don't pass any command to the vendor hal to prevent this */
|
||||
return 0;
|
||||
//return VENDOR_CALL(device, send_command, cmd, arg1, arg2);
|
||||
}
|
||||
|
||||
void camera_release(struct camera_device * device)
|
||||
{
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
|
||||
|
||||
if(!device)
|
||||
return;
|
||||
|
||||
VENDOR_CALL(device, release);
|
||||
}
|
||||
|
||||
int camera_dump(struct camera_device * device, int fd)
|
||||
{
|
||||
if(!device)
|
||||
return -EINVAL;
|
||||
|
||||
return VENDOR_CALL(device, dump, fd);
|
||||
}
|
||||
|
||||
extern "C" void heaptracker_free_leaked_memory(void);
|
||||
|
||||
int camera_device_close(hw_device_t* device)
|
||||
{
|
||||
int ret = 0;
|
||||
wrapper_camera_device_t *wrapper_dev = NULL;
|
||||
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
|
||||
android::Mutex::Autolock lock(gCameraWrapperLock);
|
||||
|
||||
if (!device) {
|
||||
ret = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
wrapper_dev = (wrapper_camera_device_t*) device;
|
||||
|
||||
wrapper_dev->vendor->common.close((hw_device_t*)wrapper_dev->vendor);
|
||||
if (wrapper_dev->base.ops)
|
||||
free(wrapper_dev->base.ops);
|
||||
free(wrapper_dev);
|
||||
done:
|
||||
#ifdef HEAPTRACKER
|
||||
heaptracker_free_leaked_memory();
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* implementation of camera_module functions
|
||||
*******************************************************************/
|
||||
|
||||
/* open device handle to one of the cameras
|
||||
*
|
||||
* assume camera service will keep singleton of each camera
|
||||
* so this function will always only be called once per camera instance
|
||||
*/
|
||||
|
||||
int camera_device_open(const hw_module_t* module, const char* name,
|
||||
hw_device_t** device)
|
||||
{
|
||||
int rv = 0;
|
||||
int num_cameras = 0;
|
||||
int cameraid;
|
||||
wrapper_camera_device_t* camera_device = NULL;
|
||||
camera_device_ops_t* camera_ops = NULL;
|
||||
|
||||
android::Mutex::Autolock lock(gCameraWrapperLock);
|
||||
|
||||
ALOGV("camera_device open");
|
||||
|
||||
if (name != NULL) {
|
||||
if (check_vendor_module())
|
||||
return -EINVAL;
|
||||
|
||||
cameraid = atoi(name);
|
||||
num_cameras = gVendorModule->get_number_of_cameras();
|
||||
|
||||
if(cameraid > num_cameras)
|
||||
{
|
||||
ALOGE("camera service provided cameraid out of bounds, "
|
||||
"cameraid = %d, num supported = %d",
|
||||
cameraid, num_cameras);
|
||||
rv = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
camera_device = (wrapper_camera_device_t*)malloc(sizeof(*camera_device));
|
||||
if(!camera_device)
|
||||
{
|
||||
ALOGE("camera_device allocation fail");
|
||||
rv = -ENOMEM;
|
||||
goto fail;
|
||||
}
|
||||
memset(camera_device, 0, sizeof(*camera_device));
|
||||
camera_device->id = cameraid;
|
||||
|
||||
if(rv = gVendorModule->common.methods->open((const hw_module_t*)gVendorModule, name, (hw_device_t**)&(camera_device->vendor)))
|
||||
{
|
||||
ALOGE("vendor camera open fail");
|
||||
goto fail;
|
||||
}
|
||||
ALOGV("%s: got vendor camera device 0x%08X", __FUNCTION__, (uintptr_t)(camera_device->vendor));
|
||||
|
||||
camera_ops = (camera_device_ops_t*)malloc(sizeof(*camera_ops));
|
||||
if(!camera_ops)
|
||||
{
|
||||
ALOGE("camera_ops allocation fail");
|
||||
rv = -ENOMEM;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
memset(camera_ops, 0, sizeof(*camera_ops));
|
||||
|
||||
camera_device->base.common.tag = HARDWARE_DEVICE_TAG;
|
||||
camera_device->base.common.version = 0;
|
||||
camera_device->base.common.module = (hw_module_t *)(module);
|
||||
camera_device->base.common.close = camera_device_close;
|
||||
camera_device->base.ops = camera_ops;
|
||||
|
||||
camera_ops->set_preview_window = camera_set_preview_window;
|
||||
camera_ops->set_callbacks = camera_set_callbacks;
|
||||
camera_ops->enable_msg_type = camera_enable_msg_type;
|
||||
camera_ops->disable_msg_type = camera_disable_msg_type;
|
||||
camera_ops->msg_type_enabled = camera_msg_type_enabled;
|
||||
camera_ops->start_preview = camera_start_preview;
|
||||
camera_ops->stop_preview = camera_stop_preview;
|
||||
camera_ops->preview_enabled = camera_preview_enabled;
|
||||
camera_ops->store_meta_data_in_buffers = camera_store_meta_data_in_buffers;
|
||||
camera_ops->start_recording = camera_start_recording;
|
||||
camera_ops->stop_recording = camera_stop_recording;
|
||||
camera_ops->recording_enabled = camera_recording_enabled;
|
||||
camera_ops->release_recording_frame = camera_release_recording_frame;
|
||||
camera_ops->auto_focus = camera_auto_focus;
|
||||
camera_ops->cancel_auto_focus = camera_cancel_auto_focus;
|
||||
camera_ops->take_picture = camera_take_picture;
|
||||
camera_ops->cancel_picture = camera_cancel_picture;
|
||||
camera_ops->set_parameters = camera_set_parameters;
|
||||
camera_ops->get_parameters = camera_get_parameters;
|
||||
camera_ops->put_parameters = camera_put_parameters;
|
||||
camera_ops->send_command = camera_send_command;
|
||||
camera_ops->release = camera_release;
|
||||
camera_ops->dump = camera_dump;
|
||||
|
||||
*device = &camera_device->base.common;
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
||||
fail:
|
||||
if(camera_device) {
|
||||
free(camera_device);
|
||||
camera_device = NULL;
|
||||
}
|
||||
if(camera_ops) {
|
||||
free(camera_ops);
|
||||
camera_ops = NULL;
|
||||
}
|
||||
*device = NULL;
|
||||
return rv;
|
||||
}
|
||||
|
||||
int camera_get_number_of_cameras(void)
|
||||
{
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
if (check_vendor_module())
|
||||
return 0;
|
||||
return gVendorModule->get_number_of_cameras();
|
||||
}
|
||||
|
||||
int camera_get_camera_info(int camera_id, struct camera_info *info)
|
||||
{
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
if (check_vendor_module())
|
||||
return 0;
|
||||
return gVendorModule->get_camera_info(camera_id, info);
|
||||
}
|
184
common.mk
Normal file
@ -0,0 +1,184 @@
|
||||
#
|
||||
# Copyright (C) 2012 The Android Open-Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
DEVICE_PACKAGE_OVERLAYS := device/samsung/galaxys2-common/overlay
|
||||
|
||||
# This device is hdpi.
|
||||
PRODUCT_AAPT_CONFIG := normal hdpi
|
||||
PRODUCT_AAPT_PREF_CONFIG := hdpi
|
||||
PRODUCT_LOCALES += hdpi
|
||||
|
||||
# Init files
|
||||
PRODUCT_COPY_FILES := \
|
||||
device/samsung/galaxys2-common/lpm.rc:root/lpm.rc \
|
||||
device/samsung/galaxys2-common/init.smdk4210.usb.rc:root/init.smdk4210.usb.rc \
|
||||
device/samsung/galaxys2-common/init.smdk4210.rc:root/init.smdk4210.rc \
|
||||
device/samsung/galaxys2-common/ueventd.smdk4210.rc:root/ueventd.smdk4210.rc
|
||||
|
||||
# Audio
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/samsung/galaxys2-common/configs/asound.conf:system/etc/asound.conf
|
||||
|
||||
# Vold and Storage
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/samsung/galaxys2-common/configs/vold.fstab:system/etc/vold.fstab
|
||||
|
||||
# Bluetooth configuration files
|
||||
PRODUCT_COPY_FILES += \
|
||||
system/bluetooth/data/main.le.conf:system/etc/bluetooth/main.conf
|
||||
|
||||
# Wifi
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/samsung/galaxys2-common/configs/wpa_supplicant.conf:system/etc/wifi/wpa_supplicant.conf \
|
||||
device/samsung/galaxys2-common/configs/bcmdhd.cal:system/etc/wifi/bcmdhd.cal
|
||||
|
||||
PRODUCT_PROPERTY_OVERRIDES += \
|
||||
wifi.interface=wlan0 \
|
||||
wifi.supplicant_scan_interval=15
|
||||
|
||||
$(call inherit-product-if-exists, hardware/broadcom/wlan/bcmdhd/firmware/bcm4330/device-bcm.mk)
|
||||
|
||||
# Gps
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/samsung/galaxys2-common/configs/gps.conf:system/etc/gps.conf \
|
||||
device/samsung/galaxys2-common/configs/sirfgps.conf:system/etc/sirfgps.conf
|
||||
|
||||
# Packages
|
||||
PRODUCT_PACKAGES := \
|
||||
audio.a2dp.default \
|
||||
libaudiohw_legacy \
|
||||
camera.exynos4 \
|
||||
libsurfaceflinger_client \
|
||||
com.android.future.usb.accessory \
|
||||
SamsungServiceMode \
|
||||
Torch \
|
||||
TvOut
|
||||
|
||||
# HAL
|
||||
PRODUCT_PACKAGES += \
|
||||
lights.exynos4 \
|
||||
libhwconverter \
|
||||
libs5pjpeg \
|
||||
libfimg
|
||||
|
||||
# Charger
|
||||
PRODUCT_PACKAGES += \
|
||||
charger \
|
||||
charger_res_images
|
||||
|
||||
# MFC API
|
||||
PRODUCT_PACKAGES += \
|
||||
libsecmfcapi
|
||||
|
||||
# OMX
|
||||
PRODUCT_PACKAGES += \
|
||||
libstagefrighthw \
|
||||
libseccscapi \
|
||||
libsecbasecomponent \
|
||||
libsecosal \
|
||||
libSEC_OMX_Resourcemanager \
|
||||
libSEC_OMX_Core \
|
||||
libSEC_OMX_Vdec \
|
||||
libOMX.SEC.AVC.Decoder \
|
||||
libOMX.SEC.M4V.Decoder \
|
||||
libOMX.SEC.WMV.Decoder \
|
||||
libOMX.SEC.VP8.Decoder \
|
||||
libSEC_OMX_Venc \
|
||||
libOMX.SEC.AVC.Encoder \
|
||||
libOMX.SEC.M4V.Encoder \
|
||||
libSEC_OMX_Adec \
|
||||
libOMX.SEC.MP3.Decoder
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/samsung/galaxys2-common/configs/media_codecs.xml:system/etc/media_codecs.xml \
|
||||
device/samsung/galaxys2-common/configs/media_profiles.xml:system/etc/media_profiles.xml
|
||||
|
||||
# RIL
|
||||
PRODUCT_PROPERTY_OVERRIDES += \
|
||||
ro.telephony.ril_class=Smdk4210RIL \
|
||||
mobiledata.interfaces=pdp0,wlan0,gprs,ppp0 \
|
||||
ro.ril.hsxpa=1 \
|
||||
ro.ril.gprsclass=10
|
||||
|
||||
# Filesystem management tools
|
||||
PRODUCT_PACKAGES += \
|
||||
static_busybox \
|
||||
make_ext4fs \
|
||||
setup_fs
|
||||
|
||||
# Live Wallpapers
|
||||
PRODUCT_PACKAGES += \
|
||||
Galaxy4 \
|
||||
HoloSpiralWallpaper \
|
||||
LiveWallpapers \
|
||||
LiveWallpapersPicker \
|
||||
MagicSmokeWallpapers \
|
||||
NoiseField \
|
||||
PhaseBeam \
|
||||
VisualizationWallpapers \
|
||||
librs_jni
|
||||
|
||||
# These are the hardware-specific features
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/android.hardware.audio.low_latency.xml:system/etc/permissions/android.hardware.audio.low_latency.xml \
|
||||
frameworks/native/data/etc/android.hardware.camera.autofocus.xml:system/etc/permissions/android.hardware.camera.autofocus.xml \
|
||||
frameworks/native/data/etc/android.hardware.camera.flash-autofocus.xml:system/etc/permissions/android.hardware.camera.flash-autofocus.xml \
|
||||
frameworks/native/data/etc/android.hardware.camera.front.xml:system/etc/permissions/android.hardware.camera.front.xml \
|
||||
frameworks/native/data/etc/android.hardware.camera.xml:system/etc/permissions/android.hardware.camera.xml \
|
||||
frameworks/native/data/etc/android.hardware.location.gps.xml:system/etc/permissions/android.hardware.location.gps.xml \
|
||||
frameworks/native/data/etc/android.hardware.location.xml:system/etc/permissions/android.hardware.location.xml \
|
||||
frameworks/native/data/etc/android.hardware.sensor.accelerometer.xml:system/etc/permissions/android.hardware.sensor.accelerometer.xml \
|
||||
frameworks/native/data/etc/android.hardware.sensor.compass.xml:system/etc/permissions/android.hardware.sensor.compass.xml \
|
||||
frameworks/native/data/etc/android.hardware.sensor.gyroscope.xml:system/etc/permissions/android.hardware.sensor.gyroscope.xml \
|
||||
frameworks/native/data/etc/android.hardware.sensor.light.xml:system/etc/permissions/android.hardware.sensor.light.xml \
|
||||
frameworks/native/data/etc/android.hardware.sensor.proximity.xml:system/etc/permissions/android.hardware.sensor.proximity.xml \
|
||||
frameworks/native/data/etc/android.hardware.telephony.gsm.xml:system/etc/permissions/android.hardware.telephony.gsm.xml \
|
||||
frameworks/native/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml:system/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.xml \
|
||||
frameworks/native/data/etc/android.hardware.touchscreen.multitouch.xml:system/etc/permissions/android.hardware.touchscreen.multitouch.xml \
|
||||
frameworks/native/data/etc/android.hardware.touchscreen.xml:system/etc/permissions/android.hardware.touchscreen.xml \
|
||||
frameworks/native/data/etc/android.hardware.usb.accessory.xml:system/etc/permissions/android.hardware.usb.accessory.xml \
|
||||
frameworks/native/data/etc/android.hardware.usb.host.xml:system/etc/permissions/android.hardware.usb.host.xml \
|
||||
frameworks/native/data/etc/android.hardware.wifi.direct.xml:system/etc/permissions/android.hardware.wifi.direct.xml \
|
||||
frameworks/native/data/etc/android.hardware.wifi.xml:system/etc/permissions/android.hardware.wifi.xml \
|
||||
frameworks/native/data/etc/android.software.sip.voip.xml:system/etc/permissions/android.software.sip.voip.xml \
|
||||
frameworks/native/data/etc/android.software.sip.xml:system/etc/permissions/android.software.sip.xml \
|
||||
frameworks/native/data/etc/handheld_core_hardware.xml:system/etc/permissions/handheld_core_hardware.xml
|
||||
|
||||
# Feature live wallpaper
|
||||
PRODUCT_COPY_FILES += \
|
||||
packages/wallpapers/LivePicker/android.software.live_wallpaper.xml:system/etc/permissions/android.software.live_wallpaper.xml
|
||||
|
||||
PRODUCT_PROPERTY_OVERRIDES += \
|
||||
ro.opengles.version=131072 \
|
||||
hwui.render_dirty_regions=false
|
||||
|
||||
PRODUCT_PROPERTY_OVERRIDES += \
|
||||
ro.sf.lcd_density=240
|
||||
|
||||
PRODUCT_TAGS += dalvik.gc.type-precise
|
||||
|
||||
# Set default USB interface
|
||||
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
|
||||
persist.sys.usb.config=mtp
|
||||
|
||||
$(call inherit-product, frameworks/native/build/phone-hdpi-512-dalvik-heap.mk)
|
||||
|
||||
# Include exynos4 platform specific parts
|
||||
TARGET_HAL_PATH := hardware/samsung/exynos4/hal
|
||||
TARGET_OMX_PATH := hardware/samsung/exynos/multimedia/openmax
|
||||
$(call inherit-product, hardware/samsung/exynos4210.mk)
|
||||
|
||||
# Use the non-open-source parts, if they're present
|
||||
-include vendor/samsung/galaxys2-common/common-vendor.mk
|
61
configs/asound.conf
Normal file
@ -0,0 +1,61 @@
|
||||
#
|
||||
# Copyright(c) 2010 Yamaha Corporation
|
||||
#
|
||||
|
||||
# ----------------------------------------
|
||||
# PCM Interface
|
||||
#
|
||||
|
||||
pcm.hifi {
|
||||
type plug
|
||||
slave.pcm {
|
||||
type hw
|
||||
card 0
|
||||
device 0
|
||||
format S16_LE
|
||||
channels 2
|
||||
rate 44100
|
||||
}
|
||||
}
|
||||
|
||||
pcm.voice {
|
||||
type plug
|
||||
slave.pcm {
|
||||
type hw
|
||||
card 0
|
||||
device 1
|
||||
format S16_LE
|
||||
channels 1
|
||||
rate 8000
|
||||
}
|
||||
}
|
||||
|
||||
pcm.bluetooth {
|
||||
type plug
|
||||
slave.pcm {
|
||||
type hw
|
||||
card 0
|
||||
device 2
|
||||
format S16_LE
|
||||
channels 1
|
||||
rate 8000
|
||||
}
|
||||
}
|
||||
|
||||
# ----------------------------------------
|
||||
# Mixer Interface
|
||||
#
|
||||
|
||||
ctl.mc1n2 {
|
||||
type hw
|
||||
card 0
|
||||
}
|
||||
|
||||
# ----------------------------------------
|
||||
# Hardware Dependant Interface
|
||||
#
|
||||
|
||||
hwdep.mc1n2 {
|
||||
type hw
|
||||
card 0
|
||||
}
|
118
configs/bcmdhd.cal
Normal file
@ -0,0 +1,118 @@
|
||||
manfid=0x2d0
|
||||
prodid=0x0532
|
||||
vendid=0x14e4
|
||||
devid=0x4360
|
||||
boardtype=0x0532
|
||||
boardrev=0x20
|
||||
boardflags=0x10080201
|
||||
|
||||
nocrc=1
|
||||
xtalfreq=37400
|
||||
xtalmode=0x20,0x4,0
|
||||
boardnum=22
|
||||
macaddr=00:90:4c:c5:12:38
|
||||
ag0=252
|
||||
ag1=252
|
||||
aa2g=1
|
||||
aa5g=1
|
||||
ccode=GB
|
||||
|
||||
#for BT-coexistence
|
||||
btc_params80=0
|
||||
btc_params6=10
|
||||
btc_params8=10000
|
||||
|
||||
sd_gpout=0
|
||||
# sd_oobonly=1
|
||||
muxenab=0x10
|
||||
|
||||
# 2G PA param_B42R 110927
|
||||
pa0b0=0x12E4
|
||||
pa0b1=0xFE09
|
||||
pa0b2=0xFF9A
|
||||
#pa0itssit=62
|
||||
rssismf2g=0xa
|
||||
rssismc2g=0x3
|
||||
rssisav2g=0x7
|
||||
|
||||
# rssi params for 5GHz B42R_110803
|
||||
#rssismf5g=0x4
|
||||
rssismf5g=0xa
|
||||
rssismc5g=0x7
|
||||
rssisav5g=0x1
|
||||
#PA parameters for lower band
|
||||
pa1lob0=0x144F
|
||||
pa1lob1=0xFD6B
|
||||
pa1lob2=0xFF3B
|
||||
#PA parameters for midband
|
||||
pa1b0=0x139C
|
||||
pa1b1=0xFD87
|
||||
pa1b2=0xFF4F
|
||||
#PA parameters for high band
|
||||
pa1hib0=0x12CA
|
||||
pa1hib1=0xFD9A
|
||||
pa1hib2=0xFF4E
|
||||
|
||||
# 2G PA offset
|
||||
maxp2ga0=64
|
||||
sromrev=3
|
||||
cckpo=0
|
||||
ofdm2gpo=0x66666666
|
||||
mcs2gpo0=0xaaaa
|
||||
mcs2gpo1=0xaaaa
|
||||
|
||||
# 5G PA offset
|
||||
maxp5ga0=66
|
||||
maxp5gla0=66
|
||||
maxp5gha0=66
|
||||
ofdm5gpo=0x22222222
|
||||
ofdm5glpo=0x11111111
|
||||
ofdm5ghpo=0x22222222
|
||||
mcs5gpo0=0x6666
|
||||
mcs5gpo1=0x6666
|
||||
mcs5glpo0=0x5555
|
||||
mcs5glpo1=0x5555
|
||||
mcs5ghpo0=0x6666
|
||||
mcs5ghpo1=0x6666
|
||||
|
||||
cckPwrOffset=4
|
||||
cckdigfilttype=22
|
||||
ofdmdigfilttype=2
|
||||
extpagain5g=2
|
||||
#wl0id=0x431b
|
||||
|
||||
# For 2GHz Tx EVM/SM
|
||||
rfreg033=0x19
|
||||
rfreg033_cck=0x1d
|
||||
pacalidx2g=65
|
||||
dacrate2g=160
|
||||
txalpfbyp2g=1
|
||||
bphyscale=17
|
||||
|
||||
# 5GHz LOFT and IQ CAL
|
||||
txgaintbl5g=1
|
||||
txiqlopapu5g=1
|
||||
txiqlopag5g=0x10
|
||||
iqlocalidx5g=24
|
||||
|
||||
# 5GHz Noise CAL parameter
|
||||
noise_cal_po_5g=5
|
||||
noise_cal_enable_5g=0
|
||||
|
||||
# 2GHz RxPER at low rates
|
||||
noise_cal_ref_2g=56
|
||||
noise_cal_po_bias_2g=-4
|
||||
noise_cal_enable_2g=1
|
||||
|
||||
# Max input level on a-band
|
||||
triso5g=9
|
||||
|
||||
# Tx power control, especially temp.
|
||||
tssitime=1
|
||||
|
||||
#fc+1.7GHz Spur Elimination
|
||||
loidacmode5g=1
|
||||
|
||||
swctrlmap_2g=0x84048404, 0x82028202, 0x84048404, 0x010202, 0x1ff
|
||||
swctrlmap_5g=0xC040C040, 0xB030A020, 0xA020C040, 0x010A02, 0x2F8
|
||||
|
1
configs/egl.cfg
Normal file
@ -0,0 +1 @@
|
||||
0 1 mali
|
6
configs/gps.conf
Normal file
@ -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
|
109
configs/media_codecs.xml
Normal file
@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!-- Copyright (C) 2012 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!--
|
||||
<!DOCTYPE MediaCodecs [
|
||||
<!ELEMENT MediaCodecs (Decoders,Encoders)>
|
||||
<!ELEMENT Decoders (MediaCodec*)>
|
||||
<!ELEMENT Encoders (MediaCodec*)>
|
||||
<!ELEMENT MediaCodec (Type*,Quirk*)>
|
||||
<!ATTLIST MediaCodec name CDATA #REQUIRED>
|
||||
<!ATTLIST MediaCodec type CDATA>
|
||||
<!ELEMENT Type EMPTY>
|
||||
<!ATTLIST Type name CDATA #REQUIRED>
|
||||
<!ELEMENT Quirk EMPTY>
|
||||
<!ATTLIST Quirk name CDATA #REQUIRED>
|
||||
]>
|
||||
|
||||
There's a simple and a complex syntax to declare the availability of a
|
||||
media codec:
|
||||
|
||||
A codec that properly follows the OpenMax spec and therefore doesn't have any
|
||||
quirks and that only supports a single content type can be declared like so:
|
||||
|
||||
<MediaCodec name="OMX.foo.bar" type="something/interesting" />
|
||||
|
||||
If a codec has quirks OR supports multiple content types, the following syntax
|
||||
can be used:
|
||||
|
||||
<MediaCodec name="OMX.foo.bar" >
|
||||
<Type name="something/interesting" />
|
||||
<Type name="something/else" />
|
||||
...
|
||||
<Quirk name="requires-allocate-on-input-ports" />
|
||||
<Quirk name="requires-allocate-on-output-ports" />
|
||||
<Quirk name="output-buffers-are-unreadable" />
|
||||
</MediaCodec>
|
||||
|
||||
Only the three quirks included above are recognized at this point:
|
||||
|
||||
"requires-allocate-on-input-ports"
|
||||
must be advertised if the component does not properly support specification
|
||||
of input buffers using the OMX_UseBuffer(...) API but instead requires
|
||||
OMX_AllocateBuffer to be used.
|
||||
|
||||
"requires-allocate-on-output-ports"
|
||||
must be advertised if the component does not properly support specification
|
||||
of output buffers using the OMX_UseBuffer(...) API but instead requires
|
||||
OMX_AllocateBuffer to be used.
|
||||
|
||||
"output-buffers-are-unreadable"
|
||||
must be advertised if the emitted output buffers of a decoder component
|
||||
are not readable, i.e. use a custom format even though abusing one of
|
||||
the official OMX colorspace constants.
|
||||
Clients of such decoders will not be able to access the decoded data,
|
||||
naturally making the component much less useful. The only use for
|
||||
a component with this quirk is to render the output to the screen.
|
||||
Audio decoders MUST NOT advertise this quirk.
|
||||
Video decoders that advertise this quirk must be accompanied by a
|
||||
corresponding color space converter for thumbnail extraction,
|
||||
matching surfaceflinger support that can render the custom format to
|
||||
a texture and possibly other code, so just DON'T USE THIS QUIRK.
|
||||
|
||||
-->
|
||||
|
||||
<MediaCodecs>
|
||||
<Decoders>
|
||||
<MediaCodec name="OMX.SEC.AVC.Decoder" type="video/avc" />
|
||||
<MediaCodec name="OMX.SEC.MPEG4.Decoder" type="video/mp4v-es" />
|
||||
<MediaCodec name="OMX.SEC.H263.Decoder" type="video/3gpp" />
|
||||
<MediaCodec name="OMX.SEC.AVC.Decoder" type="video/avc" />
|
||||
<MediaCodec name="OMX.SEC.VP8.Decoder" type="video/x-vnd.on2.vp8" />
|
||||
|
||||
<MediaCodec name="OMX.google.mp3.decoder" type="audio/mpeg" />
|
||||
<MediaCodec name="OMX.google.amrnb.decoder" type="audio/3gpp" />
|
||||
<MediaCodec name="OMX.google.amrwb.decoder" type="audio/amr-wb" />
|
||||
<MediaCodec name="OMX.google.aac.decoder" type="audio/mp4a-latm" />
|
||||
<MediaCodec name="OMX.google.g711.alaw.decoder" type="audio/g711-alaw" />
|
||||
<MediaCodec name="OMX.google.g711.mlaw.decoder" type="audio/g711-mlaw" />
|
||||
<MediaCodec name="OMX.google.vorbis.decoder" type="audio/vorbis" />
|
||||
<MediaCodec name="OMX.google.mpeg4.decoder" type="video/mp4v-es" />
|
||||
<MediaCodec name="OMX.google.h263.decoder" type="video/3gpp" />
|
||||
<MediaCodec name="OMX.google.h264.decoder" type="video/avc" />
|
||||
<MediaCodec name="OMX.google.vpx.decoder" type="video/x-vnd.on2.vp8" />
|
||||
</Decoders>
|
||||
|
||||
<Encoders>
|
||||
<MediaCodec name="OMX.SEC.MPEG4.Encoder" type="video/mp4v-es" />
|
||||
<MediaCodec name="OMX.SEC.H263.Encoder" type="video/3gpp" />
|
||||
<MediaCodec name="OMX.SEC.AVC.Encoder" type="video/avc" />
|
||||
|
||||
<MediaCodec name="OMX.google.amrnb.encoder" type="audio/3gpp" />
|
||||
<MediaCodec name="OMX.google.amrwb.encoder" type="audio/amr-wb" />
|
||||
<MediaCodec name="OMX.google.aac.encoder" type="audio/mp4a-latm" />
|
||||
<MediaCodec name="OMX.google.flac.encoder" type="audio/flac" />
|
||||
</Encoders>
|
||||
</MediaCodecs>
|
497
configs/media_profiles.xml
Normal file
@ -0,0 +1,497 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2010 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<!DOCTYPE MediaSettings [
|
||||
<!ELEMENT MediaSettings (CamcorderProfiles,
|
||||
EncoderOutputFileFormat+,
|
||||
VideoEncoderCap+,
|
||||
AudioEncoderCap+,
|
||||
VideoDecoderCap,
|
||||
AudioDecoderCap)>
|
||||
<!ELEMENT CamcorderProfiles (EncoderProfile+, ImageEncoding+, ImageDecoding, Camera)>
|
||||
<!ELEMENT EncoderProfile (Video, Audio)>
|
||||
<!ATTLIST EncoderProfile quality (timelapse1080p|timelapse720p|timelapse480p|timelapsehigh|timelapselow|480p|qcif|high|low) #REQUIRED>
|
||||
<!ATTLIST EncoderProfile fileFormat (mp4|3gp) #REQUIRED>
|
||||
<!ATTLIST EncoderProfile duration (30|60) #REQUIRED>
|
||||
<!ATTLIST EncoderProfile cameraId (0|1) #REQUIRED>
|
||||
<!ELEMENT Video EMPTY>
|
||||
<!ATTLIST Video codec (h264|h263|m4v) #REQUIRED>
|
||||
<!ATTLIST Video bitRate CDATA #REQUIRED>
|
||||
<!ATTLIST Video width CDATA #REQUIRED>
|
||||
<!ATTLIST Video height CDATA #REQUIRED>
|
||||
<!ATTLIST Video frameRate CDATA #REQUIRED>
|
||||
<!ELEMENT Audio EMPTY>
|
||||
<!ATTLIST Audio codec (amrnb|amrwb|aac) #REQUIRED>
|
||||
<!ATTLIST Audio bitRate CDATA #REQUIRED>
|
||||
<!ATTLIST Audio sampleRate CDATA #REQUIRED>
|
||||
<!ATTLIST Audio channels (1|2) #REQUIRED>
|
||||
<!ELEMENT ImageEncoding EMPTY>
|
||||
<!ATTLIST ImageEncoding quality (90|80|70|60|50|40) #REQUIRED>
|
||||
<!ELEMENT ImageDecoding EMPTY>
|
||||
<!ATTLIST ImageDecoding memCap CDATA #REQUIRED>
|
||||
<!ELEMENT Camera EMPTY>
|
||||
<!ATTLIST Camera previewFrameRate CDATA #REQUIRED>
|
||||
<!ELEMENT EncoderOutputFileFormat EMPTY>
|
||||
<!ATTLIST EncoderOutputFileFormat name (mp4|3gp) #REQUIRED>
|
||||
<!ELEMENT VideoEncoderCap EMPTY>
|
||||
<!ATTLIST VideoEncoderCap name (h264|h263|m4v|wmv) #REQUIRED>
|
||||
<!ATTLIST VideoEncoderCap enabled (true|false) #REQUIRED>
|
||||
<!ATTLIST VideoEncoderCap minBitRate CDATA #REQUIRED>
|
||||
<!ATTLIST VideoEncoderCap maxBitRate CDATA #REQUIRED>
|
||||
<!ATTLIST VideoEncoderCap minFrameWidth CDATA #REQUIRED>
|
||||
<!ATTLIST VideoEncoderCap maxFrameWidth CDATA #REQUIRED>
|
||||
<!ATTLIST VideoEncoderCap minFrameHeight CDATA #REQUIRED>
|
||||
<!ATTLIST VideoEncoderCap maxFrameHeight CDATA #REQUIRED>
|
||||
<!ATTLIST VideoEncoderCap minFrameRate CDATA #REQUIRED>
|
||||
<!ATTLIST VideoEncoderCap maxFrameRate CDATA #REQUIRED>
|
||||
<!ELEMENT AudioEncoderCap EMPTY>
|
||||
<!ATTLIST AudioEncoderCap name (amrnb|amrwb|aac|wma) #REQUIRED>
|
||||
<!ATTLIST AudioEncoderCap enabled (true|false) #REQUIRED>
|
||||
<!ATTLIST AudioEncoderCap minBitRate CDATA #REQUIRED>
|
||||
<!ATTLIST AudioEncoderCap maxBitRate CDATA #REQUIRED>
|
||||
<!ATTLIST AudioEncoderCap minSampleRate CDATA #REQUIRED>
|
||||
<!ATTLIST AudioEncoderCap maxSampleRate CDATA #REQUIRED>
|
||||
<!ATTLIST AudioEncoderCap minChannels (1|2) #REQUIRED>
|
||||
<!ATTLIST AudioEncoderCap maxChannels (1|2) #REQUIRED>
|
||||
<!ELEMENT VideoDecoderCap EMPTY>
|
||||
<!ATTLIST VideoDecoderCap name (wmv) #REQUIRED>
|
||||
<!ATTLIST VideoDecoderCap enabled (true|false) #REQUIRED>
|
||||
<!ELEMENT AudioDecoderCap EMPTY>
|
||||
<!ATTLIST AudioDecoderCap name (wma) #REQUIRED>
|
||||
<!ATTLIST AudioDecoderCap enabled (true|false) #REQUIRED>
|
||||
<!ELEMENT VideoEditorCap EMPTY>
|
||||
<!ATTLIST VideoEditorCap maxInputFrameWidth CDATA #REQUIRED>
|
||||
<!ATTLIST VideoEditorCap maxInputFrameHeight CDATA #REQUIRED>
|
||||
<!ATTLIST VideoEditorCap maxOutputFrameWidth CDATA #REQUIRED>
|
||||
<!ATTLIST VideoEditorCap maxOutputFrameHeight CDATA #REQUIRED>
|
||||
<!ATTLIST VideoEditorCap maxPrefetchYUVFrames CDATA #REQUIRED>
|
||||
<!ELEMENT ExportVideoProfile EMPTY>
|
||||
<!ATTLIST ExportVideoProfile name (h264|h263|m4v) #REQUIRED>
|
||||
<!ATTLIST ExportVideoProfile profile CDATA #REQUIRED>
|
||||
<!ATTLIST ExportVideoProfile level CDATA #REQUIRED>
|
||||
]>
|
||||
<!--
|
||||
This file is used to declare the multimedia profiles and capabilities
|
||||
on an android-powered device.
|
||||
-->
|
||||
<MediaSettings>
|
||||
<!-- Each camcorder profile defines a set of predefined configuration parameters -->
|
||||
<!-- Back Camera -->
|
||||
<CamcorderProfiles cameraId="0">
|
||||
|
||||
<EncoderProfile quality="low" fileFormat="3gp" duration="30">
|
||||
<Video codec="h264"
|
||||
bitRate="384000"
|
||||
width="176"
|
||||
height="144"
|
||||
frameRate="30" />
|
||||
|
||||
<Audio codec="amrnb"
|
||||
bitRate="12200"
|
||||
sampleRate="8000"
|
||||
channels="1" />
|
||||
</EncoderProfile>
|
||||
|
||||
<EncoderProfile quality="high" fileFormat="3gp" duration="30">
|
||||
<Video codec="h264"
|
||||
bitRate="17000000"
|
||||
width="1920"
|
||||
height="1080"
|
||||
frameRate="30" />
|
||||
|
||||
<Audio codec="aac"
|
||||
bitRate="128000"
|
||||
sampleRate="48000"
|
||||
channels="1" />
|
||||
</EncoderProfile>
|
||||
|
||||
<EncoderProfile quality="qcif" fileFormat="3gp" duration="30">
|
||||
<Video codec="h264"
|
||||
bitRate="384000"
|
||||
width="176"
|
||||
height="144"
|
||||
frameRate="30" />
|
||||
|
||||
<Audio codec="amrnb"
|
||||
bitRate="12200"
|
||||
sampleRate="8000"
|
||||
channels="1" />
|
||||
</EncoderProfile>
|
||||
|
||||
<EncoderProfile quality="480p" fileFormat="mp4" duration="30">
|
||||
<Video codec="h264"
|
||||
bitRate="3078000"
|
||||
width="640"
|
||||
height="480"
|
||||
frameRate="30" />
|
||||
|
||||
<Audio codec="aac"
|
||||
bitRate="96000"
|
||||
sampleRate="16000"
|
||||
channels="1" />
|
||||
</EncoderProfile>
|
||||
|
||||
<EncoderProfile quality="720p" fileFormat="mp4" duration="30">
|
||||
<Video codec="h264"
|
||||
bitRate="16000000"
|
||||
width="1280"
|
||||
height="720"
|
||||
frameRate="30" />
|
||||
|
||||
<Audio codec="aac"
|
||||
bitRate="128000"
|
||||
sampleRate="48000"
|
||||
channels="2" />
|
||||
</EncoderProfile>
|
||||
|
||||
<EncoderProfile quality="1080p" fileFormat="mp4" duration="30">
|
||||
<Video codec="h264"
|
||||
bitRate="20000000"
|
||||
width="1920"
|
||||
height="1080"
|
||||
frameRate="30" />
|
||||
|
||||
<Audio codec="aac"
|
||||
bitRate="128000"
|
||||
sampleRate="48000"
|
||||
channels="2" />
|
||||
</EncoderProfile>
|
||||
|
||||
<EncoderProfile quality="timelapselow" fileFormat="3gp" duration="30">
|
||||
<Video codec="h264"
|
||||
bitRate="384000"
|
||||
width="176"
|
||||
height="144"
|
||||
frameRate="30" />
|
||||
|
||||
<!--
|
||||
The Audio part of the profile will not be used since time lapse mode
|
||||
does not capture audio
|
||||
-->
|
||||
<Audio codec="amrnb"
|
||||
bitRate="12200"
|
||||
sampleRate="8000"
|
||||
channels="1" />
|
||||
</EncoderProfile>
|
||||
|
||||
<EncoderProfile quality="timelapsehigh" fileFormat="3gp" duration="30">
|
||||
<Video codec="h264"
|
||||
bitRate="17000000"
|
||||
width="1920"
|
||||
height="1080"
|
||||
frameRate="30" />
|
||||
|
||||
<!--
|
||||
The Audio part of the profile will not be used since time lapse mode
|
||||
does not capture audio
|
||||
-->
|
||||
<Audio codec="aac"
|
||||
bitRate="96000"
|
||||
sampleRate="16000"
|
||||
channels="1" />
|
||||
</EncoderProfile>
|
||||
|
||||
<EncoderProfile quality="timelapseqcif" fileFormat="3gp" duration="30">
|
||||
<Video codec="h264"
|
||||
bitRate="384000"
|
||||
width="176"
|
||||
height="144"
|
||||
frameRate="30" />
|
||||
|
||||
<!--
|
||||
The Audio part of the profile will not be used since time lapse mode
|
||||
does not capture audio
|
||||
-->
|
||||
<Audio codec="amrnb"
|
||||
bitRate="12200"
|
||||
sampleRate="8000"
|
||||
channels="1" />
|
||||
</EncoderProfile>
|
||||
|
||||
<EncoderProfile quality="timelapse480p" fileFormat="3gp" duration="30">
|
||||
<Video codec="h264"
|
||||
bitRate="3078000"
|
||||
width="640"
|
||||
height="480"
|
||||
frameRate="30" />
|
||||
|
||||
<!--
|
||||
The Audio part of the profile will not be used since time lapse mode
|
||||
does not capture audio
|
||||
-->
|
||||
<Audio codec="aac"
|
||||
bitRate="96000"
|
||||
sampleRate="16000"
|
||||
channels="1" />
|
||||
</EncoderProfile>
|
||||
|
||||
<EncoderProfile quality="timelapse720p" fileFormat="3gp" duration="30">
|
||||
<Video codec="h264"
|
||||
bitRate="12000000"
|
||||
width="1280"
|
||||
height="720"
|
||||
frameRate="30" />
|
||||
|
||||
<!--
|
||||
The Audio part of the profile will not be used since time lapse mode
|
||||
does not capture audio
|
||||
-->
|
||||
<Audio codec="aac"
|
||||
bitRate="96000"
|
||||
sampleRate="16000"
|
||||
channels="1" />
|
||||
</EncoderProfile>
|
||||
|
||||
<EncoderProfile quality="timelapse1080p" fileFormat="3gp" duration="30">
|
||||
<Video codec="h264"
|
||||
bitRate="17000000"
|
||||
width="1920"
|
||||
height="1080"
|
||||
frameRate="30" />
|
||||
|
||||
<!--
|
||||
The Audio part of the profile will not be used since time lapse mode
|
||||
does not capture audio
|
||||
-->
|
||||
<Audio codec="aac"
|
||||
bitRate="96000"
|
||||
sampleRate="16000"
|
||||
channels="1" />
|
||||
</EncoderProfile>
|
||||
|
||||
<ImageEncoding quality="90" />
|
||||
<ImageEncoding quality="80" />
|
||||
<ImageEncoding quality="70" />
|
||||
<ImageDecoding memCap="20000000" />
|
||||
|
||||
</CamcorderProfiles>
|
||||
|
||||
<!-- Front Camera -->
|
||||
<CamcorderProfiles cameraId="1">
|
||||
|
||||
<EncoderProfile quality="low" fileFormat="3gp" duration="15">
|
||||
<Video codec="h264"
|
||||
bitRate="384000"
|
||||
width="176"
|
||||
height="144"
|
||||
frameRate="30" />
|
||||
|
||||
<Audio codec="amrnb"
|
||||
bitRate="12200"
|
||||
sampleRate="8000"
|
||||
channels="1" />
|
||||
</EncoderProfile>
|
||||
|
||||
<EncoderProfile quality="high" fileFormat="3gp" duration="15">
|
||||
<Video codec="h264"
|
||||
bitRate="3078000"
|
||||
width="640"
|
||||
height="480"
|
||||
frameRate="30" />
|
||||
|
||||
<Audio codec="aac"
|
||||
bitRate="96000"
|
||||
sampleRate="16000"
|
||||
channels="1" />
|
||||
</EncoderProfile>
|
||||
|
||||
<EncoderProfile quality="qcif" fileFormat="3gp" duration="15">
|
||||
<Video codec="h264"
|
||||
bitRate="384000"
|
||||
width="176"
|
||||
height="144"
|
||||
frameRate="30" />
|
||||
|
||||
<Audio codec="amrnb"
|
||||
bitRate="12200"
|
||||
sampleRate="8000"
|
||||
channels="1" />
|
||||
</EncoderProfile>
|
||||
|
||||
<EncoderProfile quality="480p" fileFormat="mp4" duration="15">
|
||||
<Video codec="h264"
|
||||
bitRate="3078000"
|
||||
width="640"
|
||||
height="480"
|
||||
frameRate="30" />
|
||||
|
||||
<Audio codec="aac"
|
||||
bitRate="96000"
|
||||
sampleRate="16000"
|
||||
channels="1" />
|
||||
</EncoderProfile>
|
||||
|
||||
<EncoderProfile quality="timelapselow" fileFormat="3gp" duration="15">
|
||||
<Video codec="h264"
|
||||
bitRate="384000"
|
||||
width="176"
|
||||
height="144"
|
||||
frameRate="30" />
|
||||
|
||||
<!--
|
||||
The Audio part of the profile will not be used since time lapse mode
|
||||
does not capture audio
|
||||
-->
|
||||
<Audio codec="amrnb"
|
||||
bitRate="12200"
|
||||
sampleRate="8000"
|
||||
channels="1" />
|
||||
</EncoderProfile>
|
||||
|
||||
<EncoderProfile quality="timelapsehigh" fileFormat="3gp" duration="15">
|
||||
<Video codec="h264"
|
||||
bitRate="3078000"
|
||||
width="640"
|
||||
height="480"
|
||||
frameRate="30" />
|
||||
|
||||
<!--
|
||||
The Audio part of the profile will not be used since time lapse mode
|
||||
does not capture audio
|
||||
-->
|
||||
<Audio codec="aac"
|
||||
bitRate="96000"
|
||||
sampleRate="16000"
|
||||
channels="1" />
|
||||
</EncoderProfile>
|
||||
|
||||
<EncoderProfile quality="timelapseqcif" fileFormat="3gp" duration="15">
|
||||
<Video codec="h264"
|
||||
bitRate="384000"
|
||||
width="176"
|
||||
height="144"
|
||||
frameRate="30" />
|
||||
|
||||
<!--
|
||||
The Audio part of the profile will not be used since time lapse mode
|
||||
does not capture audio
|
||||
-->
|
||||
<Audio codec="amrnb"
|
||||
bitRate="12200"
|
||||
sampleRate="8000"
|
||||
channels="1" />
|
||||
</EncoderProfile>
|
||||
|
||||
<EncoderProfile quality="timelapse480p" fileFormat="3gp" duration="15">
|
||||
<Video codec="h264"
|
||||
bitRate="3078000"
|
||||
width="640"
|
||||
height="480"
|
||||
frameRate="30" />
|
||||
|
||||
<!--
|
||||
The Audio part of the profile will not be used since time lapse mode
|
||||
does not capture audio
|
||||
-->
|
||||
<Audio codec="aac"
|
||||
bitRate="96000"
|
||||
sampleRate="16000"
|
||||
channels="1" />
|
||||
</EncoderProfile>
|
||||
|
||||
<ImageEncoding quality="90" />
|
||||
<ImageEncoding quality="80" />
|
||||
<ImageEncoding quality="70" />
|
||||
<ImageDecoding memCap="20000000" />
|
||||
|
||||
</CamcorderProfiles>
|
||||
|
||||
<EncoderOutputFileFormat name="3gp" />
|
||||
<EncoderOutputFileFormat name="mp4" />
|
||||
|
||||
<!--
|
||||
If a codec is not enabled, it is invisible to the applications
|
||||
In other words, the applications won't be able to use the codec
|
||||
or query the capabilities of the codec at all if it is disabled
|
||||
-->
|
||||
<VideoEncoderCap name="h264" enabled="true"
|
||||
minBitRate="64000" maxBitRate="20000000"
|
||||
minFrameWidth="176" maxFrameWidth="1920"
|
||||
minFrameHeight="144" maxFrameHeight="1080"
|
||||
minFrameRate="1" maxFrameRate="30" />
|
||||
|
||||
<VideoEncoderCap name="h263" enabled="true"
|
||||
minBitRate="64000" maxBitRate="1000000"
|
||||
minFrameWidth="176" maxFrameWidth="800"
|
||||
minFrameHeight="144" maxFrameHeight="480"
|
||||
minFrameRate="1" maxFrameRate="30" />
|
||||
|
||||
<VideoEncoderCap name="m4v" enabled="true"
|
||||
minBitRate="64000" maxBitRate="20000000"
|
||||
minFrameWidth="176" maxFrameWidth="1920"
|
||||
minFrameHeight="144" maxFrameHeight="1080"
|
||||
minFrameRate="1" maxFrameRate="30" />
|
||||
|
||||
<AudioEncoderCap name="aac" enabled="true"
|
||||
minBitRate="8192" maxBitRate="196000"
|
||||
minSampleRate="8000" maxSampleRate="48000"
|
||||
minChannels="1" maxChannels="2" />
|
||||
|
||||
<AudioEncoderCap name="amrwb" enabled="true"
|
||||
minBitRate="6600" maxBitRate="23050"
|
||||
minSampleRate="16000" maxSampleRate="16000"
|
||||
minChannels="1" maxChannels="1" />
|
||||
|
||||
<AudioEncoderCap name="amrnb" enabled="true"
|
||||
minBitRate="5525" maxBitRate="12200"
|
||||
minSampleRate="8000" maxSampleRate="8000"
|
||||
minChannels="1" maxChannels="1" />
|
||||
|
||||
<!--
|
||||
FIXME:
|
||||
We do not check decoder capabilities at present
|
||||
At present, we only check whether windows media is visible
|
||||
for TEST applications. For other applications, we do
|
||||
not perform any checks at all.
|
||||
-->
|
||||
<VideoDecoderCap name="wmv" enabled="false"/>
|
||||
<AudioDecoderCap name="wma" enabled="false"/>
|
||||
|
||||
<!--
|
||||
The VideoEditor Capability configuration:
|
||||
- maxInputFrameWidth: maximum video width of imported video clip.
|
||||
- maxInputFrameHeight: maximum video height of imported video clip.
|
||||
- maxOutputFrameWidth: maximum video width of exported video clip.
|
||||
- maxOutputFrameHeight: maximum video height of exported video clip.
|
||||
- maxPrefetchYUVFrames: maximum prefetch YUV frames for encoder,
|
||||
used to limit the amount of memory for prefetched YUV frames.
|
||||
For this platform, it allows maximum ~1MB(~0.1MB per QVGA frame x 10
|
||||
frames) memory.
|
||||
-->
|
||||
|
||||
<VideoEditorCap maxInputFrameWidth="1280"
|
||||
maxInputFrameHeight="720" maxOutputFrameWidth="1280"
|
||||
maxOutputFrameHeight="720" maxPrefetchYUVFrames="5"/>
|
||||
<!--
|
||||
The VideoEditor Export codec profile and level values
|
||||
correspond to the values in OMX_Video.h.
|
||||
E.g. for h264, profile value 1 means OMX_VIDEO_AVCProfileBaseline
|
||||
and level 256 means OMX_VIDEO_AVCLevel3.
|
||||
Please note that the values are in decimal.
|
||||
These values are for video encoder.
|
||||
-->
|
||||
<!--
|
||||
Codec = h.264, Baseline profile, level 3.1
|
||||
-->
|
||||
<ExportVideoProfile name="h264" profile= "1" level="512"/>
|
||||
<!--
|
||||
Codec = h.263, Baseline profile, level 0
|
||||
-->
|
||||
<ExportVideoProfile name="h263" profile= "1" level="1"/>
|
||||
<!--
|
||||
Codec = mpeg4, Simple profile, level 3
|
||||
-->
|
||||
<ExportVideoProfile name="m4v" profile= "1" level="16"/>
|
||||
</MediaSettings>
|
38
configs/sirfgps.conf
Normal file
@ -0,0 +1,38 @@
|
||||
#CSR SiRF plc
|
||||
#PROJECT_NAME : white Space is not allowed
|
||||
#UART_DRIVER : Uart Driver Path
|
||||
#RESET_GPIO : Reset GPIO Driver Path
|
||||
#ONOFF_GPIO : OnOff GPIO Driver Path
|
||||
#EXTERNAL_LNA : 1 - use External LNA, 0 - use Internal LNA only
|
||||
#REF_CLOCK_26MHZ: 1 - use 26MHz TCXO, 0 - use 16.369MHz TCXO
|
||||
#UART_BAUD_RATE : 0 - 115200bps 1 - 230400, 2 - 460800, 3 - 57600
|
||||
#FREQUENCY_AIDING : 0 - Disable, 1 - Enable
|
||||
#SENSOR_AIDING : 0 - Disable, 1 - Enable
|
||||
#SET_ID_IMSI : 1 - Use IMSI for SET ID, 0 - Use MSISDN for SET ID, especially for Japan Network Operators
|
||||
#DEBUGGING_FILES : 0 - no log file, 1 - log files enabled
|
||||
#SSL_ENABLED : 0 - SSL Disabled, 1 - SSL Enabled
|
||||
#CERTI_VERSION : 0 - TLSv1 , 1 - SSLv3 , 2 - SSLv23
|
||||
#CP_RESPONSETIME : 0 - no priority, 1 - resposne priority time, 2 - resposne priority position ,3 - resposne priority use entire response time
|
||||
#REAIDING=20
|
||||
#CONTROL_PLANE : 1 - CP Enabled, 0 - CP Disabled, for MP3 player or PND
|
||||
#ATT_NETWORK_OPERATOR : 1 - for AT&T, 0 - for other network operator
|
||||
PROJECT=SAMSUNG_S5PC210
|
||||
UART_DRIVER=/dev/ttySAC1
|
||||
RESET_GPIO=/sys/devices/virtual/sec/gps/GPS_nRST/value
|
||||
ONOFF_GPIO=/sys/devices/virtual/sec/gps/GPS_PWR_EN/value
|
||||
EXTERNAL_LNA=0
|
||||
REF_CLOCK_26MHZ=1
|
||||
UART_BAUD_RATE=2
|
||||
FREQUENCY_AIDING=1
|
||||
SENSOR_AIDING=1
|
||||
SET_ID_IMSI=1
|
||||
DEBUGGING_FILES=0
|
||||
SSL_ENABLED=0
|
||||
CERTI_VERSION=0
|
||||
CP_RESPONSETIME=2
|
||||
CONTROL_PLANE=1
|
||||
ATT_NETWORK_OPERATOR=0
|
||||
ICS_NETWORK_OPERATOR=1
|
||||
SGEE=0
|
||||
EMC_ENABLE=1
|
||||
LOG_PATH=/data
|
132
configs/spn-conf.xml
Normal file
@ -0,0 +1,132 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
** Copyright 2006, Google Inc.
|
||||
**
|
||||
** 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<!--
|
||||
spnOverride attributes:
|
||||
numeric: MCC+MNC from IMSI - this attribute is used as the key
|
||||
imsi_subset: this attribute is used as a imsi filter (imsi format is: [MCC][MNC][imsi_subset][rest of imsi]) - the longest matching imsi_subset is a best match
|
||||
spn: spn to show instead of EFSPN. locales can be specified here too, if needed
|
||||
spn_display_rule: SPN_RULE_SHOW_SPN, SPN_RULE_SHOW_PLMN or both
|
||||
fake_home_on: regard specified PLMN as home
|
||||
fake_roaming_on: regard specified PLMN as roaming (comma-separated list)
|
||||
|
||||
examples:
|
||||
<spnOverride
|
||||
numeric="45001" spn="ko_KR;?œêµ??SPN,en;English SPN,fr;Français SPN,pl;Polski SPN,Default SPN"
|
||||
spn_display_rule="SPN_RULE_SHOW_SPN" spn_override_only_on="45001" fake_home_on="00101,45008"/>
|
||||
<spnOverride numeric="46001" spn="zh_CN;ä¸?›½?”é€? />
|
||||
-->
|
||||
<spnOverrides>
|
||||
|
||||
<!-- Spain -->
|
||||
<spnOverride numeric="21404" spn_display_rule="SPN_RULE_SHOW_SPN" spn_override_only_on="214"/>
|
||||
<spnOverride numeric="21406" spn_display_rule="SPN_RULE_SHOW_SPN" spn_override_only_on="214"/>
|
||||
<spnOverride numeric="21408" spn_display_rule="SPN_RULE_SHOW_SPN" spn_override_only_on="214"/>
|
||||
<spnOverride numeric="21416" spn_display_rule="SPN_RULE_SHOW_SPN" spn_override_only_on="214"/>
|
||||
<spnOverride numeric="21419" spn_display_rule="SPN_RULE_SHOW_SPN" spn_override_only_on="214"/>
|
||||
<spnOverride numeric="214" fake_home_on="21401,21403,21404,21406,21407,21408,21416,21419"/>
|
||||
|
||||
<!-- SENA -->
|
||||
<spnOverride numeric="24001" spn_display_rule="SPN_RULE_SHOW_SPN" spn_override_only_on="24005"/>
|
||||
<spnOverride numeric="24007" spn_display_rule="SPN_RULE_SHOW_SPN" spn_override_only_on="24005"/>
|
||||
|
||||
<!-- Finland -->
|
||||
<spnOverride numeric="24421" fake_home_on="24405"/>
|
||||
|
||||
<!-- Japan -->
|
||||
<spnOverride numeric="44010" spn="NTT DOCOMO"/>
|
||||
|
||||
<!-- Poland -->
|
||||
<spnOverride numeric="26006" spn_display_rule="SPN_RULE_SHOW_SPN" spn_override_only_on="26001"/>
|
||||
|
||||
<!-- Belgium Telent - Proximus and Mobistar-->
|
||||
<spnOverride numeric="20605" spn_display_rule="SPN_RULE_SHOW_SPN" fake_home_on="20610"/>
|
||||
<spnOverride numeric="20601" imsi_subset="889" spn_display_rule="SPN_RULE_SHOW_SPN" fake_roaming_on="20601"/>
|
||||
|
||||
<!-- Netherlands - Telfort and KPN -->
|
||||
<spnOverride numeric="20412" fake_home_on="20408,20410" />
|
||||
|
||||
<!-- SpainTelefonica - Tuenti and 21407 -->
|
||||
<spnOverride numeric="21405" fake_home_on="21407"/>
|
||||
|
||||
<!-- LTN [latin_protocol] -->
|
||||
<spnOverride numeric="72410" spn_display_rule="SPN_RULE_SHOW_SPN" fake_home_on="72410,72411,72406,72423"/>
|
||||
<spnOverride numeric="72411" spn_display_rule="SPN_RULE_SHOW_SPN" fake_home_on="72410,72411,72406,72423"/>
|
||||
<spnOverride numeric="72406" spn_display_rule="SPN_RULE_SHOW_SPN" fake_home_on="72410,72411,72406,72423"/>
|
||||
<spnOverride numeric="72423" spn_display_rule="SPN_RULE_SHOW_SPN" fake_home_on="72410,72411,72406,72423"/>
|
||||
<spnOverride numeric="72432" spn_display_rule="SPN_RULE_SHOW_SPN" fake_home_on="72432,72433,72434"/>
|
||||
<spnOverride numeric="72433" spn_display_rule="SPN_RULE_SHOW_SPN" fake_home_on="72432,72433,72434"/>
|
||||
<spnOverride numeric="72434" spn_display_rule="SPN_RULE_SHOW_SPN" fake_home_on="72432,72433,72434"/>
|
||||
<spnOverride numeric="73001" spn_display_rule="SPN_RULE_SHOW_SPN" fake_home_on="73001,73010"/>
|
||||
<spnOverride numeric="73010" spn_display_rule="SPN_RULE_SHOW_SPN" fake_home_on="73001,73010"/>
|
||||
<spnOverride numeric="71201" spn_display_rule="SPN_RULE_SHOW_SPN" fake_home_on="71201,71202"/>
|
||||
<spnOverride numeric="71202" spn_display_rule="SPN_RULE_SHOW_SPN" fake_home_on="71201,71202"/>
|
||||
<spnOverride numeric="732103" spn_display_rule="SPN_RULE_SHOW_SPN" fake_home_on="732103,732111"/>
|
||||
<spnOverride numeric="732111" spn_display_rule="SPN_RULE_SHOW_SPN" fake_home_on="732103,732111"/>
|
||||
<spnOverride numeric="73401" spn_display_rule="SPN_RULE_SHOW_SPN" fake_home_on="73401,73402,73403"/>
|
||||
<spnOverride numeric="73402" spn_display_rule="SPN_RULE_SHOW_SPN" fake_home_on="73401,73402,73403"/>
|
||||
<spnOverride numeric="73403" spn_display_rule="SPN_RULE_SHOW_SPN" fake_home_on="73401,73402,73403"/>
|
||||
|
||||
<spnOverride numeric="338050" spn_display_rule="SPN_RULE_SHOW_SPN" fake_home_on="33805,338050"/>
|
||||
<spnOverride numeric="33805" spn_display_rule="SPN_RULE_SHOW_SPN" fake_home_on="33805,338050"/>
|
||||
<spnOverride numeric="73007" spn_display_rule="SPN_RULE_SHOW_SPN" fake_home_on="73002"/>
|
||||
|
||||
<!-- South Africa -->
|
||||
<spnOverride numeric="65507" imsi_subset="10" spn_display_rule="SPN_RULE_SHOW_SPN" spn="Virgin" spn_override_only_on="655"/> <!-- Virgin is roaming on 'Cell C' network (same mcc-mnc) and this display rule for home country -->
|
||||
<spnOverride numeric="65507" spn_display_rule="SPN_RULE_SHOW_SPN" spn="Cell C"/>
|
||||
<spnOverride numeric="65502" spn_display_rule="SPN_RULE_SHOW_SPN" spn="8.ta"/>
|
||||
|
||||
<!-- H3G RM#2022-->
|
||||
<spnOverride numeric="23420" spn_display_rule="SPN_RULE_SHOW_PLMN" spn_override_only_on="23420,23433"/>
|
||||
|
||||
<!-- TDC Sweden -->
|
||||
<spnOverride numeric="23801" imsi_subset="72" fake_home_on="24005,24007" fake_roaming_on="23801" />
|
||||
<spnOverride numeric="24014" imsi_subset="72" fake_home_on="24005,24007" fake_roaming_on="23801" />
|
||||
|
||||
<spnOverride numeric="24004" spn_display_rule="SPN_RULE_SHOW_SPN" fake_home_on="24008,24024"/>
|
||||
<spnOverride numeric="24008" spn_display_rule="SPN_RULE_SHOW_SPN" fake_home_on="24004,24024"/>
|
||||
<spnOverride numeric="24024" spn_display_rule="SPN_RULE_SHOW_SPN" fake_home_on="24004,24008"/>
|
||||
|
||||
<!-- TDC Norway -->
|
||||
<spnOverride numeric="23801" imsi_subset="71" fake_home_on="24201" fake_roaming_on="23801" />
|
||||
<spnOverride numeric="24208" imsi_subset="71" fake_home_on="24201" fake_roaming_on="23801" />
|
||||
|
||||
<!-- TDC Finland -->
|
||||
<spnOverride numeric="24412" imsi_subset="2400" fake_home_on="24412" fake_roaming_on="23801" />
|
||||
<spnOverride numeric="23801" imsi_subset="7300" fake_home_on="24412" fake_roaming_on="23801" />
|
||||
<spnOverride numeric="23211" fake_home_on="23201"/> <!-- bob @ A1 network -->
|
||||
<spnOverride numeric="23212" fake_home_on="23205"/> <!-- yesss! @ Orange AT -->
|
||||
<spnOverride numeric="23207" fake_home_on="23203"/> <!-- tele.ring @ T-Mobile A -->
|
||||
<spnOverride numeric="23207" fake_home_on="23203"/> <!-- tele.ring @ T-Mobile A -->
|
||||
<spnOverride numeric="23430,23431,23432" fake_home_on="23433,23434"/> <!-- T-Mobile @ Orange Network -->
|
||||
<spnOverride numeric="23433,23434" fake_home_on="23430,23431,23432"/> <!-- Orange Network @ T-Mobile -->
|
||||
|
||||
<!-- South Africa -->
|
||||
<spnOverride numeric="65507" spn_display_rule="SPN_RULE_SHOW_SPN" spn="Cell C"/>
|
||||
<spnOverride numeric="65502" spn_display_rule="SPN_RULE_SHOW_SPN" spn="8.ta"/>
|
||||
|
||||
<!-- Everything Everywhere -->
|
||||
<spnOverride numeric="23430" spn_display_rule="SPN_RULE_SHOW_PLMN" spn_override_only_on="23430,23431,23432,23433,23434,23486"/>
|
||||
<spnOverride numeric="23431" spn_display_rule="SPN_RULE_SHOW_PLMN" spn_override_only_on="23430,23431,23432,23433,23434,23486"/>
|
||||
<spnOverride numeric="23432" spn_display_rule="SPN_RULE_SHOW_PLMN" spn_override_only_on="23430,23431,23432,23433,23434,23486"/>
|
||||
<spnOverride numeric="23433" spn_display_rule="SPN_RULE_SHOW_PLMN" spn_override_only_on="23430,23431,23432,23433,23434,23486"/>
|
||||
<spnOverride numeric="23434" spn_display_rule="SPN_RULE_SHOW_PLMN" spn_override_only_on="23430,23431,23432,23433,23434,23486"/>
|
||||
<spnOverride numeric="23486" spn_display_rule="SPN_RULE_SHOW_PLMN" spn_override_only_on="23430,23431,23432,23433,23434,23486"/>
|
||||
|
||||
</spnOverrides>
|
22
configs/vold.fstab
Normal file
@ -0,0 +1,22 @@
|
||||
## Vold 2.0 Generic fstab
|
||||
## - 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
|
||||
######################
|
||||
|
||||
# internal sdcard
|
||||
dev_mount sdcard0 /storage/sdcard0 11 /devices/platform/dw_mmc/mmc_host/mmc0/mmc0 nonremovable,encryptable
|
||||
|
||||
# external sdcard
|
||||
dev_mount sdcard1 /storage/sdcard1 auto /devices/platform/s3c-sdhci.2/mmc_host/mmc1
|
||||
|
||||
# USB storage device
|
||||
dev_mount usbdisk0 /storage/usbdisk0 auto /devices/platform/s3c_otghcd/usb
|
9
configs/wpa_supplicant.conf
Normal file
@ -0,0 +1,9 @@
|
||||
update_config=1
|
||||
ctrl_interface=wlan0
|
||||
eapol_version=1
|
||||
ap_scan=1
|
||||
fast_reauth=1
|
||||
p2p_listen_reg_class=81
|
||||
p2p_listen_channel=1
|
||||
p2p_oper_reg_class=115
|
||||
p2p_oper_channel=48
|
21
gpswrapper/Android.mk
Executable file
@ -0,0 +1,21 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
LOCAL_MODULE := gps.$(TARGET_BOARD_PLATFORM)
|
||||
|
||||
LOCAL_SHARED_LIBRARIES:= \
|
||||
liblog \
|
||||
libdl
|
||||
|
||||
LOCAL_SRC_FILES += \
|
||||
gps.c
|
||||
|
||||
LOCAL_CFLAGS += \
|
||||
-fno-short-enums
|
||||
|
||||
LOCAL_PRELINK_MODULE := false
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
0
gpswrapper/MODULE_LICENSE_APACHE2
Normal file
203
gpswrapper/gps.c
Normal file
@ -0,0 +1,203 @@
|
||||
/******************************************************************************
|
||||
* GPS HAL wrapper
|
||||
* wrapps around Samsung GPS Libary and replaces a faulty pointer to
|
||||
* a faulty function from Samsung that will cause the system_server
|
||||
* to crash.
|
||||
*
|
||||
* Copyright 2010 - Kolja Dummann
|
||||
*
|
||||
* 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 <hardware/hardware.h>
|
||||
#include <hardware/gps.h>
|
||||
#include <errno.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
//#define ALOG_NDEBUG 0
|
||||
|
||||
#include <stdlib.h>
|
||||
#define ALOG_TAG "gps-wrapper"
|
||||
#include <utils/Log.h>
|
||||
|
||||
#define ORIGINAL_HAL_PATH "/system/lib/hw/vendor-gps.exynos4.so"
|
||||
|
||||
static const AGpsRilInterface* oldAGPSRIL = NULL;
|
||||
static AGpsRilInterface newAGPSRIL;
|
||||
|
||||
static const GpsInterface* originalGpsInterface = NULL;
|
||||
static GpsInterface newGpsInterface;
|
||||
|
||||
/**
|
||||
* Load the file defined by the variant and if successful
|
||||
* return the dlopen handle and the hmi.
|
||||
* @return 0 = success, !0 = failure.
|
||||
*/
|
||||
static int load(const char *id,
|
||||
const char *path,
|
||||
const struct hw_module_t **pHmi)
|
||||
{
|
||||
int status;
|
||||
void *handle;
|
||||
struct hw_module_t *hmi;
|
||||
|
||||
/*
|
||||
* load the symbols resolving undefined symbols before
|
||||
* dlopen returns. Since RTLD_GLOBAL is not or'd in with
|
||||
* RTLD_NOW the external symbols will not be global
|
||||
*/
|
||||
handle = dlopen(path, RTLD_NOW);
|
||||
if (handle == NULL) {
|
||||
char const *err_str = dlerror();
|
||||
ALOGE("load: module=%s\n%s", path, err_str?err_str:"unknown");
|
||||
status = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Get the address of the struct hal_module_info. */
|
||||
const char *sym = HAL_MODULE_INFO_SYM_AS_STR;
|
||||
hmi = (struct hw_module_t *)dlsym(handle, sym);
|
||||
if (hmi == NULL) {
|
||||
ALOGE("load: couldn't find symbol %s", sym);
|
||||
status = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Check that the id matches */
|
||||
if (strcmp(id, hmi->id) != 0) {
|
||||
ALOGE("load: id=%s != hmi->id=%s", id, hmi->id);
|
||||
status = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
hmi->dso = handle;
|
||||
|
||||
/* success */
|
||||
status = 0;
|
||||
|
||||
done:
|
||||
if (status != 0) {
|
||||
hmi = NULL;
|
||||
if (handle != NULL) {
|
||||
dlclose(handle);
|
||||
handle = NULL;
|
||||
}
|
||||
} else {
|
||||
ALOGV("loaded HAL id=%s path=%s hmi=%p handle=%p",
|
||||
id, path, *pHmi, handle);
|
||||
}
|
||||
|
||||
*pHmi = hmi;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static void update_network_state_wrapper(int connected, int type, int roaming, const char* extra_info)
|
||||
{
|
||||
ALOGI("%s was called and saved your from a faulty implementation ;-)", __func__);
|
||||
}
|
||||
|
||||
static const void* wrapper_get_extension(const char* name)
|
||||
{
|
||||
ALOGV("%s was called", __func__);
|
||||
|
||||
if (!strcmp(name, AGPS_RIL_INTERFACE) && (oldAGPSRIL = originalGpsInterface->get_extension(name)))
|
||||
{
|
||||
ALOGV("%s AGPS_RIL_INTERFACE extension requested", __func__);
|
||||
/* use a wrapper to avoid calling samsungs faulty implemetation */
|
||||
newAGPSRIL.size = sizeof(AGpsRilInterface);
|
||||
newAGPSRIL.init = oldAGPSRIL->init;
|
||||
newAGPSRIL.set_ref_location = oldAGPSRIL->set_ref_location;
|
||||
newAGPSRIL.set_set_id = oldAGPSRIL->set_set_id;
|
||||
newAGPSRIL.ni_message = oldAGPSRIL->ni_message;
|
||||
ALOGV("%s setting update_network_state_wrapper", __func__);
|
||||
newAGPSRIL.update_network_state = update_network_state_wrapper;
|
||||
return &newAGPSRIL;
|
||||
}
|
||||
return originalGpsInterface->get_extension(name);
|
||||
}
|
||||
|
||||
/* HAL Methods */
|
||||
const GpsInterface* gps_get_gps_interface(struct gps_device_t* dev)
|
||||
{
|
||||
hw_module_t* module;
|
||||
int err;
|
||||
|
||||
ALOGV("%s was called", __func__);
|
||||
|
||||
err = load(GPS_HARDWARE_MODULE_ID, ORIGINAL_HAL_PATH, (hw_module_t const**)&module);
|
||||
|
||||
if (err == 0) {
|
||||
ALOGV("%s vendor lib loaded", __func__);
|
||||
hw_device_t* device;
|
||||
struct gps_device_t *gps_device;
|
||||
err = module->methods->open(module, GPS_HARDWARE_MODULE_ID, &device);
|
||||
if (err == 0) {
|
||||
ALOGV("%s got gps device", __func__);
|
||||
gps_device = (struct gps_device_t *)device;
|
||||
originalGpsInterface = gps_device->get_gps_interface(gps_device);
|
||||
ALOGV("%s device set", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
if(originalGpsInterface)
|
||||
{
|
||||
ALOGV("%s exposing callbacks", __func__);
|
||||
newGpsInterface.size = sizeof(GpsInterface);
|
||||
newGpsInterface.init = originalGpsInterface->init;
|
||||
newGpsInterface.start = originalGpsInterface->start;
|
||||
newGpsInterface.stop = originalGpsInterface->stop;
|
||||
newGpsInterface.cleanup = originalGpsInterface->cleanup;
|
||||
newGpsInterface.inject_time = originalGpsInterface->inject_time;
|
||||
newGpsInterface.inject_location = originalGpsInterface->inject_location;
|
||||
newGpsInterface.delete_aiding_data = originalGpsInterface->delete_aiding_data;
|
||||
newGpsInterface.set_position_mode = originalGpsInterface->set_position_mode;
|
||||
ALOGV("%s setting extension wrapper", __func__);
|
||||
newGpsInterface.get_extension = wrapper_get_extension;
|
||||
|
||||
}
|
||||
ALOGV("%s done", __func__);
|
||||
return &newGpsInterface;
|
||||
}
|
||||
|
||||
static int open_gps(const struct hw_module_t* module, char const* name,
|
||||
struct hw_device_t** device)
|
||||
{
|
||||
struct gps_device_t *dev = malloc(sizeof(struct gps_device_t));
|
||||
memset(dev, 0, sizeof(*dev));
|
||||
|
||||
ALOGV("%s was called", __func__);
|
||||
|
||||
dev->common.tag = HARDWARE_DEVICE_TAG;
|
||||
dev->common.version = 0;
|
||||
dev->common.module = (struct hw_module_t*)module;
|
||||
dev->get_gps_interface = gps_get_gps_interface;
|
||||
|
||||
*device = (struct hw_device_t*)dev;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct hw_module_methods_t gps_module_methods = {
|
||||
.open = open_gps
|
||||
};
|
||||
|
||||
const struct hw_module_t HAL_MODULE_INFO_SYM = {
|
||||
.tag = HARDWARE_MODULE_TAG,
|
||||
.version_major = 1,
|
||||
.version_minor = 0,
|
||||
.id = GPS_HARDWARE_MODULE_ID,
|
||||
.name = "GPS HAL Wrapper Module",
|
||||
.author = "Kolja Dummann",
|
||||
.methods = &gps_module_methods,
|
||||
};
|
415
init.smdk4210.rc
Normal file
@ -0,0 +1,415 @@
|
||||
import init.smdk4210.usb.rc
|
||||
|
||||
on early-init
|
||||
export EXTERNAL_STORAGE /storage/sdcard0
|
||||
export SECONDARY_STORAGE /storage/sdcard1
|
||||
mkdir /storage 0775 system system
|
||||
mkdir /storage/sdcard0 0775 system system
|
||||
mkdir /storage/sdcard1 0775 system system
|
||||
mkdir /storage/usbdisk0 0775 system system
|
||||
mkdir /efs 0771 radio system
|
||||
mkdir /preload 0771 system system
|
||||
mkdir /mnt/.lfs 0755 root root
|
||||
|
||||
# for backwards compatibility
|
||||
symlink /storage/sdcard0 /sdcard
|
||||
symlink /storage/sdcard0 /mnt/sdcard
|
||||
symlink /storage/sdcard1 /extSdCard
|
||||
symlink /storage/sdcard1 /mnt/extSdCard
|
||||
symlink /storage/usbdisk0 /usbdisk0
|
||||
symlink /storage/usbdisk0 /mnt/usbdisk0
|
||||
|
||||
# Disable CFQ slice idle delay
|
||||
write /sys/block/mmcblk0/queue/iosched/slice_idle 0
|
||||
|
||||
# FIXME: permissions for tvout
|
||||
chmod 0777 /dev/graphics/fb0
|
||||
chmod 0777 /dev/graphics/fb10
|
||||
chmod 0777 /dev/graphics/fb11
|
||||
chown media graphics /sys/class/switch/hdmi
|
||||
chmod 0777 /sys/class/switch/hdmi
|
||||
|
||||
# FIXME: permission for HDMI audio path
|
||||
chown media audio /sys/class/hdmi_audio/hdmi_audio/hdmi_audio_set_ext
|
||||
chmod 0777 /sys/class/hdmi_audio/hdmi_audio/hdmi_audio_set_ext
|
||||
|
||||
on fs
|
||||
# mount ext4 partitions
|
||||
mount ext4 /dev/block/mmcblk0p9 /system noatime wait ro
|
||||
mount ext4 /dev/block/mmcblk0p7 /cache nosuid nodev noatime wait
|
||||
mount ext4 /dev/block/mmcblk0p10 /data nosuid nodev noatime wait noauto_da_alloc
|
||||
mount ext4 /dev/block/mmcblk0p12 /preload nosuid nodev noatime wait
|
||||
|
||||
mount ext4 /dev/block/mmcblk0p1 /efs nosuid nodev noatime wait
|
||||
mkdir /efs/bluetooth
|
||||
mkdir /efs/wifi
|
||||
chown radio system /efs/bluetooth
|
||||
chown radio system /efs/wifi
|
||||
chmod 0775 /efs/bluetooth
|
||||
chmod 0775 /efs/wifi
|
||||
|
||||
mkdir /data/misc/vpn/profiles 0770 system system
|
||||
mkdir /data/misc/radio 0775 radio system
|
||||
chmod 0770 /data/misc/wifi
|
||||
|
||||
on post-fs-data
|
||||
# insmod kernel modules
|
||||
insmod /system/lib/modules/j4fs.ko
|
||||
insmod /system/lib/modules/Si4709_driver.ko
|
||||
|
||||
# mount param.lfs
|
||||
mount j4fs /dev/block/mmcblk0p4 /mnt/.lfs
|
||||
|
||||
# MDNS
|
||||
socket mdns stream 0660 root system
|
||||
|
||||
# GPS
|
||||
chown root system /dev/ttySAC1
|
||||
chmod 0660 /dev/ttySAC1
|
||||
chown root system /sys/class/sec/gps/GPS_PWR_EN/value
|
||||
chmod 0664 /sys/class/sec/gps/GPS_PWR_EN/value
|
||||
chown root system /sys/class/sec/gps/GPS_nRST/value
|
||||
chmod 0664 /sys/class/sec/gps/GPS_nRST/value
|
||||
mkdir /data/gps 771 system system
|
||||
chown system system /data/gps
|
||||
|
||||
# give system access to wpa_supplicant.conf for backup and restore
|
||||
mkdir /data/misc/wifi 0770 wifi wifi
|
||||
chmod 0770 /data/misc/wifi
|
||||
chmod 0660 /data/misc/wifi/wpa_supplicant.conf
|
||||
mkdir /data/misc/wifi/sockets 0770 wifi wifi
|
||||
mkdir /data/misc/dhcp 0770 dhcp dhcp
|
||||
chown dhcp dhcp /data/misc/dhcp
|
||||
|
||||
#DRM directory creation
|
||||
mkdir /system/etc/security/.drm 0775
|
||||
chown root root /system/etc/security/.drm
|
||||
chmod 0775 /system/etc/security/.drm
|
||||
|
||||
# Added for Playready DRM Support
|
||||
mkdir /data/data/.drm 0775
|
||||
chown drm system /data/data/.drm
|
||||
chmod 0775 /data/data/.drm
|
||||
mkdir /data/data/.drm/.playready 0775
|
||||
chown drm system /data/data/.drm/.playready
|
||||
chmod 0775 /data/data/.drm/.playready
|
||||
|
||||
#Added drm folder to copy drm plugins
|
||||
mkdir /system/lib/drm 0775
|
||||
chown root root /system/lib/drm
|
||||
chmod 0775 /system/lib/drm
|
||||
|
||||
# DivX DRM
|
||||
mkdir /efs/.files 0775
|
||||
mkdir /efs/.files/.dx1 0775
|
||||
mkdir /efs/.files/.dm33 0775
|
||||
mkdir /efs/.files/.mp301 0775
|
||||
chown media system /efs/.files/.dx1
|
||||
chown media system /efs/.files/.dm33
|
||||
chown media system /efs/.files/.mp301
|
||||
chmod 0775 /efs/.files/.dx1
|
||||
chmod 0775 /efs/.files/.dm33
|
||||
chmod 0775 /efs/.files/.mp301
|
||||
|
||||
# MTP Device permission.
|
||||
chmod 0660 /dev/usb_mtp_gadget
|
||||
chown system system /dev/usb_mtp_gadget
|
||||
|
||||
# terminal mode
|
||||
chmod 0660 /sys/class/android_usb/android0/terminal_version
|
||||
chown system system /sys/class/android_usb/android0/terminal_version
|
||||
|
||||
# NFC
|
||||
setprop ro.nfc.port "I2C"
|
||||
chmod 0600 /dev/pn544
|
||||
chown nfc nfc /dev/pn544
|
||||
|
||||
# setup for alsa snd device
|
||||
chmod 0770 /dev/snd/pcmC0D0c
|
||||
chmod 0770 /dev/snd/pcmC0D0p
|
||||
chmod 0770 /dev/snd/controlC0
|
||||
chmod 0770 /dev/snd/timer
|
||||
chmod 0770 /dev/snd/hwC0D0
|
||||
|
||||
# create log system
|
||||
mkdir /data/log 0775 system log
|
||||
chown system log /data/log
|
||||
|
||||
chmod 0775 /data/log
|
||||
chmod 0775 /data/anr
|
||||
|
||||
chmod 0662 /dev/log/radio
|
||||
chmod 0662 /dev/log/main
|
||||
chmod 0662 /dev/log/event
|
||||
|
||||
#panorama directory creation
|
||||
mkdir /data/pxtmpdir 0775
|
||||
chown system system /data/pxtmpdir
|
||||
chmod 0775 /data/pxtmpdir
|
||||
|
||||
# permission for HDMI audio path
|
||||
chown media audio /sys/class/hdmi_audio/hdmi_audio/hdmi_audio_set_ext
|
||||
|
||||
# Permissions for gpio_keys.
|
||||
chown system radio /sys/class/sec/sec_key/wakeup_keys
|
||||
write /sys/class/sec/sec_key/wakeup_keys 102,116
|
||||
|
||||
# Add permission for ATM. 2010.03.20
|
||||
chown system radio /sys/devices/platform/i2c-gpio.9/i2c-9/9-0036/power_supply/fuelgauge/fg_read_soc
|
||||
chown system radio /sys/devices/platform/i2c-gpio.9/i2c-9/9-0036/power_supply/fuelgauge/fg_reset_soc
|
||||
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/batt_lpm_state
|
||||
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/fg_psoc
|
||||
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/system_rev
|
||||
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/batt_current_adc
|
||||
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/batt_test_value
|
||||
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/batt_temp_adc_spec
|
||||
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/batt_temp_check
|
||||
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/batt_full_check
|
||||
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/batt_type
|
||||
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/mp3
|
||||
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/video
|
||||
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/batt_lp_charging
|
||||
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/charging_source
|
||||
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/batt_temp_adc_avg
|
||||
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/batt_temp_adc
|
||||
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/batt_temp
|
||||
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/batt_vfocv
|
||||
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/batt_soc
|
||||
chown system radio /sys/devices/platform/sec-battery/power_supply/battery/batt_vol
|
||||
|
||||
chown system system /sys/class/backlight/panel/brightness
|
||||
chown system system /sys/class/power_supply/battery/temp
|
||||
|
||||
# Permissions for input devices
|
||||
chown system radio /sys/devices/virtual/sec/sec_key/sec_key_pressed
|
||||
|
||||
chown system radio /sys/devices/virtual/sec/sec_touchkey/force_disable
|
||||
chown system radio /sys/devices/virtual/sec/sec_touchkey/recommended_version
|
||||
chown system radio /sys/devices/virtual/sec/sec_touchkey/touch_sensitivity
|
||||
chown system radio /sys/devices/virtual/sec/sec_touchkey/brightness
|
||||
chown system radio /sys/devices/virtual/sec/sec_touchkey/touchkey_brightness
|
||||
chown system radio /sys/devices/virtual/sec/sec_touchkey/touchkey_back
|
||||
chown system radio /sys/devices/virtual/sec/sec_touchkey/touchkey_menu
|
||||
chown system radio /sys/devices/virtual/sec/sec_touchkey/touchkey_firm_version_panel
|
||||
chown system radio /sys/devices/virtual/sec/sec_touchkey/touchkey_firm_version_phone
|
||||
chown system radio /sys/devices/virtual/sec/sec_touchkey/touchkey_firm_update_status
|
||||
chown system radio /sys/devices/virtual/sec/sec_touchkey/touchkey_firm_update
|
||||
chown system radio /sys/devices/virtual/sec/sec_touchkey/updated_version
|
||||
chown system radio /sys/devices/virtual/sec/sec_touchkey/led_timeout
|
||||
|
||||
chown system radio /sys/devices/virtual/sec/tsp_noise_test/set_firm_version
|
||||
chown system radio /sys/devices/virtual/sec/tsp_noise_test/set_threshould
|
||||
chown system radio /sys/devices/virtual/sec/tsp_noise_test/set_all_delta
|
||||
chown system radio /sys/devices/virtual/sec/tsp_noise_test/set_all_refer
|
||||
chown system radio /sys/devices/virtual/sec/tsp_noise_test/set_delta4
|
||||
chown system radio /sys/devices/virtual/sec/tsp_noise_test/set_refer4
|
||||
chown system radio /sys/devices/virtual/sec/tsp_noise_test/set_delta3
|
||||
chown system radio /sys/devices/virtual/sec/tsp_noise_test/set_refer3
|
||||
chown system radio /sys/devices/virtual/sec/tsp_noise_test/set_delta2
|
||||
chown system radio /sys/devices/virtual/sec/tsp_noise_test/set_refer2
|
||||
chown system radio /sys/devices/virtual/sec/tsp_noise_test/set_delta1
|
||||
chown system radio /sys/devices/virtual/sec/tsp_noise_test/set_refer1
|
||||
chown system radio /sys/devices/virtual/sec/tsp_noise_test/set_delta0
|
||||
chown system radio /sys/devices/virtual/sec/tsp_noise_test/set_refer0
|
||||
chown system radio /sys/devices/virtual/sec/tsp_noise_test/disp_all_deltadata
|
||||
chown system radio /sys/devices/virtual/sec/tsp_noise_test/disp_all_refdata
|
||||
chown system radio /sys/devices/virtual/sec/tsp_noise_test/set_module_off
|
||||
chown system radio /sys/devices/virtual/sec/tsp_noise_test/set_module_on
|
||||
|
||||
chown system radio /sys/devices/virtual/sec/sec_touchscreen/tsp_firm_version_panel
|
||||
chown system radio /sys/devices/virtual/sec/sec_touchscreen/tsp_firm_version_phone
|
||||
chown system radio /sys/devices/virtual/sec/sec_touchscreen/tsp_firm_update_status
|
||||
chown system radio /sys/devices/virtual/sec/sec_touchscreen/tsp_firm_update
|
||||
chown system radio /sys/devices/virtual/sec/sec_touchscreen/tsp_threshold
|
||||
chown system radio /sys/devices/virtual/sec/sec_touchscreen/tsp_config_version
|
||||
chown system radio /sys/devices/virtual/sec/sec_touchscreen/tsp_touchtype
|
||||
|
||||
# Permissions for bluetooth
|
||||
setprop ro.bt.bdaddr_path "/efs/bluetooth/bt_addr"
|
||||
chown bluetooth bluetooth ro.bt.bdaddr_path
|
||||
chown bluetooth bluetooth /dev/ttySAC0
|
||||
chmod 0600 /dev/ttySAC0
|
||||
chmod 0660 /sys/class/rfkill/rfkill0/state
|
||||
chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
|
||||
chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type
|
||||
|
||||
# Vibetonz
|
||||
chmod 0660 /dev/tspdrv
|
||||
chown root shell /dev/tspdrv
|
||||
chmod 0660 /sys/vibrator/pwm_val
|
||||
chown system system /sys/vibrator/pwm_val
|
||||
|
||||
# Permissions for LCD
|
||||
chown system radio /sys/class/lcd/panel/lcd_power
|
||||
chown system radio /sys/class/lcd/panel/lcd_type
|
||||
chown system media_rw /sys/class/lcd/panel/gamma_mode
|
||||
chown system media_rw /sys/class/lcd/panel/power_reduce
|
||||
chown system system /sys/class/backlight/panel/auto_brightness
|
||||
|
||||
# Permissions for mDNIe
|
||||
chown system media_rw /sys/class/mdnie/mdnie/mode
|
||||
chown system media_rw /sys/class/mdnie/mdnie/outdoor
|
||||
chown system media_rw /sys/class/mdnie/mdnie/scenario
|
||||
chown system media_rw /sys/class/mdnie/mdnie/negative
|
||||
write /sys/class/mdnie/mdnie/scenario 4
|
||||
|
||||
# Permissions for uart_sel and usb_sel
|
||||
chown system radio /sys/class/sec/switch/uart_sel/value
|
||||
chown system radio /sys/class/sec/switch/usb_sel
|
||||
chown system radio /sys/class/sec/switch/audio_path
|
||||
chown system radio /sys/class/sec/switch/otg_test
|
||||
chown system radio /sys/class/sec/switch/adc_debounce_time
|
||||
chown system radio /sys/class/sec/switch/status
|
||||
chown system radio /sys/class/sec/switch/adc
|
||||
chown system radio /mnt/.lfs/sw_sel
|
||||
|
||||
# Permissions for OTG Test
|
||||
chown system radio /sys/class/host_notify/usb_otg/booster
|
||||
chmod 0664 /sys/class/host_notify/usb_otg/booster
|
||||
|
||||
# Permission for radio
|
||||
chown system radio /sys/devices/platform/s5p-ehci/ehci_power
|
||||
chown system radio /sys/devices/platform/s5p-ehci/ehci_runtime
|
||||
chown system radio /sys/devices/virtual/misc/multipdp/waketime
|
||||
|
||||
# for datarouter
|
||||
chown system system /dev/dun
|
||||
chown system system /dev/ttyGS0
|
||||
chown system system /dev/ttyGS1
|
||||
chown system system /dev/ttyGS2
|
||||
chown system system /dev/ttyGS3
|
||||
|
||||
# DVFS - cpufreq ondemand
|
||||
write /sys/devices/system/cpu/cpufreq/ondemand/down_differential 5
|
||||
write /sys/devices/system/cpu/cpufreq/ondemand/up_threshold 85
|
||||
|
||||
#panorama directory creation
|
||||
mkdir /data/pxtmpdir 0775
|
||||
chown system system /data/pxtmpdir
|
||||
chmod 0775 /data/pxtmpdir
|
||||
|
||||
# backlight permissions
|
||||
chown system system /sys/class/backlight/pwm-backlight/brightness
|
||||
chmod 0660 /sys/class/backlight/pwm-backlight/brightness
|
||||
chown radio system /sys/devices/virtual/misc/melfas_touchkey/brightness
|
||||
chmod 0660 /sys/devices/virtual/misc/melfas_touchkey/brightness
|
||||
|
||||
# Permissions for dvfs lock
|
||||
chown system system /sys/power/cpufreq_max_limit
|
||||
chown system system /sys/power/cpufreq_min_limit
|
||||
chmod 0660 /sys/power/cpufreq_max_limit
|
||||
chmod 0660 /sys/power/cpufreq_min_limit
|
||||
|
||||
chown system system /sys/power/gpu_lock
|
||||
chmod 0660 /sys/power/gpu_lock
|
||||
|
||||
# Permisions for sensors
|
||||
chown radio system /sys/devices/virtual/K3G_GYRO-dev/k3g/gyro_selftest
|
||||
chown radio system /sys/devices/virtual/K3G_GYRO-dev/k3g/gyro_get_temp
|
||||
chown radio system /sys/devices/virtual/K3G_GYRO-dev/k3g/gyro_power_on
|
||||
chown radio system /sys/devices/virtual/accelerometer/accelerometer/acc_file
|
||||
chown radio system /sys/devices/virtual/sec/gsensorcal/calibration
|
||||
|
||||
# for device encryption
|
||||
setprop vold.post_fs_data_done 1
|
||||
|
||||
on boot
|
||||
mount debugfs /sys/kernel/debug /sys/kernel/debug
|
||||
|
||||
setprop ro.build.product GT-I9100
|
||||
setprop ro.product.device GT-I9100
|
||||
setprop ro.radio.noril yes
|
||||
|
||||
# permissions for NFC
|
||||
setprop ro.nfc.port "I2C"
|
||||
chmod 0600 /dev/pn544
|
||||
chown nfc nfc /dev/pn544
|
||||
|
||||
# Device Encryption by B2B Security Lab.
|
||||
setprop ro.crypto.keyfile.userdata /efs/metadata
|
||||
|
||||
# fake some battery state
|
||||
setprop status.battery.state Slow
|
||||
setprop status.battery.level 5
|
||||
setprop status.battery.level_raw 50
|
||||
setprop status.battery.level_scale 9
|
||||
|
||||
service mdnsd /system/bin/mdnsd
|
||||
class main
|
||||
user mdnsr
|
||||
group inet net_raw
|
||||
socket mdnsd stream 0660 mdnsr inet
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service p2p_supplicant /system/bin/wpa_supplicant \
|
||||
-Dnl80211 -iwlan0 -puse_p2p_group_interface=1 -c/data/misc/wifi/wpa_supplicant.conf -e/data/misc/wifi/entropy.bin
|
||||
# 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
|
||||
class main
|
||||
socket wpa_wlan0 dgram 660 wifi wifi
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service wpa_supplicant /system/bin/wpa_supplicant \
|
||||
-Dnl80211 -iwlan0 -puse_p2p_group_interface=1 -c/data/misc/wifi/wpa_supplicant.conf -e/data/misc/wifi/entropy.bin
|
||||
# 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
|
||||
class main
|
||||
socket wpa_wlan0 dgram 660 wifi wifi
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service dhcpcd_wlan0 /system/bin/dhcpcd -ABKL
|
||||
class main
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service dhcpcd_p2p /system/bin/dhcpcd -aABKL
|
||||
class main
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service iprenew_wlan0 /system/bin/dhcpcd -n
|
||||
class main
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service iprenew_p2p /system/bin/dhcpcd -n
|
||||
class main
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
# for bluetooth
|
||||
service hciattach /system/bin/brcm_patchram_plus --enable_hci --enable_lpm --no2bytes --tosleep 50000 \
|
||||
--baudrate 3000000 --use_baudrate_for_download --patchram /system/bin/bcm4330B1.hcd \
|
||||
--scopcm=0,0,0,0,0,0,0,3,3,0 /dev/ttySAC0
|
||||
class main
|
||||
user bluetooth
|
||||
group bluetooth net_bt_admin
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
# bluetooth mac address
|
||||
service bdaddr /system/bin/bdaddr_read
|
||||
class main
|
||||
user root
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
# TVout
|
||||
service TvoutService_C /system/bin/bintvoutservice
|
||||
class main
|
||||
user system
|
||||
group graphics
|
||||
|
||||
# bugreport is triggered by holding down volume down, volume up and power
|
||||
service bugreport /system/bin/bugmailer.sh -v
|
||||
class main
|
||||
disabled
|
||||
oneshot
|
||||
keycodes 114 115 116
|
89
init.smdk4210.usb.rc
Normal file
@ -0,0 +1,89 @@
|
||||
on init
|
||||
write /sys/class/android_usb/android0/iSerial $ro.serialno
|
||||
write /sys/class/android_usb/android0/f_rndis/manufacturer Samsung
|
||||
write /sys/class/android_usb/android0/f_rndis/vendorID 04e8
|
||||
write /sys/class/android_usb/android0/f_rndis/wceis 1
|
||||
|
||||
on boot
|
||||
write /sys/class/android_usb/android0/iManufacturer $ro.manufacturer
|
||||
write /sys/class/android_usb/android0/iProduct $ro.model
|
||||
write /sys/class/android_usb/android0/iSerial $ro.serialno
|
||||
write /sys/class/android_usb/f_mass_storage/inquiry_string "Samsung"
|
||||
|
||||
on property:sys.usb.config=mtp
|
||||
write /sys/class/android_usb/android0/enable 0
|
||||
write /sys/class/android_usb/android0/idVendor 04e8
|
||||
write /sys/class/android_usb/android0/idProduct 6860
|
||||
write /sys/class/android_usb/android0/functions $sys.usb.config
|
||||
write /sys/class/android_usb/android0/enable 1
|
||||
setprop sys.usb.state $sys.usb.config
|
||||
|
||||
on property:sys.usb.config=mtp,adb
|
||||
write /sys/class/android_usb/android0/enable 0
|
||||
write /sys/class/android_usb/android0/idVendor 04e8
|
||||
write /sys/class/android_usb/android0/idProduct 6860
|
||||
write /sys/class/android_usb/android0/functions $sys.usb.config
|
||||
write /sys/class/android_usb/android0/enable 1
|
||||
start adbd
|
||||
setprop sys.usb.state $sys.usb.config
|
||||
|
||||
on property:sys.usb.config=rndis
|
||||
write /sys/class/android_usb/android0/enable 0
|
||||
write /sys/class/android_usb/android0/idVendor 04e8
|
||||
write /sys/class/android_usb/android0/idProduct 6863
|
||||
write /sys/class/android_usb/android0/functions $sys.usb.config
|
||||
write /sys/class/android_usb/android0/bDeviceClass 224
|
||||
write /sys/class/android_usb/android0/enable 1
|
||||
setprop sys.usb.state $sys.usb.config
|
||||
|
||||
on property:sys.usb.config=rndis,adb
|
||||
write /sys/class/android_usb/android0/enable 0
|
||||
write /sys/class/android_usb/android0/idVendor 04e8
|
||||
write /sys/class/android_usb/android0/idProduct 6864
|
||||
write /sys/class/android_usb/android0/functions $sys.usb.config
|
||||
write /sys/class/android_usb/android0/bDeviceClass 224
|
||||
write /sys/class/android_usb/android0/enable 1
|
||||
start adbd
|
||||
setprop sys.usb.state $sys.usb.config
|
||||
|
||||
on property:sys.usb.config=ptp
|
||||
write /sys/class/android_usb/android0/enable 0
|
||||
write /sys/class/android_usb/android0/idVendor 04e8
|
||||
write /sys/class/android_usb/android0/idProduct 6865
|
||||
write /sys/class/android_usb/android0/functions $sys.usb.config
|
||||
write /sys/class/android_usb/android0/enable 1
|
||||
setprop sys.usb.state $sys.usb.config
|
||||
|
||||
on property:sys.usb.config=ptp,adb
|
||||
write /sys/class/android_usb/android0/enable 0
|
||||
write /sys/class/android_usb/android0/idVendor 04e8
|
||||
write /sys/class/android_usb/android0/idProduct 6866
|
||||
write /sys/class/android_usb/android0/functions $sys.usb.config
|
||||
write /sys/class/android_usb/android0/enable 1
|
||||
start adbd
|
||||
setprop sys.usb.state $sys.usb.config
|
||||
|
||||
on property:sys.usb.config=rndis,dm
|
||||
write /sys/class/android_usb/android0/enable 0
|
||||
write /sys/class/android_usb/android0/idVendor 04e8
|
||||
write /sys/class/android_usb/android0/idProduct 6862
|
||||
write /sys/class/android_usb/android0/functions $sys.usb.config
|
||||
write /sys/class/android_usb/android0/enable 1
|
||||
setprop sys.usb.state $sys.usb.config
|
||||
|
||||
on property:sys.usb.config=mass_storage
|
||||
write /sys/class/android_usb/android0/enable 0
|
||||
write /sys/class/android_usb/android0/idVendor 04e8
|
||||
write /sys/class/android_usb/android0/idProduct 685B
|
||||
write /sys/class/android_usb/android0/functions $sys.usb.config
|
||||
write /sys/class/android_usb/android0/enable 1
|
||||
setprop sys.usb.state $sys.usb.config
|
||||
|
||||
on property:sys.usb.config=mass_storage,adb
|
||||
write /sys/class/android_usb/android0/enable 0
|
||||
write /sys/class/android_usb/android0/idVendor 04e8
|
||||
write /sys/class/android_usb/android0/idProduct 685e
|
||||
write /sys/class/android_usb/android0/functions $sys.usb.config
|
||||
write /sys/class/android_usb/android0/enable 1
|
||||
start adbd
|
||||
setprop sys.usb.state $sys.usb.config
|
331
libsensors/AkmSensor.cpp
Normal file
@ -0,0 +1,331 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <poll.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/select.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "ak8973b.h"
|
||||
|
||||
#include <cutils/log.h>
|
||||
#include "AkmSensor.h"
|
||||
|
||||
//#define ALOG_NDEBUG 0
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
int (*akm_is_sensor_enabled)(uint32_t sensor_type);
|
||||
int (*akm_enable_sensor)(uint32_t sensor_type);
|
||||
int (*akm_disable_sensor)(uint32_t sensor_type);
|
||||
int (*akm_set_delay)(uint32_t sensor_type, uint64_t delay);
|
||||
|
||||
int stub_is_sensor_enabled(uint32_t sensor_type) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int stub_enable_disable_sensor(uint32_t sensor_type) {
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
int stub_set_delay(uint32_t sensor_type, uint64_t delay) {
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
AkmSensor::AkmSensor()
|
||||
: SensorBase(NULL, NULL),
|
||||
mEnabled(0),
|
||||
mPendingMask(0),
|
||||
mInputReader(32)
|
||||
{
|
||||
/* Open the library before opening the input device. The library
|
||||
* creates a uinput device.
|
||||
*/
|
||||
if (loadAKMLibrary() == 0) {
|
||||
data_name = "compass_sensor";
|
||||
data_fd = openInput("compass_sensor");
|
||||
}
|
||||
|
||||
memset(mPendingEvents, 0, sizeof(mPendingEvents));
|
||||
|
||||
mPendingEvents[Accelerometer].version = sizeof(sensors_event_t);
|
||||
mPendingEvents[Accelerometer].sensor = ID_A;
|
||||
mPendingEvents[Accelerometer].type = SENSOR_TYPE_ACCELEROMETER;
|
||||
mPendingEvents[Accelerometer].acceleration.status = SENSOR_STATUS_ACCURACY_HIGH;
|
||||
|
||||
mPendingEvents[MagneticField].version = sizeof(sensors_event_t);
|
||||
mPendingEvents[MagneticField].sensor = ID_M;
|
||||
mPendingEvents[MagneticField].type = SENSOR_TYPE_MAGNETIC_FIELD;
|
||||
mPendingEvents[MagneticField].magnetic.status = SENSOR_STATUS_ACCURACY_HIGH;
|
||||
|
||||
mPendingEvents[Orientation ].version = sizeof(sensors_event_t);
|
||||
mPendingEvents[Orientation ].sensor = ID_O;
|
||||
mPendingEvents[Orientation ].type = SENSOR_TYPE_ORIENTATION;
|
||||
mPendingEvents[Orientation ].orientation.status = SENSOR_STATUS_ACCURACY_HIGH;
|
||||
|
||||
// read the actual value of all sensors if they're enabled already
|
||||
struct input_absinfo absinfo;
|
||||
short flags = 0;
|
||||
|
||||
if (akm_is_sensor_enabled(SENSOR_TYPE_ACCELEROMETER)) {
|
||||
mEnabled |= 1<<Accelerometer;
|
||||
if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_ACCEL_X), &absinfo)) {
|
||||
mPendingEvents[Accelerometer].acceleration.x = absinfo.value * CONVERT_A_X;
|
||||
}
|
||||
if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_ACCEL_Y), &absinfo)) {
|
||||
mPendingEvents[Accelerometer].acceleration.y = absinfo.value * CONVERT_A_Y;
|
||||
}
|
||||
if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_ACCEL_Z), &absinfo)) {
|
||||
mPendingEvents[Accelerometer].acceleration.z = absinfo.value * CONVERT_A_Z;
|
||||
}
|
||||
}
|
||||
if (akm_is_sensor_enabled(SENSOR_TYPE_MAGNETIC_FIELD)) {
|
||||
mEnabled |= 1<<MagneticField;
|
||||
if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_MAGV_X), &absinfo)) {
|
||||
mPendingEvents[MagneticField].magnetic.x = absinfo.value * CONVERT_M_X;
|
||||
}
|
||||
if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_MAGV_Y), &absinfo)) {
|
||||
mPendingEvents[MagneticField].magnetic.y = absinfo.value * CONVERT_M_Y;
|
||||
}
|
||||
if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_MAGV_Z), &absinfo)) {
|
||||
mPendingEvents[MagneticField].magnetic.z = absinfo.value * CONVERT_M_Z;
|
||||
}
|
||||
}
|
||||
if (akm_is_sensor_enabled(SENSOR_TYPE_ORIENTATION)) {
|
||||
mEnabled |= 1<<Orientation;
|
||||
if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_YAW), &absinfo)) {
|
||||
mPendingEvents[Orientation].orientation.azimuth = absinfo.value;
|
||||
}
|
||||
if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_PITCH), &absinfo)) {
|
||||
mPendingEvents[Orientation].orientation.pitch = absinfo.value;
|
||||
}
|
||||
if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_ROLL), &absinfo)) {
|
||||
mPendingEvents[Orientation].orientation.roll = -absinfo.value;
|
||||
}
|
||||
if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_ORIENT_STATUS), &absinfo)) {
|
||||
mPendingEvents[Orientation].orientation.status = uint8_t(absinfo.value & SENSOR_STATE_MASK);
|
||||
}
|
||||
}
|
||||
|
||||
// disable temperature sensor, since it is not supported
|
||||
akm_disable_sensor(SENSOR_TYPE_TEMPERATURE);
|
||||
}
|
||||
|
||||
AkmSensor::~AkmSensor()
|
||||
{
|
||||
if (mLibAKM) {
|
||||
unsigned ref = ::dlclose(mLibAKM);
|
||||
}
|
||||
}
|
||||
|
||||
int AkmSensor::enable(int32_t handle, int en)
|
||||
{
|
||||
int what = -1;
|
||||
|
||||
switch (handle) {
|
||||
case ID_A: what = Accelerometer; break;
|
||||
case ID_M: what = MagneticField; break;
|
||||
case ID_O: what = Orientation; break;
|
||||
}
|
||||
|
||||
if (uint32_t(what) >= numSensors)
|
||||
return -EINVAL;
|
||||
|
||||
int newState = en ? 1 : 0;
|
||||
int err = 0;
|
||||
|
||||
if ((uint32_t(newState)<<what) != (mEnabled & (1<<what))) {
|
||||
uint32_t sensor_type;
|
||||
switch (what) {
|
||||
case Accelerometer: sensor_type = SENSOR_TYPE_ACCELEROMETER; break;
|
||||
case MagneticField: sensor_type = SENSOR_TYPE_MAGNETIC_FIELD; break;
|
||||
case Orientation: sensor_type = SENSOR_TYPE_ORIENTATION; break;
|
||||
}
|
||||
short flags = newState;
|
||||
if (en)
|
||||
err = akm_enable_sensor(sensor_type);
|
||||
else
|
||||
err = akm_disable_sensor(sensor_type);
|
||||
|
||||
ALOGE_IF(err, "Could not change sensor state (%s)", strerror(-err));
|
||||
if (!err) {
|
||||
mEnabled &= ~(1<<what);
|
||||
mEnabled |= (uint32_t(flags)<<what);
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
int AkmSensor::setDelay(int32_t handle, int64_t ns)
|
||||
{
|
||||
int what = -1;
|
||||
uint32_t sensor_type = 0;
|
||||
|
||||
if (ns < 0)
|
||||
return -EINVAL;
|
||||
|
||||
switch (handle) {
|
||||
case ID_A: sensor_type = SENSOR_TYPE_ACCELEROMETER; break;
|
||||
case ID_M: sensor_type = SENSOR_TYPE_MAGNETIC_FIELD; break;
|
||||
case ID_O: sensor_type = SENSOR_TYPE_ORIENTATION; break;
|
||||
}
|
||||
|
||||
if (sensor_type == 0)
|
||||
return -EINVAL;
|
||||
|
||||
mDelays[what] = ns;
|
||||
return update_delay();
|
||||
}
|
||||
|
||||
int AkmSensor::update_delay()
|
||||
{
|
||||
if (mEnabled) {
|
||||
uint64_t wanted = -1LLU;
|
||||
for (int i=0 ; i<numSensors ; i++) {
|
||||
if (mEnabled & (1<<i)) {
|
||||
uint64_t ns = mDelays[i];
|
||||
wanted = wanted < ns ? wanted : ns;
|
||||
}
|
||||
}
|
||||
short delay = int64_t(wanted) / 1000000;
|
||||
if (ioctl(dev_fd, ECS_IOCTL_APP_SET_DELAY, &delay)) {
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int AkmSensor::loadAKMLibrary()
|
||||
{
|
||||
mLibAKM = dlopen("libakm.so", RTLD_NOW);
|
||||
|
||||
if (!mLibAKM) {
|
||||
akm_is_sensor_enabled = stub_is_sensor_enabled;
|
||||
akm_enable_sensor = stub_enable_disable_sensor;
|
||||
akm_disable_sensor = stub_enable_disable_sensor;
|
||||
akm_set_delay = stub_set_delay;
|
||||
ALOGE("AkmSensor: unable to load AKM Library, %s", dlerror());
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
*(void **)&akm_is_sensor_enabled = dlsym(mLibAKM, "akm_is_sensor_enabled");
|
||||
*(void **)&akm_enable_sensor = dlsym(mLibAKM, "akm_enable_sensor");
|
||||
*(void **)&akm_disable_sensor = dlsym(mLibAKM, "akm_disable_sensor");
|
||||
*(void **)&akm_set_delay = dlsym(mLibAKM, "akm_set_delay");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int AkmSensor::readEvents(sensors_event_t* data, int count)
|
||||
{
|
||||
if (count < 1)
|
||||
return -EINVAL;
|
||||
|
||||
ssize_t n = mInputReader.fill(data_fd);
|
||||
if (n < 0)
|
||||
return n;
|
||||
|
||||
int numEventReceived = 0;
|
||||
input_event const* event;
|
||||
|
||||
while (count && mInputReader.readEvent(&event)) {
|
||||
int type = event->type;
|
||||
if (type == EV_REL) {
|
||||
processEvent(event->code, event->value);
|
||||
mInputReader.next();
|
||||
} else if (type == EV_SYN) {
|
||||
int64_t time = timevalToNano(event->time);
|
||||
for (int j=0 ; count && mPendingMask && j<numSensors ; j++) {
|
||||
if (mPendingMask & (1<<j)) {
|
||||
mPendingMask &= ~(1<<j);
|
||||
mPendingEvents[j].timestamp = time;
|
||||
if (mEnabled & (1<<j)) {
|
||||
*data++ = mPendingEvents[j];
|
||||
count--;
|
||||
numEventReceived++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!mPendingMask) {
|
||||
mInputReader.next();
|
||||
}
|
||||
} else {
|
||||
ALOGE("AkmSensor: unknown event (type=%d, code=%d)",
|
||||
type, event->code);
|
||||
mInputReader.next();
|
||||
}
|
||||
}
|
||||
return numEventReceived;
|
||||
}
|
||||
|
||||
void AkmSensor::processEvent(int code, int value)
|
||||
{
|
||||
switch (code) {
|
||||
case EVENT_TYPE_ACCEL_X:
|
||||
mPendingMask |= 1<<Accelerometer;
|
||||
mPendingEvents[Accelerometer].acceleration.x = value * CONVERT_A_X;
|
||||
break;
|
||||
case EVENT_TYPE_ACCEL_Y:
|
||||
mPendingMask |= 1<<Accelerometer;
|
||||
mPendingEvents[Accelerometer].acceleration.y = value * CONVERT_A_Y;
|
||||
break;
|
||||
case EVENT_TYPE_ACCEL_Z:
|
||||
mPendingMask |= 1<<Accelerometer;
|
||||
mPendingEvents[Accelerometer].acceleration.z = value * CONVERT_A_Z;
|
||||
break;
|
||||
|
||||
case EVENT_TYPE_MAGV_X:
|
||||
ALOGV("AkmSensor: EVENT_TYPE_MAGV_X value =%d", value);
|
||||
mPendingMask |= 1<<MagneticField;
|
||||
mPendingEvents[MagneticField].magnetic.x = value * CONVERT_M_X;
|
||||
break;
|
||||
case EVENT_TYPE_MAGV_Y:
|
||||
ALOGV("AkmSensor: EVENT_TYPE_MAGV_Y value =%d", value);
|
||||
mPendingMask |= 1<<MagneticField;
|
||||
mPendingEvents[MagneticField].magnetic.y = value * CONVERT_M_Y;
|
||||
break;
|
||||
case EVENT_TYPE_MAGV_Z:
|
||||
ALOGV("AkmSensor: EVENT_TYPE_MAGV_Z value =%d", value);
|
||||
mPendingMask |= 1<<MagneticField;
|
||||
mPendingEvents[MagneticField].magnetic.z = value * CONVERT_M_Z;
|
||||
break;
|
||||
|
||||
case EVENT_TYPE_YAW:
|
||||
mPendingMask |= 1<<Orientation;
|
||||
mPendingEvents[Orientation].orientation.azimuth = value * CONVERT_O_A;
|
||||
break;
|
||||
case EVENT_TYPE_PITCH:
|
||||
mPendingMask |= 1<<Orientation;
|
||||
mPendingEvents[Orientation].orientation.pitch = value * CONVERT_O_P;
|
||||
break;
|
||||
case EVENT_TYPE_ROLL:
|
||||
mPendingMask |= 1<<Orientation;
|
||||
mPendingEvents[Orientation].orientation.roll = value * CONVERT_O_R;
|
||||
break;
|
||||
case EVENT_TYPE_ORIENT_STATUS:
|
||||
uint8_t status = uint8_t(value & SENSOR_STATE_MASK);
|
||||
if (status == 4)
|
||||
status = 0;
|
||||
mPendingMask |= 1<<Orientation;
|
||||
mPendingEvents[Orientation].orientation.status = status;
|
||||
break;
|
||||
}
|
||||
}
|
64
libsensors/AkmSensor.h
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_AKM_SENSOR_H
|
||||
#define ANDROID_AKM_SENSOR_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
#include "sensors.h"
|
||||
#include "SensorBase.h"
|
||||
#include "InputEventReader.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
struct input_event;
|
||||
|
||||
class AkmSensor : public SensorBase {
|
||||
public:
|
||||
AkmSensor();
|
||||
virtual ~AkmSensor();
|
||||
|
||||
enum {
|
||||
Accelerometer = 0,
|
||||
MagneticField = 1,
|
||||
Orientation = 2,
|
||||
numSensors
|
||||
};
|
||||
|
||||
virtual int setDelay(int32_t handle, int64_t ns);
|
||||
virtual int enable(int32_t handle, int enabled);
|
||||
virtual int readEvents(sensors_event_t* data, int count);
|
||||
void processEvent(int code, int value);
|
||||
|
||||
private:
|
||||
int loadAKMLibrary();
|
||||
int update_delay();
|
||||
void *mLibAKM;
|
||||
uint32_t mEnabled;
|
||||
uint32_t mPendingMask;
|
||||
InputEventCircularReader mInputReader;
|
||||
sensors_event_t mPendingEvents[numSensors];
|
||||
uint64_t mDelays[numSensors];
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#endif // ANDROID_AKM_SENSOR_H
|
45
libsensors/Android.mk
Normal file
@ -0,0 +1,45 @@
|
||||
# Copyright (C) 2008 The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
ifneq ($(TARGET_SIMULATOR),true)
|
||||
|
||||
# HAL module implemenation, not prelinked, and stored in
|
||||
# hw/<SENSORS_HARDWARE_MODULE_ID>.<ro.product.board>.so
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := sensors.$(TARGET_BOARD_PLATFORM)
|
||||
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
|
||||
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
LOCAL_CFLAGS := -DALOG_TAG=\"Sensors\"
|
||||
LOCAL_SRC_FILES := \
|
||||
sensors.cpp \
|
||||
SensorBase.cpp \
|
||||
LightSensor.cpp \
|
||||
ProximitySensor.cpp \
|
||||
AkmSensor.cpp \
|
||||
GyroSensor.cpp \
|
||||
InputEventReader.cpp
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := liblog libcutils libdl
|
||||
LOCAL_PRELINK_MODULE := false
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
endif # !TARGET_SIMULATOR
|
185
libsensors/GyroSensor.cpp
Normal file
@ -0,0 +1,185 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <poll.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/select.h>
|
||||
#include <cutils/log.h>
|
||||
|
||||
#include "GyroSensor.h"
|
||||
|
||||
#define FETCH_FULL_EVENT_BEFORE_RETURN 1
|
||||
#define IGNORE_EVENT_TIME 350000000
|
||||
/*****************************************************************************/
|
||||
|
||||
GyroSensor::GyroSensor()
|
||||
: SensorBase(NULL, "gyro_sensor"),
|
||||
mEnabled(0),
|
||||
mInputReader(4),
|
||||
mHasPendingEvent(false),
|
||||
mEnabledTime(0)
|
||||
{
|
||||
mPendingEvent.version = sizeof(sensors_event_t);
|
||||
mPendingEvent.sensor = ID_GY;
|
||||
mPendingEvent.type = SENSOR_TYPE_GYROSCOPE;
|
||||
memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data));
|
||||
|
||||
if (data_fd) {
|
||||
strcpy(input_sysfs_path, "/sys/class/input/");
|
||||
strcat(input_sysfs_path, input_name);
|
||||
strcat(input_sysfs_path, "/device/");
|
||||
input_sysfs_path_len = strlen(input_sysfs_path);
|
||||
enable(0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
GyroSensor::~GyroSensor() {
|
||||
if (mEnabled) {
|
||||
enable(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
int GyroSensor::setInitialState() {
|
||||
struct input_absinfo absinfo_x;
|
||||
struct input_absinfo absinfo_y;
|
||||
struct input_absinfo absinfo_z;
|
||||
float value;
|
||||
if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_GYRO_X), &absinfo_x) &&
|
||||
!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_GYRO_X), &absinfo_y) &&
|
||||
!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_GYRO_X), &absinfo_z)) {
|
||||
value = absinfo_x.value;
|
||||
mPendingEvent.data[0] = value * CONVERT_GYRO_X;
|
||||
value = absinfo_x.value;
|
||||
mPendingEvent.data[1] = value * CONVERT_GYRO_Y;
|
||||
value = absinfo_x.value;
|
||||
mPendingEvent.data[2] = value * CONVERT_GYRO_Z;
|
||||
mHasPendingEvent = true;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GyroSensor::enable(int32_t, int en) {
|
||||
int flags = en ? 1 : 0;
|
||||
if (flags != mEnabled) {
|
||||
int fd;
|
||||
strcpy(&input_sysfs_path[input_sysfs_path_len], "enable");
|
||||
fd = open(input_sysfs_path, O_RDWR);
|
||||
if (fd >= 0) {
|
||||
char buf[2];
|
||||
int err;
|
||||
buf[1] = 0;
|
||||
if (flags) {
|
||||
buf[0] = '1';
|
||||
mEnabledTime = getTimestamp() + IGNORE_EVENT_TIME;
|
||||
} else {
|
||||
buf[0] = '0';
|
||||
}
|
||||
err = write(fd, buf, sizeof(buf));
|
||||
close(fd);
|
||||
mEnabled = flags;
|
||||
setInitialState();
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool GyroSensor::hasPendingEvents() const {
|
||||
return mHasPendingEvent;
|
||||
}
|
||||
|
||||
int GyroSensor::setDelay(int32_t handle, int64_t delay_ns)
|
||||
{
|
||||
int fd;
|
||||
strcpy(&input_sysfs_path[input_sysfs_path_len], "poll_delay");
|
||||
fd = open(input_sysfs_path, O_RDWR);
|
||||
if (fd >= 0) {
|
||||
char buf[80];
|
||||
sprintf(buf, "%lld", delay_ns);
|
||||
write(fd, buf, strlen(buf)+1);
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int GyroSensor::readEvents(sensors_event_t* data, int count)
|
||||
{
|
||||
if (count < 1)
|
||||
return -EINVAL;
|
||||
|
||||
if (mHasPendingEvent) {
|
||||
mHasPendingEvent = false;
|
||||
mPendingEvent.timestamp = getTimestamp();
|
||||
*data = mPendingEvent;
|
||||
return mEnabled ? 1 : 0;
|
||||
}
|
||||
|
||||
ssize_t n = mInputReader.fill(data_fd);
|
||||
if (n < 0)
|
||||
return n;
|
||||
|
||||
int numEventReceived = 0;
|
||||
input_event const* event;
|
||||
|
||||
#if FETCH_FULL_EVENT_BEFORE_RETURN
|
||||
again:
|
||||
#endif
|
||||
while (count && mInputReader.readEvent(&event)) {
|
||||
int type = event->type;
|
||||
if (type == EV_REL) {
|
||||
float value = event->value;
|
||||
if (event->code == EVENT_TYPE_GYRO_X) {
|
||||
mPendingEvent.data[0] = value * CONVERT_GYRO_X;
|
||||
} else if (event->code == EVENT_TYPE_GYRO_Y) {
|
||||
mPendingEvent.data[1] = value * CONVERT_GYRO_Y;
|
||||
} else if (event->code == EVENT_TYPE_GYRO_Z) {
|
||||
mPendingEvent.data[2] = value * CONVERT_GYRO_Z;
|
||||
}
|
||||
} else if (type == EV_SYN) {
|
||||
mPendingEvent.timestamp = timevalToNano(event->time);
|
||||
if (mEnabled) {
|
||||
if (mPendingEvent.timestamp >= mEnabledTime) {
|
||||
*data++ = mPendingEvent;
|
||||
numEventReceived++;
|
||||
}
|
||||
count--;
|
||||
}
|
||||
} else {
|
||||
ALOGE("GyroSensor: unknown event (type=%d, code=%d)",
|
||||
type, event->code);
|
||||
}
|
||||
mInputReader.next();
|
||||
}
|
||||
|
||||
#if FETCH_FULL_EVENT_BEFORE_RETURN
|
||||
/* if we didn't read a complete event, see if we can fill and
|
||||
try again instead of returning with nothing and redoing poll. */
|
||||
if (numEventReceived == 0 && mEnabled == 1) {
|
||||
n = mInputReader.fill(data_fd);
|
||||
if (n)
|
||||
goto again;
|
||||
}
|
||||
#endif
|
||||
|
||||
return numEventReceived;
|
||||
}
|
||||
|
55
libsensors/GyroSensor.h
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_GYRO_SENSOR_H
|
||||
#define ANDROID_GYRO_SENSOR_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "sensors.h"
|
||||
#include "SensorBase.h"
|
||||
#include "InputEventReader.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
struct input_event;
|
||||
|
||||
class GyroSensor : public SensorBase {
|
||||
int mEnabled;
|
||||
InputEventCircularReader mInputReader;
|
||||
sensors_event_t mPendingEvent;
|
||||
bool mHasPendingEvent;
|
||||
char input_sysfs_path[PATH_MAX];
|
||||
int input_sysfs_path_len;
|
||||
int64_t mEnabledTime;
|
||||
|
||||
int setInitialState();
|
||||
|
||||
public:
|
||||
GyroSensor();
|
||||
virtual ~GyroSensor();
|
||||
virtual int readEvents(sensors_event_t* data, int count);
|
||||
virtual bool hasPendingEvents() const;
|
||||
virtual int setDelay(int32_t handle, int64_t ns);
|
||||
virtual int enable(int32_t handle, int enabled);
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#endif // ANDROID_GYRO_SENSOR_H
|
88
libsensors/InputEventReader.cpp
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <poll.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <linux/input.h>
|
||||
|
||||
#include <cutils/log.h>
|
||||
|
||||
#include "InputEventReader.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
struct input_event;
|
||||
|
||||
InputEventCircularReader::InputEventCircularReader(size_t numEvents)
|
||||
: mBuffer(new input_event[numEvents * 2]),
|
||||
mBufferEnd(mBuffer + numEvents),
|
||||
mHead(mBuffer),
|
||||
mCurr(mBuffer),
|
||||
mFreeSpace(numEvents)
|
||||
{
|
||||
}
|
||||
|
||||
InputEventCircularReader::~InputEventCircularReader()
|
||||
{
|
||||
delete [] mBuffer;
|
||||
}
|
||||
|
||||
ssize_t InputEventCircularReader::fill(int fd)
|
||||
{
|
||||
size_t numEventsRead = 0;
|
||||
if (mFreeSpace) {
|
||||
const ssize_t nread = read(fd, mHead, mFreeSpace * sizeof(input_event));
|
||||
if (nread<0 || nread % sizeof(input_event)) {
|
||||
// we got a partial event!!
|
||||
return nread<0 ? -errno : -EINVAL;
|
||||
}
|
||||
|
||||
numEventsRead = nread / sizeof(input_event);
|
||||
if (numEventsRead) {
|
||||
mHead += numEventsRead;
|
||||
mFreeSpace -= numEventsRead;
|
||||
if (mHead > mBufferEnd) {
|
||||
size_t s = mHead - mBufferEnd;
|
||||
memcpy(mBuffer, mBufferEnd, s * sizeof(input_event));
|
||||
mHead = mBuffer + s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return numEventsRead;
|
||||
}
|
||||
|
||||
ssize_t InputEventCircularReader::readEvent(input_event const** events)
|
||||
{
|
||||
*events = mCurr;
|
||||
ssize_t available = (mBufferEnd - mBuffer) - mFreeSpace;
|
||||
return available ? 1 : 0;
|
||||
}
|
||||
|
||||
void InputEventCircularReader::next()
|
||||
{
|
||||
mCurr++;
|
||||
mFreeSpace++;
|
||||
if (mCurr >= mBufferEnd) {
|
||||
mCurr = mBuffer;
|
||||
}
|
||||
}
|
47
libsensors/InputEventReader.h
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_INPUT_EVENT_READER_H
|
||||
#define ANDROID_INPUT_EVENT_READER_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
struct input_event;
|
||||
|
||||
class InputEventCircularReader
|
||||
{
|
||||
struct input_event* const mBuffer;
|
||||
struct input_event* const mBufferEnd;
|
||||
struct input_event* mHead;
|
||||
struct input_event* mCurr;
|
||||
ssize_t mFreeSpace;
|
||||
|
||||
public:
|
||||
InputEventCircularReader(size_t numEvents);
|
||||
~InputEventCircularReader();
|
||||
ssize_t fill(int fd);
|
||||
ssize_t readEvent(input_event const** events);
|
||||
void next();
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#endif // ANDROID_INPUT_EVENT_READER_H
|
160
libsensors/LightSensor.cpp
Normal file
@ -0,0 +1,160 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <poll.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/select.h>
|
||||
|
||||
#include <linux/lightsensor.h>
|
||||
|
||||
#include <cutils/log.h>
|
||||
|
||||
#include "LightSensor.h"
|
||||
|
||||
// #define ALOG_NDEBUG 0
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
LightSensor::LightSensor()
|
||||
: SensorBase(NULL, "light_sensor"),
|
||||
mEnabled(0),
|
||||
mInputReader(4),
|
||||
mHasPendingEvent(false)
|
||||
{
|
||||
mPendingEvent.version = sizeof(sensors_event_t);
|
||||
mPendingEvent.sensor = ID_L;
|
||||
mPendingEvent.type = SENSOR_TYPE_LIGHT;
|
||||
memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data));
|
||||
|
||||
if (data_fd) {
|
||||
strcpy(input_sysfs_path, "/sys/class/input/");
|
||||
strcat(input_sysfs_path, input_name);
|
||||
strcat(input_sysfs_path, "/device/");
|
||||
input_sysfs_path_len = strlen(input_sysfs_path);
|
||||
enable(0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
LightSensor::~LightSensor() {
|
||||
if (mEnabled) {
|
||||
enable(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
int LightSensor::setInitialState() {
|
||||
struct input_absinfo absinfo;
|
||||
if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_LIGHT), &absinfo)) {
|
||||
// make sure to report an event immediately
|
||||
mHasPendingEvent = true;
|
||||
mPendingEvent.light = absinfo.value;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LightSensor::setDelay(int32_t handle, int64_t ns)
|
||||
{
|
||||
int fd;
|
||||
strcpy(&input_sysfs_path[input_sysfs_path_len], "poll_delay");
|
||||
fd = open(input_sysfs_path, O_RDWR);
|
||||
if (fd >= 0) {
|
||||
char buf[80];
|
||||
sprintf(buf, "%lld", ns);
|
||||
write(fd, buf, strlen(buf)+1);
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int LightSensor::enable(int32_t handle, int en)
|
||||
{
|
||||
int flags = en ? 1 : 0;
|
||||
if (flags != mEnabled) {
|
||||
int fd;
|
||||
strcpy(&input_sysfs_path[input_sysfs_path_len], "enable");
|
||||
fd = open(input_sysfs_path, O_RDWR);
|
||||
if (fd >= 0) {
|
||||
char buf[2];
|
||||
int err;
|
||||
buf[1] = 0;
|
||||
if (flags) {
|
||||
buf[0] = '1';
|
||||
} else {
|
||||
buf[0] = '0';
|
||||
}
|
||||
err = write(fd, buf, sizeof(buf));
|
||||
close(fd);
|
||||
mEnabled = flags;
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool LightSensor::hasPendingEvents() const {
|
||||
return mHasPendingEvent;
|
||||
}
|
||||
|
||||
int LightSensor::readEvents(sensors_event_t* data, int count)
|
||||
{
|
||||
if (count < 1)
|
||||
return -EINVAL;
|
||||
|
||||
if (mHasPendingEvent) {
|
||||
mHasPendingEvent = false;
|
||||
mPendingEvent.timestamp = getTimestamp();
|
||||
*data = mPendingEvent;
|
||||
return mEnabled ? 1 : 0;
|
||||
}
|
||||
|
||||
ssize_t n = mInputReader.fill(data_fd);
|
||||
if (n < 0)
|
||||
return n;
|
||||
|
||||
int numEventReceived = 0;
|
||||
input_event const* event;
|
||||
|
||||
while (count && mInputReader.readEvent(&event)) {
|
||||
int type = event->type;
|
||||
if (type == EV_ABS) {
|
||||
if (event->code == EVENT_TYPE_LIGHT) {
|
||||
if (event->value != -1) {
|
||||
ALOGV("LightSensor: event (value=%d)", event->value);
|
||||
// FIXME: not sure why we're getting -1 sometimes
|
||||
mPendingEvent.light = event->value;
|
||||
}
|
||||
}
|
||||
} else if (type == EV_SYN) {
|
||||
mPendingEvent.timestamp = timevalToNano(event->time);
|
||||
if (mEnabled) {
|
||||
*data++ = mPendingEvent;
|
||||
count--;
|
||||
numEventReceived++;
|
||||
}
|
||||
} else {
|
||||
ALOGE("LightSensor: unknown event (type=%d, code=%d)",
|
||||
type, event->code);
|
||||
}
|
||||
mInputReader.next();
|
||||
}
|
||||
|
||||
return numEventReceived;
|
||||
}
|
55
libsensors/LightSensor.h
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_LIGHT_SENSOR_H
|
||||
#define ANDROID_LIGHT_SENSOR_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "sensors.h"
|
||||
#include "SensorBase.h"
|
||||
#include "InputEventReader.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
struct input_event;
|
||||
|
||||
class LightSensor : public SensorBase {
|
||||
int mEnabled;
|
||||
InputEventCircularReader mInputReader;
|
||||
sensors_event_t mPendingEvent;
|
||||
bool mHasPendingEvent;
|
||||
char input_sysfs_path[PATH_MAX];
|
||||
int input_sysfs_path_len;
|
||||
|
||||
float indexToValue(size_t index) const;
|
||||
int setInitialState();
|
||||
|
||||
public:
|
||||
LightSensor();
|
||||
virtual ~LightSensor();
|
||||
virtual int readEvents(sensors_event_t* data, int count);
|
||||
virtual bool hasPendingEvents() const;
|
||||
virtual int setDelay(int32_t handle, int64_t ns);
|
||||
virtual int enable(int32_t handle, int enabled);
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#endif // ANDROID_LIGHT_SENSOR_H
|
0
libsensors/MODULE_LICENSE_APACHE2
Normal file
144
libsensors/ProximitySensor.cpp
Normal file
@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <poll.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/select.h>
|
||||
|
||||
#include <linux/capella_cm3602.h>
|
||||
|
||||
#include <cutils/log.h>
|
||||
|
||||
#include "ProximitySensor.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
ProximitySensor::ProximitySensor()
|
||||
: SensorBase(NULL, "proximity_sensor"),
|
||||
mEnabled(0),
|
||||
mInputReader(4),
|
||||
mHasPendingEvent(false)
|
||||
{
|
||||
mPendingEvent.version = sizeof(sensors_event_t);
|
||||
mPendingEvent.sensor = ID_P;
|
||||
mPendingEvent.type = SENSOR_TYPE_PROXIMITY;
|
||||
memset(mPendingEvent.data, 0, sizeof(mPendingEvent.data));
|
||||
|
||||
if (data_fd) {
|
||||
strcpy(input_sysfs_path, "/sys/class/input/");
|
||||
strcat(input_sysfs_path, input_name);
|
||||
strcat(input_sysfs_path, "/device/");
|
||||
input_sysfs_path_len = strlen(input_sysfs_path);
|
||||
enable(0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
ProximitySensor::~ProximitySensor() {
|
||||
if (mEnabled) {
|
||||
enable(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
int ProximitySensor::setInitialState() {
|
||||
struct input_absinfo absinfo;
|
||||
if (!ioctl(data_fd, EVIOCGABS(EVENT_TYPE_PROXIMITY), &absinfo)) {
|
||||
// make sure to report an event immediately
|
||||
mHasPendingEvent = true;
|
||||
mPendingEvent.distance = indexToValue(absinfo.value);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ProximitySensor::enable(int32_t, int en) {
|
||||
int flags = en ? 1 : 0;
|
||||
if (flags != mEnabled) {
|
||||
int fd;
|
||||
strcpy(&input_sysfs_path[input_sysfs_path_len], "enable");
|
||||
fd = open(input_sysfs_path, O_RDWR);
|
||||
if (fd >= 0) {
|
||||
char buf[2];
|
||||
buf[1] = 0;
|
||||
if (flags) {
|
||||
buf[0] = '1';
|
||||
} else {
|
||||
buf[0] = '0';
|
||||
}
|
||||
write(fd, buf, sizeof(buf));
|
||||
close(fd);
|
||||
mEnabled = flags;
|
||||
setInitialState();
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool ProximitySensor::hasPendingEvents() const {
|
||||
return mHasPendingEvent;
|
||||
}
|
||||
|
||||
int ProximitySensor::readEvents(sensors_event_t* data, int count)
|
||||
{
|
||||
if (count < 1)
|
||||
return -EINVAL;
|
||||
|
||||
if (mHasPendingEvent) {
|
||||
mHasPendingEvent = false;
|
||||
mPendingEvent.timestamp = getTimestamp();
|
||||
*data = mPendingEvent;
|
||||
return mEnabled ? 1 : 0;
|
||||
}
|
||||
|
||||
ssize_t n = mInputReader.fill(data_fd);
|
||||
if (n < 0)
|
||||
return n;
|
||||
|
||||
int numEventReceived = 0;
|
||||
input_event const* event;
|
||||
|
||||
while (count && mInputReader.readEvent(&event)) {
|
||||
int type = event->type;
|
||||
if (type == EV_ABS) {
|
||||
if (event->code == EVENT_TYPE_PROXIMITY) {
|
||||
mPendingEvent.distance = indexToValue(event->value);
|
||||
}
|
||||
} else if (type == EV_SYN) {
|
||||
mPendingEvent.timestamp = timevalToNano(event->time);
|
||||
if (mEnabled) {
|
||||
*data++ = mPendingEvent;
|
||||
count--;
|
||||
numEventReceived++;
|
||||
}
|
||||
} else {
|
||||
ALOGE("ProximitySensor: unknown event (type=%d, code=%d)",
|
||||
type, event->code);
|
||||
}
|
||||
mInputReader.next();
|
||||
}
|
||||
|
||||
return numEventReceived;
|
||||
}
|
||||
|
||||
float ProximitySensor::indexToValue(size_t index) const
|
||||
{
|
||||
ALOGV("ProximitySensor: Index = %zu", index);
|
||||
return index * PROXIMITY_THRESHOLD_CM;
|
||||
}
|
54
libsensors/ProximitySensor.h
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_PROXIMITY_SENSOR_H
|
||||
#define ANDROID_PROXIMITY_SENSOR_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "sensors.h"
|
||||
#include "SensorBase.h"
|
||||
#include "InputEventReader.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
struct input_event;
|
||||
|
||||
class ProximitySensor : public SensorBase {
|
||||
int mEnabled;
|
||||
InputEventCircularReader mInputReader;
|
||||
sensors_event_t mPendingEvent;
|
||||
bool mHasPendingEvent;
|
||||
char input_sysfs_path[PATH_MAX];
|
||||
int input_sysfs_path_len;
|
||||
|
||||
int setInitialState();
|
||||
float indexToValue(size_t index) const;
|
||||
|
||||
public:
|
||||
ProximitySensor();
|
||||
virtual ~ProximitySensor();
|
||||
virtual int readEvents(sensors_event_t* data, int count);
|
||||
virtual bool hasPendingEvents() const;
|
||||
virtual int enable(int32_t handle, int enabled);
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#endif // ANDROID_PROXIMITY_SENSOR_H
|
128
libsensors/SensorBase.cpp
Normal file
@ -0,0 +1,128 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <poll.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/select.h>
|
||||
|
||||
#include <cutils/log.h>
|
||||
|
||||
#include <linux/input.h>
|
||||
|
||||
#include "SensorBase.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
SensorBase::SensorBase(
|
||||
const char* dev_name,
|
||||
const char* data_name)
|
||||
: dev_name(dev_name), data_name(data_name),
|
||||
dev_fd(-1), data_fd(-1)
|
||||
{
|
||||
if (data_name) {
|
||||
data_fd = openInput(data_name);
|
||||
}
|
||||
}
|
||||
|
||||
SensorBase::~SensorBase() {
|
||||
if (data_fd >= 0) {
|
||||
close(data_fd);
|
||||
}
|
||||
if (dev_fd >= 0) {
|
||||
close(dev_fd);
|
||||
}
|
||||
}
|
||||
|
||||
int SensorBase::open_device() {
|
||||
if (dev_fd<0 && dev_name) {
|
||||
dev_fd = open(dev_name, O_RDONLY);
|
||||
ALOGE_IF(dev_fd<0, "Couldn't open %s (%s)", dev_name, strerror(errno));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SensorBase::close_device() {
|
||||
if (dev_fd >= 0) {
|
||||
close(dev_fd);
|
||||
dev_fd = -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SensorBase::getFd() const {
|
||||
if (!data_name) {
|
||||
return dev_fd;
|
||||
}
|
||||
return data_fd;
|
||||
}
|
||||
|
||||
int SensorBase::setDelay(int32_t handle, int64_t ns) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool SensorBase::hasPendingEvents() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
int64_t SensorBase::getTimestamp() {
|
||||
struct timespec t;
|
||||
t.tv_sec = t.tv_nsec = 0;
|
||||
clock_gettime(CLOCK_MONOTONIC, &t);
|
||||
return int64_t(t.tv_sec)*1000000000LL + t.tv_nsec;
|
||||
}
|
||||
|
||||
int SensorBase::openInput(const char* inputName) {
|
||||
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, O_RDONLY);
|
||||
if (fd>=0) {
|
||||
char name[80];
|
||||
if (ioctl(fd, EVIOCGNAME(sizeof(name) - 1), &name) < 1) {
|
||||
name[0] = '\0';
|
||||
}
|
||||
if (!strcmp(name, inputName)) {
|
||||
strcpy(input_name, filename);
|
||||
break;
|
||||
} else {
|
||||
close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
ALOGE_IF(fd<0, "couldn't find '%s' input device", inputName);
|
||||
return fd;
|
||||
}
|
65
libsensors/SensorBase.h
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_SENSOR_BASE_H
|
||||
#define ANDROID_SENSOR_BASE_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
struct sensors_event_t;
|
||||
|
||||
class SensorBase {
|
||||
protected:
|
||||
const char* dev_name;
|
||||
const char* data_name;
|
||||
char input_name[PATH_MAX];
|
||||
int dev_fd;
|
||||
int data_fd;
|
||||
|
||||
int openInput(const char* inputName);
|
||||
static int64_t getTimestamp();
|
||||
|
||||
|
||||
static int64_t timevalToNano(timeval const& t) {
|
||||
return t.tv_sec*1000000000LL + t.tv_usec*1000;
|
||||
}
|
||||
|
||||
int open_device();
|
||||
int close_device();
|
||||
|
||||
public:
|
||||
SensorBase(
|
||||
const char* dev_name,
|
||||
const char* data_name);
|
||||
|
||||
virtual ~SensorBase();
|
||||
|
||||
virtual int readEvents(sensors_event_t* data, int count) = 0;
|
||||
virtual bool hasPendingEvents() const;
|
||||
virtual int getFd() const;
|
||||
virtual int setDelay(int32_t handle, int64_t ns);
|
||||
virtual int enable(int32_t handle, int enabled) = 0;
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#endif // ANDROID_SENSOR_BASE_H
|
51
libsensors/ak8973b.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Definitions for akm8973 compass chip.
|
||||
*/
|
||||
#ifndef AKM8973_H
|
||||
#define AKM8973_H
|
||||
|
||||
#include <linux/ioctl.h>
|
||||
|
||||
#define AKM8973_I2C_NAME "ak8973b"
|
||||
|
||||
#define AKMIO 0xA1
|
||||
|
||||
/* IOCTLs for AKM library */
|
||||
#define ECS_IOCTL_WRITE _IOW(AKMIO, 0x01, char*)
|
||||
#define ECS_IOCTL_READ _IOWR(AKMIO, 0x02, char*)
|
||||
#define ECS_IOCTL_RESET _IO(AKMIO, 0x03)
|
||||
#define ECS_IOCTL_SET_MODE _IOW(AKMIO, 0x04, short)
|
||||
#define ECS_IOCTL_GETDATA _IOR(AKMIO, 0x05, char[SENSOR_DATA_SIZE])
|
||||
#define ECS_IOCTL_SET_YPR _IOW(AKMIO, 0x06, short[12])
|
||||
#define ECS_IOCTL_GET_OPEN_STATUS _IOR(AKMIO, 0x07, int)
|
||||
#define ECS_IOCTL_GET_CLOSE_STATUS _IOR(AKMIO, 0x08, int)
|
||||
#define ECS_IOCTL_GET_DELAY _IOR(AKMIO, 0x30, int64_t)
|
||||
#define ECS_IOCTL_GET_PROJECT_NAME _IOR(AKMIO, 0x0D, char[64])
|
||||
#define ECS_IOCTL_GET_MATRIX _IOR(AKMIO, 0x0E, short [4][3][3])
|
||||
|
||||
/* IOCTLs for APPs */
|
||||
#define ECS_IOCTL_APP_SET_MODE _IOW(AKMIO, 0x10, short)
|
||||
#define ECS_IOCTL_APP_SET_MFLAG _IOW(AKMIO, 0x11, short)
|
||||
#define ECS_IOCTL_APP_GET_MFLAG _IOW(AKMIO, 0x12, short)
|
||||
#define ECS_IOCTL_APP_SET_AFLAG _IOW(AKMIO, 0x13, short)
|
||||
#define ECS_IOCTL_APP_GET_AFLAG _IOR(AKMIO, 0x14, short)
|
||||
#define ECS_IOCTL_APP_SET_TFLAG _IOR(AKMIO, 0x15, short)
|
||||
#define ECS_IOCTL_APP_GET_TFLAG _IOR(AKMIO, 0x16, short)
|
||||
#define ECS_IOCTL_APP_RESET_PEDOMETER _IO(AKMIO, 0x17)
|
||||
#define ECS_IOCTL_APP_SET_DELAY _IOW(AKMIO, 0x18, int64_t)
|
||||
#define ECS_IOCTL_APP_GET_DELAY ECS_IOCTL_GET_DELAY
|
||||
|
||||
/* Set raw magnetic vector flag */
|
||||
#define ECS_IOCTL_APP_SET_MVFLAG _IOW(AKMIO, 0x19, short)
|
||||
|
||||
/* Get raw magnetic vector flag */
|
||||
#define ECS_IOCTL_APP_GET_MVFLAG _IOR(AKMIO, 0x1A, short)
|
||||
|
||||
struct akm8973_platform_data {
|
||||
short layouts[4][3][3];
|
||||
char project_name[64];
|
||||
int gpio_RST;
|
||||
int gpio_INT;
|
||||
};
|
||||
|
||||
#endif
|
326
libsensors/sensors.cpp
Normal file
@ -0,0 +1,326 @@
|
||||
/*
|
||||
* 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 ALOG_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 <stdlib.h>
|
||||
|
||||
#include <linux/input.h>
|
||||
|
||||
#include <utils/Atomic.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include "sensors.h"
|
||||
|
||||
#include "LightSensor.h"
|
||||
#include "ProximitySensor.h"
|
||||
#include "AkmSensor.h"
|
||||
#include "GyroSensor.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define DELAY_OUT_TIME 0x7FFFFFFF
|
||||
|
||||
#define LIGHT_SENSOR_POLLTIME 2000000000
|
||||
|
||||
|
||||
#define SENSORS_ACCELERATION (1<<ID_A)
|
||||
#define SENSORS_MAGNETIC_FIELD (1<<ID_M)
|
||||
#define SENSORS_ORIENTATION (1<<ID_O)
|
||||
#define SENSORS_LIGHT (1<<ID_L)
|
||||
#define SENSORS_PROXIMITY (1<<ID_P)
|
||||
#define SENSORS_GYROSCOPE (1<<ID_GY)
|
||||
|
||||
#define SENSORS_ACCELERATION_HANDLE 0
|
||||
#define SENSORS_MAGNETIC_FIELD_HANDLE 1
|
||||
#define SENSORS_ORIENTATION_HANDLE 2
|
||||
#define SENSORS_LIGHT_HANDLE 3
|
||||
#define SENSORS_PROXIMITY_HANDLE 4
|
||||
#define SENSORS_GYROSCOPE_HANDLE 5
|
||||
|
||||
#define AKM_FTRACE 0
|
||||
#define AKM_DEBUG 0
|
||||
#define AKM_DATA 0
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/* The SENSORS Module */
|
||||
static const struct sensor_t sSensorList[] = {
|
||||
{ "KR3DM 3-axis Accelerometer",
|
||||
"STMicroelectronics",
|
||||
1, SENSORS_ACCELERATION_HANDLE,
|
||||
SENSOR_TYPE_ACCELEROMETER, RANGE_A, CONVERT_A, 0.23f, 20000, { } },
|
||||
{ "AK8975 3-axis Magnetic field sensor",
|
||||
"Asahi Kasei Microdevices",
|
||||
1, SENSORS_MAGNETIC_FIELD_HANDLE,
|
||||
SENSOR_TYPE_MAGNETIC_FIELD, 2000.0f, CONVERT_M, 6.8f, 16667, { } },
|
||||
{ "AK8973 Orientation sensor",
|
||||
"Asahi Kasei Microdevices",
|
||||
1, SENSORS_ORIENTATION_HANDLE,
|
||||
SENSOR_TYPE_ORIENTATION, 360.0f, CONVERT_O, 7.8f, 16667, { } },
|
||||
{ "CM3663 Light sensor",
|
||||
"Capella Microsystems",
|
||||
1, SENSORS_LIGHT_HANDLE,
|
||||
SENSOR_TYPE_LIGHT, 10240.0f, 1.0f, 0.75f, 0, { } },
|
||||
{ "CM3663 Proximity sensor",
|
||||
"Capella Microsystems",
|
||||
1, SENSORS_PROXIMITY_HANDLE,
|
||||
SENSOR_TYPE_PROXIMITY, 5.0f, 5.0f, 0.75f, 0, { } },
|
||||
{ "K3G Gyroscope sensor",
|
||||
"STMicroelectronics",
|
||||
1, SENSORS_GYROSCOPE_HANDLE,
|
||||
SENSOR_TYPE_GYROSCOPE, RANGE_GYRO, CONVERT_GYRO, 6.1f, 1190, { } },
|
||||
};
|
||||
|
||||
|
||||
static int open_sensors(const struct hw_module_t* module, const char* id,
|
||||
struct hw_device_t** device);
|
||||
|
||||
|
||||
static int sensors__get_sensors_list(struct sensors_module_t* module,
|
||||
struct sensor_t const** list)
|
||||
{
|
||||
*list = sSensorList;
|
||||
return ARRAY_SIZE(sSensorList);
|
||||
}
|
||||
|
||||
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: "Samsung Sensor module",
|
||||
author: "Samsung Electronic Company",
|
||||
methods: &sensors_module_methods,
|
||||
},
|
||||
get_sensors_list: sensors__get_sensors_list,
|
||||
};
|
||||
|
||||
struct sensors_poll_context_t {
|
||||
struct sensors_poll_device_t device; // must be first
|
||||
|
||||
sensors_poll_context_t();
|
||||
~sensors_poll_context_t();
|
||||
int activate(int handle, int enabled);
|
||||
int setDelay(int handle, int64_t ns);
|
||||
int pollEvents(sensors_event_t* data, int count);
|
||||
|
||||
private:
|
||||
enum {
|
||||
light = 0,
|
||||
proximity = 1,
|
||||
akm = 2,
|
||||
gyro = 3,
|
||||
numSensorDrivers,
|
||||
numFds,
|
||||
};
|
||||
|
||||
static const size_t wake = numFds - 1;
|
||||
static const char WAKE_MESSAGE = 'W';
|
||||
struct pollfd mPollFds[numFds];
|
||||
int mWritePipeFd;
|
||||
SensorBase* mSensors[numSensorDrivers];
|
||||
|
||||
int handleToDriver(int handle) const {
|
||||
switch (handle) {
|
||||
case ID_A:
|
||||
case ID_M:
|
||||
case ID_O:
|
||||
return akm;
|
||||
case ID_P:
|
||||
return proximity;
|
||||
case ID_L:
|
||||
return light;
|
||||
case ID_GY:
|
||||
return gyro;
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
sensors_poll_context_t::sensors_poll_context_t()
|
||||
{
|
||||
mSensors[light] = new LightSensor();
|
||||
mPollFds[light].fd = mSensors[light]->getFd();
|
||||
mPollFds[light].events = POLLIN;
|
||||
mPollFds[light].revents = 0;
|
||||
|
||||
mSensors[proximity] = new ProximitySensor();
|
||||
mPollFds[proximity].fd = mSensors[proximity]->getFd();
|
||||
mPollFds[proximity].events = POLLIN;
|
||||
mPollFds[proximity].revents = 0;
|
||||
|
||||
mSensors[akm] = new AkmSensor();
|
||||
mPollFds[akm].fd = mSensors[akm]->getFd();
|
||||
mPollFds[akm].events = POLLIN;
|
||||
mPollFds[akm].revents = 0;
|
||||
|
||||
mSensors[gyro] = new GyroSensor();
|
||||
mPollFds[gyro].fd = mSensors[gyro]->getFd();
|
||||
mPollFds[gyro].events = POLLIN;
|
||||
mPollFds[gyro].revents = 0;
|
||||
|
||||
int wakeFds[2];
|
||||
int result = pipe(wakeFds);
|
||||
ALOGE_IF(result<0, "error creating wake pipe (%s)", strerror(errno));
|
||||
fcntl(wakeFds[0], F_SETFL, O_NONBLOCK);
|
||||
fcntl(wakeFds[1], F_SETFL, O_NONBLOCK);
|
||||
mWritePipeFd = wakeFds[1];
|
||||
|
||||
mPollFds[wake].fd = wakeFds[0];
|
||||
mPollFds[wake].events = POLLIN;
|
||||
mPollFds[wake].revents = 0;
|
||||
}
|
||||
|
||||
sensors_poll_context_t::~sensors_poll_context_t() {
|
||||
for (int i=0 ; i<numSensorDrivers ; i++) {
|
||||
delete mSensors[i];
|
||||
}
|
||||
close(mPollFds[wake].fd);
|
||||
close(mWritePipeFd);
|
||||
}
|
||||
|
||||
int sensors_poll_context_t::activate(int handle, int enabled) {
|
||||
int index = handleToDriver(handle);
|
||||
if (index < 0) return index;
|
||||
int err = mSensors[index]->enable(handle, enabled);
|
||||
if (enabled && !err) {
|
||||
const char wakeMessage(WAKE_MESSAGE);
|
||||
int result = write(mWritePipeFd, &wakeMessage, 1);
|
||||
ALOGE_IF(result<0, "error sending wake message (%s)", strerror(errno));
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
int sensors_poll_context_t::setDelay(int handle, int64_t ns) {
|
||||
|
||||
int index = handleToDriver(handle);
|
||||
if (index < 0) return index;
|
||||
return mSensors[index]->setDelay(handle, ns);
|
||||
}
|
||||
|
||||
int sensors_poll_context_t::pollEvents(sensors_event_t* data, int count)
|
||||
{
|
||||
int nbEvents = 0;
|
||||
int n = 0;
|
||||
|
||||
do {
|
||||
// see if we have some leftover from the last poll()
|
||||
for (int i=0 ; count && i<numSensorDrivers ; i++) {
|
||||
SensorBase* const sensor(mSensors[i]);
|
||||
if ((mPollFds[i].revents & POLLIN) || (sensor->hasPendingEvents())) {
|
||||
int nb = sensor->readEvents(data, count);
|
||||
if (nb < count) {
|
||||
// no more data for this sensor
|
||||
mPollFds[i].revents = 0;
|
||||
}
|
||||
count -= nb;
|
||||
nbEvents += nb;
|
||||
data += nb;
|
||||
}
|
||||
}
|
||||
|
||||
if (count) {
|
||||
// we still have some room, so try to see if we can get
|
||||
// some events immediately or just wait if we don't have
|
||||
// anything to return
|
||||
n = poll(mPollFds, numFds, nbEvents ? 0 : -1);
|
||||
if (n<0) {
|
||||
ALOGE("poll() failed (%s)", strerror(errno));
|
||||
return -errno;
|
||||
}
|
||||
if (mPollFds[wake].revents & POLLIN) {
|
||||
char msg;
|
||||
int result = read(mPollFds[wake].fd, &msg, 1);
|
||||
ALOGE_IF(result<0, "error reading from wake pipe (%s)", strerror(errno));
|
||||
ALOGE_IF(msg != WAKE_MESSAGE, "unknown message on wake queue (0x%02x)", int(msg));
|
||||
mPollFds[wake].revents = 0;
|
||||
}
|
||||
}
|
||||
// if we have events and space, go read them
|
||||
} while (n && count);
|
||||
|
||||
return nbEvents;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static int poll__close(struct hw_device_t *dev)
|
||||
{
|
||||
sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev;
|
||||
if (ctx) {
|
||||
delete ctx;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int poll__activate(struct sensors_poll_device_t *dev,
|
||||
int handle, int enabled) {
|
||||
sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev;
|
||||
return ctx->activate(handle, enabled);
|
||||
}
|
||||
|
||||
static int poll__setDelay(struct sensors_poll_device_t *dev,
|
||||
int handle, int64_t ns) {
|
||||
sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev;
|
||||
return ctx->setDelay(handle, ns);
|
||||
}
|
||||
|
||||
static int poll__poll(struct sensors_poll_device_t *dev,
|
||||
sensors_event_t* data, int count) {
|
||||
sensors_poll_context_t *ctx = (sensors_poll_context_t *)dev;
|
||||
return ctx->pollEvents(data, count);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Open a new instance of a sensor device using name */
|
||||
static int open_sensors(const struct hw_module_t* module, const char* id,
|
||||
struct hw_device_t** device)
|
||||
{
|
||||
int status = -EINVAL;
|
||||
sensors_poll_context_t *dev = new sensors_poll_context_t();
|
||||
|
||||
memset(&dev->device, 0, sizeof(sensors_poll_device_t));
|
||||
|
||||
dev->device.common.tag = HARDWARE_DEVICE_TAG;
|
||||
dev->device.common.version = 0;
|
||||
dev->device.common.module = const_cast<hw_module_t*>(module);
|
||||
dev->device.common.close = poll__close;
|
||||
dev->device.activate = poll__activate;
|
||||
dev->device.setDelay = poll__setDelay;
|
||||
dev->device.poll = poll__poll;
|
||||
|
||||
*device = &dev->device.common;
|
||||
status = 0;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
144
libsensors/sensors.h
Normal file
@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_SENSORS_H
|
||||
#define ANDROID_SENSORS_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <linux/input.h>
|
||||
|
||||
#include <hardware/hardware.h>
|
||||
#include <hardware/sensors.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
|
||||
|
||||
#define ID_A (0)
|
||||
#define ID_M (1)
|
||||
#define ID_O (2)
|
||||
#define ID_L (3)
|
||||
#define ID_P (4)
|
||||
#define ID_GY (5)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* The SENSORS Module
|
||||
*/
|
||||
|
||||
/* the CM3663 is a binary proximity sensor that triggers around 6 cm on
|
||||
* this hardware */
|
||||
#define PROXIMITY_THRESHOLD_CM 6.0f
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define AKM_DEVICE_NAME "/dev/akm8975"
|
||||
#define CM_DEVICE_NAME "/dev/i2c11" // FIXME Proximity
|
||||
#define LS_DEVICE_NAME "/dev/i2c11" // FIXME Lig
|
||||
|
||||
/*
|
||||
E/Sensors ( 2656): AkmSensor: processing event (type=0, code=0)
|
||||
E/Sensors ( 2656): AkmSensor: processing event (type=2, code=8)
|
||||
E/Sensors ( 2656): AkmSensor: processing event (type=2, code=3)
|
||||
E/Sensors ( 2656): AkmSensor: processing event (type=2, code=4)
|
||||
E/Sensors ( 2656): AkmSensor: processing event (type=2, code=5)
|
||||
E/Sensors ( 2656): AkmSensor: processing event (type=2, code=0)
|
||||
E/Sensors ( 2656): AkmSensor: processing event (type=2, code=1)
|
||||
E/Sensors ( 2656): AkmSensor: processing event (type=2, code=2)
|
||||
E/Sensors ( 2656): AkmSensor: processing event (type=2, code=6)
|
||||
E/Sensors ( 2656): AkmSensor: processing event (type=2, code=7)
|
||||
E/Sensors ( 2656): AkmSensor: processing event (type=2, code=9)
|
||||
E/Sensors ( 2656): AkmSensor: processing event (type=0, code=0)
|
||||
E/Sensors ( 2656): AkmSensor: processing event (type=2, code=8)
|
||||
E/Sensors ( 2656): AkmSensor: processing event (type=2, code=3)
|
||||
E/Sensors ( 2656): AkmSensor: processing event (type=2, code=4)
|
||||
E/Sensors ( 2656): AkmSensor: processing event (type=2, code=5)
|
||||
E/Sensors ( 2656): AkmSensor: processing event (type=2, code=0)
|
||||
E/Sensors ( 2656): AkmSensor: processing event (type=2, code=1)
|
||||
E/Sensors ( 2656): AkmSensor: processing event (type=2, code=2)
|
||||
E/Sensors ( 2656): AkmSensor: processing event (type=2, code=6)
|
||||
E/Sensors ( 2656): AkmSensor: processing event (type=2, code=7)
|
||||
E/Sensors ( 2656): AkmSensor: processing event (type=2, code=9)
|
||||
*/
|
||||
|
||||
// for akm8975
|
||||
#define EVENT_TYPE_ACCEL_X ABS_Y //1
|
||||
#define EVENT_TYPE_ACCEL_Y ABS_X //0
|
||||
#define EVENT_TYPE_ACCEL_Z ABS_Z //2
|
||||
//#define EVENT_TYPE_ACCEL_STATUS ABS_WHEEL //8
|
||||
|
||||
#define EVENT_TYPE_YAW ABS_RX //3
|
||||
#define EVENT_TYPE_PITCH ABS_RY //4
|
||||
#define EVENT_TYPE_ROLL ABS_RZ //5
|
||||
#define EVENT_TYPE_ORIENT_STATUS ABS_WHEEL //8
|
||||
|
||||
#define EVENT_TYPE_MAGV_X ABS_RUDDER // 6
|
||||
#define EVENT_TYPE_MAGV_Y ABS_THROTTLE // 7
|
||||
#define EVENT_TYPE_MAGV_Z ABS_GAS // 9
|
||||
|
||||
#define EVENT_TYPE_TEMPERATURE ABS_THROTTLE
|
||||
#define EVENT_TYPE_STEP_COUNT ABS_GAS
|
||||
#define EVENT_TYPE_PROXIMITY ABS_DISTANCE
|
||||
#define EVENT_TYPE_LIGHT ABS_MISC
|
||||
|
||||
#define EVENT_TYPE_GYRO_X REL_RX
|
||||
#define EVENT_TYPE_GYRO_Y REL_RY
|
||||
#define EVENT_TYPE_GYRO_Z REL_RZ
|
||||
|
||||
// 90 LSB = 1G for KR3DM
|
||||
#define LSB (90.0f)
|
||||
#define NUMOFACCDATA (8.0f)
|
||||
|
||||
// conversion of acceleration data to SI units (m/s^2)
|
||||
#define RANGE_A (2*GRAVITY_EARTH)
|
||||
#define CONVERT_A (GRAVITY_EARTH / LSB / NUMOFACCDATA)
|
||||
#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)
|
||||
|
||||
/* conversion of orientation data to degree units */
|
||||
#define CONVERT_O (1.0f/1000.0f)
|
||||
#define CONVERT_O_A (CONVERT_O)
|
||||
#define CONVERT_O_P (CONVERT_O)
|
||||
#define CONVERT_O_R (CONVERT_O)
|
||||
|
||||
// conversion of gyro data to SI units (radian/sec)
|
||||
#define RANGE_GYRO (500.0f*(float)M_PI/180.0f)
|
||||
#define CONVERT_GYRO ((70.0f / 4000.0f) * ((float)M_PI / 180.0f))
|
||||
#define CONVERT_GYRO_X (CONVERT_GYRO)
|
||||
#define CONVERT_GYRO_Y (CONVERT_GYRO)
|
||||
#define CONVERT_GYRO_Z (CONVERT_GYRO)
|
||||
|
||||
#define SENSOR_STATE_MASK (0x7FFF)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif // ANDROID_SENSORS_H
|
64
lpm.rc
Normal file
@ -0,0 +1,64 @@
|
||||
on early-init
|
||||
start ueventd
|
||||
|
||||
on init
|
||||
export PATH /sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
|
||||
export LD_LIBRARY_PATH /vendor/lib:/system/lib
|
||||
export ANDROID_ROOT /system
|
||||
export ANDROID_DATA /data
|
||||
export ANDROID_CACHE /cache
|
||||
export SECONDARY_STORAGE /mnt/emmc
|
||||
export EXTERNAL_STORAGE /mnt/sdcard
|
||||
|
||||
symlink /system/etc /etc
|
||||
mkdir /mnt 0775 root system
|
||||
|
||||
mkdir /system
|
||||
mkdir /tmp
|
||||
mkdir /mnt 0775 root root
|
||||
|
||||
|
||||
on boot
|
||||
# CPU Frequency Governor
|
||||
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor powersave
|
||||
|
||||
ifup lo
|
||||
hostname localhost
|
||||
domainname localdomain
|
||||
|
||||
class_start default
|
||||
|
||||
service ueventd /sbin/ueventd
|
||||
class core
|
||||
critical
|
||||
|
||||
service console /system/bin/sh
|
||||
class core
|
||||
console
|
||||
|
||||
service adbd /sbin/adbd
|
||||
disabled
|
||||
|
||||
service charger /charger
|
||||
class default
|
||||
user root
|
||||
|
||||
# Always start adbd on userdebug and eng builds
|
||||
# In recovery, always run adbd as root.
|
||||
on property:ro.debuggable=1
|
||||
write /sys/class/android_usb/android0/enable 0
|
||||
write /sys/class/android_usb/android0/idVendor 04e8
|
||||
write /sys/class/android_usb/android0/idProduct 6860
|
||||
write /sys/class/android_usb/android0/functions adb
|
||||
write /sys/class/android_usb/android0/enable 1
|
||||
write /sys/class/android_usb/android0/iManufacturer $ro.product.manufacturer
|
||||
write /sys/class/android_usb/android0/iProduct $ro.product.model
|
||||
write /sys/class/android_usb/android0/iSerial $ro.serialno
|
||||
start adbd
|
||||
setprop service.adb.root 1
|
||||
|
||||
# Restart adbd so it can run as root
|
||||
on property:service.adb.root=1
|
||||
write /sys/class/android_usb/android0/enable 0
|
||||
restart adbd
|
||||
write /sys/class/android_usb/android0/enable 1
|
37
overlay/frameworks/base/core/res/res/values/arrays.xml
Normal file
@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/* //device/apps/common/assets/res/any/colors.xml
|
||||
**
|
||||
** Copyright 2006, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
|
||||
<!-- Defines the shutdown options shown in the reboot dialog. -->
|
||||
<array name="shutdown_reboot_options" translatable="false">
|
||||
<item>@string/reboot_reboot</item>
|
||||
<item>@string/reboot_recovery</item>
|
||||
<item>@string/reboot_download</item>
|
||||
</array>
|
||||
|
||||
<!-- Do not translate. Defines the shutdown actions passed to the kernel.
|
||||
The first item should be empty for regular reboot. -->
|
||||
<string-array name="shutdown_reboot_actions" translatable="false">
|
||||
<item></item>
|
||||
<item>recovery</item>
|
||||
<item>bootloader</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
169
overlay/frameworks/base/core/res/res/values/config.xml
Normal file
@ -0,0 +1,169 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
** Copyright 2011, 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>
|
||||
|
||||
<!-- Our amoled doesn't animate well. -->
|
||||
<bool name="config_animateScreenLights">false</bool>
|
||||
|
||||
<integer name="config_deskDockKeepsScreenOn">0</integer>
|
||||
<integer name="config_carDockKeepsScreenOn">1</integer>
|
||||
|
||||
<!-- If this is true, the screen will come on when you unplug usb/power/whatever. -->
|
||||
<bool name="config_unplugTurnsOnScreen">true</bool>
|
||||
|
||||
<!-- Component name of the service providing network location support. -->
|
||||
<string name="config_networkLocationProviderPackageName">com.google.android.location.NetworkLocationProvider</string>
|
||||
|
||||
<!-- Component name of the service providing geocoder API support. -->
|
||||
<string name="config_geocodeProviderPackageName">com.google.android.location.GeocodeProvider</string>
|
||||
|
||||
<!-- Whether a software navigation bar should be shown. NOTE: in the future this may be
|
||||
autodetected from the Configuration. -->
|
||||
<bool name="config_showNavigationBar">false</bool>
|
||||
|
||||
<!-- XXXXX NOTE THE FOLLOWING RESOURCES USE THE WRONG NAMING CONVENTION.
|
||||
Please don't copy them, copy anything else. -->
|
||||
|
||||
<!-- An Array of "[Connection name],[ConnectivityManager.TYPE_xxxx],
|
||||
[associated radio-type],[priority],[restoral-timer(ms)],[dependencyMet] -->
|
||||
<!-- the 5th element "resore-time" indicates the number of milliseconds to delay
|
||||
before automatically restore the default connection. Set -1 if the connection
|
||||
does not require auto-restore. -->
|
||||
<!-- the 6th element indicates boot-time dependency-met value. -->
|
||||
<string-array translatable="false" name="networkAttributes">
|
||||
<item>"wifi,1,1,1,-1,true"</item>
|
||||
<item>"mobile,0,0,0,-1,true"</item>
|
||||
<item>"mobile_mms,2,0,2,60000,true"</item>
|
||||
<item>"mobile_supl,3,0,2,60000,true"</item>
|
||||
<item>"mobile_dun,4,0,3,60000,true"</item>
|
||||
<item>"mobile_hipri,5,0,3,60000,true"</item>
|
||||
<item>"mobile_bluetooth,7,7,1,-1,true"</item>
|
||||
<item>"wifi_p2p,13,1,0,-1,true"</item>
|
||||
</string-array>
|
||||
|
||||
<!-- An Array of "[ConnectivityManager connectionType],
|
||||
[# simultaneous connection types]" -->
|
||||
<string-array translatable="false" name="radioAttributes">
|
||||
<item>"1,1"</item>
|
||||
<item>"0,1"</item>
|
||||
<item>"7,1"</item>
|
||||
</string-array>
|
||||
|
||||
<!-- List of regexpressions describing the interface (if any) that represent tetherable
|
||||
USB interfaces. If the device doesn't want to support tething over USB this should
|
||||
be empty. An example would be "usb.*" -->
|
||||
<string-array translatable="false" name="config_tether_usb_regexs">
|
||||
<item>"rndis0"</item>
|
||||
</string-array>
|
||||
|
||||
<!-- List of regexpressions describing the interface (if any) that represent tetherable
|
||||
Wifi interfaces. If the device doesn't want to support tethering over Wifi this
|
||||
should be empty. An example would be "softap.*" -->
|
||||
<string-array translatable="false" name="config_tether_wifi_regexs">
|
||||
<item>"wlan0"</item>
|
||||
</string-array>
|
||||
|
||||
<!-- List of regexpressions describing the interface (if any) that represent tetherable
|
||||
bluetooth interfaces. If the device doesn't want to support tethering over bluetooth this
|
||||
should be empty. -->
|
||||
<string-array translatable="false" name="config_tether_bluetooth_regexs">
|
||||
<item>"bnep\\d"</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
|
||||
<!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
|
||||
<!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
|
||||
<integer-array translatable="false" name="config_tether_upstream_types">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>5</item>
|
||||
<item>7</item>
|
||||
</integer-array>
|
||||
|
||||
<!-- Boolean indicating whether the wifi chipset has dual frequency band support -->
|
||||
<bool translatable="false" name="config_wifi_dual_band_support">true</bool>
|
||||
|
||||
<!-- Boolean indicating whether the wifi chipset has p2p support -->
|
||||
<bool translatable="false" name="config_wifi_p2p_support">true</bool>
|
||||
|
||||
<!-- Boolean indicating whether the wifi chipset has background scan support -->
|
||||
<bool translatable="false" name="config_wifi_background_scan_support">true</bool>
|
||||
|
||||
<bool name="config_ui_enableFadingMarquee">false</bool>
|
||||
|
||||
<!-- Vibrator pattern for feedback about a long screen/key press -->
|
||||
<integer-array name="config_longPressVibePattern">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>20</item>
|
||||
<item>21</item>
|
||||
</integer-array>
|
||||
|
||||
<!-- Vibrator pattern for feedback about touching a virtual key -->
|
||||
<integer-array name="config_virtualKeyVibePattern">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>20</item>
|
||||
<item>21</item>
|
||||
</integer-array>
|
||||
|
||||
<!-- Vibrator pattern for a very short but reliable vibration for soft keyboard tap -->
|
||||
<integer-array name="config_keyboardTapVibePattern">
|
||||
<item>20</item>
|
||||
</integer-array>
|
||||
|
||||
<!-- Vibrator pattern for feedback about booting with safe mode disabled -->
|
||||
<integer-array name="config_safeModeDisabledVibePattern">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>20</item>
|
||||
<item>21</item>
|
||||
</integer-array>
|
||||
|
||||
<!-- Vibrator pattern for feedback about booting with safe mode disabled -->
|
||||
<integer-array name="config_safeModeEnabledVibePattern">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>20</item>
|
||||
<item>21</item>
|
||||
<item>500</item>
|
||||
<item>600</item>
|
||||
</integer-array>
|
||||
|
||||
<!-- Vibrator pattern for feedback about hitting a scroll barrier -->
|
||||
<integer-array name="config_scrollBarrierVibePattern">
|
||||
<item>0</item>
|
||||
<item>15</item>
|
||||
<item>10</item>
|
||||
<item>10</item>
|
||||
</integer-array>
|
||||
|
||||
<!-- The default iface on which to monitor data use -->
|
||||
<string name="config_datause_iface">pdp0</string>
|
||||
|
||||
<!-- Allow the menu hard key to be disabled in LockScreen on some devices -->
|
||||
<bool name="config_disableMenuKeyInLockScreen">true</bool>
|
||||
|
||||
<!-- Workaround for devices with broken keyboards -->
|
||||
<bool name="config_forceDisableHardwareKeyboard">true</bool>
|
||||
|
||||
</resources>
|
59
overlay/frameworks/base/core/res/res/xml/power_profile.xml
Normal file
@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
**
|
||||
** Copyright 2011, 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">
|
||||
<!-- All values are in mA except as noted -->
|
||||
<item name="none">0</item>
|
||||
<item name="screen.on">200</item> <!-- min brite -->
|
||||
<item name="bluetooth.active">150</item>
|
||||
<item name="bluetooth.on">1</item>
|
||||
<item name="bluetooth.at">1</item> <!-- TBD -->
|
||||
<item name="screen.full">160</item> <!-- 360 max on calendar -->
|
||||
<item name="wifi.on">1</item>
|
||||
<item name="wifi.active">150</item>
|
||||
<item name="wifi.scan">200</item>
|
||||
<item name="dsp.audio">150</item>
|
||||
<item name="dsp.video">200</item>
|
||||
<item name="radio.active">150</item>
|
||||
<item name="gps.on">55</item>
|
||||
<item name="battery.capacity">1750</item>
|
||||
<item name="radio.scanning">90</item> <!-- TBD -->
|
||||
<!-- Current consumed by the radio at different signal strengths, when paging -->
|
||||
<array name="radio.on"> <!-- 1 entry per signal strength bin, TBD -->
|
||||
<value>3.0</value>
|
||||
<value>3.0</value>
|
||||
</array>
|
||||
<array name="cpu.speeds">
|
||||
<value>350000</value>
|
||||
<value>700000</value>
|
||||
<value>920000</value>
|
||||
<value>1200000</value>
|
||||
</array>
|
||||
<!-- Power consumption in suspend -->
|
||||
<item name="cpu.idle">7</item>
|
||||
<!-- Power consumption due to wake lock held -->
|
||||
<item name="cpu.awake">20</item>
|
||||
<!-- Power consumption at different speeds -->
|
||||
<array name="cpu.active">
|
||||
<value>120</value>
|
||||
<value>228</value>
|
||||
<value>299</value>
|
||||
<value>397</value>
|
||||
</array>
|
||||
</device>
|
51
overlay/frameworks/base/core/res/res/xml/storage_list.xml
Normal file
@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
**
|
||||
** Copyright 2011, 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<!-- The <device> element should contain one or more <storage> elements.
|
||||
Exactly one of these should have the attribute primary="true".
|
||||
This storage will be the primary external storage and should have path="/mnt/sdcard".
|
||||
Each storage should have both a path and description attribute set.
|
||||
The following boolean attributes are optional:
|
||||
|
||||
primary: this storage is the primary external storage
|
||||
removable: this is removable storage (for example, a real SD card)
|
||||
emulated: the storage is emulated via the FUSE sdcard daemon
|
||||
mtp-reserve: number of megabytes of storage MTP should reserve for free storage
|
||||
(used for emulated storage that is shared with system's data partition)
|
||||
|
||||
A storage should not have both emulated and removable set to true
|
||||
-->
|
||||
|
||||
<StorageList xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<storage android:mountPoint="/storage/sdcard0"
|
||||
android:storageDescription="@string/storage_internal"
|
||||
android:primary="true"
|
||||
android:removable="false" />
|
||||
|
||||
<storage android:mountPoint="/storage/sdcard1"
|
||||
android:storageDescription="@string/storage_sd_card"
|
||||
android:primary="false"
|
||||
android:removable="false" />
|
||||
|
||||
<storage android:mountPoint="/storage/usbdisk0"
|
||||
android:storageDescription="@string/storage_usb"
|
||||
android:primary="false"
|
||||
android:removable="true" />
|
||||
|
||||
</StorageList>
|
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright (c) 2011, 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>
|
||||
<!-- Screen timeout default = 30 seconds -->
|
||||
<integer name="def_screen_off_timeout">30000</integer>
|
||||
</resources>
|
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
** Copyright 2011, The CyanogenMod Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
-->
|
||||
|
||||
<!-- These resources are around just to allow their values to be customized
|
||||
for different hardware and product builds. -->
|
||||
<resources>
|
||||
<!-- Control whether status bar should distinguish HSPA data icon form UMTS data icon on devices -->
|
||||
<bool name="config_hspa_data_distinguishable">true</bool>
|
||||
</resources>
|
||||
|
686
overlay/include/hardware/gps.h
Normal file
@ -0,0 +1,686 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_INCLUDE_HARDWARE_GPS_H
|
||||
#define ANDROID_INCLUDE_HARDWARE_GPS_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <hardware/hardware.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* The id of this module
|
||||
*/
|
||||
#define GPS_HARDWARE_MODULE_ID "gps"
|
||||
|
||||
|
||||
/** Milliseconds since January 1, 1970 */
|
||||
typedef int64_t GpsUtcTime;
|
||||
|
||||
/** Maximum number of SVs for gps_sv_status_callback(). */
|
||||
#define GPS_MAX_SVS 32
|
||||
|
||||
/** Requested operational mode for GPS operation. */
|
||||
typedef uint32_t GpsPositionMode;
|
||||
// IMPORTANT: Note that the following values must match
|
||||
// constants in GpsLocationProvider.java.
|
||||
/** Mode for running GPS standalone (no assistance). */
|
||||
#define GPS_POSITION_MODE_STANDALONE 0
|
||||
/** AGPS MS-Based mode. */
|
||||
#define GPS_POSITION_MODE_MS_BASED 1
|
||||
/** AGPS MS-Assisted mode. */
|
||||
#define GPS_POSITION_MODE_MS_ASSISTED 2
|
||||
|
||||
/** Requested recurrence mode for GPS operation. */
|
||||
typedef uint32_t GpsPositionRecurrence;
|
||||
// IMPORTANT: Note that the following values must match
|
||||
// constants in GpsLocationProvider.java.
|
||||
/** Receive GPS fixes on a recurring basis at a specified period. */
|
||||
#define GPS_POSITION_RECURRENCE_PERIODIC 0
|
||||
/** Request a single shot GPS fix. */
|
||||
#define GPS_POSITION_RECURRENCE_SINGLE 1
|
||||
|
||||
/** GPS status event values. */
|
||||
typedef uint16_t GpsStatusValue;
|
||||
// IMPORTANT: Note that the following values must match
|
||||
// constants in GpsLocationProvider.java.
|
||||
/** GPS status unknown. */
|
||||
#define GPS_STATUS_NONE 0
|
||||
/** GPS has begun navigating. */
|
||||
#define GPS_STATUS_SESSION_BEGIN 1
|
||||
/** GPS has stopped navigating. */
|
||||
#define GPS_STATUS_SESSION_END 2
|
||||
/** GPS has powered on but is not navigating. */
|
||||
#define GPS_STATUS_ENGINE_ON 3
|
||||
/** GPS is powered off. */
|
||||
#define GPS_STATUS_ENGINE_OFF 4
|
||||
|
||||
/** Flags to indicate which values are valid in a GpsLocation. */
|
||||
typedef uint16_t GpsLocationFlags;
|
||||
// IMPORTANT: Note that the following values must match
|
||||
// constants in GpsLocationProvider.java.
|
||||
/** GpsLocation has valid latitude and longitude. */
|
||||
#define GPS_LOCATION_HAS_LAT_LONG 0x0001
|
||||
/** GpsLocation has valid altitude. */
|
||||
#define GPS_LOCATION_HAS_ALTITUDE 0x0002
|
||||
/** GpsLocation has valid speed. */
|
||||
#define GPS_LOCATION_HAS_SPEED 0x0004
|
||||
/** GpsLocation has valid bearing. */
|
||||
#define GPS_LOCATION_HAS_BEARING 0x0008
|
||||
/** GpsLocation has valid accuracy. */
|
||||
#define GPS_LOCATION_HAS_ACCURACY 0x0010
|
||||
|
||||
/** Flags for the gps_set_capabilities callback. */
|
||||
|
||||
/** GPS HAL schedules fixes for GPS_POSITION_RECURRENCE_PERIODIC mode.
|
||||
If this is not set, then the framework will use 1000ms for min_interval
|
||||
and will start and call start() and stop() to schedule the GPS.
|
||||
*/
|
||||
#define GPS_CAPABILITY_SCHEDULING 0x0000001
|
||||
/** GPS supports MS-Based AGPS mode */
|
||||
#define GPS_CAPABILITY_MSB 0x0000002
|
||||
/** GPS supports MS-Assisted AGPS mode */
|
||||
#define GPS_CAPABILITY_MSA 0x0000004
|
||||
/** GPS supports single-shot fixes */
|
||||
#define GPS_CAPABILITY_SINGLE_SHOT 0x0000008
|
||||
/** GPS supports on demand time injection */
|
||||
#define GPS_CAPABILITY_ON_DEMAND_TIME 0x0000010
|
||||
|
||||
/** Flags used to specify which aiding data to delete
|
||||
when calling delete_aiding_data(). */
|
||||
typedef uint16_t GpsAidingData;
|
||||
// IMPORTANT: Note that the following values must match
|
||||
// constants in GpsLocationProvider.java.
|
||||
#define GPS_DELETE_EPHEMERIS 0x0001
|
||||
#define GPS_DELETE_ALMANAC 0x0002
|
||||
#define GPS_DELETE_POSITION 0x0004
|
||||
#define GPS_DELETE_TIME 0x0008
|
||||
#define GPS_DELETE_IONO 0x0010
|
||||
#define GPS_DELETE_UTC 0x0020
|
||||
#define GPS_DELETE_HEALTH 0x0040
|
||||
#define GPS_DELETE_SVDIR 0x0080
|
||||
#define GPS_DELETE_SVSTEER 0x0100
|
||||
#define GPS_DELETE_SADATA 0x0200
|
||||
#define GPS_DELETE_RTI 0x0400
|
||||
#define GPS_DELETE_CELLDB_INFO 0x8000
|
||||
#define GPS_DELETE_ALL 0xFFFF
|
||||
|
||||
/** AGPS type */
|
||||
typedef uint16_t AGpsType;
|
||||
#define AGPS_TYPE_SUPL 1
|
||||
#define AGPS_TYPE_C2K 2
|
||||
|
||||
typedef uint16_t AGpsSetIDType;
|
||||
#define AGPS_SETID_TYPE_NONE 0
|
||||
#define AGPS_SETID_TYPE_IMSI 1
|
||||
#define AGPS_SETID_TYPE_MSISDN 2
|
||||
|
||||
/**
|
||||
* String length constants
|
||||
*/
|
||||
#define GPS_NI_SHORT_STRING_MAXLEN 256
|
||||
#define GPS_NI_LONG_STRING_MAXLEN 2048
|
||||
|
||||
/**
|
||||
* GpsNiType constants
|
||||
*/
|
||||
typedef uint32_t GpsNiType;
|
||||
#define GPS_NI_TYPE_VOICE 1
|
||||
#define GPS_NI_TYPE_UMTS_SUPL 2
|
||||
#define GPS_NI_TYPE_UMTS_CTRL_PLANE 3
|
||||
|
||||
/**
|
||||
* GpsNiNotifyFlags constants
|
||||
*/
|
||||
typedef uint32_t GpsNiNotifyFlags;
|
||||
/** NI requires notification */
|
||||
#define GPS_NI_NEED_NOTIFY 0x0001
|
||||
/** NI requires verification */
|
||||
#define GPS_NI_NEED_VERIFY 0x0002
|
||||
/** NI requires privacy override, no notification/minimal trace */
|
||||
#define GPS_NI_PRIVACY_OVERRIDE 0x0004
|
||||
|
||||
/**
|
||||
* GPS NI responses, used to define the response in
|
||||
* NI structures
|
||||
*/
|
||||
typedef int GpsUserResponseType;
|
||||
#define GPS_NI_RESPONSE_ACCEPT 1
|
||||
#define GPS_NI_RESPONSE_DENY 2
|
||||
#define GPS_NI_RESPONSE_NORESP 3
|
||||
|
||||
/**
|
||||
* NI data encoding scheme
|
||||
*/
|
||||
typedef int GpsNiEncodingType;
|
||||
#define GPS_ENC_NONE 0
|
||||
#define GPS_ENC_SUPL_GSM_DEFAULT 1
|
||||
#define GPS_ENC_SUPL_UTF8 2
|
||||
#define GPS_ENC_SUPL_UCS2 3
|
||||
#define GPS_ENC_UNKNOWN -1
|
||||
|
||||
/** AGPS status event values. */
|
||||
typedef uint16_t AGpsStatusValue;
|
||||
/** GPS requests data connection for AGPS. */
|
||||
#define GPS_REQUEST_AGPS_DATA_CONN 1
|
||||
/** GPS releases the AGPS data connection. */
|
||||
#define GPS_RELEASE_AGPS_DATA_CONN 2
|
||||
/** AGPS data connection initiated */
|
||||
#define GPS_AGPS_DATA_CONNECTED 3
|
||||
/** AGPS data connection completed */
|
||||
#define GPS_AGPS_DATA_CONN_DONE 4
|
||||
/** AGPS data connection failed */
|
||||
#define GPS_AGPS_DATA_CONN_FAILED 5
|
||||
|
||||
#define AGPS_REF_LOCATION_TYPE_GSM_CELLID 1
|
||||
#define AGPS_REF_LOCATION_TYPE_UMTS_CELLID 2
|
||||
#define AGPS_REG_LOCATION_TYPE_MAC 3
|
||||
|
||||
/** Network types for update_network_state "type" parameter */
|
||||
#define AGPS_RIL_NETWORK_TYPE_MOBILE 0
|
||||
#define AGPS_RIL_NETWORK_TYPE_WIFI 1
|
||||
#define AGPS_RIL_NETWORK_TYPE_MOBILE_MMS 2
|
||||
#define AGPS_RIL_NETWORK_TYPE_MOBILE_SUPL 3
|
||||
#define AGPS_RIL_NETWORK_TTYPE_MOBILE_DUN 4
|
||||
#define AGPS_RIL_NETWORK_TTYPE_MOBILE_HIPRI 5
|
||||
#define AGPS_RIL_NETWORK_TTYPE_WIMAX 6
|
||||
|
||||
/**
|
||||
* Name for the GPS XTRA interface.
|
||||
*/
|
||||
#define GPS_XTRA_INTERFACE "gps-xtra"
|
||||
|
||||
/**
|
||||
* Name for the GPS DEBUG interface.
|
||||
*/
|
||||
#define GPS_DEBUG_INTERFACE "gps-debug"
|
||||
|
||||
/**
|
||||
* Name for the AGPS interface.
|
||||
*/
|
||||
#define AGPS_INTERFACE "agps"
|
||||
|
||||
/**
|
||||
* Name for NI interface
|
||||
*/
|
||||
#define GPS_NI_INTERFACE "gps-ni"
|
||||
|
||||
/**
|
||||
* Name for the AGPS-RIL interface.
|
||||
*/
|
||||
#define AGPS_RIL_INTERFACE "agps_ril"
|
||||
|
||||
/** Represents a location. */
|
||||
typedef struct {
|
||||
/** set to sizeof(GpsLocation) */
|
||||
size_t size;
|
||||
/** Contains GpsLocationFlags bits. */
|
||||
uint16_t flags;
|
||||
/** Represents latitude in degrees. */
|
||||
double latitude;
|
||||
/** Represents longitude in degrees. */
|
||||
double longitude;
|
||||
/** Represents altitude in meters above the WGS 84 reference
|
||||
* ellipsoid. */
|
||||
double altitude;
|
||||
/** Represents speed in meters per second. */
|
||||
float speed;
|
||||
/** Represents heading in degrees. */
|
||||
float bearing;
|
||||
/** Represents expected accuracy in meters. */
|
||||
float accuracy;
|
||||
/** Timestamp for the location fix. */
|
||||
GpsUtcTime timestamp;
|
||||
} GpsLocation;
|
||||
|
||||
/** Represents the status. */
|
||||
typedef struct {
|
||||
/** set to sizeof(GpsStatus) */
|
||||
size_t size;
|
||||
GpsStatusValue status;
|
||||
} GpsStatus;
|
||||
|
||||
/** Represents SV information. */
|
||||
typedef struct {
|
||||
/** set to sizeof(GpsSvInfo) */
|
||||
size_t size;
|
||||
/** Pseudo-random number for the SV. */
|
||||
int prn;
|
||||
/** Signal to noise ratio. */
|
||||
float snr;
|
||||
/** Elevation of SV in degrees. */
|
||||
float elevation;
|
||||
/** Azimuth of SV in degrees. */
|
||||
float azimuth;
|
||||
/** Unknown field in Samsung I9100 libgps
|
||||
May be an indicator for constellation type
|
||||
(GPS, GLONASS, Galileo)?
|
||||
Used on GT-I9100, likely also present on GT-N7000,
|
||||
SGH-I717, SGH-I727 but this needs confirmation.
|
||||
*/
|
||||
int unknown_samsung_field;
|
||||
} GpsSvInfo;
|
||||
|
||||
/** Represents SV status. */
|
||||
typedef struct {
|
||||
/** set to sizeof(GpsSvStatus) */
|
||||
size_t size;
|
||||
|
||||
/** Number of SVs currently visible. */
|
||||
int num_svs;
|
||||
|
||||
/** Contains an array of SV information. */
|
||||
GpsSvInfo sv_list[GPS_MAX_SVS];
|
||||
|
||||
/** Represents a bit mask indicating which SVs
|
||||
* have ephemeris data.
|
||||
*/
|
||||
uint32_t ephemeris_mask;
|
||||
|
||||
/** Represents a bit mask indicating which SVs
|
||||
* have almanac data.
|
||||
*/
|
||||
uint32_t almanac_mask;
|
||||
|
||||
/**
|
||||
* Represents a bit mask indicating which SVs
|
||||
* were used for computing the most recent position fix.
|
||||
*/
|
||||
uint32_t used_in_fix_mask;
|
||||
} GpsSvStatus;
|
||||
|
||||
/* 2G and 3G */
|
||||
/* In 3G lac is discarded */
|
||||
typedef struct {
|
||||
uint16_t type;
|
||||
uint16_t mcc;
|
||||
uint16_t mnc;
|
||||
uint16_t lac;
|
||||
uint32_t cid;
|
||||
} AGpsRefLocationCellID;
|
||||
|
||||
typedef struct {
|
||||
uint8_t mac[6];
|
||||
} AGpsRefLocationMac;
|
||||
|
||||
/** Represents ref locations */
|
||||
typedef struct {
|
||||
uint16_t type;
|
||||
union {
|
||||
AGpsRefLocationCellID cellID;
|
||||
AGpsRefLocationMac mac;
|
||||
} u;
|
||||
} AGpsRefLocation;
|
||||
|
||||
/** Callback with location information.
|
||||
* Can only be called from a thread created by create_thread_cb.
|
||||
*/
|
||||
typedef void (* gps_location_callback)(GpsLocation* location);
|
||||
|
||||
/** Callback with status information.
|
||||
* Can only be called from a thread created by create_thread_cb.
|
||||
*/
|
||||
typedef void (* gps_status_callback)(GpsStatus* status);
|
||||
|
||||
/** Callback with SV status information.
|
||||
* Can only be called from a thread created by create_thread_cb.
|
||||
*/
|
||||
typedef void (* gps_sv_status_callback)(GpsSvStatus* sv_info);
|
||||
|
||||
/** Callback for reporting NMEA sentences.
|
||||
* Can only be called from a thread created by create_thread_cb.
|
||||
*/
|
||||
typedef void (* gps_nmea_callback)(GpsUtcTime timestamp, const char* nmea, int length);
|
||||
|
||||
/** Callback to inform framework of the GPS engine's capabilities.
|
||||
* Capability parameter is a bit field of GPS_CAPABILITY_* flags.
|
||||
*/
|
||||
typedef void (* gps_set_capabilities)(uint32_t capabilities);
|
||||
|
||||
/** Callback utility for acquiring the GPS wakelock.
|
||||
* This can be used to prevent the CPU from suspending while handling GPS events.
|
||||
*/
|
||||
typedef void (* gps_acquire_wakelock)();
|
||||
|
||||
/** Callback utility for releasing the GPS wakelock. */
|
||||
typedef void (* gps_release_wakelock)();
|
||||
|
||||
/** Callback for requesting NTP time */
|
||||
typedef void (* gps_request_utc_time)();
|
||||
|
||||
/** Callback for creating a thread that can call into the Java framework code.
|
||||
* This must be used to create any threads that report events up to the framework.
|
||||
*/
|
||||
typedef pthread_t (* gps_create_thread)(const char* name, void (*start)(void *), void* arg);
|
||||
|
||||
/** GPS callback structure. */
|
||||
typedef struct {
|
||||
/** set to sizeof(GpsCallbacks) */
|
||||
size_t size;
|
||||
gps_location_callback location_cb;
|
||||
gps_status_callback status_cb;
|
||||
gps_sv_status_callback sv_status_cb;
|
||||
gps_nmea_callback nmea_cb;
|
||||
gps_set_capabilities set_capabilities_cb;
|
||||
gps_acquire_wakelock acquire_wakelock_cb;
|
||||
gps_release_wakelock release_wakelock_cb;
|
||||
gps_create_thread create_thread_cb;
|
||||
gps_request_utc_time request_utc_time_cb;
|
||||
} GpsCallbacks;
|
||||
|
||||
|
||||
/** Represents the standard GPS interface. */
|
||||
typedef struct {
|
||||
/** set to sizeof(GpsInterface) */
|
||||
size_t size;
|
||||
/**
|
||||
* Opens the interface and provides the callback routines
|
||||
* to the implemenation of this interface.
|
||||
*/
|
||||
int (*init)( GpsCallbacks* callbacks );
|
||||
|
||||
/** Starts navigating. */
|
||||
int (*start)( void );
|
||||
|
||||
/** Stops navigating. */
|
||||
int (*stop)( void );
|
||||
|
||||
/** Closes the interface. */
|
||||
void (*cleanup)( void );
|
||||
|
||||
/** Injects the current time. */
|
||||
int (*inject_time)(GpsUtcTime time, int64_t timeReference,
|
||||
int uncertainty);
|
||||
|
||||
/** Injects current location from another location provider
|
||||
* (typically cell ID).
|
||||
* latitude and longitude are measured in degrees
|
||||
* expected accuracy is measured in meters
|
||||
*/
|
||||
int (*inject_location)(double latitude, double longitude, float accuracy);
|
||||
|
||||
/**
|
||||
* Specifies that the next call to start will not use the
|
||||
* information defined in the flags. GPS_DELETE_ALL is passed for
|
||||
* a cold start.
|
||||
*/
|
||||
void (*delete_aiding_data)(GpsAidingData flags);
|
||||
|
||||
/**
|
||||
* min_interval represents the time between fixes in milliseconds.
|
||||
* preferred_accuracy represents the requested fix accuracy in meters.
|
||||
* preferred_time represents the requested time to first fix in milliseconds.
|
||||
*/
|
||||
int (*set_position_mode)(GpsPositionMode mode, GpsPositionRecurrence recurrence,
|
||||
uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time);
|
||||
|
||||
/** Get a pointer to extension information. */
|
||||
const void* (*get_extension)(const char* name);
|
||||
} GpsInterface;
|
||||
|
||||
/** Callback to request the client to download XTRA data.
|
||||
* The client should download XTRA data and inject it by calling inject_xtra_data().
|
||||
* Can only be called from a thread created by create_thread_cb.
|
||||
*/
|
||||
typedef void (* gps_xtra_download_request)();
|
||||
|
||||
/** Callback structure for the XTRA interface. */
|
||||
typedef struct {
|
||||
gps_xtra_download_request download_request_cb;
|
||||
gps_create_thread create_thread_cb;
|
||||
} GpsXtraCallbacks;
|
||||
|
||||
/** Extended interface for XTRA support. */
|
||||
typedef struct {
|
||||
/** set to sizeof(GpsXtraInterface) */
|
||||
size_t size;
|
||||
/**
|
||||
* Opens the XTRA interface and provides the callback routines
|
||||
* to the implemenation of this interface.
|
||||
*/
|
||||
int (*init)( GpsXtraCallbacks* callbacks );
|
||||
/** Injects XTRA data into the GPS. */
|
||||
int (*inject_xtra_data)( char* data, int length );
|
||||
} GpsXtraInterface;
|
||||
|
||||
/** Extended interface for DEBUG support. */
|
||||
typedef struct {
|
||||
/** set to sizeof(GpsDebugInterface) */
|
||||
size_t size;
|
||||
|
||||
/**
|
||||
* This function should return any information that the native
|
||||
* implementation wishes to include in a bugreport.
|
||||
*/
|
||||
size_t (*get_internal_state)(char* buffer, size_t bufferSize);
|
||||
} GpsDebugInterface;
|
||||
|
||||
/** Represents the status of AGPS. */
|
||||
typedef struct {
|
||||
/** set to sizeof(AGpsStatus) */
|
||||
size_t size;
|
||||
|
||||
AGpsType type;
|
||||
AGpsStatusValue status;
|
||||
uint32_t ipaddr;
|
||||
} AGpsStatus;
|
||||
|
||||
/** Callback with AGPS status information.
|
||||
* Can only be called from a thread created by create_thread_cb.
|
||||
*/
|
||||
typedef void (* agps_status_callback)(AGpsStatus* status);
|
||||
|
||||
/** Callback structure for the AGPS interface. */
|
||||
typedef struct {
|
||||
agps_status_callback status_cb;
|
||||
gps_create_thread create_thread_cb;
|
||||
} AGpsCallbacks;
|
||||
|
||||
|
||||
/** Extended interface for AGPS support. */
|
||||
typedef struct {
|
||||
/** set to sizeof(AGpsInterface) */
|
||||
size_t size;
|
||||
|
||||
/**
|
||||
* Opens the AGPS interface and provides the callback routines
|
||||
* to the implemenation of this interface.
|
||||
*/
|
||||
void (*init)( AGpsCallbacks* callbacks );
|
||||
/**
|
||||
* Notifies that a data connection is available and sets
|
||||
* the name of the APN to be used for SUPL.
|
||||
*/
|
||||
int (*data_conn_open)( const char* apn );
|
||||
/**
|
||||
* Notifies that the AGPS data connection has been closed.
|
||||
*/
|
||||
int (*data_conn_closed)();
|
||||
/**
|
||||
* Notifies that a data connection is not available for AGPS.
|
||||
*/
|
||||
int (*data_conn_failed)();
|
||||
/**
|
||||
* Sets the hostname and port for the AGPS server.
|
||||
*/
|
||||
int (*set_server)( AGpsType type, const char* hostname, int port );
|
||||
} AGpsInterface;
|
||||
|
||||
|
||||
/** Represents an NI request */
|
||||
typedef struct {
|
||||
/** set to sizeof(GpsNiNotification) */
|
||||
size_t size;
|
||||
|
||||
/**
|
||||
* An ID generated by HAL to associate NI notifications and UI
|
||||
* responses
|
||||
*/
|
||||
int notification_id;
|
||||
|
||||
/**
|
||||
* An NI type used to distinguish different categories of NI
|
||||
* events, such as GPS_NI_TYPE_VOICE, GPS_NI_TYPE_UMTS_SUPL, ...
|
||||
*/
|
||||
GpsNiType ni_type;
|
||||
|
||||
/**
|
||||
* Notification/verification options, combinations of GpsNiNotifyFlags constants
|
||||
*/
|
||||
GpsNiNotifyFlags notify_flags;
|
||||
|
||||
/**
|
||||
* Timeout period to wait for user response.
|
||||
* Set to 0 for no time out limit.
|
||||
*/
|
||||
int timeout;
|
||||
|
||||
/**
|
||||
* Default response when time out.
|
||||
*/
|
||||
GpsUserResponseType default_response;
|
||||
|
||||
/**
|
||||
* Requestor ID
|
||||
*/
|
||||
char requestor_id[GPS_NI_SHORT_STRING_MAXLEN];
|
||||
|
||||
/**
|
||||
* Notification message. It can also be used to store client_id in some cases
|
||||
*/
|
||||
char text[GPS_NI_LONG_STRING_MAXLEN];
|
||||
|
||||
/**
|
||||
* Client name decoding scheme
|
||||
*/
|
||||
GpsNiEncodingType requestor_id_encoding;
|
||||
|
||||
/**
|
||||
* Client name decoding scheme
|
||||
*/
|
||||
GpsNiEncodingType text_encoding;
|
||||
|
||||
/**
|
||||
* A pointer to extra data. Format:
|
||||
* key_1 = value_1
|
||||
* key_2 = value_2
|
||||
*/
|
||||
char extras[GPS_NI_LONG_STRING_MAXLEN];
|
||||
|
||||
} GpsNiNotification;
|
||||
|
||||
/** Callback with NI notification.
|
||||
* Can only be called from a thread created by create_thread_cb.
|
||||
*/
|
||||
typedef void (*gps_ni_notify_callback)(GpsNiNotification *notification);
|
||||
|
||||
/** GPS NI callback structure. */
|
||||
typedef struct
|
||||
{
|
||||
/**
|
||||
* Sends the notification request from HAL to GPSLocationProvider.
|
||||
*/
|
||||
gps_ni_notify_callback notify_cb;
|
||||
gps_create_thread create_thread_cb;
|
||||
} GpsNiCallbacks;
|
||||
|
||||
/**
|
||||
* Extended interface for Network-initiated (NI) support.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/** set to sizeof(GpsNiInterface) */
|
||||
size_t size;
|
||||
|
||||
/** Registers the callbacks for HAL to use. */
|
||||
void (*init) (GpsNiCallbacks *callbacks);
|
||||
|
||||
/** Sends a response to HAL. */
|
||||
void (*respond) (int notif_id, GpsUserResponseType user_response);
|
||||
} GpsNiInterface;
|
||||
|
||||
struct gps_device_t {
|
||||
struct hw_device_t common;
|
||||
|
||||
/**
|
||||
* Set the provided lights to the provided values.
|
||||
*
|
||||
* Returns: 0 on succes, error code on failure.
|
||||
*/
|
||||
const GpsInterface* (*get_gps_interface)(struct gps_device_t* dev);
|
||||
};
|
||||
|
||||
#define AGPS_RIL_REQUEST_SETID_IMSI (1<<0L)
|
||||
#define AGPS_RIL_REQUEST_SETID_MSISDN (1<<1L)
|
||||
|
||||
#define AGPS_RIL_REQUEST_REFLOC_CELLID (1<<0L)
|
||||
#define AGPS_RIL_REQUEST_REFLOC_MAC (1<<1L)
|
||||
|
||||
typedef void (*agps_ril_request_set_id)(uint32_t flags);
|
||||
typedef void (*agps_ril_request_ref_loc)(uint32_t flags);
|
||||
|
||||
typedef struct {
|
||||
agps_ril_request_set_id request_setid;
|
||||
agps_ril_request_ref_loc request_refloc;
|
||||
gps_create_thread create_thread_cb;
|
||||
} AGpsRilCallbacks;
|
||||
|
||||
/** Extended interface for AGPS_RIL support. */
|
||||
typedef struct {
|
||||
/** set to sizeof(AGpsRilInterface) */
|
||||
size_t size;
|
||||
/**
|
||||
* Opens the AGPS interface and provides the callback routines
|
||||
* to the implemenation of this interface.
|
||||
*/
|
||||
void (*init)( AGpsRilCallbacks* callbacks );
|
||||
|
||||
/**
|
||||
* Sets the reference location.
|
||||
*/
|
||||
void (*set_ref_location) (const AGpsRefLocation *agps_reflocation, size_t sz_struct);
|
||||
/**
|
||||
* Sets the set ID.
|
||||
*/
|
||||
void (*set_set_id) (AGpsSetIDType type, const char* setid);
|
||||
|
||||
/**
|
||||
* Send network initiated message.
|
||||
*/
|
||||
void (*ni_message) (uint8_t *msg, size_t len);
|
||||
|
||||
/**
|
||||
* Notify GPS of network status changes.
|
||||
* These parameters match values in the android.net.NetworkInfo class.
|
||||
*/
|
||||
void (*update_network_state) (int connected, int type, int roaming, const char* extra_info);
|
||||
|
||||
/**
|
||||
* Notify GPS of network status changes.
|
||||
* These parameters match values in the android.net.NetworkInfo class.
|
||||
*/
|
||||
void (*update_network_availability) (int avaiable, const char* apn);
|
||||
} AGpsRilInterface;
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* ANDROID_INCLUDE_HARDWARE_GPS_H */
|
||||
|
273
overlay/include/hardware/gralloc.h
Normal file
@ -0,0 +1,273 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ANDROID_GRALLOC_INTERFACE_H
|
||||
#define ANDROID_GRALLOC_INTERFACE_H
|
||||
|
||||
#include <system/window.h>
|
||||
#include <hardware/hardware.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <cutils/native_handle.h>
|
||||
|
||||
#include <hardware/hardware.h>
|
||||
#include <hardware/fb.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define GRALLOC_API_VERSION 1
|
||||
|
||||
/**
|
||||
* The id of this module
|
||||
*/
|
||||
#define GRALLOC_HARDWARE_MODULE_ID "gralloc"
|
||||
|
||||
/**
|
||||
* Name of the graphics device to open
|
||||
*/
|
||||
|
||||
#define GRALLOC_HARDWARE_GPU0 "gpu0"
|
||||
|
||||
enum {
|
||||
/* buffer is never read in software */
|
||||
GRALLOC_USAGE_SW_READ_NEVER = 0x00000000,
|
||||
/* buffer is rarely read in software */
|
||||
GRALLOC_USAGE_SW_READ_RARELY = 0x00000002,
|
||||
/* buffer is often read in software */
|
||||
GRALLOC_USAGE_SW_READ_OFTEN = 0x00000003,
|
||||
/* mask for the software read values */
|
||||
GRALLOC_USAGE_SW_READ_MASK = 0x0000000F,
|
||||
|
||||
/* buffer is never written in software */
|
||||
GRALLOC_USAGE_SW_WRITE_NEVER = 0x00000000,
|
||||
/* buffer is never written in software */
|
||||
GRALLOC_USAGE_SW_WRITE_RARELY = 0x00000020,
|
||||
/* buffer is never written in software */
|
||||
GRALLOC_USAGE_SW_WRITE_OFTEN = 0x00000030,
|
||||
/* mask for the software write values */
|
||||
GRALLOC_USAGE_SW_WRITE_MASK = 0x000000F0,
|
||||
|
||||
/* buffer will be used as an OpenGL ES texture */
|
||||
GRALLOC_USAGE_HW_TEXTURE = 0x00000100,
|
||||
/* buffer will be used as an OpenGL ES render target */
|
||||
GRALLOC_USAGE_HW_RENDER = 0x00000200,
|
||||
/* buffer will be used by the 2D hardware blitter */
|
||||
GRALLOC_USAGE_HW_2D = 0x00000400,
|
||||
/* buffer will be used by the HWComposer HAL module */
|
||||
GRALLOC_USAGE_HW_COMPOSER = 0x00000800,
|
||||
/* buffer will be used with the framebuffer device */
|
||||
GRALLOC_USAGE_HW_FB = 0x00001000,
|
||||
/* buffer will be used with the HW video encoder */
|
||||
GRALLOC_USAGE_HW_VIDEO_ENCODER = 0x00010000,
|
||||
/* mask for the software usage bit-mask */
|
||||
GRALLOC_USAGE_HW_MASK = 0x00011F00,
|
||||
|
||||
/* buffer should be displayed full-screen on an external display when
|
||||
* possible
|
||||
*/
|
||||
GRALLOC_USAGE_EXTERNAL_DISP = 0x00002000,
|
||||
|
||||
/* Must have a hardware-protected path to external display sink for
|
||||
* this buffer. If a hardware-protected path is not available, then
|
||||
* either don't composite only this buffer (preferred) to the
|
||||
* external sink, or (less desirable) do not route the entire
|
||||
* composition to the external sink.
|
||||
*/
|
||||
GRALLOC_USAGE_PROTECTED = 0x00004000,
|
||||
|
||||
/* implementation-specific private usage flags */
|
||||
GRALLOC_USAGE_PRIVATE_0 = 0x10000000,
|
||||
GRALLOC_USAGE_PRIVATE_1 = 0x20000000,
|
||||
GRALLOC_USAGE_PRIVATE_2 = 0x40000000,
|
||||
GRALLOC_USAGE_PRIVATE_3 = 0x80000000,
|
||||
GRALLOC_USAGE_PRIVATE_MASK = 0xF0000000,
|
||||
|
||||
/* SAMSUNG */
|
||||
GRALLOC_USAGE_HW_FIMC1 = 0x01000000,
|
||||
GRALLOC_USAGE_HW_ION = 0x02000000,
|
||||
GRALLOC_USAGE_YUV_ADDR = 0x04000000,
|
||||
|
||||
/* SEC Private usage , for Overlay path at HWC */
|
||||
GRALLOC_USAGE_HWC_HWOVERLAY = 0x20000000,
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Every hardware module must have a data structure named HAL_MODULE_INFO_SYM
|
||||
* and the fields of this data structure must begin with hw_module_t
|
||||
* followed by module specific information.
|
||||
*/
|
||||
typedef struct gralloc_module_t {
|
||||
struct hw_module_t common;
|
||||
|
||||
/*
|
||||
* (*registerBuffer)() must be called before a buffer_handle_t that has not
|
||||
* been created with (*alloc_device_t::alloc)() can be used.
|
||||
*
|
||||
* This is intended to be used with buffer_handle_t's that have been
|
||||
* received in this process through IPC.
|
||||
*
|
||||
* This function checks that the handle is indeed a valid one and prepares
|
||||
* it for use with (*lock)() and (*unlock)().
|
||||
*
|
||||
* It is not necessary to call (*registerBuffer)() on a handle created
|
||||
* with (*alloc_device_t::alloc)().
|
||||
*
|
||||
* returns an error if this buffer_handle_t is not valid.
|
||||
*/
|
||||
int (*registerBuffer)(struct gralloc_module_t const* module,
|
||||
buffer_handle_t handle);
|
||||
|
||||
/*
|
||||
* (*unregisterBuffer)() is called once this handle is no longer needed in
|
||||
* this process. After this call, it is an error to call (*lock)(),
|
||||
* (*unlock)(), or (*registerBuffer)().
|
||||
*
|
||||
* This function doesn't close or free the handle itself; this is done
|
||||
* by other means, usually through libcutils's native_handle_close() and
|
||||
* native_handle_free().
|
||||
*
|
||||
* It is an error to call (*unregisterBuffer)() on a buffer that wasn't
|
||||
* explicitly registered first.
|
||||
*/
|
||||
int (*unregisterBuffer)(struct gralloc_module_t const* module,
|
||||
buffer_handle_t handle);
|
||||
|
||||
/*
|
||||
* The (*lock)() method is called before a buffer is accessed for the
|
||||
* specified usage. This call may block, for instance if the h/w needs
|
||||
* to finish rendering or if CPU caches need to be synchronized.
|
||||
*
|
||||
* The caller promises to modify only pixels in the area specified
|
||||
* by (l,t,w,h).
|
||||
*
|
||||
* The content of the buffer outside of the specified area is NOT modified
|
||||
* by this call.
|
||||
*
|
||||
* If usage specifies GRALLOC_USAGE_SW_*, vaddr is filled with the address
|
||||
* of the buffer in virtual memory.
|
||||
*
|
||||
* THREADING CONSIDERATIONS:
|
||||
*
|
||||
* It is legal for several different threads to lock a buffer from
|
||||
* read access, none of the threads are blocked.
|
||||
*
|
||||
* However, locking a buffer simultaneously for write or read/write is
|
||||
* undefined, but:
|
||||
* - shall not result in termination of the process
|
||||
* - shall not block the caller
|
||||
* It is acceptable to return an error or to leave the buffer's content
|
||||
* into an indeterminate state.
|
||||
*
|
||||
* If the buffer was created with a usage mask incompatible with the
|
||||
* requested usage flags here, -EINVAL is returned.
|
||||
*
|
||||
*/
|
||||
|
||||
int (*lock)(struct gralloc_module_t const* module,
|
||||
buffer_handle_t handle, int usage,
|
||||
int l, int t, int w, int h,
|
||||
void** vaddr);
|
||||
|
||||
|
||||
/*
|
||||
* The (*unlock)() method must be called after all changes to the buffer
|
||||
* are completed.
|
||||
*/
|
||||
|
||||
int (*unlock)(struct gralloc_module_t const* module,
|
||||
buffer_handle_t handle);
|
||||
|
||||
#ifdef EXYNOS4210_ENHANCEMENTS
|
||||
int (*getphys) (struct gralloc_module_t const* module,
|
||||
buffer_handle_t handle, void** paddr);
|
||||
#endif
|
||||
|
||||
/* reserved for future use */
|
||||
int (*perform)(struct gralloc_module_t const* module,
|
||||
int operation, ... );
|
||||
|
||||
/* reserved for future use */
|
||||
void* reserved_proc[7];
|
||||
} gralloc_module_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Every device data structure must begin with hw_device_t
|
||||
* followed by module specific public methods and attributes.
|
||||
*/
|
||||
|
||||
typedef struct alloc_device_t {
|
||||
struct hw_device_t common;
|
||||
|
||||
/*
|
||||
* (*alloc)() Allocates a buffer in graphic memory with the requested
|
||||
* parameters and returns a buffer_handle_t and the stride in pixels to
|
||||
* allow the implementation to satisfy hardware constraints on the width
|
||||
* of a pixmap (eg: it may have to be multiple of 8 pixels).
|
||||
* The CALLER TAKES OWNERSHIP of the buffer_handle_t.
|
||||
*
|
||||
* Returns 0 on success or -errno on error.
|
||||
*/
|
||||
|
||||
int (*alloc)(struct alloc_device_t* dev,
|
||||
int w, int h, int format, int usage,
|
||||
buffer_handle_t* handle, int* stride);
|
||||
|
||||
/*
|
||||
* (*free)() Frees a previously allocated buffer.
|
||||
* Behavior is undefined if the buffer is still mapped in any process,
|
||||
* but shall not result in termination of the program or security breaches
|
||||
* (allowing a process to get access to another process' buffers).
|
||||
* THIS FUNCTION TAKES OWNERSHIP of the buffer_handle_t which becomes
|
||||
* invalid after the call.
|
||||
*
|
||||
* Returns 0 on success or -errno on error.
|
||||
*/
|
||||
int (*free)(struct alloc_device_t* dev,
|
||||
buffer_handle_t handle);
|
||||
|
||||
/* This hook is OPTIONAL.
|
||||
*
|
||||
* If non NULL it will be caused by SurfaceFlinger on dumpsys
|
||||
*/
|
||||
void (*dump)(struct alloc_device_t *dev, char *buff, int buff_len);
|
||||
|
||||
void* reserved_proc[7];
|
||||
} alloc_device_t;
|
||||
|
||||
|
||||
/** convenience API for opening and closing a supported device */
|
||||
|
||||
static inline int gralloc_open(const struct hw_module_t* module,
|
||||
struct alloc_device_t** device) {
|
||||
return module->methods->open(module,
|
||||
GRALLOC_HARDWARE_GPU0, (struct hw_device_t**)device);
|
||||
}
|
||||
|
||||
static inline int gralloc_close(struct alloc_device_t* device) {
|
||||
return device->common.close(&device->common);
|
||||
}
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif // ANDROID_GRALLOC_INTERFACE_H
|
27
overlay/packages/apps/Camera/res/values/config.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
** Copyright 2011, The CyanogenMod Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<!-- Allows setting video size before recording starts -->
|
||||
<bool name="needsEarlyVideoSize">true</bool>
|
||||
<!-- Samsung Camcorder Mode -->
|
||||
<bool name="needsSamsungCamMode">true</bool>
|
||||
<!-- Samsung Camera Settings -->
|
||||
<bool name="hasSamsungCamSettings">true</bool>
|
||||
</resources>
|
25
overlay/packages/apps/Phone/res/values/config.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<?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.
|
||||
-->
|
||||
|
||||
<!-- Phone app resources that may need to be customized
|
||||
for different hardware or product builds. -->
|
||||
<resources>
|
||||
<!-- Determines if device implements a noise suppression device for in call audio-->
|
||||
<!-- <bool name="has_in_call_noise_suppression">true</bool> -->
|
||||
|
||||
<!-- Audio parameter for setting noise suppression-->
|
||||
<!-- <string name="in_call_noise_suppression_audioparameter">dualmic_enabled=true=false</string> -->
|
||||
</resources>
|
24
overlay/packages/apps/Settings/res/values/config.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2012 The CyanogenMod Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<resources xmlns:xliff="urnasis:names:tc:xliff:document:1.2 ">
|
||||
<!-- LED Flashlight -->
|
||||
<!-- <bool name="has_led_flash">true</bool> -->
|
||||
|
||||
<!-- Dock Settings -->
|
||||
<!-- <bool name="has_dock_settings">true</bool> -->
|
||||
</resources>
|
27
overlay/packages/apps/Torch/res/values/config.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
** Copyright 2011, The CyanogenMod Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
-->
|
||||
|
||||
<!-- These resources are around just to allow their values to be customized
|
||||
for different hardware and product builds. -->
|
||||
<resources>
|
||||
|
||||
<!-- If there is no sysfs-based control mechanism, enable this -->
|
||||
<bool name="useCameraInterface">true</bool>
|
||||
|
||||
</resources>
|
71
recovery.rc
Normal file
@ -0,0 +1,71 @@
|
||||
on early-init
|
||||
start ueventd
|
||||
|
||||
on init
|
||||
export PATH /sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
|
||||
export ANDROID_ROOT /system
|
||||
export ANDROID_DATA /data
|
||||
export ANDROID_CACHE /cache
|
||||
export SECONDARY_STORAGE /emmc
|
||||
export EXTERNAL_STORAGE /sdcard
|
||||
|
||||
symlink /system/etc /etc
|
||||
|
||||
mkdir /emmc
|
||||
mkdir /sdcard
|
||||
mkdir /usbdisk
|
||||
mkdir /system
|
||||
mkdir /data
|
||||
mkdir /cache
|
||||
mkdir /preload
|
||||
mount /tmp /tmp tmpfs
|
||||
|
||||
on boot
|
||||
# Permissions for mDNIe
|
||||
chown system media_rw /sys/class/mdnie/mdnie/mode
|
||||
chown system media_rw /sys/class/mdnie/mdnie/outdoor
|
||||
chown system media_rw /sys/class/mdnie/mdnie/scenario
|
||||
write /sys/class/mdnie/mdnie/scenario 4
|
||||
|
||||
ifup lo
|
||||
hostname localhost
|
||||
domainname localdomain
|
||||
|
||||
class_start default
|
||||
|
||||
service ueventd /sbin/ueventd
|
||||
critical
|
||||
|
||||
service console /sbin/sh
|
||||
class core
|
||||
console
|
||||
disabled
|
||||
group log
|
||||
|
||||
on property:ro.debuggable=1
|
||||
start console
|
||||
|
||||
service recovery /sbin/recovery
|
||||
|
||||
service adbd /sbin/adbd recovery
|
||||
disabled
|
||||
|
||||
# Always start adbd on userdebug and eng builds
|
||||
# In recovery, always run adbd as root.
|
||||
on property:ro.debuggable=1
|
||||
write /sys/class/android_usb/android0/enable 0
|
||||
write /sys/class/android_usb/android0/idVendor 04e8
|
||||
write /sys/class/android_usb/android0/idProduct 6860
|
||||
write /sys/class/android_usb/android0/functions adb
|
||||
write /sys/class/android_usb/android0/enable 1
|
||||
write /sys/class/android_usb/android0/iManufacturer $ro.product.manufacturer
|
||||
write /sys/class/android_usb/android0/iProduct $ro.product.model
|
||||
write /sys/class/android_usb/android0/iSerial $ro.serialno
|
||||
start adbd
|
||||
setprop service.adb.root 1
|
||||
|
||||
# Restart adbd so it can run as root
|
||||
on property:service.adb.root=1
|
||||
write /sys/class/android_usb/android0/enable 0
|
||||
restart adbd
|
||||
write /sys/class/android_usb/android0/enable 1
|
376
recovery/graphics.c
Normal file
@ -0,0 +1,376 @@
|
||||
/*
|
||||
* 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 <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <linux/fb.h>
|
||||
#include <linux/kd.h>
|
||||
|
||||
#include <pixelflinger/pixelflinger.h>
|
||||
|
||||
#ifdef BOARD_USE_CUSTOM_RECOVERY_FONT
|
||||
#include BOARD_USE_CUSTOM_RECOVERY_FONT
|
||||
#else
|
||||
#include "font_10x18.h"
|
||||
#endif
|
||||
|
||||
#include "minui.h"
|
||||
|
||||
#define PIXEL_FORMAT GGL_PIXEL_FORMAT_BGRA_8888
|
||||
#define PIXEL_SIZE 4
|
||||
|
||||
typedef struct {
|
||||
GGLSurface texture;
|
||||
unsigned cwidth;
|
||||
unsigned cheight;
|
||||
unsigned ascent;
|
||||
} GRFont;
|
||||
|
||||
static GRFont *gr_font = 0;
|
||||
static GGLContext *gr_context = 0;
|
||||
static GGLSurface gr_font_texture;
|
||||
static GGLSurface gr_framebuffer[2];
|
||||
static GGLSurface gr_mem_surface;
|
||||
static unsigned gr_active_fb = 0;
|
||||
|
||||
static int gr_fb_fd = -1;
|
||||
static int gr_vt_fd = -1;
|
||||
|
||||
static struct fb_var_screeninfo vi;
|
||||
static struct fb_fix_screeninfo fi;
|
||||
|
||||
static int get_framebuffer(GGLSurface *fb)
|
||||
{
|
||||
int fd;
|
||||
void *bits;
|
||||
|
||||
fd = open("/dev/graphics/fb0", O_RDWR);
|
||||
if (fd < 0) {
|
||||
perror("cannot open fb0");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ioctl(fd, FBIOGET_VSCREENINFO, &vi) < 0) {
|
||||
perror("failed to get fb0 info");
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
vi.bits_per_pixel = PIXEL_SIZE * 8;
|
||||
if (PIXEL_FORMAT == GGL_PIXEL_FORMAT_BGRA_8888) {
|
||||
vi.red.offset = 8;
|
||||
vi.red.length = 8;
|
||||
vi.green.offset = 16;
|
||||
vi.green.length = 8;
|
||||
vi.blue.offset = 24;
|
||||
vi.blue.length = 8;
|
||||
vi.transp.offset = 0;
|
||||
vi.transp.length = 8;
|
||||
} else if (PIXEL_FORMAT == GGL_PIXEL_FORMAT_RGBX_8888) {
|
||||
vi.red.offset = 24;
|
||||
vi.red.length = 8;
|
||||
vi.green.offset = 16;
|
||||
vi.green.length = 8;
|
||||
vi.blue.offset = 8;
|
||||
vi.blue.length = 8;
|
||||
vi.transp.offset = 0;
|
||||
vi.transp.length = 8;
|
||||
} else { /* RGB565*/
|
||||
vi.red.offset = 11;
|
||||
vi.red.length = 5;
|
||||
vi.green.offset = 5;
|
||||
vi.green.length = 6;
|
||||
vi.blue.offset = 0;
|
||||
vi.blue.length = 5;
|
||||
vi.transp.offset = 0;
|
||||
vi.transp.length = 0;
|
||||
}
|
||||
if (ioctl(fd, FBIOPUT_VSCREENINFO, &vi) < 0) {
|
||||
perror("failed to put fb0 info");
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ioctl(fd, FBIOGET_FSCREENINFO, &fi) < 0) {
|
||||
perror("failed to get fb0 info");
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
bits = mmap(0, fi.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
if (bits == MAP_FAILED) {
|
||||
perror("failed to mmap framebuffer");
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fb->version = sizeof(*fb);
|
||||
fb->width = vi.xres;
|
||||
fb->height = vi.yres;
|
||||
fb->stride = fi.line_length/PIXEL_SIZE;
|
||||
fb->data = bits;
|
||||
fb->format = PIXEL_FORMAT;
|
||||
memset(fb->data, 0, vi.yres * fi.line_length);
|
||||
|
||||
fb++;
|
||||
|
||||
fb->version = sizeof(*fb);
|
||||
fb->width = vi.xres;
|
||||
fb->height = vi.yres;
|
||||
fb->stride = fi.line_length/PIXEL_SIZE;
|
||||
fb->data = (void*) (((unsigned) bits) + vi.yres * fi.line_length);
|
||||
fb->format = PIXEL_FORMAT;
|
||||
memset(fb->data, 0, vi.yres * fi.line_length);
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
static void get_memory_surface(GGLSurface* ms) {
|
||||
ms->version = sizeof(*ms);
|
||||
ms->width = vi.xres;
|
||||
ms->height = vi.yres;
|
||||
ms->stride = fi.line_length/PIXEL_SIZE;
|
||||
ms->data = malloc(fi.line_length * vi.yres);
|
||||
ms->format = PIXEL_FORMAT;
|
||||
}
|
||||
|
||||
static void set_active_framebuffer(unsigned n)
|
||||
{
|
||||
if (n > 1) return;
|
||||
vi.yres_virtual = vi.yres * PIXEL_SIZE;
|
||||
vi.yoffset = n * vi.yres;
|
||||
vi.bits_per_pixel = PIXEL_SIZE * 8;
|
||||
if (ioctl(gr_fb_fd, FBIOPUT_VSCREENINFO, &vi) < 0) {
|
||||
perror("active fb swap failed");
|
||||
}
|
||||
}
|
||||
|
||||
void gr_flip(void)
|
||||
{
|
||||
GGLContext *gl = gr_context;
|
||||
|
||||
/* swap front and back buffers */
|
||||
gr_active_fb = (gr_active_fb + 1) & 1;
|
||||
|
||||
/* copy data from the in-memory surface to the buffer we're about
|
||||
* to make active. */
|
||||
memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data,
|
||||
fi.line_length * vi.yres);
|
||||
|
||||
/* inform the display driver */
|
||||
set_active_framebuffer(gr_active_fb);
|
||||
}
|
||||
|
||||
void gr_color(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
|
||||
{
|
||||
GGLContext *gl = gr_context;
|
||||
GGLint color[4];
|
||||
color[0] = ((r << 8) | r) + 1;
|
||||
color[1] = ((g << 8) | g) + 1;
|
||||
color[2] = ((b << 8) | b) + 1;
|
||||
color[3] = ((a << 8) | a) + 1;
|
||||
gl->color4xv(gl, color);
|
||||
}
|
||||
|
||||
int gr_measure(const char *s)
|
||||
{
|
||||
return gr_font->cwidth * strlen(s);
|
||||
}
|
||||
|
||||
void gr_font_size(int *x, int *y)
|
||||
{
|
||||
*x = gr_font->cwidth;
|
||||
*y = gr_font->cheight;
|
||||
}
|
||||
|
||||
int gr_text(int x, int y, const char *s)
|
||||
{
|
||||
GGLContext *gl = gr_context;
|
||||
GRFont *font = gr_font;
|
||||
unsigned off;
|
||||
|
||||
y -= font->ascent;
|
||||
|
||||
gl->bindTexture(gl, &font->texture);
|
||||
gl->texEnvi(gl, GGL_TEXTURE_ENV, GGL_TEXTURE_ENV_MODE, GGL_REPLACE);
|
||||
gl->texGeni(gl, GGL_S, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
|
||||
gl->texGeni(gl, GGL_T, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
|
||||
gl->enable(gl, GGL_TEXTURE_2D);
|
||||
|
||||
while((off = *s++)) {
|
||||
off -= 32;
|
||||
if (off < 96) {
|
||||
gl->texCoord2i(gl, (off * font->cwidth) - x, 0 - y);
|
||||
gl->recti(gl, x, y, x + font->cwidth, y + font->cheight);
|
||||
}
|
||||
x += font->cwidth;
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
void gr_fill(int x, int y, int w, int h)
|
||||
{
|
||||
GGLContext *gl = gr_context;
|
||||
gl->disable(gl, GGL_TEXTURE_2D);
|
||||
gl->recti(gl, x, y, w, h);
|
||||
}
|
||||
|
||||
void gr_blit(gr_surface source, int sx, int sy, int w, int h, int dx, int dy) {
|
||||
if (gr_context == NULL) {
|
||||
return;
|
||||
}
|
||||
GGLContext *gl = gr_context;
|
||||
|
||||
gl->bindTexture(gl, (GGLSurface*) source);
|
||||
gl->texEnvi(gl, GGL_TEXTURE_ENV, GGL_TEXTURE_ENV_MODE, GGL_REPLACE);
|
||||
gl->texGeni(gl, GGL_S, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
|
||||
gl->texGeni(gl, GGL_T, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
|
||||
gl->enable(gl, GGL_TEXTURE_2D);
|
||||
gl->texCoord2i(gl, sx - dx, sy - dy);
|
||||
gl->recti(gl, dx, dy, dx + w, dy + h);
|
||||
}
|
||||
|
||||
unsigned int gr_get_width(gr_surface surface) {
|
||||
if (surface == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return ((GGLSurface*) surface)->width;
|
||||
}
|
||||
|
||||
unsigned int gr_get_height(gr_surface surface) {
|
||||
if (surface == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return ((GGLSurface*) surface)->height;
|
||||
}
|
||||
|
||||
static void gr_init_font(void)
|
||||
{
|
||||
GGLSurface *ftex;
|
||||
unsigned char *bits, *rle;
|
||||
unsigned char *in, data;
|
||||
|
||||
gr_font = calloc(sizeof(*gr_font), 1);
|
||||
ftex = &gr_font->texture;
|
||||
|
||||
bits = malloc(font.width * font.height);
|
||||
|
||||
ftex->version = sizeof(*ftex);
|
||||
ftex->width = font.width;
|
||||
ftex->height = font.height;
|
||||
ftex->stride = font.width;
|
||||
ftex->data = (void*) bits;
|
||||
ftex->format = GGL_PIXEL_FORMAT_A_8;
|
||||
|
||||
in = font.rundata;
|
||||
while((data = *in++)) {
|
||||
memset(bits, (data & 0x80) ? 255 : 0, data & 0x7f);
|
||||
bits += (data & 0x7f);
|
||||
}
|
||||
|
||||
gr_font->cwidth = font.cwidth;
|
||||
gr_font->cheight = font.cheight;
|
||||
gr_font->ascent = font.cheight - 2;
|
||||
}
|
||||
|
||||
int gr_init(void)
|
||||
{
|
||||
gglInit(&gr_context);
|
||||
GGLContext *gl = gr_context;
|
||||
|
||||
gr_init_font();
|
||||
gr_vt_fd = open("/dev/tty0", O_RDWR | O_SYNC);
|
||||
if (gr_vt_fd < 0) {
|
||||
// This is non-fatal; post-Cupcake kernels don't have tty0.
|
||||
perror("can't open /dev/tty0");
|
||||
} else if (ioctl(gr_vt_fd, KDSETMODE, (void*) KD_GRAPHICS)) {
|
||||
// However, if we do open tty0, we expect the ioctl to work.
|
||||
perror("failed KDSETMODE to KD_GRAPHICS on tty0");
|
||||
gr_exit();
|
||||
return -1;
|
||||
}
|
||||
|
||||
gr_fb_fd = get_framebuffer(gr_framebuffer);
|
||||
if (gr_fb_fd < 0) {
|
||||
gr_exit();
|
||||
return -1;
|
||||
}
|
||||
|
||||
get_memory_surface(&gr_mem_surface);
|
||||
|
||||
fprintf(stderr, "framebuffer: fd %d (%d x %d)\n",
|
||||
gr_fb_fd, gr_framebuffer[0].width, gr_framebuffer[0].height);
|
||||
|
||||
/* start with 0 as front (displayed) and 1 as back (drawing) */
|
||||
gr_active_fb = 0;
|
||||
set_active_framebuffer(0);
|
||||
gl->colorBuffer(gl, &gr_mem_surface);
|
||||
|
||||
gl->activeTexture(gl, 0);
|
||||
gl->enable(gl, GGL_BLEND);
|
||||
gl->blendFunc(gl, GGL_SRC_ALPHA, GGL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
gr_fb_blank(true);
|
||||
gr_fb_blank(false);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void gr_exit(void)
|
||||
{
|
||||
close(gr_fb_fd);
|
||||
gr_fb_fd = -1;
|
||||
|
||||
free(gr_mem_surface.data);
|
||||
|
||||
ioctl(gr_vt_fd, KDSETMODE, (void*) KD_TEXT);
|
||||
close(gr_vt_fd);
|
||||
gr_vt_fd = -1;
|
||||
}
|
||||
|
||||
int gr_fb_width(void)
|
||||
{
|
||||
return gr_framebuffer[0].width;
|
||||
}
|
||||
|
||||
int gr_fb_height(void)
|
||||
{
|
||||
return gr_framebuffer[0].height;
|
||||
}
|
||||
|
||||
gr_pixel *gr_fb_data(void)
|
||||
{
|
||||
return (unsigned short *) gr_mem_surface.data;
|
||||
}
|
||||
|
||||
void gr_fb_blank(bool blank)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = ioctl(gr_fb_fd, FBIOBLANK, blank ? FB_BLANK_POWERDOWN : FB_BLANK_UNBLANK);
|
||||
if (ret < 0)
|
||||
perror("ioctl(): blank");
|
||||
}
|
62
recovery/recovery_keys.c
Normal file
@ -0,0 +1,62 @@
|
||||
#include <linux/input.h>
|
||||
|
||||
#include "recovery_ui.h"
|
||||
#include "common.h"
|
||||
#include "extendedcommands.h"
|
||||
|
||||
|
||||
int device_toggle_display(volatile char* key_pressed, int key_code) {
|
||||
int alt = key_pressed[KEY_LEFTALT] || key_pressed[KEY_RIGHTALT];
|
||||
if (alt && key_code == KEY_L)
|
||||
return 1;
|
||||
// allow toggling of the display if the correct key is pressed, and the display toggle is allowed or the display is currently off
|
||||
if (ui_get_showing_back_button()) {
|
||||
return 0;
|
||||
//return get_allow_toggle_display() && (key_code == KEY_HOME || key_code == KEY_MENU || key_code == KEY_END);
|
||||
}
|
||||
return get_allow_toggle_display() && (key_code == KEY_HOMEPAGE || key_code == KEY_MENU || key_code == KEY_POWER || key_code == KEY_END);
|
||||
}
|
||||
|
||||
int device_handle_key(int key_code, int visible) {
|
||||
if (visible) {
|
||||
switch (key_code) {
|
||||
case KEY_CAPSLOCK:
|
||||
case KEY_DOWN:
|
||||
case KEY_VOLUMEDOWN:
|
||||
return HIGHLIGHT_DOWN;
|
||||
case KEY_MENU:
|
||||
return NO_ACTION;
|
||||
case KEY_LEFTSHIFT:
|
||||
case KEY_UP:
|
||||
case KEY_VOLUMEUP:
|
||||
return HIGHLIGHT_UP;
|
||||
case KEY_HOMEPAGE:
|
||||
if (ui_get_showing_back_button()) {
|
||||
return SELECT_ITEM;
|
||||
}
|
||||
if (!get_allow_toggle_display())
|
||||
return GO_BACK;
|
||||
break;
|
||||
case KEY_POWER:
|
||||
if (ui_get_showing_back_button()) {
|
||||
return SELECT_ITEM;
|
||||
}
|
||||
if (!get_allow_toggle_display())
|
||||
return GO_BACK;
|
||||
break;
|
||||
case KEY_LEFTBRACE:
|
||||
case KEY_ENTER:
|
||||
case BTN_MOUSE:
|
||||
case KEY_CAMERA:
|
||||
case KEY_F21:
|
||||
case KEY_SEND:
|
||||
case KEY_END:
|
||||
case KEY_BACKSPACE:
|
||||
case KEY_SEARCH:
|
||||
case KEY_BACK:
|
||||
return GO_BACK;
|
||||
}
|
||||
}
|
||||
|
||||
return NO_ACTION;
|
||||
}
|
31
releasetools/galaxys2_common.py
Executable file
@ -0,0 +1,31 @@
|
||||
#
|
||||
# Copyright (C) 2008 The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import os, sys
|
||||
|
||||
LOCAL_DIR = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
|
||||
RELEASETOOLS_DIR = os.path.abspath(os.path.join(LOCAL_DIR, '../../../build/tools/releasetools'))
|
||||
|
||||
# Add releasetools directory to python path
|
||||
sys.path.append(RELEASETOOLS_DIR)
|
||||
|
||||
from common import *
|
||||
|
||||
def load_module_from_file(module_name, filename):
|
||||
import imp
|
||||
f = open(filename, 'r')
|
||||
module = imp.load_module(module_name, f, filename, ('', 'U', 1))
|
||||
f.close()
|
||||
return module
|
46
releasetools/galaxys2_edify_generator.py
Executable file
@ -0,0 +1,46 @@
|
||||
#
|
||||
# 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.
|
||||
|
||||
import os, sys
|
||||
|
||||
LOCAL_DIR = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
|
||||
RELEASETOOLS_DIR = os.path.abspath(os.path.join(LOCAL_DIR, '../../../build/tools/releasetools'))
|
||||
|
||||
import edify_generator
|
||||
|
||||
class EdifyGenerator(edify_generator.EdifyGenerator):
|
||||
def UnpackPackageFile(self, src, dst):
|
||||
"""Unpack a given file from the OTA package into the given
|
||||
destination file."""
|
||||
self.script.append('package_extract_file("%s", "%s");' % (src, dst))
|
||||
|
||||
def EMMCWriteRawImage(self, partition, image):
|
||||
"""Write the given package file into the given partition."""
|
||||
|
||||
args = {'partition': partition, 'image': image}
|
||||
|
||||
self.script.append(
|
||||
('assert(package_extract_file("%(image)s", "/tmp/%(image)s"),\n'
|
||||
' write_raw_image("/tmp/%(image)s", "%(partition)s"),\n'
|
||||
' delete("/tmp/%(image)s"));') % args)
|
||||
|
||||
def Unmount(self, mount_point):
|
||||
"""Unmount the partition with the given mount_point."""
|
||||
fstab = self.info.get("fstab", None)
|
||||
if fstab:
|
||||
p = fstab[mount_point]
|
||||
self.script.append('unmount("%s");' %
|
||||
(p.mount_point))
|
||||
self.mounts.add(p.mount_point)
|
185
releasetools/galaxys2_img_from_target_files
Executable file
@ -0,0 +1,185 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# 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.
|
||||
|
||||
"""
|
||||
Given a target-files zipfile, produces an image zipfile suitable for
|
||||
use with 'fastboot update'.
|
||||
|
||||
Usage: img_from_target_files [flags] input_target_files output_image_zip
|
||||
|
||||
-b (--board_config) <file>
|
||||
Deprecated.
|
||||
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
if sys.hexversion < 0x02040000:
|
||||
print >> sys.stderr, "Python 2.4 or newer is required."
|
||||
sys.exit(1)
|
||||
|
||||
import errno
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
import zipfile
|
||||
|
||||
# missing in Python 2.4 and before
|
||||
if not hasattr(os, "SEEK_SET"):
|
||||
os.SEEK_SET = 0
|
||||
|
||||
import galaxys2_common as common
|
||||
|
||||
OPTIONS = common.OPTIONS
|
||||
|
||||
def AddUserdata(output_zip):
|
||||
"""Create an empty userdata image and store it in output_zip."""
|
||||
|
||||
print "creating userdata.img..."
|
||||
|
||||
# The name of the directory it is making an image out of matters to
|
||||
# mkyaffs2image. So we create a temp dir, and within it we create an
|
||||
# empty dir named "data", and build the image from that.
|
||||
temp_dir = tempfile.mkdtemp()
|
||||
user_dir = os.path.join(temp_dir, "data")
|
||||
os.mkdir(user_dir)
|
||||
img = tempfile.NamedTemporaryFile()
|
||||
|
||||
build_command = []
|
||||
if OPTIONS.info_dict["fstab"]["/data"].fs_type.startswith("ext"):
|
||||
build_command = ["mkuserimg.sh",
|
||||
user_dir, img.name,
|
||||
OPTIONS.info_dict["fstab"]["/data"].fs_type, "data"]
|
||||
if "userdata_size" in OPTIONS.info_dict:
|
||||
build_command.append(str(OPTIONS.info_dict["userdata_size"]))
|
||||
else:
|
||||
build_command = ["mkyaffs2image", "-f"]
|
||||
extra = OPTIONS.info_dict.get("mkyaffs2_extra_flags", None)
|
||||
if extra:
|
||||
build_command.extend(extra.split())
|
||||
build_command.append(user_dir)
|
||||
build_command.append(img.name)
|
||||
|
||||
p = common.Run(build_command)
|
||||
p.communicate()
|
||||
assert p.returncode == 0, "build userdata.img image failed"
|
||||
|
||||
common.CheckSize(img.name, "userdata.img", OPTIONS.info_dict)
|
||||
output_zip.write(img.name, "userdata.img")
|
||||
img.close()
|
||||
os.rmdir(user_dir)
|
||||
os.rmdir(temp_dir)
|
||||
|
||||
|
||||
def AddSystem(output_zip):
|
||||
"""Turn the contents of SYSTEM into a system image and store it in
|
||||
output_zip."""
|
||||
|
||||
print "creating system.img..."
|
||||
|
||||
img = tempfile.NamedTemporaryFile()
|
||||
|
||||
# The name of the directory it is making an image out of matters to
|
||||
# mkyaffs2image. It wants "system" but we have a directory named
|
||||
# "SYSTEM", so create a symlink.
|
||||
try:
|
||||
os.symlink(os.path.join(OPTIONS.input_tmp, "SYSTEM"),
|
||||
os.path.join(OPTIONS.input_tmp, "system"))
|
||||
except OSError, e:
|
||||
if (e.errno == errno.EEXIST):
|
||||
pass
|
||||
|
||||
build_command = []
|
||||
if OPTIONS.info_dict["fstab"]["/system"].fs_type.startswith("ext"):
|
||||
build_command = ["mkuserimg.sh",
|
||||
os.path.join(OPTIONS.input_tmp, "system"), img.name,
|
||||
OPTIONS.info_dict["fstab"]["/system"].fs_type, "system"]
|
||||
if "system_size" in OPTIONS.info_dict:
|
||||
build_command.append(str(OPTIONS.info_dict["system_size"]))
|
||||
else:
|
||||
build_command = ["mkyaffs2image", "-f"]
|
||||
extra = OPTIONS.info_dict.get("mkyaffs2_extra_flags", None)
|
||||
if extra:
|
||||
build_command.extend(extra.split())
|
||||
build_command.append(os.path.join(OPTIONS.input_tmp, "system"))
|
||||
build_command.append(img.name)
|
||||
|
||||
p = common.Run(build_command)
|
||||
p.communicate()
|
||||
assert p.returncode == 0, "build system.img image failed"
|
||||
|
||||
img.seek(os.SEEK_SET, 0)
|
||||
data = img.read()
|
||||
img.close()
|
||||
|
||||
common.CheckSize(data, "system.img", OPTIONS.info_dict)
|
||||
common.ZipWriteStr(output_zip, "system.img", data)
|
||||
|
||||
|
||||
def CopyInfo(output_zip):
|
||||
"""Copy the android-info.txt file from the input to the output."""
|
||||
output_zip.write(os.path.join(OPTIONS.input_tmp, "OTA", "android-info.txt"),
|
||||
"android-info.txt")
|
||||
|
||||
|
||||
def main(argv):
|
||||
|
||||
def option_handler(o, a):
|
||||
if o in ("-b", "--board_config"):
|
||||
pass # deprecated
|
||||
else:
|
||||
return False
|
||||
return True
|
||||
|
||||
args = common.ParseOptions(argv, __doc__,
|
||||
extra_opts="b:",
|
||||
extra_long_opts=["board_config="],
|
||||
extra_option_handler=option_handler)
|
||||
|
||||
if len(args) != 2:
|
||||
common.Usage(__doc__)
|
||||
sys.exit(1)
|
||||
|
||||
OPTIONS.input_tmp = common.UnzipTemp(args[0])
|
||||
|
||||
input_zip = zipfile.ZipFile(args[0], "r")
|
||||
OPTIONS.info_dict = common.LoadInfoDict(input_zip)
|
||||
|
||||
output_zip = zipfile.ZipFile(args[1], "w", compression=zipfile.ZIP_DEFLATED)
|
||||
|
||||
common.AddBoot(output_zip, OPTIONS.info_dict)
|
||||
common.AddRecovery(output_zip, OPTIONS.info_dict)
|
||||
AddSystem(output_zip)
|
||||
AddUserdata(output_zip)
|
||||
CopyInfo(output_zip)
|
||||
|
||||
print "cleaning up..."
|
||||
output_zip.close()
|
||||
shutil.rmtree(OPTIONS.input_tmp)
|
||||
|
||||
print "done."
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
main(sys.argv[1:])
|
||||
except common.ExternalError, e:
|
||||
print
|
||||
print " ERROR: %s" % (e,)
|
||||
print
|
||||
sys.exit(1)
|
118
releasetools/galaxys2_ota_from_target_files
Executable file
@ -0,0 +1,118 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# 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.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import galaxys2_common as common
|
||||
|
||||
LOCAL_DIR = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
|
||||
RELEASETOOLS_DIR = os.path.abspath(os.path.join(LOCAL_DIR, '../../../build/tools/releasetools'))
|
||||
TARGET_DIR = os.getenv('OUT')
|
||||
|
||||
# Add releasetools directory to python path
|
||||
sys.path.append(RELEASETOOLS_DIR)
|
||||
|
||||
# Import the existing file so we just have to rewrite the modules we need.
|
||||
# This is a nasty hack as the filename doesn't end in .py, but it works
|
||||
filename = os.path.join(RELEASETOOLS_DIR, "ota_from_target_files")
|
||||
ota_from_target_files = common.load_module_from_file('ota_from_target_files', filename)
|
||||
|
||||
from ota_from_target_files import *
|
||||
import galaxys2_edify_generator as edify_generator
|
||||
|
||||
__doc__ = ota_from_target_files.__doc__
|
||||
|
||||
def CopyBootFiles(input_zip, output_zip):
|
||||
output_zip.write(os.path.join(TARGET_DIR, "boot.img"),"boot.img")
|
||||
|
||||
def WriteFullOTAPackage(input_zip, output_zip):
|
||||
# TODO: how to determine this? We don't know what version it will
|
||||
# be installed on top of. For now, we expect the API just won't
|
||||
# change very often.
|
||||
script = edify_generator.EdifyGenerator(3, OPTIONS.info_dict)
|
||||
|
||||
metadata = {"post-build": GetBuildProp("ro.build.fingerprint", input_zip),
|
||||
"pre-device": GetBuildProp("ro.product.device", input_zip),
|
||||
"post-timestamp": GetBuildProp("ro.build.date.utc", input_zip),
|
||||
}
|
||||
|
||||
device_specific = common.DeviceSpecificParams(
|
||||
input_zip=input_zip,
|
||||
input_version=OPTIONS.info_dict["recovery_api_version"],
|
||||
output_zip=output_zip,
|
||||
script=script,
|
||||
input_tmp=OPTIONS.input_tmp,
|
||||
metadata=metadata,
|
||||
info_dict=OPTIONS.info_dict)
|
||||
|
||||
AppendAssertions(script, input_zip)
|
||||
device_specific.FullOTA_Assertions()
|
||||
if OPTIONS.backuptool:
|
||||
script.RunBackup("backup")
|
||||
|
||||
script.ShowProgress(0.5, 0)
|
||||
|
||||
if OPTIONS.wipe_user_data:
|
||||
script.FormatPartition("/data")
|
||||
|
||||
script.Unmount("/system")
|
||||
script.FormatPartition("/system")
|
||||
script.Mount("/system")
|
||||
script.UnpackPackageDir("recovery", "/system")
|
||||
script.UnpackPackageDir("system", "/system")
|
||||
|
||||
symlinks = CopySystemFiles(input_zip, output_zip)
|
||||
script.MakeSymlinks(symlinks)
|
||||
|
||||
CopyBootFiles(input_zip, output_zip)
|
||||
|
||||
Item.GetMetadata(input_zip)
|
||||
Item.Get("system").SetPermissions(script)
|
||||
|
||||
script.ShowProgress(0.2, 0)
|
||||
|
||||
if OPTIONS.backuptool:
|
||||
script.ShowProgress(0.2, 10)
|
||||
script.RunBackup("restore")
|
||||
|
||||
script.ShowProgress(0.2, 10)
|
||||
script.EMMCWriteRawImage("/dev/block/mmcblk0p5", "boot.img")
|
||||
|
||||
script.ShowProgress(0.1, 0)
|
||||
device_specific.FullOTA_InstallEnd()
|
||||
|
||||
if OPTIONS.extra_script is not None:
|
||||
script.AppendExtra(OPTIONS.extra_script)
|
||||
|
||||
script.UnmountAll()
|
||||
script.AddToZip(input_zip, output_zip)
|
||||
WriteMetadata(metadata, output_zip)
|
||||
ota_from_target_files.WriteFullOTAPackage = WriteFullOTAPackage
|
||||
|
||||
|
||||
def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
|
||||
print "Incremental OTA Packages are not support on the galaxys2 at this time"
|
||||
sys.exit(1)
|
||||
ota_from_target_files.WriteIncrementalOTAPackage = WriteIncrementalOTAPackage
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
main(sys.argv[1:])
|
||||
except common.ExternalError, e:
|
||||
print
|
||||
print " ERROR: %s" % (e,)
|
||||
print
|
||||
sys.exit(1)
|
BIN
res/charger/battery_0.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
res/charger/battery_1.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
res/charger/battery_2.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
res/charger/battery_3.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
res/charger/battery_4.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
res/charger/battery_5.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
res/charger/battery_charge.png
Normal file
After Width: | Height: | Size: 7.0 KiB |
BIN
res/charger/battery_fail.png
Normal file
After Width: | Height: | Size: 6.9 KiB |
34
shbootimg.mk
Normal file
@ -0,0 +1,34 @@
|
||||
#
|
||||
# Copyright (C) 2012 The CyanogenMod Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
|
||||
|
||||
uncompressed_ramdisk := $(PRODUCT_OUT)/ramdisk.cpio
|
||||
$(uncompressed_ramdisk): $(INSTALLED_RAMDISK_TARGET)
|
||||
zcat $< > $@
|
||||
|
||||
TARGET_KERNEL_BINARIES: $(KERNEL_OUT) $(KERNEL_CONFIG) $(KERNEL_HEADERS_INSTALL) $(recovery_uncompressed_ramdisk) $(uncompressed_ramdisk)
|
||||
$(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(TARGET_ARCH) $(ARM_CROSS_COMPILE) $(TARGET_PREBUILT_INT_KERNEL_TYPE)
|
||||
$(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(TARGET_ARCH) $(ARM_CROSS_COMPILE) modules
|
||||
$(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) INSTALL_MOD_PATH=../../$(KERNEL_MODULES_INSTALL) ARCH=$(TARGET_ARCH) $(ARM_CROSS_COMPILE) modules_install
|
||||
|
||||
$(INSTALLED_BOOTIMAGE_TARGET): $(INSTALLED_KERNEL_TARGET)
|
||||
$(ACP) -fp $< $@
|
||||
|
||||
$(INSTALLED_RECOVERYIMAGE_TARGET): $(INSTALLED_KERNEL_TARGET)
|
||||
$(ACP) -fp $< $@
|
11
surfaceflinger_client/Android.mk
Normal file
@ -0,0 +1,11 @@
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
surfaceflinger_client.cpp
|
||||
|
||||
LOCAL_SHARED_LIBRARIES :=
|
||||
|
||||
LOCAL_MODULE:= libsurfaceflinger_client
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
66
surfaceflinger_client/surfaceflinger_client.cpp
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (C) 2012, The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
class SkDeviceFactory;
|
||||
class SkBitmap;
|
||||
class SkCanvas;
|
||||
class SkPaint;
|
||||
|
||||
class SkTextBox {
|
||||
public:
|
||||
SkTextBox();
|
||||
|
||||
enum Mode {
|
||||
kOneLine_Mode,
|
||||
kLineBreak_Mode,
|
||||
|
||||
kModeCount
|
||||
};
|
||||
|
||||
enum SpacingAlign {
|
||||
kStart_SpacingAlign,
|
||||
kCenter_SpacingAlign,
|
||||
kEnd_SpacingAlign,
|
||||
|
||||
kSpacingAlignCount
|
||||
};
|
||||
};
|
||||
|
||||
typedef float SkScalar;
|
||||
|
||||
extern "C" void _ZN8SkCanvasC1EP15SkDeviceFactory(SkDeviceFactory* factory) {
|
||||
}
|
||||
|
||||
extern "C" void _ZN8SkCanvas15setBitmapDeviceERK8SkBitmapb(const SkBitmap& bitmap, bool forLayer) {
|
||||
}
|
||||
|
||||
extern "C" void _ZN9SkTextBoxC1Ev() {
|
||||
}
|
||||
|
||||
extern "C" void _ZN9SkTextBox7setModeENS_4ModeE(SkTextBox::Mode) {
|
||||
}
|
||||
|
||||
extern "C" void _ZN9SkTextBox15setSpacingAlignENS_12SpacingAlignE(SkTextBox::SpacingAlign) {
|
||||
}
|
||||
|
||||
extern "C" void _ZN9SkTextBox6setBoxEffff(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) {
|
||||
}
|
||||
|
||||
extern "C" void _ZN9SkTextBox10setSpacingEff(SkScalar left, SkScalar right) {
|
||||
}
|
||||
|
||||
extern "C" void _ZN9SkTextBox4drawEP8SkCanvasPKcjRK7SkPaint(SkCanvas*, char const* foo1, unsigned int foo2, SkPaint const&) {
|
||||
}
|
16
tvout/Android.mk
Normal file
@ -0,0 +1,16 @@
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
|
||||
|
||||
LOCAL_SRC_FILES := $(call all-java-files-under, src)
|
||||
|
||||
LOCAL_PACKAGE_NAME := TvOut
|
||||
LOCAL_CERTIFICATE := platform
|
||||
|
||||
include $(BUILD_PACKAGE)
|
||||
|
||||
# Use the folloing include to make our test apk.
|
||||
include $(call all-makefiles-under,$(LOCAL_PATH))
|
24
tvout/AndroidManifest.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.teamhacksung.tvout" android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<application android:label="TvOut">
|
||||
|
||||
<service android:exported="false" android:enabled="true"
|
||||
android:name=".TvOutService">
|
||||
</service>
|
||||
|
||||
<receiver android:name=".BootCompletedReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
</application>
|
||||
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-permission>
|
||||
<uses-permission android:name="android.permission.BROADCAST_STICKY"></uses-permission>
|
||||
<uses-permission android:name="android.permission.FACTORY_TEST"></uses-permission>
|
||||
</manifest>
|
1
tvout/proguard.flags
Normal file
@ -0,0 +1 @@
|
||||
-dontshrink
|
102
tvout/src/android/hardware/Tvout.java
Normal file
@ -0,0 +1,102 @@
|
||||
package android.hardware;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
public class Tvout {
|
||||
private static final String TAG = "Tvout_java";
|
||||
|
||||
static {
|
||||
System.loadLibrary("tvout_jni");
|
||||
}
|
||||
|
||||
public Tvout() {
|
||||
Log.i(TAG, "Tvout Initializing");
|
||||
_native_setup();
|
||||
}
|
||||
|
||||
private native boolean _TvoutGetCableStatus();
|
||||
|
||||
private native boolean _TvoutGetStatus();
|
||||
|
||||
private native boolean _TvoutGetSubtitleStatus();
|
||||
|
||||
private native boolean _TvoutGetSuspendStatus();
|
||||
|
||||
private native boolean _TvoutPostSubtitle(String string, int param);
|
||||
|
||||
private native boolean _TvoutPostSuspend(String string);
|
||||
|
||||
private native boolean _TvoutSetCableStatus(boolean connected);
|
||||
|
||||
private native boolean _TvoutSetOutputMode(int mode);
|
||||
|
||||
private native boolean _TvoutSetResolution(int resolution);
|
||||
|
||||
private native boolean _TvoutSetStatus(boolean enabled);
|
||||
|
||||
private native boolean _TvoutSetSubtitleStatus(boolean enabled);
|
||||
|
||||
private native boolean _TvoutSetSuspendStatus(boolean enabled);
|
||||
|
||||
private native boolean _TvoutSetDefaultString(String string);
|
||||
|
||||
private final native void _native_setup();
|
||||
|
||||
private final native void _release();
|
||||
|
||||
public boolean getCableStatus() {
|
||||
return _TvoutGetCableStatus();
|
||||
}
|
||||
|
||||
public boolean getStatus() {
|
||||
return _TvoutGetStatus();
|
||||
}
|
||||
|
||||
public boolean getSubtitleStatus() {
|
||||
return _TvoutGetSubtitleStatus();
|
||||
}
|
||||
|
||||
public boolean getSuspendStatus() {
|
||||
return _TvoutGetSuspendStatus();
|
||||
}
|
||||
|
||||
public boolean postSubtitle(String string, int paramInt) {
|
||||
return _TvoutPostSubtitle(string, paramInt);
|
||||
}
|
||||
|
||||
public boolean postSuspend(String string) {
|
||||
return _TvoutPostSuspend(string);
|
||||
}
|
||||
|
||||
public boolean setCableStatus(boolean connected) {
|
||||
return _TvoutSetCableStatus(connected);
|
||||
}
|
||||
|
||||
public boolean setOutputMode(int mode) {
|
||||
return _TvoutSetOutputMode(mode);
|
||||
}
|
||||
|
||||
public boolean setResolution(int resolution) {
|
||||
return _TvoutSetResolution(resolution);
|
||||
}
|
||||
|
||||
public boolean setStatus(boolean enabled) {
|
||||
return _TvoutSetStatus(enabled);
|
||||
}
|
||||
|
||||
public boolean setSubtitleStatus(boolean enabled) {
|
||||
return _TvoutSetSubtitleStatus(enabled);
|
||||
}
|
||||
|
||||
public boolean setSuspendStatus(boolean enabled) {
|
||||
return _TvoutSetSuspendStatus(enabled);
|
||||
}
|
||||
|
||||
public boolean setDefaultString(String string) {
|
||||
return _TvoutSetDefaultString(string);
|
||||
}
|
||||
|
||||
public void release() {
|
||||
_release();
|
||||
}
|
||||
}
|
12
tvout/src/com/teamhacksung/tvout/BootCompletedReceiver.java
Normal file
@ -0,0 +1,12 @@
|
||||
package com.teamhacksung.tvout;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
public class BootCompletedReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
context.startService(new Intent(context, TvOutService.class));
|
||||
}
|
||||
}
|
116
tvout/src/com/teamhacksung/tvout/TvOutService.java
Normal file
@ -0,0 +1,116 @@
|
||||
package com.teamhacksung.tvout;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.hardware.Tvout;
|
||||
import android.nfc.Tag;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.util.Log;
|
||||
|
||||
public class TvOutService extends Service {
|
||||
|
||||
public static final String TAG = "TvOutService_java";
|
||||
|
||||
private Tvout mTvOut;
|
||||
private boolean mWasOn = false; // For enabling on screen on
|
||||
|
||||
private BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
if (Intent.ACTION_HDMI_AUDIO_PLUG.equals(action)) {
|
||||
getTvoutInstance();
|
||||
int state = intent.getIntExtra("state", 0);
|
||||
if (state == 1 && !mTvOut.getStatus()) {
|
||||
// Enable when cable is plugged
|
||||
Log.i(TAG, "HDMI plugged");
|
||||
mWasOn = false;
|
||||
enable();
|
||||
} else if (mTvOut.getStatus()) {
|
||||
// Disable when cable is unplugged
|
||||
Log.i(TAG, "HDMI unplugged");
|
||||
mWasOn = false;
|
||||
disable();
|
||||
releaseTvout();
|
||||
}
|
||||
} else if (Intent.ACTION_SCREEN_ON.equals(action)) {
|
||||
if (mTvOut != null && mWasOn) {
|
||||
Log.i(TAG, "Screen On - Resume TvOut stream");
|
||||
mWasOn = false;
|
||||
mTvOut.setSuspendStatus(false);
|
||||
}
|
||||
} else if (Intent.ACTION_SCREEN_OFF.equals(action)) {
|
||||
if (mTvOut != null && mTvOut.getStatus()) {
|
||||
Log.i(TAG, "Screen Off - Pausing TvOut stream");
|
||||
mWasOn = true;
|
||||
mTvOut.setSuspendStatus(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
IntentFilter filter = new IntentFilter(Intent.ACTION_HDMI_AUDIO_PLUG);
|
||||
filter.addAction(Intent.ACTION_SCREEN_OFF);
|
||||
filter.addAction(Intent.ACTION_SCREEN_ON);
|
||||
registerReceiver(mReceiver, filter);
|
||||
Log.i(TAG, "Registered Receiver");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
private boolean getTvoutInstance() {
|
||||
if (mTvOut != null) return true;
|
||||
|
||||
try {
|
||||
mTvOut = new Tvout();
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void releaseTvout() {
|
||||
if (mTvOut != null) {
|
||||
mTvOut.release();
|
||||
mTvOut = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
unregisterReceiver(mReceiver);
|
||||
releaseTvout();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
private void enable() {
|
||||
if (mTvOut == null) return;
|
||||
mTvOut.setStatus(true);
|
||||
mTvOut.setCableStatus(true);
|
||||
mTvOut.setSuspendStatus(false);
|
||||
}
|
||||
|
||||
private void disable() {
|
||||
if (mTvOut == null) return;
|
||||
mTvOut.setStatus(false);
|
||||
mTvOut.setCableStatus(false);
|
||||
}
|
||||
|
||||
}
|
33
ueventd.smdk4210.rc
Normal file
@ -0,0 +1,33 @@
|
||||
/dev/mali 0666 system system
|
||||
/dev/ump 0666 system graphics
|
||||
/dev/exynos-mem 0666 system graphics
|
||||
/dev/s3c-mem 0666 system system
|
||||
/dev/s3c-mfc 0666 system graphics
|
||||
/dev/s5p-mfc 0666 system graphics
|
||||
/dev/video0 0666 system m2m
|
||||
/dev/video1 0666 system camera
|
||||
/dev/video2 0666 system m2m
|
||||
/dev/video3 0666 system m2m
|
||||
/dev/video4 0666 system m2m
|
||||
/dev/s5p-jpeg 0666 system camera
|
||||
/dev/video14 0666 system system
|
||||
/dev/video21 0666 system system
|
||||
/dev/pmem 0660 system graphics
|
||||
/dev/pmem_gpu1 0660 system graphics
|
||||
# logger should be world writable (for logging) but not readable
|
||||
/dev/log/* 0662 root log
|
||||
/dev/i2c-7 0666 system system
|
||||
/dev/CEC 0666 system system
|
||||
/dev/HPD 0666 system system
|
||||
/dev/fimg2d 0666 system graphics
|
||||
/dev/fmradio 0660 system audio
|
||||
/dev/input/* 0660 root input
|
||||
/dev/srp 0666 system audio
|
||||
/dev/srp_ctrl 0666 system audio
|
||||
/dev/umts* 0660 system radio
|
||||
/dev/link_pm 0660 system radio
|
||||
/dev/block/mmcblk0p8 0660 system radio
|
||||
/dev/akm8975 0660 system system
|
||||
/dev/accelerometer 0660 system system
|
||||
/dev/graphics/fb0 0777 root graphics
|
||||
/dev/rfkill 0666 root root
|