#define MS_VCONF_KEY_RESET_STATUS "db/media_server/reset_status"
#define SMARTHUB_RESET_VCONF "db/smarthub/reset/firstscreen"
-
-bool smarthub_reset;
#endif
GMainLoop *mainloop = NULL;
return true;
}
-static void __ms_smarthub_vconf_cb(void *data)
+static void __ms_smarthub_vconf_cb(keynode_t *key, void *user_data)
{
int status = 0;
int scanner_pid = 0;
uid_t uid = ms_sys_get_uid();
- if (!ms_get_power_off()) {
- if (!ms_config_get_int(SMARTHUB_RESET_VCONF, &status))
- MS_DBG_ERR("Get SMARTHUB_RESET_VCONF failed.");
-
- MS_DBG_ERR("CURRENT STATUS OF SMARTHUB_RESET_VCONF[%d]", status);
+ if (ms_get_power_off())
+ return;
- smarthub_reset = true;
+ status = vconf_keynode_get_int(key);
+ MS_DBG_ERR("CURRENT STATUS OF SMARTHUB_RESET_VCONF[%d]", status);
+ if (status != 0)
+ return;
- if (status == 0) {
- scanner_pid = ms_get_scanner_pid();
+ scanner_pid = ms_get_scanner_pid();
- /*Kill the running child process*/
- if (scanner_pid > 0) {
- if (kill(scanner_pid, SIGKILL) < 0) {
- MS_DBG_ERR("kill failed");
- MS_DBG_STRERROR();
- }
- }
+ if (scanner_pid > 0) {
+ if (kill(scanner_pid, SIGKILL) == 0) {
MS_DBG("KILL SCANNER");
- MS_DBG_ERR("START SMART HUB RESET");
- ms_config_set_int(MS_DB_RESET, 1);
- ms_reset_ownerlist();
- ms_reset_mediadb(uid);
- __ms_update_mediadb(true);
- ms_config_set_int(MS_DB_RESET, 0);
- MS_DBG_ERR("END SMART HUB RESET");
- smarthub_reset = false;
+ } else {
+ MS_DBG_STRERROR("kill failed");
}
}
+
+ MS_DBG_ERR("START SMART HUB RESET");
+ ms_config_set_int(MS_DB_RESET, 1);
+ ms_reset_ownerlist();
+ ms_reset_mediadb(uid);
+ __ms_update_mediadb(true);
+ ms_config_set_int(MS_DB_RESET, 0);
+ MS_DBG_ERR("END SMART HUB RESET");
}
#endif
static void __ms_add_event_receiver(void)
{
#ifdef _USE_TVPD_MODE
- int err = 0;
- /*add noti receiver for smart hub reset */
- err = vconf_notify_key_changed(SMARTHUB_RESET_VCONF, (vconf_callback_fn) __ms_smarthub_vconf_cb, NULL);
- if (err == -1)
+ if (vconf_notify_key_changed(SMARTHUB_RESET_VCONF, __ms_smarthub_vconf_cb, NULL) == -1)
MS_DBG_ERR("add call back function for event %s fails", SMARTHUB_RESET_VCONF);
#else
- /*set power off callback function*/
ms_sys_set_poweroff_cb(__power_off_cb, NULL);
#endif
ms_sys_set_device_block_event_cb(ms_device_block_changed_cb, NULL);