Related
I have a problem with this:
C code
#define CREATE_HTML_FILE_SCRIPT "/bin/curl https://coinmarketcap.com/it/currencies/bytecoin-bcn/ > /data/data/com.example.bytecoin/bcn.html"
#define CREATE_TEMP_FILE_SCRIPT "/data/local/lynx /data/data/com.example.bytecoin/bcn.html -dump > /data/data/com.example.bytecoin/bcn.txt"
system(CREATE_HTML_FILE_SCRIPT);
system(CREATE_TEMP_FILE_SCRIPT);
If I run from adb shell these commands all works well but when these command are executed from the app, file.html and file.txt are empty... I don't understand why and how I can solve it.
Well, lynx is an interactive program, so I think you'll run in trouble when using it from a system() call. But not with curl:
/* pru_curl-1.c */
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char *cmd = "curl https://www.google.com/";
system(cmd); /* you will get the output of curl on stdout */
exit(EXIT_SUCCESS);
}
This is with curl redirecting its output in the shell call with the > operator:
/* pru_curl-2.c */
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char *cmd = "curl https://www.google.com/ >output_file-2";
/* you will get the output of curl on output_file-2 */
system(cmd);
exit(EXIT_SUCCESS);
}
Curl, on the other side, allows you to specify -o output_file.txt and you'll be able to read the file, once the program has finished.
/* pru_curl-3.c */
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char *cmd = "curl https://www.google.com/ -o output_file-3";
/* you will get the output of curl on output_file-3 */
system(cmd);
exit(EXIT_SUCCESS);
}
You have a third alternative, which is using popen(3), that allows you to start the program as a subcommand, and read the output of that program from the FILE * descriptor you get from popen(3). You could use it like this (processing character by character):
/* pru_curl-4.c */
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char *cmd = "curl https://www.google.com/";
FILE *f = popen(cmd, "r");
if (!f) {
fprintf(stderr, "%s: %s\n",
cmd, strerror(errno));
exit(EXIT_FAILURE);
}
int c;
while((c = fgetc(f)) != EOF) {
printf("[%d]", c); /* you will get the downloaded file as
* sequences of numbers (the character
* values) embedded in square brackets on
* stdout */
}
pclose(f);
exit(EXIT_SUCCESS);
}
or (processing line by line):
/* pru_curl-5.c */
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char *cmd = "curl https://www.google.com/";
FILE *f = popen(cmd, "r");
if (!f) {
fprintf(stderr, "%s: %s\n",
cmd, strerror(errno));
exit(EXIT_FAILURE);
}
char line[256];
while (fgets(line, sizeof line, f)) {
/* you'll get your output in chunks of one line, or 256 bytes
* ---if longer---, encapsulated by a pair of square brackets
* drawn in a different color (gren, by the escape sequences
* used) */
fprintf(stderr,
"\033[1;33m[\033[m%s\033[32m]\033[m",
line);
}
pclose(f);
exit(EXIT_SUCCESS);
}
or (by blocks):
/* pru_curl-6.c */
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 8 /* blocks in buffer */
#define CPB 11 /* chars per block */
int main()
{
char *cmd = "curl https://www.google.com/";
FILE *f = popen(cmd, "r");
if (!f) {
fprintf(stderr, "%s: %s\n",
cmd, strerror(errno));
exit(EXIT_FAILURE);
}
char block[N][CPB];
int n;
char *sep = "";
do {
/* print a blanck line between groups */
printf("%s", sep);
sep = "\n";
/* we read as many CPB byte blocks as possible to fill the
* N registers in buffer.
* Then we start again until we don't fill completely the
* buffer. */
n = fread(block, sizeof block[0], N, f);
int i;
for (i = 0; i < n; i++) {
printf("[%.*s]\n", (int)sizeof block[i], block[i]);
}
printf("finished one loop of %d blocks of %d chars, each.\n",
N, (int) sizeof block[0]);
} while (n == N);
/* n < N, so we are finished, check that probably the last register is
* not printed because it was not complete. */
pclose(f);
exit(EXIT_SUCCESS);
}
(All these examples are complete and have been tested before posting)
Edit
I have completed the code for the six programs and now all of them are executables with just building with:
$ cc pru_curl-<i>.c -o pru_curl-<i> # <i> is the program number
$ _
In each case, you can execute the program by just running:
$ pru_curl-<i>
.... <-- a lot of output (or to a file) about the contents of the root page of google.
$ _
I am trying to use pjSip for my android application and following pjsip instructions. My system configurations are centos 7.4 64 bit .
I have downloaded latest ndk and pjsip code.
But when I am running the commands I am getting below error.
One more thing I noticed, confige.log aslo showing
cc1: warning: command line option '-frtti' is valid for C++/ObjC++ but not for C
[root#localhost pjproject-2.7.1]# ./configure-android
configure-android: APP_PLATFORM not specified, using android-27
configure-android: TARGET_ABI not specified, using armeabi
configure-android: calling ./configure with env vars:
CC = /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc
CXX = /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++
CFLAGS = --sysroot=/root/ROOTSIPFOLDER/android-ndk-r16b/platforms/android-27/arch-arm -I/root/ROOTSIPFOLDER/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/include -I/root/ROOTSIPFOLDER/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include
CXXFLAGS = -shared --sysroot=/root/ROOTSIPFOLDER/android-ndk-r16b/platforms/android-27/arch-arm -fexceptions -frtti
LDFLAGS = --sysroot=/root/ROOTSIPFOLDER/android-ndk-r16b/platforms/android-27/arch-arm -L/root/ROOTSIPFOLDER/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/
LIBS = -lgnustl_static -lc -lgcc
AR = /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ar
RANLIB = /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ranlib
TARGET_HOST = arm-linux-androideabi
TARGET_ABI = armeabi
checking build system type... x86_64-unknown-linux-gnu
checking host system type... arm-unknown-linux-androideabi
checking target system type... arm-unknown-linux-androideabi
checking for arm-linux-androideabi-gcc... /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc accepts -g... yes
checking for /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc option to accept ISO C89... unsupported
checking whether we are using the GNU C++ compiler... yes
checking whether /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ accepts -g... yes
checking for arm-linux-androideabi-ranlib... /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ranlib
checking for arm-linux-androideabi-ar... /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ar
checking for pthread_create in -lpthread... no
checking for puts in -lwsock32... no
checking for puts in -lws2_32... no
checking for puts in -lole32... no
checking for puts in -lwinmm... no
checking for puts in -lsocket... no
checking for puts in -lrt... no
checking for sin in -lm... yes
checking for uuid_generate in -luuid... no
checking for uuid_generate in -luuid... (cached) no
checking for library containing gethostbyname... none required
Setting PJ_M_NAME to arm
checking memory alignment... 4 bytes (default)
checking how to run the C preprocessor... /lib/cpp
aconfigure: error: in `/root/ROOTSIPFOLDER/pjproject-2.7.1':
aconfigure: error: C preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details
Below is my configue.log result.
aconfigure:2916: /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -v >&5
Using built-in specs.
COLLECT_GCC=/root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc
COLLECT_LTO_WRAPPER=/root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../libexec/gcc/arm-linux-androideabi/4.9.x/lto-wrapper
Target: arm-linux-androideabi
.......................................
aconfigure:3269: /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -c -g --sysroot=/root/ROOTSIPFOLDER/android-ndk-r16b/platforms/android-27/arch-arm -fexceptions -frtti conftest.c >&5
cc1: warning: command line option '-frtti' is valid for C++/ObjC++ but not for C
aconfigure:3269: $? = 0
aconfigure:3279: result: yes
aconfigure:3296: checking for /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc option to accept ISO C89
aconfigure:3359: /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -c --sysroot=/root/ROOTSIPFOLDER/android-ndk-r16b/platforms/android-27/arch-arm -I/root/ROOTSIPFOLDER/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/include -I/root/ROOTSIPFOLDER/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include --sysroot=/root/ROOTSIPFOLDER/android-ndk-r16b/platforms/android-27/arch-arm -fexceptions -frtti conftest.c >&5
cc1: warning: command line option '-frtti' is valid for C++/ObjC++ but not for C
conftest.c:10:19: fatal error: stdio.h: No such file or directory
#include <stdio.h>
^
compilation terminated.
aconfigure:3359: $? = 1
aconfigure: failed program was:
/* confdefs.h */
#define PACKAGE_NAME "pjproject"
#define PACKAGE_TARNAME "pjproject"
#define PACKAGE_VERSION "2.x"
#define PACKAGE_STRING "pjproject 2.x"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
/* end confdefs.h. */
#include <stdarg.h>
#include <stdio.h>
struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
static char *e (p, i)
char **p;
int i;
{
return p[i];
}
static char *f (char * (*g) (char **, int), char **p, ...)
{
char *s;
va_list v;
va_start (v,p);
s = g (p, va_arg (v,int));
va_end (v);
return s;
}
arm-linux-androideabi-gcc: error: unrecognized command line option '-std'
aconfigure:3359: $? = 1
aconfigure: failed program was:
/* confdefs.h */
#define PACKAGE_NAME "pjproject"
#define PACKAGE_TARNAME "pjproject"
#define PACKAGE_VERSION "2.x"
#define PACKAGE_STRING "pjproject 2.x"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
/* end confdefs.h. */
#include <stdarg.h>
#include <stdio.h>
struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
static char *e (p, i)
char **p;
int i;
{
return p[i];
}Satic char *f (char * (*g) (char **, int), char **p, ...)
{
char *s;
va_list v;
va_start (v,p);
s = g (p, va_arg (v,int));
va_end (v);
return s;
}
* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
function prototypes and stuff, but not '\xHH' hex character constants.
These don't provoke an error unfortunately, instead are silently treated
as 'x'. The following induces an error, until -std is added to get
proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
array size at least. It's necessary to write '\x00'==0 to get something
that's true only with -std. */
int osf4_cc_array ['\x00' == 0 ? 1 : -1];
/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
inside strings and character constants. */
#define FOO(x) 'x'
int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;
int
main ()
{
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
;
return 0;
}
aconfigure:3359: /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -Ae -c --sysroot=/root/ROOTSIPFOLDER/android-ndk-r16b/platforms/android-27/arch-arm -I/root/ROOTSIPFOLDER/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/include -I/root/ROOTSIPFOLDER/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include --sysroot=/root/ROOTSIPFOLDER/android-ndk-r16b/platforms/android-27/arch-arm -fexceptions -frtti conftest.c >&5
cc1: warning: command line option '-frtti' is valid for C++/ObjC++ but not for C
<command-line>:0:1: error: missing '(' after predicate
conftest.c:10:19: fatal error: stdio.h: No such file or directory
#include <stdio.h>
^
compilation terminated.
aconfigure:3359: $? = 1
aconfigure: failed program was:
/* confdefs.h */
#define PACKAGE_NAME "pjproject"
#define PACKAGE_TARNAME "pjproject"
#define PACKAGE_VERSION "2.x"
#define PACKAGE_STRING "pjproject 2.x"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
/* end confdefs.h. */
#include <stdarg.h>
#include <stdio.h>
struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
static char *e (p, i)
char **p;
int i;
{
return p[i];
}
| static char *f (char * (*g) (char **, int), char **p, ...)
{
char *s;
va_list v;
va_start (v,p);
s = g (p, va_arg (v,int));
va_end (v);
return s;
}
/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
function prototypes and stuff, but not '\xHH' hex character constants.
These don't provoke an error unfortunately, instead are silently treated
as 'x'. The following induces an error, until -std is added to get
proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
array size at least. It's necessary to write '\x00'==0 to get something
that's true only with -std. */
int osf4_cc_array ['\x00' == 0 ? 1 : -1];
/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
inside strings and character constants. */
#define FOO(x) 'x'
int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;
int
main ()
{
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
;
return 0;
}
aconfigure:3359: /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -Aa -D_HPUX_SOURCE -c --sysroot=/root/ROOTSIPFOLDER/android-ndk-r16b/platforms/android-27/arch-arm -I/root/ROOTSIPFOLDER/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/include -I/root/ROOTSIPFOLDER/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include --sysroot=/root/ROOTSIPFOLDER/android-ndk-r16b/platforms/android-27/arch-arm -fexceptions -frtti conftest.c >&5
cc1: warning: command line option '-frtti' is valid for C++/ObjC++ but not for C
<command-line>:0:1: error: missing '(' after predicate
conftest.c:10:19: fatal error: stdio.h: No such file or directory
#include <stdio.h>
^
compilation terminated.
aconfigure:3359: $? = 1
aconfigure: failed program was:
/* confdefs.h */
#define PACKAGE_NAME "pjproject"
#define PACKAGE_TARNAME "pjproject"
#define PACKAGE_VERSION "2.x"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
/* end confdefs.h. */
#include <stdarg.h>
#include <stdio.h>
struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
static char *e (p, i)
char **p;
int i;
{
return p[i];
}
static char *f (char * (*g) (char **, int), char **p, ...)
{
char *s;
va_list v;
va_start (v,p);
s = g (p, va_arg (v,int));
va_end (v);
return s;
}
| Syntax error
aconfigure:4534: /lib/cpp --sysroot=/root/ROOTSIPFOLDER/android-ndk-r16b/platforms/android-27/arch-arm -fexceptions -frtti conftest.c
cc1: warning: command line option '-frtti' is valid for C++/ObjC++ but not for C [enabled by default]
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include/syslimits.h:7:0,
from /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include/limits.h:34,
from conftest.c:13:
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include/limits.h:168:61: error: no include path in which to search for limits.h
#include_next <limits.h> /* recurse down to the real one */
^
aconfigure:4534: $? = 1
aconfigure: failed program was:
/* confdefs.h */
#define PACKAGE_NAME "pjproject"
#define PACKAGE_TARNAME "pjproject"
#define PACKAGE_VERSION "2.x"
#define PACKAGE_STRING "pjproject 2.x"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define HAVE_LIBM 1
#define PJ_M_NAME "arm"
#define PJ_POOL_ALIGNMENT 4
/* end confdefs.h. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
Syntax error
aconfigure:4564: error: in `/root/ROOTSIPFOLDER/pjproject-2.7.1':
aconfigure:4566: error: C preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details
Above error are not addressed any where and I have tried every thing they
have suggested.
I have followed every step very carefully and now dont know where I am doing wrong. I have tried the same on centos 6.9 but with no success. Initially I tried same on windows with sygwin what there also I was not able to run in.
I wonder I there is some issue with my machine or I am doing some thing wrong
Sorry I am not able to format the log. Hope I can get some help over here.
Looks like the project's build script is a few revisions out of date: https://github.com/pjsip/pjproject/blob/master/configure-android#L180. The headers moved to a merged tree (rather than per-API and per-arch) in r14 and the deprecated headers were removed in r16.
You might want to try using a standalone toolchain to build. You might want to try using one of these with the non-android configure script first (standalone toolchains are designed to be dropped into arbitrary autoconf systems that don't support Android themselves), but if that doesn't work then try it with configure-android.
I'm currently trying to use OP-TEE along side Android which is an open-source trust execution environment, In order for me to use OP-TEE's apis, I have to use the JNI interface.
My current c program in Android Studio is a hello_world example that was written in c for OP-TEE, I'm simply just trying to build a shared library from the hello_world.c example:
c file:
#include<jni.h>
#include<string.h>
#include <err.h>
#include "tee_client_api.h"
#include "ta_hello_world.h"
#include <stdio.h>
jstring Java_com_example_jsherman_ndktest_MainActivity_helloWorld(JNIEnv* env,jobject obj){
TEEC_Result res;
TEEC_Context ctx;
TEEC_Session sess;
TEEC_Operation op;
TEEC_UUID uuid = TA_HELLO_WORLD_UUID;
uint32_t err_origin;
/* Initialize a context connecting us to the TEE */
res = TEEC_InitializeContext(NULL, &ctx);
if (res != TEEC_SUCCESS)
errx(1, "TEEC_InitializeContext failed with code 0x%x", res);
/*
* Open a session to the "hello world" TA, the TA will print "hello
* world!" in the log when the session is created.
*/
res = TEEC_OpenSession(&ctx, &sess, &uuid,
TEEC_LOGIN_PUBLIC, NULL, NULL, &err_origin);
if (res != TEEC_SUCCESS)
errx(1, "TEEC_Opensession failed with code 0x%x origin 0x%x",
res, err_origin);
/*
* Execute a function in the TA by invoking it, in this case
* we're incrementing a number.
*
* The value of command ID part and how the parameters are
* interpreted is part of the interface provided by the TA.
*/
/*
* Prepare the argument. Pass a value in the first parameter,
* the remaining three parameters are unused.
*/
memset(&op, 0, sizeof(op));
op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INOUT, TEEC_NONE,
TEEC_NONE, TEEC_NONE);
op.params[0].value.a = 42;
printf("Invoking TA to increment %d\n", op.params[0].value.a);
res = TEEC_InvokeCommand(&sess, TA_HELLO_WORLD_CMD_INC_VALUE, &op,
&err_origin);
if (res != TEEC_SUCCESS)
errx(1, "TEEC_InvokeCommand failed with code 0x%x origin 0x%x",
res, err_origin);
printf("TA incremented value to %d\n", op.params[0].value.a);
/*
* We're done with the TA, close the session and
* destroy the context.
*
* The TA will print "Goodbye!" in the log when the
* session is closed.
*/
TEEC_CloseSession(&sess);
TEEC_FinalizeContext(&ctx);
return (*env)->NewStringUTF(env,"Hello world");
}
Android.mk file:
################################################################################
# Android optee-hello-world makefile #
################################################################################
LOCAL_PATH := $(call my-dir)
CFG_TEEC_PUBLIC_INCLUDE = /home/jsherman/devel/optee/optee_client/public
################################################################################
# Build hello world #
################################################################################
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := /home/jsherman/devel/optee/optee_hello_world/ta/include \
$(CFG_TEEC_PUBLIC_INCLUDE) \
$(info $(LOCAL_C_INCLUDES))
LOCAL_SHARED_LIBRARIES := libteec
LOCAL_MODULE := ndktest
LOCAL_SRC_FILES := ndktest.c
include $(BUILD_SHARED_LIBRARY)
for some reason, I'm getting the error:
/home/jsherman/AndroidStudioProjects/NDKTest/jni/ndktest.c:18: undefined reference to `TEEC_InitializeContext'
/home/jsherman/AndroidStudioProjects/NDKTest/jni/ndktest.c:26: undefined reference to `TEEC_OpenSession'
/home/jsherman/AndroidStudioProjects/NDKTest/jni/ndktest.c:50: undefined reference to `TEEC_InvokeCommand'
/home/jsherman/AndroidStudioProjects/NDKTest/jni/ndktest.c:65: undefined reference to `TEEC_CloseSession'
/home/jsherman/AndroidStudioProjects/NDKTest/jni/ndktest.c:67: undefined reference to `TEEC_FinalizeContext'
I'm sort of confused on why I'm getting this error, because I reference the correct directory in my LOCAL_C_INCLUDES variable where tee_client_api.h is located which has these data structures defined.
OP-TEE is a non-platform library, so you must tell about binaries location with PREBUILT_SHARED_LIBRARY block:
include $(CLEAR_VARS)
LOCAL_MODULE := libteec
LOCAL_SRC_FILES := <path_to_libteec_so>
include $(PREBUILT_SHARED_LIBRARY)
I'm working on board bring-up of a custom iMX6 based board. I'm using the Android package from iMX6 Sabre SD board, and have got most of the things working with booting from eMMC which on on-board, but I'm facing issue with 'saveenv' of u-boot.
Firstly, everytime on boot there is a print :
*** Warning - bad CRC or MMC, using default environment
I search online and found that we have to do 'saveenv' once to let this error go away. So I did saveenv but after that the board doesn't boot completely and got stuck on 'Uncompressing Linux ...' !
I then boot-up the board using SD card and got the hexdump of /dev/block/mmcblk0boot0 and /dev/block/mmcblk0p1 (both are eMMC partitions, SD card is dev/block/mmcblk1)
To my surprise, from hexdump I found that 'saveenv' writes the environment variable data to /dev/block/mmcblk0p1 and not /dev/block/mmcblk0boot0 which was the reason the board didn't boot-up as boot.img is in dev/block/mmcblk0p1 partition was corrupted by u-boot doing saveenv and over-writing the boot.img data.
So, my question is how can I change the u-boot code to modify it to read and save environment variables on /dev/block/mmcblk0boot0 instead of /dev/block/mmcblk0p1
I'm trying to dig into the code and so far I have found that common/env_mmc.c is the file which has all functions to read/write environment variables, and include/configs/mx6solo_sabresd.h includes the configuration of my board.
P.S. : The u-boot itself is located in /dev/block/mmcblk0boot0
Edit : Below the information regarding partitions :
root#imx6:/ # cat /proc/partitions
major minor #blocks name
31 0 64 mtdblock0
179 0 3833856 mmcblk0
179 1 15640 mmcblk0p1
179 2 7840 mmcblk0p2
179 3 1 mmcblk0p3
179 5 500024 mmcblk0p5
179 6 500024 mmcblk0p6
179 7 78136 mmcblk0p7
259 0 500024 mmcblk0p8
259 1 19544 mmcblk0p9
259 2 2212568 mmcblk0p10
179 16 1024 mmcblk0boot1
179 8 1024 mmcblk0boot0
179 24 3887104 mmcblk1
179 25 7168 mmcblk1p1
179 26 484352 mmcblk1p2
179 27 1 mmcblk1p3
179 29 289792 mmcblk1p5
179 30 550912 mmcblk1p6
179 31 570368 mmcblk1p7
259 3 799744 mmcblk1p8
root#imx6:/ #
root#imx6:/ # cat /proc/mtd
dev: size erasesize name
mtd0: 00010000 00008000 "bootloader"
mtd1: 00000000 00000000 "kernel"
root#imx6:/ #
root#imx6:/ # fdisk -l /dev/block/mmcblk0
Disk /dev/block/mmcblk0: 3925 MB, 3925868544 bytes
4 heads, 16 sectors/track, 119808 cylinders
Units = cylinders of 64 * 512 = 32768 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 1 489 15640 83 Linux
/dev/block/mmcblk0p2 490 734 7840 83 Linux
/dev/block/mmcblk0p3 735 119808 3810368 5 Extended
/dev/block/mmcblk0p5 735 16360 500024 83 Linux
/dev/block/mmcblk0p6 16361 31986 500024 83 Linux
/dev/block/mmcblk0p7 31987 34428 78136 83 Linux
/dev/block/mmcblk0p8 34429 50054 500024 83 Linux
/dev/block/mmcblk0p9 50055 50665 19544 83 Linux
/dev/block/mmcblk0p10 50666 119808 2212568 83 Linux
root#imx6:/ #
root#imx6:/ # fdisk -l /dev/block/mmcblk0boot0
Disk /dev/block/mmcblk0boot0: 1 MB, 1048576 bytes
4 heads, 16 sectors/track, 32 cylinders
Units = cylinders of 64 * 512 = 32768 bytes
Disk /dev/block/mmcblk0boot0 doesn't contain a valid partition table
root#imx6:/ # fdisk -l /dev/block/mmcblk0boot1
Disk /dev/block/mmcblk0boot1: 1 MB, 1048576 bytes
4 heads, 16 sectors/track, 32 cylinders
Units = cylinders of 64 * 512 = 32768 bytes
Disk /dev/block/mmcblk0boot1 doesn't contain a valid partition table
root#imx6:/ #
U-Boot config file :
/*
* Copyright (C) 2012 Freescale Semiconductor, Inc.
*
* Configuration settings for the MX6DL SabreSD Freescale board.
* The board is configured with SOLO and 32-bit DDR bus-width.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#ifndef __CONFIG_H
#define __CONFIG_H
#include <asm/arch/mx6.h>
/* High Level Configuration Options */
#define CONFIG_ARMV7 /* This is armv7 Cortex-A9 CPU core */
#define CONFIG_MXC
#define CONFIG_MX6DL
#define CONFIG_MX6DL_DDR3
#define CONFIG_MX6DL_SABRESD
#define CONFIG_DDR_32BIT /* for DDR 32bit */
#define CONFIG_FLASH_HEADER
#define CONFIG_FLASH_HEADER_OFFSET 0x400
#define CONFIG_MX6_CLK32 32768
#define CONFIG_SKIP_RELOCATE_UBOOT
#define CONFIG_ARCH_CPU_INIT
#undef CONFIG_ARCH_MMU /* disable MMU first */
#define CONFIG_L2_OFF /* disable L2 cache first*/
#define CONFIG_MX6_HCLK_FREQ 24000000
#define CONFIG_DISPLAY_CPUINFO
#define CONFIG_DISPLAY_BOARDINFO
#define CONFIG_SYS_64BIT_VSPRINTF
#define BOARD_LATE_INIT
#define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */
#define CONFIG_SERIAL_TAG
#define CONFIG_REVISION_TAG
#define CONFIG_SETUP_MEMORY_TAGS
#define CONFIG_INITRD_TAG
#define CONFIG_MXC_GPIO
/*
* Size of malloc() pool
*/
#define CONFIG_SYS_MALLOC_LEN (2 * 1024 * 1024)
/* size in bytes reserved for initial data */
#define CONFIG_SYS_GBL_DATA_SIZE 128
/*
* Hardware drivers
*/
#define CONFIG_MXC_UART
#define CONFIG_UART_BASE_ADDR UART1_BASE_ADDR
/* allow to overwrite serial and ethaddr */
#define CONFIG_ENV_OVERWRITE
#define CONFIG_CONS_INDEX 1
#define CONFIG_BAUDRATE 115200
#define CONFIG_SYS_BAUDRATE_TABLE {9600, 19200, 38400, 57600, 115200}
/***********************************************************
* Command definition
***********************************************************/
#include <config_cmd_default.h>
#define CONFIG_CMD_PING
#define CONFIG_CMD_DHCP
#define CONFIG_CMD_MII
#define CONFIG_CMD_NET
#define CONFIG_NET_RETRY_COUNT 100
#define CONFIG_NET_MULTI 1
#define CONFIG_BOOTP_SUBNETMASK
#define CONFIG_BOOTP_GATEWAY
#define CONFIG_BOOTP_DNS
#define CONFIG_CMD_SPI
#define CONFIG_CMD_I2C
#define CONFIG_CMD_IMXOTP
/* Enable below configure when supporting nand */
#define CONFIG_CMD_SF
#define CONFIG_CMD_MMC
#define CONFIG_CMD_ENV
#define CONFIG_CMD_REGUL
#define CONFIG_CMD_CLOCK
#define CONFIG_REF_CLK_FREQ CONFIG_MX6_HCLK_FREQ
#undef CONFIG_CMD_IMLS
#define CONFIG_CMD_IMX_DOWNLOAD_MODE
#define CONFIG_BOOTDELAY 3
#define CONFIG_PRIME "FEC0"
#define CONFIG_LOADADDR 0x10800000 /* loadaddr env var */
#define CONFIG_RD_LOADADDR (CONFIG_LOADADDR + 0x300000)
#define CONFIG_EXTRA_ENV_SETTINGS \
"netdev=eth0\0" \
"ethprime=FEC0\0" \
"uboot=u-boot.bin\0" \
"kernel=uImage\0" \
"nfsroot=/opt/eldk/arm\0" \
"bootargs_base=setenv bootargs console=ttymxc0,115200 nosmp\0" \
"bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs " \
"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
"bootcmd_net=run bootargs_base bootargs_nfs; " \
"tftpboot ${loadaddr} ${kernel}; bootm\0" \
"bootargs_mmc=setenv bootargs ${bootargs} ip=dhcp " \
"root=/dev/mmcblk0p1 rootwait\0" \
"bootcmd_mmc=run bootargs_base bootargs_mmc; " \
"mmc dev 3; " \
"mmc read ${loadaddr} 0x800 0x2000; bootm\0" \
"bootcmd=run bootcmd_net\0" \
#define CONFIG_ARP_TIMEOUT 200UL
/*
* Miscellaneous configurable options
*/
#define CONFIG_SYS_LONGHELP /* undef to save memory */
#define CONFIG_SYS_PROMPT "MX6Solo SABRESD U-Boot > "
#define CONFIG_AUTO_COMPLETE
#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
/* Print Buffer Size */
#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
#define CONFIG_SYS_MAXARGS 16 /* max number of command args */
#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot Argument Buffer Size */
#define CONFIG_SYS_MEMTEST_START 0x10000000 /* memtest works on */
#define CONFIG_SYS_MEMTEST_END 0x10010000
#undef CONFIG_SYS_CLKS_IN_HZ /* everything, incl board info, in Hz */
#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
#define CONFIG_SYS_HZ 1000
#define CONFIG_CMDLINE_EDITING
#define CONFIG_FEC0_IOBASE ENET_BASE_ADDR
#define CONFIG_FEC0_PINMUX -1
#define CONFIG_FEC0_MIIBASE -1
#define CONFIG_GET_FEC_MAC_ADDR_FROM_IIM
#define CONFIG_MXC_FEC
#define CONFIG_FEC0_PHY_ADDR 1
#define CONFIG_ETH_PRIME
#define CONFIG_RMII
#define CONFIG_CMD_MII
#define CONFIG_CMD_DHCP
#define CONFIG_CMD_PING
#define CONFIG_IPADDR 192.168.1.103
#define CONFIG_SERVERIP 192.168.1.101
#define CONFIG_NETMASK 255.255.255.0
/*
* OCOTP Configs
*/
#ifdef CONFIG_CMD_IMXOTP
#define CONFIG_IMX_OTP
#define IMX_OTP_BASE OCOTP_BASE_ADDR
#define IMX_OTP_ADDR_MAX 0x7F
#define IMX_OTP_DATA_ERROR_VAL 0xBADABADA
#endif
/*
* I2C Configs
*/
#ifdef CONFIG_CMD_I2C
#define CONFIG_HARD_I2C
#define CONFIG_I2C_MXC 1
#define CONFIG_SYS_I2C_PORT I2C2_BASE_ADDR
#define CONFIG_SYS_I2C_SPEED 100000
#define CONFIG_SYS_I2C_SLAVE 0x8
#define CONFIG_MX6_INTER_LDO_BYPASS 0
#endif
/*
* SPI Configs
*/
#ifdef CONFIG_CMD_SF
#define CONFIG_FSL_SF
#define CONFIG_SPI_FLASH_IMX_M25PXX
#define CONFIG_SPI_FLASH_CS 0
#define CONFIG_IMX_ECSPI
#define IMX_CSPI_VER_2_3 1
#define MAX_SPI_BYTES (64 * 4)
#endif
/* Regulator Configs */
#ifdef CONFIG_CMD_REGUL
#define CONFIG_ANATOP_REGULATOR
#define CONFIG_CORE_REGULATOR_NAME "vdd1p1"
#define CONFIG_PERIPH_REGULATOR_NAME "vdd1p1"
#endif
/*
* MMC Configs
*/
#ifdef CONFIG_CMD_MMC
#define CONFIG_MMC
#define CONFIG_GENERIC_MMC
#define CONFIG_IMX_MMC
#define CONFIG_SYS_FSL_USDHC_NUM 4
#define CONFIG_SYS_FSL_ESDHC_ADDR 0
#define CONFIG_SYS_MMC_ENV_DEV 2
#define CONFIG_DOS_PARTITION
#define CONFIG_CMD_FAT
#define CONFIG_CMD_EXT2
/* detect whether SD1, 2, 3, or 4 is boot device */
#define CONFIG_DYNAMIC_MMC_DEVNO
/* SD3(Mircro SD) 4 bit, SD4(EMMC) are 8 bit */
#define CONFIG_MMC_8BIT_PORTS 0x8
/* Setup target delay in DDR mode for each SD port */
#define CONFIG_GET_DDR_TARGET_DELAY
#endif
/*
* GPMI Nand Configs
*/
/* #define CONFIG_CMD_NAND */
#ifdef CONFIG_CMD_NAND
#define CONFIG_NAND_GPMI
#define CONFIG_GPMI_NFC_SWAP_BLOCK_MARK
#define CONFIG_GPMI_NFC_V2
#define CONFIG_GPMI_REG_BASE GPMI_BASE_ADDR
#define CONFIG_BCH_REG_BASE BCH_BASE_ADDR
#define NAND_MAX_CHIPS 8
#define CONFIG_SYS_NAND_BASE 0x40000000
#define CONFIG_SYS_MAX_NAND_DEVICE 1
/* NAND is the unique module invoke APBH-DMA */
#define CONFIG_APBH_DMA
#define CONFIG_APBH_DMA_V2
#define CONFIG_MXS_DMA_REG_BASE ABPHDMA_BASE_ADDR
#endif
/*-----------------------------------------------------------------------
* Stack sizes
*
* The stack sizes are set up in start.S using the settings below
*/
#define CONFIG_STACKSIZE (128 * 1024) /* regular stack */
/*-----------------------------------------------------------------------
* Physical Memory Map
*/
#define CONFIG_NR_DRAM_BANKS 1
#define PHYS_SDRAM_1 CSD0_DDR_BASE_ADDR
#define PHYS_SDRAM_1_SIZE (1u * 1024 * 1024 * 1024)
#define iomem_valid_addr(addr, size) \
(addr >= PHYS_SDRAM_1 && addr <= (PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE))
/*-----------------------------------------------------------------------
* FLASH and environment organization
*/
#define CONFIG_SYS_NO_FLASH
/* Monitor at beginning of flash */
#define CONFIG_FSL_ENV_IN_MMC
/* #define CONFIG_FSL_ENV_IN_NAND */
#define CONFIG_ENV_SECT_SIZE (8 * 1024)
#define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE
#if defined(CONFIG_FSL_ENV_IN_NAND)
#define CONFIG_ENV_IS_IN_NAND 1
#define CONFIG_ENV_OFFSET 0x100000
#elif defined(CONFIG_FSL_ENV_IN_MMC)
#define CONFIG_ENV_IS_IN_MMC 1
#define CONFIG_ENV_OFFSET (768 * 1024)
#elif defined(CONFIG_FSL_ENV_IN_SF)
#define CONFIG_ENV_IS_IN_SPI_FLASH 1
#define CONFIG_ENV_SPI_CS 1
#define CONFIG_ENV_OFFSET (768 * 1024)
#else
#define CONFIG_ENV_IS_NOWHERE 1
#endif
/* #define CONFIG_SPLASH_SCREEN */
/* #define CONFIG_MXC_EPDC */
/*
* SPLASH SCREEN Configs
*/
//#define CONFIG_SPLASH_SCREEN
#ifdef CONFIG_SPLASH_SCREEN
/*
* Framebuffer and LCD
*/
#define CONFIG_LCD
#define CONFIG_FB_BASE (TEXT_BASE + 0x300000)
#define CONFIG_SYS_CONSOLE_IS_IN_ENV
#ifdef CONFIG_MXC_EPDC
#undef LCD_TEST_PATTERN
/* #define CONFIG_SPLASH_IS_IN_MMC 1 */
#define LCD_BPP LCD_MONOCHROME
/* #define CONFIG_SPLASH_SCREEN_ALIGN 1 */
#define CONFIG_MXC_EPDC 1
#define CONFIG_WORKING_BUF_ADDR (TEXT_BASE + 0x100000)
#define CONFIG_WAVEFORM_BUF_ADDR (TEXT_BASE + 0x200000)
#define CONFIG_WAVEFORM_FILE_OFFSET 0x600000
#define CONFIG_WAVEFORM_FILE_SIZE 0xF0A00
#define CONFIG_WAVEFORM_FILE_IN_MMC
#ifdef CONFIG_SPLASH_IS_IN_MMC
#define CONFIG_SPLASH_IMG_OFFSET 0x4c000
#define CONFIG_SPLASH_IMG_SIZE 0x19000
#endif
#else /* !CONFIG_MXC_EPDC */
#define CONFIG_IPU_V3H
#define CONFIG_VIDEO_MX5
#define CONFIG_IPU_CLKRATE 260000000
#define CONFIG_SYS_CONSOLE_ENV_OVERWRITE
#define CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
#define LCD_BPP LCD_COLOR16
#define CONFIG_CMD_BMP
#define CONFIG_BMP_8BPP
#define CONFIG_SPLASH_SCREEN_ALIGN
#define CONFIG_SYS_WHITE_ON_BLACK
#define CONFIG_IMX_PWM
#define IMX_PWM1_BASE PWM1_BASE_ADDR
#define IMX_PWM2_BASE PWM2_BASE_ADDR
#endif
#endif /* CONFIG_SPLASH_SCREEN */
#endif /* __CONFIG_H */
I am trying to port this logging statement to work, so it will run on linux and android my #define'ing it:
__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
I have cross-compiled my app to run on both Linux and Android. However, as linux doesn't have the equivalent I have tried to do my own.
/** ANDROID */
#if defined(__ANDROID__)
#include <android/log.h>
#define LOG_ERROR ANDROID_LOG_ERROR
#define LOG(PRIORITY, fmt, ...) __android_log_print(ANDROID_LOG_UNKNOWN, LOG_TAG, fmt, ##__VA_ARGS__)
/** LINUX */
#elif defined(linux) || defined(__linux) || defined(__linux__)
#define LOG_ERROR LINUX_LOG_ERROR
#define LOG(PRIORITY, fmt, ...) printf(PRIORITY fmt, ##__VA_ARGS__)
#endif
And then using it like this when running under linux
LOG(LOG_ERROR, "Testing loggging [ %d ]", test);
Is there a better way to do this?
Many thanks for any suggestions,
I managed to solve it this way. Here is the complete solution.
This would be in a header file
typedef enum levels_tag levels_e;
enum levels_tag {
LOG_UNKNOWN = 0,
LOG_DEFAULT,
LOG_VERBOSE,
LOG_DEBUG,
LOG_INFO,
LOG_WARN,
LOG_ERROR,
LOG_FATAL,
LOG_SILENT,
LOG_LAST
};
/* ANDRIOD IMPLEMENTATION */
#if defined( __ARM_EABI__)
#include <android/log.h>
levels_e levels[LOG_LAST] = {LOG_UNKNOWN,
LOG_DEFAULT,
LOG_VERBOSE,
LOG_DEBUG,
LOG_INFO,
LOG_WARN,
LOG_ERROR,
LOG_FATAL,
LOG_SILENT};
#define LOG_TAG "MODULE_LOG_SIP"
#define LOGGING(PRIORITY, fmt, ...) __android_log_print(levels[PRIORITY], LOG_TAG, fmt, ##__VA_ARGS__)
/* LINUX IMPLEMENTATION */
#elif defined(linux) || defined(__linux) || defined(__linux__)
char *priority_levels[] = {"UNKNOWN",
"DEFAULT",
"VERBOSE",
"DEBUG",
"INFO",
"WARN",
"ERROR",
"FATAL",
"SILENT",
NULL };
#define LOGGING(PRIORITY, fmt, ...) \
do { \
char *priority = priority_levels[PRIORITY]; \
printf("%s/%s:%d [%s] " fmt " \n", __FILE__, __func__, __LINE__, priority, ##__VA_ARGS__); \
} while(0)
#endif
#define LOG(PRIORITY, fmt, ...) LOGGING(PRIORITY, fmt, ##__VA_ARGS__)
And in your source files you would just call the LOG macro like this:
LOG(LOG_FATAL, "Failed to create and initialize application instance [ %d ]", errno);
Now if you were to compile on linux it would use the printf statement. And if you were to compile on Android it would use the __android_log_print statement. Both would produce the same formatted output.
Hope this helps someone else.
You can also use family of syslog() functions to make output to system log instead of stdout/stderr (see syslog.h):
void openlog(const char *ident, int option, int facility);
void syslog(int priority, const char *format, ...);
void closelog(void);
Logs can be viewed in /var/log (file depends on options of syslog, by default in many systems logs are in the file "messages"). Sometimes this way is a better than stdout/stderr, but you have to use openlog/closelog. Unfortunately, syslog's priorities are different comparing to android priorities and thus it doesn't allow simple macro definition with transparent priorities.Syslog priorities:
#define LOG_EMERG 0 /* system is unusable */
#define LOG_ALERT 1 /* action must be taken immediately */
#define LOG_CRIT 2 /* critical conditions */
#define LOG_ERR 3 /* error conditions */
#define LOG_WARNING 4 /* warning conditions */
#define LOG_NOTICE 5 /* normal but significant condition */
#define LOG_INFO 6 /* informational */
#define LOG_DEBUG 7 /* debug-level messages */
Priorities of android log:
/*
* Android log priority values, in ascending priority order.
*/
typedef enum android_LogPriority {
ANDROID_LOG_UNKNOWN = 0,
ANDROID_LOG_DEFAULT, /* only for SetMinPriority() */
ANDROID_LOG_VERBOSE,
ANDROID_LOG_DEBUG,
ANDROID_LOG_INFO,
ANDROID_LOG_WARN,
ANDROID_LOG_ERROR,
ANDROID_LOG_FATAL,
ANDROID_LOG_SILENT, /* only for SetMinPriority(); must be last */
} android_LogPriority;