Refactor monitor_reconfigure

- make the code more resilient to errors by checking for errors at runtime (instead of CHECKs which halt powerd).
- handle <2 outputs and >2 outputs in the code.
- match output names fuzzily to detect the internal (LVDS) panel.
- do not always expect the outputs to be named LVDS and something else; we still want to run if neither is named LVDS.

TEST=tested hotplug on mario and zgb.
BUGS=chromeos-partner:4026 chromeos-partner:3790 chromeos-partner:3354

Change-Id: Iae660c7c973de60b5d3e5320bc37c46123ae45c3
Reviewed-on: http://gerrit.chromium.org/gerrit/1556
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
Reviewed-by: Puneet Kumar <puneetster@chromium.org>
2 files changed