From 58b3d98c75efee0bbeff5894f32ccd596efc77c0 Mon Sep 17 00:00:00 2001 From: Segwon Date: Mon, 20 Nov 2017 17:39:44 +0900 Subject: [PATCH] [2/5] fd passing: include fd list in gdbus open function Change-Id: I6a5b6c42940f4dd903bd0479fe1ed287923c5348 Signed-off-by: Segwon --- src/daemon/include/peripheral_bus_gdbus_gpio.h | 1 + src/daemon/include/peripheral_bus_gdbus_i2c.h | 1 + src/daemon/include/peripheral_bus_gdbus_pwm.h | 1 + src/daemon/include/peripheral_bus_gdbus_spi.h | 1 + src/daemon/include/peripheral_bus_gdbus_uart.h | 1 + src/daemon/peripheral_bus_gdbus_gpio.c | 6 +++++- src/daemon/peripheral_bus_gdbus_i2c.c | 5 ++++- src/daemon/peripheral_bus_gdbus_pwm.c | 5 ++++- src/daemon/peripheral_bus_gdbus_spi.c | 6 +++++- src/daemon/peripheral_bus_gdbus_uart.c | 5 ++++- src/daemon/peripheral_io.xml | 5 +++++ 11 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/daemon/include/peripheral_bus_gdbus_gpio.h b/src/daemon/include/peripheral_bus_gdbus_gpio.h index 4eb59df..6036c99 100644 --- a/src/daemon/include/peripheral_bus_gdbus_gpio.h +++ b/src/daemon/include/peripheral_bus_gdbus_gpio.h @@ -22,6 +22,7 @@ gboolean handle_gpio_open( PeripheralIoGdbusGpio *gpio, GDBusMethodInvocation *invocation, + GUnixFDList *fd_list, gint pin, gpointer user_data); diff --git a/src/daemon/include/peripheral_bus_gdbus_i2c.h b/src/daemon/include/peripheral_bus_gdbus_i2c.h index 9a40a9b..b098b04 100644 --- a/src/daemon/include/peripheral_bus_gdbus_i2c.h +++ b/src/daemon/include/peripheral_bus_gdbus_i2c.h @@ -22,6 +22,7 @@ gboolean handle_i2c_open( PeripheralIoGdbusI2c *i2c, GDBusMethodInvocation *invocation, + GUnixFDList *fd_list, gint bus, gint address, gpointer user_data); diff --git a/src/daemon/include/peripheral_bus_gdbus_pwm.h b/src/daemon/include/peripheral_bus_gdbus_pwm.h index 1694123..650e7d6 100644 --- a/src/daemon/include/peripheral_bus_gdbus_pwm.h +++ b/src/daemon/include/peripheral_bus_gdbus_pwm.h @@ -22,6 +22,7 @@ gboolean handle_pwm_open( PeripheralIoGdbusPwm *pwm, GDBusMethodInvocation *invocation, + GUnixFDList *fd_list, gint chip, gint pin, gpointer user_data); diff --git a/src/daemon/include/peripheral_bus_gdbus_spi.h b/src/daemon/include/peripheral_bus_gdbus_spi.h index 54a02e5..199e632 100644 --- a/src/daemon/include/peripheral_bus_gdbus_spi.h +++ b/src/daemon/include/peripheral_bus_gdbus_spi.h @@ -22,6 +22,7 @@ gboolean handle_spi_open( PeripheralIoGdbusSpi *spi, GDBusMethodInvocation *invocation, + GUnixFDList *fd_list, gint bus, gint cs, gpointer user_data); diff --git a/src/daemon/include/peripheral_bus_gdbus_uart.h b/src/daemon/include/peripheral_bus_gdbus_uart.h index 639caa0..7cfbfa0 100644 --- a/src/daemon/include/peripheral_bus_gdbus_uart.h +++ b/src/daemon/include/peripheral_bus_gdbus_uart.h @@ -22,6 +22,7 @@ gboolean handle_uart_open( PeripheralIoGdbusUart *uart, GDBusMethodInvocation *invocation, + GUnixFDList *fd_list, gint port, gpointer user_data); diff --git a/src/daemon/peripheral_bus_gdbus_gpio.c b/src/daemon/peripheral_bus_gdbus_gpio.c index baf6f56..778f2c6 100644 --- a/src/daemon/peripheral_bus_gdbus_gpio.c +++ b/src/daemon/peripheral_bus_gdbus_gpio.c @@ -15,6 +15,7 @@ */ #include +#include #include "peripheral_io_gdbus.h" #include "peripheral_bus.h" @@ -37,6 +38,7 @@ static void __gpio_on_name_vanished(GDBusConnection *connection, gboolean handle_gpio_open( PeripheralIoGdbusGpio *gpio, GDBusMethodInvocation *invocation, + GUnixFDList *fd_list, gint pin, gpointer user_data) { @@ -44,6 +46,8 @@ gboolean handle_gpio_open( peripheral_bus_s *pb_data = (peripheral_bus_s*)user_data; pb_data_h gpio_handle = NULL; + GUnixFDList *gpio_fd_list = NULL; + if ((ret = peripheral_bus_gpio_open(pin, &gpio_handle, user_data)) < PERIPHERAL_ERROR_NONE) goto out; @@ -63,7 +67,7 @@ gboolean handle_gpio_open( _D("gpio : %d, id = %s", gpio_handle->dev.gpio.pin, gpio_handle->client_info.id); out: - peripheral_io_gdbus_gpio_complete_open(gpio, invocation, GPOINTER_TO_UINT(gpio_handle), ret); + peripheral_io_gdbus_gpio_complete_open(gpio, invocation, gpio_fd_list, GPOINTER_TO_UINT(gpio_handle), ret); return true; } \ No newline at end of file diff --git a/src/daemon/peripheral_bus_gdbus_i2c.c b/src/daemon/peripheral_bus_gdbus_i2c.c index e162031..8b21ac3 100644 --- a/src/daemon/peripheral_bus_gdbus_i2c.c +++ b/src/daemon/peripheral_bus_gdbus_i2c.c @@ -37,6 +37,7 @@ static void __i2c_on_name_vanished(GDBusConnection *connection, gboolean handle_i2c_open( PeripheralIoGdbusI2c *i2c, GDBusMethodInvocation *invocation, + GUnixFDList *fd_list, gint bus, gint address, gpointer user_data) @@ -45,6 +46,8 @@ gboolean handle_i2c_open( peripheral_error_e ret = PERIPHERAL_ERROR_NONE; pb_data_h i2c_handle = NULL; + GUnixFDList *i2c_fd_list = NULL; + if ((ret = peripheral_bus_i2c_open(bus, address, &i2c_handle, user_data)) < PERIPHERAL_ERROR_NONE) goto out; @@ -65,7 +68,7 @@ gboolean handle_i2c_open( _D("bus : %d, address : 0x%x, id = %s", bus, address, i2c_handle->client_info.id); out: - peripheral_io_gdbus_i2c_complete_open(i2c, invocation, GPOINTER_TO_UINT(i2c_handle), ret); + peripheral_io_gdbus_i2c_complete_open(i2c, invocation, i2c_fd_list, GPOINTER_TO_UINT(i2c_handle), ret); return true; } diff --git a/src/daemon/peripheral_bus_gdbus_pwm.c b/src/daemon/peripheral_bus_gdbus_pwm.c index 21518c2..f4ad8e2 100644 --- a/src/daemon/peripheral_bus_gdbus_pwm.c +++ b/src/daemon/peripheral_bus_gdbus_pwm.c @@ -37,6 +37,7 @@ static void __pwm_on_name_vanished(GDBusConnection *connection, gboolean handle_pwm_open( PeripheralIoGdbusPwm *pwm, GDBusMethodInvocation *invocation, + GUnixFDList *fd_list, gint chip, gint pin, gpointer user_data) @@ -45,6 +46,8 @@ gboolean handle_pwm_open( peripheral_error_e ret = PERIPHERAL_ERROR_NONE; pb_data_h pwm_handle = NULL; + GUnixFDList *pwm_fd_list = NULL; + if ((ret = peripheral_bus_pwm_open(chip, pin, &pwm_handle, user_data)) < PERIPHERAL_ERROR_NONE) goto out; @@ -65,7 +68,7 @@ gboolean handle_pwm_open( _D("chip : %d, pin : %d, id = %s", chip, pin, pwm_handle->client_info.id); out: - peripheral_io_gdbus_pwm_complete_open(pwm, invocation, GPOINTER_TO_UINT(pwm_handle), ret); + peripheral_io_gdbus_pwm_complete_open(pwm, invocation, pwm_fd_list, GPOINTER_TO_UINT(pwm_handle), ret); return true; } diff --git a/src/daemon/peripheral_bus_gdbus_spi.c b/src/daemon/peripheral_bus_gdbus_spi.c index 2246996..d85870e 100644 --- a/src/daemon/peripheral_bus_gdbus_spi.c +++ b/src/daemon/peripheral_bus_gdbus_spi.c @@ -37,6 +37,7 @@ static void __spi_on_name_vanished(GDBusConnection *connection, gboolean handle_spi_open( PeripheralIoGdbusSpi *spi, GDBusMethodInvocation *invocation, + GUnixFDList *fd_list, gint bus, gint cs, gpointer user_data) @@ -45,6 +46,8 @@ gboolean handle_spi_open( peripheral_error_e ret = PERIPHERAL_ERROR_NONE; pb_data_h spi_handle = NULL; + GUnixFDList *spi_fd_list = NULL; + if ((ret = peripheral_bus_spi_open(bus, cs, &spi_handle, user_data)) < PERIPHERAL_ERROR_NONE) goto out; @@ -65,7 +68,8 @@ gboolean handle_spi_open( _D("bus : %d, cs : %d, id = %s", bus, cs, spi_handle->client_info.id); out: - peripheral_io_gdbus_spi_complete_open(spi, invocation, GPOINTER_TO_UINT(spi_handle), ret); + peripheral_io_gdbus_spi_complete_open(spi, invocation, spi_fd_list, GPOINTER_TO_UINT(spi_handle), ret); return true; } + diff --git a/src/daemon/peripheral_bus_gdbus_uart.c b/src/daemon/peripheral_bus_gdbus_uart.c index e2ba4a0..f05d02f 100644 --- a/src/daemon/peripheral_bus_gdbus_uart.c +++ b/src/daemon/peripheral_bus_gdbus_uart.c @@ -37,6 +37,7 @@ static void __uart_on_name_vanished(GDBusConnection *connection, gboolean handle_uart_open( PeripheralIoGdbusUart *uart, GDBusMethodInvocation *invocation, + GUnixFDList *fd_list, gint port, gpointer user_data) { @@ -44,6 +45,8 @@ gboolean handle_uart_open( peripheral_error_e ret = PERIPHERAL_ERROR_NONE; pb_data_h uart_handle = NULL; + GUnixFDList *uart_fd_list = NULL; + if ((ret = peripheral_bus_uart_open(port, &uart_handle, user_data)) < PERIPHERAL_ERROR_NONE) goto out; @@ -64,7 +67,7 @@ gboolean handle_uart_open( _D("port : %d, id = %s", port, uart_handle->client_info.id); out: - peripheral_io_gdbus_uart_complete_open(uart, invocation, GPOINTER_TO_UINT(uart_handle), ret); + peripheral_io_gdbus_uart_complete_open(uart, invocation, uart_fd_list, GPOINTER_TO_UINT(uart_handle), ret); return true; } diff --git a/src/daemon/peripheral_io.xml b/src/daemon/peripheral_io.xml index 5f3aa84..6b987a3 100644 --- a/src/daemon/peripheral_io.xml +++ b/src/daemon/peripheral_io.xml @@ -2,6 +2,7 @@ + @@ -9,6 +10,7 @@ + @@ -17,6 +19,7 @@ + @@ -25,6 +28,7 @@ + @@ -32,6 +36,7 @@ + -- 2.7.4