Swind / pure-python-adb

This is pure-python implementation of the ADB client.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

device shell push audio file has % progress on stdout, how do I get it?

enjoysmath opened this issue · comments

When we push an audio file normally (using Cygwin terminal) there's a progress % that gets printed every 50 milliseconds on the shell's stdout. Was wondering how can I get that stdout as a string until it is finished?

      devices = self.adb_client.devices()
      if devices:
         device = devices[0]
         self.status_message('Pushing audio file......')
         device.push('audio/SRV.wav', '/sdcard/music/srv.wav')
         
         while True:
            with self.adb_client.create_connection() as conn:
               result = conn.receive()
               print(result)
commented

Hi enjoysmath,

The progress bar is printed by the adb application when the adb application opens a socket connection then sends the file data to the device.
This is not printed by the adb server or adb daemon ( device ).

If you want to print the progress, you need to implement yourself push function.

Reference code:
https://github.com/Swind/pure-python-adb/blob/master/ppadb/sync/__init__.py#L25

adb protocol spec:
https://android.googlesource.com/platform/system/core/+/master/adb/SYNC.TXT

Thanks