ADD_DEFINITIONS(-DTIZEN_FEATURE_ENABLE_IPV6)
ENDIF(TIZEN_FEATURE_ENABLE_IPV6)
+IF(TIZEN_FEATURE_RPI)
+ ADD_DEFINITIONS(-DTIZEN_FEATURE_RPI)
+ENDIF(TIZEN_FEATURE_RPI)
+
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed -pie")
ADD_CUSTOM_COMMAND(
#ifndef __MOBILEAP_BLUETOOTH_H__
#define __MOBILEAP_BLUETOOTH_H__
+#ifndef TIZEN_FEATURE_RPI
#include "mobileap_softap.h"
#define PS_RECHECK_INTERVAL 500
void _bt_get_remote_device_name(const char *mac, char **name);
mobile_ap_error_code_e _disable_bt_tethering(Tethering *obj, mobile_ap_address_type_e address_type);
gboolean _is_trying_bt_operation(void);
-
gboolean tethering_enable_bt_tethering(Tethering *obj,
GDBusMethodInvocation *context, mobile_ap_address_type_e address_type);
gboolean tethering_disable_bt_tethering(Tethering *obj,
GDBusMethodInvocation *context, mobile_ap_address_type_e address_type);
+#endif
#endif /* __MOBILEAP_BLUETOOTH_H__ */
#ifndef __MOBILEAP_HANDLER_H__
#define __MOBILEAP_HANDLER_H__
+#ifndef TIZEN_FEATURE_RPI
#include <time.h>
#include <alarm.h>
void _start_timeout_cb(mobile_ap_type_e type, time_t end_time);
void _stop_timeout_cb(mobile_ap_type_e type);
void _deinit_timeout_cb(mobile_ap_type_e type);
-
+#endif
#endif
#ifndef __MOBILEAP_NOTIFICATION_H__
#define __MOBILEAP_NOTIFICATION_H__
+#ifndef TIZEN_FEATURE_RPI
#include <appcore-common.h>
#include <notification.h>
#include <tzplatform_config.h>
void _create_bt_tethering_active_noti(void);
void _create_security_restriction_noti(mobile_ap_type_e type);
#endif
+#endif
#define HOSTAPD_WPS_DEVICE_TYPE "6-0050F204-1"
#define HOSTPAD_WPS_CONFIG_METHODS "label virtual_display virtual_push_button keypad"
-#ifndef TIZEN_FEATURE_WLAN_BOARD_SPRD
+
#define HOSTAPD_CONF "interface=%s\n" \
"driver=nl80211\n" \
"ctrl_interface=%s\n" \
"accept_mac_file=%s\n" \
"deny_mac_file=%s\n" \
"ieee80211n=1\n"
-#else
-#define HOSTAPD_CONF "interface=%s\n" \
- "driver=nl80211\n" \
- "ctrl_interface=%s\n" \
- "ssid=%s\n" \
- "channel=%d\n" \
- "ignore_broadcast_ssid=%d\n" \
- "hw_mode=%s\n" \
- "max_num_sta=%d\n" \
- "macaddr_acl=%d\n" \
- "accept_mac_file=%s\n" \
- "deny_mac_file=%s\n" \
- "ieee80211n=1\n" \
- "wowlan_triggers=any\n"
#define HOSTAPD_WPS_CONF "interface=%s\n" \
"driver=nl80211\n" \
"wpa=2\n" \
"rsn_pairwise=CCMP\n" \
"wpa_psk=%s\n"
-#endif
+
+#define HOSTAPD_RPI_CONF "interface=%s\n" \
+ "driver=nl80211\n" \
+ "ctrl_interface=%s\n" \
+ "ssid=%s\n" \
+ "channel=%d\n" \
+ "ignore_broadcast_ssid=%d\n" \
+ "hw_mode=%s\n" \
+ "max_num_sta=%d\n" \
+ "ieee80211n=1\n"
+
#define HOSTAPD_DEBUG_FILE "/var/log/hostapd.log"
#define HOSTAPD_REQ_MAX_LEN 128
#ifndef __MOBILEAP_USB_H__
#define __MOBILEAP_USB_H__
+#ifndef TIZEN_FEATURE_RPI
#include "mobileap_softap.h"
void __handle_usb_disconnect_cb(keynode_t *key, void *data);
mobile_ap_error_code_e _disable_usb_tethering(Tethering *obj);
gboolean _is_trying_usb_operation(void);
-
gboolean tethering_enable_usb_tethering(Tethering *obj,
GDBusMethodInvocation *context);
gboolean tethering_disable_usb_tethering(Tethering *obj,
GDBusMethodInvocation *context);
+#endif
#endif /* __MOBILEAP_USB_H__ */
Name: mobileap-agent
Summary: Mobile AP daemon for setting tethering environments
-Version: 1.0.87
+Version: 1.0.88
Release: 1
Group: System/Network
License: Apache-2.0
%description
Mobile AP daemon for setting tethering environments
-%ifarch %{arm}
%package extension-TM1
Summary: Extension for mobile TM1
Requires: %{name} = %{version}-%{release}
%description extension-TM1
Mobile AP daemon for setting tethering environments for mobile TM1
-%endif
+
+%package extension-RPi
+Summary: Extension for mobile RPi
+Requires: %{name} = %{version}-%{release}
+%description extension-RPi
+Mobile AP daemon for setting tethering environments for mobile RPi
+
%prep
%setup -q
export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
-%ifarch %{arm}
# Build for TM1
%cmake -DCMAKE_BUILD_TYPE="" \
-DTIZEN_FEATURE_MULTICAST=1 \
mv %{buildroot}%{_bindir}/mobileap-agent %{_builddir}/%{name}-%{version}/mobileap-agent.tm1
make %{?jobs:-j%jobs}
-%endif
-# Build for non-TM1
+# Build for RPi
+%cmake -DCMAKE_BUILD_TYPE="" \
+ -DTIZEN_FEATURE_MULTICAST=1 \
+ -DTIZEN_FEATURE_RPI=1 \
+ .
+
+%make_install
+mv %{buildroot}%{_bindir}/mobileap-agent %{_builddir}/%{name}-%{version}/mobileap-agent.rpi
+
+make %{?jobs:-j%jobs}
+
+# Build for Common
%cmake -DCMAKE_BUILD_TYPE="" \
-DTIZEN_FEATURE_MULTICAST=1 \
-DTIZEN_FEATURE_ENABLE_IPV6=1 \
%install
%make_install
-%ifarch %{arm}
mv %{_builddir}/%{name}-%{version}/mobileap-agent.tm1 %{buildroot}%{_bindir}
-%endif
+mv %{_builddir}/%{name}-%{version}/mobileap-agent.rpi %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d
cp mobileap-agent.conf %{buildroot}%{_sysconfdir}/dbus-1/system.d/mobileap-agent.conf
/bin/chmod +x /opt/etc/dump.d/module.d/tethering_dump.sh
/usr/sbin/setcap cap_dac_override,cap_fowner,cap_net_bind_service,cap_net_admin,cap_net_raw+eip /usr/bin/mobileap-agent
-%ifarch %{arm}
%post extension-TM1
pushd %{_bindir}
mv mobileap-agent.tm1 mobileap-agent
/usr/sbin/setcap cap_dac_override,cap_fowner,cap_net_bind_service,cap_net_admin,cap_net_raw+eip /usr/bin/mobileap-agent
%preun extension-TM1
rm %{_bindir}/mobileap-agent
-%endif
+
+%post extension-RPi
+pushd %{_bindir}
+mv mobileap-agent.rpi mobileap-agent
+popd
+%preun extension-RPi
+rm %{_bindir}/mobileap-agent
%files
%manifest mobileap-agent.manifest
/opt/etc/dump.d/module.d/tethering_dump.sh
%license LICENSE.APLv2.0
-%ifarch %{arm}
%files extension-TM1
%defattr(-,root,root,-)
%{_bindir}/mobileap-agent.tm1
-%endif
+%files extension-RPi
+%defattr(-,root,root,-)
+%{_bindir}/mobileap-agent.rpi
* limitations under the License.
*/
+#ifndef TIZEN_FEATURE_RPI
#include <stdio.h>
#include <glib.h>
#include <dbus/dbus.h>
DBG("-");
return;
}
-#endif
+#endif /* TIZEN_FEATURE_ENABLE_IPV6 */
+#endif /* TIZEN_FEATURE_RPI */
#include <netinet/in.h>
#include <arpa/inet.h>
#include <dbus/dbus.h>
+#ifndef TIZEN_FEATURE_RPI
#include <dpm/device-policy-manager.h>
#include <dpm/restriction.h>
+#endif
#include "mobileap_common.h"
#include "mobileap_wifi.h"
static GSList *station_list = NULL;
+#ifndef TIZEN_FEATURE_RPI
/* DPM */
device_policy_manager_h dpm = NULL;
int wifi_tethering_id = 0;
static bool allow_wifi_tethering = true;
static bool allow_bt_tethering = true;
static bool allow_usb_tethering = true;
+#endif
gint _slist_find_station_by_interface(gconstpointer a, gconstpointer b)
{
if (count == 0) {
prev_cnt = 0;
+#ifndef TIZEN_FEATURE_RPI
_delete_connected_noti();
+#endif
return;
}
else
type = MOBILE_AP_TYPE_MAX;
+#ifndef TIZEN_FEATURE_RPI
if (prev_cnt == 0)
_create_connected_noti(type, count);
else
_update_connected_noti(type, count);
-
+#endif
prev_cnt = count;
return;
}
return MOBILE_AP_ERROR_INVALID_PARAM;
}
+#ifndef TIZEN_FEATURE_RPI
static void __policy_chnaged_cb(const char *name, const char *value, void *data)
{
Tethering *obj = _get_tethering_obj();
dpm_remove_policy_changed_cb(dpm, usb_tethering_id);
dpm_manager_destroy(dpm);
}
+#endif
* limitations under the License.
*/
+#ifndef TIZEN_FEATURE_RPI
#include <glib.h>
#include <dbus/dbus.h>
#include <stdlib.h>
DBG("-\n");
return;
}
+#endif
#include <string.h>
#include <stdlib.h>
#include <time.h>
+#ifndef TIZEN_FEATURE_RPI
#include <dd-display.h>
+#endif
#include <vconf.h>
#include <net_connection.h>
#include <appcore-common.h>
#include <wifi.h>
+
+#ifndef TIZEN_FEATURE_RPI
#include <alarm.h>
+#endif
#include "mobileap_softap.h"
#include "mobileap_handler.h"
return FALSE;
}
+#ifndef TIZEN_FEATURE_RPI
if (_is_trying_bt_operation()) {
DBG("BT operation is going on\n");
return FALSE;
DBG("USB operation is going on\n");
return FALSE;
}
-
+#endif
DBG("All tethering / AP's are turned off\n");
g_main_loop_quit(mainloop);
mainloop = NULL;
void _block_device_sleep(void)
{
+#ifdef TIZEN_FEATURE_RPI
+ return;
+#else
int ret = 0;
ret = display_lock_state(LCD_OFF, STAY_CUR_STATE, 0);
ERR("PM control [ERROR] result = %d\n", ret);
else
DBG("PM control [SUCCESS]\n");
+#endif
}
void _unblock_device_sleep(void)
{
+#ifdef TIZEN_FEATURE_RPI
+ return;
+#else
int ret = 0;
ret = display_unlock_state(LCD_OFF, PM_SLEEP_MARGIN);
ERR("PM control [ERROR] result = %d\n", ret);
else
DBG("PM control [SUCCESS]\n");
+#endif
}
int _init_tethering(mobile_ap_address_type_e address_type)
else
_disable_wifi_tethering(obj, MOBILE_AP_ADDRESS_TYPE_IPV4);
+#ifndef TIZEN_FEATURE_RPI
if (_mobileap_get_ipv6_state(MOBILE_AP_STATE_BT))
_disable_bt_tethering(obj, MOBILE_AP_ADDRESS_TYPE_IPV6);
else
_disable_bt_tethering(obj, MOBILE_AP_ADDRESS_TYPE_IPV4);
_disable_usb_tethering(obj);
+#endif
tethering_complete_disable(obj, context, MOBILE_AP_DISABLE_CFM, ret);
info->hostname = g_strdup(MOBILE_AP_NAME_UNKNOWN);
else
info->hostname = g_strdup(name);
- } else if (type == MOBILE_AP_TYPE_BT) {
+ }
+#ifndef TIZEN_FEATURE_RPI
+ else if (type == MOBILE_AP_TYPE_BT) {
_bt_get_remote_device_name(mac, &bt_remote_device_name);
if (bt_remote_device_name == NULL)
info->hostname = g_strdup(MOBILE_AP_NAME_UNKNOWN);
else
info->hostname = bt_remote_device_name;
}
+#endif
time(&tm);
info->tm = tm;
if (_add_station_info(info) != MOBILE_AP_ERROR_NONE) {
_get_station_count((gconstpointer)type,
_slist_find_station_by_interface, &n_station);
+#ifndef TIZEN_FEATURE_RPI
if (n_station == 1)
_stop_timeout_cb(type);
+#endif
_send_dbus_station_info("DhcpConnected", info);
} else if (!g_strcmp0(signal_name, "DhcpLeaseDeleted")) {
} else {
DBG("Export sucessss");
}
-
+#ifndef TIZEN_FEATURE_RPI
g_signal_connect(tethering_obj, "handle-enable-wifi-tethering",
G_CALLBACK(tethering_enable_wifi_tethering), NULL);
g_signal_connect(tethering_obj, "handle-enable-bt-tethering",
G_CALLBACK(tethering_set_wps_pin), NULL);
g_signal_connect(tethering_obj, "handle-push-wps-button",
G_CALLBACK(tethering_push_wps_button), NULL);
+#endif
g_signal_connect(softap_obj, "handle-enable",
G_CALLBACK(softap_enable), NULL);
G_CALLBACK(softap_push_wps_button), NULL);
_init_network((void *)tethering_obj);
+#ifndef TIZEN_FEATURE_RPI
_register_vconf_cb((void *)tethering_obj);
+#endif
conn_sig_id = g_dbus_connection_signal_subscribe(connection, NULL, DNSMASQ_DBUS_INTERFACE,
"DhcpConnected", NULL, NULL, G_DBUS_SIGNAL_FLAGS_NONE,
return 0;
}
/* Platform modules */
+#ifndef TIZEN_FEATURE_RPI
if (appcore_set_i18n(MOBILEAP_LOCALE_COMMON_PKG, MOBILEAP_LOCALE_COMMON_RES) < 0)
ERR("appcore_set_i18n is failed\n");
+#endif
if (vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_MODE, &mobileap_state) < 0) {
ERR("vconf_get_int is failed\n");
if (ret != WIFI_ERROR_NONE)
ERR("wifi_initialize() is failed : %d\n", ret);
+#ifndef TIZEN_FEATURE_RPI
ret = alarmmgr_init(APPNAME);
if (ret != ALARMMGR_RESULT_SUCCESS) {
ERR("alarmmgr_init(%s) is failed : %d\n", APPNAME, ret);
}
_init_dpm();
-
+#endif
g_main_loop_run(mainloop);
+#ifndef TIZEN_FEATURE_RPI
_deinit_dpm();
alarmmgr_fini();
-
+#endif
ret = wifi_deinitialize();
if (ret != WIFI_ERROR_NONE)
ERR("wifi_deinitialize() is failed : %d\n", ret);
_mh_core_reset_mac();
+#ifndef TIZEN_FEATURE_RPI
_unregister_vconf_cb();
+#endif
_unregister_wifi_station_handler();
_deinit_network();
_disable_wifi_tethering(obj, MOBILE_AP_ADDRESS_TYPE_IPV4);
DBG("_disable_wifi_tethering returns %d\n", ret);
+#ifndef TIZEN_FEATURE_RPI
if (_mobileap_get_ipv6_state(MOBILE_AP_STATE_BT))
ret = _disable_bt_tethering(obj, MOBILE_AP_ADDRESS_TYPE_IPV6);
else
ret = _disable_bt_tethering(obj, MOBILE_AP_ADDRESS_TYPE_IPV4);
-
DBG("_disable_bt_tethering returns %d\n", ret);
ret = _disable_usb_tethering(obj);
DBG("_disable_usb_tethering returns %d\n", ret);
-
+#endif
tethering_emit_net_closed(obj);
}
* limitations under the License.
*/
+#ifndef TIZEN_FEATURE_RPI
#include <glib.h>
#include <dbus/dbus.h>
#include <stdio.h>
return;
}
+#endif
else
hw_mode = g_strdup(mode);
- /* Default conf. */
+#ifdef TIZEN_FEATURE_RPI
+ snprintf(buf, sizeof(buf), HOSTAPD_RPI_CONF,
+ WIFI_IF,
+ HOSTAPD_CTRL_INTF_DIR,
+ ssid,
+ channel,
+ hide_mode ? 2 : 0,
+ hw_mode,
+ max_sta);
+#else
snprintf(buf, sizeof(buf), HOSTAPD_CONF,
WIFI_IF,
HOSTAPD_CTRL_INTF_DIR,
mac_filter,
HOSTAPD_ALLOWED_LIST,
HOSTAPD_BLOCKED_LIST);
+#endif
conf = g_strdup(buf);
free(hw_mode);
+#ifdef TIZEN_FEATURE_WLAN_BOARD_SPRD
+ snprintf(buf, sizeof(buf), "wowlan_triggers=any\n");
+#endif
+
/* Vendor elements conf. */
if (type == MOBILE_AP_TYPE_WIFI) {
snprintf(buf, sizeof(buf),
_get_station_count((gconstpointer)type,
_slist_find_station_by_interface, &n_station);
+#ifndef TIZEN_FEATURE_RPI
if (n_station == 0) {
if (type == MOBILE_AP_TYPE_WIFI)
_start_timeout_cb(type, time(NULL) + TETHERING_CONN_TIMEOUT);
else if (type == MOBILE_AP_TYPE_WIFI_AP)
_start_timeout_cb(type, time(NULL) + WIFI_AP_CONN_TIMEOUT);
}
+#endif
DONE:
return TRUE;
}
_get_station_count((gconstpointer)type,
_slist_find_station_by_interface, &n_station);
+#ifndef TIZEN_FEATURE_RPI
if (n_station == 0) {
if (type == MOBILE_AP_TYPE_WIFI)
_start_timeout_cb(type, time(NULL) + TETHERING_CONN_TIMEOUT);
else if (type == MOBILE_AP_TYPE_WIFI_AP)
_start_timeout_cb(type, time(NULL) + WIFI_AP_CONN_TIMEOUT);
}
+#endif
}
return FALSE;
_get_station_count((gconstpointer)type,
_slist_find_station_by_interface, &n_station);
+#ifndef TIZEN_FEATURE_RPI
if (n_station == 1)
_stop_timeout_cb(type);
-
+#endif
_send_dbus_station_info("DhcpConnected", info);
return FALSE;
* limitations under the License.
*/
+#ifndef TIZEN_FEATURE_RPI
#include <glib.h>
#include <dbus/dbus.h>
#include <stdio.h>
{
return (g_context ? TRUE : FALSE || in_progress);
}
+#endif
ERR("_enable_wifi_tethering is failed\n");
} else {
tethering_emit_wifi_on((Tethering *)obj);
+#ifndef TIZEN_FEATURE_RPI
_create_tethering_active_noti();
+#endif
}
} else {
ret = _enable_soft_ap((Softap *)obj, wifi_settings.ssid, wifi_settings.key,
} else {
prev_wifi_on = TRUE;
tethering_emit_wifi_on(obj);
+#ifndef TIZEN_FEATURE_RPI
_create_tethering_active_noti();
+#endif
}
} else {
ret = _enable_soft_ap((Softap *)obj, wifi_settings.ssid, wifi_settings.key,
return ret;
}
tethering_emit_wifi_on(obj);
+#ifndef TIZEN_FEATURE_RPI
_create_tethering_active_noti();
+#endif
return MOBILE_AP_ERROR_NONE;
}
_mobileap_clear_state(MOBILE_AP_STATE_WIFI);
goto DONE;
}
+#ifndef TIZEN_FEATURE_RPI
_delete_timeout_noti();
-
_init_timeout_cb(MOBILE_AP_TYPE_WIFI, (void *)obj);
_start_timeout_cb(MOBILE_AP_TYPE_WIFI, time(NULL) + TETHERING_CONN_TIMEOUT);
+#endif
if (address_type != MOBILE_AP_ADDRESS_TYPE_IPV6) {
_add_interface_routing(WIFI_IF, IP_ADDRESS_SOFTAP);
_mobileap_clear_state(MOBILE_AP_STATE_WIFI_AP);
goto DONE;
}
-
+#ifndef TIZEN_FEATURE_RPI
_delete_timeout_noti();
_init_timeout_cb(MOBILE_AP_TYPE_WIFI_AP, (void *)obj);
_start_timeout_cb(MOBILE_AP_TYPE_WIFI_AP, time(NULL) + WIFI_AP_CONN_TIMEOUT);
+#endif
_add_interface_routing(WIFI_IF, IP_ADDRESS_SOFTAP);
_add_routing_rule(WIFI_IF);
}
_flush_ip_address(WIFI_IF);
+#ifndef TIZEN_FEATURE_RPI
_deinit_timeout_cb(type);
+#endif
if (_remove_station_info_all(type) != MOBILE_AP_ERROR_NONE)
ERR("_remove_station_info_all is failed. Ignore it.\n");
_del_routing_rule(WIFI_IF);
_del_interface_routing(WIFI_IF, IP_ADDRESS_SOFTAP);
_flush_ip_address(WIFI_IF);
+#ifndef TIZEN_FEATURE_RPI
_deinit_timeout_cb(type);
+#endif
if (_remove_station_info_all(type) != MOBILE_AP_ERROR_NONE)
ERR("_remove_station_info_all is failed. Ignore it.\n");
goto DONE;
}
+#ifndef TIZEN_FEATURE_RPI
_delete_timeout_noti();
_init_timeout_cb(MOBILE_AP_TYPE_WIFI_AP, (void *)obj);
_start_timeout_cb(MOBILE_AP_TYPE_WIFI_AP, time(NULL) + WIFI_AP_CONN_TIMEOUT);
+#endif
_add_interface_routing(WIFI_IF, IP_ADDRESS_SOFTAP);
_add_routing_rule(WIFI_IF);
#ifdef TIZEN_FEATURE_MULTICAST
_del_routing_rule(WIFI_IF);
_del_interface_routing(WIFI_IF, IP_ADDRESS_SOFTAP);
_flush_ip_address(WIFI_IF);
+#ifndef TIZEN_FEATURE_RPI
_deinit_timeout_cb(type);
-
+#endif
if (_remove_station_info_all(type) != MOBILE_AP_ERROR_NONE)
ERR("_remove_station_info_all is failed. Ignore it.\n");
}
g_context = context;
+#ifndef TIZEN_FEATURE_RPI
if (!_is_allowed(MOBILE_AP_TYPE_WIFI)) {
DBG("DPM policy restricts Wi-Fi tethering\n");
ret = MOBILE_AP_ERROR_NOT_PERMITTED;
_create_security_restriction_noti(MOBILE_AP_TYPE_WIFI);
goto DONE;
}
+#endif
#ifdef TIZEN_FEATURE_ENABLE_IPV6
DBG("[MOON] ipv6 feature is enabled");
ERR("_enable_wifi_tethering is failed\n");
} else {
tethering_emit_wifi_on(obj);
+#ifndef TIZEN_FEATURE_RPI
_create_tethering_active_noti();
+#endif
ret_val = TRUE;
}