mimo-monitor: Adjust reset approach.

With M120, there was an increased number of MIMO devices where the touch
panel would spontaneously disconnect from the system.  The mimo-monitor
is a watchdog process that verifies the MIMO components each minute and
attempts to reset any components that have disappeared.

Reading the code, there are assumptions that the device pointer is valid
at several places.  Instead, the device may have disappeared, so we
check function return values (particularly ReadID) more carefully.  If
the touch panel is unavailable, attempt to reset the parent device:
there is no way to send a reset command to an unresponsive device.

Add a throttle so that we do not reset the parent device more than three
times in every ten minutes.

I `cros deploy` this to an ambassador device, and then `lsusb; lsusb -t`
to discover the bus and port numbers for the SiS touch controller.  Then
`echo '1-2.1' > /sys/bus/usb/drivers/usb/unbind` to disable the touch
controller.  Nothing happened.  The device still appears in `lsusb` but
not `lsusb -t`. `mimo-monitor` does not seem to notice.

BUG=b:340905255
TEST=cros deploy mimo-monitor

Change-Id: I727a5c6874ae51c0f82042dd51903e3f3e3e5eaa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/cfm-device-monitor/+/5738592
Tested-by: Richard Yeh <rcy@google.com>
Commit-Queue: Richard Yeh <rcy@google.com>
Reviewed-by: Pablo Ceballos <pceballos@chromium.org>
(cherry picked from commit 6850e1dd1d63908d15126c431e95fbaa4a9a3289)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/cfm-device-monitor/+/5754104
Auto-Submit: Richard Yeh <rcy@google.com>
8 files changed
tree: a15e9a521e9543d9d55575652a3700a048504c70
  1. apex-monitor/
  2. camera-monitor/
  3. conf/
  4. init/
  5. mimo-monitor/
  6. BUILD.gn
  7. LICENSE
  8. OWNERS
  9. PRESUBMIT.cfg
  10. README.md
README.md

CFM Device Monitor

Source code for CFM peripheral monitors which check the status of CFM devices and guarantee their liveness.

mimo-monitor

The MIMO touch panel is a USB 2.0 device that contains a 1280x800 display and a touch panel.

# Example lsusb output

Bus 001 Device 006: ID 17e9:416d DisplayLink MIMO VUE HD
Bus 001 Device 005: ID 266e:0110 Silicon Integrated Systems SiS HID Touch Controller

/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M
    |__ Port 2: Dev 3, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 1: Dev 5, If 0, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 3: Dev 6, If 0, Class=Vendor Specific Class, Driver=udl, 480M
        |__ Port 3: Dev 6, If 1, Class=Human Interface Device, Driver=usbhid, 480M

Each minute, the mimo-monitor checks that both logical USB devices are present, and attempts to reset them if not.

sis_monitor

SiS Monitor resets are 6-byte messages sent to the /dev/hidraw# endpoint. This is like an application-level disable/enable.

If you echo '1-2.1' > /sys/bus/usb/drivers/usb/unbind, then the device will disappear from lsusb -t but still be visible on lsusb. This is a lower-level unbind, but not to the level of re-enumeration.