[hdctools] power cycle USB when switching usb_mux_sel1 and restore power state.

This CL includes the following changes to

1. Power cycle the USB stick when switching 'usb_mux_sel1', because the USB
sometimes got wedged when the USB power is on.

2. Record the initial state of prtctl4_pwren and restore it at the end of
the function.

Hopefully, this can fix, or at least reduce, the occurrence of issue 225932.

TEST=Test the repair flow from four initial USB mux states
usb_mux_sel1:dut_sees_usbkey prtctl4_pwren:on
usb_mux_sel1:servo_sees_usbkey prtctl4_pwren:on
usb_mux_sel1:dut_sees_usbkey prtctl4_pwren:off
usb_mux_sel1:servo_sees_usbkey prtctl4_pwren:off

Confirm that after each case, the repair job succeeds
and 'dut-control prtctl4_pwren' reports 'prtctl4_pwren:off'

Change-Id: Id9590d4d7a6e9677f27ff5c47a4c09e089b597c5
Reviewed-on: https://gerrit.chromium.org/gerrit/59355
Commit-Queue: Fang Deng <fdeng@chromium.org>
Reviewed-by: Fang Deng <fdeng@chromium.org>
Tested-by: Fang Deng <fdeng@chromium.org>
1 file changed