3 Commits

Autor SHA1 Mensagem Data
Alexander Smorkalov 114e04ee12 OpenCV version++. Current OpenCv version 2.4.6.2 2013-08-29 19:00:13 +04:00
Alexander Smorkalov 09e66adadc New Tegra detector with Android 4.3 support added. Manager version++.
(cherry picked from commit aa00b5a0ab)

Conflicts:

	platforms/android/service/engine/jni/BinderComponent/TegraDetector.cpp
2013-08-29 18:48:48 +04:00
Alexander Smorkalov ba26f6d48a Native camera libraries updated.
Android 4.3 support added;
ANY camera index support fixed;
applyProperties now uses camera->reconnect() instead close/connect for Android 4.x.
(cherry picked from commit fff91eef0b)
2013-08-29 18:46:45 +04:00
37 arquivos alterados com 190 adições e 122 exclusões
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
BIN
Ver Arquivo
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
BIN
Ver Arquivo
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
BIN
Ver Arquivo
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
BIN
Ver Arquivo
Arquivo binário não exibido.
@@ -1,5 +1,8 @@
#if !defined(ANDROID_r2_2_0) && !defined(ANDROID_r2_3_3) && !defined(ANDROID_r3_0_1) && !defined(ANDROID_r4_0_0) && !defined(ANDROID_r4_0_3) && !defined(ANDROID_r4_1_1) && !defined(ANDROID_r4_2_0)
# error Building camera wrapper for your version of Android is not supported by OpenCV. You need to modify OpenCV sources in order to compile camera wrapper for your version of Android.
#if !defined(ANDROID_r2_2_0) && !defined(ANDROID_r2_3_3) && !defined(ANDROID_r3_0_1) && \
!defined(ANDROID_r4_0_0) && !defined(ANDROID_r4_0_3) && !defined(ANDROID_r4_1_1) && \
!defined(ANDROID_r4_2_0) && !defined(ANDROID_r4_3_0)
# error Building camera wrapper for your version of Android is not supported by OpenCV.\
You need to modify OpenCV sources in order to compile camera wrapper for your version of Android.
#endif
#include <camera/Camera.h>
@@ -16,17 +19,18 @@
//Include SurfaceTexture.h file with the SurfaceTexture class
# include <gui/SurfaceTexture.h>
# define MAGIC_OPENCV_TEXTURE_ID (0x10)
#else // defined(ANDROID_r3_0_1) || defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3)
//TODO: This is either 2.2 or 2.3. Include the headers for ISurface.h access
#if defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0)
#include <gui/ISurface.h>
#include <gui/BufferQueue.h>
#elif defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0)
# include <gui/ISurface.h>
# include <gui/BufferQueue.h>
#elif defined(ANDROID_r4_3_0)
# include <gui/IGraphicBufferProducer.h>
# include <gui/BufferQueue.h>
#else
# include <surfaceflinger/ISurface.h>
#endif // defined(ANDROID_r4_1_1)
#endif // defined(ANDROID_r3_0_1) || defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3)
#endif
#include <string>
#include <fstream>
//undef logging macro from /system/core/libcutils/loghack.h
#ifdef LOGD
@@ -45,7 +49,6 @@
# undef LOGE
#endif
// LOGGING
#include <android/log.h>
#define CAMERA_LOG_TAG "OpenCV_NativeCamera"
@@ -60,7 +63,7 @@ using namespace android;
void debugShowFPS();
#if defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0)
#if defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0) || defined(ANDROID_r4_3_0)
class ConsumerListenerStub: public BufferQueue::ConsumerListener
{
public:
@@ -73,6 +76,29 @@ public:
};
#endif
std::string getProcessName()
{
std::string result;
std::ifstream f;
f.open("/proc/self/cmdline");
if (f.is_open())
{
std::string fullPath;
std::getline(f, fullPath, '\0');
if (!fullPath.empty())
{
int i = fullPath.size()-1;
while ((i >= 0) && (fullPath[i] != '/')) i--;
result = fullPath.substr(i+1, std::string::npos);
}
}
f.close();
return result;
}
void debugShowFPS()
{
static int mFrameCount = 0;
@@ -280,7 +306,7 @@ public:
}
virtual void postData(int32_t msgType, const sp<IMemory>& dataPtr
#if defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) || defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0)
#if defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) || defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0) || defined(ANDROID_r4_3_0)
,camera_frame_metadata_t*
#endif
)
@@ -361,7 +387,9 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
typedef sp<Camera> (*Android22ConnectFuncType)();
typedef sp<Camera> (*Android23ConnectFuncType)(int);
typedef sp<Camera> (*Android3DConnectFuncType)(int, int);
typedef sp<Camera> (*Android43ConnectFuncType)(int, const String16&, int);
const int ANY_CAMERA_INDEX = -1;
const int BACK_CAMERA_INDEX = 99;
const int FRONT_CAMERA_INDEX = 98;
@@ -372,14 +400,24 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
CAMERA_SUPPORT_MODE_ZSL = 0x08 /* Camera Sensor supports ZSL mode. */
};
// used for Android 4.3
enum {
USE_CALLING_UID = -1
};
const char Android22ConnectName[] = "_ZN7android6Camera7connectEv";
const char Android23ConnectName[] = "_ZN7android6Camera7connectEi";
const char Android3DConnectName[] = "_ZN7android6Camera7connectEii";
const char Android43ConnectName[] = "_ZN7android6Camera7connectEiRKNS_8String16Ei";
int localCameraIndex = cameraId;
if (cameraId == ANY_CAMERA_INDEX)
{
localCameraIndex = 0;
}
#if !defined(ANDROID_r2_2_0)
if (cameraId == BACK_CAMERA_INDEX)
else if (cameraId == BACK_CAMERA_INDEX)
{
LOGD("Back camera selected");
for (int i = 0; i < Camera::getNumberOfCameras(); i++)
@@ -450,6 +488,12 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
LOGD("Connecting to CameraService v 3D");
camera = Android3DConnect(localCameraIndex, CAMERA_SUPPORT_MODE_2D);
}
else if (Android43ConnectFuncType Android43Connect = (Android43ConnectFuncType)dlsym(CameraHALHandle, Android43ConnectName))
{
std::string currentProcName = getProcessName();
LOGD("Current process name for camera init: %s", currentProcName.c_str());
camera = Android43Connect(localCameraIndex, String16(currentProcName.c_str()), USE_CALLING_UID);
}
else
{
dlclose(CameraHALHandle);
@@ -471,7 +515,7 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
handler->camera = camera;
handler->cameraId = localCameraIndex;
if (prevCameraParameters != 0)
if (prevCameraParameters != NULL)
{
LOGI("initCameraConnect: Setting paramers from previous camera handler");
camera->setParameters(prevCameraParameters->flatten());
@@ -503,11 +547,11 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
const char* available_focus_modes = handler->params.get(CameraParameters::KEY_SUPPORTED_FOCUS_MODES);
if (available_focus_modes != 0)
{
if (strstr(available_focus_modes, "continuous-video") != NULL)
{
handler->params.set(CameraParameters::KEY_FOCUS_MODE, CameraParameters::FOCUS_MODE_CONTINUOUS_VIDEO);
if (strstr(available_focus_modes, "continuous-video") != NULL)
{
handler->params.set(CameraParameters::KEY_FOCUS_MODE, CameraParameters::FOCUS_MODE_CONTINUOUS_VIDEO);
status_t resParams = handler->camera->setParameters(handler->params.flatten());
status_t resParams = handler->camera->setParameters(handler->params.flatten());
if (resParams != 0)
{
@@ -517,8 +561,8 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
{
LOGD("initCameraConnect: autofocus is set to mode \"continuous-video\"");
}
}
}
}
#endif
//check if yuv420sp format available. Set this format as preview format.
@@ -560,26 +604,25 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
}
}
status_t pdstatus;
status_t bufferStatus;
#if defined(ANDROID_r2_2_0)
pdstatus = camera->setPreviewDisplay(sp<ISurface>(0 /*new DummySurface*/));
if (pdstatus != 0)
LOGE("initCameraConnect: failed setPreviewDisplay(0) call; camera migth not work correctly on some devices");
bufferStatus = camera->setPreviewDisplay(sp<ISurface>(0 /*new DummySurface*/));
if (bufferStatus != 0)
LOGE("initCameraConnect: failed setPreviewDisplay(0) call (status %d); camera might not work correctly on some devices", bufferStatus);
#elif defined(ANDROID_r2_3_3)
/* Do nothing in case of 2.3 for now */
#elif defined(ANDROID_r3_0_1) || defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3)
sp<SurfaceTexture> surfaceTexture = new SurfaceTexture(MAGIC_OPENCV_TEXTURE_ID);
pdstatus = camera->setPreviewTexture(surfaceTexture);
if (pdstatus != 0)
LOGE("initCameraConnect: failed setPreviewTexture call; camera migth not work correctly");
#elif defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0)
bufferStatus = camera->setPreviewTexture(surfaceTexture);
if (bufferStatus != 0)
LOGE("initCameraConnect: failed setPreviewTexture call (status %d); camera might not work correctly", bufferStatus);
#elif defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0) || defined(ANDROID_r4_3_0)
sp<BufferQueue> bufferQueue = new BufferQueue();
sp<BufferQueue::ConsumerListener> queueListener = new ConsumerListenerStub();
bufferQueue->consumerConnect(queueListener);
pdstatus = camera->setPreviewTexture(bufferQueue);
if (pdstatus != 0)
LOGE("initCameraConnect: failed setPreviewTexture call; camera migth not work correctly");
bufferStatus = camera->setPreviewTexture(bufferQueue);
if (bufferStatus != 0)
LOGE("initCameraConnect: failed setPreviewTexture call; camera might not work correctly");
#endif
#if (defined(ANDROID_r2_2_0) || defined(ANDROID_r2_3_3) || defined(ANDROID_r3_0_1))
@@ -595,9 +638,9 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
#endif //!(defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3))
LOGD("Starting preview");
status_t resStart = camera->startPreview();
status_t previewStatus = camera->startPreview();
if (resStart != 0)
if (previewStatus != 0)
{
LOGE("initCameraConnect: startPreview() fails. Closing camera connection...");
handler->closeCameraConnect();
@@ -605,7 +648,7 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
}
else
{
LOGD("Preview started successfully");
LOGD("Preview started successfully");
}
return handler;
@@ -620,9 +663,11 @@ void CameraHandler::closeCameraConnect()
}
camera->stopPreview();
#if defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) || defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0) || defined(ANDROID_r4_3_0)
camera->setPreviewCallbackFlags(CAMERA_FRAME_CALLBACK_FLAG_NOOP);
#endif
camera->disconnect();
camera.clear();
camera=NULL;
// ATTENTION!!!!!!!!!!!!!!!!!!!!!!!!!!
// When we set
@@ -863,14 +908,60 @@ void CameraHandler::applyProperties(CameraHandler** ppcameraHandler)
if (*ppcameraHandler == 0)
{
LOGE("applyProperties: Passed null *ppcameraHandler");
LOGE("applyProperties: Passed NULL *ppcameraHandler");
return;
}
LOGD("CameraHandler::applyProperties()");
CameraHandler* previousCameraHandler=*ppcameraHandler;
CameraParameters curCameraParameters(previousCameraHandler->params.flatten());
CameraParameters curCameraParameters((*ppcameraHandler)->params.flatten());
#if defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) || defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0) || defined(ANDROID_r4_3_0)
CameraHandler* handler=*ppcameraHandler;
handler->camera->stopPreview();
handler->camera->setPreviewCallbackFlags(CAMERA_FRAME_CALLBACK_FLAG_NOOP);
status_t reconnectStatus = handler->camera->reconnect();
if (reconnectStatus != 0)
{
LOGE("applyProperties: failed to reconnect camera (status %d)", reconnectStatus);
return;
}
handler->camera->setParameters(curCameraParameters.flatten());
handler->params.unflatten(curCameraParameters.flatten());
status_t bufferStatus;
# if defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3)
sp<SurfaceTexture> surfaceTexture = new SurfaceTexture(MAGIC_OPENCV_TEXTURE_ID);
bufferStatus = handler->camera->setPreviewTexture(surfaceTexture);
if (bufferStatus != 0)
LOGE("applyProperties: failed setPreviewTexture call (status %d); camera might not work correctly", bufferStatus);
# elif defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0) || defined(ANDROID_r4_3_0)
sp<BufferQueue> bufferQueue = new BufferQueue();
sp<BufferQueue::ConsumerListener> queueListener = new ConsumerListenerStub();
bufferQueue->consumerConnect(queueListener);
bufferStatus = handler->camera->setPreviewTexture(bufferQueue);
if (bufferStatus != 0)
LOGE("applyProperties: failed setPreviewTexture call; camera might not work correctly");
# endif
handler->camera->setPreviewCallbackFlags( CAMERA_FRAME_CALLBACK_FLAG_ENABLE_MASK | CAMERA_FRAME_CALLBACK_FLAG_COPY_OUT_MASK);//with copy
LOGD("Starting preview");
status_t previewStatus = handler->camera->startPreview();
if (previewStatus != 0)
{
LOGE("initCameraConnect: startPreview() fails. Closing camera connection...");
handler->closeCameraConnect();
handler = NULL;
}
else
{
LOGD("Preview started successfully");
}
#else
CameraHandler* previousCameraHandler=*ppcameraHandler;
CameraCallback cameraCallback=previousCameraHandler->cameraCallback;
void* userData=previousCameraHandler->userData;
int cameraId=previousCameraHandler->cameraId;
@@ -879,7 +970,6 @@ void CameraHandler::applyProperties(CameraHandler** ppcameraHandler)
previousCameraHandler->closeCameraConnect();
LOGD("CameraHandler::applyProperties(): after previousCameraHandler->closeCameraConnect");
LOGD("CameraHandler::applyProperties(): before initCameraConnect");
CameraHandler* handler=initCameraConnect(cameraCallback, cameraId, userData, &curCameraParameters);
LOGD("CameraHandler::applyProperties(): after initCameraConnect, handler=0x%x", (int)handler);
@@ -892,6 +982,7 @@ void CameraHandler::applyProperties(CameraHandler** ppcameraHandler)
}
}
(*ppcameraHandler)=handler;
#endif
}
+2 -2
Ver Arquivo
@@ -431,14 +431,14 @@ void CameraActivity::applyProperties()
int CameraActivity::getFrameWidth()
{
if (frameWidth <= 0)
frameWidth = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEWIDTH);
frameWidth = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEWIDTH);
return frameWidth;
}
int CameraActivity::getFrameHeight()
{
if (frameHeight <= 0)
frameHeight = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEHEIGHT);
frameHeight = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEHEIGHT);
return frameHeight;
}
+1 -1
Ver Arquivo
@@ -50,7 +50,7 @@
#define CV_VERSION_EPOCH 2
#define CV_VERSION_MAJOR 4
#define CV_VERSION_MINOR 6
#define CV_VERSION_REVISION 1
#define CV_VERSION_REVISION 2
#define CVAUX_STR_EXP(__A) #__A
#define CVAUX_STR(__A) CVAUX_STR_EXP(__A)
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.opencv.engine"
android:versionCode="29@ANDROID_PLATFORM_VERSION_CODE@"
android:versionName="2.9" >
android:versionCode="210@ANDROID_PLATFORM_VERSION_CODE@"
android:versionName="2.10" >
<uses-sdk android:minSdkVersion="@ANDROID_NATIVE_API_LEVEL@" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
+27 -6
Ver Arquivo
@@ -26,19 +26,32 @@ endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${ANDROID_MANIFEST_FILE}" "${OpenCV_BINARY_DIR}/platforms/android/service/engine/.build/${ANDROID_MANIFEST_FILE}" @ONLY)
link_directories("${ANDROID_SOURCE_TREE}/out/target/product/generic/system/lib" "${ANDROID_SOURCE_TREE}/out/target/product/${ANDROID_PRODUCT}/system/lib" "${ANDROID_SOURCE_TREE}/bin/${ANDROID_ARCH_NAME}")
link_directories(
"${ANDROID_SOURCE_TREE}/out/target/product/generic/system/lib"
"${ANDROID_SOURCE_TREE}/out/target/product/${ANDROID_PRODUCT}/system/lib"
"${ANDROID_SOURCE_TREE}/bin/${ANDROID_ARCH_NAME}")
file(GLOB engine_files "jni/BinderComponent/*.cpp" "jni/BinderComponent/*.h" "jni/include/*.h")
set(engine_libs "z" "binder" "log" "utils")
if (TEGRA_DETECTOR)
if (ANDROID_NATIVE_API_LEVEL GREATER 8)
add_definitions(-DUSE_TEGRA_HW_DETECTOR)
list(APPEND engine_libs ${TEGRA_DETECTOR} GLESv2 EGL)
else()
message(FATAL_ERROR "Tegra detector required native api level 9 or above")
endif()
endif()
# -D__SUPPORT_ARMEABI_FEATURES key is also available
add_definitions(-DPLATFORM_ANDROID -D__SUPPORT_ARMEABI_V7A_FEATURES -D__SUPPORT_TEGRA3 -D__SUPPORT_MIPS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-allow-shlib-undefined")
file(GLOB engine_files "jni/BinderComponent/*.cpp" "jni/BinderComponent/*.h" "jni/include/*.h")
include_directories(jni/BinderComponent jni/include)
include_directories("jni/BinderComponent" "jni/include")
include_directories(SYSTEM "${ANDROID_SOURCE_TREE}/frameworks/base/include" "${ANDROID_SOURCE_TREE}/system/core/include")
add_library(${engine} SHARED ${engine_files})
target_link_libraries(${engine} z binder log utils)
target_link_libraries(${engine} ${engine_libs})
set_target_properties(${engine} PROPERTIES
OUTPUT_NAME ${engine}
@@ -51,7 +64,15 @@ add_custom_command(TARGET ${engine} POST_BUILD COMMAND ${CMAKE_STRIP} --strip-un
file(GLOB engine_jni_files "jni/JNIWrapper/*.cpp" "jni/JNIWrapper/*.h" "jni/include/*.h")
list(APPEND engine_jni_files jni/NativeService/CommonPackageManager.cpp jni/NativeService/PackageInfo.cpp)
include_directories(jni/include jni/JNIWrapper jni/NativeService jni/BinderComponent "${ANDROID_SOURCE_TREE}/frameworks/base/include" "${ANDROID_SOURCE_TREE}/system/core/include" "${ANDROID_SOURCE_TREE}/frameworks/base/core/jni")
include_directories(
jni/include jni/JNIWrapper
jni/NativeService
jni/BinderComponent
"${ANDROID_SOURCE_TREE}/frameworks/base/include"
"${ANDROID_SOURCE_TREE}/system/core/include"
"${ANDROID_SOURCE_TREE}/frameworks/base/core/jni"
)
add_library(${engine}_jni SHARED ${engine_jni_files})
target_link_libraries(${engine}_jni z binder log utils android_runtime ${engine})
@@ -13,7 +13,7 @@ int GetCpuID()
map<string, string> cpu_info = GetCpuInfo();
map<string, string>::const_iterator it;
#if defined(__i386__)
#if defined(__i386__)
LOGD("Using X86 HW detector");
result |= ARCH_X86;
it = cpu_info.find("flags");
@@ -161,8 +161,11 @@ int GetProcessorCount()
int DetectKnownPlatforms()
{
#if defined(__arm__) && defined(USE_TEGRA_HW_DETECTOR)
int tegra_status = DetectTegra();
#else
int tegra_status = NOT_TEGRA;
#endif
// All Tegra platforms since Tegra3
if (2 < tegra_status)
{
@@ -172,4 +175,4 @@ int DetectKnownPlatforms()
{
return PLATFORM_UNKNOWN;
}
}
}
@@ -1,61 +0,0 @@
#include "TegraDetector.h"
#include <zlib.h>
#include <string.h>
#define KERNEL_CONFIG "/proc/config.gz"
#define KERNEL_CONFIG_MAX_LINE_WIDTH 512
#define KERNEL_CONFIG_TEGRA_MAGIC "CONFIG_ARCH_TEGRA=y"
#define KERNEL_CONFIG_TEGRA2_MAGIC "CONFIG_ARCH_TEGRA_2x_SOC=y"
#define KERNEL_CONFIG_TEGRA3_MAGIC "CONFIG_ARCH_TEGRA_3x_SOC=y"
#define KERNEL_CONFIG_TEGRA4_MAGIC "CONFIG_ARCH_TEGRA_11x_SOC=y"
#define MAX_DATA_LEN 4096
int DetectTegra()
{
int result = TEGRA_NOT_TEGRA;
gzFile kernelConfig = gzopen(KERNEL_CONFIG, "r");
if (kernelConfig != 0)
{
char tmpbuf[KERNEL_CONFIG_MAX_LINE_WIDTH];
const char *tegra_config = KERNEL_CONFIG_TEGRA_MAGIC;
const char *tegra2_config = KERNEL_CONFIG_TEGRA2_MAGIC;
const char *tegra3_config = KERNEL_CONFIG_TEGRA3_MAGIC;
const char *tegra4_config = KERNEL_CONFIG_TEGRA4_MAGIC;
int len = strlen(tegra_config);
int len2 = strlen(tegra2_config);
int len3 = strlen(tegra3_config);
int len4 = strlen(tegra4_config);
while (0 != gzgets(kernelConfig, tmpbuf, KERNEL_CONFIG_MAX_LINE_WIDTH))
{
if (0 == strncmp(tmpbuf, tegra_config, len))
{
result = 1;
}
if (0 == strncmp(tmpbuf, tegra2_config, len2))
{
result = 2;
break;
}
if (0 == strncmp(tmpbuf, tegra3_config, len3))
{
result = 3;
break;
}
if (0 == strncmp(tmpbuf, tegra4_config, len4))
{
result = 4;
break;
}
}
gzclose(kernelConfig);
}
else
{
result = TEGRA_DETECTOR_ERROR;
}
return result;
}
@@ -2,8 +2,13 @@
#define __TEGRA_DETECTOR_H__
#define TEGRA_DETECTOR_ERROR -2
#define TEGRA_NOT_TEGRA -1
#define NOT_TEGRA -1
#define TEGRA2 2
#define TEGRA3 3
#define TEGRA4i 4
#define TEGRA4 5
#define TEGRA5 6
int DetectTegra();
#endif
#endif
@@ -30,11 +30,12 @@ public class HardwareDetector
// GPU Acceleration options
public static final int FEATURES_HAS_GPU = 0x010000;
public static final int PLATFORM_TEGRA = 1;
public static final int PLATFORM_TEGRA2 = 2;
public static final int PLATFORM_TEGRA3 = 3;
public static final int PLATFORM_TEGRA4 = 4;
public static final int PLATFORM_TEGRA = 1;
public static final int PLATFORM_TEGRA2 = 2;
public static final int PLATFORM_TEGRA3 = 3;
public static final int PLATFORM_TEGRA4i = 4;
public static final int PLATFORM_TEGRA4 = 5;
public static final int PLATFORM_TEGRA5 = 6;
public static final int PLATFORM_UNKNOWN = 0;
@@ -107,6 +107,10 @@ public class ManagerActivity extends Activity
{
HardwarePlatformView.setText("Tegra 3");
}
else if (HardwareDetector.PLATFORM_TEGRA4i == Platfrom)
{
HardwarePlatformView.setText("Tegra 4i");
}
else
{
HardwarePlatformView.setText("Tegra 4");
+4
Ver Arquivo
@@ -21,3 +21,7 @@ native_camera_r4.2.0; armeabi-v7a; 14; /home/alexander/Projects/AndroidSource/4.
native_camera_r4.2.0; armeabi; 14; /home/alexander/Projects/AndroidSource/4.2
native_camera_r4.2.0; x86; 14; /home/alexander/Projects/AndroidSource/4.2
native_camera_r4.2.0; mips; 14; /home/alexander/Projects/AndroidSource/4.2
native_camera_r4.3.0; armeabi; 14; /home/alexander/Projects/AndroidSource/4.3
native_camera_r4.3.0; armeabi-v7a; 14; /home/alexander/Projects/AndroidSource/4.3
native_camera_r4.3.0; x86; 14; /home/alexander/Projects/AndroidSource/4.3
native_camera_r4.3.0; mips; 14; /home/alexander/Projects/AndroidSource/4.3