1. Download our Official Android App: Forums for Android!

Apps Concorde 7.1 tab USB host

Discussion in 'Android Development' started by debanti0919, Apr 22, 2011.

  1. debanti0919

    debanti0919 Lurker
    Thread Starter
    Apr 22, 2011

    Apr 22, 2011
    Hi Guys!

    We are working on a project where we have an Android 2.1 Concorde 7.1 tab with USB host capabilities and USB RFID readers which uses usbserial drivers and can be seen as /dev/ttyUSB0. We've rooted the tablet successfully with z4root and have and example serial driver port for Android from GNU RXTX for Android

    The problem is that in the JNI part of the app when a LOCK file creation is called we always got Permission denied which means that the apk doesn't have root (superuser) privileges.

    The examples on the forums say to use the Process p = Runtime.getRuntime.exec("su") thing to claim su privileges from Superuser.apk but in my interpretation, then you only have a su shell in p and the JNI part of my app is still without su rights.

    At the jni part this is the part where the app is trying to create a lock file in /data/local/tmp and gets Permission denied:

    int fhs_lock( const char *filename, int pid )
    * There is a zoo of lockdir possibilities
    * Its possible to check for stale processes with most of them.
    * for now we will just check for the lockfile on most
    * Problem lockfiles will be dealt with. Some may not even be in use.
    int fd,j;
    char lockinfo[12], message[80];
    char file[80], *p;

    j = strlen( filename );
    p = ( char * ) filename + j;
    /* FIXME need to handle subdirectories /dev/cua/...
    SCO Unix use lowercase all the time
    while( *( p - 1 ) != '/' && j-- != 1 )
    #if defined ( __unixware__ )
    *p = tolower( *p );
    #endif /* __unixware__ */
    sprintf( file, "%s/LCK..%s", LOCKDIR, p );
    if ( check_lock_status( filename ) )
    report( "fhs_lock() lockstatus fail\n" );
    return 1;
    fd = open( file, O_CREAT | O_WRONLY | O_EXCL, 0444 );
    if( fd < 0 )
    sprintf( message,
    "RXTX fhs_lock() Error: creating lock file: %s: %s\n",
    file, strerror(errno) );
    report_error( message );
    return 1;
    sprintf( lockinfo, "%10d\n",(int) getpid() );
    sprintf( message, "fhs_lock: creating lockfile: %s\n", lockinfo );
    report( message );
    write( fd, lockinfo, 11 );
    close( fd );
    return 0;

    So simply said we need a method to start the entire app as root t obe able to call the open() above to write /data locations and later read successfully from /dev/ttyUSB<X>

    Could anybody give us a hint? If you need we can share the entire app with you...

    Thanks in advance!
    Best Regards,


Share This Page