summaryrefslogtreecommitdiffstats
path: root/services/camera/libcameraservice/common/CameraModule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'services/camera/libcameraservice/common/CameraModule.cpp')
-rw-r--r--services/camera/libcameraservice/common/CameraModule.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/services/camera/libcameraservice/common/CameraModule.cpp b/services/camera/libcameraservice/common/CameraModule.cpp
index 85a4df9..5f767ad 100644
--- a/services/camera/libcameraservice/common/CameraModule.cpp
+++ b/services/camera/libcameraservice/common/CameraModule.cpp
@@ -91,7 +91,7 @@ int CameraModule::getCameraInfo(int cameraId, struct camera_info *info) {
}
int CameraModule::open(const char* id, struct hw_device_t** device) {
- return mModule->common.methods->open(&mModule->common, id, device);
+ return filterOpenErrorCode(mModule->common.methods->open(&mModule->common, id, device));
}
int CameraModule::openLegacy(
@@ -125,5 +125,20 @@ int CameraModule::setTorchMode(const char* camera_id, bool enable) {
return mModule->set_torch_mode(camera_id, enable);
}
+
+status_t CameraModule::filterOpenErrorCode(status_t err) {
+ switch(err) {
+ case NO_ERROR:
+ case -EBUSY:
+ case -EINVAL:
+ case -EUSERS:
+ return err;
+ default:
+ break;
+ }
+ return -ENODEV;
+}
+
+
}; // namespace android