Configure wfd-manager using config file 19/143919/6 submit/tizen/20170823.015938
authorMilind Ramesh Murhekar <m.murhekar@samsung.com>
Mon, 14 Aug 2017 03:13:23 +0000 (08:43 +0530)
committerMilind Ramesh Murhekar <m.murhekar@samsung.com>
Mon, 21 Aug 2017 10:56:12 +0000 (16:26 +0530)
Description: This patch adds the support to configure
wfd-manager using config files for common configurable parameters
for different platforms (TV, Mobile, TM1, Wearable).

config file path: /etc/wifi-direct/wifi-direct-manager.conf

Configurable parameters
1. Interface
2. Group interface
3. Device name
4. Primary/Secondary device type
5. Go intent
6. Persistent reconnect
7. listen reg class
8. Listen channel
9. Operating reg class
10. Operating channel
11. Config method
12. No group iface flag

Remove MACRO dependency to configure

Change-Id: Ic520f38a0c88ea251dbe0e0df23218d57e0a7a59
Signed-off-by: Milind Ramesh Murhekar <m.murhekar@samsung.com>
16 files changed:
CMakeLists.txt
files/wifi-direct-manager.conf.in
files/wifi-direct-manager.conf.mobile [new file with mode: 0644]
files/wifi-direct-manager.conf.tm1 [new file with mode: 0644]
files/wifi-direct-manager.conf.tv [new file with mode: 0644]
files/wifi-direct-manager.conf.wearable [new file with mode: 0644]
include/wifi-direct-group.h
include/wifi-direct-manager.h
oem/wifi-direct-oem.c
oem/wifi-direct-oem.h
packaging/wifi-direct-manager.spec
plugin/wpasupplicant/ctrl_iface_dbus/include/wfd-plugin-wpasupplicant.h
plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c
src/wifi-direct-iface.c
src/wifi-direct-manager.c
src/wifi-direct-util.c

index c3a0ba49347092b4bb8bc887580d5e211095f059..378e88a5a7f3ab6850857171877d8d5e7c292b2f 100644 (file)
@@ -27,9 +27,6 @@ SET(ARCH "${ARCHITECTURE}")
 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
 ADD_DEFINITIONS("-DUSE_DLOG")
 
-IF(TIZEN_WLAN_BOARD_SPRD)
-       ADD_DEFINITIONS(-DTIZEN_WLAN_BOARD_SPRD)
-ENDIF(TIZEN_WLAN_BOARD_SPRD)
 IF(TIZEN_TETHERING_ENABLE)
        ADD_DEFINITIONS(-DTIZEN_TETHERING_ENABLE)
 ENDIF(TIZEN_TETHERING_ENABLE)
@@ -38,26 +35,10 @@ IF(TIZEN_ARCH_64)
        ADD_DEFINITIONS(-DTIZEN_ARCH_64)
 ENDIF(TIZEN_ARCH_64)
 
-IF(TIZEN_PROFILE_COMMON)
-       ADD_DEFINITIONS(-DTIZEN_PROFILE_COMMON)
-ENDIF(TIZEN_PROFILE_COMMON)
-
-IF(TIZEN_PROFILE_MOBILE)
-       ADD_DEFINITIONS(-DTIZEN_PROFILE_MOBILE)
-ENDIF(TIZEN_PROFILE_MOBILE)
-
-IF(TIZEN_PROFILE_TV)
-       ADD_DEFINITIONS(-DTIZEN_PROFILE_TV)
-ENDIF(TIZEN_PROFILE_TV)
-
 IF(TIZEN_DEBUG_DBUS_VALUE)
        ADD_DEFINITIONS(-DTIZEN_DEBUG_DBUS_VALUE)
 ENDIF(TIZEN_DEBUG_DBUS_VALUE)
 
-IF(TIZEN_ENABLE_PRD)
-       ADD_DEFINITIONS(-DTIZEN_ENABLE_PRD)
-ENDIF(TIZEN_ENABLE_PRD)
-
 SET(SRCS
        ${CMAKE_SOURCE_DIR}/src/wifi-direct-manager.c
        ${CMAKE_SOURCE_DIR}/src/wifi-direct-state.c
index dfb13dd35275c4bb2ba42dfd187a315c71e1c6f8..3ae1ab30316641a0ff92ab3ae36ae0007452e312 100644 (file)
@@ -2,3 +2,31 @@
 on_demand=yes
 connection_agent=yes
 ip_over_eapol=yes
+# default common interface
+interface=wlan0
+# default group interface
+group_interface=p2p0
+# default device name
+device_name=Tizen
+# default primary device type
+primary_device_type=10
+# default secondary device type
+secondary_device_type=5
+# default GO intent
+go_intent=7
+# default persistent reconnect
+persistent_reconnect=1
+# default listen reg class
+listen_reg_class=81
+# default listen channel
+listen_channel=1
+# default operating reg class
+operating_reg_class=81
+# default operating channel
+operating_channel=1
+# default config method
+config_methods=display push_button keypad p2ps
+# default no group interface
+no_group_iface=0
+# Group operating frequency
+group_operating_freq=2
diff --git a/files/wifi-direct-manager.conf.mobile b/files/wifi-direct-manager.conf.mobile
new file mode 100644 (file)
index 0000000..1a4fcd6
--- /dev/null
@@ -0,0 +1,33 @@
+# Configure wfd-manager for mobile device
+[wfd-manager]
+on_demand=yes
+connection_agent=yes
+ip_over_eapol=yes
+# default common interface
+interface=wlan0
+# default group interface
+group_interface=p2p0
+# default device name
+device_name=Tizen
+# default primary device type
+primary_device_type=10
+# default secondary device type
+secondary_device_type=5
+# default GO intent
+go_intent=7
+# default persistent reconnect
+persistent_reconnect=1
+# default listen reg class
+listen_reg_class=81
+# default listen channel
+listen_channel=1
+# default operating reg class
+operating_reg_class=81
+# default operating channel
+operating_channel=1
+# default config method
+config_methods=display push_button keypad p2ps
+# default no group interface
+no_group_iface=0
+# Group operating frequency
+group_operating_freq=2
diff --git a/files/wifi-direct-manager.conf.tm1 b/files/wifi-direct-manager.conf.tm1
new file mode 100644 (file)
index 0000000..0058d73
--- /dev/null
@@ -0,0 +1,33 @@
+# Configure wfd-manager for TM1 device
+[wfd-manager]
+on_demand=yes
+connection_agent=yes
+ip_over_eapol=yes
+# default common interface
+interface=wlan0
+# default group interface
+group_interface=p2p0
+# default device name
+device_name=Tizen
+# default primary device type
+primary_device_type=10
+# default secondary device type
+secondary_device_type=5
+# default GO intent
+go_intent=7
+# default persistent reconnect
+persistent_reconnect=1
+# default listen reg class
+listen_reg_class=81
+# default listen channel
+listen_channel=1
+# default operating reg class
+operating_reg_class=81
+# default operating channel
+operating_channel=1
+# default config method
+config_methods=display push_button keypad p2ps
+# default no group interface
+no_group_iface=0
+# Group operating frequency
+group_operating_freq=2
diff --git a/files/wifi-direct-manager.conf.tv b/files/wifi-direct-manager.conf.tv
new file mode 100644 (file)
index 0000000..fe0b8e9
--- /dev/null
@@ -0,0 +1,33 @@
+# Configure wfd-manager for TV device
+[wfd-manager]
+on_demand=yes
+connection_agent=yes
+ip_over_eapol=yes
+# default common interface
+interface=p2p0
+# default group interface
+group_interface=p2p0
+# default device name
+device_name=[TV]Tizen
+# default primary device type
+primary_device_type=7
+# default secondary device type
+secondary_device_type=1
+# default GO intent
+go_intent=7
+# default persistent reconnect
+persistent_reconnect=1
+# default listen reg class
+listen_reg_class=81
+# default listen channel
+listen_channel=1
+# default operating reg class
+operating_reg_class=81
+# default operating channel
+operating_channel=1
+# default config method
+config_methods=keypad virtual_push_button physical_display
+# default no group interface
+no_group_iface=1
+# Group operating frequency
+group_operating_freq=2
diff --git a/files/wifi-direct-manager.conf.wearable b/files/wifi-direct-manager.conf.wearable
new file mode 100644 (file)
index 0000000..3b2e646
--- /dev/null
@@ -0,0 +1,33 @@
+# Configure wfd-manager for werable device
+[wfd-manager]
+on_demand=yes
+connection_agent=yes
+ip_over_eapol=yes
+# default common interface
+interface=wlan0
+# default group interface
+group_interface=p2p0
+# default device name
+device_name=Tizen
+# default primary device type
+primary_device_type=10
+# default secondary device type
+secondary_device_type=5
+# default GO intent
+go_intent=7
+# default persistent reconnect
+persistent_reconnect=1
+# default listen reg class
+listen_reg_class=81
+# default listen channel
+listen_channel=1
+# default operating reg class
+operating_reg_class=81
+# default operating channel
+operating_channel=1
+# default config method
+config_methods=display push_button keypad p2ps
+# default no group interface
+no_group_iface=0
+# Group operating frequency
+group_operating_freq=2
index fad27cd219a2bd98e74c436ce239cf75f65b00df..be46c4bb55cd143ca6ea3a694553c47a88d2c0a8 100644 (file)
 #define __WIFI_DIRECT_GROUP_H__
 
 #define IFACE_NAME_LEN 16
-
-#ifndef TIZEN_WLAN_BOARD_SPRD
 #define WFD_FREQ_2G 2
-#endif
 
 typedef enum {
        WFD_GROUP_FLAG_NONE,
index ac4e20050b64eb00950f73491290a04584891f3c..a4b0b9c6b5976dbb1504d961366f12a77a707e3e 100644 (file)
 #ifndef __WIFI_DIRECT_MANAGER_H__
 #define __WIFI_DIRECT_MANAGER_H__
 
-#define DEFAULT_DEVICE_NAME "Tizen_Device"
-
-#if defined TIZEN_PROFILE_MOBILE
-#      if defined TIZEN_WLAN_BOARD_SPRD
-#              define DEFAULT_IFNAME "p2p0"
-#              define GROUP_IFNAME "p2p0"
-#      else /* TIZEN_WLAN_BOARD_SPRD */
-#              define DEFAULT_IFNAME "wlan0"
-#              define GROUP_IFNAME "p2p-wlan0-0"
-#      endif /* TIZEN_WLAN_BOARD_SPRD */
-#      define DEFAULT_PRIMARY_DEVICE_TYPE WIFI_DIRECT_PRIMARY_DEVICE_TYPE_TELEPHONE
-#      define DEFAULT_SECONDARY_DEVICE_TYPE WIFI_DIRECT_SECONDARY_DEVICE_TYPE_TELEPHONE_SMARTPHONE_DUAL
-#endif /* TIZEN_PROFILE_MOBILE */
-
-#if defined TIZEN_PROFILE_TV
-#      define DEFAULT_IFNAME "p2p0"
-#      define GROUP_IFNAME "p2p0"
-#      define DEFAULT_PRIMARY_DEVICE_TYPE WIFI_DIRECT_PRIMARY_DEVICE_TYPE_DISPLAY
-#      define DEFAULT_SECONDARY_DEVICE_TYPE WIFI_DIRECT_SECONDARY_DEVICE_TYPE_DISPLAY_TV
-#endif /* TIZEN_PROFILE_TV */
-
-#ifndef DEFAULT_IFNAME
-#      define DEFAULT_IFNAME "p2p0"
-#endif
-
-#ifndef GROUP_IFNAME
-#      define GROUP_IFNAME "p2p0"
-#endif
-
-#ifndef DEFAULT_PRIMARY_DEVICE_TYPE
-#      define DEFAULT_PRIMARY_DEVICE_TYPE WIFI_DIRECT_PRIMARY_DEVICE_TYPE_TELEPHONE
-#endif
-
-#ifndef DEFAULT_SECONDARY_DEVICE_TYPE
-#      define DEFAULT_SECONDARY_DEVICE_TYPE WIFI_DIRECT_SECONDARY_DEVICE_TYPE_TELEPHONE_SMARTPHONE_DUAL
-#endif
+#define DEFAULT_IFNAME "p2p0"
+#define GROUP_IFNAME   "p2p0"
+#define DEFAULT_PRIMARY_DEVICE_TYPE WIFI_DIRECT_PRIMARY_DEVICE_TYPE_TELEPHONE
+#define DEFAULT_SECONDARY_DEVICE_TYPE WIFI_DIRECT_SECONDARY_DEVICE_TYPE_TELEPHONE_SMARTPHONE_DUAL
 
 #define WFD_MAX_CLIENT 16
 #define WFD_MAX_STATION 8
@@ -206,6 +174,7 @@ typedef struct {
        gboolean is_on_demand;
        gboolean is_connection_agent;
        gboolean is_ip_over_eapol;
+       void *wfd_oem_conf;
 } wfd_manager_s;
 
 wfd_manager_s *wfd_get_manager();
index 2b97992fbe00aea9a6f0803a743443922b760eb3..504dd48ec941d8bc72f7ae64e7fb8574dda69011 100644 (file)
@@ -40,6 +40,14 @@ wfd_oem_prd_event_cbs_s g_prd_event_cbs;
 
 wfd_oem_event_cbs_s g_event_cbs;
 
+int wfd_oem_configure(wfd_oem_ops_s *ops, wfd_oem_config_s *conf)
+{
+       if (!ops || !ops->configure)
+               return -1;
+
+       return ops->configure(conf);
+}
+
 int wfd_oem_init(wfd_oem_ops_s *ops)
 {
        if (!ops || !ops->init)
index c4a02399c87693cf93765554712a5f89a626e595..2a6de5e4a982dfb7cb7be671d9be167781037c13 100644 (file)
 #define SUPPL_PRD_PLUGIN_64BIT_PATH "/usr/lib64/wifi-direct-prd-plugin-wpasupplicant.so"
 #endif /* TIZEN_ENABLE_PRD */
 
+#define COMMON_IFACE_NAME "wlan0"
+#define P2P_IFACE_NAME "p2p0"
+#define GROUP_IFACE_NAME "p2p0"
+#define GROUP_IFACE_PREFIX "p2p"
+#define PRIMARY_DEVICE_TYPE "\x00\x0a\x00\x50\xf2\x04\x00\x05"
+#define DEFAULT_DEVICE_NAME "Tizen"
+#define DEFAULT_GO_INTENT 7
+#define DEFAULT_PERSISTENT_RECONNECT 1
+#define DEFAULT_LISTEN_REG_CLASS 81
+#define DEFAULT_LISTEN_CHANNEL 1
+#define DEFAULT_OPER_REG_CLASS 81
+#define DEFAULT_OPER_CHANNEL 1
+#define DEFAULT_CONFIG_METHOD "display push_button keypad p2ps"
+#define DEFAULT_NO_GROUP_IFACE 0
+
 #define OEM_MACSTR_LEN 18
 #define OEM_MACADDR_LEN 6
 #define OEM_IPADDR_LEN 4
@@ -46,6 +61,7 @@
 #define OEM_SERVICE_TYPE_LEN 8
 #define OEM_QUERY_ID_LEN 15
 #define OEM_SERVICE_MAX_LEN 1024
+#define OEM_CONFIG_METHOD_LEN 256
 
 /* Referring to Wi-Fi Peer-to-Peer Services Technical Specification v1.1
  * The default P2Ps PIN is 12345670. Any device decided to be GO will use
@@ -173,6 +189,23 @@ typedef enum {
        WFD_OEM_DISPLAY_TYPE_DUAL,
 } wfd_oem_display_type_e;
 
+typedef struct {
+       char ifname[OEM_IFACE_NAME_LEN+1];
+       char group_ifname[OEM_IFACE_NAME_LEN+1];
+       char device_name[OEM_DEV_NAME_LEN+1];
+       int pri_dev_type;
+       int sec_dev_type;
+       int go_intent;
+       gboolean persistent_reconnect;
+       int listen_reg_class;
+       int listen_channel;
+       int operating_reg_class;
+       int operating_channel;
+       char config_methods[OEM_CONFIG_METHOD_LEN+1];
+       gboolean no_group_iface;
+       int group_operating_freq;
+} wfd_oem_config_s;
+
 typedef struct {
        int type;
        int availability;
@@ -586,6 +619,7 @@ typedef struct {
 } wfd_oem_event_cbs_s;
 
 typedef struct {
+       int (*configure) (wfd_oem_config_s *conf);
        int (*init) (wfd_oem_event_cbs_s *event_cbs);
        int (*deinit) (void);
        int (*activate) (int concurrent);
@@ -659,6 +693,7 @@ typedef struct {
        void *extra_data;
 } wfd_oem_ops_s;
 
+int wfd_oem_configure(wfd_oem_ops_s *ops, wfd_oem_config_s *conf);
 int wfd_oem_init(wfd_oem_ops_s *ops);
 int wfd_oem_destroy(wfd_oem_ops_s *ops);
 int wfd_oem_activate(wfd_oem_ops_s *ops, int concurrent);
index ab812d15c8ca02e03b9119c033dca30d160e209a..de03b56b737efbdc9c4ce2db2a72d0c15a95dc87 100644 (file)
@@ -8,7 +8,7 @@
 
 Name:          wifi-direct-manager
 Summary:       Wi-Fi Direct manger
-Version:       1.2.238
+Version:       1.2.239
 Release:       1
 Group:      Network & Connectivity/Wireless
 License:    Apache-2.0
@@ -17,6 +17,7 @@ Source1:      dbus-wfd-manager.conf
 Source2:       net.wifidirect.service
 Source3:       wifi-direct-manager.service
 Source4:       500.wifi-direct-manager_upgrade.sh
+
 BuildRequires: pkgconfig(capi-network-wifi-direct)
 BuildRequires: pkgconfig(gio-2.0)
 BuildRequires: pkgconfig(dlog)
@@ -25,17 +26,12 @@ BuildRequires:  pkgconfig(libnl-2.0)
 BuildRequires: pkgconfig(dbus-1)
 BuildRequires: pkgconfig(aul)
 BuildRequires:  pkgconfig(capi-system-info)
-
 BuildRequires: pkgconfig(capi-appfw-application)
 BuildRequires:  pkgconfig(libsystemd-login)
-
-BuildRequires: pkgconfig(libtzplatform-config)
-
+BuildRequires:  pkgconfig(libtzplatform-config)
 BuildRequires: cmake
-#BuildRequires:  model-build-features
+
 Requires:      net-tools
-#Requires:     sys-assert
-#Requires:     tizen-coreutils
 Requires:      %{name}-compat = %{version}-%{release}
 Recommends:    %{name}-profile_common = %{version}-%{release}
 
@@ -49,7 +45,7 @@ Manager for handling wifi-direct functionalities
 # if common || ivi || "undefined"
 %if "%{?profile}" != "wearable" && "%{?profile}" != "tv" && "%{?profile}" != "mobile"
 %package profile_common
-Summary:       Wi-Fi Direct manger for common/ivi
+Summary:       Wi-Fi Direct manager for common/ivi
 Provides:      %{name}-compat = %{version}-%{release}
 Provides:      %{name}-profile_ivi = %{version}-%{release}
 Conflicts:     %{name}-profile_mobile
@@ -63,7 +59,7 @@ Manager for handling wifi-direct functionalities for common/ivi
 # if mobile || "undefined"
 %if "%{?profile}" != "wearable" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
 %package profile_mobile
-Summary:       Wi-Fi Direct manger for mobile
+Summary:       Wi-Fi Direct manager for mobile
 Provides:      %{name}-compat = %{version}-%{release}
 Conflicts:     %{name}-profile_common
 Conflicts:     %{name}-profile_wearable
@@ -84,7 +80,7 @@ Manager for handling wifi-direct functionalities for mobile TM1
 # if wearable || "undefined"
 %if "%{?profile}" != "mobile" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
 %package profile_wearable
-Summary:       Wi-Fi Direct manger for wearable
+Summary:       Wi-Fi Direct manager for wearable
 Provides:      %{name}-compat = %{version}-%{release}
 Conflicts:     %{name}-profile_common
 Conflicts:     %{name}-profile_mobile
@@ -97,7 +93,7 @@ Manager for handling wifi-direct functionalities for wearable
 # if tv || "undefined"
 %if "%{?profile}" != "mobile" && "%{?profile}" != "wearable" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
 %package profile_tv
-Summary:       Wi-Fi Direct manger for tv
+Summary:       Wi-Fi Direct manager for tv
 Provides:      %{name}-compat = %{version}-%{release}
 Conflicts:     %{name}-profile_common
 Conflicts:     %{name}-profile_mobile
@@ -209,12 +205,10 @@ export ARCH=i586
 mkdir -p build_mobile
 pushd build_mobile
 cmake .. -DCMAKE_INSTALL_PREFIX=%{_prefix} -DARCHITECTURE=$ARCH \
-       -DTIZEN_ENABLE_PRD=0 \
 %if ! 0%{?model_build_feature_network_tethering_disable}
        -DTIZEN_TETHERING_ENABLE=0 \
 %endif
        -DTIZEN_DEBUG_DBUS_VALUE=1 \
-       -DTIZEN_PROFILE_MOBILE=1 \
 %if "%{?_lib}" == "lib64"
        -DTIZEN_ARCH_64=1 \
 %endif
@@ -233,13 +227,10 @@ popd
 mkdir -p build_tm1
 pushd build_tm1
 cmake .. -DCMAKE_INSTALL_PREFIX=%{_prefix} -DARCHITECTURE=$ARCH \
-       -DTIZEN_ENABLE_PRD=0 \
 %if ! 0%{?model_build_feature_network_tethering_disable}
        -DTIZEN_TETHERING_ENABLE=0 \
 %endif
-       -DTIZEN_WLAN_BOARD_SPRD=1 \
        -DTIZEN_DEBUG_DBUS_VALUE=1 \
-       -DTIZEN_PROFILE_MOBILE=1 \
 %if "%{?_lib}" == "lib64"
        -DTIZEN_ARCH_64=1 \
 %endif
@@ -262,12 +253,10 @@ popd
 mkdir -p build_wearable
 pushd build_wearable
 cmake .. -DCMAKE_INSTALL_PREFIX=%{_prefix} -DARCHITECTURE=$ARCH \
-       -DTIZEN_ENABLE_PRD=0 \
 %if ! 0%{?model_build_feature_network_tethering_disable}
        -DTIZEN_TETHERING_ENABLE=0 \
 %endif
        -DTIZEN_DEBUG_DBUS_VALUE=1 \
-       -DTIZEN_PROFILE_COMMON=1 \
 %if "%{?_lib}" == "lib64"
        -DTIZEN_ARCH_64=1 \
 %endif
@@ -289,12 +278,10 @@ popd
 mkdir -p build_tv
 pushd build_tv
 cmake .. -DCMAKE_INSTALL_PREFIX=%{_prefix} -DARCHITECTURE=$ARCH \
-       -DTIZEN_ENABLE_PRD=0 \
 %if ! 0%{?model_build_feature_network_tethering_disable}
        -DTIZEN_TETHERING_ENABLE=0 \
 %endif
        -DTIZEN_DEBUG_DBUS_VALUE=1 \
-       -DTIZEN_PROFILE_TV=1 \
 %if "%{?_lib}" == "lib64"
        -DTIZEN_ARCH_64=1 \
 %endif
@@ -315,12 +302,10 @@ popd
 %if "%{?profile}" != "wearable" && "%{?profile}" != "tv" && "%{?profile}" != "mobile"
 # common
 cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DARCHITECTURE=$ARCH \
-       -DTIZEN_ENABLE_PRD=0 \
 %if ! 0%{?model_build_feature_network_tethering_disable}
        -DTIZEN_TETHERING_ENABLE=0 \
 %endif
        -DTIZEN_DEBUG_DBUS_VALUE=1 \
-       -DTIZEN_PROFILE_COMMON=1 \
 %if "%{?_lib}" == "lib64"
        -DTIZEN_ARCH_64=1 \
 %endif
@@ -335,24 +320,22 @@ cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DARCHITECTURE=$ARCH \
 make %{?_smp_mflags}
 %endif
 
-
 %install
 rm -rf %{buildroot}
+mkdir -p %{buildroot}/etc/wifi-direct
 
 # This is for backward-compatibility. This does not deteriorate 4.0 Configurability
 # if mobile || "undefined"
 %if "%{?profile}" != "wearable" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
+cp files/wifi-direct-manager.conf.mobile %{buildroot}/etc/wifi-direct/wifi-direct-manager.conf.mobile
 pushd build_mobile
 %make_install
-mv %{buildroot}%{_bindir}/wfd-manager %{buildroot}%{_bindir}/wfd-manager.mobile
-mv %{buildroot}%{_libdir}/wifi-direct-plugin-wpasupplicant.so %{buildroot}%{_libdir}/wifi-direct-plugin-wpasupplicant.so.mobile
 popd
 
 %ifarch %{arm}
+cp files/wifi-direct-manager.conf.tm1 %{buildroot}/etc/wifi-direct/wifi-direct-manager.conf.tm1
 pushd build_tm1
 %make_install
-mv %{buildroot}%{_bindir}/wfd-manager %{buildroot}%{_bindir}/wfd-manager.tm1
-mv %{buildroot}%{_libdir}/wifi-direct-plugin-wpasupplicant.so %{buildroot}%{_libdir}/wifi-direct-plugin-wpasupplicant.so.tm1
 popd
 %endif
 %endif
@@ -360,20 +343,18 @@ popd
 # This is for backward-compatibility. This does not deteriorate 4.0 Configurability
 # if wearable || "undefined"
 %if "%{?profile}" != "mobile" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
+cp files/wifi-direct-manager.conf.wearable %{buildroot}/etc/wifi-direct/wifi-direct-manager.conf.wearable
 pushd build_wearable
 %make_install
-mv %{buildroot}%{_bindir}/wfd-manager %{buildroot}%{_bindir}/wfd-manager.wearable
-mv %{buildroot}%{_libdir}/wifi-direct-plugin-wpasupplicant.so %{buildroot}%{_libdir}/wifi-direct-plugin-wpasupplicant.so.wearable
 popd
 %endif
 
 # This is for backward-compatibility. This does not deteriorate 4.0 Configurability
 # if tv || "undefined"
 %if "%{?profile}" != "mobile" && "%{?profile}" != "wearable" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
+cp files/wifi-direct-manager.conf.tv %{buildroot}/etc/wifi-direct/wifi-direct-manager.conf.tv
 pushd build_tv
 %make_install
-mv %{buildroot}%{_bindir}/wfd-manager %{buildroot}%{_bindir}/wfd-manager.tv
-mv %{buildroot}%{_libdir}/wifi-direct-plugin-wpasupplicant.so %{buildroot}%{_libdir}/wifi-direct-plugin-wpasupplicant.so.tv
 popd
 %endif
 
@@ -416,8 +397,8 @@ chmod 666 %{TZ_SYS_VAR}/lib/misc/dhcpd.leases
 # if mobile || "undefined"
 %if "%{?profile}" != "wearable" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
 %post profile_mobile
+mv -f %{_sysconfdir}/wifi-direct/wifi-direct-manager.conf.mobile %{_sysconfdir}/wifi-direct/wifi-direct-manager.conf
 pushd %{_bindir}
-ln -sf wfd-manager.mobile wfd-manager
 popd
 %preun profile_mobile
 case "$1" in
@@ -434,7 +415,6 @@ esac
 
 %post -n wifi-direct-plugin-wpasupplicant-profile_mobile
 pushd %{_libdir}
-ln -sf wifi-direct-plugin-wpasupplicant.so.mobile wifi-direct-plugin-wpasupplicant.so
 popd
 /sbin/ldconfig
 
@@ -442,7 +422,6 @@ popd
 case "$1" in
   0)
     # This is an un-installation.
-       rm %{_libdir}/wifi-direct-plugin-wpasupplicant.so
        /sbin/ldconfig
   ;;
   1)
@@ -454,14 +433,13 @@ esac
 
 %ifarch %{arm}
 %post extension-TM1
+mv -f %{_sysconfdir}/wifi-direct/wifi-direct-manager.conf.tm1 %{_sysconfdir}/wifi-direct/wifi-direct-manager.conf
 pushd %{_bindir}
-ln -sf wfd-manager.tm1 wfd-manager
 popd
 %preun extension-TM1
 case "$1" in
   0)
     # This is an un-installation.
-       rm %{_bindir}/wfd-manager
   ;;
   1)
     # This is an upgrade.
@@ -472,7 +450,6 @@ esac
 
 %post -n wifi-direct-plugin-wpasupplicant-extension-TM1
 pushd %{_libdir}
-ln -sf wifi-direct-plugin-wpasupplicant.so.tm1 wifi-direct-plugin-wpasupplicant.so
 popd
 /sbin/ldconfig
 
@@ -481,7 +458,6 @@ case "$1" in
   0)
     # This is an un-installation.
        pushd %{_libdir}
-       rm wifi-direct-plugin-wpasupplicant.so
        popd
   ;;
   1)
@@ -498,14 +474,13 @@ esac
 # if wearable || "undefined"
 %if "%{?profile}" != "mobile" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
 %post profile_wearable
+mv -f %{_sysconfdir}/wifi-direct/wifi-direct-manager.conf.wearable %{_sysconfdir}/wifi-direct/wifi-direct-manager.conf
 pushd %{_bindir}
-ln -sf wfd-manager.wearable wfd-manager
 popd
 %preun profile_wearable
 case "$1" in
   0)
     # This is an un-installation.
-       rm %{_bindir}/wfd-manager
   ;;
   1)
     # This is an upgrade.
@@ -516,7 +491,6 @@ esac
 
 %post -n wifi-direct-plugin-wpasupplicant-profile_wearable
 pushd %{_libdir}
-ln -sf wifi-direct-plugin-wpasupplicant.so.wearable wifi-direct-plugin-wpasupplicant.so
 popd
 /sbin/ldconfig
 
@@ -524,7 +498,6 @@ popd
 case "$1" in
   0)
     # This is an un-installation.
-       rm %{_libdir}/wifi-direct-plugin-wpasupplicant.so
        /sbin/ldconfig
   ;;
   1)
@@ -539,8 +512,8 @@ esac
 # if tv || "undefined"
 %if "%{?profile}" != "mobile" && "%{?profile}" != "wearable" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
 %post profile_tv
+mv -f %{_sysconfdir}/wifi-direct/wifi-direct-manager.conf.tv %{_sysconfdir}/wifi-direct/wifi-direct-manager.conf
 pushd %{_bindir}
-ln -sf wfd-manager.tv wfd-manager
 popd
 %preun profile_tv
 case "$1" in
@@ -557,7 +530,6 @@ esac
 
 %post -n wifi-direct-plugin-wpasupplicant-profile_tv
 pushd %{_libdir}
-ln -sf wifi-direct-plugin-wpasupplicant.so.tv wifi-direct-plugin-wpasupplicant.so
 popd
 /sbin/ldconfig
 
@@ -565,7 +537,6 @@ popd
 case "$1" in
   0)
     # This is an un-installation.
-       rm %{_libdir}/wifi-direct-plugin-wpasupplicant.so
        /sbin/ldconfig
   ;;
   1)
@@ -623,23 +594,19 @@ esac
 # if mobile || "undefined"
 %if "%{?profile}" != "wearable" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
 %files profile_mobile
-%defattr(-,network_fw,network_fw,-)
-%{_bindir}/wfd-manager.mobile
+%attr(644,root,root) %{_sysconfdir}/wifi-direct/wifi-direct-manager.conf.mobile
 
 %files -n wifi-direct-plugin-wpasupplicant-profile_mobile
 %manifest wifi-direct-plugin-wpasupplicant.manifest
 %defattr(-,network_fw,network_fw,-)
-%{_libdir}/wifi-direct-plugin-wpasupplicant.so.mobile
 
 %ifarch %{arm}
 %files extension-TM1
-%defattr(-,network_fw,network_fw,-)
-%{_bindir}/wfd-manager.tm1
+%attr(644,root,root) %{_sysconfdir}/wifi-direct/wifi-direct-manager.conf.tm1
 
 %files -n wifi-direct-plugin-wpasupplicant-extension-TM1
 %manifest wifi-direct-plugin-wpasupplicant.manifest
 %defattr(-,network_fw,network_fw,-)
-%{_libdir}/wifi-direct-plugin-wpasupplicant.so.tm1
 %endif
 %endif
 
@@ -647,26 +614,22 @@ esac
 # if wearable || "undefined"
 %if "%{?profile}" != "mobile" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
 %files profile_wearable
-%defattr(-,network_fw,network_fw,-)
-%{_bindir}/wfd-manager.wearable
+%attr(644,root,root) %{_sysconfdir}/wifi-direct/wifi-direct-manager.conf.wearable
 
 %files -n wifi-direct-plugin-wpasupplicant-profile_wearable
 %manifest wifi-direct-plugin-wpasupplicant.manifest
 %defattr(-,network_fw,network_fw,-)
-%{_libdir}/wifi-direct-plugin-wpasupplicant.so.wearable
 %endif
 
 # This is for backward-compatibility. This does not deteriorate 4.0 Configurability
 # if tv || "undefined"
 %if "%{?profile}" != "mobile" && "%{?profile}" != "wearable" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
 %files profile_tv
-%defattr(-,network_fw,network_fw,-)
-%{_bindir}/wfd-manager.tv
+%attr(644,root,root) %{_sysconfdir}/wifi-direct/wifi-direct-manager.conf.tv
 
 %files -n wifi-direct-plugin-wpasupplicant-profile_tv
 %manifest wifi-direct-plugin-wpasupplicant.manifest
 %defattr(-,network_fw,network_fw,-)
-%{_libdir}/wifi-direct-plugin-wpasupplicant.so.tv
 %endif
 
 #%files -n wifi-direct-prd-plugin-wpasupplicant
index d07dcee3804862bf290973ac713e7252ec7b19f4..304cb5ff8da750660ab1367972a5fa3d4a4dd18e 100644 (file)
 #define OBJECT_PATH_MAX 150
 #define MAX_SIZE_ERROR_BUFFER 256
 
-#if defined(TIZEN_PROFILE_MOBILE) || defined(TIZEN_PROFILE_COMMON)
-#define COMMON_IFACE_NAME "wlan0"
-
-#      if defined TIZEN_WLAN_BOARD_SPRD
-#              define P2P_IFACE_NAME "p2p0"
-#              define GROUP_IFACE_NAME "p2p0"
-#              define GROUP_IFACE_PREFIX "p2p"
-#      else /* TIZEN_WLAN_BOARD_SPRD */
-#              define GROUP_IFACE_NAME "p2p-wlan0-0"
-#              define GROUP_IFACE_PREFIX "p2p-wlan0-"
-#      endif /* TIZEN_WLAN_BOARD_SPRD */
-
-#      define PRIMARY_DEVICE_TYPE "\x00\x0a\x00\x50\xf2\x04\x00\x05"
-#      define DEFAULT_DEVICE_NAME "Tizen"
-#      define DEFAULT_GO_INTENT 7
-#      define DEFAULT_PERSISTENT_RECONNECT 1
-#      define DEFAULT_LISTEN_REG_CLASS 81
-#      define DEFAULT_LISTEN_CHANNEL 1
-#      define DEFAULT_OPER_REG_CLASS 81
-#      define DEFAULT_OPER_CHANNEL 1
-#      define DEFAULT_CONFIG_METHOD "display push_button keypad p2ps"
-#      define DEFAULT_NO_GROUP_IFACE 0
-#endif /* TIZEN_PROFILE_MOBILE */
-
-#if defined TIZEN_PROFILE_TV
-
-#      define COMMON_IFACE_NAME "p2p0"
-#      define GROUP_IFACE_NAME "p2p0"
-#      define GROUP_IFACE_PREFIX "p2p"
-
-#      define PRIMARY_DEVICE_TYPE "\x00\x07\x00\x50\xf2\x04\x00\x01"
-#      define DEFAULT_DEVICE_NAME "[TV]Tizen"
-#      define DEFAULT_GO_INTENT 7
-#      define DEFAULT_PERSISTENT_RECONNECT 1
-#      define DEFAULT_LISTEN_REG_CLASS 81
-#      define DEFAULT_LISTEN_CHANNEL 1
-#      define DEFAULT_OPER_REG_CLASS 81
-#      define DEFAULT_OPER_CHANNEL 1
-#      define DEFAULT_CONFIG_METHOD "keypad virtual_push_button physical_display"
-#      define DEFAULT_NO_GROUP_IFACE 1
-#endif /* TIZEN_PROFILE_TV */
-
-#if 0
-#define COMMON_IFACE_NAME "p2p0"
-#define DEFAULT_CONFIG_METHOD "push_button"
-#define DEFAULT_NO_GROUP_IFACE 0
-#define GROUP_IFACE_NAME "p2p0"
-#define GROUP_IFACE_PREFIX "p2p"
-#define PRIMARY_DEVICE_TYPE "\x00\x07\x00\x50\xf2\x04\x00\x01"
-#define DEFAULT_DEVICE_NAME "[TV]Tizen"
-#define DEFAULT_GO_INTENT 7
-#define DEFAULT_PERSISTENT_RECONNECT 1
-#define DEFAULT_LISTEN_REG_CLASS 81
-#define DEFAULT_LISTEN_CHANNEL 1
-#define DEFAULT_OPER_REG_CLASS 115
-#define DEFAULT_OPER_CHANNEL 48
-#define DEFAULT_CONFIG_METHOD "keypad virtual_push_button physical_display"
-#define DEFAULT_NO_GROUP_IFACE 1
-#endif
 
 #define DEFAULT_IP_GO "\xc0\xa8\x31\x01"
 #define DEFAULT_IP_MASK "\xff\xff\xff\x00"
@@ -371,6 +312,7 @@ typedef struct {
        wfd_oem_event_cbs_s *callback;
 } ws_dbus_plugin_data_s;
 
+int ws_configure(wfd_oem_config_s *conf);
 int ws_init(wfd_oem_event_cbs_s *event_cbs);
 int ws_deinit(void);
 int ws_activate(int concurrent);
index bb5f2df0c965a7c0c03af33d2de22eb5e6f74f60..9d7a193b2e58ac058d7917524efe3e9f884e9c66 100644 (file)
@@ -72,6 +72,7 @@
 #endif
 
 static wfd_oem_ops_s supplicant_ops = {
+       .configure = ws_configure,
        .init = ws_init,
        .deinit = ws_deinit,
        .activate = ws_activate,
@@ -147,6 +148,7 @@ static wfd_oem_ops_s supplicant_ops = {
 };
 
 static ws_dbus_plugin_data_s *g_pd;
+static wfd_oem_config_s *config = NULL;
 static int is_peer_joined_notified = 0;
 static int is_peer_disconnected_notified = 0;
 
@@ -643,9 +645,7 @@ static void _ws_process_interface_removed(GDBusConnection *connection,
        if (!g_strcmp0(g_pd->group_iface_path, interface_path)) {
                WDP_LOGD("p2p group interface removed");
                memset(g_pd->group_iface_path, 0x0, DBUS_OBJECT_PATH_MAX);
-       }
-#if defined(TIZEN_PROFILE_MOBILE)
-       else if (!g_strcmp0(g_pd->iface_path, interface_path)) {
+       } else if (!g_strcmp0(g_pd->iface_path, interface_path)) {
 
                WDP_LOGD("p2p interface removed");
                wfd_oem_event_s event;
@@ -659,7 +659,6 @@ static void _ws_process_interface_removed(GDBusConnection *connection,
 
                memset(g_pd->iface_path, 0x0, DBUS_OBJECT_PATH_MAX);
        }
-#endif /* TIZEN_PROFILE_MOBILE */
        __WDP_LOG_FUNC_EXIT__;
 }
 
@@ -3637,7 +3636,6 @@ static int _ws_get_interface(const char *iface_name, handle_reply function, void
        return res;
 }
 
-#if defined(TIZEN_PROFILE_MOBILE) && (TIZEN_WLAN_BOARD_SPRD)
 static void __ws_remove_interface(GVariant *value, void *user_data)
 {
        __WDP_LOG_FUNC_ENTER__;
@@ -3676,7 +3674,6 @@ static void __ws_remove_interface(GVariant *value, void *user_data)
        __WDP_LOG_FUNC_EXIT__;
        return;
 }
-#endif /* (TIZEN_PROFILE_MOBILE) && (TIZEN_WLAN_BOARD_SPRD) */
 
 static int _ws_init_dbus_connection(void)
 {
@@ -3692,6 +3689,12 @@ static int _ws_init_dbus_connection(void)
                return -1;
        }
 
+       if (!config) {
+               WDP_LOGE("no configurable data found");
+               __WDP_LOG_FUNC_EXIT__;
+               return -1;
+       }
+
        conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
 
        if (conn == NULL) {
@@ -3720,15 +3723,15 @@ static int _ws_init_dbus_connection(void)
                WDP_LOGD("Subscribed supplicant iface signal [%s]", ws_supplicant_signal_map[i].member);
        }
 
-#if defined(TIZEN_PROFILE_MOBILE) && (TIZEN_WLAN_BOARD_SPRD)
-       if (_ws_get_interface(COMMON_IFACE_NAME, NULL, NULL) < 0)
-               _ws_create_interface(COMMON_IFACE_NAME, NULL, NULL);
-       if (_ws_get_interface(P2P_IFACE_NAME, __register_p2pdevice_signal, NULL) < 0)
-               res = _ws_create_interface(P2P_IFACE_NAME, __register_p2pdevice_signal, NULL);
-#else /* (TIZEN_PROFILE_MOBILE) && (TIZEN_WLAN_BOARD_SPRD) */
-       if (_ws_get_interface(COMMON_IFACE_NAME, __register_p2pdevice_signal, NULL) < 0)
-               res = _ws_create_interface(COMMON_IFACE_NAME, __register_p2pdevice_signal, NULL);
-#endif /* (TIZEN_PROFILE_MOBILE) && (TIZEN_WLAN_BOARD_SPRD) */
+       if (g_strcmp0(config->ifname, config->group_ifname) != 0) {
+               if (_ws_get_interface(config->ifname, NULL, NULL) < 0)
+                       res = _ws_create_interface(config->ifname, NULL, NULL);
+               if (_ws_get_interface(config->group_ifname, __register_p2pdevice_signal, NULL) < 0)
+                       res = _ws_create_interface(config->group_ifname, __register_p2pdevice_signal, NULL);
+       } else {
+               if (_ws_get_interface(config->ifname, __register_p2pdevice_signal, NULL) < 0)
+                       res = _ws_create_interface(config->ifname, __register_p2pdevice_signal, NULL);
+       }
 
        if (res < 0)
                WDP_LOGE("Failed to subscribe interface signal");
@@ -3861,6 +3864,30 @@ static int __ws_check_net_interface(char* if_name)
        return 0;
 }
 
+int ws_configure(wfd_oem_config_s *conf)
+{
+       __WDP_LOG_FUNC_ENTER__;
+
+       if (conf == NULL) {
+               __WDP_LOG_FUNC_EXIT__;
+               return -1;
+       }
+
+       if (config)
+               g_free(config);
+
+       config = (wfd_oem_config_s *) g_try_malloc0(sizeof(wfd_oem_config_s));
+       if (!config) {
+               __WDP_LOG_FUNC_EXIT__;
+               return -1;
+       }
+
+       memcpy(config, conf, sizeof(wfd_oem_config_s));
+
+       __WDP_LOG_FUNC_EXIT__;
+       return 0;
+}
+
 int ws_init(wfd_oem_event_cbs_s *event_cbs)
 {
        __WDP_LOG_FUNC_ENTER__;
@@ -3898,6 +3925,9 @@ int ws_deinit(void)
                g_pd = NULL;
        }
 
+       if (config)
+               g_free(config);
+
        __WDP_LOG_FUNC_EXIT__;
        return 0;
 }
@@ -4118,7 +4148,11 @@ int __ws_init_p2pdevice(void)
        GVariantBuilder *type_builder = NULL;
        dbus_method_param_s params;
 
-       const char *primary_device_type = PRIMARY_DEVICE_TYPE;
+       unsigned char primary_device_type[8] = {
+               0x00, 0x00, 0x00, 0x50,
+               0xf2, 0x04, 0x00, 0x00
+       };
+
        int i = 0;
        int res = 0;
 
@@ -4128,6 +4162,15 @@ int __ws_init_p2pdevice(void)
                return -1;
        }
 
+       if (!config) {
+               WDP_LOGE("no configurable data found");
+               __WDP_LOG_FUNC_EXIT__;
+               return -1;
+       }
+
+       primary_device_type[1] = config->pri_dev_type;
+       primary_device_type[7] = config->sec_dev_type;
+
        for (i = 0; i < WS_DEVTYPE_LEN; i++)
                WDP_LOGD("device type[%02x]", primary_device_type[i]);
 
@@ -4144,31 +4187,31 @@ int __ws_init_p2pdevice(void)
 
        builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
        g_variant_builder_add(builder, "{sv}", "DeviceName",
-                                       g_variant_new_string(DEFAULT_DEVICE_NAME));
+                                       g_variant_new_string(config->device_name));
 
        g_variant_builder_add(builder, "{sv}", "GOIntent",
-                                       g_variant_new_uint32(DEFAULT_GO_INTENT));
+                                       g_variant_new_uint32(config->go_intent));
 
        g_variant_builder_add(builder, "{sv}", "PersistentReconnect",
-                                       g_variant_new_boolean(DEFAULT_PERSISTENT_RECONNECT));
+                                       g_variant_new_boolean(config->persistent_reconnect));
 
        g_variant_builder_add(builder, "{sv}", "ListenRegClass",
-                                       g_variant_new_uint32(DEFAULT_LISTEN_REG_CLASS));
+                                       g_variant_new_uint32(config->listen_reg_class));
 
        g_variant_builder_add(builder, "{sv}", "ListenChannel",
-                                       g_variant_new_uint32(DEFAULT_LISTEN_CHANNEL));
+                                       g_variant_new_uint32(config->listen_channel));
 
        g_variant_builder_add(builder, "{sv}", "OperRegClass",
-                                       g_variant_new_uint32(DEFAULT_OPER_REG_CLASS));
+                                       g_variant_new_uint32(config->operating_reg_class));
 
        g_variant_builder_add(builder, "{sv}", "OperChannel",
-                                       g_variant_new_uint32(DEFAULT_OPER_CHANNEL));
+                                       g_variant_new_uint32(config->operating_channel));
 
        g_variant_builder_add(builder, "{sv}", "SsidPostfix",
-                                       g_variant_new_string(DEFAULT_DEVICE_NAME));
+                                       g_variant_new_string(config->device_name));
 
        g_variant_builder_add(builder, "{sv}", "NoGroupIface",
-                                       g_variant_new_boolean(DEFAULT_NO_GROUP_IFACE));
+                                       g_variant_new_boolean(config->no_group_iface));
 
        type_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
        for (i = 0; i < WS_DEVTYPE_LEN; i++)
@@ -4210,6 +4253,12 @@ int __ws_set_config_methods(void)
                return -1;
        }
 
+       if (!config) {
+               WDP_LOGE("no configurable data found");
+               __WDP_LOG_FUNC_EXIT__;
+               return -1;
+       }
+
        g_dbus = g_pd->g_dbus;
        if (!g_dbus) {
                WDP_LOGE("DBus connection is NULL");
@@ -4221,7 +4270,7 @@ int __ws_set_config_methods(void)
        dbus_set_method_param(&params, DBUS_PROPERTIES_METHOD_SET, g_pd->iface_path,
                         g_dbus);
 
-       value = g_variant_new_string(DEFAULT_CONFIG_METHOD);
+       value = g_variant_new_string(config->config_methods);
 
        param = g_variant_new("(ssv)", SUPPLICANT_WPS, "ConfigMethods", value);
        params.params = param;
@@ -4230,7 +4279,7 @@ int __ws_set_config_methods(void)
        if (res < 0)
                WDP_LOGE("Failed to send command to wpa_supplicant");
        else
-               WDP_LOGD("Succeeded to set config method(%s)", DEFAULT_CONFIG_METHOD);
+               WDP_LOGD("Succeeded to set config method(%s)", config->config_methods);
 
        __WDP_LOG_FUNC_EXIT__;
        return res;
@@ -4248,6 +4297,12 @@ int ws_activate(int concurrent)
                return -1;
        }
 
+       if (!config) {
+               WDP_LOGE("no configurable data found");
+               __WDP_LOG_FUNC_EXIT__;
+               return -1;
+       }
+
        res = __ws_p2p_supplicant_start();
        if (res < 0) {
                res = __ws_p2p_supplicant_stop();
@@ -4266,7 +4321,7 @@ int ws_activate(int concurrent)
                }
                WDP_LOGI("P2P firmware started with error %d", res);
 
-               if (__ws_check_net_interface(COMMON_IFACE_NAME) < 0) {
+               if (__ws_check_net_interface(config->ifname) < 0) {
                        usleep(150000); /* wait for 150ms */
                        concurrent = 0;
                        retry_count++;
@@ -4320,6 +4375,12 @@ int ws_deactivate(int concurrent)
                return -1;
        }
 
+       if (!config) {
+               WDP_LOGE("no configurable data found");
+               __WDP_LOG_FUNC_EXIT__;
+               return -1;
+       }
+
        if (!g_pd->activated) {
                WDP_LOGE("Wi-Fi Direct is not activated");
                __WDP_LOG_FUNC_EXIT__;
@@ -4329,11 +4390,11 @@ int ws_deactivate(int concurrent)
        ws_stop_scan();
 
        g_pd->concurrent = concurrent;
-#if defined(TIZEN_PROFILE_MOBILE) && (TIZEN_WLAN_BOARD_SPRD)
-       _ws_get_interface(P2P_IFACE_NAME, __ws_remove_interface, NULL);
+
+       if (g_strcmp0(config->ifname, config->group_ifname) != 0)
+               _ws_get_interface(config->group_ifname, __ws_remove_interface, NULL);
        if (concurrent == 0)
-               _ws_get_interface(COMMON_IFACE_NAME, __ws_remove_interface, NULL);
-#endif /* (TIZEN_PROFILE_MOBILE) && (TIZEN_WLAN_BOARD_SPRD) */
+               _ws_get_interface(config->ifname, __ws_remove_interface, NULL);
 
        _ws_deinit_dbus_connection();
 
index 2df500bfca4412e520f3f017101dc6099d1c7d29..ab65caa9a5e5a86082533ecc1f0e3bf901571278 100644 (file)
@@ -1167,6 +1167,7 @@ static void __wfd_manager_group_iface_handler(const gchar *method_name,
        if (!g_strcmp0(method_name, "CreateGroup")) {
                wfd_group_s *group = manager->group;
                wfd_oem_group_param_s param;
+               wfd_oem_config_s *oem_conf = (wfd_oem_config_s *) manager->wfd_oem_conf;
                GVariantIter *iter = NULL;
                gchar *key = NULL;
                GVariant *var = NULL;
@@ -1192,11 +1193,7 @@ static void __wfd_manager_group_iface_handler(const gchar *method_name,
                        goto failed;
                }
 
-#ifdef TIZEN_WLAN_BOARD_SPRD
-               group = wfd_create_pending_group(manager, manager->local->dev_addr);
-#else
                group = wfd_create_pending_group(manager, manager->local->intf_addr);
-#endif
                if (!group) {
                        WDS_LOGE("Failed to create pending group");
                        ret = WIFI_DIRECT_ERROR_OPERATION_FAILED;
@@ -1213,9 +1210,8 @@ static void __wfd_manager_group_iface_handler(const gchar *method_name,
                memcpy(&(param.passphrase), manager->local->passphrase,
                                        sizeof(param.passphrase));
 
-#ifndef TIZEN_WLAN_BOARD_SPRD
-               param.freq = WFD_FREQ_2G;
-#endif
+               if (oem_conf)
+                       param.freq = oem_conf->group_operating_freq;
 
                if (ssid != NULL)
                        g_strlcpy(param.ssid, ssid, WIFI_DIRECT_MAX_DEVICE_NAME_LEN+1);
index 40b52ea732074e54cd96eed94ca373281d2ed6ff..579a194e9d3835951a03880bdca5b9c18a0e0b71 100644 (file)
@@ -168,12 +168,15 @@ static int _wfd_local_init_device(wfd_manager_s *manager)
        wfd_device_s *local = NULL;
        int res = 0;
        char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+       wfd_oem_config_s *config;
 
        if (!manager) {
                WDS_LOGE("Invalid parameter");
                return -1;
        }
 
+       config = manager->wfd_oem_conf;
+
        errno = 0;
        local = (wfd_device_s*) g_try_malloc0(sizeof(wfd_device_s));
        if (!local) {
@@ -185,7 +188,10 @@ static int _wfd_local_init_device(wfd_manager_s *manager)
        res = wfd_util_get_phone_name(local->dev_name);
        if (res < 0) {
                WDS_LOGE("Failed to get phone name of local device. Use default device name");
-               g_strlcpy(local->dev_name, DEFAULT_DEVICE_NAME, DEV_NAME_LEN + 1);
+               if (config)
+                       g_strlcpy(local->dev_name, config->device_name, DEV_NAME_LEN + 1);
+               else
+                       g_strlcpy(local->dev_name, DEFAULT_DEVICE_NAME, DEV_NAME_LEN + 1);
        }
        WDS_LOGD("Local Device name [%s]", local->dev_name);
        wfd_util_set_dev_name_notification();
@@ -696,13 +702,11 @@ int wfd_manager_deactivate(wfd_manager_s *manager)
                        WDS_LOGE("Failed to destroy group before deactivation");
        }
 
-#if defined(TIZEN_PROFILE_MOBILE)
        res = wfd_util_check_wifi_state();
        if (res < 0) {
                WDS_LOGE("Failed to get wifi state");
                return WIFI_DIRECT_ERROR_OPERATION_FAILED;
        } else if (res == 0) {
-#endif /* TIZEN_PROFILE_MOBILE */
                res = wfd_oem_deactivate(manager->oem_ops, 0);
                if (res < 0) {
                        WDS_LOGE("Failed to deactivate");
@@ -710,7 +714,6 @@ int wfd_manager_deactivate(wfd_manager_s *manager)
                        wfd_util_set_wifi_direct_state(prev_state);
                        return WIFI_DIRECT_ERROR_OPERATION_FAILED;
                }
-#if defined(TIZEN_PROFILE_MOBILE)
        } else {
                /* FIXME: We should do something to stop p2p feature of Driver */
                res = wfd_oem_deactivate(manager->oem_ops, res);
@@ -722,7 +725,7 @@ int wfd_manager_deactivate(wfd_manager_s *manager)
                }
                WDS_LOGE("Do not need to deactivate Wi-Fi");
        }
-#endif /* TIZEN_PROFILE_MOBILE */
+
        WDS_LOGE("Succeeded to deactivate");
 
        wfd_state_set(manager, WIFI_DIRECT_STATE_DEACTIVATED);
@@ -1714,6 +1717,13 @@ static wfd_manager_s *wfd_manager_init()
                return NULL;
        }
 
+       manager->wfd_oem_conf = (wfd_oem_config_s*) g_try_malloc0(sizeof(wfd_oem_config_s));
+       if (!manager->wfd_oem_conf) {
+               g_free(manager);
+               WDS_LOGE("Failed to allocate memory for wfd_oem_conf structure");
+               return NULL;
+       }
+
        manager->go_intent = 7;
        manager->req_wps_mode = WFD_WPS_MODE_PBC;
        manager->max_station = 8;
@@ -1725,6 +1735,7 @@ static wfd_manager_s *wfd_manager_init()
        res = _wfd_local_init_device(manager);
        if (res < 0) {
                WDS_LOGE("Failed to initialize local device");
+               g_free(manager->wfd_oem_conf);
                g_free(manager);
                return NULL;            /* really stop manager? */
        }
@@ -1760,6 +1771,7 @@ int wfd_manager_deinit(wfd_manager_s *manager)
 
        _wfd_local_deinit_device(manager);
 
+       g_free(manager->wfd_oem_conf);
        g_free(manager);
 
        __WDS_LOG_FUNC_EXIT__;
@@ -1823,6 +1835,17 @@ static void *wfd_plugin_init(wfd_manager_s *manager)
                __WDS_LOG_FUNC_EXIT__;
                return NULL;
        }
+
+       /* Configure the plugin here,
+        * using config file parameters */
+       res = wfd_oem_configure(manager->oem_ops, manager->wfd_oem_conf);
+       if (res < 0) {
+               WDS_LOGE("Failed to configure OEM");
+               dlclose(handle);
+               __WDS_LOG_FUNC_EXIT__;
+               return NULL;
+       }
+
        WDS_LOGD("Succeeded to initialize OEM");
 
        __WDS_LOG_FUNC_EXIT__;
index 416116f9401d7bb12f0eef745d5d6c0c5c776675..a706499da58685ff1a64df687763d3f3c34afb64 100644 (file)
 
 #define TIZEN_P2P_GO_IPADDR "192.168.49.1"
 #define MAX_SIZE_ERROR_BUFFER 256
-
-#if defined TIZEN_PROFILE_TV
-#      define DEFAULT_MAC_FILE_PATH "/sys/class/net/p2p0/address"
-#endif /* TIZEN_PROFILE_TV */
-
-#ifndef DEFAULT_MAC_FILE_PATH
-#      define DEFAULT_MAC_FILE_PATH "/sys/class/net/p2p0/address"
-#endif
+#define MAX_FILE_PATH_LEN 256
+#define DEFAULT_MAC_FILE_PATH "/sys/class/net/p2p0/address"
 
 #define COUNTRY_CODE_FILE tzplatform_mkpath(TZ_SYS_RO_ETC, "wifi-direct/ccode.conf")
 #define WFD_MANGER_CONF_FILE tzplatform_mkpath(TZ_SYS_RO_ETC, "wifi-direct/wifi-direct-manager.conf")
@@ -95,6 +89,20 @@ enum wfd_util_conf_key {
        WFD_CONF_ON_DEMAND,
        WFD_CONF_CONNECTION_AGENT,
        WFD_CONF_IP_OVER_EAPOL,
+       WFD_CONF_IFACE_NAME,
+       WFD_CONF_GROUP_IFACE_NAME,
+       WFD_CONF_DEFAULT_DEVICE_NAME,
+       WFD_CONF_PRIMARY_DEVICE_TYPE,
+       WFD_CONF_SECONDARY_DEVICE_TYPE,
+       WFD_CONF_GO_INTENT,
+       WFD_CONF_PERSISTENT_RE,
+       WFD_CONF_LISTEN_REG_CLASS,
+       WFD_CONF_LISTEN_CHANNEL,
+       WFD_CONF_OPER_REG_CLASS,
+       WFD_CONF_OPER_CHANNEL,
+       WFD_CONF_CONFIG_METHOD,
+       WFD_CONF_NO_GROUP_IFACE,
+       WFD_CONF_GROUP_OPER_FREQ,
        WFD_CONF_MAX,
 };
 
@@ -102,6 +110,8 @@ struct key_value {
        int num;
        const char *key;
        char *value;
+       int int_value;
+       gboolean bool_value;
 };
 
 static GKeyFile *__load_key_file()
@@ -111,7 +121,7 @@ static GKeyFile *__load_key_file()
        GError *error = NULL;
 
        key_file = g_key_file_new();
-       if (!g_key_file_load_from_file(key_file, WFD_MANGER_CONF_FILE, 0, &error)) {
+       if (!g_key_file_load_from_file(key_file, WFD_MANGER_CONF_FILE, G_KEY_FILE_NONE, &error)) {
                WDS_LOGE("Unable to load %s: %s", WFD_MANGER_CONF_FILE, error->message);
                g_clear_error(&error);
                g_key_file_free(key_file);
@@ -140,6 +150,47 @@ static void __load_wfd_config(GKeyFile *key_file, struct key_value *conf_key_val
        }
 
        for (i = 0; i < WFD_CONF_MAX; i++) {
+
+               if ((!g_strcmp0(conf_key_val[i].key, "primary_device_type")) ||
+                       (!g_strcmp0(conf_key_val[i].key, "secondary_device_type")) ||
+                       (!g_strcmp0(conf_key_val[i].key, "go_intent")) ||
+                       (!g_strcmp0(conf_key_val[i].key, "listen_reg_class")) ||
+                       (!g_strcmp0(conf_key_val[i].key, "listen_channel")) ||
+                       (!g_strcmp0(conf_key_val[i].key, "operating_reg_class")) ||
+                       (!g_strcmp0(conf_key_val[i].key, "operating_channel")) ||
+                       (!g_strcmp0(conf_key_val[i].key, "group_operating_freq"))) {
+
+                       conf_key_val[i].int_value = g_key_file_get_integer(key_file,
+                                       WFD_CONF_GROUP_NAME, conf_key_val[i].key, &error);
+                       if (error) {
+                               WDS_LOGE("Unable to load %s : %s", conf_key_val[i].key, error->message);
+                               g_clear_error(&error);
+
+                       } else {
+                       WDS_LOGD("key [%s] value [%d]\n",
+                               conf_key_val[i].key, conf_key_val[i].int_value);
+                       }
+
+                       continue;
+               }
+
+               if (!g_strcmp0(conf_key_val[i].key, "persistent_reconnect") ||
+                       !g_strcmp0(conf_key_val[i].key, "no_group_iface")) {
+
+                       conf_key_val[i].bool_value = g_key_file_get_boolean(key_file,
+                                       WFD_CONF_GROUP_NAME, conf_key_val[i].key, &error);
+                       if (error) {
+                               WDS_LOGE("Unable to load %s : %s", conf_key_val[i].key, error->message);
+                               g_clear_error(&error);
+
+                       } else {
+                       WDS_LOGD("key [%s] value [%d]\n",
+                               conf_key_val[i].key, conf_key_val[i].bool_value);
+                       }
+
+                       continue;
+               }
+
                conf_key_val[i].value = g_key_file_get_string(key_file,
                                WFD_CONF_GROUP_NAME, conf_key_val[i].key, &error);
                if (!conf_key_val[i].value) {
@@ -183,11 +234,26 @@ void wfd_util_load_wfd_conf(wfd_manager_s * manager)
        __WDS_LOG_FUNC_ENTER__;
 
        GKeyFile *key_file = NULL;
+       wfd_oem_config_s *oem_conf = NULL;
        struct key_value wfd_conf[] = {
-                       {WFD_CONF_ON_DEMAND, "on_demand", NULL},
-                       {WFD_CONF_CONNECTION_AGENT, "connection_agent", NULL},
-                       {WFD_CONF_IP_OVER_EAPOL, "ip_over_eapol", NULL},
-                       {WFD_CONF_MAX, NULL, NULL},
+               {WFD_CONF_ON_DEMAND, "on_demand", NULL, 0, FALSE},
+               {WFD_CONF_CONNECTION_AGENT, "connection_agent", NULL, 0, FALSE},
+               {WFD_CONF_IP_OVER_EAPOL, "ip_over_eapol", NULL, 0, FALSE},
+               {WFD_CONF_IFACE_NAME, "interface", NULL, 0, FALSE},
+               {WFD_CONF_GROUP_IFACE_NAME, "group_interface", NULL, 0, FALSE},
+               {WFD_CONF_DEFAULT_DEVICE_NAME, "device_name", NULL, 0, FALSE},
+               {WFD_CONF_PRIMARY_DEVICE_TYPE, "primary_device_type", NULL, 0, FALSE},
+               {WFD_CONF_SECONDARY_DEVICE_TYPE, "secondary_device_type", NULL, 0, FALSE},
+               {WFD_CONF_GO_INTENT, "go_intent", NULL, 0, FALSE},
+               {WFD_CONF_PERSISTENT_RE, "persistent_reconnect", NULL, 0, FALSE},
+               {WFD_CONF_LISTEN_REG_CLASS, "listen_reg_class", NULL, 0, FALSE},
+               {WFD_CONF_LISTEN_CHANNEL, "listen_channel", NULL, 0, FALSE},
+               {WFD_CONF_OPER_REG_CLASS, "operating_reg_class", NULL, 0, FALSE},
+               {WFD_CONF_OPER_CHANNEL, "operating_channel", NULL, 0, FALSE},
+               {WFD_CONF_CONFIG_METHOD, "config_methods", NULL, 0, FALSE},
+               {WFD_CONF_NO_GROUP_IFACE, "no_group_iface", NULL, 0, FALSE},
+               {WFD_CONF_GROUP_OPER_FREQ, "group_operating_freq", NULL, 0, FALSE},
+               {WFD_CONF_MAX, NULL, NULL, 0, FALSE},
        };
 
        if (!manager) {
@@ -195,6 +261,12 @@ void wfd_util_load_wfd_conf(wfd_manager_s * manager)
                return;
        }
 
+       oem_conf = (wfd_oem_config_s*) manager->wfd_oem_conf;
+       if (!oem_conf) {
+               __WDS_LOG_FUNC_EXIT__;
+               return;
+       }
+
        __load_wfd_config(key_file, wfd_conf);
 
        if (wfd_conf[WFD_CONF_ON_DEMAND].value &&
@@ -215,6 +287,84 @@ void wfd_util_load_wfd_conf(wfd_manager_s * manager)
        else
                manager->is_ip_over_eapol = false;
 
+       if (wfd_conf[WFD_CONF_IFACE_NAME].value &&
+                       strlen(wfd_conf[WFD_CONF_IFACE_NAME].value) > 0)
+               g_strlcpy(oem_conf->ifname, wfd_conf[WFD_CONF_IFACE_NAME].value,
+                               IFACE_NAME_LEN+1);
+       else
+               g_strlcpy(oem_conf->ifname, DEFAULT_IFNAME, IFACE_NAME_LEN+1);
+
+       if (wfd_conf[WFD_CONF_GROUP_IFACE_NAME].value &&
+                       strlen(wfd_conf[WFD_CONF_GROUP_IFACE_NAME].value) > 0)
+               g_strlcpy(oem_conf->group_ifname,
+                               wfd_conf[WFD_CONF_GROUP_IFACE_NAME].value, IFACE_NAME_LEN+1);
+       else
+               g_strlcpy(oem_conf->group_ifname, GROUP_IFNAME, IFACE_NAME_LEN+1);
+
+       if (wfd_conf[WFD_CONF_DEFAULT_DEVICE_NAME].value &&
+                       strlen(wfd_conf[WFD_CONF_DEFAULT_DEVICE_NAME].value) > 0)
+               g_strlcpy(oem_conf->device_name,
+                               wfd_conf[WFD_CONF_DEFAULT_DEVICE_NAME].value, DEV_NAME_LEN+1);
+       else
+               g_strlcpy(oem_conf->device_name, DEFAULT_DEVICE_NAME, DEV_NAME_LEN+1);
+
+       if (wfd_conf[WFD_CONF_PRIMARY_DEVICE_TYPE].int_value > 0)
+               oem_conf->pri_dev_type = wfd_conf[WFD_CONF_PRIMARY_DEVICE_TYPE].int_value;
+       else
+               oem_conf->pri_dev_type = DEFAULT_PRIMARY_DEVICE_TYPE;
+
+       if (wfd_conf[WFD_CONF_SECONDARY_DEVICE_TYPE].int_value > 0)
+               oem_conf->sec_dev_type = wfd_conf[WFD_CONF_SECONDARY_DEVICE_TYPE].int_value;
+       else
+               oem_conf->sec_dev_type = DEFAULT_SECONDARY_DEVICE_TYPE;
+
+       if (wfd_conf[WFD_CONF_GO_INTENT].int_value > 0)
+               oem_conf->go_intent = wfd_conf[WFD_CONF_GO_INTENT].int_value;
+       else
+               oem_conf->go_intent = DEFAULT_GO_INTENT;
+
+       if (wfd_conf[WFD_CONF_PERSISTENT_RE].bool_value == TRUE)
+               oem_conf->persistent_reconnect = TRUE;
+       else
+               oem_conf->persistent_reconnect = FALSE;
+
+       if (wfd_conf[WFD_CONF_LISTEN_REG_CLASS].int_value > 0)
+               oem_conf->listen_reg_class = wfd_conf[WFD_CONF_LISTEN_REG_CLASS].int_value;
+       else
+               oem_conf->listen_reg_class = DEFAULT_LISTEN_REG_CLASS;
+
+       if (wfd_conf[WFD_CONF_LISTEN_CHANNEL].int_value > 0)
+               oem_conf->listen_channel = wfd_conf[WFD_CONF_LISTEN_CHANNEL].int_value;
+       else
+               oem_conf->listen_channel = DEFAULT_LISTEN_CHANNEL;
+
+       if (wfd_conf[WFD_CONF_OPER_REG_CLASS].int_value > 0)
+               oem_conf->operating_reg_class = wfd_conf[WFD_CONF_OPER_REG_CLASS].int_value;
+       else
+               oem_conf->operating_reg_class = DEFAULT_OPER_REG_CLASS;
+
+       if (wfd_conf[WFD_CONF_OPER_CHANNEL].int_value > 0)
+               oem_conf->operating_channel = wfd_conf[WFD_CONF_OPER_CHANNEL].int_value;
+       else
+               oem_conf->operating_channel = DEFAULT_OPER_CHANNEL;
+
+       if (wfd_conf[WFD_CONF_CONFIG_METHOD].value)
+               g_strlcpy(oem_conf->config_methods,
+                               wfd_conf[WFD_CONF_CONFIG_METHOD].value, OEM_CONFIG_METHOD_LEN+1);
+       else
+               g_strlcpy(oem_conf->config_methods,
+                               DEFAULT_CONFIG_METHOD, OEM_CONFIG_METHOD_LEN+1);
+
+       if (wfd_conf[WFD_CONF_NO_GROUP_IFACE].bool_value == TRUE)
+               oem_conf->no_group_iface = TRUE;
+       else
+               oem_conf->no_group_iface = FALSE;
+
+       if (wfd_conf[WFD_CONF_GROUP_OPER_FREQ].int_value > 0)
+               oem_conf->group_operating_freq = wfd_conf[WFD_CONF_GROUP_OPER_FREQ].int_value;
+       else
+               oem_conf->group_operating_freq = WFD_FREQ_2G;
+
        __unload_wfd_config(key_file, wfd_conf);
 
        __WDS_LOG_FUNC_EXIT__;
@@ -853,12 +1003,23 @@ int wfd_util_set_wifi_direct_state(int state)
 int wfd_util_get_local_dev_mac(unsigned char *dev_mac)
 {
        __WDS_LOG_FUNC_ENTER__;
-       const char *file_path = DEFAULT_MAC_FILE_PATH;
+       char file_path[MAX_FILE_PATH_LEN] = {0, };
        FILE *fd = NULL;
        char local_mac[MACSTR_LEN] = {0, };
        char *ptr = NULL;
        int res = 0;
        char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+       wfd_manager_s *manager = wfd_get_manager();
+
+       if (!manager)
+               return -1;
+
+       wfd_oem_config_s *config = manager->wfd_oem_conf;
+       if (config)
+               g_snprintf(file_path, sizeof(file_path),
+                               "/sys/class/net/%s/address", config->ifname);
+       else
+               g_strlcpy(file_path, DEFAULT_MAC_FILE_PATH, sizeof(file_path));
 
        errno = 0;
        fd = fopen(file_path, "r");