Redefine the set_port_mode behavior.