Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,14 @@ signer = sign_m2crypto.M2CryptoSigner(
device = adb_commands.AdbCommands.ConnectDevice(
rsa_keys=[signer])
# Now we can use Shell, Pull, Push, etc!
for i in xrange(10):
print device.Shell('echo %d' % i)
for i in range(10):
print(device.Shell('echo %d' % i))

# Want to check the kernel version? Do this.
print(device.Shell('uname -a'))

# Want to check some properties? Do this.
print(device.Shell('getprop | grep dalvik'))
```

### Pros
Expand Down
4 changes: 4 additions & 0 deletions adb/adb_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@ def Connect(cls, usb, banner=b'notadb', rsa_keys=None, auth_timeout_ms=100):
InvalidResponseError: When the device does authentication in an
unexpected way.
"""
# In py3, convert unicode to bytes. In py2, convert str to bytes.
# It's later joined into a byte string, so in py2, this ends up kind of being a no-op.
if isinstance(banner, str):
banner = bytearray(banner, 'utf-8')
msg = cls(
command=b'CNXN', arg0=VERSION, arg1=MAX_ADB_DATA,
data=b'host::%s\0' % banner)
Expand Down