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

Old adb server version (31) is not supported using AdbDeviceTcp #183

Closed
Noam5 opened this issue Sep 13, 2021 · 1 comment
Closed

Old adb server version (31) is not supported using AdbDeviceTcp #183

Noam5 opened this issue Sep 13, 2021 · 1 comment

Comments

@Noam5
Copy link

Noam5 commented Sep 13, 2021

The following snippet crashes when trying to connect to the adb using tcp

from adb_shell.adb_device import AdbDeviceTcp
from adb_shell.auth.sign_pythonrsa import PythonRSASigner

adbkey = r'path/to/adbkey'

with open(adbkey) as f:
    priv = f.read()
with open(adbkey + '.pub') as f:
     pub = f.read()
signer = PythonRSASigner(pub, priv)

device1 = AdbDeviceTcp('127.0.0.1', 5553, default_transport_timeout_s=9.)
device1.connect(rsa_keys=[signer], auth_timeout_s=0.1)

And this is the traceback that I'm getting:

Traceback (most recent call last):
  File "c:\temp\adbtest.py", line 15, in <module>
    device1.connect(auth_timeout_s=0.1)
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\adb_shell\adb_device.py", line 219, in connect
    cmd, arg0, arg1, banner = self._read([constants.AUTH, constants.CNXN], adb_info)
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\adb_shell\adb_device.py", line 754, in _read
    cmd, arg0, arg1, data_length, data_checksum = unpack(msg)
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\adb_shell\adb_message.py", line 122, in unpack
    raise ValueError('Unable to unpack ADB command. (length={})'.format(len(message)), constants.MESSAGE_FORMAT, message, e)
ValueError: ('Unable to unpack ADB command. (length=0)', b'<6I', b'', error('unpack requires a buffer of 24 bytes'))

When connecting through my adb client, I'm given the following error message:

adb server version (31) doesn't match this client (41); killing...

When testing the connection to an updated server (My 10 android phone) it all worked fine (Tested using the mentioned snippet and also an adb.exe client)
Which makes me think that the problem is caused by an unsupported old version of the server.
Given I cannot update the server adb version, how can I make the code compatible with the old version server?

@Noam5 Noam5 closed this as completed Sep 14, 2021
@Noam5
Copy link
Author

Noam5 commented Sep 14, 2021

After further investigation, the issue is not properly described

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

1 participant