def ReadUntilClose(self):
    while True:
      cmd, data = self.ReadUntil('CLSE', 'WRTE')
      if cmd == 'CLSE':
        self._Send('CLSE', arg0=self.local_id, arg1=self.remote_id)
        break
      if cmd != 'WRTE':
        if cmd == 'FAIL':
          raise usb_exceptions.AdbCommandFailureException(
              'Command failed.', data)
        raise InvalidCommandError('Expected a WRITE or a CLOSE, got %s (%s)',
                                  cmd, data)
      yield data
Yield packets until a Close packet is received.
dataset/ETHPy150Open google/python-adb/adb/adb_protocol.py/_AdbConnection.ReadUntilClose