From a76776db2de3bbe7e92f1a948834cd328b0d1d83 Mon Sep 17 00:00:00 2001 From: Jinkun Jang Date: Sat, 16 Mar 2013 01:13:29 +0900 Subject: [PATCH] merge with master --- CMakeLists.txt | 17 +++++++---------- packaging/mobileap-agent.spec | 18 ++++++++++++------ packaging/org.tizen.tethering.service | 1 + src/mobileap_agent.c | 6 +++++- src/mobileap_main.c | 2 ++ src/mobileap_wifi.c | 22 +++++++++++++++------- 6 files changed, 42 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 306d414..1b66801 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,31 +12,28 @@ SET(SRCS src/mobileap_agent.c src/mobileap_network.c ) -SET(APP_VENDOR "samsung") +SET(CMAKE_INSTALL_PREFIX /usr) + +SET(APP_VENDOR "tizen") SET(APP_NAME mobileap-agent) -SET(APP_DIR /usr/bin) +SET(APP_DIR ${CMAKE_INSTALL_PREFIX}/bin) SET(INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include) IF("${CMAKE_BUILD_TYPE}" STREQUAL "") SET(CMAKE_BUILD_TYPE "Release") ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") -IF("${CMAKE_BUILD_TYPE}" STREQUAL "Private") - SET(CMAKE_BUILD_TYPE "Release") - ADD_DEFINITIONS("-D__PRIVATE_CODE__") - SET(PRIVATE_REQUIRED_PKGS "mdm kies-control-point") -ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "Private") MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") INCLUDE_DIRECTORIES(${INCLUDE_DIR}) INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs REQUIRED dlog dbus-glib-1 pmapi vconf notification libssl secure-storage capi-network-connection capi-network-bluetooth ${PRIVATE_REQUIRED_PKGS}) +pkg_check_modules(pkgs REQUIRED dlog dbus-glib-1 pmapi vconf notification libssl secure-storage capi-network-connection capi-network-bluetooth) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fpie -Wall") SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") SET(CMAKE_C_FLAGS_RELEASE "-O2") @@ -55,7 +52,7 @@ ADD_DEFINITIONS("-DVENDOR=\"${APP_VENDOR}\"") ADD_DEFINITIONS("-DAPPNAME=\"${APP_NAME}\"") ADD_DEFINITIONS("-DAPP_DIR=\"${APP_DIR}\"") -SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed") +SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed -pie") ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS}) diff --git a/packaging/mobileap-agent.spec b/packaging/mobileap-agent.spec index 28f2607..33c279f 100644 --- a/packaging/mobileap-agent.spec +++ b/packaging/mobileap-agent.spec @@ -1,9 +1,9 @@ Name: mobileap-agent Summary: Mobile AP daemon for setting tethering environments -Version: 0.1.83 -Release: 1 +Version: 0.1.85 +Release: 2 Group: TO_BE/FILLED_IN -License: Apache License Version 2.0 +License: Apache-2.0 Source0: %{name}-%{version}.tar.gz BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(dbus-glib-1) @@ -27,12 +27,10 @@ Mobile AP daemon for setting tethering environments %setup -q %build -export CFLAGS+=" -fpie" -CFLAGS="${CFLAGS}" cmake . -DCMAKE_INSTALL_PREFIX="%{_prefix}" +%cmake . make %{?jobs:-j%jobs} %install -rm -rf %{buildroot} %make_install %post @@ -48,6 +46,14 @@ rm -rf %{buildroot} %{_bindir}/mobileap-agent %changelog +* Sat Feb 16 2013 Seungyoun Ju 0.1.85-2 +- Function return value is checked +- Private SSID is considered +- Build option clean-up and g_type_init is deprecated from glib 2.35 + +* Thu Feb 14 2013 Seungyoun Ju 0.1.84-1 +- User is specified in service file for Dbus auto activation + * Mon Jan 28 2013 Seungyoun Ju 0.1.83-1 - Remove unrequired log diff --git a/packaging/org.tizen.tethering.service b/packaging/org.tizen.tethering.service index 8cd9d6f..577633b 100644 --- a/packaging/org.tizen.tethering.service +++ b/packaging/org.tizen.tethering.service @@ -1,3 +1,4 @@ [D-BUS Service] Name=org.tizen.tethering Exec=/usr/bin/mobileap-agent +User=root diff --git a/src/mobileap_agent.c b/src/mobileap_agent.c index 68f1c67..e643c17 100644 --- a/src/mobileap_agent.c +++ b/src/mobileap_agent.c @@ -348,13 +348,17 @@ static gboolean __hostapd_monitor_cb(GIOChannel *source) } #else GError *err = NULL; + GIOStatus ios; - g_io_channel_read_chars(hostapd_io_channel, buf, + ios = g_io_channel_read_chars(hostapd_io_channel, buf, HOSTAPD_REQ_MAX_LEN, &read, &err); if (err != NULL) { ERR("g_io_channel_read_chars is failed : %s\n", err->message); g_error_free(err); return FALSE; + } else if (ios != G_IO_STATUS_NORMAL) { + ERR("g_io_channel_read_chars is failed : %d\n", ios); + return FALSE; } #endif diff --git a/src/mobileap_main.c b/src/mobileap_main.c index bfb1f8e..fcc3c70 100644 --- a/src/mobileap_main.c +++ b/src/mobileap_main.c @@ -488,7 +488,9 @@ int main(int argc, char **argv) GError *error = NULL; int mobileap_vconf_key = VCONFKEY_MOBILE_HOTSPOT_MODE_NONE; +#if !GLIB_CHECK_VERSION(2,35,0) g_type_init(); +#endif if (vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_MODE, &mobileap_vconf_key)) { ERR("vconf_get_int FAIL\n"); diff --git a/src/mobileap_wifi.c b/src/mobileap_wifi.c index 10069b4..dc9646b 100644 --- a/src/mobileap_wifi.c +++ b/src/mobileap_wifi.c @@ -32,7 +32,7 @@ static int __generate_initial_passphrase(char *passphrase_buf); static mobile_ap_error_code_e __get_hide_mode(int *hide_mode); static mobile_ap_error_code_e __set_hide_mode(const int hide_mode); -static mobile_ap_error_code_e __get_ssid(char *ssid, unsigned int size); +static mobile_ap_error_code_e __get_common_ssid(char *ssid, unsigned int size); static mobile_ap_error_code_e __get_security_type(char *security_type, unsigned int len); static mobile_ap_error_code_e __set_security_type(const char *security_type); static mobile_ap_error_code_e __get_passphrase(char *passphrase, unsigned int size, unsigned int *passphrase_len); @@ -82,7 +82,7 @@ static mobile_ap_error_code_e __set_hide_mode(const int hide_mode) return MOBILE_AP_ERROR_NONE; } -static mobile_ap_error_code_e __get_ssid(char *ssid, unsigned int size) +static mobile_ap_error_code_e __get_common_ssid(char *ssid, unsigned int size) { if (ssid == NULL) return MOBILE_AP_ERROR_INVALID_PARAM; @@ -374,7 +374,7 @@ static mobile_ap_error_code_e __update_wifi_data(TetheringObject *obj) mobile_ap_error_code_e ret = MOBILE_AP_ERROR_NONE; unsigned int read_len = 0; - ret = __get_ssid(obj->ssid, sizeof(obj->ssid)); + ret = __get_common_ssid(obj->ssid, sizeof(obj->ssid)); if (ret != MOBILE_AP_ERROR_NONE) return ret; @@ -432,6 +432,11 @@ gboolean tethering_enable_wifi_tethering(TetheringObject *obj, gchar *ssid, goto FAIL; } + if (strlen(ssid) > 0) { + DBG("Private(Passed) SSID is used : %s\n", ssid); + g_strlcpy(obj->ssid, ssid, sizeof(obj->ssid)); + } + /* Initialize tethering */ if (!_init_tethering(obj)) { ret = MOBILE_AP_ERROR_RESOURCE; @@ -545,15 +550,18 @@ gboolean tethering_get_wifi_tethering_ssid(TetheringObject *obj, g_assert(obj != NULL); g_assert(context != NULL); - ret = __get_ssid(ssid, sizeof(ssid)); - if (ret != MOBILE_AP_ERROR_NONE) { - ERR("__get_ssid is failed : %d\n", ret); + if (_mobileap_is_enabled(MOBILE_AP_STATE_WIFI)) { + g_strlcpy(ssid, obj->ssid, sizeof(ssid)); + } else { + ret = __get_common_ssid(ssid, sizeof(ssid)); + if (ret != MOBILE_AP_ERROR_NONE) { + ERR("__get_common_ssid is failed : %d\n", ret); + } } dbus_g_method_return(context, ssid); return TRUE; - } gboolean tethering_get_wifi_tethering_security_type(TetheringObject *obj, -- 2.7.4