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)
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
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
--- /dev/null
+# 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
--- /dev/null
+# 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
--- /dev/null
+# 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
--- /dev/null
+# 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
#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,
#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
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();
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)
#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
#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
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;
} 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);
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);
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
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)
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}
# 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
# 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
# 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
# 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
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
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
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
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
%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
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
# 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
# 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
%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
case "$1" in
0)
# This is an un-installation.
- rm %{_libdir}/wifi-direct-plugin-wpasupplicant.so
/sbin/ldconfig
;;
1)
%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.
%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
0)
# This is an un-installation.
pushd %{_libdir}
- rm wifi-direct-plugin-wpasupplicant.so
popd
;;
1)
# 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.
%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
case "$1" in
0)
# This is an un-installation.
- rm %{_libdir}/wifi-direct-plugin-wpasupplicant.so
/sbin/ldconfig
;;
1)
# 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
%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
case "$1" in
0)
# This is an un-installation.
- rm %{_libdir}/wifi-direct-plugin-wpasupplicant.so
/sbin/ldconfig
;;
1)
# 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
# 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
#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"
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);
#endif
static wfd_oem_ops_s supplicant_ops = {
+ .configure = ws_configure,
.init = ws_init,
.deinit = ws_deinit,
.activate = ws_activate,
};
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;
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;
memset(g_pd->iface_path, 0x0, DBUS_OBJECT_PATH_MAX);
}
-#endif /* TIZEN_PROFILE_MOBILE */
__WDP_LOG_FUNC_EXIT__;
}
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__;
__WDP_LOG_FUNC_EXIT__;
return;
}
-#endif /* (TIZEN_PROFILE_MOBILE) && (TIZEN_WLAN_BOARD_SPRD) */
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) {
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");
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__;
g_pd = NULL;
}
+ if (config)
+ g_free(config);
+
__WDP_LOG_FUNC_EXIT__;
return 0;
}
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;
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]);
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++)
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");
dbus_set_method_param(¶ms, 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;
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;
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();
}
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++;
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__;
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();
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;
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;
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);
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) {
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();
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");
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);
}
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);
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;
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? */
}
_wfd_local_deinit_device(manager);
+ g_free(manager->wfd_oem_conf);
g_free(manager);
__WDS_LOG_FUNC_EXIT__;
__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__;
#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")
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,
};
int num;
const char *key;
char *value;
+ int int_value;
+ gboolean bool_value;
};
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);
}
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) {
__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) {
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 &&
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__;
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");