Search code examples
androidstreampipeadb

redirect a data stream from adb to a local utility - Android


I need to use the stream of data provided by a device under android in my utilities.

Under a standard Linux distribution I would do the following:

util -input /dev/random

with adb and Android i would like to use a /dev/random from the Android device as input for my local util. How i'm supposed to create this pipe ?

if i do

adb pull /dev/random random

adb just exits after dumping 1 complete copy but i need a constant pipe/stream.

Thanks.


Solution

  • You should use something like this

    $ adb shell dd if=/dev/random | util -input -
    

    providing that your util reads from stdin if - is specified.

    Also note that the command is using the non-blocking random source.