Hello. Faced the problem of reading and writing through / dev / ttyS2. It seems, rummaged through the entire Internet, but found nothing. The module and the device on Android are connected via UART. Root rights on the device are there.
It is necessary to control the module using the application. Maybe there is a possibility with the help of Linux commands. I tried to implement it like this:
prompt = (TextView)findViewById(R.id.prompt); //String[] command = {"df", "-h", "/"}; //String[] command = {"su","root","chmod", "777", "/dev/ttyS2", "&&", "less", "<","/dev/ttyS2"}; //String[] command = {"su","root","chmod", "777", "/dev/ttyS2", "&&", "od", "-x", "<","/dev/ttyS2"}; //String[] command = {"su","root","chmod", "777", "/dev/kulck", "&&", "less","/dev/kulck"}; //String[] command = {"su","root","chmod", "777", "/dev/ttyS2", "&&","tail", "-f","/dev/ttyS2"}; //String[] command = {"stty", "-speed", "19200","<","/dev/ttyS2"}; //String[] command = {"less", "/dev/kulck"}; String[] command = {"tail", "-f","/dev/ttyS2"}; //String[] command = {"ls", "-s", "/dev"}; StringBuilder cmdReturn = new StringBuilder(); try { ProcessBuilder processBuilder = new ProcessBuilder(command); Process process = processBuilder.start(); InputStream inputStream = process.getInputStream(); int c; while ((c = inputStream.read()) != -1) { cmdReturn.append((char) c); prompt.setText(cmdReturn.toString()); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }