Detect which is in use and handle it automatically.