halapi: common: Add hal_api_version_str array and an error message 64/251164/3
authorJaehoon Chung <jh80.chung@samsung.com>
Sun, 10 Jan 2021 23:03:47 +0000 (08:03 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Mon, 11 Jan 2021 03:15:37 +0000 (12:15 +0900)
Add hal_api_version_str array to display as string after converting each
enum value.
It's easier to understand than using enum value.
If abi version doesn't support about current version and compatible version,
then it needs to notice about not supporting abi_version.

Change-Id: I67f31423a4b9d911b269d8c7560c9907a6bafc8b
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
include/hal-common-interface.h
src/hal-api-common.c

index 39831b9..dab26cb 100644 (file)
@@ -29,6 +29,11 @@ enum hal_abi_version {
        HAL_ABI_VERSION_END,
 };
 
+static const char *const hal_abi_version_str[] = {
+       [HAL_ABI_VERSION_UNKNOWN]       = "Unknown HAL ABI Version",
+       [HAL_ABI_VERSION_TIZEN_6_5]     = "HAL_ABI_VERSION_TIZEN_6_5",
+};
+
 typedef struct __hal_backend {
        const char *name;
        const char *vendor;
index 9f47636..61ef60c 100644 (file)
@@ -222,6 +222,12 @@ int hal_common_check_backend_abi_version(enum hal_module module,
                if (abi_version <= data->curr_version
                                && abi_version >= data->compat_version)
                        return TIZEN_ERROR_NONE;
+
+               _E("%s doesn't support %s of HAL Backend\n", hal_abi_version_str[g_curr_hal_abi_version],
+                               hal_abi_version_str[abi_version]);
+               _E("Must use the following ABI versions from %s to %s\n",
+                               hal_abi_version_str[data->compat_version],
+                               hal_abi_version_str[data->curr_version]);
        }
 
        return TIZEN_ERROR_INVALID_PARAMETER;