Add test to take pictures while suspending

This adds a test that suspend the system while recording frames from
the camera. The only property this verifies about each frame is that
it is different from the previous frame.

BUG=chromium-os:36056
TEST=run_remote_tests.sh power_CameraSuspend [daisy, link]

Change-Id: Id27f8c3880af66f937f2c1ec4dec727b6f84ccc4
Reviewed-on: https://gerrit.chromium.org/gerrit/40457
Reviewed-by: Scott Zawalski <scottz@chromium.org>
Tested-by: Michael Spang <spang@chromium.org>
Commit-Queue: Michael Spang <spang@chromium.org>
diff --git a/client/cros/camera/camera_utils.py b/client/cros/camera/camera_utils.py
index ba45f03..919ae8d 100644
--- a/client/cros/camera/camera_utils.py
+++ b/client/cros/camera/camera_utils.py
@@ -2,6 +2,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+import glob, os
 import numpy as np
 
 # Dimension padding/unpadding function for converting points matrices to
@@ -24,3 +25,17 @@
         return (self.__class__.__name__ + '(' +
         ', '.join('%s=%s' % (k, v) for k, v in sorted(self.__dict__.items())
                   if not k.startswith('_')) + ')')
+
+
+def find_camera():
+    """
+    Find a V4L camera device.
+
+    @return (device_name, device_index). If no camera is found, (None, None).
+    """
+    cameras = [os.path.basename(camera) for camera in
+               glob.glob('/sys/bus/usb/drivers/uvcvideo/*/video4linux/video*')]
+    if not cameras:
+        return None, None
+    camera = cameras[0]
+    return camera, int(camera[5:])