def METHOD_NAME():
    if 'mxchip' in serial_settings.device_type:
        mxchip_uart_interface.device_setup()
    ser = serial.Serial(port=serial_settings.port, baudrate=serial_settings.baud_rate)
    time.sleep(.5)
    # Print initial message
    output = ser.readline(ser.in_waiting)
    output = output.strip().decode(encoding='utf-8', errors='ignore')
    print(output)
    if serial_settings.skip_setup:
        # skip waiting for WiFi and IoT Hub setup
        while (ser.in_waiting):
            time.sleep(.1)
            output = ser.readline(ser.in_waiting)
            output = output.strip().decode(encoding='utf-8', errors='ignore')
            mxchip_uart_interface.check_firmware_errors(output)
            # Do we want to save this output to file if there is an error printed?
            if len(output) > 4:
                print(output)
    else:
        # Wait for WiFi and IoT Hub setup to complete
        start_time = time.time()
        # for mxchip, branch this away
        while(serial_settings.setup_string not in output) and ((time.time() - start_time) < (3*serial_settings.wait_for_flash + 5)):
            time.sleep(.1)
            output = ser.readline(ser.in_waiting)
            output = output.strip().decode(encoding='utf-8', errors='ignore')
            mxchip_uart_interface.check_firmware_errors(output)
            if len(output) > 4:
                print(output)
    if 'rpi' in serial_settings.device_type or 'raspi' in serial_settings.device_type:
        # for rpi, transfer pipeline/artifact files from agent to device
        # get filepath, walk it
        # for each file, send rz, then sz file to rpi port
        uart = rpi_uart_interface.rpi_uart_interface()
    elif 'mxchip' in serial_settings.device_type:
        uart = mxchip_uart_interface.mxchip_uart_interface()
    elif 'esp32' in serial_settings.device_type or 'esp8266' in serial_settings.device_type:
        uart = esp_arduino_uart_interface.esp_uart_interface()
    uart.write_read(ser, serial_settings.input_file, serial_settings.output_file)
    ser.reset_input_buffer()
    ser.reset_output_buffer()
    ser.close()
    print("Num of Errors: %d" %azure_test_firmware_errors.SDK_ERRORS)
    sys.exit(azure_test_firmware_errors.SDK_ERRORS)