platform/core/system/peripheral-bus.git
6 years agointerface: create file the "peripheral_inteface_common.h" 56/160956/2
Segwon [Tue, 21 Nov 2017 01:37:37 +0000 (10:37 +0900)]
interface: create file the "peripheral_inteface_common.h"

 - change the errno check to macro
 - move common included header files to peripheral_interface_common.h
 - move common constants to peripheral_interface_common.h

Change-Id: I1a4b6fea351a045b829fb122bcec9d80f1e3ac7d
Signed-off-by: Segwon <segwon.han@samsung.com>
6 years agointerface: add prefix "peripheral_interface" to interface file name 48/160948/1
Segwon [Tue, 21 Nov 2017 01:17:27 +0000 (10:17 +0900)]
interface: add prefix "peripheral_interface" to interface file name

Change-Id: I9217d313406d113f0e314609d01edd577e9940c9
Signed-off-by: Segwon <segwon.han@samsung.com>
6 years agohandle: remove unnecessary members in handle. 99/160899/1
Segwon [Mon, 20 Nov 2017 11:15:41 +0000 (20:15 +0900)]
handle: remove unnecessary members in handle.

Change-Id: If0ff8eae0df81f5bdd84997c69bb48ea9b121ff0
Signed-off-by: Segwon <segwon.han@samsung.com>
6 years ago[3/5] fd passing: remove unnecessary functions moved to Lib 97/160897/1
Segwon [Mon, 20 Nov 2017 11:04:56 +0000 (20:04 +0900)]
[3/5] fd passing: remove unnecessary functions moved to Lib

 - I/O patch: https://review.tizen.org/gerrit/#/c/159779/

Change-Id: Ie297b0400b48f1fb17e9a3500fb94a928c1bc2b0
Signed-off-by: Segwon <segwon.han@samsung.com>
6 years agoprivilege: change the "peripheral_bus_check_privilege" function static to public. 60/160860/2
Segwon [Mon, 20 Nov 2017 09:02:55 +0000 (18:02 +0900)]
privilege: change the "peripheral_bus_check_privilege" function static to public.

 - Use the peripheral_bus_check_privilege() directly in the gdbus function rather than in the peripheral_bus_get_client_info().
 - The ids generated by peripheral_bus_get_client_info() will not be used.

Change-Id: I8ec7536f04c1db069b31c8ac973d727e12ba7f0e
Signed-off-by: Segwon <segwon.han@samsung.com>
6 years ago[2/5] fd passing: include fd list in gdbus open function 52/160852/1
Segwon [Mon, 20 Nov 2017 08:39:44 +0000 (17:39 +0900)]
[2/5] fd passing: include fd list in gdbus open function

Change-Id: I6a5b6c42940f4dd903bd0479fe1ed287923c5348
Signed-off-by: Segwon <segwon.han@samsung.com>
6 years ago[1/5] fd passing: do not communicate with Lib from gdbus except for the open. 49/160849/1
Segwon [Mon, 20 Nov 2017 08:27:30 +0000 (17:27 +0900)]
[1/5] fd passing: do not communicate with Lib from gdbus except for the open.

Change-Id: Idf4dddf501f2c14c1a28d8a27d4354ac3ad9cd8d
Signed-off-by: Segwon <segwon.han@samsung.com>
6 years agogdbus: do not include peripheral_gdbus.h removed from Lib 68/160768/1
Segwon [Mon, 20 Nov 2017 05:06:23 +0000 (14:06 +0900)]
gdbus: do not include peripheral_gdbus.h removed from Lib

 - I/O patch : https://review.tizen.org/gerrit/#/c/160409/

Change-Id: Ifb921dcd9aaffc48b042f2e82e38d07fe1acc2ec
Signed-off-by: Segwon <segwon.han@samsung.com>
6 years agospec: remove unnecessary code about systemctl 24/160324/1 accepted/tizen/unified/20171115.174115 submit/tizen/20171115.102506
Segwon [Wed, 15 Nov 2017 10:21:13 +0000 (19:21 +0900)]
spec: remove unnecessary code about systemctl

Change-Id: I1890e58f71babdfc3384a5e7c065f9a37f870015
Signed-off-by: Segwon <segwon.han@samsung.com>
6 years agopio: check if the client has privilege 54/156254/2 accepted/tizen/unified/20171019.145459 submit/tizen/20171018.072430
kibak.yoon [Tue, 17 Oct 2017 16:21:09 +0000 (01:21 +0900)]
pio: check if the client has privilege

Change-Id: I6cdd412fe8f17001717e68e13eccbb60fc16fd70
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
6 years agopio: fix memory leak 48/155848/5 accepted/tizen/unified/20171017.071214 submit/tizen/20171016.114740
kibak.yoon [Mon, 16 Oct 2017 09:50:23 +0000 (18:50 +0900)]
pio: fix memory leak

- Overwriting key_list in key_list = iniparser_getseckeys(dict, section)
leaks the storage that key_list points to.

Change-Id: Ia1aefe750ff8addfd40c6372a2720e5515289a8e
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
6 years agoini: fixed to wrong ini file for rpi3 30/155630/1
Segwon [Mon, 16 Oct 2017 01:38:49 +0000 (10:38 +0900)]
ini: fixed to wrong ini file for rpi3

   - missed the GPIO23 pin
   - wrong pin mapping with pin index

Change-Id: If1d76fe6ff050071bef07c6f51bdccb8ee7826a2
Signed-off-by: Segwon <segwon.han@samsung.com>
6 years agoi2c: try to call ioctl() to test i2c-stub when read()/write() is failed 37/148037/5 accepted/tizen/unified/20171013.193401 submit/tizen/20171013.100446
kibak.yoon [Wed, 6 Sep 2017 10:29:56 +0000 (19:29 +0900)]
i2c: try to call ioctl() to test i2c-stub when read()/write() is failed

Change-Id: Idadb56f4da5b4ed17fef47ba316524462b0c50c5
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
6 years agoboard: fixed to not be an unterminated array. 41/155041/1 submit/tizen/20171012.141835
Segwon [Thu, 12 Oct 2017 03:08:49 +0000 (12:08 +0900)]
board: fixed to not be an unterminated array.

Change-Id: If0c6aeb1a1d36392aff13f1a6564e625fbfc9cf0
Signed-off-by: Segwon <segwon.han@samsung.com>
6 years agoboard: fixed allocated memory released via iniparser_getseckeys() 72/154572/1 accepted/tizen/unified/20171010.163344 submit/tizen/20171010.131453
Segwon [Tue, 10 Oct 2017 12:52:47 +0000 (21:52 +0900)]
board: fixed allocated memory released via iniparser_getseckeys()

Change-Id: I49542c1e79e83aa8ad278eca23d89c78a44cd55f
Signed-off-by: Segwon <segwon.han@samsung.com>
6 years agoboard: increased the memory size because of unterminated string occurred. 64/154564/1
Segwon [Tue, 10 Oct 2017 12:25:12 +0000 (21:25 +0900)]
board: increased the memory size because of unterminated string occurred.

Change-Id: I5839e07b77eda7cab197248ba146bc9226573c5c
Signed-off-by: Segwon <segwon.han@samsung.com>
6 years agoboard: meaningful return value is assigned to a variable like read() 96/154496/4
Segwon [Tue, 10 Oct 2017 10:02:24 +0000 (19:02 +0900)]
board: meaningful return value is assigned to a variable like read()

Change-Id: I07e1db5b35cc071b4d28f9aac4f685c714e8edb2
Signed-off-by: Segwon <segwon.han@samsung.com>
6 years agospi: modified to the rx and tx buffers are not allocated when buffer size is zero. 87/154487/4
Segwon [Tue, 10 Oct 2017 09:15:13 +0000 (18:15 +0900)]
spi: modified to the rx and tx buffers are not allocated when buffer size is zero.

Change-Id: Ibaca59a040935701078140ca04eeef5dc3fb5280
Signed-off-by: Segwon <segwon.han@samsung.com>
6 years agospi: fixed to invalid NULL check when tx_buf allocates. 72/154472/3
Segwon [Tue, 10 Oct 2017 08:53:32 +0000 (17:53 +0900)]
spi: fixed to invalid NULL check when tx_buf allocates.

Change-Id: Ieb4e22cf35d685895960b26d25cd803bc702d67a
Signed-off-by: Segwon <segwon.han@samsung.com>
6 years agoopen handle: open function flow was matched. 23/154423/3
Segwon [Tue, 10 Oct 2017 07:26:13 +0000 (16:26 +0900)]
open handle: open function flow was matched.

 - added the NULL check when trying to allocate memory for i2c handle.
 - modified to return an OUT_OF_MEMORY when failed allocation from peripheral_bus_data_new().
 - open i2c, uart handle flow was matched with another open flow.
 - add log before return error.

Change-Id: Ibcee972e2bba39cc42b8bc53bd91efcb0526b0bf
Signed-off-by: Segwon <segwon.han@samsung.com>
6 years agoi2c: fixed that allocated memory is released when an error occurs. 18/154518/1
Segwon [Tue, 10 Oct 2017 10:38:42 +0000 (19:38 +0900)]
i2c: fixed that allocated memory is released when an error occurs.

Change-Id: Ib2c6589ad52b3752297bf6579527b574dba3b3d6
Signed-off-by: Segwon <segwon.han@samsung.com>
6 years agobus: fixed a flow using a handle already freed. 13/154513/1
Segwon [Tue, 10 Oct 2017 10:35:16 +0000 (19:35 +0900)]
bus: fixed a flow using a handle already freed.

Change-Id: Ie3596fa2db1e607d15d0c3745a872a5d4c3f067d
Signed-off-by: Segwon <segwon.han@samsung.com>
6 years agoversion up 0.1.0 57/152357/1 accepted/tizen/unified/20170926.165628 submit/tizen/20170926.023501
kibak.yoon [Tue, 26 Sep 2017 02:07:08 +0000 (11:07 +0900)]
version up 0.1.0

Change-Id: I92d08b747a243c850df8027e5b35bbe1602384bd
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
6 years agouart: fixed to return the -EAGAIN error type when read/write. 09/151609/3
Segwon [Thu, 21 Sep 2017 08:45:48 +0000 (17:45 +0900)]
uart: fixed to return the -EAGAIN error type when read/write.

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

6 years agouart: added flush logic before close. 03/151603/1
Segwon [Thu, 21 Sep 2017 08:43:06 +0000 (17:43 +0900)]
uart: added flush logic before close.

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

6 years agoname: sync functions name with changed apis name. 99/151599/1
Segwon [Thu, 21 Sep 2017 08:38:17 +0000 (17:38 +0900)]
name: sync functions name with changed apis name.

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

6 years agoadc: the adc interface is not supported 77/151577/2
Segwon [Thu, 21 Sep 2017 07:52:34 +0000 (16:52 +0900)]
adc: the adc interface is not supported

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

6 years agospi: fix bug by passing value instead of pointer as parameter 90/149390/1 accepted/tizen/unified/20170912.191949 submit/tizen/20170912.074259
kibak.yoon [Tue, 12 Sep 2017 07:15:13 +0000 (16:15 +0900)]
spi: fix bug by passing value instead of pointer as parameter

Change-Id: Ifa2991a34ad1b9f150913cd45ca8719fe1760b62
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
6 years agoutil: added to the NULL check. 25/148425/2
Segwon [Fri, 8 Sep 2017 02:07:25 +0000 (11:07 +0900)]
util: added to the NULL check.

 - SVACE : 279879, DEREF_OF_NULL.RET.PROC.STAT

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

6 years agospi: transfer the tx/rx data with the same structure variable 11/148011/1 accepted/tizen/unified/20170907.190204 submit/tizen/20170907.084231
kibak.yoon [Wed, 6 Sep 2017 08:12:02 +0000 (17:12 +0900)]
spi: transfer the tx/rx data with the same structure variable

- Tested with ADC(MCP3008)
- The name of spi_read_write() function will be changed to "spi_transfer()".

Change-Id: I6db7383854de46c5e45721fb9ec9da6ce4a51c8f
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
6 years agoboard-config: add config file for Artik 520 29/146429/1 accepted/tizen/unified/20170901.025959 submit/tizen/20170830.124248
kibak.yoon [Mon, 28 Aug 2017 12:38:31 +0000 (21:38 +0900)]
board-config: add config file for Artik 520

- Artik 520 Pin Mapping
  https://developer.artik.io/documentation/developer-guide/gpio/gpio-mapping.html#artik-520-pin-mapping
- Artik 520 Datasheet
  https://developer.artik.io/documentation/downloads.html#ds

[TODO]
- more testing is needed for GPIO

Change-Id: I2e8ce87b03a410379841be820f918f02c42d8f20
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
6 years agoboard-config: fix typo from "unkown" to "unknown" 28/146428/1
kibak.yoon [Mon, 28 Aug 2017 12:37:21 +0000 (21:37 +0900)]
board-config: fix typo from "unkown" to "unknown"

- the config file name is not matched because there is a typo("unkown").
  so it is failing to load the config file on the unknown device(e.g., artik520).
- Even if this patch is merged, the peripheral bus daemon will not boot properly.
  This is because there is no peripheral-io item in the config file...

Change-Id: I7e96467304ef8742c30205d51447ff76b35b1713
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
6 years agoImprove logs for I2C communication 95/141095/2
Hyeongsik Min [Fri, 28 Jul 2017 06:46:21 +0000 (15:46 +0900)]
Improve logs for I2C communication

- Show I2C slave address in hexadecimal.
- Add logs in peripheral_bus_i2c to provide information about the slave
  address of failed device.

Change-Id: Idc29f0cf6a52f67c849bd9dac064210203c1a192
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
6 years agoRefactor logs messages in i2c/spi interface 77/141077/1
Hyeongsik Min [Fri, 28 Jul 2017 04:51:46 +0000 (13:51 +0900)]
Refactor logs messages in i2c/spi interface

- Print message if fd is invalid.
- Show fd number in error case.

Change-Id: If08d70d1a4465ecbb6a5cf29b77674c18debe5d0
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
6 years agoPrint log messages in case of wrong write access 13/140113/1
Hyeongsik Min [Mon, 24 Jul 2017 02:15:12 +0000 (11:15 +0900)]
Print log messages in case of wrong write access

Writing value is not permitted when the pin is in input direction mode.
Just in case, this patch fixes error number and adds log message to let user
know the cause.

Change-Id: Ie40fabeba06b832eaa0585130af8702ba8fcb8b5
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
6 years agoRefactoring dbus interface functions 79/139979/2
Sungguk Na [Fri, 21 Jul 2017 07:15:41 +0000 (16:15 +0900)]
Refactoring dbus interface functions

Change-Id: Ide717e39235e5b87583e93dfd05485efc59e9a3b
Signed-off-by: Sungguk Na <sungguk.na@samsung.com>
6 years agoFix bug at spi open 75/139875/1
Sungguk Na [Fri, 21 Jul 2017 02:05:55 +0000 (11:05 +0900)]
Fix bug at spi open

Change-Id: I3133d1eb66cc2f621f85ba9601dfcf34b02014d2
Signed-off-by: Sungguk Na <sungguk.na@samsung.com>
6 years agopackage version up to 0.0.6 99/139599/1 accepted/tizen/4.0/unified/20170816.012229 accepted/tizen/4.0/unified/20170829.015756 accepted/tizen/unified/20170720.062122 submit/tizen/20170719.114354 submit/tizen_4.0/20170811.094300 submit/tizen_4.0/20170828.100004 submit/tizen_4.0/20170828.110004
jino.cho [Wed, 19 Jul 2017 11:42:01 +0000 (20:42 +0900)]
package version up to 0.0.6

Change-Id: Id491bcae11e34a686c65eb7b524532f4098ddf42
Signed-off-by: jino.cho <jino.cho@samsung.com>
6 years agoFix model name of RPI3 49/139549/3
Hyeongsik Min [Wed, 19 Jul 2017 08:07:38 +0000 (17:07 +0900)]
Fix model name of RPI3

As model name in dtb of RPI3 has been changed, there is a issue that
peripheral-bus failed to recognize the RPI3 board. This patch removes
"Rev 1.2" from lookup string for RPI3 to solve the issue.

Change-Id: If7e2c9b5f83a6bf29c743d19ae7eae3095761934
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
6 years agoMove header files in daemon/ to include directory 92/138692/3
Hyeongsik Min [Thu, 13 Jul 2017 07:57:01 +0000 (16:57 +0900)]
Move header files in daemon/ to include directory

Change-Id: Id8b9aa2e16fc9b604988075613aa53318e13883e
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
6 years agoRemove unnecessary condition check in uart.c 46/138946/1
Hyeongsik Min [Fri, 14 Jul 2017 09:36:49 +0000 (18:36 +0900)]
Remove unnecessary condition check in uart.c

bytesize is always greater than zero.

Change-Id: Iae6a882a8cb1fcaee215602ef7d8dccafa2af99d
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
6 years agoEnable support of several gpio pins for RPI3 07/138807/1 accepted/tizen/unified/20170717.021132 submit/tizen/20170714.030511
Hyeongsik Min [Fri, 14 Jul 2017 01:17:18 +0000 (10:17 +0900)]
Enable support of several gpio pins for RPI3

Change-Id: I98dbcc336e34fe22712e02177f4756c432652e09
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
6 years agoFix static analysis issue 12/138712/1
Hyeongsik Min [Thu, 13 Jul 2017 08:57:29 +0000 (17:57 +0900)]
Fix static analysis issue

Avoid possible overflow by casting before arithmetic operation

Change-Id: I0190740a7f3534427ef01fa29ab24bbf7405635e
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
6 years agoUpdate package version to 0.0.5 16/138616/1 submit/tizen/20170713.044725
jino.cho [Thu, 13 Jul 2017 04:27:08 +0000 (13:27 +0900)]
Update package version to 0.0.5

Change-Id: Ia31b426b6a05bb158ad32d9ea25dcd02b8eff0e9
Signed-off-by: jino.cho <jino.cho@samsung.com>
6 years agoRecord timestamp of gpio interrupt 90/138390/8
jino.cho [Wed, 12 Jul 2017 04:45:55 +0000 (13:45 +0900)]
Record timestamp of gpio interrupt

This patch records the timestamp of the gpio interrupt and
adds it to signal argument.

Change-Id: Ia79ebcbcaade7436d683a25623e10632e1d5c0c5
Signed-off-by: jino.cho <jino.cho@samsung.com>
6 years agoFix log message format in uart.c 86/138386/5
Hyeongsik Min [Wed, 12 Jul 2017 05:04:43 +0000 (14:04 +0900)]
Fix log message format in uart.c

- Remove unnecessay info in log message.
- Remove unnecessay new line(\n).
- Print error description string instead of showing errno.

Change-Id: Id0dccd0434ee37a7d9aa278e2295ec224a6dba1c
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
6 years agoChange service type as notify 65/138165/4
Sungguk Na [Tue, 11 Jul 2017 09:55:33 +0000 (18:55 +0900)]
Change service type as notify

Change-Id: I4b540f84ea8d8d27e7c707b4170eb80d79eae14c
Signed-off-by: Sungguk Na <sungguk.na@samsung.com>
6 years agoUpdate board ini file for RPI3 50/138150/1
Hyeongsik Min [Tue, 11 Jul 2017 08:26:39 +0000 (17:26 +0900)]
Update board ini file for RPI3

- Add key for mini UART
- Remove SPI1 not supported on RPI3

Change-Id: Ia62358c725d811e080a93f1540731d9aaca31a81
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
6 years agoSupport various uart device name 13/137713/5
jino.cho [Fri, 7 Jul 2017 02:54:46 +0000 (11:54 +0900)]
Support various uart device name

- ttyS  : hot fix for rp3
- ttyAMA: console on AMBA serial.
- ttySAC: console on Samsung SoC serial.

Change-Id: Iec73e23898e55230bbc8a1f0c71046d6f1d9f89d
Signed-off-by: jino.cho <jino.cho@samsung.com>
6 years agoAdd udev rules and tmpfiles for gpio sysfs node 77/137577/4
Hyeongsik Min [Thu, 6 Jul 2017 11:01:24 +0000 (20:01 +0900)]
Add udev rules and tmpfiles for gpio sysfs node

In order to change UID/GID of peripheral-bus, we need to change
permission of gpio sysfs node from root to system_fw and set smack label to
them.

Change-Id: I84640cc8aa858a6cc00d9a38a89bd4d1aee3b478
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
6 years agoManage board resource with .ini file 05/136705/3
jino.cho [Mon, 26 Jun 2017 05:43:32 +0000 (14:43 +0900)]
Manage board resource with .ini file

This patch is to protect H/W board and system stability from
invalid access. Peripheral IO is not available for all peripheral
devices that the board provides, but only peripheral devices
specified in the INI file can be used.

Change-Id: I2243406b79b200a1165a9a1d84deecc3eec15d88
Signed-off-by: jino.cho <jino.cho@samsung.com>
6 years agoInvoke systemd operation on installation and removal 04/135204/1
Hyeongsik Min [Wed, 21 Jun 2017 07:21:44 +0000 (16:21 +0900)]
Invoke systemd operation on installation and removal

Change-Id: Id3913e75679127586d9a38941b918c40d7979b81
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
6 years agoRefactoring the handle structure 91/134591/5
jino.cho [Mon, 19 Jun 2017 09:34:35 +0000 (18:34 +0900)]
Refactoring the handle structure

This patch unifies the structures of the device handles.
It was extracted duplicated code into one method and enhanced the
handle validation.

Change-Id: I8e91ddc5c687fce15d64598da134d3c5d8c6ea5a
Signed-off-by: jino.cho <jino.cho@samsung.com>
6 years agoMinor log changes in interface module 33/133133/3 accepted/tizen/unified/20170613.194840 submit/tizen/20170613.105843
Hyeongsik Min [Fri, 9 Jun 2017 04:44:09 +0000 (13:44 +0900)]
Minor log changes in interface module

- Add log messages to open, close and configuration functon.
- Remove log messages in read and write function to prevent log
  spam.

Change-Id: Ie26d8335ba4633a9d4fd039bc5dd28c5d968bab4
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
6 years agoAdd functions for the adc device 66/133266/4
jino.cho [Thu, 1 Jun 2017 01:34:29 +0000 (10:34 +0900)]
Add functions for the adc device

This patch support the adc device. And, it should work properly
if the patch for peripheral-io is applied together.

Change-Id: I08d9f518bbc554deaf9ced1007534adee05f2911
Signed-off-by: jino.cho <jino.cho@samsung.com>
6 years agoReplace error code from ENODEV with ENXIO 01/133001/1
Hyeongsik Min [Thu, 8 Jun 2017 23:47:30 +0000 (08:47 +0900)]
Replace error code from ENODEV with ENXIO

Change error code ENODEV to ENXIO for the case of no such device.

Change-Id: I4d5daa1c4b402f608ae217819ae79a4afb6f6fc5

6 years agoFix uninitilized variable issue 75/132775/2
Hyeongsik Min [Wed, 7 Jun 2017 11:57:14 +0000 (20:57 +0900)]
Fix uninitilized variable issue

Fix the issue that uninitilized local variable is read in
handle_i2c_smbus_ioctl().

Change-Id: I926c81a2ec024dc124339d503f0a99f9672055f6
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
6 years agoUpdate package version to 0.0.4 25/132125/1 accepted/tizen/unified/20170602.054035 submit/tizen/20170602.034029
Hyeongsik Min [Thu, 1 Jun 2017 06:57:32 +0000 (15:57 +0900)]
Update package version to 0.0.4

Change-Id: I4c7945984a303e1f9c727e0f4375df9f7f84c2c4
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
6 years agoAdd new APIS for I2C smbus transaction 52/132052/5
Hyeongsik Min [Thu, 1 Jun 2017 02:03:25 +0000 (11:03 +0900)]
Add new APIS for I2C smbus transaction

This patch support below peripheral-io APIs.
- peripheral_i2c_read_register_byte()
- peripheral_i2c_write_register_byte()
- peripheral_i2c_read_register_word()
- peripheral_i2c_write_register_word()

Below APIs already existed, but they are changed to use SMBUS ioctl in
this patch.
- peripheral_i2c_read_byte()
- peripheral_i2c_write_byte()

Change-Id: Ie22dd237fce9b731c7ecbbd904ec0f5219b005e1
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
6 years agoAdd functions for the spi device 08/131108/9
jino.cho [Thu, 25 May 2017 10:53:53 +0000 (19:53 +0900)]
Add functions for the spi device

This patch support the spi device. And, it should work properly
if the patch for peripheral-io is applied together.

Change-Id: Ib794a51e68aed07235ab423ec86f137715bc9ad9
Signed-off-by: jino.cho <jino.cho@samsung.com>
6 years agoFix error handling in peripheral_handle_{dev}_open 10/131410/3
Hyeongsik Min [Mon, 29 May 2017 04:42:53 +0000 (13:42 +0900)]
Fix error handling in peripheral_handle_{dev}_open

This patch fix crash issue accessing invalid handle value after open failure.

Change-Id: I2c81d1d99694e39185f3c75e5f375e964bf8f7c4
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
6 years agoChange argument of gpio gdbus method 11/131111/2
Sungguk Na [Thu, 25 May 2017 10:39:20 +0000 (19:39 +0900)]
Change argument of gpio gdbus method

- The gpio methods will pass handle instead of device informations.
- Add gpio routines to handle exceptional case of client close

Change-Id: I000f59f658f8b8f7c2e439b9181a1437732b7936
Signed-off-by: Sungguk Na <sungguk.na@samsung.com>
6 years agoFix to handle OUT_HIGH in gpio set direction 89/131089/1
Hyeongsik Min [Thu, 25 May 2017 10:09:51 +0000 (19:09 +0900)]
Fix to handle OUT_HIGH in gpio set direction

Change-Id: I3d76dafa2ef5c9aaee123ffc04e2a62a54b7c7fe
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
6 years agoClean up handle free function 19/130619/4
Hyeongsik Min [Tue, 23 May 2017 06:22:05 +0000 (15:22 +0900)]
Clean up handle free function

Without traversing the list, this patch uses g_list_find() to get a link of
current handle.

Change-Id: I7ec38d61c09f6c6fd1c68c6f93f50759109c0fdb
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
6 years agoRefactoring exception handling routines to remove duplication operations 61/130761/3
Sungguk Na [Wed, 24 May 2017 01:18:20 +0000 (10:18 +0900)]
Refactoring exception handling routines to remove duplication operations

Change-Id: Ib62e79d947b01acd0c24eca9001d85009be9cbc3
Signed-off-by: Sungguk Na <sungguk.na@samsung.com>
6 years agoAdd routines to handle exceptional case of client close 42/130542/2
Sungguk Na [Tue, 23 May 2017 01:07:22 +0000 (10:07 +0900)]
Add routines to handle exceptional case of client close

Change-Id: I36011f303a9183a8583fca7a2158e0a2b8ccbb6e
Signed-off-by: Sungguk Na <sungguk.na@samsung.com>
7 years agoSeperate files for util functions 33/130133/2
Hyeongsik Min [Fri, 19 May 2017 07:42:57 +0000 (16:42 +0900)]
Seperate files for util functions

Add peripheral_bus_util.c/.h and put util functions that can be used by
peripheral_bus and peripheral_bus_<interface>.

Change-Id: I6a2e643f322a3af01b0d52001d36802310d4fd4f
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoPut client_info into i2c_handle 82/130082/3
Hyeongsik Min [Fri, 19 May 2017 04:37:14 +0000 (13:37 +0900)]
Put client_info into i2c_handle

This patch put struct client_info in struct pb_data_h instead of pointer of it.

Change-Id: I2e971129337202895e730324a7baeab47fa73fda
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoFix possible fd leak in peripheral_bus_uart_open 68/129868/6
Hyeongsik Min [Thu, 18 May 2017 08:05:08 +0000 (17:05 +0900)]
Fix possible fd leak in peripheral_bus_uart_open

Change-Id: Ibed226e76e6070bc45a2623d04a7bffe3dc68aa0
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoAdd pwm set_polarity & get_polarity functions 94/129894/2
jino.cho [Thu, 18 May 2017 08:31:20 +0000 (17:31 +0900)]
Add pwm set_polarity & get_polarity functions

Change-Id: I39edddd0446a490e2d2eecca249d3399a0584972
Signed-off-by: jino.cho <jino.cho@samsung.com>
7 years agoCheck validation of the pwm handle 93/129893/2
jino.cho [Thu, 18 May 2017 08:24:14 +0000 (17:24 +0900)]
Check validation of the pwm handle

This patch adds to check validation of the pwm handle and adds
access control based on the client's bus name.

Change-Id: If2cd9cd749de271e4098dac409a902811679128d
Signed-off-by: jino.cho <jino.cho@samsung.com>
7 years agoAdd pwm get_enable functions 92/129892/1
jino.cho [Thu, 18 May 2017 07:59:09 +0000 (16:59 +0900)]
Add pwm get_enable functions

This patch adds get_enable functions to read current enable status.
The type of enable was changed to boolean.

Change-Id: Ida7f8437ad452f96bf29bc4a1a1d46b85b4eb50b
Signed-off-by: jino.cho <jino.cho@samsung.com>
7 years agoRearrange the order of pwm functions 91/129891/1
jino.cho [Thu, 18 May 2017 07:33:10 +0000 (16:33 +0900)]
Rearrange the order of pwm functions

Change-Id: Idc658f2c159d820add8d328073f4d297b6f46d86
Signed-off-by: jino.cho <jino.cho@samsung.com>
7 years agoAdd structure to store pwm client context 39/129539/4
jino.cho [Wed, 17 May 2017 01:15:07 +0000 (10:15 +0900)]
Add structure to store pwm client context

This patch adds structure to store pwm client context and changes
argument name and type of pwm gdbus method.

Change-Id: Ibfc245dd86c5da0003ae2f827e7dfb32b2ebeb18
Signed-off-by: jino.cho <jino.cho@samsung.com>
7 years agoAdd and rename pwm interface functions 20/129520/5
jino.cho [Tue, 16 May 2017 08:31:55 +0000 (17:31 +0900)]
Add and rename pwm interface functions

- add pwm_set_polarity() and pwm_get_polarity()
- rename pwm_set_enabled() to pwm_set_enable()
- rename pwm_get_enabled() to pwm_get_enable()
- modify descriptions
- fix log message level

Change-Id: I4520599bc86b6111f1e55c05e73714b1d5fac1e7
Signed-off-by: jino.cho <jino.cho@samsung.com>
7 years agoModify pwm interface functions 19/129519/2
jino.cho [Tue, 16 May 2017 08:27:42 +0000 (17:27 +0900)]
Modify pwm interface functions

 - Change log messages
 - Rename local variables

Change-Id: I57043e47652fdd84c5d98ac084ffc57db831f4cd
Signed-off-by: jino.cho <jino.cho@samsung.com>
7 years agoRearrange the order of pwm interface functions 18/129518/1
jino.cho [Tue, 16 May 2017 08:17:20 +0000 (17:17 +0900)]
Rearrange the order of pwm interface functions

Change-Id: I2eb373f5764b39eeda0d37718e794863e1dda649
Signed-off-by: jino.cho <jino.cho@samsung.com>
7 years agoAdd uart functions 61/128961/5
jino.cho [Fri, 12 May 2017 05:30:16 +0000 (14:30 +0900)]
Add uart functions

This patch support uart device. And, it should work properly
if the patch for peripheral-io is applied together.

Change-Id: I9e5f85c98951a751331d18df42ba6d87168dcd64
Signed-off-by: jino.cho <jino.cho@samsung.com>
7 years agoChange parameter type of the parity to enum 60/128960/2
jino.cho [Fri, 12 May 2017 04:20:53 +0000 (13:20 +0900)]
Change parameter type of the parity to enum

This patch change parameters (Buadrate, Bytesize, Parity and Stopbits) type
to enum and data type to unsigned char.

Change-Id: Iec619a56fe0b7bdb55c8765beab8fc7b8fee0c5b
Signed-off-by: jino.cho <jino.cho@samsung.com>
7 years agoAllocate data buffer for i2c read/write 15/128415/3
Hyeongsik Min [Tue, 9 May 2017 23:52:55 +0000 (08:52 +0900)]
Allocate data buffer for i2c read/write

Instead of using fixed size buffer, allocate data buffer per i2c
session.

Change-Id: I1157aabcdbfb2bf1385e78e60cce4b968006253d
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoFix gdbus name and path 06/128306/1
Hyeongsik Min [Mon, 8 May 2017 12:44:17 +0000 (21:44 +0900)]
Fix gdbus name and path

This change fixes macro name along with the change in peripheal-io.

Change-Id: Ifd6f03126e1dabd6488172268d557c8c1da93caa
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoFix static analysis issue 58/128258/2 accepted/tizen/unified/20170510.013102 submit/tizen/20170508.093623 tizen_4.0.m1_release
Hyeongsik Min [Mon, 8 May 2017 07:57:34 +0000 (16:57 +0900)]
Fix static analysis issue

- UNREACHABLE_CODE at peripheral_bus_gpio.c:254
- INTEGER_OVERFLOW in adc_get_device_name()
  This patch makes the function allocate buffer for the name of adc device
  node instead of just copying strings to buffer passed through argument.

Change-Id: If5d137a846ca5727b3d2cb00f4a2b6d313abf75f
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoFix build break on 64 bit architecture 57/128257/1
Hyeongsik Min [Mon, 8 May 2017 07:39:38 +0000 (16:39 +0900)]
Fix build break on 64 bit architecture

Change-Id: Ief79422f096a31447dc79068d1128594f4129e95
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoAdd structure to store i2c client context 27/128127/2 submit/tizen/20170508.033648
Hyeongsik Min [Sun, 7 May 2017 09:31:29 +0000 (18:31 +0900)]
Add structure to store i2c client context

- Add access control based on the client's bus name.
- Change argument name and type of i2c gdbus method.

Change-Id: I2d81181b41cc35ca34c71fefcf2beb8af0bc92ce
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoFix svace issue in gpio interface 78/128078/3
Hyeongsik Min [Fri, 5 May 2017 01:57:42 +0000 (10:57 +0900)]
Fix svace issue in gpio interface

- DEREF_AFTER_NULL.EX in peripheral_bus_gpio_open.
  Null pointer is dereferenced after peripherl_bus_gpio_data_new returns null.
- UNREACHABLE_CODE in peripheral_bus_gpio_register_irq().
  gpio->io_id will be zero if it failed and cannot be less than zero.

Change-Id: Ic780ba4362ef13273c3cb2f367ad13276ea429c5
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoFix svace issue in i2c interface 77/128077/2
Hyeongsik Min [Fri, 5 May 2017 01:30:05 +0000 (10:30 +0900)]
Fix svace issue in i2c interface

- Fix UNREACHABLE_CODE in i2c_open
- Add exception handling code in i2c_close
- Pass return value of ioctl in i2c_set_address

Change-Id: I5c8483948bb107034f116c47756231d7a09de57a
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoMake all warnings into errors 01/127901/1
Hyeongsik Min [Tue, 2 May 2017 07:47:17 +0000 (16:47 +0900)]
Make all warnings into errors

And removed unused variable in CMakeLists

Change-Id: I87ed0410f245b5a2391cf8f3c9fc96d669233777
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoPut i2c/pwm_skeleton variable to pb_data 00/127900/1
Hyeongsik Min [Mon, 1 May 2017 11:21:09 +0000 (20:21 +0900)]
Put i2c/pwm_skeleton variable to pb_data

Change-Id: I7f55e22e159e705cafc2a952b8877ea0d5b8b3b7
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoSupport gpio interrupt 41/127641/4
jino.cho [Tue, 18 Apr 2017 07:29:27 +0000 (16:29 +0900)]
Support gpio interrupt

The gpio interrupt should work properly if the patch for
peripheral-io is applied together.

Change-Id: I0bf71501b54728ad0ce83a623e084bf8227b3e9a
Signed-off-by: jino.cho <jino.cho@samsung.com>
7 years agoFix logic in gpio_write and gpio_get_direction 10/127210/2
Hyeongsik Min [Wed, 26 Apr 2017 11:31:03 +0000 (20:31 +0900)]
Fix logic in gpio_write and gpio_get_direction

- Return error if direction is input mode
- Update direction state along with input value

Change-Id: I360df5a6c986defaf25a71cf3a47785854b3c9a3
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoUpdate package version to 0.0.3 93/127093/1 accepted/tizen/unified/20170426.200825 submit/tizen/20170426.072552 submit/tizen/20170426.072600
Hyeongsik Min [Wed, 26 Apr 2017 07:12:15 +0000 (16:12 +0900)]
Update package version to 0.0.3

Change-Id: I599f04c285d7e142b9dfbb31efdc03f82e1ca8eb
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoRemove i2c_set_address() API 10/126810/3
Hyeongsik Min [Tue, 25 Apr 2017 05:53:38 +0000 (14:53 +0900)]
Remove i2c_set_address() API

i2c_open() will pass bus and address argument together.

Change-Id: Iedd94d1554bc17764f64b1d31ca6e8c10ad87111
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoPass pb_data to callbacks of gpio methods 46/127046/3
jino.cho [Wed, 26 Apr 2017 02:34:17 +0000 (11:34 +0900)]
Pass pb_data to callbacks of gpio methods

Previous commit missed adding pb_data to argument.
This commit fix crash issue due to the missing.

Change-Id: I75d3cffe6a09c72b6976d5581e22153866479f1b
Signed-off-by: jino.cho <jino.cho@samsung.com>
7 years agoAdd gpio instance managing 33/126933/4
jino.cho [Tue, 25 Apr 2017 09:30:29 +0000 (18:30 +0900)]
Add gpio instance managing

Change-Id: I3c9e273de2fa8c28c7f1bbcb48afe61dc5598af8
Signed-off-by: jino.cho <jino.cho@samsung.com>
7 years agoChange argument name in i2c interface 09/126809/1
Hyeongsik Min [Tue, 25 Apr 2017 05:51:14 +0000 (14:51 +0900)]
Change argument name in i2c interface

- Change file_hndl to fd
- Remove commented out codes in i2c.c
- Change log message format in i2c.c

Change-Id: If64e0fdd54f91eda232095693056044fb82b7502
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoFix gdbus interface prefix and typo 23/126523/2
Hyeongsik Min [Mon, 24 Apr 2017 04:09:35 +0000 (13:09 +0900)]
Fix gdbus interface prefix and typo

Removed 'system.' from interface name.

Change-Id: I864efa355360709cb31a77390b4cad039e00ef16
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoChange gdbus interface with gdbus-codegen 36/126436/6
Sungguk Na [Fri, 21 Apr 2017 10:47:27 +0000 (19:47 +0900)]
Change gdbus interface with gdbus-codegen

Change-Id: I568508456be8326ff95385a2839691ebd791f86b
Signed-off-by: Sungguk Na <sungguk.na@samsung.com>
7 years agoRemove exception handling in gpio_open() 55/126155/3
jino.cho [Thu, 20 Apr 2017 08:50:03 +0000 (17:50 +0900)]
Remove exception handling in gpio_open()

Calling the gpio_close as a exception handling code in gpio_open()
was removed.

Change-Id: I9fb886d051aabd12b5222e37916c04ac5c464f36
Signed-off-by: jino.cho <jino.cho@samsung.com>
7 years agoFix wrong log message in gpio_close 48/126148/2
jino.cho [Thu, 20 Apr 2017 08:23:26 +0000 (17:23 +0900)]
Fix wrong log message in gpio_close

Change-Id: Iec45696b851495fe2e95060c63ae0f6441dc92ab
Signed-off-by: jino.cho <jino.cho@samsung.com>
7 years agoRename peripheral_i2c_context_h to peripheral_i2c_h 32/126032/2
Hyeongsik Min [Wed, 19 Apr 2017 10:55:22 +0000 (19:55 +0900)]
Rename peripheral_i2c_context_h to peripheral_i2c_h

Change-Id: Id304caf9e1de0a07d90a8279e7aa03ebaf746234
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>