servod: fix issues on UsbHierarchy

This change fixes two issues:
- calling .get() on a default-dict does not return the dict's default,
but rather the default supplied to get. This was causing an unexpected
error on UsbHierarchy usage if the usb device was somehow not found.

- originally UsbHierarchy was only used for v4 - so all devices it cared
about were on a hub. Now, its used for ServodevWatchdog as well, we want
to support the use-case where a servo device can hang on a usb roothub
itself i.e. it's /sys/bus/usb path can be x-x without a '.'.

BUG=chromium:841121
TEST=manual testing
> servo on /sys/bus/usb/1-1 is detected correctly
> v4 + micro boots fine
> v4 + ccd boots fine

Change-Id: I93d5c79c00ffc4fef755c6f518eeec8386eeb195
Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1258726
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Todd Broch <tbroch@chromium.org>
1 file changed