'How to give input to interactive shell on a linux device from windows prompt, communication is through adb b/w windows and device

Process for initiating program on device:

  1. open windows command prompt
  2. adb shell
  3. After entering device shell, run the c/c++ binary (ex: ./testAbc )
  4. this program prints outs the menu with options like(0,1,2) below and waits for use input. for example : 0 flash image A. 1 flash image B. 2 flash image C.

Problem statement: need to communicate user inputs to interactive program running on linux base device from windows command prompt

we tried below steps:

  1. we opened parallel windows cmd prompt
  2. adb shell
  3. inside linux device shell give "echo 0 > /proc/'pid of above binary'/fd/0"

we are able to see this 0 on the prompt but this program is not taking this input. also we are seeing some extra character is being printed on console which is not passed like [].

is this some kind of encoding problem? Any better way to communicate to this interactive program ? running on linux base device attached to windows PC.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source