def METHOD_NAME(self):
    self.open_shell()
    os.environ["PYTHONUNBUFFERED"]="1"
    while True:
        m = self.mav.recv_match(type="SERIAL_CONTROL", timeout=1000)
        self.send_heartbeats()
        shell_failure = self.shell.poll()
        if shell_failure is not None:
            self.debug("Shell is dead, restarting (%s)" % shell_failure)
            self.open_shell()
        if select.select([self.shell.stderr, self.shell.stdout],[],[],0)[0] != []:
            try:
                self.mixed_output_from_shell += self.shell.stderr.read()
            except IOError as e:
                if e.errno != 11:
                    raise
            try:
                self.mixed_output_from_shell += self.shell.stdout.read()
            except IOError as e:
                if e.errno != 11:
                    raise
        while len(self.mixed_output_from_shell):
            data = self.mixed_output_from_shell[:70]
            self.mixed_output_from_shell = self.mixed_output_from_shell[70:]
            data_len = len(data)
            data = [ord(x) for x in list(data)]
            data = data + ([0] * (70-len(data)))
            self.mav.mav.serial_control_send(
                self.serial_control_dev,
                mavutil.mavlink.SERIAL_CONTROL_FLAG_REPLY,
                0,  # timeout
                0,  # baud
                data_len,
                data
            )
        if m is None:
            time.sleep(0.1)
            continue
        if m.device != self.serial_control_dev:
            continue
        if m.count == 0:
            continue
        b = m.data[:m.count]
        text = "".join([chr(a) for a in b])
        text = re.sub("\r\n", "\n", text)  # not quite right, doesn't take into account \r at end of data
        self.shell.stdin.write(text)