Revert "Add privilege check in all public APIs" 79/290079/1
authorTaeminYeom <taemin.yeom@samsung.com>
Thu, 16 Mar 2023 07:33:59 +0000 (16:33 +0900)
committerTaeminYeom <taemin.yeom@samsung.com>
Mon, 20 Mar 2023 06:04:08 +0000 (15:04 +0900)
Checking privilege has been done by device nodes DAC.
So, checking code is not needed.

This reverts commit e1eb7906a9c4496e7b4fa89544ae500cbf7d615a.

Change-Id: Ia872c5d4b7b6c8b376e2254a79544a5f0bc3ff5b

CMakeLists.txt
packaging/capi-system-peripheral-io.spec
src/common.c
src/common.h
src/peripheral_adc.c
src/peripheral_gpio.c
src/peripheral_i2c.c
src/peripheral_pwm.c
src/peripheral_spi.c
src/peripheral_uart.c

index 3183c3c47ecc5398bae4d41b9d60e41f20038245..b321988bdb35e89c5656d8d2e69596b141a8a13b 100644 (file)
@@ -9,7 +9,7 @@ SET(fw_name "${project_prefix}-${service}-${submodule}")
 
 PROJECT(${fw_name})
 
-SET(dependents "dlog glib-2.0 capi-base-common capi-system-info libudev cynara-client cynara-session")
+SET(dependents "dlog glib-2.0 capi-base-common capi-system-info libudev")
 SET(pc_dependents "capi-base-common")
 
 SET(CMAKE_INSTALL_PREFIX ${prefix})
index 5f10efa1a7eccc2a05417b189832c4189c4a7568..fd4cd358b5fc99072a06f99629d2561ed5d92dd9 100644 (file)
@@ -16,8 +16,6 @@ BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(capi-base-common)
 BuildRequires:  pkgconfig(capi-system-info)
-BuildRequires:  pkgconfig(cynara-client)
-BuildRequires:  pkgconfig(cynara-session)
 BuildRequires:  pkgconfig(libudev)
 %if 0%{?gcov:1}
 BuildRequires:  lcov
index c38befa246f354464ed4c27f3fd793ef1daaac4a..ed56e67495f61c8f5f3e19fa298b9da8619b64b5 100644 (file)
@@ -1,21 +1,13 @@
+#include "common.h"
 #include <assert.h>
 #include <libudev.h>
 #include <poll.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <sys/file.h>
-
 #include <system_info.h>
-#include <cynara-client.h>
-#include <cynara-session.h>
-
-#include "common.h"
 
 #define UDEV_MONITOR_POLL_TIMEOUT_MILISECONDS 100
 #define UDEV_MONITOR_POLL_ITERATIONS 10 //! How many times to poll? Affects the total timeout.
-#define BUFF_MAX 255
-#define UID_MAX_LENGTH 16
-#define PRIVILEGE_PERIPHERALIO "http://tizen.org/privilege/peripheralio"
 
 int peripheral_lock(const char *file_name)
 {
@@ -53,49 +45,6 @@ bool peripheral_is_feature_supported(const char *feature_name, int *feature_stat
        return *feature_state == PERIPHERAL_FEATURE_TRUE;
 }
 
-bool peripheral_is_privilege_supported(void)
-{
-       cynara *cynara = NULL;
-       FILE *fp = NULL;
-       char uid[UID_MAX_LENGTH];
-       char *session = NULL;
-       char smack_label[BUFF_MAX] = {0, };
-       int ret;
-
-       if (cynara_initialize(&cynara, NULL) != CYNARA_API_SUCCESS) {
-               _E("failed to initialize cynara");
-               return false;
-       }
-
-       fp = fopen("/proc/self/attr/current", "r");
-       if (fp != NULL) {
-               int ch = 0;
-               int idx = 0;
-               while (EOF != (ch = fgetc(fp))) {
-                       smack_label[idx] = ch;
-                       idx++;
-               }
-               fclose(fp);
-       }
-
-       pid_t pid = getpid();
-       session = cynara_session_from_pid(pid);
-       snprintf(uid, UID_MAX_LENGTH, "%d", getuid());
-       uid[UID_MAX_LENGTH - 1] = '\0';
-
-       ret = cynara_check(cynara, smack_label, session, uid, PRIVILEGE_PERIPHERALIO);
-       if (session)
-               free(session);
-       if (cynara)
-               cynara_finish(cynara);
-       if (ret != CYNARA_API_ACCESS_ALLOWED) {
-               _E("'%s' privilege is not supported", PRIVILEGE_PERIPHERALIO);
-               return false;
-       }
-
-       return true;
-}
-
 int peripheral_create_udev_monitor(struct udev **udev, struct udev_monitor **monitor, const char *filter_name)
 {
        struct udev_monitor *_monitor = NULL;
index 42cb9a509329f9fb43c9b5db96732bb75b8553b8..45a1a54c8d949c4978c5cbfbebd53a0e41e4b468 100644 (file)
@@ -100,7 +100,6 @@ bool peripheral_is_feature_supported(const char *feature_name, int *feature_stat
                return feature == PERIPHERAL_FEATURE_TRUE; \
        }
 
-bool peripheral_is_privilege_supported(void);
 int peripheral_create_udev_monitor(struct udev **udev, struct udev_monitor **monitor, const char *filter_name);
 
 typedef bool (*UdevCompareFunc)(struct udev_device *, void *);
index e4b76234258bf5ea48fee254dcd4146e3d43da71..788d813f934818f02c71ddce876f431acea2abec 100644 (file)
@@ -56,7 +56,6 @@ static inline void cleanup_handlep(peripheral_adc_h *handle)
  */
 int peripheral_adc_open(int device, int channel, peripheral_adc_h *adc)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "ADC feature is not supported");
        RETVM_IF(adc == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid adc handle");
        RETVM_IF(device < 0, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid adc device number");
@@ -90,7 +89,6 @@ int peripheral_adc_open(int device, int channel, peripheral_adc_h *adc)
  */
 int peripheral_adc_close(peripheral_adc_h adc)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "ADC feature is not supported");
        RETVM_IF(adc == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "adc handle is NULL");
 
@@ -104,7 +102,6 @@ int peripheral_adc_close(peripheral_adc_h adc)
  */
 int peripheral_adc_read(peripheral_adc_h adc, uint32_t *value)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "ADC feature is not supported");
        RETVM_IF(adc == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "adc handle is NULL");
        RETVM_IF(value == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "adc read value is invalid");
index 3460df7da628f2398480a87feaa58d48e7d1b153..0e8fd548b634f42762936a4dfd0d36683bef9d9c 100644 (file)
@@ -84,7 +84,6 @@ int peripheral_gpio_open(int gpio_pin, peripheral_gpio_h *gpio)
 {
        int ret = PERIPHERAL_ERROR_NONE;
 
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "GPIO feature is not supported");
        RETVM_IF(gpio == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid gpio handle");
        RETVM_IF(gpio_pin < 0, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid gpio pin number");
@@ -127,7 +126,6 @@ int peripheral_gpio_open(int gpio_pin, peripheral_gpio_h *gpio)
  */
 int peripheral_gpio_close(peripheral_gpio_h gpio)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "GPIO feature is not supported");
        RETVM_IF(gpio == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "gpio handle is NULL");
 
@@ -145,7 +143,6 @@ int peripheral_gpio_close(peripheral_gpio_h gpio)
  */
 int peripheral_gpio_set_direction(peripheral_gpio_h gpio, peripheral_gpio_direction_e direction)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "GPIO feature is not supported");
        RETVM_IF(gpio == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "gpio handle is NULL");
        RETVM_IF((direction < PERIPHERAL_GPIO_DIRECTION_IN) || (direction > PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW), PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid direction input");
@@ -178,7 +175,6 @@ int peripheral_gpio_set_direction(peripheral_gpio_h gpio, peripheral_gpio_direct
  */
 int peripheral_gpio_set_edge_mode(peripheral_gpio_h gpio, peripheral_gpio_edge_e edge)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "GPIO feature is not supported");
        RETVM_IF(gpio == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "gpio handle is NULL");
        RETVM_IF((edge < PERIPHERAL_GPIO_EDGE_NONE) || (edge > PERIPHERAL_GPIO_EDGE_BOTH), PERIPHERAL_ERROR_INVALID_PARAMETER, "edge input is invalid");
@@ -276,7 +272,6 @@ static gpointer __peripheral_gpio_poll(void *data)
  */
 int peripheral_gpio_set_interrupted_cb(peripheral_gpio_h gpio, peripheral_gpio_interrupted_cb callback, void *user_data)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "GPIO feature is not supported");
        RETVM_IF(gpio == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "gpio handle is NULL");
        RETVM_IF(callback == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "gpio interrupted callback is NULL");
@@ -297,7 +292,6 @@ int peripheral_gpio_set_interrupted_cb(peripheral_gpio_h gpio, peripheral_gpio_i
  */
 int peripheral_gpio_unset_interrupted_cb(peripheral_gpio_h gpio)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "GPIO feature is not supported");
        RETVM_IF(gpio == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "gpio handle is NULL");
 
@@ -316,7 +310,6 @@ int peripheral_gpio_unset_interrupted_cb(peripheral_gpio_h gpio)
  */
 int peripheral_gpio_read(peripheral_gpio_h gpio, uint32_t *value)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "GPIO feature is not supported");
        RETVM_IF(gpio == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "gpio handle is NULL");
        RETVM_IF(value == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "gpio read value is invalid");
@@ -335,7 +328,6 @@ int peripheral_gpio_read(peripheral_gpio_h gpio, uint32_t *value)
  */
 int peripheral_gpio_write(peripheral_gpio_h gpio, uint32_t value)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "GPIO feature is not supported");
        RETVM_IF(gpio == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "gpio handle is NULL");
        RETVM_IF((value != 0) && (value != 1), PERIPHERAL_ERROR_INVALID_PARAMETER, "gpio value is invalid");
index 37116135853c2a50172b20cfa7c6a92c8f5bf4ca..cd64453132b4ae944cd3c14479887447ec6408c1 100644 (file)
@@ -83,7 +83,6 @@ int peripheral_i2c_open_flags(int bus, int address, peripheral_open_flags_e flag
        int ret;
        char path[DEV_PATH_FMT_MAX_SIZE] = {0, };       /* space for /dev/i2c-%d */
 
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "I2C feature is not supported");
        RETVM_IF(i2c == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid i2c handle");
        RETVM_IF(bus < 0 || address < 0, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid parameter");
@@ -121,7 +120,6 @@ int peripheral_i2c_open(int bus, int address, peripheral_i2c_h *i2c)
 
 int peripheral_i2c_close(peripheral_i2c_h i2c)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "I2C feature is not supported");
        RETVM_IF(i2c == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "i2c handle is NULL");
 
@@ -147,7 +145,6 @@ static int i2c_readwrite(peripheral_i2c_h i2c, uint8_t read_write, uint32_t size
 
 int peripheral_i2c_read(peripheral_i2c_h i2c, uint8_t *data_out, uint32_t length)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "I2C feature is not supported");
        RETVM_IF(i2c == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "i2c handle is NULL");
        RETVM_IF(data_out == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid parameter");
@@ -168,7 +165,6 @@ int peripheral_i2c_read(peripheral_i2c_h i2c, uint8_t *data_out, uint32_t length
 
 int peripheral_i2c_write(peripheral_i2c_h i2c, uint8_t *data_in, uint32_t length)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "I2C feature is not supported");
        RETVM_IF(i2c == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "i2c handle is NULL");
        RETVM_IF(data_in == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid parameter");
@@ -184,7 +180,6 @@ int peripheral_i2c_write(peripheral_i2c_h i2c, uint8_t *data_in, uint32_t length
 
 int peripheral_i2c_read_register_byte(peripheral_i2c_h i2c, uint8_t reg, uint8_t *data_out)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "I2C feature is not supported");
        RETVM_IF(i2c == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "i2c handle is NULL");
        RETVM_IF(data_out == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid parameter");
@@ -201,7 +196,6 @@ int peripheral_i2c_read_register_byte(peripheral_i2c_h i2c, uint8_t reg, uint8_t
 
 int peripheral_i2c_write_register_byte(peripheral_i2c_h i2c, uint8_t reg, uint8_t data_in)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "I2C feature is not supported");
        RETVM_IF(i2c == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "i2c handle is NULL");
 
@@ -213,7 +207,6 @@ int peripheral_i2c_write_register_byte(peripheral_i2c_h i2c, uint8_t reg, uint8_
 
 int peripheral_i2c_read_register_word(peripheral_i2c_h i2c, uint8_t reg, uint16_t *data_out)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "I2C feature is not supported");
        RETVM_IF(i2c == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "i2c handle is NULL");
        RETVM_IF(data_out == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid parameter");
@@ -230,7 +223,6 @@ int peripheral_i2c_read_register_word(peripheral_i2c_h i2c, uint8_t reg, uint16_
 
 int peripheral_i2c_write_register_word(peripheral_i2c_h i2c, uint8_t reg, uint16_t data_in)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "I2C feature is not supported");
        RETVM_IF(i2c == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "i2c handle is NULL");
 
index 63f5945c1d3323d2a25a9e56b9729f8608fe0dcf..fe0bafd3b76be52417a815a190c460b7b3aa337d 100644 (file)
@@ -175,7 +175,6 @@ int peripheral_pwm_open(int chip, int pin, peripheral_pwm_h *pwm)
 {
        int ret = PERIPHERAL_ERROR_NONE;
 
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "PWM feature is not supported");
        RETVM_IF(pwm == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid pwm handle");
        RETVM_IF(chip < 0 || pin < 0, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid parameter");
@@ -242,7 +241,6 @@ int peripheral_pwm_open(int chip, int pin, peripheral_pwm_h *pwm)
 
 int peripheral_pwm_close(peripheral_pwm_h pwm)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "PWM feature is not supported");
        RETVM_IF(pwm == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "pwm handle is NULL");
 
@@ -251,7 +249,6 @@ int peripheral_pwm_close(peripheral_pwm_h pwm)
 
 int peripheral_pwm_set_period(peripheral_pwm_h pwm, uint32_t period_ns)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "PWM feature is not supported");
        RETVM_IF(pwm == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "pwm handle is NULL");
 
@@ -268,7 +265,6 @@ int peripheral_pwm_set_period(peripheral_pwm_h pwm, uint32_t period_ns)
 
 int peripheral_pwm_set_duty_cycle(peripheral_pwm_h pwm, uint32_t duty_cycle_ns)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "PWM feature is not supported");
        RETVM_IF(pwm == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "pwm handle is NULL");
 
@@ -285,7 +281,6 @@ int peripheral_pwm_set_duty_cycle(peripheral_pwm_h pwm, uint32_t duty_cycle_ns)
 
 int peripheral_pwm_set_polarity(peripheral_pwm_h pwm, peripheral_pwm_polarity_e polarity)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "PWM feature is not supported");
        RETVM_IF(pwm == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "pwm handle is NULL");
        RETVM_IF((polarity < PERIPHERAL_PWM_POLARITY_ACTIVE_HIGH) || (polarity > PERIPHERAL_PWM_POLARITY_ACTIVE_LOW), PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid polarity parameter");
@@ -303,7 +298,6 @@ int peripheral_pwm_set_polarity(peripheral_pwm_h pwm, peripheral_pwm_polarity_e
 
 int peripheral_pwm_set_enabled(peripheral_pwm_h pwm, bool enable)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "PWM feature is not supported");
        RETVM_IF(pwm == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "pwm handle is NULL");
 
index 5049ef458e72243405d5790c2b43e1423367bbd1..8e84a29b7f6db1810b4e12a7cb8e64af1ce27608 100644 (file)
@@ -52,7 +52,7 @@ static inline void cleanup_handlep(peripheral_spi_h *handle)
 
 int peripheral_spi_open(int bus, int cs, peripheral_spi_h *spi)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
+
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "SPI feature is not supported");
        RETVM_IF(spi == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid spi handle");
        RETVM_IF(bus < 0 || cs < 0, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid parameter");
@@ -82,7 +82,6 @@ int peripheral_spi_open(int bus, int cs, peripheral_spi_h *spi)
 
 int peripheral_spi_close(peripheral_spi_h spi)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "SPI feature is not supported");
        RETVM_IF(spi == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "spi handle is NULL");
 
@@ -93,7 +92,6 @@ int peripheral_spi_close(peripheral_spi_h spi)
 
 int peripheral_spi_set_mode(peripheral_spi_h spi, peripheral_spi_mode_e mode)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "SPI feature is not supported");
        RETVM_IF(spi == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "spi handle is NULL");
        RETVM_IF((mode < PERIPHERAL_SPI_MODE_0) || (mode > PERIPHERAL_SPI_MODE_3), PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid spi mode parameter");
@@ -106,7 +104,6 @@ int peripheral_spi_set_mode(peripheral_spi_h spi, peripheral_spi_mode_e mode)
 
 int peripheral_spi_set_bit_order(peripheral_spi_h spi, peripheral_spi_bit_order_e bit_order)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "SPI feature is not supported");
        RETVM_IF(spi == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "spi handle is NULL");
        RETVM_IF((bit_order < PERIPHERAL_SPI_BIT_ORDER_MSB) || (bit_order > PERIPHERAL_SPI_BIT_ORDER_LSB), PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid bit order parameter");
@@ -119,7 +116,6 @@ int peripheral_spi_set_bit_order(peripheral_spi_h spi, peripheral_spi_bit_order_
 
 int peripheral_spi_set_bits_per_word(peripheral_spi_h spi, uint8_t bits)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "SPI feature is not supported");
        RETVM_IF(spi == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "spi handle is NULL");
 
@@ -131,7 +127,6 @@ int peripheral_spi_set_bits_per_word(peripheral_spi_h spi, uint8_t bits)
 
 int peripheral_spi_set_frequency(peripheral_spi_h spi, uint32_t freq_hz)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "SPI feature is not supported");
        RETVM_IF(spi == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "spi handle is NULL");
 
@@ -143,7 +138,6 @@ int peripheral_spi_set_frequency(peripheral_spi_h spi, uint32_t freq_hz)
 
 int peripheral_spi_read(peripheral_spi_h spi, uint8_t *data, uint32_t length)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "SPI feature is not supported");
        RETVM_IF(spi == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "spi handle is NULL");
        RETVM_IF(data == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid parameter");
@@ -162,7 +156,6 @@ int peripheral_spi_read(peripheral_spi_h spi, uint8_t *data, uint32_t length)
 
 int peripheral_spi_write(peripheral_spi_h spi, uint8_t *data, uint32_t length)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "SPI feature is not supported");
        RETVM_IF(spi == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "spi handle is NULL");
        RETVM_IF(data == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid parameter");
@@ -181,7 +174,6 @@ int peripheral_spi_write(peripheral_spi_h spi, uint8_t *data, uint32_t length)
 
 int peripheral_spi_transfer(peripheral_spi_h spi, uint8_t *txdata, uint8_t *rxdata, uint32_t length)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "SPI feature is not supported");
        RETVM_IF(spi == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "spi handle is NULL");
        RETVM_IF(txdata == NULL || rxdata == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid parameter");
index fff6deb436ab860a541e49702d61f7d9ba5ad566..936f3c37346fe31e14da76172a0e1577b3fa25c2 100644 (file)
@@ -101,7 +101,6 @@ static int peripheral_uart_find_devpath(int port, char *buffer, int len)
  */
 int peripheral_uart_open_flags(int port, peripheral_open_flags_e flags, peripheral_uart_h *uart)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "UART feature is not supported");
        RETVM_IF(uart == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid uart handle");
        RETVM_IF(port < 0, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid port number");
@@ -181,7 +180,6 @@ int peripheral_uart_open(int port, peripheral_uart_h *uart)
 
 int peripheral_uart_flush(peripheral_uart_h uart)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "UART feature is not supported");
        RETVM_IF(uart == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "uart handle is NULL");
 
@@ -193,7 +191,6 @@ int peripheral_uart_flush(peripheral_uart_h uart)
 
 int peripheral_uart_drain(peripheral_uart_h uart)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "UART feature is not supported");
        RETVM_IF(uart == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "uart handle is NULL");
 
@@ -208,7 +205,6 @@ int peripheral_uart_drain(peripheral_uart_h uart)
  */
 int peripheral_uart_close(peripheral_uart_h uart)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "UART feature is not supported");
        RETVM_IF(uart == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "uart handle is NULL");
 
@@ -224,7 +220,6 @@ int peripheral_uart_close(peripheral_uart_h uart)
  */
 int peripheral_uart_set_baud_rate(peripheral_uart_h uart, peripheral_uart_baud_rate_e baud)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "UART feature is not supported");
        RETVM_IF(uart == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "uart handle is NULL");
        RETVM_IF((baud < PERIPHERAL_UART_BAUD_RATE_0) || (baud > PERIPHERAL_UART_BAUD_RATE_230400), PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid baud input");
@@ -252,7 +247,6 @@ int peripheral_uart_set_baud_rate(peripheral_uart_h uart, peripheral_uart_baud_r
 
 int peripheral_uart_set_byte_size(peripheral_uart_h uart, peripheral_uart_byte_size_e byte_size)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "UART feature is not supported");
        RETVM_IF(uart == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "uart handle is NULL");
        RETVM_IF((byte_size < PERIPHERAL_UART_BYTE_SIZE_5BIT) || (byte_size > PERIPHERAL_UART_BYTE_SIZE_8BIT), PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid parameter");
@@ -278,7 +272,6 @@ int peripheral_uart_set_byte_size(peripheral_uart_h uart, peripheral_uart_byte_s
 
 int peripheral_uart_set_parity(peripheral_uart_h uart, peripheral_uart_parity_e parity)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "UART feature is not supported");
        RETVM_IF(uart == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "uart handle is NULL");
        RETVM_IF((parity < PERIPHERAL_UART_PARITY_NONE) || (parity > PERIPHERAL_UART_PARITY_ODD), PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid parameter");
@@ -316,7 +309,6 @@ int peripheral_uart_set_parity(peripheral_uart_h uart, peripheral_uart_parity_e
 
 int peripheral_uart_set_stop_bits(peripheral_uart_h uart, peripheral_uart_stop_bits_e stop_bits)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "UART feature is not supported");
        RETVM_IF(uart == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "uart handle is NULL");
        RETVM_IF((stop_bits < PERIPHERAL_UART_STOP_BITS_1BIT) || (stop_bits > PERIPHERAL_UART_STOP_BITS_2BIT), PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid parameter");
@@ -345,7 +337,6 @@ int peripheral_uart_set_stop_bits(peripheral_uart_h uart, peripheral_uart_stop_b
  */
 int peripheral_uart_set_flow_control(peripheral_uart_h uart, peripheral_uart_software_flow_control_e sw_flow_control, peripheral_uart_hardware_flow_control_e hw_flow_control)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "UART feature is not supported");
        RETVM_IF(uart == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "uart handle is NULL");
        RETVM_IF((sw_flow_control < PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE) || (sw_flow_control > PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF), PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid sw_flow_control parameter");
@@ -380,7 +371,6 @@ int peripheral_uart_set_flow_control(peripheral_uart_h uart, peripheral_uart_sof
  */
 int peripheral_uart_read(peripheral_uart_h uart, uint8_t *data, uint32_t length)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "UART feature is not supported");
        RETVM_IF(uart == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "uart handle is NULL");
        RETVM_IF(data == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid parameter");
@@ -397,7 +387,6 @@ int peripheral_uart_read(peripheral_uart_h uart, uint8_t *data, uint32_t length)
  */
 int peripheral_uart_write(peripheral_uart_h uart, uint8_t *data, uint32_t length)
 {
-       RETVM_IF(!peripheral_is_privilege_supported(), PERIPHERAL_ERROR_PERMISSION_DENIED, "Peripheral-io privilege is not supported");
        RETVM_IF(!__is_feature_supported(), PERIPHERAL_ERROR_NOT_SUPPORTED, "UART feature is not supported");
        RETVM_IF(uart == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "uart handle is NULL");
        RETVM_IF(data == NULL, PERIPHERAL_ERROR_INVALID_PARAMETER, "Invalid parameter");