Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

hardware-libcamera: Commit

hardware/libcamera


Commit MetaInfo

Revisioncdab62634d2dbc2ad7556147bcd592e2e8e01879 (tree)
Time2020-05-05 11:01:40
AuthorChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

Fix property hal.camera.0 has no effect issue

There is a logical error that prevents hal.camera.0 from working
if /dev/video1 exists.

Reported-by: NovHak <novhak@gmail.com>

Change Summary

Incremental Difference

--- a/CameraFactory.cpp
+++ b/CameraFactory.cpp
@@ -141,10 +141,12 @@ void CameraFactory::parseConfig(const char* configFile)
141141 char camera_node[] = "/dev/video0";
142142 char camera_prop[] = "hal.camera.0";
143143 char prop[PROPERTY_VALUE_MAX] = "";
144+ bool no_prop = true;
144145 while (camera_node[10] <= '9' && mCameraNum < 3) {
145146 if (!access(camera_node, F_OK)) {
146147 int facing = mCameraNum, orientation = 0;
147148 if (property_get(camera_prop, prop, "")) {
149+ no_prop = false;
148150 sscanf(prop, "%d,%d", &facing, &orientation);
149151 ALOGI("%s got facing=%d orient=%d from property %s", __FUNCTION__, facing, orientation, camera_prop);
150152 }
@@ -154,8 +156,9 @@ void CameraFactory::parseConfig(const char* configFile)
154156 }
155157
156158 // If there is only one camera, assume its facing is front
157- if (mCameraNum == 1 && prop[0] == '\0') {
159+ if (mCameraNum == 1 && no_prop) {
158160 mCameraFacing[0] = CAMERA_FACING_FRONT;
161+ ALOGI("%s assume %s is front", __FUNCTION__, mCameraDevices[0]);
159162 }
160163 }
161164 }
Show on old repository browser