hardware/libcamera
Revision | cdab62634d2dbc2ad7556147bcd592e2e8e01879 (tree) |
---|---|
Time | 2020-05-05 11:01:40 |
Author | Chih-Wei Huang <cwhuang@linu...> |
Commiter | Chih-Wei Huang |
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>
@@ -141,10 +141,12 @@ void CameraFactory::parseConfig(const char* configFile) | ||
141 | 141 | char camera_node[] = "/dev/video0"; |
142 | 142 | char camera_prop[] = "hal.camera.0"; |
143 | 143 | char prop[PROPERTY_VALUE_MAX] = ""; |
144 | + bool no_prop = true; | |
144 | 145 | while (camera_node[10] <= '9' && mCameraNum < 3) { |
145 | 146 | if (!access(camera_node, F_OK)) { |
146 | 147 | int facing = mCameraNum, orientation = 0; |
147 | 148 | if (property_get(camera_prop, prop, "")) { |
149 | + no_prop = false; | |
148 | 150 | sscanf(prop, "%d,%d", &facing, &orientation); |
149 | 151 | ALOGI("%s got facing=%d orient=%d from property %s", __FUNCTION__, facing, orientation, camera_prop); |
150 | 152 | } |
@@ -154,8 +156,9 @@ void CameraFactory::parseConfig(const char* configFile) | ||
154 | 156 | } |
155 | 157 | |
156 | 158 | // If there is only one camera, assume its facing is front |
157 | - if (mCameraNum == 1 && prop[0] == '\0') { | |
159 | + if (mCameraNum == 1 && no_prop) { | |
158 | 160 | mCameraFacing[0] = CAMERA_FACING_FRONT; |
161 | + ALOGI("%s assume %s is front", __FUNCTION__, mCameraDevices[0]); | |
159 | 162 | } |
160 | 163 | } |
161 | 164 | } |