platform/core/api/peripheral-io.git
11 months agouart: Change version 7.5 to 8.0 02/292802/1 accepted/tizen_8.0_unified accepted/tizen_unified tizen tizen_8.0 accepted/tizen/8.0/unified/20231005.092817 accepted/tizen/unified/20230608.164339 tizen_8.0_m2_release
TaeminYeom [Mon, 15 May 2023 05:08:25 +0000 (14:08 +0900)]
uart: Change version 7.5 to 8.0

Because of changing of Tizen versioning policy,
new Tizen version is 8.0, not 7.5

So, modify description in added APIs and enum as 7.5.

Change-Id: I826ab0059f68ceb077a4c9f1db2a4a46db0dc9c7
Signed-off-by: TaeminYeom <taemin.yeom@samsung.com>
13 months agoFix typo in header decription 85/290385/1 accepted/tizen/unified/20230325.044635
TaeminYeom [Fri, 24 Mar 2023 01:37:06 +0000 (10:37 +0900)]
Fix typo in header decription

-out -> in (peripheral_uart_read function parameter)
-siginificant -> significant (peripheral_spi_bit_order_e enum)

Change-Id: I3724599f41f77ed5378ffe50213cf9d714af2362
Signed-off-by: TaeminYeom <taemin.yeom@samsung.com>
13 months agoFix retval order in API description 64/290264/4
TaeminYeom [Wed, 22 Mar 2023 07:20:02 +0000 (16:20 +0900)]
Fix retval order in API description

Native API Design Guidline of retval order is below.
-ERROR_NONE
-NOT_SUPPORTED
-PERMISSION_DENIED
-INVALID_PARAMETER
-(others)

Change-Id: I5d4598b87598ab83601e32d5d1f1e87796352bbc
Signed-off-by: TaeminYeom <taemin.yeom@samsung.com>
13 months agoRun apply-peripheral-io-perms with predefined $PATH 55/290355/2
Karol Lewandowski [Thu, 23 Mar 2023 11:12:31 +0000 (12:12 +0100)]
Run apply-peripheral-io-perms with predefined $PATH

Be sure what tools we actually call.

Change-Id: I97a790b30c82661585809a99548aea780158fafd

13 months agocommon: Add permission denied return value 50/290150/2 accepted/tizen/unified/20230322.080549
TaeminYeom [Tue, 21 Mar 2023 01:48:29 +0000 (10:48 +0900)]
common: Add permission denied return value

When apps attempt to open, read or write the device node without permission,
API should return PERIPHERAL_ERROR_PERMISSION_DENIED.
So, add it in CHECK_ERROR macro.

Change-Id: I862da7c08d96fd1506b89834a5721832f7e42ea1
Signed-off-by: TaeminYeom <taemin.yeom@samsung.com>
13 months agoPrivilege: Set ADC device nodes privilege 80/290080/4 accepted/tizen/unified/20230321.123152
TaeminYeom [Mon, 20 Mar 2023 06:01:18 +0000 (15:01 +0900)]
Privilege: Set ADC device nodes privilege

To check privilege, device nodes should be owned by "priv_peripheralio" group.
But ADC device nodes have not been owned, so add it.

Change-Id: I19a2cb4054cd56378768a4c5a94fe113c0bf3151
Signed-off-by: TaeminYeom <taemin.yeom@samsung.com>
13 months agoRevert "Add privilege check in all public APIs" 79/290079/1
TaeminYeom [Thu, 16 Mar 2023 07:33:59 +0000 (16:33 +0900)]
Revert "Add privilege check in all public APIs"

Checking privilege has been done by device nodes DAC.
So, checking code is not needed.

This reverts commit e1eb7906a9c4496e7b4fa89544ae500cbf7d615a.

Change-Id: Ia872c5d4b7b6c8b376e2254a79544a5f0bc3ff5b

13 months agogpio: Change to call flock with void type conversion 19/289519/1 accepted/tizen/unified/20230313.022859
TaeminYeom [Thu, 9 Mar 2023 06:04:28 +0000 (15:04 +0900)]
gpio: Change to call flock with void type conversion

In the API "gpio_modern_set_direction_xor_edge_mode",
After flock fd and set edge mode or direction, unlock fd.
This API doesn't use the return value of unlock and use
the return of setting edge mode or direction.
So, in calling fd unlock, change to call with void type conversion.

Change-Id: I7219b666e8779f74e4bff0978835e6b29af79269
Signed-off-by: TaeminYeom <taemin.yeom@samsung.com>
14 months agouart: change to call uart flush with void return type 67/289167/1
TaeminYeom [Thu, 2 Mar 2023 07:18:22 +0000 (16:18 +0900)]
uart: change to call uart flush with void return type

In commit e14fc739d7de ("uart: Add nonblocking IO and assorted functions")
peripheral_uart_flush function's return type was changed void to int
And, other functions using it were changed to call it with (void) type coversion
because previous code didn't check the return of flush function.
But in close function, it was ommited so add it.

Change-Id: I0f89fc71d8c4bd76a3768f2bdc96cfd52a10c2ff
Signed-off-by: TaeminYeom <taemin.yeom@samsung.com>
14 months agoAdd privilege check in all public APIs 79/288979/4
TaeminYeom [Mon, 27 Feb 2023 06:22:52 +0000 (15:22 +0900)]
Add privilege check in all public APIs

Previous checking privilege was done by peripheral-bus daemon.
After changing to use direct API, it was needed to add code
checking privilege but it was not added.

Change-Id: Ib893f5fe71995f3cb5e54a0dcf196057af1f09b9
Signed-off-by: TaeminYeom <taemin.yeom@samsung.com>
14 months agoAdd description nonblock open flag 65/288665/2 accepted/tizen/unified/20230223.162155
TaeminYeom [Tue, 21 Feb 2023 07:48:29 +0000 (16:48 +0900)]
Add description nonblock open flag

PERIPHERAL_OPEN_FLAGS_NONBLOCK is availble for only uart open.
So, to prevent to use it in i2c open, add description.

Change-Id: I7614a2b9ea1c96dd84069d75a29bb4d5e064d5d4
Signed-off-by: TaeminYeom <taemin.yeom@samsung.com>
14 months agoRelease 0.4.0 90/288290/1 accepted/tizen/unified/20230215.155624
Karol Lewandowski [Tue, 14 Feb 2023 14:53:07 +0000 (15:53 +0100)]
Release 0.4.0

Change-Id: Ie001a38833ca070955173c2e466393385509b590

14 months agoEnsure only public symbols are exported 89/288289/1
Karol Lewandowski [Tue, 14 Feb 2023 14:51:44 +0000 (15:51 +0100)]
Ensure only public symbols are exported

Change-Id: I976e472ea46293ede86cae7205b4735091e434f1

14 months agoSkip some I2C tests if stub driver cannot be found 01/287201/3
Antoni Adaszkiewicz [Tue, 24 Jan 2023 16:31:22 +0000 (17:31 +0100)]
Skip some I2C tests if stub driver cannot be found

Some I2C tests can behave as expected even if stub driver cannot be
found. Prevoiusly, these tests would not be run, now they will (with
suitable info displayed).

Change-Id: I48a439dd7d99f3d18b71878618f1b034a414e017

14 months agoAdd tests for new drain and flush functions in UART api 00/287200/3
Antoni Adaszkiewicz [Tue, 24 Jan 2023 16:29:47 +0000 (17:29 +0100)]
Add tests for new drain and flush functions in UART api

Change-Id: I7ec9d9b0893f1628c96e23c41b7119f3e01bd51b

14 months agoFix misleading output messages 74/286774/4
Antoni Adaszkiewicz [Thu, 12 Jan 2023 14:31:08 +0000 (15:31 +0100)]
Fix misleading output messages

Change-Id: I2ccea575a7608f0238e29f06f409f2f102f27cef

14 months agoAllow rpi3/rpi4 ADC tests to pass initialization 73/286773/4
Antoni Adaszkiewicz [Thu, 12 Jan 2023 13:23:40 +0000 (14:23 +0100)]
Allow rpi3/rpi4 ADC tests to pass initialization

Change-Id: I97a438605315c78d256e0328b18e5fdcce1e8368

14 months agoEnable GPIO tests for rpi4 72/286772/4
Antoni Adaszkiewicz [Thu, 12 Jan 2023 13:20:44 +0000 (14:20 +0100)]
Enable GPIO tests for rpi4

Change-Id: Icd06acd96a4059da322431afd81af14d652a5a28

14 months agouart: Add nonblocking IO and assorted functions 14/286314/3
Karol Lewandowski [Mon, 2 Jan 2023 16:23:55 +0000 (17:23 +0100)]
uart: Add nonblocking IO and assorted functions

This commits extends UART API with following:

 * additional nonblocking variants of the peripheral_open_flags_e for use
   in peripheral_open_with_flags():
   - PERIPHERAL_OPEN_FLAGS_PRIVATE_NONBLOCK
   - PERIPHERAL_OPEN_FLAGS_SHARED_NONBLOCK

 * peripheral_uart_drain() and peripheral_uart_flush() API functions

Change-Id: I4fe45ff8a2115e954244affe16818aa5b9710e47

2 years agopackaging: hotfix the udev rules 32/270632/2
Mateusz Majewski [Mon, 7 Feb 2022 06:33:18 +0000 (07:33 +0100)]
packaging: hotfix the udev rules

I have no idea how did this work in first place.

Change-Id: I775ed415f26df23f9542aa532691eba38c1f3b9c

2 years agoRelease 0.3.2 88/270588/1 submit/tizen/20220204.140035
Karol Lewandowski [Fri, 4 Feb 2022 13:47:43 +0000 (14:47 +0100)]
Release 0.3.2

Change-Id: I6938fb0972728be57b3c5f7a2b2f41124708755b

2 years agopackaging: only apply rule if file exists 37/270537/2
Mateusz Majewski [Fri, 4 Feb 2022 07:34:42 +0000 (08:34 +0100)]
packaging: only apply rule if file exists

Change-Id: I8b29a8ea266c98672080436854e9fe3c0ce44b5e

2 years agouart: remove O_NONBLOCK flag 26/267726/3 accepted/tizen_7.0_unified_hotfix tizen_7.0_hotfix accepted/tizen/7.0/unified/20221110.060853 accepted/tizen/7.0/unified/hotfix/20221116.104803 accepted/tizen/unified/20211210.115150 submit/tizen/20211209.090954 tizen_7.0_m2_release
INSUN PYO [Thu, 9 Dec 2021 08:06:53 +0000 (17:06 +0900)]
uart: remove O_NONBLOCK flag

Sometimes, peripheral_uart_read() returns -EAGAIN.
If you retry it many times, it returns correct value.

Change-Id: I2a7f9aacc7d0ca47ca06cca52382c0185c76f4fb

2 years agoudev_rules: add ttyHS[0-9]* udev rules for UART device 33/267733/1
INSUN PYO [Thu, 9 Dec 2021 08:40:27 +0000 (17:40 +0900)]
udev_rules: add ttyHS[0-9]* udev rules for UART device

Change-Id: I2d9fc626311b59a7441c04ab636c9a02a4772b2c

2 years agoApply device nodes permission for new-style gpio and (legacy) uart 80/264380/3 accepted/tizen/6.5/unified/20211028.095416 accepted/tizen/unified/20210920.131400 submit/tizen/20210917.104742 submit/tizen_6.5/20211028.161801 tizen_6.5.m2_release
Karol Lewandowski [Thu, 16 Sep 2021 17:59:15 +0000 (19:59 +0200)]
Apply device nodes permission for new-style gpio and (legacy) uart

Change-Id: I2c0aa73a0a3bf70470aaf89579b3a32874342ac0

2 years agoFix a pointless check / race condition 51/263451/3 accepted/tizen/unified/20210914.053344 submit/tizen/20210910.102518
Michal Bloch [Thu, 2 Sep 2021 19:01:31 +0000 (21:01 +0200)]
Fix a pointless check / race condition

Using the open() call already tells us whether the file exists,
so there is little point checking that separately. Additionally
it's a minor race condition (the file can stop existing between
the calls, though no harm done in this particular case).

Add some commentary as well because the chunk is a bit confusing.

Change-Id: I8c3469aaddac2b30d9f60c0ce65abcb3bd9847b9
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agogpio: fix deallocator mismatch 72/262872/1
Youngjae Cho [Mon, 23 Aug 2021 01:40:50 +0000 (18:40 -0700)]
gpio: fix deallocator mismatch

Change-Id: Ia613bf7bb89d566245bb22103067d3e69ce9190c
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
2 years agogpio: use g_free instead of free 34/262834/1 accepted/tizen/unified/20210824.123804 submit/tizen/20210820.100048
Adrian Szyndela [Fri, 20 Aug 2021 09:40:36 +0000 (11:40 +0200)]
gpio: use g_free instead of free

Use g_free instead of free for data allocated by glib.

Change-Id: I7f5743e741a838c9e8ce32a2bbb3152cd88db4e0

2 years agogpio: eliminate file descriptor leak 30/262830/1
Adrian Szyndela [Fri, 20 Aug 2021 08:34:29 +0000 (10:34 +0200)]
gpio: eliminate file descriptor leak

Once in the loop, fd_chip can be left unclosed if configuration file
does not match the system and next iteration is required.

This commit makes fd_chip closed just at the end of the current iteration,
before entering another iteration.

Change-Id: I8d7102ba01d0ca30d63e5b634199792368a98297

2 years agopackaging: bump version to 0.3.0 76/262476/2 accepted/tizen/unified/20210816.122834 submit/tizen/20210813.142813
Mateusz Majewski [Wed, 11 Aug 2021 11:18:59 +0000 (13:18 +0200)]
packaging: bump version to 0.3.0

Change-Id: I8d4865e4fc4450aefaf323efe2c2ec92711f698d

2 years agoAdd RPi4 to tests 27/262227/2
Michal Bloch [Wed, 4 Aug 2021 13:12:10 +0000 (15:12 +0200)]
Add RPi4 to tests

Change-Id: I98a9b186ff5039b2ce3adc906c927714c364f4e3
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoFix some miscellaneous flaws in the code. 26/262226/2
Michal Bloch [Tue, 3 Aug 2021 18:05:53 +0000 (20:05 +0200)]
Fix some miscellaneous flaws in the code.

Change-Id: I031b94add3465970352700a4ac8596e30b7f89ec
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agogpio: switch to new kernel API 25/261025/12
Adrian Szyndela [Thu, 22 Jul 2021 10:17:58 +0000 (12:17 +0200)]
gpio: switch to new kernel API

Change-Id: I628b7e88578f079d21d24513a1ecdfb3ee6ee255

2 years agogpio: encapsulate legacy kernel API usage 80/261580/7
Mateusz Majewski [Thu, 22 Jul 2021 06:53:42 +0000 (08:53 +0200)]
gpio: encapsulate legacy kernel API usage

Not useful by itself, but allows us to move to the new kernel API step
by step.

Change-Id: I23f224b091dbc600172fb38da4d55ab2bbc17636

2 years agogpio: don't allow direction change if there is poll/callback set 56/261656/5
Adrian Szyndela [Thu, 22 Jul 2021 06:53:12 +0000 (08:53 +0200)]
gpio: don't allow direction change if there is poll/callback set

This was missing. The function that sets the callback
(peripheral_gpio_set_interrupted_cb())
exits with error if the direction is not "in". Therefore,
the callback makes sense only when the direction is "in".
Therefore, we don't want to allow changing the direction if there
is a callback set.

Change-Id: Ib21746ee4c32706a4114a76fbd0f6bd80bc9b787

2 years agogpio: import new kernel API 46/262446/3
Mateusz Majewski [Wed, 11 Aug 2021 05:38:55 +0000 (07:38 +0200)]
gpio: import new kernel API

Import the kernel header representing the new GPIO kernel API.

For the record, this file comes from the
git://git.tizen.org/platform/kernel/linux-rpi3.git repository, from the
cec42e0a4e9704d1f428e96cb4f5e1902a6e2b11 commit.

Change-Id: I043cf329864f9f0892ed42c196b27c4f0be8df3c

2 years agouart: allow whitespace in config 54/261754/1 submit/tizen/20210805.103313
Adrian Szyndela [Fri, 23 Jul 2021 11:39:20 +0000 (13:39 +0200)]
uart: allow whitespace in config

Add spaces to the format string on the sides of the '=' char, to allow
any amount of whitespace, including none.
For example, all below lines are valid now:
17=/dev/ttyS0
17 =/dev/ttyS0
17= /dev/ttyS0
17 = /dev/ttyS0
17       =     /dev/ttyS0

Change-Id: I3369880b89ba865c3b3638f9874788a7eaf60580

2 years agoRemove GIO 04/261504/1
Mateusz Majewski [Tue, 20 Jul 2021 07:53:02 +0000 (09:53 +0200)]
Remove GIO

It seems we only needed it for GDbus.

Change-Id: Id50176585159085ec4d0013c1337c8fbbeb8079f

2 years agotest: add performance tests 47/260847/1
Adrian Szyndela [Mon, 5 Jul 2021 11:52:38 +0000 (13:52 +0200)]
test: add performance tests

Change-Id: Idd8f4989e4d630ca13f9d1c81cf5c7ba6ec70084

2 years agouart: try to open uart based on uart.ini 53/260753/2 accepted/tizen/unified/20210705.125135 submit/tizen/20210705.023617
Youngjae Cho [Fri, 2 Jul 2021 06:19:20 +0000 (15:19 +0900)]
uart: try to open uart based on uart.ini

Now try once to find which devpath corresponds to a port number. It is
specified in /hal/etc/peripheral-io/uart.ini. For example, if the
uart.ini contains
  [UART]
  0=/dev/ttyS0
then it returns "/dev/ttyS0" as devpath of the port number 0.
If the above process fail, follow normal opening routine.

Change-Id: Icec9d6601387f7f135b6e1a8692915553014ae8c
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
2 years agopwm: fix potential segfault 90/260690/3
Youngjae Cho [Thu, 1 Jul 2021 06:48:33 +0000 (15:48 +0900)]
pwm: fix potential segfault

Change-Id: I304ccf87409fea57abcde3329693416891a92ed8
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
2 years agoLinting: buffer size safety 11/260611/2
Michal Bloch [Tue, 29 Jun 2021 18:34:57 +0000 (20:34 +0200)]
Linting: buffer size safety

Make sure the buffer's actual size is used. This safeguards against
somebody changing the size of the buffer but forgetting to change
the value that gets passed as its size to other functions.

Change-Id: I12c78acf56daf55a785e9c994ca70ed34a38a1de

2 years agoLinting: improve some loop code 10/260610/2
Michal Bloch [Tue, 29 Jun 2021 18:33:04 +0000 (20:33 +0200)]
Linting: improve some loop code

Prevent signed/unsigned comparison in the loop condition
and reduce pyramidity.

Change-Id: I20a24f37810726d08a60a2791d1e2f8d7695b962

2 years agoLinting: storage and const correctness 09/260609/2
Michal Bloch [Tue, 29 Jun 2021 18:22:46 +0000 (20:22 +0200)]
Linting: storage and const correctness

Change-Id: I0c52f2e1e0642e1bbb48d3a02cb7f4cec6991747
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoMinor improvements to the udev polling loop. 08/260608/2
Michal Bloch [Tue, 29 Jun 2021 18:17:54 +0000 (20:17 +0200)]
Minor improvements to the udev polling loop.

Change-Id: I068e2cbfe0243221f879961bb19ae8ea5e9b65f3

2 years agoLinting: improve variable scoping 07/260607/2
Michal Bloch [Tue, 29 Jun 2021 18:03:43 +0000 (20:03 +0200)]
Linting: improve variable scoping

Declare variables at their first site of use where possible, especially
those with the cleanup attribute, but also some arrays that have to be
zeroed before use. This way we won't have wasted time preparing them if
an earlier step fails.

Change-Id: Ic46bdd38915f709bac37c7bfff9ba6dcb19f7657

2 years agoLinting: reduce type repetition 06/260606/2
Michal Bloch [Tue, 29 Jun 2021 17:52:50 +0000 (19:52 +0200)]
Linting: reduce type repetition

Makes sure that the pointer and the pointee have the same type,
which is both less error-prone and more convenient.

Change-Id: I48887b4594a4bf2fcb2816f32ce4bc1e24bcffa8
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
2 years agoAdd .gitignore 22/260622/1
Hyotaek Shim [Wed, 30 Jun 2021 02:04:26 +0000 (11:04 +0900)]
Add .gitignore

Change-Id: Ife812dcdcee519dee22ec99b38616e8405f2c5eb
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
2 years agoRemove Conflicts: peripheral-bus to fix MIC errors 21/260621/2 accepted/tizen/unified/20210630.015242 submit/tizen/20210630.020200
Hyotaek Shim [Wed, 30 Jun 2021 01:59:40 +0000 (10:59 +0900)]
Remove Conflicts: peripheral-bus to fix MIC errors

Change-Id: I4d6435989b48c669330fae2f598790a51b6e73d0
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
2 years ago0.2.0: allow direct IO for clients in priv_peripheralio group 34/260034/5 accepted/tizen/unified/20210630.005908 submit/tizen/20210629.012223 submit/tizen/20210629.111329
Karol Lewandowski [Thu, 17 Jun 2021 22:38:19 +0000 (00:38 +0200)]
0.2.0: allow direct IO for clients in priv_peripheralio group

The priv_periperalio will be granted automatically for all apps having the
http://tizen.org/privilege/peripheralio privilege.

This bumps up the release number to 0.2.0.

Change-Id: I35bb10d72820c5696aed6842fd2ee92a51aa9bab

2 years agoAdd API function to open UART device with flags 38/260538/1 submit/tizen/20210629.011533
Adrian Szyndela [Mon, 28 Jun 2021 11:43:00 +0000 (13:43 +0200)]
Add API function to open UART device with flags

Extract translation from peripheral_open_flags to flock()'s lock type.

Change-Id: Ifcb933a70c30f077b55facd3f78ea5c3c47298e9

2 years agoname magic numbers in poll() calls 21/260521/3
Adrian Szyndela [Mon, 28 Jun 2021 07:55:22 +0000 (09:55 +0200)]
name magic numbers in poll() calls

It probably does not help much as it does not explain intentions.
They stay with the original authors of this code.

However, I believe it is a small step in the right direction.

Change-Id: I236a9b2b3dabb712ad7b1d0b6a8b1b33dd1e0230

2 years agorefactoring: beautify snprintf formats 00/260500/3
Adrian Szyndela [Fri, 25 Jun 2021 14:07:07 +0000 (16:07 +0200)]
refactoring: beautify snprintf formats

Change-Id: I40fe25dd18dc87e38dd522b6b1614ae7fd6a6465

2 years agorefactoring: extract common udev code 99/260499/3
Adrian Szyndela [Fri, 25 Jun 2021 13:14:35 +0000 (15:14 +0200)]
refactoring: extract common udev code

Change-Id: I40e73a8b266e634a1d51b4d1e010d4ecbf43e2a0

2 years agorefactoring: extract common code 98/260498/2
Adrian Szyndela [Fri, 25 Jun 2021 13:08:20 +0000 (15:08 +0200)]
refactoring: extract common code

Extract generic flocks.
Extract ARRAY_SIZE.
Extract close_fd.
Extract MAX_d_FMT.

Change-Id: I1f165414e95c0c3d4ac5c7e21b70896b8ae4a288

2 years agorefactoring: extract system_info feature handling 97/260497/1
Adrian Szyndela [Fri, 25 Jun 2021 12:51:13 +0000 (14:51 +0200)]
refactoring: extract system_info feature handling

Change-Id: I9ee561f1ba9498e8660555ec93dbae691b0b7287

2 years agoi2c: extract ioctl setup to separate function 30/260430/4
Adrian Szyndela [Thu, 24 Jun 2021 15:09:11 +0000 (17:09 +0200)]
i2c: extract ioctl setup to separate function

Change-Id: Id1af5824d0b25600bb0387b2008dae3ff290dcc5

2 years agomove and remove private headers 55/260355/6
Adrian Szyndela [Wed, 23 Jun 2021 15:17:50 +0000 (17:17 +0200)]
move and remove private headers

Leave only public header in include/.
Remove peripheral_handle.h by moving struct definitions into
respective source files.

Change-Id: I7a5042fbf68667499a1247bc8efcf704447e1d4d

2 years agopwm: flatten structure - remove 'interface' 54/260354/7
Adrian Szyndela [Wed, 23 Jun 2021 14:44:13 +0000 (16:44 +0200)]
pwm: flatten structure - remove 'interface'

Merge src/peripheral_pwm.c with src/interface/peripheral_interface_pwm.c,
with additions from include/interface/peripheral_interface_pwm.h.

Change-Id: Ic5343b93d9bd9ce01d22a7d8841c825a99611d96

2 years agoremove gdbus remainings 53/260353/7
Adrian Szyndela [Wed, 23 Jun 2021 14:33:37 +0000 (16:33 +0200)]
remove gdbus remainings

Change-Id: I5a527db12075b70b9c9cf092199ead6726dccc01

2 years agopwm: replace gdbus with direct implementation 52/260352/7
Adrian Szyndela [Wed, 23 Jun 2021 14:28:02 +0000 (16:28 +0200)]
pwm: replace gdbus with direct implementation

Move open/close code from peripheral-bus.
Add flocks() where appropriate.

Change-Id: If2554f2d30389836eb39794dffaf9e34df31176a

2 years agogpio: flatten structure - remove 'interface' 57/260257/5
Adrian Szyndela [Tue, 22 Jun 2021 14:28:06 +0000 (16:28 +0200)]
gpio: flatten structure - remove 'interface'

Merge src/peripheral_gpio.c with src/interface/peripheral_interface_gpio.c,
with additions from include/interface/peripheral_interface_gpio.h.

Change-Id: I45f9eda5cf4ab47995db43bf934ab7176670b867

2 years agogpio: replace gdbus with direct implementation 56/260256/5
Adrian Szyndela [Tue, 22 Jun 2021 10:51:37 +0000 (12:51 +0200)]
gpio: replace gdbus with direct implementation

Move open/close code from peripheral-bus.
Add flocks() where appropriate.

Change-Id: Ib54d4b8dbf4dcd7a1300b6c48ec8207fbbce2476

2 years agoadc: flatten structure - remove 'interface' 98/259798/5
Adrian Szyndela [Mon, 14 Jun 2021 08:48:14 +0000 (10:48 +0200)]
adc: flatten structure - remove 'interface'

Merge src/peripheral_adc.c with src/interface/peripheral_interface_adc.c,
with additions from include/interface/peripheral_interface_adc.h.

Change-Id: I95f03beb77a35b9f1c2d3f82f3d0590737cea59c

2 years agoadc: replace gdbus with direct implementation 97/259797/4
Adrian Szyndela [Mon, 14 Jun 2021 08:44:20 +0000 (10:44 +0200)]
adc: replace gdbus with direct implementation

Move open/close code from peripheral-bus.
Add flocks() where appropriate.

Change-Id: I696c87502d606b54a483f72990b57acf2904bb72

2 years agouart: flatten structure - remove 'interface' 58/259758/7
Adrian Szyndela [Fri, 11 Jun 2021 13:29:28 +0000 (15:29 +0200)]
uart: flatten structure - remove 'interface'

Merge src/peripheral_uart.c with src/interface/peripheral_interface_uart.c.

Change-Id: I1fdb5a0fb7c23a18bf591911a47eba1314246e91

2 years agouart: replace gdbus with direct implementation 57/259757/7
Adrian Szyndela [Fri, 11 Jun 2021 13:17:12 +0000 (15:17 +0200)]
uart: replace gdbus with direct implementation

Move open/close code from peripheral-bus.
Add flocks() where appropriate.

Change-Id: Ia74be68f4acad0a9a494c82ca6183077cc804e49

2 years agospi: flatten structure - remove 'interface' 56/259756/7
Adrian Szyndela [Fri, 11 Jun 2021 12:59:27 +0000 (14:59 +0200)]
spi: flatten structure - remove 'interface'

Merge src/peripheral_spi.c with src/interface/peripheral_interface_spi.c.

Change-Id: I9b45addfafe7c71e99cbd7797069df6f98fc69ec

2 years agospi: replace gdbus with direct implementation 55/259755/6
Adrian Szyndela [Fri, 11 Jun 2021 12:50:22 +0000 (14:50 +0200)]
spi: replace gdbus with direct implementation

Move open/close code from peripheral-bus.
Add flocks() where appropriate.

Change-Id: Id68566050afd74f1b6d0e42a87e239150ce4364f

2 years agoi2c: flatten structure - remove 'interface' 49/259749/6
Adrian Szyndela [Fri, 11 Jun 2021 11:09:26 +0000 (13:09 +0200)]
i2c: flatten structure - remove 'interface'

Merge src/peripheral_i2c.c with src/interface/peripheral_interface_i2c.c,
with additions from include/interface/peripheral_interface_i2c.h.

Change-Id: I4c0646d7b78b6753c929cb66fe2a696b4eab7ba9

2 years agoi2c: replace gdbus with direct implementation 44/259744/6
Adrian Szyndela [Wed, 9 Jun 2021 09:23:25 +0000 (11:23 +0200)]
i2c: replace gdbus with direct implementation

Move open/close code from peripheral-bus.
Add flocks() where appropriate.

Change-Id: I57bffbe463cacf2674484e8d8cf8fadfe672218f

2 years agoAdd API function to open i2c device with flags 34/259134/3 accepted/tizen/unified/20210607.124325 submit/tizen/20210607.045229
Karol Lewandowski [Tue, 1 Jun 2021 09:48:02 +0000 (11:48 +0200)]
Add API function to open i2c device with flags

Flags are going to be checked on the service side.

Change-Id: Ie7ee17a06ad76a7366236122a1a42c29dbbc56bd

3 years agoAdd information about GPIO pin value in callback. 67/255967/5 accepted/tizen/unified/20210413.021248 submit/tizen/20210412.185901
Ernest Borowski [Thu, 25 Mar 2021 16:16:35 +0000 (16:16 +0000)]
Add information about GPIO pin value in callback.

Change-Id: Ibc6ddc9c094b488236706cf2b9455c251b60f3ce
Signed-off-by: Ernest Borowski <e.borowski@samsung.com>
3 years agogdbus: Check pointer before dereference 34/253934/1 accepted/tizen/unified/20210222.215243 submit/tizen/20210219.120309
Konrad Kuchciak [Fri, 19 Feb 2021 11:16:18 +0000 (12:16 +0100)]
gdbus: Check pointer before dereference

Change-Id: I2093875c5de833536573a16af7afb23af9629753

3 years agodocs: Fix docs.tizen.org URLs 21/248921/1
Konrad Kuchciak [Thu, 3 Dec 2020 07:59:06 +0000 (08:59 +0100)]
docs: Fix docs.tizen.org URLs

Change-Id: I060c9cd1f53a8ea4c40128148cad9cabd50bb7f9

3 years agodocs: Change developer.tizen.org to docs.tizen.org 90/248690/1 submit/tizen/20201201.110307
Konrad Kuchciak [Tue, 1 Dec 2020 10:53:08 +0000 (11:53 +0100)]
docs: Change developer.tizen.org to docs.tizen.org

Change-Id: I86be1688252311b5922a54237cb9a1dce0a21417

3 years agouart: Fix read and write functions 29/239429/3
Konrad Kuchciak [Fri, 24 Jul 2020 12:34:03 +0000 (14:34 +0200)]
uart: Fix read and write functions

Return number of bytes read/written to fulfill declaration
given in docs.

Change-Id: I81e229a1b719c9370ed97d38316fbef8e712bba5

3 years agotest: Add skip test functionality 59/236959/7 accepted/tizen_6.0_unified accepted/tizen_6.0_unified_hotfix tizen_6.0_hotfix accepted/tizen/6.0/unified/20201030.121328 accepted/tizen/6.0/unified/hotfix/20201103.003528 accepted/tizen/6.0/unified/hotfix/20201103.050258 accepted/tizen/unified/20200812.143924 submit/tizen/20200811.122142 submit/tizen_6.0/20201029.205102 submit/tizen_6.0_hotfix/20201102.192502 submit/tizen_6.0_hotfix/20201103.114802 tizen_6.0.m2_release
Wiktor Gerstenstein [Thu, 25 Jun 2020 12:29:00 +0000 (14:29 +0200)]
test: Add skip test functionality

- add static array with function names to skip

Change-Id: Ic8aaa0728a43936cd4c6e1ed590e01ba8f0fbf5c

3 years agotest bugfix: check invalid function results in SPI tests 61/236961/2
Wiktor Gerstenstein [Tue, 23 Jun 2020 16:32:50 +0000 (18:32 +0200)]
test bugfix:  check invalid function results in SPI tests

Change-Id: I5b254a97e0df869666420c031fe10e122961d79c

4 years agotest: Init each test individually 36/231836/3
Konrad Kuchciak [Fri, 24 Apr 2020 10:42:41 +0000 (12:42 +0200)]
test: Init each test individually

Change-Id: I2d26dbfa63f3d454a6cc30330ac5327468ecae58
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
4 years agoBuild with gcov 25/231825/1
Konrad Kuchciak [Fri, 24 Apr 2020 09:33:06 +0000 (11:33 +0200)]
Build with gcov

 - build with gcov when --define "gcov 1" option is passed to gbs

Change-Id: I1997b14b8330eca41b5e8f2599b3b606b78ccb26
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
4 years agotest: search for i2c bus exposed by SMBus stub driver 27/224027/2 accepted/tizen/unified/20200217.213905 submit/tizen/20200214.101934 submit/tizen/20200217.095901
Konrad Kuchciak [Wed, 5 Feb 2020 16:50:49 +0000 (17:50 +0100)]
test: search for i2c bus exposed by SMBus stub driver

Change-Id: I1863416c93149bad73adaba734e5f2fc2c1fe16f

4 years agogpio: init pin after export 62/214162/1 accepted/tizen_5.5_unified accepted/tizen_5.5_unified_mobile_hotfix accepted/tizen_5.5_unified_wearable_hotfix tizen_5.5_mobile_hotfix tizen_5.5_tv tizen_5.5_wearable_hotfix accepted/tizen/5.5/unified/20191031.025744 accepted/tizen/5.5/unified/mobile/hotfix/20201027.064158 accepted/tizen/5.5/unified/wearable/hotfix/20201027.120549 accepted/tizen/unified/20190923.225255 submit/tizen/20190923.102122 submit/tizen/20190923.125435 submit/tizen_5.5/20191031.000002 submit/tizen_5.5_mobile_hotfix/20201026.185102 submit/tizen_5.5_wearable_hotfix/20201026.184302 tizen_5.5.m2_release
Konrad Kuchciak [Wed, 18 Sep 2019 11:58:46 +0000 (13:58 +0200)]
gpio: init pin after export

This will fully initialize the pin.
The problem is that edge attribute cannot be modified without explicitly
defining pin's direction after boot.
It seems like a kernel issue. This is just a workaround.

Change-Id: I6c9a2c8d20757c3f9d04779a820015c839b8ea5c
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
5 years agopio: don't return from close function too early 12/199412/3 accepted/tizen/unified/20190214.154127 submit/tizen/20190213.063316
Konrad Kuchciak [Mon, 11 Feb 2019 07:45:18 +0000 (08:45 +0100)]
pio: don't return from close function too early

We need to reach the end of the peripheral_xxx_close function in order
to free handle structure.

Change-Id: I51cf86a106397d52773875efe60424f662373c0f
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
5 years agogpio,adc: use pread instead of lseek + read 11/199411/3
Konrad Kuchciak [Mon, 11 Feb 2019 07:39:44 +0000 (08:39 +0100)]
gpio,adc: use pread instead of lseek + read

Change-Id: Ibfcffb46715e55d28a3c17749101158e4dbd48e2
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
5 years agogpio: make read function threadsafe 45/190645/1
Konrad Kuchciak [Thu, 4 Oct 2018 10:06:55 +0000 (12:06 +0200)]
gpio: make read function threadsafe

A new thread is created when setting interrupted callback on gpio pin,
which is polling and reading in loop. Reading at the same time from main
thread makes race condition as it is doing lseek() and read() on static
variable gpio->fd_value. This is fixed by adding mutex to
peripheral_gpio_read().

Change-Id: I55508fc36b91993226b373d460407c40d551276f
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
5 years agogpio: don't ignore return codes when setting/unsetting interrupted cb 44/190644/1
Konrad Kuchciak [Thu, 4 Oct 2018 09:54:36 +0000 (11:54 +0200)]
gpio: don't ignore return codes when setting/unsetting interrupted cb

Change-Id: Iaf3be22ee5939b6ff8ed239a803eabddd57e21dc
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
5 years agoadc: fix adc_read_n2 test case 32/188332/1 accepted/tizen/unified/20181031.153942 submit/tizen/20180907.001350 submit/tizen/20180924.110450 submit/tizen/20181010.111134 submit/tizen/20181022.095331 submit/vip/20181010.110708
Konrad Kuchciak [Tue, 4 Sep 2018 04:37:17 +0000 (06:37 +0200)]
adc: fix adc_read_n2 test case

Change-Id: I408ea83f787a5f48f883a3455dc660f1a7039d9e
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
5 years agoAdd API for the adc device 13/184513/7 accepted/tizen_5.0_unified accepted/tizen/5.0/unified/20181102.013255 accepted/tizen/unified/20180822.164537 submit/tizen/20180821.133358 submit/tizen_5.0/20181101.000002
Konrad Kuchciak [Wed, 18 Jul 2018 09:56:23 +0000 (11:56 +0200)]
Add API for the adc device

This commit adds support for the adc device.
For this to work, adc also has to be supported by peripheral-bus.

Change-Id: I3277815fde9e6b82e5d165ccb5003b11f505f0e9
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
5 years agogpio: fix documentation errors 52/186652/4
Konrad Kuchciak [Mon, 13 Aug 2018 06:18:00 +0000 (08:18 +0200)]
gpio: fix documentation errors

* Added '#' before enums to automatically create links in the HTML
documentation.
* Added description of errors received in GPIO interrupted callback

Change-Id: Idb818c52708b1e73de594f1b7ac77c09cda71534
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
6 years agopio: deliver user data to gpio interrupted callback function 00/170300/1 accepted/tizen/unified/20180219.142443 submit/tizen/20180219.102234
kibak.yoon [Mon, 19 Feb 2018 03:42:04 +0000 (12:42 +0900)]
pio: deliver user data to gpio interrupted callback function

Change-Id: Ib0048d8031a5799e0a495adafdbc4f824e117801
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
6 years agoMerge "doxygen: give additional prerequisites information for set APIs" into tizen
Segwon [Fri, 5 Jan 2018 03:58:40 +0000 (03:58 +0000)]
Merge "doxygen: give additional prerequisites information for set APIs" into tizen

6 years agogpio: fix to free a handle when peripheral_gdbus_gpio_close() is failed 43/165643/1 accepted/tizen/unified/20180103.151843 submit/tizen/20180103.062104
Segwon [Wed, 3 Jan 2018 04:22:51 +0000 (13:22 +0900)]
gpio: fix to free a handle when peripheral_gdbus_gpio_close() is failed

Change-Id: Ibab4d38a57e91b11f2c5a6e1b21e94d2c6e40eed
Signed-off-by: Segwon <segwon.han@samsung.com>
6 years agogpio: enhance the interrupted callback thread safty 41/165641/1
Segwon [Wed, 3 Jan 2018 03:10:20 +0000 (12:10 +0900)]
gpio: enhance the interrupted callback thread safty

Change-Id: Ib9374b0a62bdf7d8d71604365637d0dfacab69b6
Signed-off-by: Segwon <segwon.han@samsung.com>
6 years agogpio: do not join if the thread is null 36/165636/2
Segwon [Wed, 3 Jan 2018 03:00:19 +0000 (12:00 +0900)]
gpio: do not join if the thread is null

Change-Id: Ib1dafd777acaa7da520ac7aae050a05b1d607dca
Signed-off-by: Segwon <segwon.han@samsung.com>
6 years agopio: free the memory allocated by system_info_get_platform_string() 96/165596/2
kibak.yoon [Tue, 2 Jan 2018 09:17:53 +0000 (18:17 +0900)]
pio: free the memory allocated by system_info_get_platform_string()

Change-Id: Ibccb1798db42ac207ecb5f9d95858919b40371c6
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
6 years agopio: return error when open is failed 95/165595/1
kibak.yoon [Tue, 2 Jan 2018 08:16:54 +0000 (17:16 +0900)]
pio: return error when open is failed

- to prevent explicite null dereferenced, error should be returned when
  open is failed.

Change-Id: I645dec3879d54d43edec1ba52ace84af6c86b180
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
6 years agodoxygen: give additional prerequisites information for set APIs 47/165247/1
Segwon [Wed, 27 Dec 2017 08:13:59 +0000 (17:13 +0900)]
doxygen: give additional prerequisites information for set APIs

Change-Id: If1a69bdfb93ef06f1f1c6734850dbafe75ff5c20
Signed-off-by: Segwon <segwon.han@samsung.com>
6 years agointerface: add return type EINVAL in CHECK_ERROR 52/164452/4 accepted/tizen/unified/20171221.071344 submit/tizen/20171220.125854 submit/tizen/20171221.025332
Segwon [Tue, 19 Dec 2017 06:38:30 +0000 (15:38 +0900)]
interface: add return type EINVAL in CHECK_ERROR

Change-Id: I7dfb65fb371c428a7ef2f030cb5711bfb9d221af
Signed-off-by: Segwon <segwon.han@samsung.com>
6 years agospi: exclude the positive value in the ioctl error check, becasue of the ioctl return... 51/164451/1
Segwon [Tue, 19 Dec 2017 06:31:25 +0000 (15:31 +0900)]
spi: exclude the positive value in the ioctl error check, becasue of the ioctl return length

Change-Id: If7d4d517c519f6d41c6bde7a7716edda4cd6a25a
Signed-off-by: Segwon <segwon.han@samsung.com>