I'm trying to write/read data from my android tablet to an external device via serial communication. I read i should try to write/read data from a 'virtual serial port' represented by a file (for me its a file in the /dev/bus/usb folder).
I succeed in creating a File object for my file, and it does exist (via .exists()). However, .canWrite() and .canRead() return false, and trying to .setWriteable (For example) fails all the time.
I tried changing the folder's permissions like i've seen in other threads:
Process sh = Runtime.getRuntime().exec("su", null, new File("/system/bin/"));
OutputStream os = sh.getOutputStream();
os.write(("chmod 777 <filepath>").getBytes("ASCII"));
os.flush();
os.close();
sh.waitFor();
but i get an exception every time at the first line (.exec one).
going without "su" (since device is not rooted):
Runtime.getRuntime().exec("chmod 666 " + name);
i get no exception this time, but still getting false from setWriteable.
Am i doing something wrong? How should i try to access that file? How else is it possible to write/read data to external serial port from an android device?
thanks for your time!
edit: device is not rooted, and cant have it rooted. trying manually to go to adb shell and doing chmod resulted in "operation not permitted". is there any way to make this work without rooting?