

def Write(self, data):
    'Write a packet and expect an Ack.'
    self._Send('WRTE', arg0=self.local_id, arg1=self.remote_id, data=data)
    (cmd, okay_data) = self.ReadUntil('OKAY')
    if (cmd != 'OKAY'):
        if (cmd == 'FAIL'):
            raise usb_exceptions.AdbCommandFailureException('Command failed.', okay_data)
        raise InvalidCommandError('Expected an OKAY in response to a WRITE, got %s (%s)', cmd, okay_data)
    return len(data)

dataset/ETHPy150Open google/python-adb/adb/adb_protocol.py _AdbConnection.Write/original