camera: Hint users to update the camera config file if misconfigured
Errors will be raised when the camera_characteristics.conf file is
not properly configured. We ask the user to submit a CL to update the
configuration file.
BUG=b:185074892
TEST=make test; manually test on DUT
Change-Id: If7885b85e03d42da7e95ac20e0985278de8997ce
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/factory/+/2853688
Tested-by: Ting-Hsuan Wang <phoebewang@chromium.org>
Reviewed-by: Jasmine Chen <lnishan@google.com>
Commit-Queue: Ting-Hsuan Wang <phoebewang@chromium.org>
diff --git a/py/device/chromeos/camera.py b/py/device/chromeos/camera.py
index cc60640..e3b38d6 100644
--- a/py/device/chromeos/camera.py
+++ b/py/device/chromeos/camera.py
@@ -68,11 +68,18 @@
camera_id = re.findall(
r'^camera(\d+)\.module\d+\.usb_vid_pid=%s$' % vid_pid,
camera_config, re.IGNORECASE | re.MULTILINE)
- if len(set(camera_id)) > 1:
+ if len(camera_id) > 1:
raise CameraError(
- 'Multiple cameras have the same usb_vid_pid (%s)' % vid_pid)
+ 'Multiple cameras have the same usb_vid_pid (%s)'
+ ' There are duplicated usb_vid_pid in the'
+ ' camera_characteristics.conf file. Please submit'
+ ' a CL to fix this. See sample CL at https://crrev.com/c/419375' %
+ vid_pid)
if not camera_id:
- raise CameraError('No camera has the usb_vid_pid (%s)' % vid_pid)
+ raise CameraError(
+ 'No camera has the usb_vid_pid (%s)'
+ ' Please submit a CL to update the camera_characteristics.conf'
+ ' file. See sample CL at https://crrev.com/c/419375' % vid_pid)
camera_id = int(camera_id[0])
index_to_camera_id[index] = camera_id