Remove libbluetooth-extension-TM1 package 06/138606/2 accepted/tizen/unified/20170713.153738 submit/tizen/20170713.052302
authorDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 13 Jul 2017 02:41:43 +0000 (11:41 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 13 Jul 2017 04:22:06 +0000 (13:22 +0900)
This patchset handles TM1 extension functionality such as
QoS control at the runtime. So don't need to use other package.

Change-Id: I9f2b4a3006046a6f05c0ec662e9ce146d5db6abd
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
packaging/bluez.spec
profile.h
profiles/audio/avdtp.c
src/adapter.c

index 21728c9..c1575fc 100755 (executable)
@@ -121,17 +121,6 @@ Conflicts: %{name}-profile_wearable
 %description profile_tv
 Bluez modified service script for Tizen TV
 
-%ifarch %{ix86} || %{arm}
-%package -n libbluetooth-extension-TM1
-Summary:       Extension for mobile TM1
-Requires:      libbluetooth = %{version}-%{release}
-%description -n libbluetooth-extension-TM1
-Bluez default service script for Tizen mobile TM1
-When you want to uninstall this while keeping libbluetooth, you need
-to reinstall libbluetooth after uninstalling this because this package
-overwrites some contents of libbluetooth.
-%endif
-
 %prep
 %setup -q
 cp %{SOURCE1001} .
@@ -154,55 +143,9 @@ export LDFLAGS=" -lncurses -Wl,--as-needed "
 export CFLAGS+=" -DTIZEN_FEATURE_BLUEZ_MODIFY -DTIZEN_FEATURE_BLUEZ_PBAP_SIM -DTIZEN_FEATURE_BLUEZ_AVRCP_TARGET"
 export CFLAGS_DEFAULT="$CFLAGS"
 
-%ifarch %{ix86} || %{arm}
-# extension-TM1
-export CFLAGS="$CFLAGS_DEFAULT -DTIZEN_FEATURE_BLUEZ_SPRD_QOS -DTIZEN_FEATURE_BLUEZ_SPRD_PAGE_SCAN"
-# TIZEN_FEATURE_BLUEZ_SPRD_QOS: only in profiles/audio/avdtp.c
-# TIZEN_FEATURE_BLUEZ_SPRD_PAGE_SCAN: src/adapter.c
+# TIZEN_FEATURE_BLUEZ_SPRD_QOS: only in profiles/audio/avdtp.c ==> RUNTIME! (profile.h)
+# TIZEN_FEATURE_BLUEZ_SPRD_PAGE_SCAN: src/adapter.c ==> RUNTIME! (profile.h)
 
-%reconfigure --disable-static \
-                       --sysconfdir=%{_sysconfdir} \
-                       --localstatedir=%{_localstatedir} \
-                       --with-systemdsystemunitdir=%{_libpath}/systemd/system \
-                       --with-systemduserunitdir=%{_libpath}/systemd/user \
-                       --libexecdir=%{_libexecdir} \
-                       --enable-debug \
-                       --enable-pie \
-                       --enable-serial \
-                       --enable-input \
-                       --enable-usb=no \
-                       --enable-tools \
-                       --disable-bccmd \
-                       --enable-pcmcia=no \
-                       --enable-hid2hci=no \
-                       --enable-alsa=no \
-                       --enable-gstreamer=no \
-                       --disable-dfutool \
-                       --disable-cups \
-                       --enable-health=yes \
-                       --enable-proximity=yes \
-                       --enable-tds=yes \
-                       --enable-dbusoob \
-                       --enable-test \
-                       --with-telephony=tizen \
-                       --enable-obex \
-                       --enable-library \
-                       --enable-gatt \
-                       --enable-experimental \
-                       --enable-autopair=no \
-                       --enable-hid=yes \
-                       --enable-tizenunusedplugin=no
-
-
-make %{?_smp_mflags} all V=1
-
-mkdir -p tm1
-
-%make_install
-cp -a  %{buildroot}%{_libdir}/libbluetooth.so* tm1/
-%endif
-
-# non-extension-TM1
 export CFLAGS="$CFLAGS_DEFAULT"
 
 %reconfigure --disable-static \
@@ -254,11 +197,6 @@ make check
 
 %install
 %make_install
-%ifarch %{ix86} || %{arm}
-pushd tm1
-for FILE in libbluetooth.so*; do mv "$FILE" "%{buildroot}%{_libdir}/$FILE.tm1"; done
-popd
-%endif
 
 # bluez-test
 rm -rvf $RPM_BUILD_ROOT/%{_libdir}/gstreamer-*
@@ -308,14 +246,6 @@ cp -f packaging/500.bluez_upgrade.sh %{buildroot}%{upgrade_script_path}
 
 %postun -n libbluetooth -p /sbin/ldconfig
 
-%ifarch %{ix86} || %{arm}
-%post -n libbluetooth-extension-TM1
-pushd %{_libdir}
-for FILE in libbluetooth.so*.tm1; do mv "$FILE" "${FILE%.tm1}"; done
-popd
-/sbin/ldconfig
-%endif
-
 %files
 %manifest %{name}.manifest
 %defattr(-, root, root)
@@ -366,16 +296,8 @@ popd
 %manifest %{name}.manifest
 %defattr(-, root, root)
 %{_libdir}/libbluetooth.so.*
-%exclude %{_libdir}/libbluetooth.so*.tm1
 %license COPYING
 
-%ifarch %{ix86} || %{arm}
-%files -n libbluetooth-extension-TM1
-%manifest %{name}.manifest
-%defattr(-, root, root)
-%{_libdir}/libbluetooth.so*.tm1
-%endif
-
 %files -n obexd
 %manifest %{name}.manifest
 %defattr(-,root,root,-)
index 697303d..952c6f2 100755 (executable)
--- a/profile.h
+++ b/profile.h
@@ -41,7 +41,17 @@ typedef enum {
        TIZEN_PROFILE_COMMON = 0x10,
 } tizen_profile_t;
 
+typedef enum {
+       TIZEN_MODEL_UNKNOWN = 0,
+       TIZEN_MODEL_COMMON = 0x1,
+       TIZEN_MODEL_TM1 = 0x2,
+       TIZEN_MODEL_TM2 = 0x4,
+       TIZEN_MODEL_TW1 = 0x8,
+       TIZEN_MODEL_TW2 = 0x10,
+} tizen_model_t;
+
 static tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN;
+static tizen_model_t model = TIZEN_MODEL_UNKNOWN;
 
 static inline int __get_profile_from_model_config_xml(const char *field, char **value)
 {
@@ -153,12 +163,47 @@ static inline tizen_profile_t _get_tizen_profile(void)
        return profile;
 }
 
+static inline tizen_model_t _get_tizen_model(void)
+{
+       char *model_name = NULL;
+
+       if (__builtin_expect(model != TIZEN_MODEL_UNKNOWN, 1))
+               return model;
+
+       if (__get_profile_from_model_config_xml("tizen.org/system/model_name",
+                                                                       &model_name) < 0) {
+               model = TIZEN_MODEL_COMMON;
+               return model;
+       }
+
+       if (model_name == NULL) {
+               model = TIZEN_MODEL_COMMON;
+               return model;
+       }
+
+       if (!strcasecmp(model_name, "TM1"))
+               model = TIZEN_MODEL_TM1;
+       else if (!strcasecmp(model_name, "TM2"))
+               model = TIZEN_MODEL_TM2;
+       else if (!strcasecmp(model_name, "TW1"))
+               model = TIZEN_MODEL_TW1;
+       else if (!strcasecmp(model_name, "TW2"))
+               model = TIZEN_MODEL_TW2;
+       else
+               model = TIZEN_MODEL_COMMON;
+
+       free(model_name);
+
+       return model;
+}
+
 #define TIZEN_FEATURE_BLUEZ_BRCM_CHIP ((_get_tizen_profile()) == TIZEN_PROFILE_IVI)
 #define TIZEN_FEATURE_BLUEZ_SMS_ONLY ((_get_tizen_profile()) == TIZEN_PROFILE_WEARABLE)
 #define TIZEN_FEATURE_BLUEZ_BRCM_QOS ((_get_tizen_profile()) == TIZEN_PROFILE_WEARABLE)
 #define TIZEN_FEATURE_BLUEZ_ROLE_CHANGE ((_get_tizen_profile()) == TIZEN_PROFILE_WEARABLE)
 #define TIZEN_FEATURE_BLUEZ_CONFIRM_ONLY ((_get_tizen_profile()) == TIZEN_PROFILE_WEARABLE)
-
+#define TIZEN_FEATURE_BLUEZ_SPRD_QOS ((_get_tizen_model()) == TIZEN_MODEL_TM1)
+#define TIZEN_FEATURE_BLUEZ_SPRD_PAGE_SCAN ((_get_tizen_model()) == TIZEN_MODEL_TM1)
 
 #endif /* __TIZEN_PROFILE_H__ */
 
index bc5a735..7dbd3ac 100755 (executable)
 
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
 #include "src/service.h"
+#include "../../profile.h"
 #endif
 
 #include "avdtp.h"
 #include "sink.h"
 #include "source.h"
-#include "../../profile.h"
 
 #define AVDTP_PSM 25
 
@@ -1011,7 +1011,6 @@ static gboolean send_broadcom_a2dp_qos(const bdaddr_t *dst, gboolean qos_high)
        return TRUE;
 }
 
-#ifdef TIZEN_FEATURE_BLUEZ_SPRD_QOS
 static gboolean send_sprd_a2dp_qos(bdaddr_t *dst, gboolean qos_high)
 {
        int dd;
@@ -1064,7 +1063,6 @@ static gboolean send_sprd_a2dp_qos(bdaddr_t *dst, gboolean qos_high)
 
        return TRUE;
 }
-#endif /* TIZEN_FEATURE_BLUEZ_SPRD_QOS */
 
 static gboolean fix_role_to_master(const bdaddr_t *dst, gboolean fix_to_master)
 {
@@ -1133,12 +1131,10 @@ static void avdtp_sep_set_state(struct avdtp *session,
        struct avdtp_stream *stream = sep->stream;
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
        const bdaddr_t *dst;
-#if defined(TIZEN_FEATURE_BLUEZ_SPRD_QOS)
-       dst = device_get_address(session->device);
-#else
-       if (TIZEN_FEATURE_BLUEZ_BRCM_QOS || TIZEN_FEATURE_BLUEZ_ROLE_CHANGE)
+       if (TIZEN_FEATURE_BLUEZ_SPRD_QOS)
+               dst = device_get_address(session->device);
+       else if (TIZEN_FEATURE_BLUEZ_BRCM_QOS || TIZEN_FEATURE_BLUEZ_ROLE_CHANGE)
                dst = device_get_address(session->device);
-#endif
 #endif
        avdtp_state_t old_state;
        struct avdtp_error err, *err_ptr = NULL;
@@ -1173,16 +1169,14 @@ static void avdtp_sep_set_state(struct avdtp *session,
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
                if (TIZEN_FEATURE_BLUEZ_BRCM_QOS) {
                        send_broadcom_a2dp_qos(dst, FALSE);
-               } else {
-#if defined(TIZEN_FEATURE_BLUEZ_SPRD_QOS)
+               } else if (TIZEN_FEATURE_BLUEZ_SPRD_QOS) {
                        if (old_state == AVDTP_STATE_STREAMING)
                                send_sprd_a2dp_qos(dst, FALSE);
-#endif
                }
+
                if (TIZEN_FEATURE_BLUEZ_ROLE_CHANGE)
                        fix_role_to_master(dst, FALSE);
 #endif /* TIZEN_FEATURE_BLUEZ_MODIFY */
-
                break;
        case AVDTP_STATE_STREAMING:
                if (stream->start_timer) {
@@ -1193,11 +1187,9 @@ static void avdtp_sep_set_state(struct avdtp *session,
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
                if (TIZEN_FEATURE_BLUEZ_BRCM_QOS) {
                        send_broadcom_a2dp_qos(dst, TRUE);
-               } else {
-#if defined(TIZEN_FEATURE_BLUEZ_SPRD_QOS)
+               } else if (TIZEN_FEATURE_BLUEZ_SPRD_QOS) {
                        if (old_state == AVDTP_STATE_OPEN)
                                send_sprd_a2dp_qos(dst, TRUE);
-#endif
                }
                if (TIZEN_FEATURE_BLUEZ_ROLE_CHANGE)
                        fix_role_to_master(dst, TRUE);
index 2a3e40b..092ea7a 100755 (executable)
@@ -79,6 +79,7 @@
 
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
 #include "adapter_le_vsc_features.h"
+#include "../profile.h"
 #endif
 
 #define ADAPTER_INTERFACE      "org.bluez.Adapter1"
@@ -774,7 +775,7 @@ static void advertiser_cleanup(struct btd_adapter *adapter)
 }
 #endif
 
-#if defined TIZEN_FEATURE_BLUEZ_MODIFY && defined TIZEN_FEATURE_BLUEZ_SPRD_PAGE_SCAN
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
 #define OCF_PAGE_SCAN_TIMEOUT                  0x0018
 #define OGF_PAGE_SCAN_TIMEOUT          0x03
 
@@ -820,15 +821,18 @@ static void settings_changed(struct btd_adapter *adapter, uint32_t settings)
 
                if (adapter->current_settings & MGMT_SETTING_POWERED) {
                        adapter_start(adapter);
-#if defined TIZEN_FEATURE_BLUEZ_MODIFY && defined TIZEN_FEATURE_BLUEZ_SPRD_PAGE_SCAN
-                       /* Approx 6.4 Seconds of timeout */
-                       /* This Added because Z3 device was not able to connect with
-                         * some device as it was getting Page Timeout
-                         * (LG HBS800, sony carkit) etc. So, Increasing Page timeout value
-                         * from 5.12 Sec (which is default) to ~6.4sec*/
-                       DBG("Setting value");
-                       send_sprd_page_scan_timeout(10240);
-#endif /* TIZEN_FEATURE_BLUEZ_SPRD_PAGE_SCAN */
+
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+                       if (TIZEN_FEATURE_BLUEZ_SPRD_PAGE_SCAN) {
+                               /* Approx 6.4 Seconds of timeout */
+                               /* This Added because Z3 device was not able to connect with
+                                 * some device as it was getting Page Timeout
+                                 * (LG HBS800, sony carkit) etc. So, Increasing Page timeout value
+                                 * from 5.12 Sec (which is default) to ~6.4sec*/
+                               DBG("Setting value");
+                               send_sprd_page_scan_timeout(10240);
+                       }
+#endif
                } else {
                        adapter_stop(adapter);