[libcamera-devel,2/4] libcamera: ipa_proxy: rearrange proxies precedence

Message ID 20200317173145.18226-3-kgupta@es.iitr.ac.in
State Superseded
Headers show
Series
  • libcamera: determine IPA_PROXY_PATH at runtime
Related show

Commit Message

Kaaira Gupta March 17, 2020, 5:31 p.m. UTC
User environment path in LIBCAMERA_IPA_PROXY_PATH should take precedence
over system loading locations. Change precedence accordingly.

Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
---
 src/libcamera/ipa_proxy.cpp | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Comments

Kieran Bingham March 17, 2020, 8:15 p.m. UTC | #1
Hi Kaaira,

On 17/03/2020 17:31, Kaaira Gupta wrote:
> User environment path in LIBCAMERA_IPA_PROXY_PATH should take precedence
> over system loading locations. Change precedence accordingly.
> 
> Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
> ---
>  src/libcamera/ipa_proxy.cpp | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/src/libcamera/ipa_proxy.cpp b/src/libcamera/ipa_proxy.cpp
> index e04117c..363d034 100644
> --- a/src/libcamera/ipa_proxy.cpp
> +++ b/src/libcamera/ipa_proxy.cpp
> @@ -75,13 +75,8 @@ IPAProxy::~IPAProxy()
>   */
>  std::string IPAProxy::resolvePath(const std::string &file) const
>  {
> -	/* Try finding the exec target from the install directory first */
>  	std::string proxyFile = "/" + file;
> -	std::string proxyPath = std::string(IPA_PROXY_DIR) + proxyFile;
> -	if (!access(proxyPath.c_str(), X_OK))
> -		return proxyPath;
> -
> -	/* No exec target in install directory; check env variable. */

It would be good to have a blank line here,

(between the std::string proxyFile local variable, and the next code block)

> +	/* Check env variable first. */
>  	const char *execPaths = utils::secure_getenv("LIBCAMERA_IPA_PROXY_PATH");
>  	if (execPaths) {
>  		for (const auto &dir : utils::split(execPaths, ":")){
> @@ -93,6 +88,12 @@ std::string IPAProxy::resolvePath(const std::string &file) const
>  				return proxyPath;
>  		}
>  	}
> +
> +	/*Try finding the exec target from the install directory.*/

The comment is missing spaces after the '/*' and before the '*/' markers.

> +        std::string proxyPath = std::string(IPA_PROXY_DIR) + proxyFile;
> +        if (!access(proxyPath.c_str(), X_OK))
> +                return proxyPath;
> +

And those lines have been indented with spaces instead of tabs.

>  	return std::string();
>  }


With the whitespace issues fixed,

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Patch

diff --git a/src/libcamera/ipa_proxy.cpp b/src/libcamera/ipa_proxy.cpp
index e04117c..363d034 100644
--- a/src/libcamera/ipa_proxy.cpp
+++ b/src/libcamera/ipa_proxy.cpp
@@ -75,13 +75,8 @@  IPAProxy::~IPAProxy()
  */
 std::string IPAProxy::resolvePath(const std::string &file) const
 {
-	/* Try finding the exec target from the install directory first */
 	std::string proxyFile = "/" + file;
-	std::string proxyPath = std::string(IPA_PROXY_DIR) + proxyFile;
-	if (!access(proxyPath.c_str(), X_OK))
-		return proxyPath;
-
-	/* No exec target in install directory; check env variable. */
+	/* Check env variable first. */
 	const char *execPaths = utils::secure_getenv("LIBCAMERA_IPA_PROXY_PATH");
 	if (execPaths) {
 		for (const auto &dir : utils::split(execPaths, ":")){
@@ -93,6 +88,12 @@  std::string IPAProxy::resolvePath(const std::string &file) const
 				return proxyPath;
 		}
 	}
+
+	/*Try finding the exec target from the install directory.*/
+        std::string proxyPath = std::string(IPA_PROXY_DIR) + proxyFile;
+        if (!access(proxyPath.c_str(), X_OK))
+                return proxyPath;
+
 	return std::string();
 }