dimanche 30 mars 2014

Android: Unable to access serial ports (dev/tty) with JNI


Vote count:

0




So I have a problem accessing serial ports on Android (its a JNI function written in C):



int fd; /* File descriptor for the port */

fd = open("/dev/ttyGPS0", O_RDWR | O_NOCTTY | O_SYNC);

//opening serial port
if(fd == -1)
return (*env)->NewStringUTF(env, "OpenPortError");

// closing files
close(fd);

return (*env)->NewStringUTF(env, "Success");


It always returns "OpenPortError" and I have no idea why. I tried like adding all possible android permissions with no luck. Do I need to somehow execute this function as su to access /dev/*?



asked 57 secs ago






Aucun commentaire:

Enregistrer un commentaire