Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

can i call device.shell() and device.logcat() same time? #58

Open
juneJuly opened this issue Sep 14, 2017 · 3 comments
Open

can i call device.shell() and device.logcat() same time? #58

juneJuly opened this issue Sep 14, 2017 · 3 comments

Comments

@juneJuly
Copy link

juneJuly commented Sep 14, 2017

i found can not call shell() and logcat() same time, like this case:

'''
import os.path as op
from mainfuzzer.adb import adb_commands
from mainfuzzer.adb import sign_m2crypto
signer = sign_m2crypto.M2CryptoSigner(
op.expanduser('~/.android/adbkey'))
device = adb_commands.AdbCommands.ConnectDevice( rsa_keys=[signer])
class LogcatTask:
def __init__(self):
self._running = True
self.output = ''

def terminate(self):
    self._running = False

def run(self, options, timeout_ms):
    logcat = device.Logcat(' '.join(options), timeout_ms=timeout_ms)
    while self._running and timeout_ms > 0:
        self.output += logcat.next().strip()

from threading import Thread
c = LogcatTask()
t = Thread(target=c.run, args=([' ', ], 10000,))
t.start()
cmd = "ls -al /data/local/tmp"
print '=============>' + device.Shell(cmd)
import time
time.sleep(5)
c.terminate()
t.join()
print c.output
'''

i got this error:

usb_exceptions.ReadFailedError: Could not receive data from first SP9832A311063170368 (timeout 10000ms): LIBUSB_ERROR_TIMEOUT [-7]

@eismog
Copy link

eismog commented Sep 17, 2017

Hi,

#24
fahhem said:
Currently, one can only issue one command at a time. Issuing two or more will cause issues with the data being intermixed because the ADB client assumes a local-id of 1.

@eismog
Copy link

eismog commented Sep 17, 2017

@juneJuly
Copy link
Author

@eismog
well, thank you all the way.
i have implemented this years ago with 'subprocess.Popen(adbpath+cmd)'
u know, i think this way is not so stable or contrallable.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants