platform/hal/api/common.git
13 months agohalcc: Fix parser to accept multiple version for hal 78/311178/1
Youngjae Cho [Mon, 13 May 2024 05:49:01 +0000 (14:49 +0900)]
halcc: Fix parser to accept multiple version for hal

 Make halcc_hal manage multiple version internally. The parser accepts
versions whenever it meets <version> element, consumes and updates
version list of halcc_hal.
 Currently, the only first incoming version is set as version of a hal,
and all of the version-related operations works on top if it. This is
for making the whole code work in the current structure, but it will be
fixed to take the entire version list into account when it counts
compatibility.

Change-Id: I6b95a7692fc2ffbe3630db04b94dd6dc0f3a66cc
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalcc: Remove hal dependency scheme from manifest 19/311019/3
Youngjae Cho [Fri, 3 May 2024 08:53:42 +0000 (17:53 +0900)]
halcc: Remove hal dependency scheme from manifest

It is currently not used. And for support multi-versioning hal manifest,
the current style should be totally reformed somehow. Therefore, removed
the hal dependency scheme and related operations.

Change-Id: I1857b558f6debc9463fb3babfbc1447326dfc4bb
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalcc: Fix not to use min-max semantic for minor versioning 18/311018/3
Youngjae Cho [Thu, 2 May 2024 03:10:41 +0000 (12:10 +0900)]
halcc: Fix not to use min-max semantic for minor versioning

Removed use of version format of MAJOR.MIN_MINOR-MAX_MINOR. It has
changed to have only form of MAJOR.MINOR.

Change-Id: I3fa0e0220a97f7a5dcb2c817b291a4fbd96fb5fa
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agoRevert removal of enum hal_abi_version definition 03/311003/2
Youngjae Cho [Fri, 10 May 2024 07:38:00 +0000 (16:38 +0900)]
Revert removal of enum hal_abi_version definition

This has been removed since 70757d52a56abd1e9820c181bfe10aefbeee7caf.
However, the definition is still required as the reference from another
repository hasn't been totally removed yet. Those code referring the
definition and the definition itself would be removed together.

Change-Id: I6d985d2290d6aaf755e4dcca2b3a00f9820a7acb
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalcc: Fix thread-unsafe function, getpwnam(), getgpnam() 11/310511/1
Youngjae Cho [Tue, 30 Apr 2024 06:15:04 +0000 (15:15 +0900)]
halcc: Fix thread-unsafe function, getpwnam(), getgpnam()

Change them to getpwnam_r(), getgrnam_r().

Change-Id: I3841bd9018ac30b7adb0701b4cb439009ea74dc3
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalcc: Make parser maintain hal to have the latest version 08/310508/2
Youngjae Cho [Tue, 30 Apr 2024 04:44:38 +0000 (13:44 +0900)]
halcc: Make parser maintain hal to have the latest version

If halcc parser picks a hal that can be covered by hal that has been
parsed before, put the hal back. Here 'cover' means that one can
supports the other in terms of backward compatibility, for example,
v2.3 covers v2.0~v2.3. On the other hand, if a hal being picked can
cover a hal that has been parsed before, the previous hal is replaced
with the newly picked one.

Change-Id: Ie273d5065e53cd541b5edb3138b97f3c3deb1ff7
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalcc: Fix manifest scheme to have multiple <manifest> element 07/310507/1
Youngjae Cho [Tue, 30 Apr 2024 01:56:21 +0000 (10:56 +0900)]
halcc: Fix manifest scheme to have multiple <manifest> element

To have multiple <manifest> element, halcc parser now recognizes root
element <root> and searches for its children <manifest>.

Change-Id: I72ca77a6331f172c6a0f6e4eb3c660dccef7e71c
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalapi: Fix directory where halcc searches for manifest.xml 62/310162/2
Youngjae Cho [Tue, 23 Apr 2024 08:22:22 +0000 (17:22 +0900)]
halapi: Fix directory where halcc searches for manifest.xml

The hal manifest install path has changed to a directory, /etc/hal-manifest,
regardless of tizen version specified at /hal/etc/hal-info.ini.

Change-Id: Ib6941b89ed4688e43f954cf278add0dc8008a92b
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalapi: Add hal-api-manifest.xml 57/310157/2
Youngjae Cho [Tue, 23 Apr 2024 06:41:20 +0000 (15:41 +0900)]
halapi: Add hal-api-manifest.xml

The hal-api specifies which version it requires to a hal backend
module. The manifest file must be installed in the following directory:
 - /etc/hal-manifest/hal-api-manifest.xml

Manifest scheme:
 <manifest version="1.0" type="platform">
     <hal>
         <name>HAL_MODULE_XXX</name>
         <version>1.2</version>
         <version>2.0</version>
         <transport>passthrough</transport>
     </hal>
 </manifest>

 The above specifies that a platform has hal api version of both 1.0-2
and 2.0. The name, in this case the HAL_MODULE_XXX, must be one of an
enum hal_module. (See include/hal-common.h) It expects for hal backend
to have version that specified in <version>. Here the 'compatible' means
that backend version should have major version equal to platform, and
minor equal to or lesser than platform. At the above case, here is
compatible set of backend version:
 - Compatible backend version: 1.0, 1.1, 1.2, 2.0
 - Incompatible backend version: 1.3, 2.1, 3.0, ...

 As aforementioned, a platform must contain all set of apis as it has
specified on manifest <version>. For example, a hal api that specified
the above manifest must have all apis like below.
  // hal-xxx.h
  int hal_xxx_foo(); // Implemented as of v1.0
  int hal_xxx_bar(); // Implemented as of v1.1
  int hal_xxx_baz(); // Implemented as of v1.2
  int hal_xxx_qux(); // Implemented as of v2.0

 Note that, for backward compatibility, all functions with older minor
version as well as the latest minor version must be provided together.
And they cannot be removed as the minor bumps within the same major
version.
 It works based on which backend version would have been. If a platform
works on top of backend version of 1.1, the foo and bar will works
whereas baz and qux won't, returning not supported error, for example.
Note that even though the platform has implemented baz since v1.2, it
won't work as backend has no idea about v1.2.
 For backend version of 1.3, for example, all the foo, bar, and baz
won't work. (qux obviously won't too due to major version mismatch)
The backend v1.3 might have implemented all v1.0 ~ v1.3 functionalities
for backward compatibility though, it is possible that v1.2 platform
could not understand semantic of v1.3 that will have been given in
the future. To prevent this, platform refuses to work with backend
of future minor version.

 If a new hal api is added with major or minor version bump, fix the
manifest file through ACR process.

Change-Id: I9d191f4fe63577eb6ce08aa7fe3ac058f80f0360
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agotools: hal-compatibility-checker: Print error log 47/310147/2
Youngjae Cho [Tue, 23 Apr 2024 05:53:01 +0000 (14:53 +0900)]
tools: hal-compatibility-checker: Print error log

Change-Id: Id7adda83f8625065c2a48f4284265f5525c374b9
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalapi: Disable dependency checking between hal-api 90/309990/4
Youngjae Cho [Fri, 19 Apr 2024 02:46:07 +0000 (11:46 +0900)]
halapi: Disable dependency checking between hal-api

Temporarily disable it. For now, it is unclear that dependency checking
is necessary. Because, those hal-api header and manifest.xml aren't
managed by ACR process so they could be transformed anyhow, breaking
dependency. Currently, our policy has no specification that force them
to think about and comply with dependency among hal-apis.

Change-Id: Iab1fc46674e4af0e0b6771c630d6e1a093dda8f9
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalapi: Remove 'level' from manifest scheme 89/309989/3
Youngjae Cho [Fri, 19 Apr 2024 02:23:10 +0000 (11:23 +0900)]
halapi: Remove 'level' from manifest scheme

It hasn't been used and had no role.

Change-Id: Ied4007d00e4596618a9f11e993780c343c42b1c7
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agotests: Fix hooking to be done via wrapper provided by linker 31/309731/3
Youngjae Cho [Tue, 16 Apr 2024 06:08:38 +0000 (15:08 +0900)]
tests: Fix hooking to be done via wrapper provided by linker

For MCD(Module Circular Dependency) score, remove direct reference
from hal-api-common to hal-api-common-hook.c.

Change-Id: I1095243186f270cc1fb8d1ed30f7c8e954deb16d
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalapi: Eliminate HAL abi and its operations 67/309367/14
Youngjae Cho [Tue, 9 Apr 2024 07:16:11 +0000 (16:16 +0900)]
halapi: Eliminate HAL abi and its operations

HAL abi won't be used anymore. Compatibility manifest and compatibility
checker take over the role. However, the .abi_version member variable
of struct __hal_backend has not been removed but just deprecated as it
is referenced by too many modules for now. After completely removing
them, this field will be removed.

Change-Id: I2ad812be1d1b8d8d16eeca776c20837d582aa25f
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalapi: Separate g_compatibility_info into manifest and backend 39/309639/14
Youngjae Cho [Fri, 12 Apr 2024 11:09:02 +0000 (20:09 +0900)]
halapi: Separate g_compatibility_info into manifest and backend

To load those data separately, manifest and backend, separate their
data structure. It holds major/minor version instead of compatibility.
The compatibility could easily be knonw if major/minor versions of
manifest and backend have been held on memory.

In addition, storing format has been changed. Each segment is separated
by ':'.
 {index}:{module_name}:{manifest_major}.{manifest_minor}:
  {backend_major}.{backend_minor}:{manifest_desciption}:
  {backend_description}:{compatibility}

Change-Id: Ifd59eebc60e092e0c465e92b36ffde81e1185f15
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalapi: Fix storing function to accept overwrite parameter 38/309638/5
Youngjae Cho [Fri, 12 Apr 2024 06:39:49 +0000 (15:39 +0900)]
halapi: Fix storing function to accept overwrite parameter

This wipes out the access() for checking existance of file and code
branch. Due to this, code readability becomes more coherent.

Change-Id: I5e4cac06002818677051e8f4cf066d60cf7f1ca0
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
13 months agohalapi: Move hal_common family function to hal-api-common.c 37/309637/5
Youngjae Cho [Fri, 12 Apr 2024 05:43:11 +0000 (14:43 +0900)]
halapi: Move hal_common family function to hal-api-common.c

Place the below functions under hal-api-common.c.
 - hal_common_check_backend_compatibility()
 - hal_common_check_backend_compatibility_all()

And their implementation details, which are internal use only, has
been listed on hal-api-compatibility-checker.h.

Change-Id: I208363f860c75627f8b7c3d3e1c564d62e6196f3
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
14 months agoRevert "packaging: Add some packages as Requires(post)" 46/309346/2
Youngjae Cho [Tue, 9 Apr 2024 04:46:43 +0000 (13:46 +0900)]
Revert "packaging: Add some packages as Requires(post)"

This reverts commit 2bf62bbf6f24df736e3fc2360abbb70ce90eea6e.

It seems better that the /sbin/ldconfig is taken by the same package
on installing and uninstalling.

Change-Id: Iba4940fcce2ca6e2539bcfbd9897a83cd34e0880

14 months agohalapi: Fix escaping condition to 'ret < 0' for consistency 36/309636/3
Youngjae Cho [Fri, 12 Apr 2024 05:27:07 +0000 (14:27 +0900)]
halapi: Fix escaping condition to 'ret < 0' for consistency

Change-Id: I6ef8a25ffcb54609c42fd21bf214984fb2241002
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
14 months agohalapi: Apply compatibility check when __init_backend() 21/309321/13
Youngjae Cho [Mon, 8 Apr 2024 12:07:38 +0000 (21:07 +0900)]
halapi: Apply compatibility check when __init_backend()

Change-Id: Ic4938993fd3a7ce589e6d634423140a9d71bb562
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
14 months agohalapi: Add function checking HAL compatibility 20/309320/9
Youngjae Cho [Mon, 8 Apr 2024 11:34:54 +0000 (20:34 +0900)]
halapi: Add function checking HAL compatibility

int hal_common_check_backend_compatibility()
  : It checks compatibility of the given hal module.

Change-Id: I1f4e7a61b709b4bc364400a9ec7f6b920f4eb550
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
14 months agohalapi: Add function checking all of the HAL compatibility 19/309319/9
Youngjae Cho [Thu, 11 Apr 2024 03:30:37 +0000 (12:30 +0900)]
halapi: Add function checking all of the HAL compatibility

Previously, the API provides callbacks that give responsibility to
the caller that storing compatibility result in their own way. However,
to provide a unified way of storing and loading HAL compatibility,
hal-api-common has become responsible for storing and loading
compatibility in a unified manner.

int hal_common_check_backend_compatibility_all()
  : It gets compatibility of all the hal modules. Additionally, it
    stores compatibility of all modules to backing storage if there
    hasn't been for later use.

Currently, the result is stored in /opt/etc/hal/.hal-compatibility and
the below is an example of result generated by hal-compatibility-checker:
  root:/opt/etc/hal> cat .hal-compatibility
  0:Not defined:0:Manifest hasn't specified the module
  1:HAL_MODULE_TBM:0:Manifest hasn't specified the module
  2:HAL_MODULE_TDM:0:Manifest hasn't specified the module
  ...
  26:HAL_MODULE_DEVICE_DISPLAY:2:Compatible
  27:HAL_MODULE_DEVICE_IR:0:Manifest hasn't specified the module
  28:HAL_MODULE_DEVICE_TOUCHSCREEN:1:Backend has incompatible version
  29:HAL_MODULE_DEVICE_LED:2:Compatible
  30:HAL_MODULE_DEVICE_BOARD:0:Manifest hasn't specified the module
  ...

It has foramt of
  "{index}:{module_name}:{compatibility}:{description}"

The tool hal-compatibility-checker, therefore, has changed to just call
the API, and removed callback code.

Change-Id: I4e1319bb98c81e1389e22924ae4ed70a66e46f7b
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
14 months agohalcc: Move libhalcc into libhal-api-common 18/309318/4
Youngjae Cho [Mon, 8 Apr 2024 02:59:41 +0000 (11:59 +0900)]
halcc: Move libhalcc into libhal-api-common

There were cyclic dependencies that
 : libhalcc requires libhal-api-common due to loading and checking
   backend version
 : libhal-api-common requires libhalcc due to checking compatibility

To remove dependency on each other, the libhalcc has been added to
the libhal-api-common.

Change-Id: I6b12310e2ffea0e038609d57158b51b973a470ce
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
14 months agohalapi: Move 'g_platform_curr_abi_version' from header to source code 17/309317/2
Youngjae Cho [Mon, 8 Apr 2024 09:52:34 +0000 (18:52 +0900)]
halapi: Move 'g_platform_curr_abi_version' from header to source code

Declaring variable with initializer on header might cause muiltiple
definition. Linker would be confused when linking multiple object files
that had been compiled seperately with the header included as the linker
can see multiple definitions to which symbol g_platform_curr_abi_version
could be linked. As multiple object files are complied seperately by each
translation unit, #ifndef-#define-#endif guard has no effect in the case.
Therefore, it is general that define variable in source code and provide
getter function or directly with extern keyword.

Change-Id: Ieb30dd5c9452cd846b318c7288221c9455e1f0ae
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
14 months agopackaging: Remove hal-rpmdb-checker.service 92/309192/2
Chanwoo Choi [Fri, 5 Apr 2024 10:30:34 +0000 (19:30 +0900)]
packaging: Remove hal-rpmdb-checker.service

hal-rpmdb-checker.service checks the RPM packages version
used by each hal-backend in order to check the compatibility between
hal-backand and used RPM packages. But hal-rpmdb-checker will be
replaced with each HAL module version checker of HAL compatibility
checker. So that remove hal-rpmdb-checker.service.

Change-Id: If33924c83b4d1619d9e8fd80711fe195a846d0a4
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
14 months agohalcc: Use major/minor version instead of abi version for checking compatibility 52/308952/1
Youngjae Cho [Tue, 2 Apr 2024 06:48:13 +0000 (15:48 +0900)]
halcc: Use major/minor version instead of abi version for checking compatibility

Change-Id: Ib7fa6ed4e9a482ac5f9cdc356626444d3d762730
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
14 months agohal-common-interface: Add hal_common_get_backend_abi_version() 30/308130/2
Yunhee Seo [Wed, 21 Feb 2024 06:26:13 +0000 (15:26 +0900)]
hal-common-interface: Add hal_common_get_backend_abi_version()

To apply HAL ABI Versioning, hal-backend major/minor version information is added.
Platform can decide whether to support hal-backend with major/minor version information.
To get major/minor versions from the hal-backend, this function is added.

int hal_common_get_backend_version(enum hal_module module, unsigned int *major_version, unsigned int *minor_version);
 - It obtains version information from hal-backend.

These variables are added to hal_backend structure.
 - const unsigned int major_version;
 - const unsigned int minor_version;

Change-Id: I8e548aabdeb66c27304a3ea99c2853d30e600c63
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
14 months agohalapi: Add checking abi_version pointer existence 29/308129/1
Yunhee Seo [Wed, 21 Feb 2024 06:38:24 +0000 (15:38 +0900)]
halapi: Add checking abi_version pointer existence

When obtainig the backend data, abi_version pointer checking part is necessary.
Although the absence of abi_version is the intended action, it occurs error.
Checking the pointer existence part was omitted.

Change-Id: I5852bdcfd288aec485643e599af56d358b2d7739
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
15 months agotests: Use strict string length for xml input 84/307884/1 accepted/tizen/unified/20240319.140945 accepted/tizen/unified/20240319.154751 accepted/tizen/unified/x/20240320.132940
Youngjae Cho [Thu, 14 Mar 2024 02:25:18 +0000 (11:25 +0900)]
tests: Use strict string length for xml input

 As libxml2 is upgraded to version 2.12.5, there added internal
logic that tests whether the parser would have succssfully reached at
the end of the given string when it completes parsing.

 The previous sizeof(str[]) is always greater by 1 than the sizeof(str[])
as it counts the terminating '\0'. And it makes libxml2 parser see that
there are some stuffs after parsing completion, reporting parse error.

Change-Id: I86cd16cb4a6b5460249900a138a6ee8dcb652d2c
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
15 months agotools: hal-compatibility-checker: Add stdout/stderr redirection to dlog 03/306603/3
Youngjae Cho [Fri, 23 Feb 2024 02:40:05 +0000 (11:40 +0900)]
tools: hal-compatibility-checker: Add stdout/stderr redirection to dlog

Options, --redirect-all, --redirect-stdout, --redirect-stderr, can now
recognize special symbol "dlog" as a parameter, which redirects output
to dlog SYSTEM buffer with log tag HAL_COMPATIBILITY_CHECKER.

Change-Id: I80425f5643709d0b0b16f8aaaa98b2a3021d263a
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
15 months agohalcc: Add fail log for halcc-object operations 48/306348/3 accepted/tizen/unified/20240306.011956 accepted/tizen/unified/toolchain/20240311.065828 accepted/tizen/unified/x/20240307.010805
Youngjae Cho [Tue, 20 Feb 2024 10:19:54 +0000 (19:19 +0900)]
halcc: Add fail log for halcc-object operations

Change-Id: I2ced0da3de13b627dc6d8a528bf9a91a102960d6
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
15 months agohalcc: Add checking halcc_manifest_add_hal() return value 78/305978/2
Yunhee Seo [Wed, 14 Feb 2024 10:10:06 +0000 (19:10 +0900)]
halcc: Add checking halcc_manifest_add_hal() return value

If halcc_manifest_add_hal() returns error, halcc_hal should be free.
Omitted handling code is added.

Change-Id: Ic566968760537f2375cd84e25b877115beeaddb3
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
15 months agohalapi: common: Add HAL_ABI_VERSION_TIZEN_9_0 34/306734/1 accepted/tizen/unified/20240228.170403 accepted/tizen/unified/x/20240304.072506 accepted/tizen/unified/x/20240304.072736
Jaehoon Chung [Fri, 23 Feb 2024 06:52:22 +0000 (15:52 +0900)]
halapi: common: Add HAL_ABI_VERSION_TIZEN_9_0

Add HAL_ABI_VERSION_TIZEN_9_0 after released Tizen-8.0.
It needs to add HAL_ABI_VERSION_TIZEN_9_0 for using correct Tizen Version.
If it's not backward compatible, it has to modify a compatible by module
owner.

Change-Id: I65359722e02e88e5deb10ee5358578da0716ff07
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
16 months agohalcc: Rename to systemd-hal-compatibility-checker-generator 63/304463/2 accepted/tizen/unified/20240119.154718 accepted/tizen/unified/x/20240205.063858
Chanwoo Choi [Wed, 17 Jan 2024 23:45:33 +0000 (08:45 +0900)]
halcc: Rename to systemd-hal-compatibility-checker-generator

Use full name of HAL Compatibilicy Checker instead of non-standand short
name as following:
- systemd-hal-compatibility-checker-generator

Change-Id: I04897575f5f2fec964e554ae640d1302834bcd5e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
16 months agosystemd-hal-cc-generator: Fix typo of PATH= environment variable 70/304470/2
Youngjae Cho [Thu, 18 Jan 2024 01:40:33 +0000 (10:40 +0900)]
systemd-hal-cc-generator: Fix typo of PATH= environment variable

Change-Id: I444adc46255d630365d9fa6203fd6505aa2f4366
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
16 months agohalcc: Add support for hal-api dependency checking 71/304171/12 accepted/tizen_unified_riscv accepted/tizen/unified/20240116.155507 accepted/tizen/unified/riscv/20240117.041616
Youngjae Cho [Thu, 11 Jan 2024 08:50:58 +0000 (17:50 +0900)]
halcc: Add support for hal-api dependency checking

Optionally, hal-api can specify dependency, name and version of another
hal-api, that it must work with.

  | <!--hal-api-xxx.xml-->
  |
  | <manifest version="1.0" type="platform" level="2">
  |     <hal>
  |         <name>AAA</name>
  |         <version>1.0</version>
  |         <dependency>
  |             <hal>
  |                 <name>BBB</name>
  |                 <version>1.0</version>
  |             </hal>
  |             ...
  |         </dependency>
  |     </hal>
  |     <hal>
  |         <name>BBB</name>
  |         <version>1.5</version>
  |     </hal>
  |     ...
  | </manifest>

The halcc-object.c now provides
 - halcc_manifest_validate_hal_dependency()

This validates dependencies between hals within manifest. It try to
find compatible hal that specified by hal-api dependency. If it
couldn't find compatible one for the dependency, the resolution fails
and the hal is regarded as not supported.

Let's say a manifest contains below specification about 4 hals
 - AAA@1.5  : success
 - BBB@2.3  : success
 - CCC@3.3  : success
 - DDD@1.0  : success
If there are no dependencies between each other, no problem.

Case1] If AAA@1.5 depends on YYY@1.0.
 - AAA@1.5 -> YYY@1.0  : fail, YYY@1.0 is not specified
 - BBB@2.3  : success
 - CCC@3.3  : success
 - DDD@1.0  : success

Case2] If AAA@1.5 depends on BBB@1.0.
 - AAA@1.5 -> BBB@1.0  : fail, BBB@1.0 isn't compatible with
                         the specified BBB@2.3
 - BBB@2.3  : success
 - CCC@3.3  : success
 - DDD@1.0  : success

Caser3] If AAA@1.5 depends on BBB@2.0, CCC@4.0
 - AAA@1.5 -> BBB@2.0, CCC@4.0 : fail, BBB@2.0 is backward compatible
                         with the specified BBB@2.3, but CCC@4.0 isn't
                         compatible with the specified CCC@3.3.
 - BBB@2.3  : success
 - CCC@3.3  : success
 - DDD@1.0  : success
 If multiple dependencies are specified on a hal, it success only when
 all the dependencies are satisfied.

Case4] If AAA@1.5 depends on BBB@2.0
          and BBB@2.3 depends on CCC@3.0
          and CCC@3.3 depends on DDD@1.5
 - AAA@1.5 -> BBB@2.0  : fail, BBB@2.0 is backward compatible with the
                         specified BBB@2.3, but BBB@2.3 has failed to
                         validate dependency
 - BBB@2.3 -> CCC@3.0  : fail, CCC@3.0 is backward compatible with the
                         specified CCC@3.3, but CCC@3.3 has failed to
                         validate dependency
 - CCC@3.3 -> DDD@1.5  : fail, DDD@1.5 isn't compatible with the
                         specified DDD@1.0
 - DDD@1.0  : success
 The failure is propagated to all hals that have dependency on that
 failed hal.

Case5] If AAA@1.5 depends on BBB@2.1
          and BBB@2.3 depends on CCC@3.0
          and CCC@3.3 depends on AAA@1.0
 - AAA@1.5 -> BBB@2.1  : fail, cyclic dependency
 - BBB@2.3 -> CCC@3.0  : fail, cyclic dependency
 - CCC@3.3 -> AAA@1.0  : fail, cyclic dependency
 - DDD@1.0  : success
 All hals that make dependency cycle are failure.

Case6] If AAA@1.5 depends on BBB@2.0
          and BBB@2.3 depends on CCC@3.0
 - AAA@1.5 -> BBB@2.0  : success
 - BBB@2.3 -> CCC@3.0  : success
 - CCC@3.3  : success
 - DDD@1.0  : success

In addition, the tool hal-compatibility-checker has changed to validate
dependency, by default, before it checks compatibility.

Change-Id: I34ce0f78a9ae9c05f65c77b20199353c93072851
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
16 months agosystemd-hal-cc-generator: Add hal compatibility checker 60/303660/9
Youngjae Cho [Wed, 3 Jan 2024 04:14:45 +0000 (13:14 +0900)]
systemd-hal-cc-generator: Add hal compatibility checker

In early booting state, the hal-compatibility-checker operates aided
by systemd-generator. It checks compatibility manifested by hal-api
and abi-version of hal-backend. Once it successfully checks and stores
result, those next following bootings won't do this again but just
reuse the result.

Change-Id: Id9a50a921f8e0d21de292d1aab81e490973cb2d1
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
16 months agotools: Add hal-compatibility-checker 59/303659/8
Youngjae Cho [Tue, 2 Jan 2024 11:14:35 +0000 (20:14 +0900)]
tools: Add hal-compatibility-checker

Provide tool for executing compatibility checker of libhalcc by command.
See 'hal-compatibility-checker --help'.

Change-Id: I3bfd46496997471dcd41d790cc702cc57664a01b
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
16 months agohalcc: Introduce halcc library 64/303164/13
Youngjae Cho [Tue, 19 Dec 2023 06:24:38 +0000 (15:24 +0900)]
halcc: Introduce halcc library

The halcc stands for hal compatibility checker.

Tizen hal-apis can specify what feature and version it expects to
hal-backends in manifest file. The halcc library deserializes and
utilizes the information for checking compatibility between
hal-api and hal-backend.

For example, a hal-api specifies what it needs in xml file:

  | <!--hal-api-xxx.xml-->
  |
  | <manifest version="1.0" type="platform" level="2">
  |     <hal>
  |         <name>AAA</name>
  |         <version>3.1</version>
  |         <transport>passthrough</transport>
  |     </hal>
  |     ...
  | </manifest>

It means that the hal-api expects and requires hal-backend module name
of AAA, and version of 3.x where x >= 1.
(See semantic versioning, https://semver.org)

These are collected and tested by the halcc library.

Currently only the function below is provieded
 - int halcc_check_compatibility(const char *hal_api_manifest_dir,
     halcc_compatibility_cb callback, void *user_data)
   : It collects manifest files at hal_api_manifest_dir and checks
     whether the hal-backends have compatible what hal-apis have
     specified. For each specified <hal> in manifests, callback is
     invoked.

Change-Id: Ibb16c378f6fbe08750b6df7db99ee6626bcfd033
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
17 months agohalapi: Add NULL check for strncpy() dest buffer 28/303228/2
Youngjae Cho [Fri, 22 Dec 2023 01:18:16 +0000 (10:18 +0900)]
halapi: Add NULL check for strncpy() dest buffer

Change-Id: I6dbd911d246edc49b2eecabe4eb2400affb86b9e
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
17 months agohalapi: Fix strncpy() warnings 49/302749/3
Youngjae Cho [Wed, 13 Dec 2023 04:55:41 +0000 (13:55 +0900)]
halapi: Fix strncpy() warnings

Those strncpy() cause warnings, -Wstringop-truncate, -Wstringop-overflow
due to the length calculated by strlen(). Replace the length with the
explicit size specified by the parameter. It is logically the same as
before.

Change-Id: I5b06f8595aa89f32fc7a6becab31130eb1178116
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
18 months agoCMakeLists.txt: Add security compiling option (RELRO, SC, and FORTIFY) 38/301938/1 accepted/tizen/unified/20231128.175121 accepted/tizen/unified/riscv/20231211.234136
Unsung Lee [Sat, 25 Nov 2023 12:51:34 +0000 (21:51 +0900)]
CMakeLists.txt: Add security compiling option (RELRO, SC, and FORTIFY)

Add security compiling option (RELRO, SC, and FORTIFY) in CFLAGS.

Change-Id: Ic32765cd1967b7f8d028acac238a3ccf001c6992
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
23 months agohalapi: common: Add new HAL_ABI_VERSION_TIZEN_8_0 26/295526/1 accepted/tizen/8.0/unified/20231005.094410 accepted/tizen/unified/20230713.014417 tizen_8.0_m2_release
Chanwoo Choi [Mon, 10 Jul 2023 09:02:51 +0000 (18:02 +0900)]
halapi: common: Add new HAL_ABI_VERSION_TIZEN_8_0

Add new HAL_ABI_VERSION_TIZEN_8_0 and then HAL_ABI_VERSION_TIZEN_7_5 is
deprecated because of changes of tizen major version.

Change-Id: I8f26b12f2f81dccda0997b624b055c4479cc7ab8
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
23 months agotools: lshal: Add missing flag to print hal backend information 93/295293/1
Chanwoo Choi [Tue, 4 Jul 2023 23:14:11 +0000 (08:14 +0900)]
tools: lshal: Add missing flag to print hal backend information

Need to pass LSHAL_FLAG_* flags in order to print the hal backend
information. commit 9746f25a833a (tools: lshal: Fix wrong operation
when checking flag is set or not) fixed the wrong bitmap operation.
In result, the unknown issue occurred. So that add missing flag
to print all hal backend information.

Change-Id: If07f0908e4b4d50862ba942a3678d7e52fff8ce5
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoRevert "halapi: Fix mismatch by closing backend" 08/293508/1 accepted/tizen/unified/20230607.160240
Chanwoo Choi [Wed, 31 May 2023 05:19:49 +0000 (14:19 +0900)]
Revert "halapi: Fix mismatch by closing backend"

This reverts commit 82c338c4db17f1517e3efec3e4c482034f4b6b0d
because it causes the system halt.

Change-Id: I67a0ea9f324dfa46e894a3b49050eba972821cf3
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agohalapi: Add support of RISC-V architecture type 93/292093/1
Chanwoo Choi [Thu, 27 Apr 2023 04:59:44 +0000 (13:59 +0900)]
halapi: Add support of RISC-V architecture type

Change-Id: I7a41b523735c10973702557734c59ddbde1c8cc3
Reported-by: Woochang Kim <wchang.kim@samsung.com>
Tested-by: Woochang Kim <wchang.kim@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agotools: lshal: Fix wrong operation when checking flag is set or not 57/291757/1 accepted/tizen/unified/20230424.185339
Chanwoo Choi [Fri, 21 Apr 2023 02:04:15 +0000 (11:04 +0900)]
tools: lshal: Fix wrong operation when checking flag is set or not

When using bit operation for flag, should use 'and' operation.
But, lshal.c used the wrong operation. It fix the operatin from 'or' to
'and'.

Change-Id: I3a2badb8c61f73a6fc8d98b737fa6d7d4134c9eb
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agotools: Add lshal tool to get hal backends 00/291600/2
Chanwoo Choi [Mon, 13 Mar 2023 21:17:42 +0000 (06:17 +0900)]
tools: Add lshal tool to get hal backends

Provide lshal to get the detailed informaiton of hal backends on device.

[Description of each attribute of lshal tool]
- HAL Module Name          : HAL Module Name (fixed, not be changed)
- ID                       : HAL Module Unique ID (fixed, not be changed)
- Backend Library Name     : HAL Backend Library Name (fixed, not be changed)
- Backend Open Count       : HAL Backend Open Count (it's changed according to user count)
- Backend Verification     : If there is HAL backend, print "YES".
                           : If HAL backend is verified (get/put_backen), print "VERIFIED".
- Backend Symbol Name      : HAL Backend Symbol Name (fixed, not be changed)
- Backend ABI Version      : HAL Backend ABI Version (Written by Backend Developer)
- Backend Name             : HAL Backend Name (Written by Backend Developer)
- Vendor Name              : HAL Backend Vendor Name (Written by Backend Developer)
- TOTAL                    : The number of HAL modules and backends

[Example on rpi4 armv7l environment]
root:~> lshal
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                                        |    |                                                         | Backend    | Backend         | Backend                                       | Backend ABI Version       | Backend Name              | Vendor Name               |
 HAL Module Name                        | ID | Backend Library Name                                    | Open Count | Verification    | Symbol Name                                   | (Written by Developer)    | (Written by Developer)    | (Written by Developer)    |
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 HAL_MODULE_TBM                         | 1  | /hal/lib/libhal-backend-tbm.so                          | 4          | YES | VERIFIED  | hal_backend_tbm_data                          | HAL_ABI_VERSION_TIZEN_6_5 | vc4                       | Samsung                   |
 HAL_MODULE_TDM                         | 2  | /hal/lib/libhal-backend-tdm.so                          | 2          | YES | VERIFIED  | hal_backend_tdm_data                          | HAL_ABI_VERSION_TIZEN_6_5 | vc4                       | Samsung                   |
 HAL_MODULE_COREGL                      | 3  |                                                         |            |     |           |                                               |                           |                           |                           |
 HAL_MODULE_INPUT                       | 4  |                                                         |            |     |           |                                               |                           |                           |                           |
 HAL_MODULE_AUDIO                       | 5  | /hal/lib/libhal-backend-audio.so                        | 1          | YES | VERIFIED  | hal_backend_audio_data                        | HAL_ABI_VERSION_TIZEN_6_5 | audio-rpi                 | Broadcom                  |
 HAL_MODULE_CAMERA                      | 6  | /hal/lib/libhal-backend-camera.so                       | 1          | YES | VERIFIED  | hal_backend_camera_data                       | HAL_ABI_VERSION_TIZEN_6_5 | camera-v4l2               | TIZEN                     |
 HAL_MODULE_RADIO                       | 7  | /hal/lib/libhal-backend-radio.so                        | 0          | NO  |           | hal_backend_radio_data                        |                           |                           |                           |
 HAL_MODULE_CODEC                       | 8  |                                                         |            |     |           |                                               |                           |                           |                           |
 HAL_MODULE_USB_AUDIO                   | 9  |                                                         |            |     |           |                                               |                           |                           |                           |
 HAL_MODULE_ALSAUCM                     | 10 |                                                         |            |     |           |                                               |                           |                           |                           |
 HAL_MODULE_BLUETOOTH                   | 11 | /hal/lib/libhal-backend-bluetooth.so                    | 1          | YES | VERIFIED  | hal_backend_bluetooth_data                    | HAL_ABI_VERSION_TIZEN_6_5 | bluetooth                 | broadcom                  |
 HAL_MODULE_WIFI                        | 12 | /hal/lib/libhal-backend-wifi.so                         | 0          | NO  |           | hal_backend_wifi_data                         |                           |                           |                           |
 HAL_MODULE_NAN                         | 13 |                                                         |            |     |           |                                               |                           |                           |                           |
 HAL_MODULE_NFC                         | 14 | /hal/lib/libhal-backend-nfc.so                          | 0          | NO  |           | hal_backend_nfc_data                          |                           |                           |                           |
 HAL_MODULE_ZIGBEE                      | 15 | /hal/lib/libhal-backend-zigbee.so                       | 0          | NO  |           | hal_backend_zigbee_data                       |                           |                           |                           |
 HAL_MODULE_UWB                         | 16 | /hal/lib/libhal-backend-uwb.so                          | 0          | NO  |           | hal_backend_uwb_data                          |                           |                           |                           |
 HAL_MODULE_MTP                         | 17 |                                                         |            |     |           |                                               |                           |                           |                           |
 HAL_MODULE_TELEPHONY                   | 18 |                                                         |            |     |           |                                               |                           |                           |                           |
 HAL_MODULE_LOCATION                    | 19 | /hal/lib/libhal-backend-location.so                     | 3          | YES | VERIFIED  | hal_backend_location_data                     | HAL_ABI_VERSION_TIZEN_6_5 | location-backend          | replay                    |
 HAL_MODULE_COMMON                      | 20 |                                                         |            |     |           |                                               |                           |                           |                           |
 HAL_MODULE_POWER                       | 21 | /hal/lib/libhal-backend-power.so                        | 1          | YES | VERIFIED  | hal_backend_power_data                        | HAL_ABI_VERSION_TIZEN_6_5 | power-rpi4                | Rasberry Pi               |
 HAL_MODULE_SENSOR                      | 22 | /hal/lib/libhal-backend-sensor.so                       | 0          | NO  |           | hal_backend_sensor_data                       |                           |                           |                           |
 HAL_MODULE_PERIPHERAL                  | 23 |                                                         |            |     |           |                                               |                           |                           |                           |
 HAL_MODULE_DEVICE_BATTERY              | 24 | /hal/lib/libhal-backend-device-battery.so               | 0          | NO  |           | hal_backend_device_battery_data               |                           |                           |                           |
 HAL_MODULE_DEVICE_BEZEL                | 25 | /hal/lib/libhal-backend-device-bezel.so                 | 0          | NO  |           | hal_backend_device_bezel_data                 |                           |                           |                           |
 HAL_MODULE_DEVICE_DISPLAY              | 26 | /hal/lib/libhal-backend-device-display.so               | 2          | YES | VERIFIED  | hal_backend_device_display_data               | HAL_ABI_VERSION_TIZEN_7_0 | display                   | RPI                       |
 HAL_MODULE_DEVICE_IR                   | 27 | /hal/lib/libhal-backend-device-ir.so                    | 0          | NO  |           | hal_backend_device_ir_data                    |                           |                           |                           |
 HAL_MODULE_DEVICE_TOUCHSCREEN          | 28 | /hal/lib/libhal-backend-device-touchscreen.so           | 1          | YES | VERIFIED  | hal_backend_device_touchscreen_data           | HAL_ABI_VERSION_TIZEN_7_0 | touchscreen               | RPI                       |
 HAL_MODULE_DEVICE_LED                  | 29 | /hal/lib/libhal-backend-device-led.so                   | 1          | YES | VERIFIED  | hal_backend_device_led_data                   | HAL_ABI_VERSION_TIZEN_7_0 | led                       | RPI                       |
 HAL_MODULE_DEVICE_BOARD                | 30 | /hal/lib/libhal-backend-device-board.so                 | 1          | YES | VERIFIED  | hal_backend_device_board_data                 | HAL_ABI_VERSION_TIZEN_7_0 | board                     | RPI                       |
 HAL_MODULE_DEVICE_EXTERNAL_CONNECTION  | 31 | /hal/lib/libhal-backend-device-external-connection.so   | 0          | NO  |           | hal_backend_device_external_connection_data   |                           |                           |                           |
 HAL_MODULE_DEVICE_THERMAL              | 32 | /hal/lib/libhal-backend-device-thermal.so               | 1          | YES | VERIFIED  | hal_backend_device_thermal_data               | HAL_ABI_VERSION_TIZEN_7_0 | thermal                   | RPI                       |
 HAL_MODULE_DEVICE_USB_GADGET           | 33 | /hal/lib/libhal-backend-device-usb-gadget.so            | 0          | NO  |           | hal_backend_device_usb_gadget_data            |                           |                           |                           |
 HAL_MODULE_DEVICE_HAPTIC               | 34 | /hal/lib/libhal-backend-device-haptic.so                | 1          | YES | VERIFIED  | hal_backend_device_haptic_data                | HAL_ABI_VERSION_TIZEN_7_0 | haptic                    | RPI                       |
 HAL_MODULE_DEVICE_MEMORY               | 35 | /hal/lib/libhal-backend-device-memory.so                | 1          | YES | VERIFIED  | hal_backend_device_memory_data                | HAL_ABI_VERSION_TIZEN_7_0 | memory                    | RPI                       |
 HAL_MODULE_DEVICE_INPUT                | 36 | /hal/lib/libhal-backend-device-input.so                 | 0          | NO  |           | hal_backend_device_input_data                 |                           |                           |                           |
 HAL_MODULE_DEVICE_POWER                | 37 | /hal/lib/libhal-backend-device-power.so                 | 0          | NO  |           | hal_backend_device_power_data                 |                           |                           |                           |
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 TOTAL                                  | 37 |                                                         |            |              14 |                                               |                           |                           |                           |
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Change-Id: Id8246ff25d6cabf785b3fd1c6f24b1a1749daf0f
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agohalapi: Add new hal_common_get_backend_module_name function 68/291368/3
Chanwoo Choi [Tue, 28 Mar 2023 16:57:19 +0000 (01:57 +0900)]
halapi: Add new hal_common_get_backend_module_name function

Add new hal_common_get_backend_module_name function in order to provide
the HAL module name

[Detailed function prototype]
- int hal_common_get_backend_module_name(enum hal_module module, char *name, int size);

Change-Id: I521846db3917571ea7cfa00dd701dd9e8c7c97a2
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agohalapi: Add missing exception handling of hal_common_get_backend_library_name 67/291367/2
Chanwoo Choi [Sun, 26 Mar 2023 22:47:26 +0000 (07:47 +0900)]
halapi: Add missing exception handling of hal_common_get_backend_library_name

Change-Id: I9832ecce9923cfdd45196293c3af16bff1358ae5
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agohalapi: Fix mismatch by closing backend 66/291366/2
Chanwoo Choi [Fri, 7 Apr 2023 02:23:01 +0000 (11:23 +0900)]
halapi: Fix mismatch by closing backend

Change-Id: I1bd0d6548551a35cb9c993dfc6f3094d87c8bcca
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agohalapi: common: Remove unused variables on _get_module_info_with_library_name 63/290363/1
Chanwoo Choi [Mon, 13 Mar 2023 21:31:58 +0000 (06:31 +0900)]
halapi: common: Remove unused variables on _get_module_info_with_library_name

Change-Id: I5bb8472601d010a7e7b0e8d8e7b56f191c1d543b
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agosystemd-hal-firmware-generator: Fix wrong firmware loading path 11/289911/2
Chanwoo Choi [Wed, 15 Mar 2023 09:33:04 +0000 (18:33 +0900)]
systemd-hal-firmware-generator: Fix wrong firmware loading path

Change-Id: Id83b9b295f878b08eaad41501e779703afa04260
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agohal-api: common: fix the error handling path 87/285887/1 accepted/tizen/unified/20230105.154657 accepted/tizen/unified/20230425.063950
Jaehoon Chung [Thu, 22 Dec 2022 03:22:54 +0000 (12:22 +0900)]
hal-api: common: fix the error handling path

Before calling hal_api_conf_exit(), it needs to call close_backend().
Otherwise, hal_api_conf_exit will call free(info) before info->backend/handle.

Change-Id: If9b3b66d3bb7c9e5d92ebd565815c13bde4babdb
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agohalapi: common: add device power interface 42/284942/4 accepted/tizen/unified/20221220.180328
TaeminYeom [Thu, 1 Dec 2022 09:28:28 +0000 (18:28 +0900)]
halapi: common: add device power interface

To add device wakeup source function in device hal, it is needed.

Change-Id: I23d23f758134bea3bc02c488154a737f3e85c1d1
Signed-off-by: TaeminYeom <taemin.yeom@samsung.com>
2 years agohalapi: common: add DEVICE_INPUT HAL module 52/285452/2
Yunhee Seo [Tue, 13 Dec 2022 05:41:42 +0000 (14:41 +0900)]
halapi: common: add DEVICE_INPUT HAL module

Add DEVICE_INPUT HAL module to control the input device.

Change-Id: Iddb6457850cfe9ce36cb9f20db6dedc7e894a9a4
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
2 years agohalapi: common: Add HAL_ABI_VERSION_TIZEN_7_5 77/284277/1 accepted/tizen/unified/20221115.172858
Jaehoon Chung [Tue, 15 Nov 2022 00:43:03 +0000 (09:43 +0900)]
halapi: common: Add HAL_ABI_VERSION_TIZEN_7_5

Add HAL_ABL_VERSION_TIZEN_7_5 after released Tizen-7.0.
Because current Tizen Version is 7.5, It needs to add current Tizen
version about HAL_ABI_VERSION.
If it's not compatible between TIZEN_6.5 and TIZEN_7.5, it needs to
modify by modules owner.

Change-Id: Ifabd5981e7add0a9b07e08cb8fb14c603febb16f
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agotests: unittest: Add new test for hal_common_get_backend_with_library_name 00/276600/3 accepted/tizen_7.0_unified_hotfix tizen_7.0_hotfix accepted/tizen/7.0/unified/20221110.060157 accepted/tizen/7.0/unified/hotfix/20221116.110326 accepted/tizen/unified/20220715.141321 submit/tizen/20220714.022505 submit/tizen/20220715.020027 tizen_7.0_m2_release
Chanwoo Choi [Tue, 21 Jun 2022 15:58:01 +0000 (00:58 +0900)]
tests: unittest: Add new test for hal_common_get_backend_with_library_name

Basically, the hal backend library name of each module is already decied
such as 'libhal-backend-[module name].so'. But, some module requires
the hal backend library loading way with their own library name
like 'libhal-backend-[module name]-lidar.so'.

When loading the their own library name, hal_common_get_backend_with_library_name
and hal_common_put_backend_with_library_name are used.

So that add new for hal_common_get/put_backend_with_library_name
and add 'backend_module_name' attribute to class HalInfo
because 'backend_module_name' is required to check the hal backend name
as I mentioned above.

Change-Id: Idbd5ae4f23714a4efdb857d2a1ed0885a927e887
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agotests: unittest: Add new test for hal_common_get_backend and put_backend function 67/276567/4
Chanwoo Choi [Thu, 16 Jun 2022 03:48:35 +0000 (12:48 +0900)]
tests: unittest: Add new test for hal_common_get_backend and put_backend function

hal_common_get_backend and hal_common_put_backend functions are very
important because they are in charge of loading/unloading the hal
backend library for all hal backends and also verify the validation checking
of the loaded hal backend library. When executing hal_common_get_backend and
hal_common_put_backend, there are very complex validation sequence.

It means that have to verify the internal logic of both
hal_common_get_backend and hal_common_put_backend at the implementation
step in order to catch the error.

So that add new test for hal_common_get_backend and
hal_common_put_backend functions.

Change-Id: I8d42e9327248c283d8f01fc8b5f5926e0d371ba5
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agotests: unittest: Add hook function for handle hal backend library 66/276566/2
Chanwoo Choi [Thu, 16 Jun 2022 05:36:55 +0000 (14:36 +0900)]
tests: unittest: Add hook function for handle hal backend library

The hal-api-common uses the dlopen/dlsym/dlclose to load/unload
the shared library of hal backend and find symbol from hal backend library.
For testing hal-api-common functions when building time, re-implement
dlopen/dlsym/dlclose for hooking.By implementing the hooking functions,
be able to verify the internal logic of hal-api-common functions.

Following fucntions are re-implemented for hooking:
- void *dlopen(const char *filename, int flags)
- int dlclose(void *handle)
- void *dlsym(void *handle, const char *symbol)
- int access(const char *pathname, int mode)

And hal-backend-[module] (e.g., tbm/tdm/audio/camera/devcie/power etc)
have to contain the their own hal_backend structure to implement
the h/w device-dependent hal backend. Instead of adding the each hal_backend
structure for all hal modules, use the common 'hal_backend_module_data'
regardless of hal module name.

Change-Id: Icbcba49a654f9ed1a287233c9cc0e3efcca508df
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agotests: unittest: Rename unitttest name to hal-api-common-unittest 65/276565/1 accepted/tizen/unified/20220622.215415 submit/tizen/20220622.061839
Chanwoo Choi [Thu, 16 Jun 2022 03:12:51 +0000 (12:12 +0900)]
tests: unittest: Rename unitttest name to hal-api-common-unittest

hal-api-common is the official module name. In order to improve
the readability of unittest name, rename to hal-api-common-unittest
as following:
- common-unittest -> hal-api-common-unittest
- CommonHaltest -> HalApiCommonTest

Change-Id: I9a3e1667b76b9fab361fddca3cb052389526f581
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agotests: unittest: Use tab for indentaion instead of space 64/276564/1
Chanwoo Choi [Mon, 13 Jun 2022 09:29:25 +0000 (18:29 +0900)]
tests: unittest: Use tab for indentaion instead of space

In order to improve the readability and keep the consistent indentation style,
use tab instead of space.

Change-Id: Ie8fb6167484dc6fa7e0daa5b395c8a83f9d0b7e0
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agotests: unittests: Rename to test-hal-api-common.cc for using correct name 63/276563/1
Chanwoo Choi [Thu, 16 Jun 2022 01:11:15 +0000 (10:11 +0900)]
tests: unittests: Rename to test-hal-api-common.cc for using correct name

test_hal.cc contains the test code of  hal-api-common funcitons.
In order to pass the correct meaning of file, rename from test_hal.cc
to test-hal-api-common.cc.

Also, rename from test_main.cc to test-main.cc by using '-' instead of
'_'.

Change-Id: Ibf8dd8aebb24ea231b87e4fb7ebad98c01afcd91
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohal-api: common: Do not treat "No such file or directory" as error log 42/276342/6 accepted/tizen/unified/20220622.134045 submit/tizen/20220620.072007
Youngjae Cho [Wed, 15 Jun 2022 04:25:37 +0000 (13:25 +0900)]
hal-api: common: Do not treat "No such file or directory" as error log

There might be an environment that naturally has no hal backend. For
the environment, changed log level to info so that not to be confused
as an error.

Change-Id: Ia458d7ec6c5bc89cbe58a35df0f7d6343bceae66
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
3 years agohal-rpmdb-checker: Fix comment about hal info file 54/275854/1
Seung-Woo Kim [Fri, 3 Jun 2022 05:06:04 +0000 (14:06 +0900)]
hal-rpmdb-checker: Fix comment about hal info file

The hal info file path is /hal/etc/hal-info.ini. Fix the file
path from comment.

Change-Id: I8c8eabefe666872056e1de2b9d87a1976651367e
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agohal-api: common: Check value validation for current platform HAL ABI version 95/274095/3 accepted/tizen/unified/20220422.133442 submit/tizen/20220421.230800
Chanwoo Choi [Thu, 21 Apr 2022 08:01:07 +0000 (17:01 +0900)]
hal-api: common: Check value validation for current platform HAL ABI version

Change-Id: I0b6cf1627f992acc47532553b3588342f58990b6
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohal-api: common: Add support of __x86_64__ architecture 56/274056/1 submit/tizen/20220421.032339
Chanwoo Choi [Wed, 20 Apr 2022 11:16:11 +0000 (20:16 +0900)]
hal-api: common: Add support of __x86_64__ architecture

If architecture type is __x86_64__, use /hal/lib64 path.

Change-Id: Ifee4aebb8a86a4f3ecfe2053b027d20288008067
Reported-by: Sungguk Na <sungguk.na@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: common: Remove unused json-c dependency 84/272684/2 submit/tizen/20220323.085140 submit/tizen/20220324.073713 submit/tizen/20220325.020025
Chanwoo Choi [Tue, 22 Mar 2022 11:02:55 +0000 (20:02 +0900)]
halapi: common: Remove unused json-c dependency

Change-Id: I38a9f5d183e46f2ebee8504d5b2f06f98d79f8b1
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohal-api: common: Update current ABI verion by HAL_ABI_VERSION_TIZEN_7_0 71/271171/1 accepted/tizen/unified/20220221.080307 submit/tizen/20220216.095026 submit/tizen/20220218.075904
Chanwoo Choi [Wed, 16 Feb 2022 09:22:38 +0000 (18:22 +0900)]
hal-api: common: Update current ABI verion by HAL_ABI_VERSION_TIZEN_7_0

Update current ABI verion by HAL_ABI_VERSION_TIZEN_7_0

I expect the all modules will be compatible with
between HAL_ABI_VERSION_TIZEN_6_5 and HAL_ABI_VERSION_TIZEN_7_0.
If not compatible between HAL_ABI_VERSION_TIZEN_6_5 and
HAL_ABI_VERSION_TIZEN_7_0, it should be edited by module owner.

Change-Id: I03f47ad66895f1311d60760fb1833c2dfd4b2e70
Reported-by: Taemin Yeom <taemin.yeom@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: common: Fix unneeded free operation 87/270187/2 accepted/tizen/unified/20220209.131808 submit/tizen/20220208.024112
Chanwoo Choi [Wed, 26 Jan 2022 08:53:46 +0000 (17:53 +0900)]
halapi: common: Fix unneeded free operation

Remove the unneeded free operation because don't allocate
the dynamic memory to 'info->abi_versions'.

Change-Id: I2fc146b7e2ddd03be4c390a832c5a1e0de786b3a
Suggested-by: Taemin Yeom <taemin.yeom@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: common: Fix wrong operation 26/270226/2
Chanwoo Choi [Thu, 27 Jan 2022 01:21:42 +0000 (10:21 +0900)]
halapi: common: Fix wrong operation

Reported-by: Seung-Woo Kim sw0312.kim@samsung.com
Change-Id: I9a33513c00f772ce7f431331817199440181d83e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: common: Remove json unused code 86/270186/1
Chanwoo Choi [Wed, 26 Jan 2022 08:52:50 +0000 (17:52 +0900)]
halapi: common: Remove json unused code

Change-Id: I87aeb68c4af32542a3d3d91da360e89cfb851eb1
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agopackaging: Add some packages as Requires(post) 39/267239/2 accepted/tizen/unified/20211208.121830 submit/tizen/20211207.220750
Jaehoon Chung [Tue, 30 Nov 2021 06:18:54 +0000 (15:18 +0900)]
packaging: Add some packages as Requires(post)

There is a warning message during creating Image.
Fix the below warning message with this patch.

INFO: Installing: hal-api-common-0.0.1-1.armv7l.rpm
/opt/etc/hal: No such file or directory
/opt/etc/hal: No such file or directory
/var/tmp/rpm-tmp.LHK8m3: line 3: systemd-tmpfiles: command not found
warning: %post(hal-api-common-0.0.1-1.armv7l) scriptlet failed, exit status 127
WARNING: (hal-api-common-0.0.1-1.armv7l.rpm) Post script failed

Change-Id: I1ed933f92f2614ae4ea1c4e1e5d07a932b6a558b
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agohalapi: common: Add HAL_ABI_VERSION_TIZEN_7_0 59/265959/1
Jaehoon Chung [Tue, 2 Nov 2021 10:34:10 +0000 (19:34 +0900)]
halapi: common: Add HAL_ABI_VERSION_TIZEN_7_0

Tizen version is updated to TIZEN_7.0.
If there is some case not to support the backward compatible, it needs to
check whether tizen_hal_abi_version is correct or not.

Change-Id: Ie7a4949f0ec3855af6a1e12cd71334b65a7c1f54
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agohaltest: Add net-config and connmand service for wifi-haltest 00/263900/2 accepted/tizen/6.5/unified/20211028.114854 accepted/tizen/unified/20210915.100031 submit/tizen/20210914.030309 submit/tizen_6.5/20211028.163201 tizen_6.5.m2_release
Chanwoo Choi [Mon, 13 Sep 2021 08:11:21 +0000 (17:11 +0900)]
haltest: Add net-config and connmand service for wifi-haltest

wifi-haltests requires the net-config and connmand daemon.
So that add two network daemon service.

Change-Id: I12f3f155fb14e5aff24e70740a6fba5892f3f426
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohaltest: Remove common-haltests from hal-api-common-haltests.rpm 19/263219/2 accepted/tizen/unified/20210907.121846 submit/tizen/20210830.024306 submit/tizen/20210906.072830
Chanwoo Choi [Thu, 15 Jul 2021 03:11:38 +0000 (12:11 +0900)]
haltest: Remove common-haltests from hal-api-common-haltests.rpm

The automatic haltests get the haltest binary by parsing the binary name
with *haltests*' pattern. Actually, common-haltests doesn't need to be
verified because it cannot verify any HAL backend library for hal.img.

Change-Id: Ibe99e4c51a571931c50768f89e64c94481adc61c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Add ENABLE_DLOG build option 35/262835/1 accepted/tizen/unified/20210827.045711 submit/tizen/20210825.032704 submit/tizen/20210826.082453
Chanwoo Choi [Fri, 20 Aug 2021 03:40:40 +0000 (12:40 +0900)]
halapi: Add ENABLE_DLOG build option

Add ENABLE_DLOG build option to support the case of
when DLOG should be disabled.

Also, if don't require dlog, hal-api-common is not able to use
tizen error value. So that change the error value to make it
minimum package dependency.

Change-Id: I52766750c3b8b547dbc9e2576e0e9a8b3d2b1232
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohal-rpmdb-checker: Add capability for /opt/etc/hal path 49/262749/1 accepted/tizen/unified/20210820.101814 submit/tizen/20210819.080213
Chanwoo Choi [Thu, 19 Aug 2021 06:40:22 +0000 (15:40 +0900)]
hal-rpmdb-checker: Add capability for /opt/etc/hal path

hal-rpmdb-checker.service has used /opt/etc/hal path in order to create
the files for both checking the platform booting is first booting and
hal rpmdb version are matched or not. So that /opt/etc/hal patch
should be set with the proper capability with UID/GID/Smack lable.

Change-Id: I07bec1b2f824d8a0114659346bab09911f863e42
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Delete unused code to make directory 99/261899/1 accepted/tizen/unified/20210803.123918 submit/tizen/20210729.015437
Seungha Son [Wed, 28 Jul 2021 11:31:17 +0000 (20:31 +0900)]
halapi: Delete unused code to make directory

 %{TZ_SYS_RO_ETC}/hal is not used directory then
 delete unused behavior to keep clean code.

Change-Id: Icc7a1085ab42fc2018ab5deb5e29bd5e983a8fea
Signed-off-by: Seungha Son <seungha.son@samsung.com>
3 years agohalapi: Remove build warning due to misused 'const' keyword 11/261511/1 accepted/tizen/unified/20210721.123533 submit/tizen/20210721.013304
Chanwoo Choi [Tue, 20 Jul 2021 09:17:18 +0000 (18:17 +0900)]
halapi: Remove build warning due to misused 'const' keyword

Remove the following build warning due to misused 'const' keyword.

[Build warning message]
[ 11%] Building C object CMakeFiles/hal-api-common.dir/src/hal-api-common.c.o
[ 22%] Building C object CMakeFiles/hal-api-common.dir/src/hal-api-conf.c.o
/home/abuild/rpmbuild/BUILD/hal-api-common-0.0.1/src/hal-api-common.c:
In function '__get_backend_library_data':
/home/abuild/rpmbuild/BUILD/hal-api-common-0.0.1/src/hal-api-common.c:684:9:
warning: passing argument 1 of 'g_free' discards 'const' qualifier
from pointer target type [-Wdiscarded-qualifiers]
  684 |  g_free(backend_module_name);

Change-Id: I8576581f3a40d140293fbbc62433107a25a9998b
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Remove libtzplatform-config dependency 10/261510/1
Chanwoo Choi [Tue, 20 Jul 2021 09:15:12 +0000 (18:15 +0900)]
halapi: Remove libtzplatform-config dependency

Change-Id: I7b57ca09374ac2648939ab4fdd415401fe7c00e2
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Add new helper functions to get multiple library names 39/261139/5 accepted/tizen/unified/20210714.014120 submit/tizen/20210713.080137
Chanwoo Choi [Tue, 6 Jul 2021 09:21:49 +0000 (18:21 +0900)]
halapi: Add new helper functions to get multiple library names

In order to get the multiple library namse on device,
add new helper function as following. Firstly, get the number of HAL
backend libraries hal_common_get_backend_count() and the get the library
names by hal_common_get_backend_library_names().

- Get the number of the backend libraries according to the type of HAL module
int hal_common_get_backend_count(enum hal_module module);

- Get the backend library names according to the type of HAL module
int hal_common_get_backend_library_names(enum hal_module module,
                                       char **library_names,
                                       int library_count,
                                       int library_name_size);

Change-Id: If6ecc2f550693768e6e63a572dd99c791984e596
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Add new backend_module_name information 38/261138/3
Chanwoo Choi [Tue, 6 Jul 2021 11:02:12 +0000 (20:02 +0900)]
halapi: Add new backend_module_name information

Change-Id: I186359becfb908d3bd8bb78efc741da3daa87001
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Don't install hal-api.json 55/260155/1 accepted/tizen/unified/20210625.170417 submit/tizen/20210622.012446 submit/tizen/20210624.100841
Chanwoo Choi [Mon, 21 Jun 2021 09:23:14 +0000 (18:23 +0900)]
halapi: Don't install hal-api.json

hal-api.json is not used because of package dependcency issue.
Until fixing the issue, don't install hal-api.json.

Change-Id: Iaafaef11db0ae3a3d5a58812e679b3b1f4716f08
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohal-rpmdb-checker: Remove systemd-tmpfiles-setup.service dependency 49/260149/1
Chanwoo Choi [Mon, 21 Jun 2021 09:18:46 +0000 (18:18 +0900)]
hal-rpmdb-checker: Remove systemd-tmpfiles-setup.service dependency

When checking hal rpmdb dependency, systemd-tmpfiles.setup.service is
not necessary. Also, if add the dependency of systemd-tmpfiles.setup.service
to hal-rpmdb-checker.service, affect the booting time.
So that remove systemd-tmpfiles-setup.service dependency
from systemd-tmpfiles-setup.service

Change-Id: I25bc49c42b6edc81cf072ec133f8123f54b0adf9
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalimg: Add hal-rpmdb-checker.service to check rpm version compatibility 95/258895/3
Chanwoo Choi [Thu, 29 Apr 2021 03:14:16 +0000 (12:14 +0900)]
halimg: Add hal-rpmdb-checker.service to check rpm version compatibility

For removing the h/w dependency from Tizen core image, decide to create
Tizen core image (core.img) and hal.img separately. It means that each
image is able to be built on different build time. So that in order to
guarnatee the compatibility between images, must need to check
the version compatiblity of rpm packages of hal backend packages in hal.img.

hal-rpmdb-checker.service will check the  the version compatiblity
between core.img and hal.img on booting time.

If there are no problem between images, hal-rpmdb-checker script
will create /opt/etc/hal/.hal-img-version.ini with hal.img build
information. Also, after writing the core.img, hal-rpmdb-checker
script will create /opt/etc/hal/.first-booting file to distinguish
whether booting is first or not.

Exmaple of /opt/etc/hal/.hal-img-version.ini
$cat /opt/etc/hal/.hal-img-version.ini
tizen-6.5-unified-gbm_20210525.030006;

Change-Id: I06c740d48478eae6671cec555e627e58e06ea119
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agohalapi: Fix svace issue when accessing hal-backend file 48/259948/1 accepted/tizen/unified/20210617.124845 submit/tizen/20210617.022719
Chanwoo Choi [Thu, 17 Jun 2021 02:13:13 +0000 (11:13 +0900)]
halapi: Fix svace issue when accessing hal-backend file

Fix savce TOCTOU[1] issue

[1] https://wiki.sei.cmu.edu/confluence/display/c/FIO45-C.+Avoid+TOCTOU+race+conditions+while+accessing+files

Change-Id: I20e8724afd5d27eb466223315fab11ebc9faf77c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agohaltest: Change dmverity command according to the change of dmverity guide 43/259643/1
Chanwoo Choi [Wed, 2 Jun 2021 08:01:13 +0000 (17:01 +0900)]
haltest: Change dmverity command according to the change of dmverity guide

Change-Id: Ibcd023abdddea80bee7323ac841da1fc9809c570
Reported-by: INSUN PYO <insun.pyo@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agohalapi: Add new functions to get information of hal_backend structure 16/257516/4 accepted/tizen/unified/20210429.011907 submit/tizen/20210428.073114
Chanwoo Choi [Mon, 26 Apr 2021 10:06:56 +0000 (19:06 +0900)]
halapi: Add new functions to get information of hal_backend structure

The hal-api-common defines the common hal_backend structure for all hal
backend driver. Add new functions to provide the information of
hal_backend structure because of user request. Add the detailed function
roles as following:

[Newly added functions]
- hal_common_get_backend_abi_version(enum hal_module module);
  : Get the backend HAL ABI version according to the type of HAL module

- hal_common_get_backend_name(enum hal_module module, char *name, int size);
  : Get the backend name according to the type of HAL module

- hal_common_get_backend_vendor(enum hal_module module, char *vendor, int size);
  : Get the backend vendor description according to the type of HAL module

Change-Id: I2060e9047b60c029e161dc18f3981185a0f724a1
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agohalapi: Split the internal functions finely to get flexibility 15/257515/3
Chanwoo Choi [Thu, 22 Apr 2021 10:12:04 +0000 (19:12 +0900)]
halapi: Split the internal functions finely to get flexibility

New functions will use only __open_backend() without __close_backend()
in order to get the data of hal_backend structure. But this code have
been tightly coupled implemented in __get_backend and __put_backend.
In order to make the code more flexibility, split __get_backend/__put_backend
finley to two steps such as open/close and init/exit.

[Simple description for functions]
- __open_backend() : Open backend library and get backend symbol
- __close_backend() : Close backend library
- __init_backend() : After getting backend, initialize HAL backend driver
- __exit_backend() : After getting backend, exit HAL backend driver
- __get_backend()
__open_backend()
__init_backend()
Increase usage_count
- __put_backend()
__exit_backen()
__close_backend()
Decrease usage_count

[Change variable name in struct __hal_module_info]
- library_backend -> backend
- library_handle -> handle

Change-Id: I358e3f4db1991d26c8cf0498b3f37ec543da3e38
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agohalapi: Show process name when using hal-api library 14/257514/1
Chanwoo Choi [Fri, 23 Apr 2021 07:02:45 +0000 (16:02 +0900)]
halapi: Show process name when using hal-api library

The hal-api library are used by the various process.
In order to support the easy debugging, show the process name
who get/put the hal-api library.

Example log with process name,
HAL_MODULE_TBM: Get HAL backend: name(vc4)/vendor(Samsung)/library(/hal/lib64/libhal-backend-tbm.so)/count(1) by /usr/bin/enlightenment
HAL_MODULE_TBM: Get HAL backend: name(vc4)/vendor(Samsung)/library(/hal/lib64/libhal-backend-tbm.so)/count(1) by /usr/bin/boot-animation

Change-Id: I7befe874d17585cfffc79e05e32f90f1edcb284d
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agohalapi: conf: Remove unused local variables 13/257513/1
Chanwoo Choi [Thu, 22 Apr 2021 09:33:36 +0000 (18:33 +0900)]
halapi: conf: Remove unused local variables

Change-Id: Iab9597b3bd4d2bbfc258d62ca1302f8ba64169a4
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agohalapi: Encapsulate unused variables by external user 12/257512/1
Chanwoo Choi [Wed, 21 Apr 2021 12:02:43 +0000 (21:02 +0900)]
halapi: Encapsulate unused variables by external user

The following variables are only used in hal-api-common
without exposing for external user. So that move them into internal
header files for encapsulation.
- enum hal_license
- enum hal_group
- char *const hal_group_string[]
- char *const hal_module_string[]

Change-Id: I18643fdbbabcabee7b6aefadff1ba36c8dc3a0fa
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agohalapi: Get backend library name always regardless of usage_count 11/257511/1
Chanwoo Choi [Wed, 21 Apr 2021 11:48:59 +0000 (20:48 +0900)]
halapi: Get backend library name always regardless of usage_count

The backend_library_name value is necessary to show the backend library
name always. So that get backend library name always regardless of usage_count
and then print 'close' message when close the fd of backend library.

Change-Id: I338bf22ac678bc80ceab020c7fd0c1ca1662254b
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agohalapi: Replace fPIE gcc option with fPIC 76/257276/2
Chanwoo Choi [Thu, 22 Apr 2021 05:19:35 +0000 (14:19 +0900)]
halapi: Replace fPIE gcc option with fPIC

The fPIE option is for the executable binary.
It is not proper for shared library files.
So that correct the wrong use-case by using fPIC.

Change-Id: Id27d4a31080477415d9bc2bbaa0210039ff27233
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agohaltest: Add haltest.target to support HAL TEST mode 43/255743/9 accepted/tizen/unified/20210330.111243 submit/tizen/20210325.061957 submit/tizen/20210330.004535
Chanwoo Choi [Tue, 23 Mar 2021 08:25:16 +0000 (17:25 +0900)]
haltest: Add haltest.target to support HAL TEST mode

In order to support HAL TEST Mode, add haltest.target which requires
the least running processes for only haltest such as sdbd service.
So that haltest.target is based on getty.target to support the console
and then add deviced.service/ac.service for supporting sdbd service.

And reboot-haltest/reboot-normal scripts are for switching between normal
mode and HALTEST mode.

[Essential service list in haltest.target]
- dbus.service for /usr/bin/dbus-daemon
- serial-getty@.service for console
- dlog_logger.service for /usr/bin/dlog_logger
- systemd-udevd.service for /usr/lib/sytemd/sytemd-udevd
- systemd-journald.service for /usr/bin/systemd/systemd-journald
- ac.service for /usr/bin/amd is requied for deviced.service
- deviced.service for /usr/bin/deviced is required for sdbd.service
- sdbd.service for /usr/sbin/sdbd

[Script commands to switch between Normal and HALTEST mode]
- reboot-haltest switches from Normal to HALTEST mode.
- reboot-normal switches from HALTEST to Normal mode.

Change-Id: If8fdd240003cf3509cec5f83bf8aacb3bc1a5ec6
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agohalapi: Fix svace warning issue 62/255662/1 accepted/tizen/unified/20210324.124404 submit/tizen/20210323.015555
Chanwoo Choi [Mon, 22 Mar 2021 07:54:53 +0000 (16:54 +0900)]
halapi: Fix svace warning issue

Change-Id: I29f2405f1412a99066ae248c1a98f14cf6b30af9
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agohalapi: Remove unneeded function definition from header file 49/255249/2 accepted/tizen/unified/20210317.034405 submit/tizen/20210316.021632 submit/tizen/20210316.040120
Chanwoo Choi [Tue, 16 Mar 2021 00:33:10 +0000 (09:33 +0900)]
halapi: Remove unneeded function definition from header file

_destroy_module_info() function is not used on outside of
hal-api-conf.c. So that remove the unneeded function defintion.

Change-Id: I13b17dcc8592d0a0a1c0d392eda9a9c13dd76155
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agohalapi: Replace hal-api.json with hal-api-list.h 11/255211/4
Chanwoo Choi [Mon, 15 Mar 2021 06:02:54 +0000 (15:02 +0900)]
halapi: Replace hal-api.json with hal-api-list.h

When using hal-api.json, the segmentation falut happen when trying
to use json-c library because of some library including json-c
statically. In order to fix this issue rapily, use the 'hal-api-list.h'
temporarily instead of 'hal-api.json'.

After fixing this issue, revert this patch for using 'hal-api.json'.

Change-Id: I22ba800b536e974879cbfa758f9160b896813c63
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agohalapi: Add new get_backend and put_backend with specific library name 98/254798/6 submit/tizen/20210316.010905
Chanwoo Choi [Tue, 9 Mar 2021 05:01:59 +0000 (14:01 +0900)]
halapi: Add new get_backend and put_backend with specific library name

Basically, hal_common_get_backend has used the promised libray name
for HAL backend like 'libhal-backend-[moodule name].so'. But, there are
some requirements that need to select the one HAL backend among the
multiple HAL backends on same device according to the role of use.

So that add the following two functions with new library_name argument.
- int hal_common_get_backend_with_library_name(enum hal_module module,
void **data, const char *library_name);
- int hal_common_put_backend_with_library_name(enum hal_module module,
void *data, const char *library_name);

[Constraints of library name]
This library_name argument must keep the naming rule as following:
-  'libhal-backend-[moodule name]-[extented name].so

Change-Id: Ia6c69597a718f5a4ae9de2f879f7c4337874b1ee
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>