The polarization of ECRH waves, set by the orientation of a pair of corrugated mirror polarizers in the transmission line, determines the degree of coupling to O- and X-modes in the plasma and has an important effect on the first-pass absorption. Existing methods for determining the required polarization have been found adequate in most experiments. However, as the pulse length is increased it becomes increasingly important to maximize the first-pass absorption while the plasma or injection conditions change or when there can be significant O- to Xmode power coupling during propagation, particularly in the edge plasma region of a stellarator. This has motivated the development of a dedicated feedback control system which is able to adjust the polarizers angles settings during the discharge in order to maintain the highest possible absorption. An extremum seeking controller is shown to successfully recover the optimum polarization setting during long-pulse ECRH experiments on LHD.