OSDN Git Service

cleanup build files, remove now integrated libsensors and liblights, add "user" build...
authorStefan Seidel <android@stefanseidel.info>
Wed, 15 Feb 2012 22:37:52 +0000 (23:37 +0100)
committerStefan Seidel <android@stefanseidel.info>
Wed, 15 Feb 2012 22:37:52 +0000 (23:37 +0100)
BoardConfig.mk
liblights/Android.mk [deleted file]
liblights/lights.c [deleted file]
libsensors/Android.mk [deleted file]
libsensors/sensors.c [deleted file]
vendorsetup.sh
x41t.mk

index 2a3c48c..9317e8f 100644 (file)
@@ -1,29 +1,20 @@
-#TARGET_HAS_THIRD_PARTY_APPS := true
-
-#BOARD_WPA_SUPPLICANT_DRIVER:=AWEXT
-
-#BOARD_USES_TSLIB := true
-
-#BOARD_USES_I915C := true
-#BOARD_USES_DRM := true
-#BOARD_USES_HWOPENGL := true
-#TARGET_HARDWARE_3D := true
 BOARD_USES_WACOMINPUT := true
 
 #BOARD_USES_GENERIC_AUDIO := false
 BOARD_USES_ALSA_AUDIO := true
 BUILD_WITH_ALSA_UTILS := true
 
-#USE_CAMERA_STUB := false
+USE_CAMERA_STUB := false
 #BOARD_CAMERA_LIBRARIES := libcamera
 #BOARD_USES_OLD_CAMERA_HACK := true
 
 #BUILD_WITH_MPLAYER := true
 TARGET_HAS_THIRD_PARTY_APPS := true
-BOARD_USES_TSLIB := false
-BOARD_GPU_DRIVERS := i915g
-BOARD_USES_KBDSENSOR := true
+BOARD_GPU_DRIVERS := i915
+BOARD_USES_KBDSENSOR := false
+BOARD_USES_HDAPS_ACCEL := true
 #TARGET_CPU_SMP := false
+BOARD_KERNEL_CMDLINE := root=/dev/ram0 quiet androidboot.hardware=$(TARGET_PRODUCT) video=1024x768 i915.lvds_downclock=1 i915.powersave=1 usbcore.autosuspend=2
 
 include $(GENERIC_X86_CONFIG_MK)
 
diff --git a/liblights/Android.mk b/liblights/Android.mk
deleted file mode 100644 (file)
index 7ceaf77..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-# HAL module implemenation, not prelinked and stored in
-# hw/<COPYPIX_HARDWARE_MODULE_ID>.<ro.board.platform>.so
-include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := eng
-
-LOCAL_SRC_FILES := lights.c
-
-LOCAL_PRELINK_MODULE := false
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
-
-LOCAL_SHARED_LIBRARIES := liblog libcutils
-
-LOCAL_MODULE := lights.thinkpad_x41t
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/liblights/lights.c b/liblights/lights.c
deleted file mode 100644 (file)
index aabd575..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright (C) 2012 Stefan Seidel
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#define LOG_TAG "lights"
-
-#include <cutils/log.h>
-
-#include <stdint.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <pthread.h>
-
-#include <sys/ioctl.h>
-#include <sys/types.h>
-
-#include <hardware/lights.h>
-#include <cutils/properties.h>
-
-/******************************************************************************/
-
-static pthread_once_t g_init = PTHREAD_ONCE_INIT;
-static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER;
-static int max_brightness = 255;
-static char brightness_file[PROPERTY_VALUE_MAX] = {'\0'};
-
-char const*const LLP_BRIGHTNESS_FILE     = "backlight.brightness_file";
-char const*const LLP_MAX_BRIGHTNESS_FILE = "backlight.max_brightness_file";
-char const*const LLP_MAX_BRIGHTNESS      = "backlight.max_brightness";
-
-void init_globals(void)
-{
-    pthread_mutex_init(&g_lock, NULL);
-}
-
-static int write_int(char* path, int value)
-{
-    int fd;
-    static int already_warned = 0;
-
-    fd = open(path, O_RDWR);
-    if (fd >= 0) {
-        char buffer[20];
-        int bytes = sprintf(buffer, "%d\n", value);
-        int amt = write(fd, buffer, bytes);
-        close(fd);
-        return amt == -1 ? -errno : 0;
-    } else {
-        if (already_warned == 0) {
-            LOGE("write_int failed to open %s\n", path);
-            already_warned = 1;
-        }
-        return -errno;
-    }
-}
-
-static int read_int(char* path)
-{
-    int fd;
-
-    fd = open(path, O_RDONLY);
-    if (fd >= 0) {
-        char buffer[3];
-        int amt = read(fd, buffer, 3);
-        close(fd);
-        if (amt <= 0) return -errno;
-        int ret = -1;
-        amt = sscanf(buffer, "%d", &ret);
-        return amt == -1 ? -errno : ret;
-    } else {
-        return -errno;
-    }
-}
-
-static int rgb_to_brightness16(struct light_state_t const* state)
-{
-    int color = state->color & 0x00ffffff;
-    return ((77*((color>>16)&0x00ff)) + (150*((color>>8)&0x00ff)) + (29*(color&0x00ff)));
-}
-
-static int set_light_backlight(struct light_device_t* dev, struct light_state_t const* state)
-{
-    int err = 0;
-    int brightness = rgb_to_brightness16(state) / (65536 / (max_brightness+1));
-    LOGV("Setting display brightness to %d",brightness);
-
-    pthread_mutex_lock(&g_lock);
-    err = write_int(brightness_file, (brightness));
-    pthread_mutex_unlock(&g_lock);
-
-    return err;
-}
-
-static int close_lights(struct light_device_t *dev)
-{
-    if (dev) {
-        free(dev);
-    }
-    return 0;
-}
-
-
-static int open_lights(const struct hw_module_t* module, char const* name, struct hw_device_t** device)
-{
-    int (*set_light)(struct light_device_t* dev,
-            struct light_state_t const* state);
-
-    if (0 == strcmp(LIGHT_ID_BACKLIGHT, name)) {
-        set_light = set_light_backlight;
-        char max_b_file[PROPERTY_VALUE_MAX] = {'\0'};
-        if (property_get(LLP_MAX_BRIGHTNESS, max_b_file, NULL)) {
-            if (!sscanf(max_b_file, "%d", &max_brightness)) {
-                LOGE("%s system property is set to '%s', this could not be parsed as an integer!", LLP_MAX_BRIGHTNESS, max_b_file);
-                return -EINVAL;
-            }
-        } else {
-            if (property_get(LLP_MAX_BRIGHTNESS_FILE, max_b_file, NULL)) {
-                max_brightness = read_int(max_b_file);
-            } else {
-                LOGE("%s system property not set", LLP_MAX_BRIGHTNESS_FILE);
-                return -EINVAL;
-            }
-        }
-        LOGV("Read max display brightness of %d", max_brightness);
-        if (max_brightness < 1) {
-            max_brightness = 255;
-        }
-        if (!property_get(LLP_BRIGHTNESS_FILE, brightness_file, NULL)) {
-            LOGE("%s system property not set", LLP_BRIGHTNESS_FILE);
-            return -EINVAL;
-        }
-    }
-    else {
-        return -EINVAL;
-    }
-
-    pthread_once(&g_init, init_globals);
-
-    struct light_device_t *dev = malloc(sizeof(struct light_device_t));
-    memset(dev, 0, sizeof(*dev));
-
-    dev->common.tag = HARDWARE_DEVICE_TAG;
-    dev->common.close = (int (*)(struct hw_device_t*))close_lights;
-    dev->common.module = (struct hw_module_t*)module;
-    dev->common.version = 0;
-    dev->set_light = set_light;
-
-    *device = (struct hw_device_t*)dev;
-    return 0;
-}
-
-
-static struct hw_module_methods_t lights_module_methods = {
-    .open =  open_lights,
-};
-
-const struct hw_module_t HAL_MODULE_INFO_SYM = {
-    .tag = HARDWARE_MODULE_TAG,
-    .version_major = 1,
-    .version_minor = 0,
-    .id = LIGHTS_HARDWARE_MODULE_ID,
-    .name = "Generic sysfs liblights implementation",
-    .author = "Stefan Seidel",
-    .methods = &lights_module_methods,
-};
diff --git a/libsensors/Android.mk b/libsensors/Android.mk
deleted file mode 100644 (file)
index 5d8068c..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-# HAL module implemenation, not prelinked and stored in
-# hw/<COPYPIX_HARDWARE_MODULE_ID>.<ro.board.platform>.so
-include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := eng
-
-LOCAL_SRC_FILES := sensors.c
-
-LOCAL_PRELINK_MODULE := false
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
-
-LOCAL_SHARED_LIBRARIES := liblog libcutils
-
-LOCAL_MODULE := sensors.thinkpad_x41t
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/libsensors/sensors.c b/libsensors/sensors.c
deleted file mode 100644 (file)
index bae9808..0000000
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- *  (c) Copyright Bosch Sensortec GmbH 2011
-
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions are
- *   met:
- *
- *      * Redistributions of source code must retain the above copyright
- *         notice, this list of conditions and the following disclaimer.
- *      * Redistributions in binary form must reproduce the above
- *         copyright notice, this list of conditions and the following
- *         disclaimer in the documentation and/or other materials provided
- *         with the distribution.
- *      * Neither the name of the author nor the names of its
- *         contributors may be used to endorse or promote products derived
- *         from this software without specific prior written permission.
- *
- *
- *   THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- *   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- *   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- *   BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- *   BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- *   OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- *   IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdint.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <dirent.h>
-#include <math.h>
-#include <poll.h>
-#include <pthread.h>
-#include <linux/input.h>
-
-#include <cutils/atomic.h>
-#include <cutils/log.h>
-#include <hardware/sensors.h>
-
-#define DEBUG_SENSOR           0
-
-#define CONVERT                     (GRAVITY_EARTH / 156.0f)
-#define SENSOR_NAME            "hdaps"
-#define INPUT_DIR               "/dev/input"
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
-#define ID_ACCELERATION                (SENSORS_HANDLE_BASE + 0)
-
-#define AMIN(a,b) (((a)<(fabs(b)))?(a):(b))
-#define SQUARE(x)      ((x)*(x))
-#define COS_ASIN(m,x)  (sqrt(SQUARE(m)-SQUARE(AMIN(m,x))))
-#define COS_ASIN_2D(m,x,y)     (COS_ASIN(m,x)*COS_ASIN(m,y)/(m))
-
-struct sensors_poll_context_t {
-       struct sensors_poll_device_t device;
-       int fd;
-       char class_path[256];
-};
-
-static int common__close(struct hw_device_t *dev) {
-       struct sensors_poll_context_t *ctx = (struct sensors_poll_context_t *) dev;
-       if (ctx) {
-               free(ctx);
-       }
-
-       return 0;
-}
-
-static int device__activate(struct sensors_poll_device_t *dev, int handle,
-               int enabled) {
-
-       return 0;
-}
-
-static int device__set_delay(struct sensors_poll_device_t *device, int handle,
-               int64_t ns) {
-
-       return 0;
-
-}
-
-static int device__poll(struct sensors_poll_device_t *device,
-               sensors_event_t* data, int count) {
-
-       struct input_event event;
-       int ret;
-       struct sensors_poll_context_t *dev =
-                       (struct sensors_poll_context_t *) device;
-
-       if (dev->fd < 0)
-               return 0;
-
-       while (1) {
-
-               ret = read(dev->fd, &event, sizeof(event));
-
-#ifdef DEBUG_SENSOR
-               LOGD("read event %d - %d - %d\n", event.type, event.code, event.value);
-#endif
-               if (event.type == EV_ABS) {
-                       switch (event.code) {
-                       // Android imagines the device in portrait mode, but hdaps measures in landscape mode,
-                       // so swap x and y axis!
-                       case ABS_X:
-                               data->acceleration.x = (float) event.value * CONVERT;
-                               break;
-                       case ABS_Y:
-                               data->acceleration.y = -(float) event.value * CONVERT;
-                               break;
-                       }
-               } else if (event.type == EV_SYN) {
-                       data->timestamp = (int64_t) ((int64_t) event.time.tv_sec
-                                       * 1000000000 + (int64_t) event.time.tv_usec * 1000);
-                       // hdaps doesn't have z-axis, so simulate it by rotation matrix solution
-                       data ->acceleration.z
-                                       = COS_ASIN_2D(GRAVITY_EARTH, data->acceleration.x, data->acceleration.y);
-                       data->sensor = ID_ACCELERATION;
-                       data->type = SENSOR_TYPE_ACCELEROMETER;
-                       data->acceleration.status = SENSOR_STATUS_ACCURACY_HIGH;
-                       return 1;
-               }
-       }
-
-       return -errno;
-}
-
-static int sensor_get_class_path(struct sensors_poll_context_t *dev) {
-       char *dirname = "/sys/class/input";
-       char buf[256];
-       int res;
-       DIR *dir;
-       struct dirent *de;
-       int fd = -1;
-       int found = 0;
-
-       dir = opendir(dirname);
-       if (dir == NULL)
-               return -1;
-
-       while ((de = readdir(dir))) {
-               if (strncmp(de->d_name, "input", strlen("input")) != 0) {
-                       continue;
-               }
-
-               sprintf(dev->class_path, "%s/%s", dirname, de->d_name);
-               snprintf(buf, sizeof(buf), "%s/name", dev->class_path);
-
-               fd = open(buf, O_RDONLY);
-               if (fd < 0) {
-                       continue;
-               }
-               if ((res = read(fd, buf, sizeof(buf))) < 0) {
-                       close(fd);
-                       continue;
-               }
-               buf[res - 1] = '\0';
-               if (strcmp(buf, SENSOR_NAME) == 0) {
-                       found = 1;
-                       close(fd);
-                       break;
-               }
-
-               close(fd);
-               fd = -1;
-       }
-       closedir(dir);
-
-       if (found) {
-               return 0;
-       } else {
-               *dev->class_path = '\0';
-               return -1;
-       }
-
-}
-
-static int open_input_device(void) {
-       char *filename;
-       int fd;
-       DIR *dir;
-       struct dirent *de;
-       char name[80];
-       char devname[256];
-       dir = opendir(INPUT_DIR);
-       if (dir == NULL)
-               return -1;
-
-       strcpy(devname, INPUT_DIR);
-       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) {
-                       continue;
-               }
-
-               if (ioctl(fd, EVIOCGNAME(sizeof(name) - 1), &name) < 1) {
-                       name[0] = '\0';
-               }
-
-               if (!strcmp(name, SENSOR_NAME)) {
-#ifdef DEBUG_SENSOR
-                       LOGI("devname is %s \n", devname);
-#endif
-               } else {
-                       close(fd);
-                       continue;
-               }
-               closedir(dir);
-
-               return fd;
-
-       }
-       closedir(dir);
-
-       return -1;
-}
-
-static const struct sensor_t sSensorList[] = { //
-               { .name = "HDAPS accelerometer", //
-                               .vendor = "Linux kernel", //
-                               .version = 1, //
-                               .handle = ID_ACCELERATION, //
-                               .type = SENSOR_TYPE_ACCELEROMETER, //
-                               .maxRange = (GRAVITY_EARTH * 6.0f), //
-                               .resolution = (GRAVITY_EARTH * 6.0f) / 1024.0f, //
-                               .power = 0.84f, //
-                               .reserved = {}, //
-                               }, //
-               };
-
-static int open_sensors(const struct hw_module_t* module, const char* name,
-               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 };
-
-const 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 = "hdaps accelerometer sensor", //
-                                       .author = "Stefan Seidel", //
-                                       .methods = &sensors_module_methods, //
-                                       .dso = NULL, //
-                                       .reserved = {}, //
-                               },//
-                               get_sensors_list : sensors__get_sensors_list //
-               };
-
-static int open_sensors(const struct hw_module_t* module, const char* name,
-               struct hw_device_t** device) {
-       int status = -EINVAL;
-
-       struct sensors_poll_context_t *dev = malloc(
-                       sizeof(struct sensors_poll_context_t));
-       memset(&dev->device, 0, sizeof(struct sensors_poll_device_t));
-
-       dev->device.common.tag = HARDWARE_DEVICE_TAG;
-       dev->device.common.version = 0;
-       dev->device.common.module = (struct hw_module_t*) module;
-       dev->device.common.close = common__close;
-       dev->device.activate = device__activate;
-       dev->device.setDelay = device__set_delay;
-       dev->device.poll = device__poll;
-
-       if (sensor_get_class_path(dev) < 0) {
-               LOGE("g sensor get class path error \n");
-       } else {
-               dev->fd = open_input_device();
-               *device = &dev->device.common;
-               status = 0;
-       }
-
-       return status;
-}
index 7116a96..4e2ada3 100644 (file)
@@ -1 +1,2 @@
 add_lunch_combo thinkpad_x41t-eng
+add_lunch_combo thinkpad_x41t-user
diff --git a/x41t.mk b/x41t.mk
index 5771e0a..16a8b2e 100644 (file)
--- a/x41t.mk
+++ b/x41t.mk
@@ -1,16 +1,11 @@
 PRODUCT_PACKAGES := $(THIRD_PARTY_APPS)
-#PRODUCT_PACKAGES += sensors.$(TARGET_PRODUCT)
-PRODUCT_PACKAGES += lights.$(TARGET_PRODUCT)
-#PRODUCT_PACKAGES += sensors.hdaps
+PRODUCT_PACKAGES += lights.default
+PRODUCT_PACKAGES += sensors.$(TARGET_PRODUCT)
 PRODUCT_PACKAGES += wacom-input
-
-#PRODUCT_COPY_FILES := \
-#    $(LOCAL_PATH)/vold.fstab:system/etc/vold.fstab \
+PRODUCT_PACKAGES += su Superuser FileManager libchromium_net alsa_amixer radiooptions rild libreference-ril
 
 $(call inherit-product,$(SRC_TARGET_DIR)/product/generic_x86.mk)
 
-USE_SQUASHFS := 0
-
 PRODUCT_NAME := thinkpad_x41t
 PRODUCT_DEVICE := x41t
 PRODUCT_MANUFACTURER := ibm
@@ -18,7 +13,10 @@ PRODUCT_MANUFACTURER := ibm
 DEVICE_PACKAGE_OVERLAYS := $(LOCAL_PATH)/overlays
 
 #PRODUCT_COPY_FILES += \
-#      $(LOCAL_PATH)/init.x41t.sh:system/etc/init.x41t.sh
-#      $(LOCAL_PATH)/asound.conf:system/etc/asound.conf
+#    $(LOCAL_PATH)/system/etc/permissions/features.xml:system/etc/permissions/features.xml \
+#    $(LOCAL_PATH)/system/etc/permissions/com.google.android.media.effects.xml:system/etc/permissions/com.google.android.media.effects.xml \
+#    $(LOCAL_PATH)/system/etc/permissions/com.google.android.maps.xml:system/etc/permissions/com.google.android.maps.xml \
+#    $(LOCAL_PATH)/system/framework/com.google.android.maps.jar:system/framework/com.google.android.maps.jar \
+#    $(LOCAL_PATH)/system/framework/com.google.android.media.effects.jar:system/framework/com.google.android.media.effects.jar
 
 include $(call all-subdir-makefiles)