summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVishal Mahaveer2014-07-07 18:02:24 -0500
committerVishal Mahaveer2014-07-07 18:02:24 -0500
commitd020834787b241ad558474ea95afd1a1a9d561c1 (patch)
tree063e93eb3b77b5e601e116a446ea8731680f31c3
parent0083dd3bc678cd52b659593c5e33b60d89aebaf2 (diff)
downloaddevice-ti-common-open-d020834787b241ad558474ea95afd1a1a9d561c1.tar.gz
device-ti-common-open-d020834787b241ad558474ea95afd1a1a9d561c1.tar.xz
device-ti-common-open-d020834787b241ad558474ea95afd1a1a9d561c1.zip
cleanup: remove legacy sources
Remove unused source code Change-Id: Ia5e53fb56b52c0dc0c9a00c7938cd909dbdb3b69 Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
-rw-r--r--BoardConfig.mk77
-rw-r--r--board_identity/Android.mk1
-rw-r--r--board_identity/include/omap4_board_identity.h71
-rw-r--r--board_identity/src/Android.mk21
-rw-r--r--board_identity/src/app/Android.mk46
-rw-r--r--board_identity/src/app/AndroidManifest.xml22
-rw-r--r--board_identity/src/app/proguard.cfg40
-rw-r--r--board_identity/src/app/res/drawable-hdpi/about.pngbin5304 -> 0 bytes
-rw-r--r--board_identity/src/app/res/drawable-hdpi/exit.pngbin2499 -> 0 bytes
-rw-r--r--board_identity/src/app/res/drawable-hdpi/icon.pngbin39262 -> 0 bytes
-rw-r--r--board_identity/src/app/res/drawable-ldpi/about.pngbin5304 -> 0 bytes
-rw-r--r--board_identity/src/app/res/drawable-ldpi/exit.pngbin2499 -> 0 bytes
-rw-r--r--board_identity/src/app/res/drawable-ldpi/icon.pngbin39262 -> 0 bytes
-rw-r--r--board_identity/src/app/res/drawable-mdpi/about.pngbin5304 -> 0 bytes
-rw-r--r--board_identity/src/app/res/drawable-mdpi/exit.pngbin2499 -> 0 bytes
-rw-r--r--board_identity/src/app/res/drawable-mdpi/icon.pngbin39262 -> 0 bytes
-rw-r--r--board_identity/src/app/res/layout/main.xml203
-rw-r--r--board_identity/src/app/res/values/strings.xml31
-rw-r--r--board_identity/src/app/src/board_id/com/ti/BoardIDAgent.java211
-rw-r--r--board_identity/src/app/src/board_id/com/ti/BoardIDService.java157
-rw-r--r--board_identity/src/app/src/board_id/com/ti/Board_id_Activity.java263
-rw-r--r--board_identity/src/app/src/board_id/com/ti/IBoardIDService.aidl24
-rw-r--r--board_identity/src/daemon/Android.mk52
-rw-r--r--board_identity/src/daemon/Identity_daemon.c262
-rw-r--r--board_identity/src/jni/Android.mk56
-rw-r--r--board_identity/src/jni/com_ti_boardid_BoardID_JNI.cpp97
-rw-r--r--cpcam/Android.mk22
-rw-r--r--cpcam/cpcam-products.mk22
-rw-r--r--cpcam/products/AndroidProducts.mk27
-rw-r--r--cpcam/products/cpcam_sdk_addon.mk50
-rw-r--r--cpcam/products/stub_defs.txt18
-rw-r--r--cpcam/sdk_addon/hardware.ini19
-rw-r--r--cpcam/sdk_addon/manifest.ini61
-rw-r--r--mtpfuse/Android.mk28
-rw-r--r--mtpfuse/mtpfuse.cpp477
-rw-r--r--s3d/Android.mk13
-rw-r--r--s3d/apps/Android.mk1
-rw-r--r--s3d/apps/Cowboids/Android.mk16
-rw-r--r--s3d/apps/Cowboids/AndroidManifest.xml16
-rw-r--r--s3d/apps/Cowboids/res/drawable/cowboid.pngbin512726 -> 0 bytes
-rw-r--r--s3d/apps/Cowboids/res/drawable/icon.pngbin75488 -> 0 bytes
-rw-r--r--s3d/apps/Cowboids/res/layout/main.xml7
-rw-r--r--s3d/apps/Cowboids/res/values/strings.xml4
-rw-r--r--s3d/apps/Cowboids/src/com/ti/s3d/cube/CowboidsActivity.java46
-rw-r--r--s3d/apps/Cowboids/src/com/ti/s3d/cube/CubeScene.java101
-rw-r--r--s3d/apps/Cowboids/src/com/ti/s3d/cube/TexturedCube.java210
-rw-r--r--s3d/apps/Cowboids/src/com/ti/s3d/render/Scene.java26
-rw-r--r--s3d/apps/Cowboids/src/com/ti/s3d/render/StereoGLView.java61
-rw-r--r--s3d/apps/Cowboids/src/com/ti/s3d/render/StereoRenderer.java190
-rw-r--r--s3d/frameworks/Android.mk49
-rw-r--r--s3d/frameworks/com.ti.s3d.xml5
-rw-r--r--s3d/frameworks/java/com/ti/s3d/S3DView.java332
-rw-r--r--s3d/frameworks/jni/Android.mk35
-rw-r--r--s3d/frameworks/jni/S3DView.cpp267
-rw-r--r--s3d/products/AndroidProducts.mk13
-rw-r--r--s3d/products/s3d_sdk_addon.mk39
-rw-r--r--s3d/products/stub_defs.txt1
-rw-r--r--s3d/s3d-products.mk13
-rw-r--r--s3d/sdk_addon/hardware.ini3
-rw-r--r--s3d/sdk_addon/manifest.ini11
-rw-r--r--sensor_test_app/Android.mk28
-rw-r--r--sensor_test_app/AndroidManifest.xml38
-rw-r--r--sensor_test_app/res/drawable-hdpi/about.pngbin5304 -> 0 bytes
-rw-r--r--sensor_test_app/res/drawable-hdpi/exit.pngbin2499 -> 0 bytes
-rw-r--r--sensor_test_app/res/drawable-hdpi/icon.pngbin2731 -> 0 bytes
-rw-r--r--sensor_test_app/res/drawable-ldpi/about.pngbin5304 -> 0 bytes
-rw-r--r--sensor_test_app/res/drawable-ldpi/exit.pngbin2499 -> 0 bytes
-rw-r--r--sensor_test_app/res/drawable-ldpi/icon.pngbin2731 -> 0 bytes
-rw-r--r--sensor_test_app/res/drawable-mdpi/about.pngbin5304 -> 0 bytes
-rw-r--r--sensor_test_app/res/drawable-mdpi/exit.pngbin2499 -> 0 bytes
-rw-r--r--sensor_test_app/res/drawable-mdpi/icon.pngbin2731 -> 0 bytes
-rw-r--r--sensor_test_app/res/layout/main.xml259
-rw-r--r--sensor_test_app/res/values/strings.xml57
-rw-r--r--sensor_test_app/src/sensor/test/com/android/sensor/Main.java500
-rw-r--r--sensor_test_app/src/sensor/test/com/android/sensor/Sensor_data.java214
-rw-r--r--sensor_test_app/src/sensor/test/com/android/sensor/Sensor_management.java271
76 files changed, 0 insertions, 5184 deletions
diff --git a/BoardConfig.mk b/BoardConfig.mk
deleted file mode 100644
index 474c579..0000000
--- a/BoardConfig.mk
+++ /dev/null
@@ -1,77 +0,0 @@
1#
2# Copyright (C) 2012 Texas Instruments Inc.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17# Common Makefile to be included at the bottom of each device's
18# BoardConfig.mk file. Definitions here are supposed to be device independent.
19
20
21# Function to check malformed boolean variable
22define ti-check-boolean-var
23$(if $(call filter,true,$($(1))),,$(if $($(1)),\
24 $(error Boolean variable $(1) is set to "$($(1))". Expected: "true" or undefined),))
25endef
26
27
28# Check boolean variables
29$(call ti-check-boolean-var,ENHANCED_DOMX)
30$(call ti-check-boolean-var,OMAP_ENHANCEMENT)
31$(call ti-check-boolean-var,OMAP_ENHANCEMENT_S3D)
32$(call ti-check-boolean-var,OMAP_ENHANCEMENT_CPCAM)
33$(call ti-check-boolean-var,OMAP_ENHANCEMENT_VTC)
34$(call ti-check-boolean-var,OMAP_ENHANCEMENT_BURST_CAPTURE)
35$(call ti-check-boolean-var,USE_ITTIAM_AAC)
36$(call ti-check-boolean-var,OMAP_ENHANCEMENT_MULTIGPU)
37
38
39# Makefile variable and C/C++ macro to recognise DOMX version
40ifdef ENHANCED_DOMX
41 COMMON_GLOBAL_CFLAGS += -DENHANCED_DOMX
42 DOMX_PATH := hardware/ti/domx
43else
44 DOMX_PATH := hardware/ti/omap4xxx/domx
45endif
46
47# C/C++ macros for OMAP_ENHANCEMENT
48ifdef OMAP_ENHANCEMENT
49 COMMON_GLOBAL_CFLAGS += -DOMAP_ENHANCEMENT -DTARGET_OMAP4
50endif
51
52ifdef OMAP_ENHANCEMENT_BURST_CAPTURE
53 COMMON_GLOBAL_CFLAGS += -DOMAP_ENHANCEMENT_BURST_CAPTURE
54endif
55
56ifdef OMAP_ENHANCEMENT_S3D
57 COMMON_GLOBAL_CFLAGS += -DOMAP_ENHANCEMENT_S3D
58endif
59
60ifdef OMAP_ENHANCEMENT_CPCAM
61 COMMON_GLOBAL_CFLAGS += -DOMAP_ENHANCEMENT_CPCAM
62endif
63
64ifdef OMAP_ENHANCEMENT_VTC
65 COMMON_GLOBAL_CFLAGS += -DOMAP_ENHANCEMENT_VTC
66endif
67
68ifdef USE_ITTIAM_AAC
69 COMMON_GLOBAL_CFLAGS += -DUSE_ITTIAM_AAC
70endif
71
72ifdef OMAP_ENHANCEMENT_MULTIGPU
73 COMMON_GLOBAL_CFLAGS += -DOMAP_ENHANCEMENT_MULTIGPU
74endif
75
76# Undefine local functions
77ti-check-boolean-var :=
diff --git a/board_identity/Android.mk b/board_identity/Android.mk
deleted file mode 100644
index 5053e7d..0000000
--- a/board_identity/Android.mk
+++ /dev/null
@@ -1 +0,0 @@
1include $(call all-subdir-makefiles)
diff --git a/board_identity/include/omap4_board_identity.h b/board_identity/include/omap4_board_identity.h
deleted file mode 100644
index bb37d49..0000000
--- a/board_identity/include/omap4_board_identity.h
+++ /dev/null
@@ -1,71 +0,0 @@
1/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _OMAP4_BOARD_IDENTITY_H
18#define _OMAP4_BOARD_IDENTITY_H
19
20#if __cplusplus
21extern "C" {
22#endif
23
24#define SOC_FAMILY 0
25#define SOC_REV 1
26#define SOC_TYPE 2
27#define SOC_MAX_FREQ 3
28#define APPS_BOARD_REV 4
29#define CPU_MAX_FREQ 5
30#define CPU_GOV 6
31#define LINUX_VERSION 7
32#define LINUX_PVR_VER 8
33#define LINUX_CMDLINE 9
34#define LINUX_CPU1_STAT 10
35#define LINUX_OFF_MODE 11
36#define WILINK_VERSION 12
37#define DPLL_TRIM 13
38#define RBB_TRIM 14
39#define PRODUCTION_ID 15
40#define DIE_ID 16
41#define MAX_FIELDS (DIE_ID + 1)
42
43#define PROP_DISPLAY_ID 0
44#define PROP_BUILD_TYPE 1
45#define PROP_SER_NO 2
46#define PROP_BOOTLOADER 3
47#define PROP_DEBUGGABLE 4
48#define PROP_CRYPTO_STATE 5
49#define MAX_PROP (PROP_CRYPTO_STATE + 1)
50
51#define GOV_STRING "/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
52#define CPU1_ONLINE "/sys/devices/system/cpu/cpu1/online"
53#define OFF_MODE "/sys/kernel/debug/pm_debug/enable_off_mode"
54#define GOV_PERFORMANCE 0
55#define GOV_HOTPLUG 1
56#define GOV_ONDEMAND 2
57#define GOV_INTERACTIVE 3
58#define GOV_USERSPACE 4
59#define GOV_CONSERVATIVE 5
60#define GOV_POWERSAVE 6
61#define GOV_MAX 7
62
63char* get_device_identity(int id_number);
64char* get_device_property(int id_number);
65int set_governor(int governor);
66char* get_dpll_trim_val(void);
67#if __cplusplus
68} // extern "C"
69#endif
70
71#endif // _OMAP4_BOARD_IDENTITY_H
diff --git a/board_identity/src/Android.mk b/board_identity/src/Android.mk
deleted file mode 100644
index 3629f10..0000000
--- a/board_identity/src/Android.mk
+++ /dev/null
@@ -1,21 +0,0 @@
1#
2# Copyright (C) 2011 The Android Open Source Project
3# Copyright (C) 2010-2012 Texas Instruments, Inc. All rights reserved.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17ifeq ($(findstring omap, $(TARGET_BOARD_PLATFORM)),omap)
18LOCAL_PATH := $(call my-dir)
19include $(call all-makefiles-under,$(LOCAL_PATH))
20endif
21
diff --git a/board_identity/src/app/Android.mk b/board_identity/src/app/Android.mk
deleted file mode 100644
index 0fa5dc9..0000000
--- a/board_identity/src/app/Android.mk
+++ /dev/null
@@ -1,46 +0,0 @@
1#
2# Copyright (C) 2011 The Android Open Source Project
3# Copyright (C) 2010-2012 Texas Instruments, Inc. All rights reserved.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17
18
19ifeq ($(findstring omap, $(TARGET_BOARD_PLATFORM)),omap)
20ifeq ($(origin TARGET_BUILD_PDK),undefined)
21
22LOCAL_PATH:= $(call my-dir)
23include $(CLEAR_VARS)
24LOCAL_MODULE_TAGS := optional
25LOCAL_SHARED_LIBRARIES := libandroid_runtime
26LOCAL_JAVA_LIBRARIES := framework
27LOCAL_SRC_FILES := src/board_id/com/ti/Board_id_Activity.java \
28 src/board_id/com/ti/BoardIDService.java \
29 src/board_id/com/ti/IBoardIDService.aidl
30LOCAL_PACKAGE_NAME := Board_id
31LOCAL_CERTIFICATE := platform
32LOCAL_SDK_VERSION := current
33include $(BUILD_PACKAGE)
34
35include $(CLEAR_VARS)
36LOCAL_MODULE_TAGS := optional
37LOCAL_SRC_FILES := src/board_id/com/ti/BoardIDAgent.java \
38 src/board_id/com/ti/IBoardIDService.aidl
39LOCAL_MODULE := board_id.com.ti
40LOCAL_JNI_SHARED_LIBRARIES := libboard_idJNI
41LOCAL_CERTIFICATE := platform
42LOCAL_SDK_VERSION := current
43include $(BUILD_STATIC_JAVA_LIBRARY)
44
45endif
46endif
diff --git a/board_identity/src/app/AndroidManifest.xml b/board_identity/src/app/AndroidManifest.xml
deleted file mode 100644
index fa04d6f..0000000
--- a/board_identity/src/app/AndroidManifest.xml
+++ /dev/null
@@ -1,22 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 package="board_id.com.ti"
4 android:versionCode="1"
5 android:versionName="1.0">
6 <uses-sdk android:minSdkVersion="7" />
7
8 <application android:icon="@drawable/icon" android:label="@string/app_name">
9 <activity android:name=".Board_id_Activity"
10 android:label="@string/app_name">
11 <service android:name="board_id.com.ti.BoardIDService"
12 android:process=":BoardIDService">
13 </service>
14 <intent-filter>
15 <action android:name="android.intent.action.MAIN" />
16 <category
17 android:name="android.intent.category.LAUNCHER" />
18 </intent-filter>
19 </activity>
20
21 </application>
22</manifest>
diff --git a/board_identity/src/app/proguard.cfg b/board_identity/src/app/proguard.cfg
deleted file mode 100644
index b1cdf17..0000000
--- a/board_identity/src/app/proguard.cfg
+++ /dev/null
@@ -1,40 +0,0 @@
1-optimizationpasses 5
2-dontusemixedcaseclassnames
3-dontskipnonpubliclibraryclasses
4-dontpreverify
5-verbose
6-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
7
8-keep public class * extends android.app.Activity
9-keep public class * extends android.app.Application
10-keep public class * extends android.app.Service
11-keep public class * extends android.content.BroadcastReceiver
12-keep public class * extends android.content.ContentProvider
13-keep public class * extends android.app.backup.BackupAgentHelper
14-keep public class * extends android.preference.Preference
15-keep public class com.android.vending.licensing.ILicensingService
16
17-keepclasseswithmembernames class * {
18 native <methods>;
19}
20
21-keepclasseswithmembers class * {
22 public <init>(android.content.Context, android.util.AttributeSet);
23}
24
25-keepclasseswithmembers class * {
26 public <init>(android.content.Context, android.util.AttributeSet, int);
27}
28
29-keepclassmembers class * extends android.app.Activity {
30 public void *(android.view.View);
31}
32
33-keepclassmembers enum * {
34 public static **[] values();
35 public static ** valueOf(java.lang.String);
36}
37
38-keep class * implements android.os.Parcelable {
39 public static final android.os.Parcelable$Creator *;
40}
diff --git a/board_identity/src/app/res/drawable-hdpi/about.png b/board_identity/src/app/res/drawable-hdpi/about.png
deleted file mode 100644
index 7c55dfd..0000000
--- a/board_identity/src/app/res/drawable-hdpi/about.png
+++ /dev/null
Binary files differ
diff --git a/board_identity/src/app/res/drawable-hdpi/exit.png b/board_identity/src/app/res/drawable-hdpi/exit.png
deleted file mode 100644
index 619858c..0000000
--- a/board_identity/src/app/res/drawable-hdpi/exit.png
+++ /dev/null
Binary files differ
diff --git a/board_identity/src/app/res/drawable-hdpi/icon.png b/board_identity/src/app/res/drawable-hdpi/icon.png
deleted file mode 100644
index a551e62..0000000
--- a/board_identity/src/app/res/drawable-hdpi/icon.png
+++ /dev/null
Binary files differ
diff --git a/board_identity/src/app/res/drawable-ldpi/about.png b/board_identity/src/app/res/drawable-ldpi/about.png
deleted file mode 100644
index 7c55dfd..0000000
--- a/board_identity/src/app/res/drawable-ldpi/about.png
+++ /dev/null
Binary files differ
diff --git a/board_identity/src/app/res/drawable-ldpi/exit.png b/board_identity/src/app/res/drawable-ldpi/exit.png
deleted file mode 100644
index 619858c..0000000
--- a/board_identity/src/app/res/drawable-ldpi/exit.png
+++ /dev/null
Binary files differ
diff --git a/board_identity/src/app/res/drawable-ldpi/icon.png b/board_identity/src/app/res/drawable-ldpi/icon.png
deleted file mode 100644
index a551e62..0000000
--- a/board_identity/src/app/res/drawable-ldpi/icon.png
+++ /dev/null
Binary files differ
diff --git a/board_identity/src/app/res/drawable-mdpi/about.png b/board_identity/src/app/res/drawable-mdpi/about.png
deleted file mode 100644
index 7c55dfd..0000000
--- a/board_identity/src/app/res/drawable-mdpi/about.png
+++ /dev/null
Binary files differ
diff --git a/board_identity/src/app/res/drawable-mdpi/exit.png b/board_identity/src/app/res/drawable-mdpi/exit.png
deleted file mode 100644
index 619858c..0000000
--- a/board_identity/src/app/res/drawable-mdpi/exit.png
+++ /dev/null
Binary files differ
diff --git a/board_identity/src/app/res/drawable-mdpi/icon.png b/board_identity/src/app/res/drawable-mdpi/icon.png
deleted file mode 100644
index a551e62..0000000
--- a/board_identity/src/app/res/drawable-mdpi/icon.png
+++ /dev/null
Binary files differ
diff --git a/board_identity/src/app/res/layout/main.xml b/board_identity/src/app/res/layout/main.xml
deleted file mode 100644
index 79789c8..0000000
--- a/board_identity/src/app/res/layout/main.xml
+++ /dev/null
@@ -1,203 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
3 android:id="@+id/scrllvwNo1"
4 android:layout_width="fill_parent"
5 android:layout_height="wrap_content"
6 >
7 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
8 android:orientation="vertical"
9 android:scrollbars="vertical"
10 android:layout_width="fill_parent"
11 android:layout_height="fill_parent"
12 android:weightSum="1"
13 >
14 <TextView android:layout_width="wrap_content"
15 android:id="@+id/textView1"
16 android:textAppearance="?android:attr/textAppearanceLarge"
17 android:text="@string/dev_info_title"
18 android:layout_height="wrap_content">
19 </TextView>
20 <TextView
21 android:layout_width="fill_parent"
22 android:layout_height="wrap_content"
23 android:textAppearance="?android:attr/textAppearanceMedium"
24 android:id="@+id/family"
25 android:text="@string/proc_family"
26 />
27 <TextView
28 android:layout_width="fill_parent"
29 android:layout_height="wrap_content"
30 android:textAppearance="?android:attr/textAppearanceMedium"
31 android:id="@+id/type"
32 android:text="@string/proc_type"
33 />
34 <TextView
35 android:layout_width="fill_parent"
36 android:layout_height="wrap_content"
37 android:textAppearance="?android:attr/textAppearanceMedium"
38 android:id="@+id/version"
39 android:text="@string/proc_version"
40 />
41 <TextView
42 android:layout_width="wrap_content"
43 android:id="@+id/prod_id"
44 android:textAppearance="?android:attr/textAppearanceMedium"
45 android:text="@string/prod_id_string"
46 android:layout_height="wrap_content">
47 </TextView>
48 <TextView
49 android:layout_width="wrap_content"
50 android:id="@+id/die_id"
51 android:textAppearance="?android:attr/textAppearanceMedium"
52 android:text="@string/die_id_string"
53 android:layout_height="wrap_content">
54 </TextView>
55 <TextView
56 android:layout_width="wrap_content"
57 android:id="@+id/serial_no"
58 android:textAppearance="?android:attr/textAppearanceMedium"
59 android:text="@string/ser_no"
60 android:layout_height="wrap_content">
61 </TextView>
62 <TextView
63 android:layout_width="fill_parent"
64 android:layout_height="wrap_content"
65 android:textAppearance="?android:attr/textAppearanceMedium"
66 android:id="@+id/max_freq"
67 android:text="@string/proc_max_freq"
68 />
69 <TextView
70 android:layout_width="fill_parent"
71 android:layout_height="wrap_content"
72 android:textAppearance="?android:attr/textAppearanceMedium"
73 android:id="@+id/rated_freq"
74 android:text="@string/proc_rated_freq"
75 />
76 <TextView
77 android:layout_width="fill_parent"
78 android:layout_height="wrap_content"
79 android:textAppearance="?android:attr/textAppearanceMedium"
80 android:id="@+id/dpll_trim"
81 android:text="@string/dpll_trim_string"
82 />
83 <TextView
84 android:layout_width="fill_parent"
85 android:layout_height="wrap_content"
86 android:textAppearance="?android:attr/textAppearanceMedium"
87 android:id="@+id/rbb_trim"
88 android:text="@string/rbb_trim_string"
89 />
90 <TextView
91 android:layout_width="fill_parent"
92 android:layout_height="wrap_content"
93 android:textAppearance="?android:attr/textAppearanceMedium"
94 android:id="@+id/apps_brd_rev"
95 android:text="@string/apps_brd_rev"
96 />
97 <TextView
98 android:layout_width="fill_parent"
99 android:layout_height="wrap_content"
100 android:textAppearance="?android:attr/textAppearanceMedium"
101 android:id="@+id/wilink_version"
102 android:text="@string/wilink_version"
103 />
104 <TextView
105 android:layout_width="fill_parent"
106 android:layout_height="wrap_content"
107 android:textAppearance="?android:attr/textAppearanceMedium"
108 android:id="@+id/kernel_ver"
109 android:text="@string/kernel_version"
110 />
111 <TextView
112 android:layout_width="fill_parent"
113 android:layout_height="wrap_content"
114 android:textAppearance="?android:attr/textAppearanceMedium"
115 android:id="@+id/pvr_version"
116 android:text="@string/pvr_string"
117 />
118 <TextView
119 android:layout_width="fill_parent"
120 android:layout_height="wrap_content"
121 android:textAppearance="?android:attr/textAppearanceMedium"
122 android:id="@+id/cmd_line"
123 android:text="@string/cmd_line"
124 />
125 <TextView android:id="@+id/blank_line_5"
126 android:layout_width="wrap_content"
127 android:layout_height="wrap_content">
128 </TextView>
129 <TextView
130 android:layout_width="wrap_content"
131 android:id="@+id/textView1"
132 android:textAppearance="?android:attr/textAppearanceLarge"
133 android:text="@string/build_info_title"
134 android:layout_height="wrap_content">
135 </TextView>
136 <TextView
137 android:layout_width="wrap_content"
138 android:id="@+id/boot_ver"
139 android:textAppearance="?android:attr/textAppearanceMedium"
140 android:text="@string/bootloader_version"
141 android:layout_height="wrap_content"></TextView>
142 <TextView
143 android:layout_width="wrap_content"
144 android:id="@+id/build_ver"
145 android:textAppearance="?android:attr/textAppearanceMedium"
146 android:text="@string/build_version"
147 android:layout_height="wrap_content"></TextView>
148 <TextView
149 android:layout_width="wrap_content"
150 android:id="@+id/board_ver"
151 android:textAppearance="?android:attr/textAppearanceMedium"
152 android:text="@string/brd_rev"
153 android:layout_height="wrap_content"></TextView>
154 <TextView
155 android:layout_width="wrap_content"
156 android:textAppearance="?android:attr/textAppearanceMedium"
157 android:id="@+id/build_type"
158 android:text="@string/build_type_string"
159 android:layout_height="wrap_content"></TextView>
160 <TextView
161 android:layout_width="wrap_content"
162 android:textAppearance="?android:attr/textAppearanceMedium"
163 android:id="@+id/crypto_state"
164 android:text="@string/crypto_string"
165 android:layout_height="wrap_content">
166 </TextView>
167 <TextView android:id="@+id/blank_line_6"
168 android:layout_width="wrap_content"
169 android:layout_height="wrap_content">
170 </TextView>
171 <TextView
172 android:layout_width="wrap_content"
173 android:textAppearance="?android:attr/textAppearanceLarge"
174 android:id="@+id/textView2"
175 android:text="@string/runtime_info_title"
176 android:layout_height="wrap_content">
177 </TextView>
178 <TextView
179 android:layout_width="fill_parent"
180 android:layout_height="wrap_content"
181 android:textAppearance="?android:attr/textAppearanceMedium"
182 android:id="@+id/cpu1_status"
183 android:text="@string/cpu1_string"
184 />
185 <TextView
186 android:layout_width="fill_parent"
187 android:layout_height="wrap_content"
188 android:textAppearance="?android:attr/textAppearanceMedium"
189 android:id="@+id/governor"
190 android:text="@string/curr_gov"
191 />
192 <!-- Remove the button since we cannot write to the governor
193 <Button android:text="@string/gov_change_string"
194 android:id="@+id/gov_button"
195 android:layout_width="wrap_content"
196 android:layout_height="wrap_content">
197 </Button>-->
198 <TextView android:id="@+id/blank_line_7"
199 android:layout_width="wrap_content"
200 android:layout_height="wrap_content">
201 </TextView>
202 </LinearLayout>
203</ScrollView>
diff --git a/board_identity/src/app/res/values/strings.xml b/board_identity/src/app/res/values/strings.xml
deleted file mode 100644
index 6d376ac..0000000
--- a/board_identity/src/app/res/values/strings.xml
+++ /dev/null
@@ -1,31 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<resources>
3 <string name="board_id_header">TI Board ID Application</string>
4 <string name="app_name">TI Board ID App</string>
5 <string name="build_info_title">Build Informaion </string>
6 <string name="dev_info_title">Device Information </string>
7 <string name="runtime_info_title">Runtime Information</string>
8 <string name="proc_family">Processor Family = </string>
9 <string name="proc_type">Processor Type = </string>
10 <string name="proc_version">Processor Version = </string>
11 <string name="proc_max_freq">Maximum Freq = </string>
12 <string name="proc_rated_freq">Rated Frequency = </string>
13 <string name="apps_brd_rev">Apps Board Rev = </string>
14 <string name="cmd_line">Command Line = </string>
15 <string name="kernel_version">Kernel Version = </string>
16 <string name="curr_gov">Current Governor = </string>
17 <string name="bootloader_version">Bootloader Version = </string>
18 <string name="build_version">Bu‎ild Version = </string>
19 <string name="brd_rev">Board Revision = </string>
20 <string name="ser_no">Serial Number = </string>
21 <string name="build_type_string">Build Type = </string>
22 <string name="crypto_string">Crypto State = </string>
23 <string name="pvr_string">PVR/SGX Version = </string>
24 <string name="gov_change_string">Change Governor</string>
25 <string name="cpu1_string">CPU1 Status = </string>
26 <string name="wilink_version">WiLink Version = </string>
27 <string name="dpll_trim_string">DPLL Trimmed = </string>
28 <string name="rbb_trim_string">RBB Trimmed = </string>
29 <string name="prod_id_string">Production ID = </string>
30 <string name="die_id_string">Die ID = </string>
31</resources>
diff --git a/board_identity/src/app/src/board_id/com/ti/BoardIDAgent.java b/board_identity/src/app/src/board_id/com/ti/BoardIDAgent.java
deleted file mode 100644
index e761c5a..0000000
--- a/board_identity/src/app/src/board_id/com/ti/BoardIDAgent.java
+++ /dev/null
@@ -1,211 +0,0 @@
1/*
2 * Copyright (C) 2011 The Android Open Source Project
3 * Copyright (C) 2010-2012 Texas Instruments, Inc. All rights reserved.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18package board_id.com.ti;
19
20import android.app.Activity;
21import android.util.Log;
22
23import android.content.Context;
24import android.os.IBinder;
25import android.os.Message;
26import android.os.RemoteException;
27import android.content.ComponentName;
28import android.content.Intent;
29import android.content.ServiceConnection;
30
31/**
32* @brief
33* BoardIDAgent is the main entry point to the BoardIDDaemon
34*
35*/
36public class BoardIDAgent implements ServiceConnection {
37
38 private static final String TAG = "BoardIDAgent";
39 private IBinder mServiceToken;
40 private IBoardIDService mService;
41 private static Context mContext;
42 private boolean mConnected;
43 private static BoardIDAgentConnection mClient;
44
45 /**
46 * Constructor[s]
47 */
48 public BoardIDAgent(Context context, BoardIDAgentConnection client) {
49 mContext = context;
50 mClient = client;
51 mService = null;
52 mServiceToken = null;
53 mConnected = false;
54 }
55
56 /**
57 *
58 * Creates a connection to the BoardIDService.
59 * (System call by Android! no direct invocation)
60 *
61 */
62 public void onServiceConnected(ComponentName className, IBinder service) {
63 synchronized( this ) {
64 mService = IBoardIDService.Stub.asInterface((IBinder)service);
65 mServiceToken = (IBinder)service;
66 mConnected = true;
67 if (mClient != null)
68 mClient.onAgentConnected();
69 }
70 }
71
72 /**
73 *
74 * Releases the connection to the BoardIDDaemon.
75 * (System call by Android! no direct invocation)
76 *
77 */
78 public void onServiceDisconnected(ComponentName className) {
79 synchronized( this ) {
80 mClient.onAgentDisconnected();
81 mService = null;
82 mServiceToken = null;
83 mConnected = false;
84 }
85 }
86
87 /** Creates a connection to the BoardIDDaemon. */
88 public void Connect() {
89 synchronized( this ) {
90 if (!mConnected) {
91 Intent intent = new Intent("board_id.com.ti.IBoardIDService");
92 if (!mContext.bindService(intent, this, Context.BIND_AUTO_CREATE)) {
93 Log.e(TAG, " Failed to launch intent connecting to IBoardIDService");
94 } else {
95 mConnected = true;
96 Log.e(TAG, " Connect():: TRUELY connected!");
97 }
98 }
99 else
100 {
101 Log.d(TAG, "Already connected!");
102 }
103 }
104 }
105
106 /**
107 *
108 * Releases the connection to the BoardIDDaemon.
109 *
110 */
111 public void Disconnect() {
112 synchronized (this) {
113 if (mConnected) {
114 try {
115 mContext.unbindService(this);
116 } catch (IllegalArgumentException ex) {
117 Log.v(TAG, " Could not disconnect from service: "+ex.toString());
118 }
119 mConnected = false;
120 } else {
121 Log.d(TAG, "Already disconnected!");
122 }
123 }
124 }
125
126 /**
127 *
128 * Returns whether we are connected to the BoardIDDaemon service
129 * @return true if we are connected, false otherwise
130 */
131 public synchronized boolean isConnected() {
132 return (mConnected);
133 }
134
135 /**
136 * Defines a power state for the USP's current profile.
137 *
138 * @param state - power state to configure USP with
139 */
140 public int GetBoardProp(int value)
141 {
142 int ret = 0;
143
144 if (mService != null) {
145 try {
146 mService.GetBoardProp(value);
147 } catch (RemoteException e) {
148 Log.e(TAG, " Remote call exception: " + e.toString());
149 } catch (NullPointerException e2) {
150 Log.e(TAG, " Null pointer exception: "+ e2.toString());
151 }
152 }
153 return ret;
154 }
155
156 public int GetProperty(int value)
157 {
158 int ret = 0;
159
160 if (mService != null) {
161 try {
162 mService.GetProperty(value);
163 } catch (RemoteException e) {
164 Log.e(TAG, " Remote call exception: " + e.toString());
165 } catch (NullPointerException e2) {
166 Log.e(TAG, " Null pointer exception: "+ e2.toString());
167 }
168 }
169 return ret;
170 }
171
172 public int SetGovernor(int value)
173 {
174 int ret = 0;
175
176 if (mService != null) {
177 try {
178 ret = mService.SetGovernor(value);
179 } catch (RemoteException e) {
180 Log.e(TAG, " Remote call exception: " + e.toString());
181 } catch (NullPointerException e2) {
182 Log.e(TAG, " Null pointer exception: "+ e2.toString());
183 }
184 }
185 return ret;
186 }
187
188 //**************************************************************************
189 // INTERFACES
190 //**************************************************************************
191
192 /**
193 *
194 * A callback interface that allows the applications (clients
195 * of the BoardIDAgent) to operate on the BoardID Service, i.e.
196 * connect to / disconnect from it.
197 *
198 */
199 public interface BoardIDAgentConnection {
200
201 /** Called when the BoardIDAgent connects to the BoardIDService */
202 public void onAgentConnected();
203
204 /** Called when the BoardIDDaemon changes the Power State */
205 public void onPowerStateChange(int newState);
206
207 /** Called when the BoardIDAgent disconnects from the BoardIDService */
208 public void onAgentDisconnected();
209 }
210}
211
diff --git a/board_identity/src/app/src/board_id/com/ti/BoardIDService.java b/board_identity/src/app/src/board_id/com/ti/BoardIDService.java
deleted file mode 100644
index 6c82f65..0000000
--- a/board_identity/src/app/src/board_id/com/ti/BoardIDService.java
+++ /dev/null
@@ -1,157 +0,0 @@
1/*
2 * Copyright (C) 2011 The Android Open Source Project
3 * Copyright (C) 2010-2012 Texas Instruments, Inc. All rights reserved.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18package board_id.com.ti;
19
20import android.app.PendingIntent;
21import android.app.Service;
22import android.content.Context;
23import android.content.Intent;
24import android.content.res.Configuration;
25import android.os.Bundle;
26import android.os.Handler;
27import android.os.IBinder;
28import android.os.Message;
29import android.os.PowerManager;
30import android.os.RemoteException;
31import android.util.Log;
32
33public class BoardIDService extends Service {
34
35 private static final String TAG = "BoardIDService";
36 public static final int SOC_FAMILY = 0;
37 public static final int SOC_REV = 1;
38 public static final int SOC_TYPE = 2;
39 public static final int SOC_MAX_FREQ = 3;
40 public static final int APPS_BOARD_REV = 4;
41 public static final int CPU_MAX_FREQ = 5;
42 public static final int CPU_GOV = 6;
43 public static final int LINUX_VERSION = 7;
44 public static final int LINUX_PVR_VER = 8;
45 public static final int LINUX_CMDLINE = 9;
46 public static final int LINUX_CPU1_STAT = 10;
47 public static final int LINUX_OFF_MODE = 11;
48 public static final int WILINK_VERSION = 12;
49 public static final int DPLL_TRIM = 13;
50 public static final int RBB_TRIM = 14;
51 public static final int PRODUCTION_ID = 15;
52 public static final int DIE_ID = 16;
53
54 public static final int PROP_DISPLAY_ID = 0;
55 public static final int PROP_BUILD_TYPE = 1;
56 public static final int PROP_SER_NO = 2;
57 public static final int PROP_BOOTLOADER = 3;
58 public static final int PROP_DEBUGGABLE = 4;
59 public static final int PROP_CRYPTO_STATE = 5;
60
61 // Reference to the system power manager
62 protected PowerManager pm;
63
64 // Used to control the service's wakelock
65 protected PowerManager.WakeLock serviceWakeLock;
66
67 // Constructor method which sets up any needed initializations.
68 public BoardIDService() {
69 super();
70 }
71
72 // Overrides the Service class's standard method. It loads the ThermalObserver
73 @Override
74 public void onCreate() {
75
76 //Log.d(TAG,"+BoardIDService.onCreate loading JNI");
77 System.load("/system/lib/libboard_idJNI.so");
78 // Let's {responsibly} control the power state
79 pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
80 // get a wake lock when we start
81 serviceWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
82 }
83
84 @Override
85 public IBinder onBind(Intent intent) {
86 Log.d(TAG,"+BoardIDService.onBind()");
87 if (IBoardIDService.class.getName().equals(intent.getAction())) {
88 return mBinder;
89 } else {
90 return null;
91 }
92 }
93
94 @Override
95 public boolean onUnbind(Intent intent) {
96 //Log.d(TAG,"+BoardIDService.onUnbind()");
97 if (IBoardIDService.class.getName().equals(intent.getAction())) {
98 return super.onUnbind(intent);
99 } else {
100 return false;
101 }
102 }
103
104 @Override
105 public void onRebind(Intent intent) {
106 //Log.d(TAG,"+BoardIDService.onRebind()");
107 if (IBoardIDService.class.getName().equals(intent.getAction())) {
108 super.onRebind(intent);
109 }
110 }
111
112 @Override
113 public void onDestroy() {
114 return;
115 }
116
117 public String GetBoardProp(int value) {
118 //Log.d(TAG,"+BoardIDService.onCreate loading JNI");
119 System.load("/system/lib/libboard_idJNI.so");
120 return getBoardIDsysfsNative(value);
121 }
122
123 public String GetProperty(int value) {
124 //Log.d(TAG,"+BoardIDService.onCreate loading JNI");
125 System.load("/system/lib/libboard_idJNI.so");
126 return getBoardIDpropNative(value);
127 }
128
129 public int SetGovernor(int value) {
130 //Log.d(TAG,"+BoardIDService.onCreate loading JNI");
131 System.load("/system/lib/libboard_idJNI.so");
132 return setGovernorNative(value);
133 }
134
135 private native String getBoardIDsysfsNative(int value);
136 private native String getBoardIDpropNative(int value);
137 private native int setGovernorNative(int value);
138
139 //**************************************************************************
140 // PRIVATE
141 //**************************************************************************
142
143 /** Defines our local RPC instance object which clients use to communicate with us. */
144 private final IBoardIDService.Stub mBinder = new IBoardIDService.Stub() {
145 public String GetBoardProp(int value) {
146 return "Not Avaialble";
147 }
148 public String GetProperty(int value) {
149 return "Not Avaialble";
150 }
151 public int SetGovernor(int value) {
152 return -1;
153 }
154 };
155
156}
157
diff --git a/board_identity/src/app/src/board_id/com/ti/Board_id_Activity.java b/board_identity/src/app/src/board_id/com/ti/Board_id_Activity.java
deleted file mode 100644
index deadab9..0000000
--- a/board_identity/src/app/src/board_id/com/ti/Board_id_Activity.java
+++ /dev/null
@@ -1,263 +0,0 @@
1/*
2 * Android Board Identification Application
3 *
4 * Copyright 2011 Texas Instruments, Inc. - http://www.ti.com/
5 *
6 * Written by Dan Murphy <dmurphy@ti.com>
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20package board_id.com.ti;
21
22import board_id.com.ti.BoardIDService;
23
24import android.app.Activity;
25import android.app.AlertDialog;
26import android.content.Context;
27import android.content.DialogInterface;
28import android.os.*;
29import android.provider.Settings;
30import android.util.Log;
31import android.view.Menu;
32import android.view.MenuItem;
33import android.view.ContextMenu;
34import android.view.ContextMenu.ContextMenuInfo;
35import android.view.View;
36import android.view.View.OnClickListener;
37import android.widget.Button;
38import android.widget.TextView;
39
40public class Board_id_Activity extends Activity {
41 /** Called when the activity is first created. */
42 private static final String TAG = "BoardIDActivity";
43 private static final String VER_NUM = "1.0";
44 public BoardIDService IDService = null;
45
46 @Override
47 public void onCreate(Bundle savedInstanceState) {
48 super.onCreate(savedInstanceState);
49 setContentView(R.layout.main);
50
51 //registerForContextMenu(findViewById(R.id.gov_button));
52
53 IDService = new BoardIDService();
54
55 this.get_sysfs_props();
56 this.set_build_props();
57 }
58
59 @Override
60 public boolean onCreateOptionsMenu(Menu menu) {
61 super.onCreateOptionsMenu(menu);
62 int groupId = 0;
63 int menuItemOrder = Menu.NONE;
64
65 MenuItem quitmenuItem = menu.add(groupId, 0, menuItemOrder, "Quit");
66 quitmenuItem.setIcon(R.drawable.exit);
67 MenuItem aboutmenuItem = menu.add(groupId, 1, menuItemOrder, "About This Application");
68 aboutmenuItem.setIcon(R.drawable.about);
69
70 return true;
71 }
72
73 @Override
74 public boolean onOptionsItemSelected(MenuItem item) {
75 // Handle item selection
76 switch (item.getItemId()) {
77 //Quit
78 case 0:
79 this.onStop();
80 finish();
81 break;
82 //Help
83 case 1:
84 AlertDialog.Builder helpbox = new AlertDialog.Builder(this);
85 helpbox.setMessage("Texas Instruments Board Identification Application Version: " + VER_NUM);
86 helpbox.setNeutralButton("Ok", new DialogInterface.OnClickListener() {
87 public void onClick(DialogInterface arg0, int arg1) {
88 // Do nothing as there is nothing to do
89 }
90 });
91 helpbox.show();
92 return true;
93 default:
94 return super.onOptionsItemSelected(item);
95 }
96 return true;
97 }
98
99 @Override
100 public boolean onContextItemSelected(MenuItem item) {
101 TextView gov_val, cpu1_stat_val;
102 boolean err = false;
103 String test = new String();
104 String cpu = new String();
105
106 if (IDService == null)
107 IDService = new BoardIDService();
108
109 Log.d(TAG, "Got id " + item.getItemId());
110 IDService.SetGovernor(item.getItemId());
111
112 test = IDService.GetBoardProp(BoardIDService.CPU_GOV);
113 gov_val = (TextView) findViewById(R.id.governor);
114 gov_val.setText(R.string.curr_gov);
115 gov_val.setText(gov_val.getText() + " " + test);
116
117 cpu = IDService.GetBoardProp(BoardIDService.LINUX_CPU1_STAT);
118 cpu1_stat_val = (TextView) findViewById(R.id.cpu1_status);
119 cpu1_stat_val.setText(R.string.cpu1_string);
120 cpu1_stat_val.setText(cpu1_stat_val.getText() + " " + cpu);
121
122 return true;
123 }
124
125 @Override
126 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
127
128 super.onCreateContextMenu(menu, v, menuInfo);
129 menu.add(0, 0, 0, "Performance");
130 menu.add(0, 1, 0, "Hotplug");
131 menu.add(0, 2, 0, "Ondemand");
132 menu.add(0, 3, 0, "Interactive");
133 menu.add(0, 4, 0, "Userspace");
134 menu.add(0, 5, 0, "Conservative");
135 menu.add(0, 6, 0, "Powersave");
136 }
137
138 private void get_sysfs_props() {
139 TextView max_freq_val, rated_freq_val, cmd_line_val, kernel_ver_val;
140 TextView family_val, type_val, ver_val, gov_val, apps_val, pvr_val;
141 TextView cpu1_stat_val, wl_ver_val, dpll_trim_val, rbb_trim_val;
142 TextView prod_id_val, die_id_val;
143 String test = new String();
144
145 if (this.IDService == null)
146 IDService = new BoardIDService();
147
148 test = IDService.GetBoardProp(BoardIDService.SOC_FAMILY);
149
150 family_val = (TextView) findViewById(R.id.family);
151 family_val.setText(family_val.getText() + " " +test);
152
153 test = IDService.GetBoardProp(BoardIDService.SOC_REV);
154 type_val = (TextView) findViewById(R.id.type);
155 type_val.setText(type_val.getText() + " " + test);
156
157 test = IDService.GetBoardProp(BoardIDService.SOC_TYPE);
158 ver_val = (TextView) findViewById(R.id.version);
159 ver_val.setText(ver_val.getText() + " " + test);
160
161 test = IDService.GetBoardProp(BoardIDService.SOC_MAX_FREQ);
162 max_freq_val = (TextView) findViewById(R.id.max_freq);
163 max_freq_val.setText(max_freq_val.getText() + " " + test);
164
165 test = IDService.GetBoardProp(BoardIDService.APPS_BOARD_REV);
166 apps_val = (TextView) findViewById(R.id.apps_brd_rev);
167 apps_val.setText(apps_val.getText() + " " + test);
168
169 test = IDService.GetBoardProp(BoardIDService.CPU_MAX_FREQ);
170 rated_freq_val = (TextView) findViewById(R.id.rated_freq);
171 rated_freq_val.setText(rated_freq_val.getText() + " " + test);
172
173 test = IDService.GetBoardProp(BoardIDService.CPU_GOV);
174 gov_val = (TextView) findViewById(R.id.governor);
175 gov_val.setText(gov_val.getText() + " " + test);
176
177 test = IDService.GetBoardProp(BoardIDService.LINUX_VERSION);
178 kernel_ver_val = (TextView) findViewById(R.id.kernel_ver);
179 kernel_ver_val.setText(kernel_ver_val.getText() + " " + test);
180
181 test = IDService.GetBoardProp(BoardIDService.LINUX_PVR_VER);
182 pvr_val = (TextView) findViewById(R.id.pvr_version);
183 pvr_val.setText(pvr_val.getText() + " " + test);
184
185 test = IDService.GetBoardProp(BoardIDService.LINUX_CMDLINE);
186 cmd_line_val = (TextView) findViewById(R.id.cmd_line);
187 cmd_line_val.setText(cmd_line_val.getText() + " " + test);
188
189 test = IDService.GetBoardProp(BoardIDService.LINUX_CPU1_STAT );
190 cpu1_stat_val = (TextView) findViewById(R.id.cpu1_status);
191 cpu1_stat_val.setText(cpu1_stat_val.getText() + " " + test);
192
193 test = IDService.GetBoardProp(BoardIDService.WILINK_VERSION );
194 wl_ver_val = (TextView) findViewById(R.id.wilink_version);
195 wl_ver_val.setText(wl_ver_val.getText() + " " + test);
196
197 test = IDService.GetBoardProp(BoardIDService.DPLL_TRIM );
198 dpll_trim_val = (TextView) findViewById(R.id.dpll_trim);
199 dpll_trim_val.setText(dpll_trim_val.getText() + " " + test);
200
201 test = IDService.GetBoardProp(BoardIDService.RBB_TRIM );
202 rbb_trim_val = (TextView) findViewById(R.id.rbb_trim);
203 rbb_trim_val.setText(rbb_trim_val.getText() + " " + test);
204
205 test = IDService.GetBoardProp(BoardIDService.PRODUCTION_ID );
206 prod_id_val = (TextView) findViewById(R.id.prod_id);
207 prod_id_val.setText(prod_id_val.getText() + " " + test);
208
209 test = IDService.GetBoardProp(BoardIDService.DIE_ID );
210 die_id_val = (TextView) findViewById(R.id.die_id);
211 die_id_val.setText(die_id_val.getText() + " " + test);
212
213 }
214 private void set_build_props() {
215 final TextView bootloader_ver, db_number, serial_no, board_info;
216 final TextView debug_prop, build_val, crypto_val;
217 String serial = Build.SERIAL;
218 String boot_ver = Build.BOOTLOADER;
219 String build_id = Build.DISPLAY;
220 String board_id = Build.BOARD;
221 String test = new String();
222
223 if (IDService == null)
224 IDService = new BoardIDService();
225
226 test = IDService.GetProperty(1);
227 build_val = (TextView) findViewById(R.id.build_type);
228 build_val.setText(build_val.getText() + " " + test);
229
230 IDService = new BoardIDService();
231 test = IDService.GetProperty(5);
232 crypto_val = (TextView) findViewById(R.id.crypto_state);
233 crypto_val.setText(crypto_val.getText() + " " + test);
234
235 serial_no = (TextView) findViewById(R.id.serial_no);
236 if (serial != null && !serial.equals("")) {
237 serial_no.setText(serial_no.getText() + " " + serial);
238 } else {
239 serial_no.setText(serial_no.getText() + "Not Avaiable");
240 }
241
242 bootloader_ver = (TextView) findViewById(R.id.boot_ver);
243 if (boot_ver != null && !boot_ver.equals("")) {
244 bootloader_ver.setText(bootloader_ver.getText() + " " + boot_ver);
245 } else {
246 bootloader_ver.setText(bootloader_ver.getText() + "Not Avaiable");
247 }
248
249 db_number = (TextView) findViewById(R.id.build_ver);
250 if (build_id != null && !build_id.equals("")) {
251 db_number.setText(db_number.getText() + " " + build_id);
252 } else {
253 db_number.setText(db_number.getText() + "Not Avaiable");
254 }
255
256 board_info = (TextView) findViewById(R.id.board_ver);
257 if (board_id != null && !board_id.equals("")) {
258 board_info.setText(board_info.getText() + " " + board_id);
259 } else {
260 board_info.setText(board_info.getText() + "Not Avaiable");
261 }
262 }
263}
diff --git a/board_identity/src/app/src/board_id/com/ti/IBoardIDService.aidl b/board_identity/src/app/src/board_id/com/ti/IBoardIDService.aidl
deleted file mode 100644
index 2c51402..0000000
--- a/board_identity/src/app/src/board_id/com/ti/IBoardIDService.aidl
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * Copyright (C) 2011 The Android Open Source Project
3 * Copyright (C) 2010-2012 Texas Instruments, Inc. All rights reserved.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18package board_id.com.ti;
19
20interface IBoardIDService {
21 String GetBoardProp(int value);
22 String GetProperty(int value);
23 int SetGovernor(int value);
24}
diff --git a/board_identity/src/daemon/Android.mk b/board_identity/src/daemon/Android.mk
deleted file mode 100644
index a4c6e5d..0000000
--- a/board_identity/src/daemon/Android.mk
+++ /dev/null
@@ -1,52 +0,0 @@
1#
2# Copyright (C) 2011 The Android Open Source Project
3# Copyright (C) 2010-2012 Texas Instruments, Inc. All rights reserved.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17
18#Binary form
19ifeq ($(findstring omap, $(TARGET_BOARD_PLATFORM)),omap)
20LOCAL_PATH := $(call my-dir)
21include $(CLEAR_VARS)
22LOCAL_ARM_MODE := arm
23LOCAL_SRC_FILES := \
24 Identity_daemon.c
25LOCAL_C_INCLUDES += \
26 $(LOCAL_PATH)/../inc \
27 $(LOCAL_PATH)
28LOCAL_SHARED_LIBRARIES := libcutils \
29 liblog
30
31LOCAL_CFLAGS := -DPRINT_ONLY
32
33LOCAL_MODULE := boardidentity
34LOCAL_MODULE_TAGS := optional
35
36include $(BUILD_EXECUTABLE)
37
38
39# Library form
40include $(CLEAR_VARS)
41LOCAL_MODULE_TAGS := optional
42LOCAL_MODULE := libboardidentity
43LOCAL_PRELINK_MODULE := false
44LOCAL_SHARED_LIBRARIES := libcutils \
45 liblog
46
47LOCAL_SRC_FILES := \
48 Identity_daemon.c
49
50LOCAL_LDLIBS := -llog
51include $(BUILD_SHARED_LIBRARY)
52endif
diff --git a/board_identity/src/daemon/Identity_daemon.c b/board_identity/src/daemon/Identity_daemon.c
deleted file mode 100644
index 03c39f6..0000000
--- a/board_identity/src/daemon/Identity_daemon.c
+++ /dev/null
@@ -1,262 +0,0 @@
1/*
2 * Identity Daemon
3 *
4 * Copyright (C) 2011 Texas Instruments, Inc.
5 *
6 * Dan Murphy (dmurphy@ti.com)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the dual BSD / GNU General Public License version 2 as
10 * published by the Free Software Foundation. When using or
11 * redistributing this file, you may do so under either license.
12 */
13
14/* OS-specific headers */
15#include <errno.h>
16#include <fcntl.h>
17#include <stdio.h>
18#include <stdlib.h>
19#include <unistd.h>
20#include <string.h>
21#include <signal.h>
22#include <errno.h>
23#include <pthread.h>
24#include <dirent.h>
25#include <ctype.h>
26
27#include <utils/Log.h>
28#include <cutils/properties.h>
29
30#include "../../include/omap4_board_identity.h"
31
32#if defined (__cplusplus)
33extern "C" {
34#endif /* defined (__cplusplus) */
35
36#define ID_DEBUG 1
37
38struct id_data_sysfs {
39 int info_id;
40 const char *name;
41 const char *sysfs_node;
42} id_sysfs[] = {
43 { SOC_FAMILY, "OMAP Family ", "/sys/board_properties/soc/family"},
44 { SOC_REV, "OMAP Type ", "/sys/board_properties/soc/type"},
45 { SOC_TYPE, "OMAP Rev ", "/sys/board_properties/soc/revision"},
46 { SOC_MAX_FREQ, "Rated Freq ", "/sys/board_properties/soc/max_freq"},
47 { APPS_BOARD_REV, "Apps Board Rev ", "/sys/board_properties/board/board_rev"},
48 { CPU_MAX_FREQ, "Max Freq ", "/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq"},
49 { CPU_GOV, "Scaling Gov ", "/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"},
50 { LINUX_VERSION, "Linux version ", "/proc/version"},
51 { LINUX_CMDLINE, "cmdline ", "/proc/pvr/version"},
52 { LINUX_CMDLINE, "cmdline ", "/proc/cmdline"},
53 { LINUX_CPU1_STAT, "CPU1 Status ", CPU1_ONLINE},
54 { LINUX_OFF_MODE, "Off Mode ", OFF_MODE},
55 { WILINK_VERSION, "WiLink version ", "/sys/kernel/debug/ti-st/version"},
56 { DPLL_TRIM, "DPLL Trimmed ", "/sys/board_properties/soc/dpll_trimmed"},
57 { RBB_TRIM, "DPLL Trimmed ", "/sys/board_properties/soc/rbb_trimmed"},
58 { PRODUCTION_ID, "Production ID ", "/sys/board_properties/soc/production_id"},
59 { DIE_ID, "Die ID ", "/sys/board_properties/soc/die_id"},
60};
61
62struct id_data_prop {
63 int info_id;
64 const char *name;
65 const char *prop_node;
66} id_prop[] = {
67 { PROP_DISPLAY_ID, "Build ID ", "ro.build.display.id"},
68 { PROP_BUILD_TYPE, "Build Type ", "ro.build.type"},
69 { PROP_SER_NO, "Serial Number ", "ro.serialno"},
70 { PROP_BOOTLOADER, "Bootloader ", "ro.bootloader"},
71 { PROP_DEBUGGABLE, "Debug ", "ro.debuggable"},
72 { PROP_CRYPTO_STATE, "Crypto State ", "ro.crypto.state"},
73};
74
75struct gov_data {
76 int gov_id;
77 const char *name;
78} gov_info[] = {
79 { GOV_PERFORMANCE, "performance"},
80 { GOV_HOTPLUG, "hotplug"},
81 { GOV_ONDEMAND, "ondemand "},
82 { GOV_INTERACTIVE, "interactive"},
83 { GOV_USERSPACE, "userspace"},
84 { GOV_CONSERVATIVE, "conservative"},
85 { GOV_POWERSAVE, "powersave"},
86};
87
88char* get_device_identity(int id_number)
89{
90 char buffer[1024] = {0};
91 char* buf;
92 int bytes_read = 13;
93 int sys_fd = -1;
94
95 if (id_number > MAX_FIELDS) {
96 buf = (char *)calloc(1, bytes_read);
97 strcpy(buffer, "Not Avaiable");
98 goto out;
99 }
100
101 ALOGD("Reading %i %s\n", id_number, id_sysfs[id_number].sysfs_node);
102 sys_fd = open(id_sysfs[id_number].sysfs_node, O_RDONLY);
103 if (sys_fd >= 0) {
104 bytes_read = read(sys_fd, buffer, 1024);
105 buf = (char *)calloc(1, bytes_read);
106 ALOGD("%s = %s", id_sysfs[id_number].name, buffer);
107 close(sys_fd);
108 sys_fd = -1;
109 } else {
110 ALOGD("%s = %s", id_sysfs[id_number].name, "Not Avaialble");
111 buf = (char *)calloc(1, bytes_read);
112 strcpy(buffer, "Not Avaiable");
113 }
114
115out:
116 memcpy(buf, buffer, bytes_read - 1);
117 return buf;
118}
119
120char* get_device_property(int id_number)
121{
122 char prop_return[1024] = {0};
123 int bytes_read = 0;
124
125 if (id_number > MAX_PROP)
126 goto out;
127
128 bytes_read = property_get(id_prop[id_number].prop_node, prop_return, "unknown");
129 ALOGD("%s = %s", id_prop[id_number].name, prop_return);
130
131out:
132 return prop_return;
133}
134
135int set_governor(int governor)
136{
137 int ret = 0;
138 int sys_fd = -1;
139 int value = 1;
140
141 if (governor > GOV_MAX)
142 goto out;
143
144 sys_fd = open(GOV_STRING, O_RDWR);
145 if (sys_fd >= 0) {
146 ALOGD("Setting %s\n", gov_info[governor].name);
147 ret = write(sys_fd, gov_info[governor].name, 12);
148 if (ret < 0)
149 ALOGD("ERRNO %i\n", errno);
150 ALOGD("Returning %i\n", ret);
151 close(sys_fd);
152 if (governor != GOV_HOTPLUG) {
153 char buffer[20];
154 sys_fd = open(CPU1_ONLINE, O_RDWR);
155 ALOGD("Setting CPU1 Online\n");
156 int bytes = sprintf(buffer, "%d\n", value);
157 ret = write(sys_fd, buffer, bytes);
158 if (ret < 0)
159 ALOGD("ERRNO %i\n", errno);
160 ALOGD("Returning %i\n", ret);
161 close(sys_fd);
162 }
163 return ret;
164 } else {
165 ALOGD("Cannot open %s\n", GOV_STRING);
166 }
167
168out:
169 return -1;
170}
171
172int set_off_mode(int off_mode)
173{
174 int ret = 0;
175 int sys_fd = -1;
176
177 if (off_mode > 1)
178 off_mode = 1;
179
180 sys_fd = open(OFF_MODE, O_RDWR);
181 if (sys_fd >= 0) {
182 char buffer[20];
183 ALOGD("Setting %i\n", off_mode);
184 int bytes = sprintf(buffer, "%d\n", off_mode);
185 ret = write(sys_fd, buffer, bytes);
186 if (ret < 0)
187 ALOGD("ERRNO %i\n", errno);
188 ALOGD("Returning %i\n", ret);
189 close(sys_fd);
190 return ret;
191 } else {
192 ALOGD("Cannot open %s\n", OFF_MODE);
193 }
194
195out:
196 return -1;
197}
198
199ssize_t print_prop_identity(int id_number)
200{
201 char prop_return[1024] = {0};
202
203 if (id_number > MAX_PROP)
204 goto out;
205
206 property_get(id_prop[id_number].prop_node, prop_return, "unknown");
207
208 ALOGD("%s = %s", id_prop[id_number].name, prop_return);
209out:
210 return 0;
211}
212
213ssize_t print_sysfs_identity(int id_number)
214{
215 char buffer[1024] = {0};
216 int bytes_read = 0;
217 int sys_fd = -1;
218
219 if (id_number > MAX_FIELDS)
220 goto out;
221
222 sys_fd = open(id_sysfs[id_number].sysfs_node, O_RDONLY);
223 if (sys_fd >= 0) {
224 bytes_read = read(sys_fd, buffer, 1024);
225 ALOGD("%s = %s", id_sysfs[id_number].name, buffer);
226 close(sys_fd);
227 sys_fd = -1;
228 } else {
229 ALOGD("%s = %s", id_sysfs[id_number].name, "Not Avaialble");
230 strcpy(buffer, "Not Avaiable");
231 }
232
233out:
234 return 0;
235}
236
237int main(int argc, char * argv [])
238{
239 int bytes_read = 0;
240 int sys_fd = -1;
241 int i = 0;
242 int sysfs_count = MAX_FIELDS;
243
244#if PRINT_ONLY
245 for (i = 0; i < MAX_FIELDS; i++) {
246 print_sysfs_identity(i);
247 }
248
249 for (i = 0; i < MAX_PROP; i++) {
250 print_prop_identity(i);
251 }
252
253#else
254 ALOGD(" I got nothing");
255#endif
256 return 0;
257}
258
259
260#if defined (__cplusplus)
261}
262#endif /* defined (__cplusplus) */
diff --git a/board_identity/src/jni/Android.mk b/board_identity/src/jni/Android.mk
deleted file mode 100644
index a553dbd..0000000
--- a/board_identity/src/jni/Android.mk
+++ /dev/null
@@ -1,56 +0,0 @@
1#
2# Copyright (C) 2011 The Android Open Source Project
3# Copyright (C) 2010-2012 Texas Instruments, Inc. All rights reserved.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17
18LOCAL_PATH := $(call my-dir)
19
20ifeq ($(origin TARGET_BUILD_PDK),undefined)
21
22include $(CLEAR_VARS)
23
24LOCAL_SRC_FILES := \
25 com_ti_boardid_BoardID_JNI.cpp
26
27LOCAL_C_INCLUDES := $(TOP)/include
28LOCAL_C_INCLUDES += \
29 $(JNI_H_INCLUDE)
30LOCAL_PRELINK_MODULE := false
31LOCAL_MODULE_TAGS := optional
32LOCAL_SHARED_LIBRARIES := \
33 libandroid_runtime \
34 libcutils \
35 libnativehelper \
36 libsystem_server \
37 libutils \
38 libui \
39 libboardidentity
40
41ifeq ($(TARGET_SIMULATOR),true)
42ifeq ($(TARGET_OS),linux)
43ifeq ($(TARGET_ARCH),x86)
44LOCAL_LDLIBS += -lpthread -ldl -lrt
45endif
46endif
47endif
48
49ifeq ($(WITH_MALLOC_LEAK_CHECK),true)
50 LOCAL_CFLAGS += -DMALLOC_LEAK_CHECK
51endif
52
53LOCAL_MODULE := libboard_idJNI
54
55include $(BUILD_SHARED_LIBRARY)
56endif
diff --git a/board_identity/src/jni/com_ti_boardid_BoardID_JNI.cpp b/board_identity/src/jni/com_ti_boardid_BoardID_JNI.cpp
deleted file mode 100644
index c5c6b80..0000000
--- a/board_identity/src/jni/com_ti_boardid_BoardID_JNI.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
1/*
2 * Copyright (C) 2011 The Android Open Source Project
3 * Copyright (C) 2010-2012 Texas Instruments, Inc. All rights reserved.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#define LOG_TAG "Board_ID"
19
20#include "jni.h"
21#include "JNIHelp.h"
22#include "android_runtime/AndroidRuntime.h"
23
24#include <utils/misc.h>
25#include <utils/Log.h>
26#include "../../include/omap4_board_identity.h"
27
28#include <stdio.h>
29
30namespace android
31{
32 static jstring getBoardID_sysfs(JNIEnv *env __attribute__ ((unused)),
33 jobject clazz __attribute__ ((unused)),
34 jint id_to_get)
35 {
36 int data_size = 0;
37 char* data_ret;
38
39 ALOGI("Getting the ID %i\n", id_to_get);
40 data_ret = get_device_identity(id_to_get);
41 jstring jdata_ret = env->NewStringUTF(data_ret);
42 return jdata_ret;
43 }
44 static jstring getBoardID_prop(JNIEnv *env __attribute__ ((unused)),
45 jobject clazz __attribute__ ((unused)),
46 jint id_to_get)
47 {
48 int data_size = 0;
49 char* data_ret;
50
51 ALOGI("Getting the ID %i\n", id_to_get);
52 data_ret = get_device_property(id_to_get);
53 jstring jdata_ret = env->NewStringUTF(data_ret);
54 return jdata_ret;
55 }
56
57 static jint setGov(JNIEnv *env __attribute__ ((unused)),
58 jobject clazz __attribute__ ((unused)),
59 jint gov_to_set)
60 {
61 int data_ret;
62
63 ALOGI("Getting the ID %i\n", gov_to_set);
64 data_ret = set_governor(gov_to_set);
65 return data_ret;
66 }
67
68 static JNINativeMethod method_table[] = {
69 { "getBoardIDsysfsNative", "(I)Ljava/lang/String;", (void*)getBoardID_sysfs },
70 { "getBoardIDpropNative", "(I)Ljava/lang/String;", (void*)getBoardID_prop },
71 { "setGovernorNative", "(I)I", (void*)setGov },
72 };
73
74 int register_Board_ID_Service(JNIEnv *env)
75 {
76 return jniRegisterNativeMethods(env, "board_id/com/ti/BoardIDService",
77 method_table, NELEM(method_table));
78 }
79
80};
81
82using namespace android;
83extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved)
84{
85 JNIEnv* env = NULL;
86 jint result = -1;
87
88 if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
89 ALOGE("GetEnv failed!");
90 return result;
91 }
92 ALOG_ASSERT(env, "Could not retrieve the env!");
93
94 register_Board_ID_Service(env);
95
96 return JNI_VERSION_1_4;
97}
diff --git a/cpcam/Android.mk b/cpcam/Android.mk
deleted file mode 100644
index 1ce211a..0000000
--- a/cpcam/Android.mk
+++ /dev/null
@@ -1,22 +0,0 @@
1#
2# Copyright (C) 2012 Texas Instruments
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16ifeq ($(OMAP_ENHANCEMENT_CPCAM), true)
17 include_cpcam_makefiles = yes
18endif
19
20ifdef include_cpcam_makefiles
21include $(call all-subdir-makefiles)
22endif
diff --git a/cpcam/cpcam-products.mk b/cpcam/cpcam-products.mk
deleted file mode 100644
index ef03dba..0000000
--- a/cpcam/cpcam-products.mk
+++ /dev/null
@@ -1,22 +0,0 @@
1#
2# Copyright (C) 2012 Texas Instruments
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17PRODUCT_PACKAGES += \
18 com.ti.omap.android.cpcam \
19 libcpcam_jni
20
21PRODUCT_COPY_FILES := \
22 hardware/ti/omap4xxx/cpcam/com.ti.omap.android.cpcam.xml:system/etc/permissions/com.ti.omap.android.cpcam.xml
diff --git a/cpcam/products/AndroidProducts.mk b/cpcam/products/AndroidProducts.mk
deleted file mode 100644
index c6a3970..0000000
--- a/cpcam/products/AndroidProducts.mk
+++ /dev/null
@@ -1,27 +0,0 @@
1#
2# Copyright (C) 2012 Texas Instruments
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16# This file should set PRODUCT_MAKEFILES to a list of product makefiles
17# to expose to the build system. LOCAL_DIR will already be set to
18# the directory containing this file.
19#
20# This file may not rely on the value of any variable other than
21# LOCAL_DIR; do not use any conditionals, and do not look up the
22# value of any variable that isn't set in this file or in a file that
23# it includes.
24#
25
26PRODUCT_MAKEFILES := \
27 $(LOCAL_DIR)/cpcam_sdk_addon.mk
diff --git a/cpcam/products/cpcam_sdk_addon.mk b/cpcam/products/cpcam_sdk_addon.mk
deleted file mode 100644
index fc6132c..0000000
--- a/cpcam/products/cpcam_sdk_addon.mk
+++ /dev/null
@@ -1,50 +0,0 @@
1#
2# Copyright (C) 2012 Texas Instruments
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17# List of apps and optional libraries (Java and native) to put in the add-on system image.
18PRODUCT_PACKAGES := \
19 com.ti.omap.android.cpcam \
20 libcpcam_jni
21
22# Manually copy the optional library XML files in the system image.
23PRODUCT_COPY_FILES := \
24 hardware/ti/omap4xxx/cpcam/com.ti.omap.android.cpcam.xml:system/etc/permissions/com.ti.omap.android.cpcam.xml
25
26# name of the add-on
27PRODUCT_SDK_ADDON_NAME := cpcam
28
29# Copy the manifest and hardware files for the SDK add-on.
30# The content of those files is manually created for now.
31PRODUCT_SDK_ADDON_COPY_FILES := \
32 device/ti/common-open/cpcam/sdk_addon/manifest.ini:manifest.ini \
33 device/ti/common-open/cpcam/sdk_addon/hardware.ini:hardware.ini \
34 $(call find-copy-subdir-files,*,device/sample/skins/WVGAMedDpi,skins/WVGAMedDpi)
35
36# Copy the jar files for the optional libraries that are exposed as APIs.
37PRODUCT_SDK_ADDON_COPY_MODULES := \
38 com.ti.omap.android.cpcam:libs/cpcam.jar
39
40PRODUCT_SDK_ADDON_STUB_DEFS += \
41 device/ti/common-open/cpcam/products/stub_defs.txt
42
43PRODUCT_SDK_ADDON_DOC_MODULES := cpcam
44
45# This add-on extends the default sdk product.
46$(call inherit-product, $(SRC_TARGET_DIR)/product/sdk.mk)
47
48# Real name of the add-on. This is the name used to build the add-on.
49# Use 'make PRODUCT-cpcam-sdk_addon' to build the add-on.
50PRODUCT_NAME := cpcam
diff --git a/cpcam/products/stub_defs.txt b/cpcam/products/stub_defs.txt
deleted file mode 100644
index 7e13249..0000000
--- a/cpcam/products/stub_defs.txt
+++ /dev/null
@@ -1,18 +0,0 @@
1#
2# Copyright (C) 2012 Texas Instruments
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17
18+com.ti.omap.android.cpcam.*
diff --git a/cpcam/sdk_addon/hardware.ini b/cpcam/sdk_addon/hardware.ini
deleted file mode 100644
index 36e18bb..0000000
--- a/cpcam/sdk_addon/hardware.ini
+++ /dev/null
@@ -1,19 +0,0 @@
1#
2# Copyright (C) 2012 Texas Instruments
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17# Custom hardware options for the add-on.
18# Properties defined here impact all AVD targetting this add-on.
19# Each skin can also override those values with its own hardware.ini file.
diff --git a/cpcam/sdk_addon/manifest.ini b/cpcam/sdk_addon/manifest.ini
deleted file mode 100644
index 9222efc..0000000
--- a/cpcam/sdk_addon/manifest.ini
+++ /dev/null
@@ -1,61 +0,0 @@
1#
2# Copyright (C) 2012 Texas Instruments
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17
18# SDK Add-on Manifest
19# File encoding is UTF-8
20
21# Name and vendor of the add-on.
22# Add-ons are uniquely identified by a string composed of name, vendor and api.
23# 2 add-ons with the same identifier cannot be installed in the same SDK
24# and only the add-on with the highest rev number will be installed.
25# Name and vendor are used to create folder names, so they shouldn't contain
26# any special characters. Also, the character ':' is forbidden.
27# Mandatory character set: a-z A-Z 0-9 _.-
28name=TI OMAP Add-On
29vendor=Texas Instruments Inc
30description=Android extensions for TI OMAP platform
31
32# version of the Android platform on which this add-on is built.
33api=15
34
35# revision of the add-on. This must be a strict integer.
36revision=1
37
38# list of libraries, separated by a semi-colon.
39# This must be the name of the libraries, as required by the
40# <uses-library> node in the AndroidManifest.xml file.
41libraries=com.ti.omap.android.cpcam
42
43# details for each library. format is:
44# <library.name>=<name>.jar;<desc>
45# where
46# <library.name>: the name of the library defined in the property "libraries" above.
47# <name>.jar: the jar file containing the library API. This is to be located in
48# the add-on folder in libs/
49com.ti.omap.android.cpcam=cpcam.jar;TI OMAP plaform library
50
51# default skin name. Optional. Only useful if the add-on has its own skin, or
52# if it wishes to override the default skin of the base platform.
53# This should be the name of the skin in the skins/ folder of the add-on.
54skin=WVGAMedDpi
55
56# USB Vendor ID
57# This 16-bit integer allows adb to detect new devices, by extending the list
58# of USB Vendor IDs it knows. After installing an add-on the command
59# 'android update' adb' must be run to update a file that adb reads during
60# start-up.
61#usb-vendor=0x0000
diff --git a/mtpfuse/Android.mk b/mtpfuse/Android.mk
deleted file mode 100644
index f889e53..0000000
--- a/mtpfuse/Android.mk
+++ /dev/null
@@ -1,28 +0,0 @@
1ifdef OMAP_ENHANCEMENT
2ifeq ($(TARGET_BOARD_PLATFORM), $(filter $(TARGET_BOARD_PLATFORM), jacinto6))
3
4LOCAL_PATH:= $(call my-dir)
5
6include $(CLEAR_VARS)
7
8LOCAL_CFLAGS:= -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26 -D__MULTI_THREAD
9
10LOCAL_SRC_FILES:= mtpfuse.cpp \
11
12LOCAL_MODULE:= mtpfuse
13LOCAL_CFLAGS := -Wall -Wno-unused-parameter
14
15LOCAL_C_INCLUDES := \
16 $(TOP)/external/libfuse/include \
17 $(LOCAL_PATH)/. \
18 $(TOP)/system/core/include \
19 $(TOP)/frameworks/av/media/mtp \
20 $(TOP)/frameworks/native/include
21
22LOCAL_SHARED_LIBRARIES := libc libusbhost libmtp libutils
23
24LOCAL_STATIC_LIBRARIES := libfuse
25
26include $(BUILD_EXECUTABLE)
27endif # jacinto6
28endif # OMAP_ENHANCEMENT
diff --git a/mtpfuse/mtpfuse.cpp b/mtpfuse/mtpfuse.cpp
deleted file mode 100644
index 1bf49bc..0000000
--- a/mtpfuse/mtpfuse.cpp
+++ /dev/null
@@ -1,477 +0,0 @@
1/*
2 * Copyright (C) 2012 Texas Instruments
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <usbhost/usbhost.h>
18#include <fuse.h>
19#include <MtpStorageInfo.h>
20#include <MtpObjectInfo.h>
21#include <utils/String8.h>
22#include <utils/Vector.h>
23#include <utils/KeyedVector.h>
24#include <stdio.h>
25#include <string.h>
26#include <MtpDevice.h>
27#include <fcntl.h>
28#include <errno.h>
29#include <sys/statfs.h>
30#include <sys/mman.h>
31
32
33#undef FUSE_USE_VERSION
34#define FUSE_USE_VERSION 25
35
36#ifdef DEBUG
37#define STRINGIFY(x) #x
38#define TOSTRING(x) STRINGIFY(x)
39#define DBG(a...) {printf(a);}
40#else
41#define DBG(a...)
42#endif
43
44using namespace android;
45
46MtpDevice* mtp_device = NULL;
47usb_device* device = NULL;
48int mtp_device_found = 0;
49MtpStorageIDList* storageAreaList = NULL;
50KeyedVector<uint32_t, char*> storageEntries;
51
52static struct fuse_operations mtpfuse_oper;
53typedef Vector <String8*> PathTokenList;
54typedef Vector <MtpObjectInfo*> childList;
55KeyedVector<uint32_t, childList*> mtpEntries;
56KeyedVector<uint32_t, String8> fileDescriptorTable;
57
58static int usb_device_listed(const char *devname, void* client_data) {
59 int fd;
60 device = usb_device_open(devname);
61 if (device == NULL) {
62 DBG("Error opening device\n");
63 return 0;
64 }
65 fd = usb_device_get_fd(device);
66 if (fd < 0) {
67 DBG("Error getting fd\n");
68 return 0;
69 }
70
71 MtpDevice *mtp = MtpDevice::open(devname, fd);
72 if (mtp!= NULL) {
73 DBG("MTP device found\n");
74 mtp_device_found = 1;
75 mtp_device = mtp;
76 }
77 return 0;
78}
79
80static int list_devices () {
81 struct usb_host_context* context = usb_host_init();
82 usb_host_load(context, usb_device_listed, NULL, NULL, NULL);
83 return 0;
84}
85
86static int get_storage_id(PathTokenList* tokens) {
87 String8* storage = tokens->itemAt(0);
88 DBG("Storage %s\n", storage->string());
89 if (storage == NULL) {
90 return -1;
91 }
92 for (size_t i = 0;i < storageEntries.size();i++) {
93 char* desc = storageEntries.valueAt(i);
94 if (strcmp(desc, storage->string()) == 0) {
95 return storageEntries.keyAt(i);
96 }
97 }
98 return -1;
99}
100
101static int mtpfuse_release (const char *path,
102 struct fuse_file_info *fi) {
103 return 0;
104}
105
106static PathTokenList* tokenize_path(String8* path) {
107 String8* remain = path;
108 PathTokenList* tokens = new PathTokenList();
109 do {
110 String8* token = new String8(remain->walkPath(remain));
111 tokens->add(token);
112 } while (*remain != "");
113 return tokens;
114}
115
116static MtpObjectInfo* get_mtp_obj_for_path(const char *path) {
117 PathTokenList* tokens;
118 MtpObjectInfo* ret = NULL;
119 String8* path_str = new String8();
120 path_str->setPathName(path);
121 tokens = tokenize_path(path_str);
122 //Go through mtp entries to get the entries
123 int storageId = get_storage_id(tokens);
124 if (storageId == -1) {
125 DBG("Could not get Storage Id\n");
126 tokens->removeItemsAt(0, tokens->size());
127 delete tokens;
128 delete path_str;
129 return NULL;
130 }
131 int found = 0;
132 int index = mtpEntries.indexOfKey(storageId);
133 childList *list = mtpEntries.valueAt(index);
134 if (list != NULL) {
135 found = 1;
136 }
137 MtpObjectInfo *target = NULL;
138 if (tokens->size() > 1) {
139 found = 0;
140 for (size_t i = 1;i < tokens->size();i++) {
141 for (size_t j = 0;j < list->size();j++) {
142 if (strcmp(list->itemAt(j)->mName, tokens->itemAt(i)->string()) == 0) {
143 uint32_t handle = list->itemAt(j)->mHandle;
144 target = list->itemAt(j);
145 int indx = mtpEntries.indexOfKey(handle);
146 list = NULL;
147 list = mtpEntries.valueAt(indx);
148 if (i == tokens->size() - 1) {
149 found = 1;
150 }
151 break;
152 }
153 }
154 }
155 }
156
157 if (found) {
158 ret = target;
159 }
160 tokens->removeItemsAt(0, tokens->size());
161 delete tokens;
162 delete path_str;
163 return target;
164}
165
166
167static int mtpfuse_open (const char * path, struct fuse_file_info *fi) {
168 MtpObjectInfo *obj = get_mtp_obj_for_path(path);
169 if (obj == NULL) {
170 return -ENOENT;
171 }
172 fi->fh = (uint64_t)obj->mHandle;
173 DBG("Handle is %llu %s\n", fi->fh, obj->mName);
174 return 0;
175}
176
177static int mtpfuse_readdir (const char * path,
178 void *buf, fuse_fill_dir_t filler,
179 off_t offset, struct fuse_file_info *fi) {
180 PathTokenList* tokens;
181 filler (buf, ".", NULL, 0);
182 filler (buf, "..", NULL, 0);
183
184 if (strcmp(path, "/") == 0) {
185 //First get the storages
186 for (size_t i = 0;i < storageEntries.size();i++) {
187 struct stat st;
188 memset (&st, 0, sizeof (st));
189 st.st_nlink = 2;
190 st.st_ino = storageEntries.keyAt(i);
191 st.st_mode = S_IFDIR | 0777;
192 char *desc = storageEntries.valueAt(i);
193 filler (buf, desc, &st, 0);
194 }
195 return 0;
196 } else {
197 String8* path_str = new String8();
198 path_str->setPathName(path);
199 tokens = tokenize_path(path_str);
200 //Go through mtp entries to get the entries
201 int storageId = get_storage_id(tokens);
202 if (storageId == -1) {
203 tokens->removeItemsAt(0, tokens->size());
204 delete tokens;
205 delete path_str;
206 return -ENOENT;
207 }
208 int found = 0;
209 int index = mtpEntries.indexOfKey(storageId);
210 childList *list = mtpEntries.valueAt(index);
211 if (list != NULL) {
212 found = 1;
213 }
214
215 if (tokens->size() > 1) {
216 found = 0;
217 for (size_t i = 1;i < tokens->size();i++) {
218 for (size_t j = 0;j < list->size();j++) {
219 if (strcmp(list->itemAt(j)->mName, tokens->itemAt(i)->string()) == 0) {
220 uint32_t handle = list->itemAt(j)->mHandle;
221 int indx = mtpEntries.indexOfKey(handle);
222 list = NULL;
223 list = mtpEntries.valueAt(indx);
224 if (i == tokens->size() - 1) {
225 found = 1;
226 }
227 break;
228 }
229 }
230 }
231 }
232
233 if (found) {
234 if (list != NULL) {
235 childList *leaves = NULL;
236 for (size_t i = 0;i < list->size();i++) {
237 uint32_t handle = list->itemAt(i)->mHandle;
238 int indx = mtpEntries.indexOfKey(handle);
239 leaves = mtpEntries.valueAt(indx);
240 if (leaves) {
241 if (leaves->size() == 0) {
242 struct stat st;
243 memset (&st, 0, sizeof (st));
244 st.st_ino = list->itemAt(i)->mHandle;
245 st.st_mode = S_IFREG | 0777;
246 filler (buf, list->itemAt(i)->mName, &st, 0);
247 }else {
248 struct stat st;
249 memset (&st, 0, sizeof (st));
250 st.st_ino = list->itemAt(i)->mHandle;
251 st.st_mode = S_IFDIR | 0777;
252 filler (buf, list->itemAt(i)->mName, &st, 0);
253 }
254 }
255 }
256 }
257 }
258 tokens->removeItemsAt(0, tokens->size());
259 delete tokens;
260 delete path_str;
261 }
262 return 0;
263}
264
265
266static int mtpfuse_get_mtp_objects(const char * path) {
267 //First get the storages
268 for (size_t i = 0;i < storageAreaList->size();i++) {
269 uint32_t storageId = storageAreaList->itemAt(i);
270 //Each storage has handle
271 childList *forRoot = new childList;
272 mtpEntries.add(storageId, forRoot);
273 MtpObjectHandleList* mo_list =
274 mtp_device->getObjectHandles(storageId, 0, 0);
275 if (mo_list != NULL) {
276 //Each mtp object handle is associated with a Vector of child nodes.
277 //The object is stored as a KeyedVector which has an associated child Vector
278 for (size_t i = 0;i < mo_list->size();i++) {
279 MtpObjectInfo* info = mtp_device->getObjectInfo
280 (mo_list->itemAt(i));
281 childList *c = new childList;
282 mtpEntries.add(info->mHandle, c);
283 //Handle to childList
284 childList* parent_child_list = NULL;
285 int index = -1;
286 if (info->mParent != 0) {
287 index = mtpEntries.indexOfKey(info->mParent);
288 }else {
289 index = mtpEntries.indexOfKey(storageId);
290 }
291 if (index == -1) {
292 continue;
293 }
294 parent_child_list = mtpEntries.valueAt(index);
295 if (parent_child_list != NULL) {
296 parent_child_list->add(info);
297 }else {
298 DBG("No handle to parent's list\n");
299 }
300 }
301 }
302 }
303 return 0;
304}
305
306static int mtpfuse_getattr (const char * path, struct stat *stbuf) {
307 PathTokenList* tokens;
308
309 memset (stbuf, 0, sizeof (struct stat));
310
311 struct fuse_context *fc;
312 fc = fuse_get_context();
313 stbuf->st_uid = fc->uid;
314 stbuf->st_gid = fc->gid;
315
316 if (strcmp(path, "/") == 0) {
317 stbuf->st_mode = S_IFDIR | 0777;
318 stbuf->st_nlink = 2;
319 return 0;
320
321 } else {
322 String8* path_str = new String8();
323 path_str->setPathName(path);
324 tokens = tokenize_path(path_str);
325 //Go through mtp entries to get the entries
326 int storageId = get_storage_id(tokens);
327 if (storageId == -1) {
328 tokens->removeItemsAt(0, tokens->size());
329 delete tokens;
330 delete path_str;
331 return -ENOENT;
332 }
333 int found = 0;
334 int index = mtpEntries.indexOfKey(storageId);
335 childList *list = mtpEntries.valueAt(index);
336 if (list != NULL) {
337 found = 1;
338 }
339 MtpObjectInfo *target = NULL;
340 if (tokens->size() > 1) {
341 found = 0;
342 for (size_t i = 1;i < tokens->size();i++) {
343 for (size_t j = 0;j < list->size();j++) {
344 if (strcmp(list->itemAt(j)->mName, tokens->itemAt(i)->string()) == 0) {
345 uint32_t handle = list->itemAt(j)->mHandle;
346 target = list->itemAt(j);
347 int indx = mtpEntries.indexOfKey(handle);
348 list = NULL;
349 list = mtpEntries.valueAt(indx);
350 if (i == tokens->size() - 1) {
351 found = 1;
352 }
353 break;
354 }
355 }
356 }
357 }
358 if (found) {
359 if (list != NULL) {
360 //If an object has no child nodes, assume it to be a directory
361 if (list->size() == 0) {
362 DBG("File\n");
363 stbuf->st_ino = target->mHandle;
364 stbuf->st_size = target->mCompressedSize;
365 stbuf->st_blocks = (target->mCompressedSize / 512) +
366 (target->mCompressedSize % 512 > 0 ? 1 : 0);
367 stbuf->st_nlink = 1;
368 stbuf->st_mode = S_IFREG | 0777;
369 stbuf->st_uid = 1000;
370 stbuf->st_gid = 1015;
371 stbuf->st_mtime = target->mDateModified;
372 stbuf->st_ctime = target->mDateModified;
373 stbuf->st_atime = target->mDateModified;
374 }else {
375 DBG("Directory\n");
376 if (target != NULL)
377 stbuf->st_ino = target->mHandle;
378 stbuf->st_mode = S_IFDIR | 0777;
379 stbuf->st_nlink = 2;
380 stbuf->st_uid = 1000;
381 stbuf->st_gid = 1015;
382 }
383 }
384 }
385 tokens->removeItemsAt(0, tokens->size());
386 delete tokens;
387 delete path_str;
388 }
389 return 0;
390}
391
392bool read_callback (void* data, int offset, int length, void* clientData) {
393 //DBG("Received read callback %d %d\n", offset, length);
394 memcpy((char *)clientData + offset, data, length);
395 return true;
396}
397
398static int mtpfuse_read (const char * path, char * buf,
399 size_t size, off_t offset,
400 struct fuse_file_info *fi) {
401 int ret;
402 MtpObjectHandle h = (MtpObjectHandle)fi->fh;
403 bool status = mtp_device->readObject(h, read_callback, size, offset, buf);
404 if (status == false) {
405 ret = 0;
406 }else {
407 ret = size;
408 }
409 return ret;
410}
411
412static void start_media_scanner() {
413 const char* cmd =
414 "am broadcast -a android.intent.action.MEDIA_MOUNTED -d file:///mnt/shell/emulated/0";
415 system(cmd);
416}
417
418void mtpfuse_destroy (void *) {
419 //Release mtp entries
420 for (size_t i = 0;i < mtpEntries.size();i++) {
421 childList* list = mtpEntries.valueAt(i);
422 list->clear();
423 }
424 mtpEntries.clear();
425 mtp_device->close();
426 storageEntries.clear();
427 usb_device_close(device);
428 start_media_scanner();
429}
430
431void * mtpfuse_init (struct fuse_conn_info *conn) {
432 return 0;
433}
434
435int main(int argc, char* argv[]) {
436 int fuse_stat;
437
438 /*Create the mount directory, if it doesn't exist*/
439 struct stat st;
440 if (stat(argv[1], &st) != 0) {
441 if (mkdir(argv[1], S_IRWXU) != 0 && errno != EEXIST) {
442 printf("Could not create mount point %d\n", errno);
443 exit(0);
444 }
445 }
446
447 list_devices();
448 if (mtp_device_found && mtp_device != NULL) {
449 storageAreaList = mtp_device->getStorageIDs();
450 if (storageAreaList == NULL) {
451 return 0;
452 }
453
454 if (storageAreaList->size() == 0) {
455 printf("No storages found\n");
456 return 0;
457 }
458 printf("Found %d storage(s)\n", storageAreaList->size());
459 for (size_t i = 0;i < storageAreaList->size();i++) {
460 MtpStorageInfo* storageInfo = mtp_device->getStorageInfo(storageAreaList->itemAt(i));
461 printf("Desc: %s\n", storageInfo->mStorageDescription);
462 storageEntries.add(storageAreaList->itemAt(i), storageInfo->mStorageDescription);
463 }
464 mtpfuse_get_mtp_objects("/");
465 mtpfuse_oper.readdir = mtpfuse_readdir;
466 mtpfuse_oper.release = mtpfuse_release;
467 mtpfuse_oper.getattr = mtpfuse_getattr;
468 mtpfuse_oper.open = mtpfuse_open;
469 mtpfuse_oper.read = mtpfuse_read;
470 mtpfuse_oper.destroy = mtpfuse_destroy;
471 //Mount fuse
472 DBG("Setting up FUSE\n");
473 fuse_stat = fuse_main(argc, argv, &mtpfuse_oper);
474 return fuse_stat;
475 }
476 return 0;
477}
diff --git a/s3d/Android.mk b/s3d/Android.mk
deleted file mode 100644
index fbdcaaf..0000000
--- a/s3d/Android.mk
+++ /dev/null
@@ -1,13 +0,0 @@
1ifeq ($(MAKECMDGOALS), sdk_addon)
2ifeq ($(TARGET_PRODUCT), s3d)
3include_s3d_makefiles = yes
4endif
5endif
6
7ifeq ($(OMAP_ENHANCEMENT_S3D), true)
8include_s3d_makefiles = yes
9endif
10
11ifdef include_s3d_makefiles
12include $(call all-subdir-makefiles)
13endif
diff --git a/s3d/apps/Android.mk b/s3d/apps/Android.mk
deleted file mode 100644
index 5053e7d..0000000
--- a/s3d/apps/Android.mk
+++ /dev/null
@@ -1 +0,0 @@
1include $(call all-subdir-makefiles)
diff --git a/s3d/apps/Cowboids/Android.mk b/s3d/apps/Cowboids/Android.mk
deleted file mode 100644
index 008fcdb..0000000
--- a/s3d/apps/Cowboids/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
1LOCAL_PATH:= $(call my-dir)
2include $(CLEAR_VARS)
3
4LOCAL_MODULE_TAGS := optional
5
6LOCAL_SRC_FILES := $(call all-java-files-under, src)
7
8LOCAL_PACKAGE_NAME := S3DCowboids
9LOCAL_SDK_VERSION := current
10
11LOCAL_JAVA_LIBRARIES := com.ti.s3d
12
13include $(BUILD_PACKAGE)
14
15# Use the following include to make our test apk.
16include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/s3d/apps/Cowboids/AndroidManifest.xml b/s3d/apps/Cowboids/AndroidManifest.xml
deleted file mode 100644
index 9d9f8fd..0000000
--- a/s3d/apps/Cowboids/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 package="com.ti.s3d.cube">
4
5 <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
6 <uses-library android:name="com.ti.s3d" />
7 <activity android:name=".CowboidsActivity"
8 android:label="@string/app_name">
9 <intent-filter>
10 <action android:name="android.intent.action.MAIN" />
11 <category android:name="android.intent.category.LAUNCHER" />
12 </intent-filter>
13 </activity>
14 </application>
15
16</manifest>
diff --git a/s3d/apps/Cowboids/res/drawable/cowboid.png b/s3d/apps/Cowboids/res/drawable/cowboid.png
deleted file mode 100644
index 6f9558f..0000000
--- a/s3d/apps/Cowboids/res/drawable/cowboid.png
+++ /dev/null
Binary files differ
diff --git a/s3d/apps/Cowboids/res/drawable/icon.png b/s3d/apps/Cowboids/res/drawable/icon.png
deleted file mode 100644
index cd556a4..0000000
--- a/s3d/apps/Cowboids/res/drawable/icon.png
+++ /dev/null
Binary files differ
diff --git a/s3d/apps/Cowboids/res/layout/main.xml b/s3d/apps/Cowboids/res/layout/main.xml
deleted file mode 100644
index 4361cfe..0000000
--- a/s3d/apps/Cowboids/res/layout/main.xml
+++ /dev/null
@@ -1,7 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:orientation="vertical"
4 android:layout_width="fill_parent"
5 android:layout_height="fill_parent"
6 >
7</LinearLayout>
diff --git a/s3d/apps/Cowboids/res/values/strings.xml b/s3d/apps/Cowboids/res/values/strings.xml
deleted file mode 100644
index 724114c..0000000
--- a/s3d/apps/Cowboids/res/values/strings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<resources>
3 <string name="app_name">S3D Cowboids</string>
4</resources>
diff --git a/s3d/apps/Cowboids/src/com/ti/s3d/cube/CowboidsActivity.java b/s3d/apps/Cowboids/src/com/ti/s3d/cube/CowboidsActivity.java
deleted file mode 100644
index 25e7ccf..0000000
--- a/s3d/apps/Cowboids/src/com/ti/s3d/cube/CowboidsActivity.java
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * Copyright (C) 2011 Texas Instruments Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.ti.s3d.cube;
18
19import android.app.Activity;
20import android.os.Bundle;
21
22import com.ti.s3d.render.StereoGLView;
23
24public class CowboidsActivity extends Activity {
25 @Override
26 protected void onCreate(Bundle savedInstanceState) {
27 super.onCreate(savedInstanceState);
28 CubeScene scene = new CubeScene(this, R.drawable.cowboid);
29 mGLView = new StereoGLView(this, scene);
30 setContentView(mGLView);
31 }
32
33 @Override
34 protected void onResume() {
35 super.onResume();
36 mGLView.onResume();
37 }
38
39 @Override
40 protected void onPause() {
41 super.onPause();
42 mGLView.onPause();
43 }
44
45 private StereoGLView mGLView;
46}
diff --git a/s3d/apps/Cowboids/src/com/ti/s3d/cube/CubeScene.java b/s3d/apps/Cowboids/src/com/ti/s3d/cube/CubeScene.java
deleted file mode 100644
index 579d46a..0000000
--- a/s3d/apps/Cowboids/src/com/ti/s3d/cube/CubeScene.java
+++ /dev/null
@@ -1,101 +0,0 @@
1/*
2 * Copyright (C) 2011 Texas Instruments Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.ti.s3d.cube;
18
19import java.util.ArrayList;
20import javax.microedition.khronos.opengles.GL10;
21
22import android.content.Context;
23
24import com.ti.s3d.render.Scene;
25
26public class CubeScene implements Scene {
27
28 private TexturedCube mCube;
29 private ArrayList<Transform> transforms;
30 private float mAngle;
31 private float mAngleDelta;
32 private int h;
33
34 //Draws a cube formation of textured cubes
35 public CubeScene(Context context, int resourceId) {
36 mCube = new TexturedCube(context, resourceId);
37 transforms = new ArrayList<Transform>(9);
38 float location = 2.0f;
39 transforms.add(new Transform(0.0f, 0.0f, 0.0f));
40 for (int i=0;i<8;i++) {
41 float x = ( (i & 0x4) == 0) ? -location : location;
42 float y = ( (i & 0x2) == 0) ? -location : location;
43 float z = ( (i & 0x1) == 0) ? -location : location;
44 transforms.add(new Transform(x, y, z));
45 }
46 mAngleDelta = 1.5f;
47 }
48
49 public void draw(GL10 gl) {
50 mCube.drawBatchStart(gl);
51 for(Transform t : transforms) {
52 gl.glPushMatrix();
53 t.apply(gl,mAngle);
54 mCube.draw(gl);
55 gl.glPopMatrix();
56 }
57 mCube.drawBatchStop(gl);
58 }
59
60 public void drawEnd(GL10 gl) {
61 mAngle += mAngleDelta;
62 }
63
64 public void setup(GL10 gl, int w, int h) {
65 mCube.setup(gl);
66 this.h = h;
67 }
68
69 public void onTouch(float deltaX, float deltaY) {
70 deltaY /= -h;
71 deltaY *= 20.0f;
72 mAngleDelta += deltaY;
73 if(mAngleDelta < 0.0f)
74 mAngleDelta = 0.0f;
75 else if(mAngleDelta > 20.0f)
76 mAngleDelta = 20.0f;
77 }
78
79 private static class Transform {
80 //Translation
81 private float x, y, z;
82 //Angle ratios
83 private float ax, ay, az;
84
85 private Transform(float x, float y, float z) {
86 this.x = x;
87 this.y = y;
88 this.z = z;
89 ax = (float)Math.random();
90 ay = (float)Math.random();
91 az = (float)Math.random();
92 }
93
94 private void apply(GL10 gl, float angle) {
95 gl.glTranslatef(x, y, z);
96 gl.glRotatef(ax*angle, 1, 0, 0);
97 gl.glRotatef(ay*angle, 0, 1, 0);
98 gl.glRotatef(az*angle, 0, 0, 1);
99 }
100 }
101}
diff --git a/s3d/apps/Cowboids/src/com/ti/s3d/cube/TexturedCube.java b/s3d/apps/Cowboids/src/com/ti/s3d/cube/TexturedCube.java
deleted file mode 100644
index 5c65147..0000000
--- a/s3d/apps/Cowboids/src/com/ti/s3d/cube/TexturedCube.java
+++ /dev/null
@@ -1,210 +0,0 @@
1/*
2 * Copyright (C) 2011 Texas Instruments Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.ti.s3d.cube;
18
19import java.nio.FloatBuffer;
20import java.nio.ByteBuffer;
21import java.nio.ByteOrder;
22import java.lang.Float;
23
24import java.io.IOException;
25import java.io.InputStream;
26
27import android.content.Context;
28import android.graphics.Bitmap;
29import android.graphics.BitmapFactory;
30import android.opengl.GLUtils;
31
32import javax.microedition.khronos.opengles.GL10;
33import javax.microedition.khronos.opengles.GL11;
34
35public class TexturedCube {
36
37 private FloatBuffer vertices;
38 private FloatBuffer texCoords;
39 private ByteBuffer indices;
40
41 private int mTextureID;
42 private int mVtxVboID;
43 private int mTexVboID;
44 private int mIndVboID;
45
46 private int mResourceId;
47 private Context context;
48
49 public TexturedCube(Context context, int resourceId) {
50 this.context = context;
51 this.mResourceId = resourceId;
52
53 float cubeVertices[] = {
54 //front face
55 -1.0f, -1.0f, 1.0f,
56 1.0f, -1.0f, 1.0f,
57 -1.0f, 1.0f, 1.0f,
58 1.0f, 1.0f, 1.0f,
59
60 //right face
61 1.0f, -1.0f, 1.0f,
62 1.0f, -1.0f, -1.0f,
63 1.0f, 1.0f, 1.0f,
64 1.0f, 1.0f, -1.0f,
65
66 //back face
67 1.0f, -1.0f, -1.0f,
68 -1.0f, -1.0f, -1.0f,
69 1.0f, 1.0f, -1.0f,
70 -1.0f, 1.0f, -1.0f,
71
72 //left face
73 -1.0f, -1.0f, -1.0f,
74 -1.0f, -1.0f, 1.0f,
75 -1.0f, 1.0f, -1.0f,
76 -1.0f, 1.0f, 1.0f,
77
78 //bottom face
79 -1.0f, -1.0f, -1.0f,
80 1.0f, -1.0f, -1.0f,
81 -1.0f, -1.0f, 1.0f,
82 1.0f, -1.0f, 1.0f,
83
84 //top face
85 -1.0f, 1.0f, 1.0f,
86 1.0f, 1.0f, 1.0f,
87 -1.0f, 1.0f, -1.0f,
88 1.0f, 1.0f, -1.0f,
89 };
90
91 float texFaceCoords[] = {
92 0.0f, 0.0f,
93 0.0f, 1.0f,
94 1.0f, 0.0f,
95 1.0f, 1.0f,
96 };
97
98 byte elIndices[] = {
99 0,1,3, 0,3,2,
100 4,5,7, 4,7,6,
101 8,9,11, 8,11,10,
102 12,13,15, 12,15,14,
103 16,17,19, 16,19,18,
104 20,21,23, 20,23,22,
105 };
106
107 ByteBuffer byteBuf = ByteBuffer.allocateDirect(cubeVertices.length * Float.SIZE);
108 byteBuf.order(ByteOrder.nativeOrder());
109 vertices = byteBuf.asFloatBuffer();
110 vertices.put(cubeVertices);
111 vertices.position(0);
112
113 byteBuf = ByteBuffer.allocateDirect(texFaceCoords.length * 6 * Float.SIZE);
114 byteBuf.order(ByteOrder.nativeOrder());
115 texCoords = byteBuf.asFloatBuffer();
116 for(int i=0;i<6;i++)
117 texCoords.put(texFaceCoords);
118 texCoords.position(0);
119
120 indices = ByteBuffer.allocateDirect(elIndices.length);
121 indices.put(elIndices);
122 indices.position(0);
123 }
124
125 public void drawBatchStart(GL10 gl) {
126 gl.glActiveTexture(GL10.GL_TEXTURE0);
127 gl.glBindTexture(GL10.GL_TEXTURE_2D, mTextureID);
128 gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
129 gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
130 gl.glFrontFace(GL10.GL_CCW);
131 if(gl instanceof GL11) {
132 GL11 gl11 = (GL11)gl;
133 gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, mVtxVboID);
134 gl11.glVertexPointer(3, GL10.GL_FLOAT, 0, 0);
135
136 gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, mTexVboID);
137 gl11.glTexCoordPointer(2, GL10.GL_FLOAT, 0, 0);
138 gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, mIndVboID);
139 }
140 }
141
142 public void draw(GL10 gl) {
143 if(gl instanceof GL11) {
144 GL11 gl11 = (GL11)gl;
145 gl11.glDrawElements(GL10.GL_TRIANGLES, indices.limit(), GL10.GL_UNSIGNED_BYTE, 0);
146 }
147 }
148
149 public void drawBatchStop(GL10 gl) {
150 gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
151 gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
152 if(gl instanceof GL11) {
153 GL11 gl11 = (GL11)gl;
154 gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, 0);
155 gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, 0);
156 }
157 }
158
159 public void setup(GL10 gl10) {
160 if(gl10 instanceof GL11) {
161 GL11 gl = (GL11)gl10;
162 int[] ids = new int[3];
163 gl.glGenBuffers(3, ids, 0);
164 mVtxVboID = ids[0];
165 mTexVboID = ids[1];
166 mIndVboID= ids[2];
167
168 gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, mVtxVboID);
169 gl.glBufferData(GL11.GL_ARRAY_BUFFER, vertices.capacity(), vertices, GL11.GL_STATIC_DRAW);
170 gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, 0);
171
172 gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, mTexVboID);
173 gl.glBufferData(GL11.GL_ARRAY_BUFFER, texCoords.capacity(), texCoords, GL11.GL_STATIC_DRAW);
174 gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, 0);
175
176 gl.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, mIndVboID);
177 gl.glBufferData(GL11.GL_ELEMENT_ARRAY_BUFFER, indices.capacity(), indices, GL11.GL_STATIC_DRAW);
178 gl.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, 0);
179 }
180 textureLoadFromResource(gl10);
181 }
182
183 public void textureLoadFromResource(GL10 gl) {
184 InputStream is = context.getResources().openRawResource(mResourceId);
185 Bitmap bitmap = null;
186 try {
187 bitmap = BitmapFactory.decodeStream(is);
188 } finally {
189 try {
190 is.close();
191 is = null;
192 } catch (IOException e) {
193 }
194 }
195
196 int[] ids = new int[1];
197 gl.glGenTextures(1, ids, 0);
198 mTextureID = ids[0];
199
200 gl.glBindTexture(GL10.GL_TEXTURE_2D, mTextureID);
201
202 gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST);
203 gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_NEAREST);
204 gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_REPEAT);
205 gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_REPEAT);
206 GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
207
208 bitmap.recycle();
209 }
210}
diff --git a/s3d/apps/Cowboids/src/com/ti/s3d/render/Scene.java b/s3d/apps/Cowboids/src/com/ti/s3d/render/Scene.java
deleted file mode 100644
index 3c6ae15..0000000
--- a/s3d/apps/Cowboids/src/com/ti/s3d/render/Scene.java
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * Copyright (C) 2011 Texas Instruments Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.ti.s3d.render;
18
19import javax.microedition.khronos.opengles.GL10;
20
21public interface Scene {
22 public void draw(GL10 gl);
23 public void drawEnd(GL10 gl);
24 public void setup(GL10 gl, int w, int h);
25 public void onTouch(float deltaX, float deltaY);
26}
diff --git a/s3d/apps/Cowboids/src/com/ti/s3d/render/StereoGLView.java b/s3d/apps/Cowboids/src/com/ti/s3d/render/StereoGLView.java
deleted file mode 100644
index 594e38c..0000000
--- a/s3d/apps/Cowboids/src/com/ti/s3d/render/StereoGLView.java
+++ /dev/null
@@ -1,61 +0,0 @@
1/*
2 * Copyright (C) 2011 Texas Instruments Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.ti.s3d.render;
18
19import android.view.MotionEvent;
20import android.opengl.GLSurfaceView;
21import android.content.Context;
22
23import com.ti.s3d.S3DView;
24
25
26public class StereoGLView extends GLSurfaceView {
27
28 public StereoGLView(Context context, Scene scene) {
29 super(context);
30 this.mScene = scene;
31 //Create an S3D view to signal we are rendering stereo content
32 s3dView = new S3DView(getHolder());
33 mRenderer = new StereoRenderer(scene);
34 setRenderer(mRenderer);
35 mPrevX = 0;
36 mPrevY = 0;
37 }
38
39 @Override
40 public boolean onTouchEvent(MotionEvent e) {
41 if (e.getActionMasked() == MotionEvent.ACTION_DOWN) {
42 mPrevX = e.getX();
43 mPrevY = e.getY();
44 }
45 if (e.getActionMasked() == MotionEvent.ACTION_MOVE) {
46 float deltaX = e.getX() - mPrevX;
47 float deltaY = e.getY() - mPrevY;
48 mRenderer.moveCam(deltaX);
49 mScene.onTouch(deltaX, deltaY);
50 mPrevX = e.getX();
51 mPrevY = e.getY();
52 }
53 return true;
54 }
55
56 private float mPrevX;
57 private float mPrevY;
58 private S3DView s3dView;
59 private StereoRenderer mRenderer;
60 private Scene mScene;
61}
diff --git a/s3d/apps/Cowboids/src/com/ti/s3d/render/StereoRenderer.java b/s3d/apps/Cowboids/src/com/ti/s3d/render/StereoRenderer.java
deleted file mode 100644
index 2e91808..0000000
--- a/s3d/apps/Cowboids/src/com/ti/s3d/render/StereoRenderer.java
+++ /dev/null
@@ -1,190 +0,0 @@
1/*
2 * Copyright (C) 2011 Texas Instruments Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.ti.s3d.render;
18
19import javax.microedition.khronos.egl.EGLConfig;
20import javax.microedition.khronos.opengles.GL10;
21import android.opengl.GLSurfaceView;
22
23import java.lang.Math;
24
25/**
26 * Render a stereo scene.
27 */
28
29public class StereoRenderer implements GLSurfaceView.Renderer {
30
31 private static final float DEGREES_TO_RADIANS = 0.0174532925f;
32
33 private float mDepthZ = -10.0f;
34 private static final float nearZ = 3.0f;
35 private static final float farZ = 30.0f;
36 private static final float maxDepthZ = -(nearZ+2.0f);
37 private static final float minDepthZ = -(farZ-7.0f);
38 private static final float screenPlaneZ = 10.0f;
39 private static final float fovy = 45.0f;
40 //private static final float IOD = 0.2f;
41 private float IOD = 0.2f;
42
43 private int width;
44 private int height;
45 private S3DRenderMode renderMode;
46 private Camera leftCam = new Camera(S3DView.LEFT);
47 private Camera rightCam = new Camera(S3DView.RIGHT);
48
49 private Scene scene;
50
51 public StereoRenderer(Scene scene) {
52 renderMode = S3DRenderMode.SIDE_BY_SIDE;
53 this.scene = scene;
54 }
55
56 private void setViewPort(GL10 gl, S3DView view) {
57 gl.glViewport(renderMode.viewportX(view,width),
58 renderMode.viewportY(view,height),
59 renderMode.viewportWidth(width),
60 renderMode.viewportHeight(height));
61 }
62
63 private void drawScene(GL10 gl, S3DView view) {
64 setViewPort(gl, view);
65
66 gl.glMatrixMode(GL10.GL_MODELVIEW);
67 gl.glLoadIdentity();
68 gl.glPushMatrix();
69 gl.glTranslatef(0.0f, 0.0f, mDepthZ);
70 scene.draw(gl);
71 gl.glPopMatrix();
72 }
73
74 public void onDrawFrame(GL10 gl) {
75 gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
76
77 leftCam.apply(gl);
78 drawScene(gl, S3DView.LEFT);
79
80 rightCam.apply(gl);
81 drawScene(gl, S3DView.RIGHT);
82
83 scene.drawEnd(gl);
84 }
85
86 private void setupGL(GL10 gl) {
87 gl.glClearColor(0,0,0,0);
88 gl.glEnable(GL10.GL_CULL_FACE);
89 gl.glEnable(GL10.GL_DEPTH_TEST);
90 }
91
92 public void onSurfaceChanged(GL10 gl, int w, int h) {
93 width = w;
94 height = h;
95 setupGL(gl);
96 scene.setup(gl, w, h);
97
98 float aspect = (float)w/(float)h;
99 leftCam.setup(IOD, aspect);
100 rightCam.setup(IOD, aspect);
101 }
102
103 public void onSurfaceCreated(GL10 gl, EGLConfig config) {
104 gl.glDisable(GL10.GL_DITHER);
105 gl.glEnable(GL10.GL_CULL_FACE);
106 gl.glEnable(GL10.GL_DEPTH_TEST);
107 gl.glEnable(GL10.GL_TEXTURE_2D);
108 gl.glShadeModel(GL10.GL_SMOOTH);
109 gl.glClearColor(0,0,0,0);
110 gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST);
111 }
112
113 public void moveCam(float deltaX) {
114 deltaX /= (float)width;
115 deltaX *= 20.0f;
116 mDepthZ += deltaX;
117 if(mDepthZ >= maxDepthZ)
118 mDepthZ = maxDepthZ;
119 else if(mDepthZ <= minDepthZ)
120 mDepthZ = minDepthZ;
121 }
122
123 public void changeIOD(float deltaY) {
124 deltaY /= (float)height;
125 IOD += deltaY;
126 if(IOD > 0.75f)
127 IOD=0.75f;
128 else if(IOD < 0.0f)
129 IOD=0.0f;
130 float aspect = (float)width/(float)height;
131 leftCam.setup(IOD, aspect);
132 rightCam.setup(IOD, aspect);
133 }
134
135 private static enum S3DView { LEFT, RIGHT };
136 protected static enum S3DRenderMode {
137 SIDE_BY_SIDE {
138 S3DRenderMode next() { return OVER_UNDER; }
139 int viewportWidth(int width) { return width/2; }
140 int viewportHeight(int height) { return height; }
141 int viewportX(S3DView view, int w) { return view == S3DView.LEFT ? 0 : w/2; }
142 int viewportY(S3DView view, int h) { return 0; }
143 },
144 OVER_UNDER {
145 S3DRenderMode next() { return SIDE_BY_SIDE; }
146 int viewportWidth(int width) { return width; }
147 int viewportHeight(int height) { return height/2; }
148 int viewportX(S3DView view, int w) { return 0; }
149 int viewportY(S3DView view, int h) { return (view == S3DView.RIGHT) ? 0 : h/2; }
150 };
151
152 abstract S3DRenderMode next();
153 abstract int viewportWidth(int width);
154 abstract int viewportHeight(int height);
155 abstract int viewportX(S3DView view, int w);
156 abstract int viewportY(S3DView view, int h);
157 }
158
159 private static class Camera {
160
161 private Camera(S3DView view) {
162 this.view = view;
163 };
164
165 private void setup(float IOD, float aspect) {
166 float top = nearZ*(float)Math.tan(DEGREES_TO_RADIANS*fovy/2.0f);
167 float r = aspect*top;
168 float frustumshift = (IOD/2.0f)*nearZ/screenPlaneZ;
169 this.top = top;
170 this.bottom = -top;
171 this.left = view == S3DView.LEFT ? -r + frustumshift : -r-frustumshift;
172 this.right = view == S3DView.LEFT ? r + frustumshift : r-frustumshift;
173 this.x = view == S3DView.LEFT ? IOD/2.0f : -IOD/2.0f;
174 }
175
176 private void apply(GL10 gl) {
177 gl.glMatrixMode(GL10.GL_PROJECTION);
178 gl.glLoadIdentity();
179 gl.glFrustumf(left, right, bottom, top,nearZ, farZ);
180 gl.glTranslatef(x, 0.0f, 0.0f);
181 }
182
183 private float left;
184 private float right;
185 private float bottom;
186 private float top;
187 private float x;
188 private S3DView view;
189 }
190}
diff --git a/s3d/frameworks/Android.mk b/s3d/frameworks/Android.mk
deleted file mode 100644
index 972cf40..0000000
--- a/s3d/frameworks/Android.mk
+++ /dev/null
@@ -1,49 +0,0 @@
1#
2# Copyright (C) 2011 Texas Instruments Inc.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17# This makefile shows how to build your own shared library that can be
18# shipped on the system of a phone, and included additional examples of
19# including JNI code with the library and writing client applications against it.
20
21LOCAL_PATH := $(call my-dir)
22
23include $(CLEAR_VARS)
24
25LOCAL_SRC_FILES := $(call all-subdir-java-files)
26
27LOCAL_MODULE:= com.ti.s3d
28LOCAL_MODULE_TAGS := optional
29
30include $(BUILD_JAVA_LIBRARY)
31
32# ============================================================
33include $(CLEAR_VARS)
34
35LOCAL_SRC_FILES := \
36 $(call all-subdir-java-files) \
37 $(call all-subdir-html-files)
38
39LOCAL_MODULE:= s3d_api
40LOCAL_DROIDDOC_OPTIONS := com.ti.s3d
41LOCAL_MODULE_CLASS := JAVA_LIBRARIES
42LOCAL_DROIDDOC_USE_STANDARD_DOCLET := true
43
44include $(BUILD_DROIDDOC)
45
46# ============================================================
47include $(CLEAR_VARS)
48
49include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/s3d/frameworks/com.ti.s3d.xml b/s3d/frameworks/com.ti.s3d.xml
deleted file mode 100644
index ee3fa79..0000000
--- a/s3d/frameworks/com.ti.s3d.xml
+++ /dev/null
@@ -1,5 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<permissions>
3 <library name="com.ti.s3d"
4 file="/system/framework/com.ti.s3d.jar"/>
5</permissions>
diff --git a/s3d/frameworks/java/com/ti/s3d/S3DView.java b/s3d/frameworks/java/com/ti/s3d/S3DView.java
deleted file mode 100644
index ddfd869..0000000
--- a/s3d/frameworks/java/com/ti/s3d/S3DView.java
+++ /dev/null
@@ -1,332 +0,0 @@
1/*
2* Copyright (C) 2011 Texas Instruments Inc.
3*
4* Licensed under the Apache License, Version 2.0 (the "License");
5* you may not use this file except in compliance with the License.
6* You may obtain a copy of the License at
7*
8* http://www.apache.org/licenses/LICENSE-2.0
9*
10* Unless required by applicable law or agreed to in writing, software
11* distributed under the License is distributed on an "AS IS" BASIS,
12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13* See the License for the specific language governing permissions and
14* limitations under the License.
15*/
16
17package com.ti.s3d;
18
19import java.lang.IllegalArgumentException;
20
21import android.app.Activity;
22import android.view.Surface;
23import android.view.SurfaceHolder;
24
25/**
26 S3DView provides a mechanism to inform the surface composer (SurfaceFlinger)
27 that stereoscopic content is being rendered unto a surface or an Activity window.
28 <br /><br />
29
30 The typical use of this class when using SurfaceView or one of its descendants is:<br />
31 <p><blockquote><pre>
32 SurfaceView view = new SurfaceView(context);<br />
33 SurfaceHolder holder = view.getHolder();<br />
34 S3DView s3dView = S3DView(holder, Layout.SIDE_BY_SIDE_LR, RenderMode.STEREO);<br />
35 or <br />
36 S3DView s3dView = S3DView(holder, Layout.TOPBOTTOM_L, RenderMode.STEREO);
37 </pre></blockquote>
38
39 For a standard Activity window, the application has to invoke the methods provided by this class
40 after the underlying surface has been created. The easiest way to ensure this is by overriding
41 the method onWindowFocusChanged of the required target Activity; when onWindowFocusChanged is called
42 the activity window will already have a surface attached to it. If the S3DView method is invoked before
43 onWindowFocusChanged has happened, the configuration will be ignored.
44 <p><blockquote><pre>
45 public void onWindowFocusChanged(boolean hasFocus) {<br />
46 super.onWindowFocusChanged(hasFocus);<br />
47 if (hasFocus) {<br />
48 S3DView.configureWindow(this, Layout.SIDE_BY_SIDE_LR, RenderMode.STEREO);<br />
49 }<br />
50 }<br />
51 </pre></blockquote>
52
53 To use this class in an application, the following is required in AndroidManifest.xml
54 as a child of the <application> element:
55 <p><blockquote><pre>
56 {@code <uses-library android:name="com.ti.s3d" android:required="false" />}
57 </pre></blockquote>
58
59 Additionally, for a native build, the following line should be added in Android.mk:
60 <p><blockquote><pre>
61 LOCAL_JAVA_LIBRARIES := com.ti.s3d
62 </pre></blockquote>
63
64 @author Alberto Aguirre
65 @author Jagadeesh Pakaravoor
66 @version 1.1, Jan 2012
67 */
68
69public class S3DView implements SurfaceHolder.Callback {
70
71 /**
72 Equivalent to S3DView(Layout.SIDE_BY_SIDE_LR, RenderMode.STEREO)
73 @see #S3DView(SurfaceHolder, Layout, RenderMode)
74 */
75 public S3DView(SurfaceHolder sh) {
76 this(sh, Layout.SIDE_BY_SIDE_LR, RenderMode.STEREO);
77 }
78
79 /**
80 This constructor is used to inform the compositor about stereo content in SurfaceView.
81 If the surface holder already contains a valid surface, then the configuration
82 is done during the constructor. Otherwise, a callback is registered with
83 the given surface holder instance and performs the configuration during surfaceChanged.
84 @param sh The holder associated with the SurfaceView where stereo content will be rendered to.
85 @param layout Describes in which position the stereo views are rendered as.
86 @param mode Describes if the stereo view should be rendered in stereo or just one of the views
87 */
88 public S3DView(SurfaceHolder sh, Layout layout, RenderMode mode) {
89 nativeClassInit();
90 sh.addCallback(this);
91 this.layout = layout;
92 this.mode = mode;
93 if(sh.getSurface().isValid()) {
94 this.holder = sh;
95 config();
96 }
97 }
98
99 /**
100 This constructor is used to inform the compositor about stereo content in a regular window
101 associated with an Activity.
102 @param a The activity that owns the window where stereo content is rendered to.
103 @param layout Describes in which position the stereo views are rendered as.
104 @param mode Describes if the stereo view should be rendered in stereo or just one of the views
105 */
106 public S3DView(Activity a, Layout layout, RenderMode mode) {
107 nativeClassInit();
108 this.layout = layout;
109 this.mode = mode;
110 this.activity = a;
111 config();
112 }
113
114 /**
115 Equivalent to S3DView(Layout.SIDE_BY_SIDE_LR, RenderMode.STEREO)
116 @see #S3DView(Layout, RenderMode)
117 */
118 public S3DView() {
119 this(Layout.SIDE_BY_SIDE_LR, RenderMode.STEREO);
120 }
121
122 /**
123 This constructor is used to inform the compositor about stereo content in SurfaceView layer.
124 If the surface holder already contains a valid surface, then the configuration
125 is done during the constructor. Otherwise, a callback is registered with
126 the given surface holder instance and performs the configuration during surfaceChanged.
127 @param layout Describes in which position the stereo views are rendered as.
128 @param mode Describes if the stereo view should be rendered in stereo or just one of the views
129 */
130 public S3DView(Layout layout, RenderMode mode) {
131 nativeClassInit();
132 this.layout = layout;
133 this.mode = mode;
134 config();
135 }
136
137 /**
138 Changes the current layout and render mode. Typically this is used when
139 you reuse the same Surfaceview to render mono content, or potentially after
140 a system orientation change, where the preferred layout has changed.
141 @param layout Describes in which position the stereo views are rendered as.
142 @param mode Describes if the stereo view should be rendered in stereo or just one of the views
143 @see #getPrefLayout
144 */
145 public void setConfig(S3DView.Layout layout, S3DView.RenderMode mode) {
146 this.layout = layout;
147 this.mode = mode;
148 config();
149 }
150
151 /**
152 Only the layout is changed. The RenderMode remains set to its current value.
153 @param layout Describes in which position the stereo views are rendered as.
154 @see S3DView.Layout
155 */
156 public void setLayout(S3DView.Layout layout) {
157 this.layout = layout;
158 config();
159 }
160
161 /**
162 Only the render mode is changed. The layout remains set to its current value.
163 @param mode Describes in which position the stereo views are rendered as.
164 @see S3DView.Layout
165 */
166 public void setMode(S3DView.RenderMode mode) {
167 this.mode = mode;
168 config();
169 }
170
171 /**
172 Swaps the left and right view. Useful mainly in cases where the rendering is not done
173 by the owner of this view, for example Camera or Video.
174 */
175 public void swapLR() {
176 layout = layout.swapLR();
177 config();
178 }
179
180 /**
181 Informs what is the preferred layout for the default display.
182 To minimize aliasing artifacts when dealing with interleaved S3D displays,
183 the user should render in the layout described here.
184 @return The layout preferred by the default display
185 */
186 public S3DView.Layout getPrefLayout() {
187 return native_getPrefLayout();
188 }
189
190 /**
191 Convenience method to configure a window. It's the equivalent of:<br />
192 S3DView v = new S3DView(a, layout, mode);
193 @param a The activity that owns the window where stereo content is rendered to.
194 @param layout Describes in which position the stereo views are rendered as.
195 @param mode Describes if the stereo view should be rendered in stereo or just one of the views
196 */
197 public static void configureWindow(Activity a, Layout layout, RenderMode mode) {
198 S3DView v = new S3DView(a, layout, mode);
199 }
200
201 /**
202 Convenience method to configure a surface. It's the equivalent of:<br />
203 S3DView v = new S3DView(sh, layout, mode);
204 Throws IllegalArgumentException if the given surface holder doesn't contain
205 a valid surface.
206 @param sh The holder associated with the SurfaceView where stereo content will be rendered to.
207 @param layout Describes in which position the stereo views are rendered as.
208 @param mode Describes if the stereo view should be rendered in stereo or just one of the views
209
210 */
211 public static void configureSurface(SurfaceHolder sh, Layout layout, RenderMode mode) {
212 if(!sh.getSurface().isValid()) {
213 throw new IllegalArgumentException("Surface is not valid");
214 }
215 S3DView v = new S3DView(sh, layout, mode);
216 }
217
218 /**
219 SurfaceHolder.Callback implementation.