Changed to build the scanner-v2 only for TV profile (Exclude scanner-v1 when TV profile build)
Change-Id: I0d5fa8c32ec53c3d704ce5ca23157b59fabc11aa
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
$(CYNARA_CREDS_SOCKET_LIBS) \
$(SYSTEM_INFO_LIBS)
-bin_PROGRAMS = media-server \
- media-scanner \
- media-scanner-v2 \
- mediadb-update
+bin_PROGRAMS = media-server mediadb-update
+if !USE_PRODUCT_TV
+bin_PROGRAMS += media-scanner
+else
+bin_PROGRAMS += media-scanner-v2
+endif
+
######################################################
#media server
######################################################
######################################################
#media scanner v1
######################################################
+if !USE_PRODUCT_TV
media_scanner_SOURCES = src/common/media-common-utils.c \
src/common/media-common-system.c \
src/common/media-common-external-storage.c \
media_scanner_LDADD = $(COMMON_LDADD)
+else
######################################################
#media scanner v2
######################################################
media_scanner_v2_LDADD += $(USB_DEVICE_LIBS) \
$(POWER_DEFS_LIBS) \
$(POWER_TV_LIBS)
-
+endif
######################################################
#mediadb_udpate
######################################################
%manifest %{name}.manifest
%defattr(-,root,root,-)
%{_bindir}/media-server
-%{_bindir}/media-scanner
+%if 0%{?product_tv}
%{_bindir}/media-scanner-v2
+%else
+%{_bindir}/media-scanner
+%endif
%{_bindir}/mediadb-update
%if 0%{?gtests:1}
%{_bindir}/gtest*
void ms_sys_unset_device_block_event_cb(void);
int ms_sys_get_device_list(ms_stg_type_e stg_type, GArray **dev_list);
-typedef struct ms_power_info_s {
- int option;
-} ms_power_info_s;
-
#ifdef _USE_DEVICED_DBUS
-typedef void (*power_off_cb)(ms_power_info_s *power_info, void *user_data);
+typedef void (*power_off_cb)(void *user_data);
int ms_sys_set_poweroff_cb(power_off_cb user_callback, void *user_data);
#else
int ms_sys_set_poweroff_cb(device_changed_cb user_callback, void *user_data);
int val_int = 0;
power_off_cb cb_func = (power_off_cb)usr_cb;
- ms_power_info_s *power_info = NULL;
MS_DBG_FENTER();
MS_DBG_WARN("PREPARE POWER OFF");
if (val_int == 2 || val_int == 3)
- cb_func(power_info, usr_data);
+ cb_func(usr_data);
MS_SAFE_FREE(type_str);
}
}
#endif
-#ifdef _USE_DEVICED_DBUS
void ms_sys_unset_poweroff_cb(void)
{
+#ifdef _USE_DEVICED_DBUS
if (g_pwr_bus == NULL)
return;
g_pwr_bus = NULL;
MS_SAFE_FREE(g_pwr_cb_data);
-}
#else
-void ms_sys_unset_poweroff_cb(void)
-{
device_power_unsubscribe_standby(g_user_callback);
g_user_callback = NULL;
-}
#endif
+}
#include "media-common-system.h"
-#ifdef _USE_DEVICED_DBUS
-void msc_device_block_changed_cb(ms_block_info_s *block_info, void *user_data);
-#else
void msc_device_block_changed_cb(usb_device_h usb_device, char *action, void *user_data);
-#endif
#endif
#include "media-scanner-common-v2.h"
#define VCONFKEY_PRIVATE_EXTRACTSTATUS "db/private/extractstatus"
-#ifdef _USE_DEVICED_DBUS
-static void __msc_usb_remove_event(const char *mount_path)
-{
- MS_DBG_WARN("USB REMOVED, mountpath : %s", mount_path);
-
- int update_status = -1;
- int remain_request = 0;
- bool status = false;
-
- if (!ms_config_get_int(VCONFKEY_FILEMANAGER_DB_STATUS, &update_status))
- MS_DBG_ERR("ms_config_get_int[VCONFKEY_FILEMANAGER_DB_STATUS]");
-
- if (msc_get_remain_scan_request(MS_SCAN_STORAGE, &remain_request) == MS_MEDIA_ERR_NONE) {
- if (!(remain_request == 0 && update_status == VCONFKEY_FILEMANAGER_DB_UPDATED))
- msc_set_blocked_path(mount_path);
-
- remain_request = 0;
- }
-
-
- if (msc_get_dir_scan_status(&status) == MS_MEDIA_ERR_NONE) {
- if (status)
- MS_DBG_WARN("Doing directory scanning");
-
- status = false;
- }
-
- if (msc_get_remain_extract_request(MS_EXTRACT_STORAGE, &remain_request) == MS_MEDIA_ERR_NONE) {
- if (!(remain_request == 0 && update_status == VCONFKEY_FILEMANAGER_DB_UPDATED))
- msc_set_extract_blocked_path(mount_path);
-
- remain_request = 0;
- }
-
- if (msc_get_dir_scan_status(&status) == MS_MEDIA_ERR_NONE) {
- if (status) {
- MS_DBG_WARN("Doing directory extracting. Set cancel path");
- msc_set_extract_cancel_path(mount_path);
- }
- status = false;
- }
-}
-#endif
-
-#ifdef _USE_DEVICED_DBUS
-void msc_device_block_changed_cb(ms_block_info_s *block_info, void *user_data)
-{
- if (block_info->block_type == 0) {
- if (block_info->state == MS_STG_INSERTED) {
- MS_DBG_WARN("GET THE USB INSERT EVENT");
- } else {
- MS_DBG_WARN("GET THE USB REMOVE EVENT");
- __msc_usb_remove_event(block_info->mount_path);
- }
- }
-}
-#else
extern GAsyncQueue *storage_queue2;
extern GAsyncQueue *storage_extract_queue;
extern int g_directory_scan_processing2;
free_usb_device_h(usb_device);
MS_DBG_ERR("_usb_event_callback END");
}
-#endif
#include <dirent.h>
#include <malloc.h>
#include <vconf.h>
-#ifndef _USE_DEVICED_DBUS
#include <usb-device.h>
-#endif
#include "media-util.h"
#include "media-server-ipc.h"
static void __msc_add_event_receiver(void *data);
static void __msc_remove_event_receiver(void);
-#ifndef _USE_DEVICED_DBUS
static void _power_off_cb(void* data)
{
ms_comm_msg_s *scan_data;
MS_DBG_ERR("POWER OFF END");
}
-#endif
#ifdef _USE_SENIOR_MODE
extern GAsyncQueue *storage_queue2;
return 0;
}
-#ifdef _USE_DEVICED_DBUS
-static void __msc_power_off_cb(ms_power_info_s *power_info, void* data)
-{
- msc_stop_scan_thread();
- msc_stop_extract_thread();
-
- if (g_main_loop_is_running(scanner_mainloop2)) g_main_loop_quit(scanner_mainloop2);
-}
-#else
static int __msc_power_off_cb(int option, void *data)
{
_power_off_cb(NULL);
return MS_MEDIA_ERR_NONE;
}
-#endif
static void __msc_add_event_receiver(void *data)
{
static GMainLoop *scanner_mainloop = NULL;
-#ifdef _USE_DEVICED_DBUS
-static void __msc_power_off_cb(ms_power_info_s *power_info, void* data);
-#else
-static int __msc_power_off_cb(int option, void *data);
-#endif
-static void __msc_add_event_receiver(void *data);
-static void __msc_remove_event_receiver(void);
+
+static void __msc_power_off_cb(void *data)
+{
+ msc_send_power_off_request();
+
+ if (g_main_loop_is_running(scanner_mainloop))
+ g_main_loop_quit(scanner_mainloop);
+}
int main(int argc, char **argv)
{
int fd = -1;
/*set power off callback function*/
- __msc_add_event_receiver(NULL);
+ ms_sys_set_poweroff_cb(__msc_power_off_cb, NULL);
/*load functions from plusin(s)*/
err = ms_load_functions();
/*unload functions*/
ms_unload_functions();
- __msc_remove_event_receiver();
-
+ ms_sys_unset_poweroff_cb();
EXIT:
MS_DBG_INFO("SCANNER is shutting down");
return 0;
}
-#ifdef _USE_DEVICED_DBUS
-static void __msc_power_off_cb(ms_power_info_s *power_info, void* data)
-{
- msc_send_power_off_request();
-
- if (g_main_loop_is_running(scanner_mainloop)) g_main_loop_quit(scanner_mainloop);
-}
-#else
-static int __msc_power_off_cb(int option, void *data)
-{
- msc_send_power_off_request();
-
- if (g_main_loop_is_running(scanner_mainloop)) g_main_loop_quit(scanner_mainloop);
-
- return MS_MEDIA_ERR_NONE;
-}
-#endif
-
-static void __msc_add_event_receiver(void *data)
-{
- /*set power off callback function*/
- ms_sys_set_poweroff_cb(__msc_power_off_cb, NULL);
-}
-
-static void __msc_remove_event_receiver(void)
-{
- ms_sys_unset_poweroff_cb();
-}
-
static void __ms_add_signal_handler(void);
static void __ms_add_event_receiver(GIOChannel *channel);
static void __ms_add_request_receiver(GMainLoop *mainloop, GIOChannel **channel);
-#ifdef _USE_DEVICED_DBUS
-static void __ms_remove_event_receiver(void);
-static void __ms_remove_request_receiver(GIOChannel *channel);
-#endif
static bool __ms_is_dcm_supported(void);
static bool __ms_is_external_supported(void);
#ifdef _USE_DEVICED_DBUS
-void _power_off_cb(ms_power_info_s *power_info, void* data)
+static void __power_off_cb(void *data)
{
+ int fd = -1;
MS_DBG_ERR("POWER OFF");
GIOChannel *channel = (GIOChannel *)data;
if (db_mainloop && g_main_loop_is_running(db_mainloop))
g_main_loop_quit(db_mainloop);
- __ms_remove_request_receiver(channel);
+ /*close an IO channel*/
+ fd = g_io_channel_unix_get_fd(channel);
+ g_io_channel_shutdown(channel, FALSE, NULL);
+ g_io_channel_unref(channel);
+
+ if (fd > 0) {
+ if (close(fd) < 0)
+ MS_DBG_STRERROR("CLOSE ERROR");
+ }
- __ms_remove_event_receiver();
+ ms_sys_unset_device_block_event_cb();
+ ms_sys_unset_poweroff_cb();
}
#endif
#endif
/*set power off callback function*/
#ifdef _USE_DEVICED_DBUS
- ms_sys_set_poweroff_cb(_power_off_cb, channel);
+ ms_sys_set_poweroff_cb(__power_off_cb, channel);
#endif
ms_sys_set_device_block_event_cb(ms_device_block_changed_cb, NULL);
}
-#ifdef _USE_DEVICED_DBUS
-static void __ms_remove_event_receiver(void)
-{
- ms_sys_unset_device_block_event_cb();
- ms_sys_unset_poweroff_cb();
-}
-
-static void __ms_remove_request_receiver(GIOChannel *channel)
-{
- int fd = -1;
-
- /*close an IO channel*/
- fd = g_io_channel_unix_get_fd(channel);
- g_io_channel_shutdown(channel, FALSE, NULL);
- g_io_channel_unref(channel);
-
- if (fd > 0) {
- if (close(fd) < 0)
- MS_DBG_STRERROR("CLOSE ERROR");
- }
-}
-#endif
-
static void __ms_add_signal_handler(void)
{
struct sigaction sigset;