I'm trying to write some hex data into /dev/ttyS1 from android java app without any success.
Easiest way should be to runtime exec command but it doesn't work for me.
I tried:
Process process = Runtime.getRuntime().exec("echo -n -e \\xb5\\x62\\x06\\x17\\x14\\x00\\x00\\x40\\x00\\x02\\x00\\x00\\x00\\x00\\x00\\x01\\x00\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x75\\x4f > /dev/ttyS1");
and also:
Process process = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(process.getOutputStream());
os.writeBytes("echo -n -e \\xb5\\x62\\x06\\x17\\x14\\x00\\x00\\x40\\x00\\x02\\x00\\x00\\x00\\x00\\x00\\x01\\x00\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x75\\x4f > /dev/ttyS1\n");
os.flush();
os.writeBytes("exit\n");
os.flush();
Without any success. The same commands from adb shell works of course.
Is there any other option to send hex data into /dev/ttyS1 from android app? Or maybe someone know what I'm doing wrong in my way?
I tried also method marked as answer in question How to make pipes work with Runtime.exec()? also without any luck.