Name: mtp-initiator
Summary: mtp(media transfer protocol) initiator
-Version: 1.4.21
+Version: 1.4.22
Release: 1
Group: Network & Connectivity/Other
License: Apache-2.0
#define RETV_IF(expr, val) \
do { \
if (expr) { \
- MTP_LOGE("(%s) return", #expr); \
+ MTP_LOGE("%s return", #expr); \
return (val); \
} \
} while (0)
int bus_location;
int device_number;
char *model_name;
- GMainLoop *event_loop;
+ char *stitching_engine_version;
};
struct _mtp_device_list {
struct _mtp_context {
/* daemon variable */
- bool is_initialized;
GMainLoop *main_loop;
/* controller variable */
mtp_device_list *device_list;
/* gdbus variable */
- gint bus_id;
GDBusConnection *connection;
mtpgdbuslibManager *manager;
gint handle,
gpointer user_data);
+gboolean deviceinfo_get_stitching_engine_version(
+ mtpgdbuslibDeviceinfo *deviceinfo,
+ GDBusMethodInvocation *invocation,
+ gint handle,
+ gpointer user_data);
+
#endif
static mtp_context *_mtp_ctx = NULL;
-mtp_context *get_mtp_ctx(void)
-{
- MTP_LOGI("%s", __func__);
- return _mtp_ctx;
-}
-
static mtp_error_e __daemon_initalize(mtp_context *mtp_ctx)
{
mtp_error_e ret = MTP_ERROR_NONE;
ret = mtp_daemon_controller_init(mtp_ctx);
if (ret != MTP_ERROR_NONE) {
- MTP_LOGE("mtp_daemon_controller_init is failed - ret[%d]", ret);
+ MTP_LOGE("mtp_daemon_controller_init is failed: %d", ret);
return ret;
}
ret = mtp_daemon_db_init(mtp_ctx);
if (ret != MTP_ERROR_NONE) {
- MTP_LOGE("mtp_daemon_db_init is failed - ret[%d]", ret);
+ MTP_LOGE("mtp_daemon_db_init is failed: %d", ret);
return ret;
}
- ret = mtp_daemon_gdbus_init(mtp_ctx);
+ ret = mtp_daemon_event_init(mtp_ctx);
if (ret != MTP_ERROR_NONE) {
- MTP_LOGE("mtp_daemon_gdbus_init is failed - ret[%d]", ret);
+ MTP_LOGE("mtp_daemon_event_init is failed: %d", ret);
return ret;
}
- mtp_ctx->is_initialized = true;
+ ret = mtp_daemon_gdbus_init(mtp_ctx);
+ if (ret != MTP_ERROR_NONE) {
+ MTP_LOGE("mtp_daemon_gdbus_init is failed: %d", ret);
+ return ret;
+ }
return ret;
}
RETV_IF(mtp_ctx == NULL, MTP_ERROR_INVALID_PARAMETER);
- /* deinitialize daemon */
- mtp_ctx->is_initialized = false;
-
usb_host_unset_event_cb();
ret = mtp_daemon_db_deinit(mtp_ctx);
switch (signo) {
case SIGTERM:
ret = __daemon_deinitalize(_mtp_ctx);
- MTP_LOGD("SIGTERM ret[%d]", ret);
+ MTP_LOGD("SIGTERM ret: %d", ret);
break;
default:
- MTP_LOGD("unhandled signal[%d]", signo);
+ MTP_LOGD("unhandled signal: %d", signo);
exit(EXIT_FAILURE);
break;
} /* end switch */
mtp_error_e ret = MTP_ERROR_NONE;
struct sigaction sigact;
- MTP_LOGI("mtp_daemon - start");
+ MTP_LOGI("mtp initiator start");
remove(MTP_DB_FILE);
sigemptyset(&sigact.sa_mask);
sigact.sa_flags = 0;
if (sigaction(SIGTERM, &sigact, NULL) < 0)
- MTP_LOGW("sigaction(SIGTERM) is failed");
+ MTP_LOGW("sigaction is failed");
/* 2. create mtp daemon context */
mtp_ctx = g_new0(mtp_context, 1);
mtp_ctx->device_list = g_new0(mtp_device_list, 1);
if (mtp_ctx->device_list == NULL) {
- MTP_LOGE("create mtp_context is failed");
+ MTP_LOGE("create device_list is failed");
goto EXIT;
}
/* 3. initialize daemon */
ret = __daemon_initalize(mtp_ctx);
if (ret != MTP_ERROR_NONE) {
- MTP_LOGE("mtp_daemon_initalize is failed");
+ MTP_LOGE("daemon initalize is failed");
goto EXIT;
}
EXIT:
ret = __daemon_deinitalize(mtp_ctx);
- if (ret != MTP_ERROR_NONE) {
- MTP_LOGE("mtp_daemon_deinitalize is failed");
- return -1;
- }
+ if (ret != MTP_ERROR_NONE)
+ MTP_LOGE("daemon deinitalize is failed");
- MTP_LOGD("mtp_daemon - exit");
+ MTP_LOGI("mtp initiator exit");
return 0;
}
if (mtp_ctx->c_thread == NULL) {
MTP_LOGE("Can not create controller thread");
if (error != NULL) {
- MTP_LOGE("The error msg : %s", error->message);
+ MTP_LOGE("The error msg: %s", error->message);
g_error_free(error);
}
if (sql != NULL) {
sql_ret = sqlite3_exec(mtp_ctx->db, sql, NULL, NULL, &error);
if (sql_ret != SQLITE_OK) {
- MTP_LOGE("sqlite3_exec failed, sql_ret[%d] : %s", sql_ret, error);
+ MTP_LOGE("sqlite3_exec failed, %d, %s", sql_ret, error);
ret = MTP_ERROR_DB;
sqlite3_free(error);
}
if (sql != NULL) {
sql_ret = sqlite3_exec(mtp_ctx->db, sql, NULL, NULL, &error);
if (sql_ret != SQLITE_OK) {
- MTP_LOGE("sqlite3_exec failed, sql_ret[%d] : %s", sql_ret, error);
+ MTP_LOGE("sqlite3_exec failed, %d, %s", sql_ret, error);
ret = MTP_ERROR_DB;
sqlite3_free(error);
}
if (sql != NULL && object_info != NULL) {
sql_ret = sqlite3_prepare_v2(mtp_ctx->db, sql, strlen(sql), &stmt, NULL);
if (stmt == NULL) {
- MTP_LOGE("sqlite3_prepare_v2 failed, sql_ret[%d], %s", sql_ret, sqlite3_errmsg(mtp_ctx->db));
+ MTP_LOGE("sqlite3_prepare_v2 failed, %d, %s", sql_ret, sqlite3_errmsg(mtp_ctx->db));
g_free(object_info);
return NULL;
}
sql_ret = sqlite3_step(stmt);
if (sql_ret != SQLITE_ROW) {
- MTP_LOGE("sqlite3_step failed, sql_ret[%d]", sql_ret);
+ MTP_LOGE("sqlite3_step failed, %d", sql_ret);
g_free(object_info);
return NULL;
}
object_info->ModificationDate = sqlite3_column_int(stmt, 20);
object_info->Keywords = g_strdup((const char *)sqlite3_column_text(stmt, 21));
- /*MTP_LOGI("Filename: %s, CaptureDate: %ld, ModificationDate: %ld",
- object_info->Filename, (long)object_info->CaptureDate, (long)object_info->ModificationDate);*/
-
sqlite3_finalize(stmt);
sqlite3_free(sql);
} else {
if (sql != NULL) {
sql_ret = sqlite3_prepare_v2(mtp_ctx->db, sql, strlen(sql), &stmt, NULL);
if (stmt == NULL) {
- MTP_LOGE("sqlite3_prepare_v2 failed, sql_ret[%d], %s", sql_ret, sqlite3_errmsg(mtp_ctx->db));
+ MTP_LOGE("sqlite3_prepare_v2 failed, %d, %s", sql_ret, sqlite3_errmsg(mtp_ctx->db));
return false;
}
sql_ret = sqlite3_step(stmt);
if (sql_ret != SQLITE_ROW) {
- MTP_LOGE("sqlite3_step failed, sql_ret[%d]", sql_ret);
+ MTP_LOGE("sqlite3_step failed, %d", sql_ret);
return false;
}
count = sqlite3_column_int(stmt, 0);
- /*MTP_LOGI("device: %d, object_id: %d, count: %d", device_handle, object_handle, count);*/
-
sqlite3_finalize(stmt);
sqlite3_free(sql);
} else {
{
int sql_ret;
- MTP_LOGI("mtp_ctx %p", mtp_ctx);
-
if (mtp_ctx->db == NULL) {
MTP_LOGE("mtp_ctx->db is NULL");
return MTP_ERROR_DB;
sql_ret = sqlite3_exec(mtp_ctx->db, "BEGIN;", NULL, NULL, NULL);
if (sql_ret != SQLITE_OK) {
- MTP_LOGE("sqlite3_exec BEGIN failed - sql_ret[%d]", sql_ret);
+ MTP_LOGE("sqlite3_exec BEGIN failed, %d", sql_ret);
return MTP_ERROR_DB;
}
{
int sql_ret;
- MTP_LOGI("mtp_ctx %p", mtp_ctx);
-
if (mtp_ctx->db == NULL) {
MTP_LOGE("mtp_ctx->db is NULL");
return MTP_ERROR_DB;
sql_ret = sqlite3_exec(mtp_ctx->db, "COMMIT;", NULL, NULL, NULL);
if (sql_ret != SQLITE_OK) {
- MTP_LOGE("sqlite3_exec COMMIT failed - sql_ret[%d]", sql_ret);
+ MTP_LOGE("sqlite3_exec COMMIT failed, %d", sql_ret);
return MTP_ERROR_DB;
}
if (sql != NULL) {
sql_ret = sqlite3_exec(mtp_ctx->db, sql, NULL, NULL, &error);
if (sql_ret != SQLITE_OK) {
- MTP_LOGE("sqlite3_exec failed, sql_ret[%d] : %s", sql_ret, error);
+ MTP_LOGE("sqlite3_exec failed, %d, %s", sql_ret, error);
ret = MTP_ERROR_DB;
sqlite3_free(error);
}
if (sql != NULL) {
sql_ret = sqlite3_exec(mtp_ctx->db, sql, NULL, NULL, &error);
if (sql_ret != SQLITE_OK) {
- MTP_LOGE("sqlite3_exec failed, sql_ret[%d] : %s", sql_ret, error);
+ MTP_LOGE("sqlite3_exec failed, %d, %s", sql_ret, error);
ret = MTP_ERROR_DB;
sqlite3_free(error);
}
sql_ret = sqlite3_open_v2(MTP_DB_FILE, &mtp_ctx->db,
SQLITE_OPEN_FULLMUTEX | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL);
if (sql_ret != SQLITE_OK) {
- MTP_LOGE("sqlite3_open_v2 failed, sql_ret[%d]", sql_ret);
+ MTP_LOGE("sqlite3_open_v2 failed, %d", sql_ret);
return MTP_ERROR_DB;
}
if (mtp_ctx->db != NULL) {
sql_ret = sqlite3_close(mtp_ctx->db);
if (sql_ret != SQLITE_OK) {
- MTP_LOGE("sqlite3_close failed, sql_ret[%d]", sql_ret);
+ MTP_LOGE("sqlite3_close failed, %d", sql_ret);
return MTP_ERROR_DB;
}
mtp_ctx->db = NULL;
USB_MAX,
} usbhost_state;
-typedef void (*device_changed_cb)(const char *dev_path, int bus_no, int dev_no, usbhost_state host_status, void *user_data);
+typedef void (*device_changed_cb)(const char *dev_path, int bus_no, int dev_no,
+ usbhost_state host_status, void *user_data);
typedef struct _device_cb_data device_cb_data;
{
int slot;
- MTP_LOGI(" ");
- MTP_LOGI("<------print list------->");
-
for (slot = 1; slot < MTP_MAX_SLOT; slot++) {
mtp_device_info *device_info;
device_info = (mtp_device_info *)mtp_ctx->device_list->device_info_list[slot];
- if (device_info != NULL)
- MTP_LOGI("%d. bus %d, dev %d, %s, %p", slot, device_info->bus_location,
- device_info->device_number, device_info->model_name, device_info->device);
- else
- MTP_LOGI("empty slot %d", slot);
+ if (device_info != NULL) {
+ MTP_LOGI("%s: %03d-%03d", device_info->model_name, device_info->bus_location,
+ device_info->device_number);
+ }
}
-
- MTP_LOGI("<------print list end------->");
- MTP_LOGI(" ");
}
static int __search_empty_slot(mtp_context *mtp_ctx)
for (slot = 1; slot < MTP_MAX_SLOT; slot++) {
if (mtp_ctx->device_list->device_info_list[slot] == NULL) {
- MTP_LOGI("empty slot: %d", slot);
return slot;
}
}
char label[256] = {0,};
getxattr(usb_node, "security.SMACK64", label, 256);
- MTP_LOGI("check_count: %d, label: %s", check_count, label);
-
if (!strcmp(label, "*"))
break;
if (devpath_len < 8)
return false;
- MTP_LOGI("devpath_len: %d", devpath_len);
-
strncpy(bus, &devpath[devpath_len - 7], 3);
strncpy(dev, &devpath[devpath_len - 3], 3);
*busno = atoi(bus);
*devno = atoi(dev);
- MTP_LOGI("busno: %d, devno: %d, devpath: %s", *busno, *devno, devpath);
-
return true;
}
{
GVariant *tmp;
const char *devpath = NULL;
- int state;
- int vendorid;
- int productid;
+ int state = -1;
int busno = 0;
int devno = 0;
-
- int baseclass;
- int subclass;
- int protocol;
- const char *manufacturer = NULL;
- const char *product = NULL;
- const char *serial = NULL;
-
gsize size = 0;
device_cb_data *cb_data = (device_cb_data *)user_data;
void *usr_cb = cb_data->usr_cb;
tmp = g_variant_get_child_value(parameters, 0);
state = g_variant_get_int32(tmp);
- MTP_LOGI("state: %d", state);
tmp = g_variant_get_child_value(parameters, 1);
devpath = g_variant_get_string(tmp, &size);
- MTP_LOGI("devpath: %s", devpath);
-
- tmp = g_variant_get_child_value(parameters, 2);
- baseclass = g_variant_get_int32(tmp);
- MTP_LOGI("baseclass: %d", baseclass);
-
- tmp = g_variant_get_child_value(parameters, 3);
- subclass = g_variant_get_int32(tmp);
- MTP_LOGI("subclass: %d", subclass);
-
- tmp = g_variant_get_child_value(parameters, 4);
- protocol = g_variant_get_int32(tmp);
- MTP_LOGI("protocol: %d", protocol);
-
- tmp = g_variant_get_child_value(parameters, 5);
- vendorid = g_variant_get_int32(tmp);
- MTP_LOGI("vendorid: %d", vendorid);
-
- tmp = g_variant_get_child_value(parameters, 6);
- productid = g_variant_get_int32(tmp);
- MTP_LOGI("productid: %d", productid);
-
- tmp = g_variant_get_child_value(parameters, 7);
- manufacturer = g_variant_get_string(tmp, &size);
- MTP_LOGI("manufacturer: %s", manufacturer);
-
- tmp = g_variant_get_child_value(parameters, 8);
- product = g_variant_get_string(tmp, &size);
- MTP_LOGI("product: %s", product);
-
- tmp = g_variant_get_child_value(parameters, 9);
- serial = g_variant_get_string(tmp, &size);
- MTP_LOGI("serial: %s", serial);
if (devpath == NULL) {
MTP_LOGE("devpath is NULL");
}
if (__parsing_usb_devpath(devpath, &busno, &devno) == false) {
- MTP_LOGE("devpath parsing failed! : %s", devpath);
+ MTP_LOGE("devpath parsing failed: %s", devpath);
return;
}
if (busno > 0 && devno > 0)
((device_changed_cb)usr_cb)(devpath, busno, devno, state, usr_data);
-
- MTP_LOGI("user callback done");
}
static int __dbus_subscribe_usb_host_event(device_changed_cb usr_callback, void *usr_data)
int ret = MTP_ERROR_NONE;
GError *error = NULL;
- MTP_LOGI("BEGIN");
-
g_usb_cb_data = malloc(sizeof(device_cb_data));
if (g_usb_cb_data == NULL) {
MTP_LOGE("malloc failed");
g_usb_cb_data,
NULL);
- MTP_LOGI("END");
-
return MTP_ERROR_NONE;
ERROR:
LIBMTP_raw_device_t *raw_devices;
LIBMTP_mtpdevice_t *device;
mtp_device_info *device_info;
- int device_count = mtp_ctx->device_list->device_num;
- MTP_LOGI("host_status: %d, bus_no: %d, dev_no: %d, dev_path: %s",
- host_status, bus_no, dev_no, dev_path);
+ MTP_LOGI("usb status: %d, %03d-%03d", host_status, bus_no, dev_no);
if (host_status == USB_HOST_ADDED) {
LIBMTP_Detect_Raw_Devices(&raw_devices, &num_of_devices);
int empty_slot = 0;
char usb_node[256] = {0,};
- MTP_LOGI("connected bus_no: %d", bus_no);
-
snprintf(usb_node, sizeof(usb_node), "/dev/bus/usb/%03d/%03d",
raw_devices[slot].bus_location, raw_devices[slot].devnum);
- MTP_LOGI("usb_node : %s", usb_node);
-
__wait_smack_labeling(usb_node);
device = LIBMTP_Open_Raw_Device_Uncached(&raw_devices[slot]);
if (device == NULL) {
- MTP_LOGE("Unable to open raw device: %d", slot);
+ MTP_LOGE("Unable to open raw device: %s", usb_node);
continue;
}
device_info->model_name = LIBMTP_Get_Modelname(device);
empty_slot = __search_empty_slot(mtp_ctx);
- if (empty_slot <= 0)
+ if (empty_slot <= 0) {
+ MTP_LOGE("Not enough space in device_list");
continue;
+ }
mtp_ctx->device_list->device_info_list[empty_slot] = device_info;
mtp_ctx->device_list->device_num++;
g_thread_pool_push(mtp_ctx->device_list->threads, (gpointer)device, NULL);
mtp_daemon_gdbus_emit_event(MTP_INITIATOR_EVENT_DEVICE_ADDED, empty_slot, mtp_ctx);
+ __print_device_list(mtp_ctx);
}
}
g_free(raw_devices);
- __print_device_list(mtp_ctx);
} else if (host_status == USB_HOST_REMOVED) {
- MTP_LOGI("disconnected bus_no: %d, dev_no: %d", bus_no, dev_no);
+ while (1) {
+ if (g_async_queue_length(mtp_ctx->c_queue) < 0 && mtp_ctx->is_processing == false)
+ break;
+
+ MTP_LOGW("queue length: %d, is processing: %d",
+ g_async_queue_length(mtp_ctx->c_queue), mtp_ctx->is_processing);
+
+ usleep(200000);
+ }
+
+ mtp_ctx->is_releasing = true;
for (slot = 1; slot < MTP_MAX_SLOT; slot++) {
device_info = mtp_ctx->device_list->device_info_list[slot];
- if (device_info &&
- bus_no == device_info->bus_location &&
- dev_no == device_info->device_number &&
- device_info->event_loop != NULL) {
- MTP_LOGI("Event loop exists. Quit loop.");
- g_main_loop_quit(device_info->event_loop);
- g_main_loop_unref(device_info->event_loop);
- device_info->event_loop = NULL;
+ if (device_info && bus_no == device_info->bus_location &&
+ dev_no == device_info->device_number) {
+ int device_id = -1;
+
+ device_id = mtp_daemon_util_get_device_id(device_info->device, mtp_ctx);
+ if (device_id < 0) {
+ MTP_LOGE("device_id: %d", device_id);
+ return;
+ }
+
+ LIBMTP_Release_Device(device_info->device);
+ mtp_daemon_db_delete(device_id, 0, 0, mtp_ctx);
+
+ mtp_ctx->device_list->device_num--;
+
+ g_free(device_info->model_name);
+ g_free(device_info);
+
+ mtp_ctx->device_list->device_info_list[device_id] = NULL;
+ mtp_daemon_gdbus_emit_event(MTP_INITIATOR_EVENT_DEVICE_REMOVED, device_id, mtp_ctx);
+ __print_device_list(mtp_ctx);
}
}
+
+ mtp_ctx->is_releasing = false;
+ }
+
+ if (mtp_ctx->device_list->device_num == 0) {
+ mtp_daemon_gdbus_emit_event(MTP_INITIATOR_EVENT_TURNED_OFF, 0, mtp_ctx);
+ g_main_loop_quit(mtp_ctx->main_loop);
}
}
int device_id = -1;
mtp_device_info *device_info;
- MTP_LOGI("Event loop is started");
-
device_id = mtp_daemon_util_get_device_id(device, mtp_ctx);
if (device_id < 0)
return NULL;
if (device_info == NULL)
return NULL;
- mtp_daemon_gdbus_emit_event(MTP_INITIATOR_EVENT_DEVICE_ADDED, device_id, mtp_ctx);
-
- if(!strcmp(device_info->model_name, "SM-C200")) {
- device_info->event_loop = g_main_loop_new(NULL, FALSE);
- g_main_loop_run(device_info->event_loop);
- } else {
- while (LIBMTP_Read_Event(device, &device_event, ¶m1) == 0) {
- MTP_LOGI("device %d device_event is occured %d", device, device_event);
-
- if (device_event == LIBMTP_EVENT_STORE_ADDED) {
- LIBMTP_Get_Storage(device, LIBMTP_STORAGE_SORTBY_NOTSORTED);
- } else if (device_event == LIBMTP_EVENT_STORE_REMOVED) {
- if (device_id >= 0)
- mtp_daemon_db_delete(device_id, param1, 0, mtp_ctx);
- LIBMTP_Get_Storage(device, LIBMTP_STORAGE_SORTBY_NOTSORTED);
- } else if (device_event == LIBMTP_EVENT_OBJECT_REMOVED) {
- if (device_id >= 0)
- mtp_daemon_db_delete(device_id, 0, param1, mtp_ctx);
- } else if (device_event == LIBMTP_EVENT_OBJECT_ADDED) {
- MTPObjectInfo *object_info;
- object_info = LIBMTP_Get_Object_Info(device, param1);
-
- /* scan db and if exist, then update db */
- if (object_info != NULL && device_id >= 0) {
- if (mtp_daemon_db_is_exist(device_id, object_info->StorageID, param1, mtp_ctx) == true) {
- MTP_LOGI("DB Update");
- mtp_daemon_db_update(device_id, param1, object_info, mtp_ctx);
- } else {
- MTP_LOGI("DB Insert");
- mtp_daemon_db_insert(device_id, object_info->StorageID, param1, object_info, mtp_ctx);
- }
+ MTP_LOGI("%s, %03d-%03d event loop start", device_info->model_name,
+ device_info->bus_location, device_info->device_number);
+
+ while (LIBMTP_Read_Event(device, &device_event, ¶m1) == 0) {
+ MTP_LOGI("%s, %03d-%03d event occurs", device_info->model_name,
+ device_info->bus_location, device_info->device_number);
+
+ if (device_event == LIBMTP_EVENT_STORE_ADDED) {
+ LIBMTP_Get_Storage(device, LIBMTP_STORAGE_SORTBY_NOTSORTED);
+ } else if (device_event == LIBMTP_EVENT_STORE_REMOVED) {
+ if (device_id >= 0)
+ mtp_daemon_db_delete(device_id, param1, 0, mtp_ctx);
+ LIBMTP_Get_Storage(device, LIBMTP_STORAGE_SORTBY_NOTSORTED);
+ } else if (device_event == LIBMTP_EVENT_OBJECT_REMOVED) {
+ if (device_id >= 0)
+ mtp_daemon_db_delete(device_id, 0, param1, mtp_ctx);
+ } else if (device_event == LIBMTP_EVENT_OBJECT_ADDED) {
+ MTPObjectInfo *object_info;
+ object_info = LIBMTP_Get_Object_Info(device, param1);
+
+ /* scan db and if exist, then update db */
+ if (object_info != NULL && device_id >= 0) {
+ if (mtp_daemon_db_is_exist(device_id, object_info->StorageID, param1, mtp_ctx) == true) {
+ mtp_daemon_db_update(device_id, param1, object_info, mtp_ctx);
+ } else {
+ mtp_daemon_db_insert(device_id, object_info->StorageID, param1, object_info, mtp_ctx);
}
-
- g_free(object_info);
}
- mtp_daemon_gdbus_emit_event(device_event, (int)param1, mtp_ctx);
- }
- }
-
- while (1) {
- MTP_LOGI("queue length = %d", g_async_queue_length(mtp_ctx->c_queue));
- MTP_LOGI("is processing = %d", mtp_ctx->is_processing);
- if (g_async_queue_length(mtp_ctx->c_queue) < 0 && mtp_ctx->is_processing == false) {
- break;
+ g_free(object_info);
}
-
- usleep(200000);
+ mtp_daemon_gdbus_emit_event(device_event, (int)param1, mtp_ctx);
}
- mtp_ctx->is_releasing = true;
-
- MTP_LOGI("device is closing down!! device_id : %d", device_id);
-
- mtp_daemon_gdbus_emit_event(MTP_INITIATOR_EVENT_DEVICE_REMOVED, device_id, mtp_ctx);
-
- /* remove the device into device list */
- MTP_LOGI("remove device from the list!!");
-
- mtp_ctx->device_list->device_num--;
-
- LIBMTP_Release_Device(device_info->device);
- mtp_daemon_db_delete(device_id, 0, 0, mtp_ctx);
-
- g_free(device_info->model_name);
- g_free(device_info);
-
- mtp_ctx->device_list->device_info_list[device_id] = NULL;
-
- /* TODO : deactivate signal to clients using g_idle_add */
- __print_device_list(mtp_ctx);
-
- mtp_ctx->is_releasing = false;
-
- if (mtp_ctx->device_list->device_num == 0) {
- mtp_daemon_gdbus_emit_event(MTP_INITIATOR_EVENT_TURNED_OFF, 0, mtp_ctx);
- g_main_loop_quit(mtp_ctx->main_loop);
- }
+ MTP_LOGI("%s, %03d-%03d event loop stop", device_info->model_name,
+ device_info->bus_location, device_info->device_number);
return NULL;
}
LIBMTP_Init();
LIBMTP_Detect_Raw_Devices(&rawdevices, &numrawdevices);
- MTP_LOGI("detected device num %d", numrawdevices);
if (numrawdevices == 0) {
MTP_LOGW("MTP Host have not any mtp device");
snprintf(usb_node, sizeof(usb_node), "/dev/bus/usb/%03d/%03d",
rawdevices[device_index].bus_location, rawdevices[device_index].devnum);
-
- MTP_LOGI("usb_node : %s", usb_node);
-
+
__wait_smack_labeling(usb_node);
device = LIBMTP_Open_Raw_Device_Uncached(&rawdevices[device_index]);
if (device == NULL) {
- MTP_LOGE("Unable to open raw device[%d]", device_index);
+ MTP_LOGE("Unable to open raw device : %s", usb_node);
continue;
}
device_info->bus_location = rawdevices[device_index].bus_location;
device_info->device_number = rawdevices[device_index].devnum;
device_info->model_name = LIBMTP_Get_Modelname(device);
+ char *device_version = LIBMTP_Get_Deviceversion(device);
- if (device_info->model_name == NULL) {
- MTP_LOGE("Device: (NULL)");
- device_info->model_name = strdup(tmp_name);
+ MTP_LOGI("Device version : %s", device_version);
+ if (!strncmp(device_version, "SM", 2) && strlen(device_version) > 25) {
+ device_info->stitching_engine_version = g_strndup(&device_version[21], 4);
+ MTP_LOGI("stitching engine version : %s", device_info->stitching_engine_version);
}
- MTP_LOGI("Device: %s, Bus: %d DevNo: %d", device_info->model_name, device_info->bus_location, device_info->device_number);
+
+ if (device_info->model_name == NULL)
+ device_info->model_name = strdup(tmp_name);
empty_slot = __search_empty_slot(mtp_ctx);
- if (empty_slot < 0)
+ if (empty_slot < 0) {
+ MTP_LOGE("Not enough space in device_list");
continue;
+ }
mtp_ctx->device_list->device_info_list[empty_slot] = device_info;
mtp_ctx->device_list->device_num++;
-
- /*MTP_LOGI("mtp_ctx Device: %s, mtp_ctx Bus: %d",
- mtp_ctx->device_list->device_info_list[empty_slot]->model_name,
- mtp_ctx->device_list->device_info_list[empty_slot]->bus_location);*/
}
g_free(rawdevices);
mtp_error_e mtp_daemon_event_init(mtp_context *mtp_ctx)
{
int slot;
- mtp_error_e ret = MTP_ERROR_NONE;
RETV_IF(mtp_ctx == NULL, MTP_ERROR_INVALID_PARAMETER);
mtp_ctx->device_list->device_info_list[slot] = NULL;
/* mtp device list init */
- __device_list_init(mtp_ctx);
+ if (__device_list_init(mtp_ctx) != MTP_ERROR_NONE)
+ return MTP_ERROR_NO_DEVICE;
/* usb event setting */
usb_host_set_event_cb(__usb_host_status_changed_cb, mtp_ctx);
device_info = (mtp_device_info *)mtp_ctx->device_list->device_info_list[slot];
if (device_info != NULL) {
- MTP_LOGI("%d. bus %d, dev %d, %p", slot, device_info->bus_location,
- device_info->device_number, device_info->device);
-
g_thread_pool_push(mtp_ctx->device_list->threads,
(gpointer) device_info->device, NULL);
}
}
- MTP_LOGI("number of Devices and Thread is %d", mtp_ctx->device_list->device_num);
-
- if (mtp_ctx->device_list->device_num == 0) {
- MTP_LOGW("No Device !!");
- return MTP_ERROR_NO_DEVICE;
- }
-
- return ret;
+ return MTP_ERROR_NONE;
}
#include "mtp_daemon_gdbus_deviceinfo.h"
#include "mtp_daemon_gdbus_storageinfo.h"
#include "mtp_daemon_gdbus_objectinfo.h"
+#include "mtp_daemon_util.h"
static gboolean __manager_init(mtp_context *mtp_ctx)
{
G_CALLBACK(deviceinfo_get_device_number),
mtp_ctx);
+ g_signal_connect(
+ deviceinfo_skeleton,
+ "handle-get-stitching-engine-version",
+ G_CALLBACK(deviceinfo_get_stitching_engine_version),
+ mtp_ctx);
+
deviceinfo = g_dbus_object_manager_server_new(MTP_DBUS_DEVICEINFO_PATH);
/* Set connection to 'deviceinfo' */
{
mtp_context* mtp_ctx = (mtp_context*)user_data;
- MTP_LOGI("path: %s", path);
-
mtp_ctx->connection = connection;
if (__manager_init(mtp_ctx) == FALSE) {
const gchar *name,
gpointer user_data)
{
+ int slot;
+ int device_id = -1;
+ mtp_device_info *device_info;
mtp_context* mtp_ctx = (mtp_context*)user_data;
- MTP_LOGI("name: %s", name);
+ MTP_LOGI("mtp initiator is initialized : %d", mtp_ctx->device_list->device_num);
+
+ /* event emit */
+ for (slot = 1; slot < MTP_MAX_SLOT; slot++) {
+ device_info = mtp_ctx->device_list->device_info_list[slot];
+ if (device_info == NULL)
+ continue;
- if (mtp_daemon_event_init(mtp_ctx) != MTP_ERROR_NONE)
- g_main_loop_quit(mtp_ctx->main_loop);
+ mtp_daemon_gdbus_emit_event(MTP_INITIATOR_EVENT_DEVICE_ADDED, slot, mtp_ctx);
+ }
}
static void on_name_lost(GDBusConnection *connnection,
const gchar *name,
gpointer user_data)
{
- MTP_LOGI("name : %s", name);
+ MTP_LOGE("on_name_lost : %s", name);
}
mtp_error_e mtp_daemon_gdbus_init(mtp_context *mtp_ctx)
{
- mtp_ctx->bus_id = g_bus_own_name(G_BUS_TYPE_SYSTEM,
+ g_bus_own_name(G_BUS_TYPE_SYSTEM,
MTP_DBUS_SERVICE,
G_BUS_NAME_OWNER_FLAGS_NONE,
on_bus_acquired,
mtp_ctx,
NULL);
- MTP_LOGI("mtp_ctx->bus_id: %d", mtp_ctx->bus_id);
-
return MTP_ERROR_NONE;
}
g_assert(param->object != NULL);
g_assert(param->invocation != NULL);
- /*MTP_LOGI("%s", __func__);*/
-
/* parameter unpacking */
device_id = param->param1;
device_info = (mtp_device_info *)param->mtp_ctx->device_list->device_info_list[device_id];
/* do process */
name = LIBMTP_Get_Manufacturername(device);
} else {
- MTP_LOGE("!!! no MTP device");
- name = strdup("No Device");
+ name = strdup("N/A");
+ MTP_LOGE("No MTP device");
result = MTP_ERROR_NO_DEVICE;
}
- MTP_LOGI("name: %s, device handle: %p", name, device);
+ MTP_LOGI("manufacturer name: %s", name);
mtp_gdbuslib_deviceinfo_complete_get_manufacturer_name(param->object,
param->invocation, name, result);
g_assert(param->object != NULL);
g_assert(param->invocation != NULL);
- /*MTP_LOGI("%s", __func__);*/
-
/* parameter unpacking */
device_id = param->param1;
device_info = (mtp_device_info *)param->mtp_ctx->device_list->device_info_list[device_id];
/* do process */
name = LIBMTP_Get_Modelname(device);
} else {
- MTP_LOGE("!!! no MTP device");
- name = strdup("No Device");
+ name = strdup("N/A");
+ MTP_LOGE("No MTP device");
result = MTP_ERROR_NO_DEVICE;
}
- MTP_LOGI("name: %s, device handle: %p", name, device);
+ MTP_LOGI("model name: %s", name);
mtp_gdbuslib_deviceinfo_complete_get_model_name(param->object,
param->invocation, name, result);
g_assert(param->object != NULL);
g_assert(param->invocation != NULL);
- /*MTP_LOGI("%s", __func__);*/
-
/* parameter unpacking */
device_id = param->param1;
device_info = (mtp_device_info *)param->mtp_ctx->device_list->device_info_list[device_id];
/* do process */
number = LIBMTP_Get_Serialnumber(device);
} else {
- MTP_LOGE("!!! no MTP device");
- number = strdup("No Device");
+ number = strdup("N/A");
+ MTP_LOGE("No MTP device");
result = MTP_ERROR_NO_DEVICE;
}
- MTP_LOGI("name: %s, device handle: %p", number, device);
+ MTP_LOGI("serial number: %s", number);
mtp_gdbuslib_deviceinfo_complete_get_serial_number(param->object,
param->invocation, number, result);
g_assert(param->object != NULL);
g_assert(param->invocation != NULL);
- /*MTP_LOGI("%s", __func__);*/
-
/* parameter unpacking */
device_id = param->param1;
device_info = (mtp_device_info *)param->mtp_ctx->device_list->device_info_list[device_id];
/* do process */
version = LIBMTP_Get_Deviceversion(device);
} else {
- MTP_LOGE("!!! no MTP device");
- version = strdup("No Device");
+ version = strdup("N/A");
+ MTP_LOGE("No MTP device");
result = MTP_ERROR_NO_DEVICE;
}
- MTP_LOGI("version: %s, device handle: %p", version, device);
+ MTP_LOGI("device version: %s", version);
mtp_gdbuslib_deviceinfo_complete_get_device_version(param->object,
param->invocation, version, result);
{
mtp_param *param = (mtp_param *)user_data;
mtp_error_e result = MTP_ERROR_NONE;
- LIBMTP_mtpdevice_t *device = NULL;
mtp_device_info *device_info;
int device_id;
int bus_location = 0;
g_assert(param->object != NULL);
g_assert(param->invocation != NULL);
- /*MTP_LOGI("%s", __func__);*/
-
/* parameter unpacking */
device_id = param->param1;
device_info = (mtp_device_info *)param->mtp_ctx->device_list->device_info_list[device_id];
if (device_info != NULL) {
bus_location = device_info->bus_location;
} else {
- MTP_LOGE("!!! no MTP device");
+ MTP_LOGE("No MTP device");
result = MTP_ERROR_NO_DEVICE;
}
- MTP_LOGI("bus location: %d, device handle: %p", bus_location, device);
+ MTP_LOGI("bus location: %d", bus_location);
mtp_gdbuslib_deviceinfo_complete_get_bus_location(param->object,
param->invocation, bus_location, result);
{
mtp_param *param = (mtp_param *)user_data;
mtp_error_e result = MTP_ERROR_NONE;
- LIBMTP_mtpdevice_t *device = NULL;
mtp_device_info *device_info;
int device_id = 0;
int device_number = 0;
g_assert(param->object != NULL);
g_assert(param->invocation != NULL);
- /*MTP_LOGI("%s", __func__);*/
-
/* parameter unpacking */
device_id = param->param1;
device_info = (mtp_device_info *)param->mtp_ctx->device_list->device_info_list[device_id];
if (device_info != NULL) {
device_number = device_info->device_number;
} else {
- MTP_LOGE("!!! no MTP device");
+ MTP_LOGE("No MTP device");
result = MTP_ERROR_NO_DEVICE;
}
- MTP_LOGI("device number : %d, device handle: %p", device_number, device);
+ MTP_LOGI("device number: %d", device_number);
mtp_gdbuslib_deviceinfo_complete_get_device_number(param->object,
param->invocation, device_number, result);
g_free(param);
}
+static void __deviceinfo_get_stitching_engine_version_thread_func(gpointer user_data)
+{
+ mtp_param *param = (mtp_param *)user_data;
+ mtp_error_e result = MTP_ERROR_NONE;
+ mtp_device_info *device_info;
+ int device_id = 0;
+ char* stitching_engine_version = NULL;
+
+ g_assert(param != NULL);
+ g_assert(param->object != NULL);
+ g_assert(param->invocation != NULL);
+
+ /* parameter unpacking */
+ device_id = param->param1;
+ device_info = (mtp_device_info *)param->mtp_ctx->device_list->device_info_list[device_id];
+
+ if (device_info != NULL) {
+ if (device_info->stitching_engine_version != NULL)
+ stitching_engine_version = strdup(device_info->stitching_engine_version);
+ } else {
+ MTP_LOGE("No MTP device");
+ result = MTP_ERROR_NO_DEVICE;
+ }
+
+ MTP_LOGI("stitching_engine_version : %s", stitching_engine_version);
+
+ mtp_gdbuslib_deviceinfo_complete_get_stitching_engine_version(param->object,
+ param->invocation, stitching_engine_version, result);
+
+ /* deinitializing */
+ g_object_unref(param->invocation);
+ g_object_unref(param->object);
+ g_free(param);
+}
+
gboolean deviceinfo_get_manufacturer_name(
mtpgdbuslibDeviceinfo *deviceinfo,
GDBusMethodInvocation *invocation,
mtp_param *param = NULL;
gint result = MTP_ERROR_NONE;
- MTP_LOGI(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
-
param = g_try_new0(mtp_param, 1);
if (param == NULL) {
MTP_LOGE("Memory allocation failed");
if (mtp_daemon_controller_push(__deviceinfo_get_manufacturer_name_thread_func,
param, param->mtp_ctx) != MTP_ERROR_NONE) {
/* return error if queue was blocked */
- MTP_LOGE("controller is processing important message..");
+ MTP_LOGE("controller is processing important message");
result = MTP_ERROR_CONTROLLER;
goto OUT;
mtp_param *param = NULL;
gint result = MTP_ERROR_NONE;
- MTP_LOGI(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
-
param = g_try_new0(mtp_param, 1);
if (param == NULL) {
MTP_LOGE("Memory allocation failed");
if (mtp_daemon_controller_push(__deviceinfo_get_model_name_thread_func,
param, param->mtp_ctx) != MTP_ERROR_NONE) {
/* return error if queue was blocked */
- MTP_LOGE("controller is processing important message..");
+ MTP_LOGE("controller is processing important message");
result = MTP_ERROR_CONTROLLER;
goto OUT;
mtp_param *param = NULL;
gint result = MTP_ERROR_NONE;
- MTP_LOGI(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
-
param = g_try_new0(mtp_param, 1);
if (param == NULL) {
MTP_LOGE("Memory allocation failed");
if (mtp_daemon_controller_push(__deviceinfo_get_serial_number_thread_func,
param, param->mtp_ctx) != MTP_ERROR_NONE) {
/* return error if queue was blocked */
- MTP_LOGE("controller is processing important message..");
+ MTP_LOGE("controller is processing important message");
result = MTP_ERROR_CONTROLLER;
goto OUT;
mtp_param *param = NULL;
gint result = MTP_ERROR_NONE;
- MTP_LOGI(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
-
param = g_try_new0(mtp_param, 1);
if (param == NULL) {
MTP_LOGE("Memory allocation failed");
if (mtp_daemon_controller_push(__deviceinfo_get_device_version_thread_func,
param, param->mtp_ctx) != MTP_ERROR_NONE) {
/* return error if queue was blocked */
- MTP_LOGE("controller is processing important message..");
+ MTP_LOGE("controller is processing important message");
result = MTP_ERROR_CONTROLLER;
goto OUT;
mtp_param *param = NULL;
gint result = MTP_ERROR_NONE;
- MTP_LOGI(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
-
param = g_try_new0(mtp_param, 1);
if (param == NULL) {
MTP_LOGE("Memory allocation failed");
if (mtp_daemon_controller_push(__deviceinfo_get_bus_location_thread_func,
param, param->mtp_ctx) != MTP_ERROR_NONE) {
/* return error if queue was blocked */
- MTP_LOGE("controller is processing important message..");
+ MTP_LOGE("controller is processing important message");
result = MTP_ERROR_CONTROLLER;
goto OUT;
mtp_param *param = NULL;
gint result = MTP_ERROR_NONE;
- MTP_LOGI(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
-
param = g_try_new0(mtp_param, 1);
if (param == NULL) {
MTP_LOGE("Memory allocation failed");
if (mtp_daemon_controller_push(__deviceinfo_get_device_number_thread_func,
param, param->mtp_ctx) != MTP_ERROR_NONE) {
/* return error if queue was blocked */
- MTP_LOGE("controller is processing important message..");
+ MTP_LOGE("controller is processing important message");
result = MTP_ERROR_CONTROLLER;
goto OUT;
return TRUE;
}
+gboolean deviceinfo_get_stitching_engine_version(
+ mtpgdbuslibDeviceinfo *deviceinfo,
+ GDBusMethodInvocation *invocation,
+ gint handle,
+ gpointer user_data)
+{
+ mtp_param *param = NULL;
+ gint result = MTP_ERROR_NONE;
+
+ param = g_try_new0(mtp_param, 1);
+ if (param == NULL) {
+ MTP_LOGE("Memory allocation failed");
+ result = MTP_ERROR_OUT_OF_MEMORY;
+ goto OUT;
+ }
+
+ param->object = g_object_ref(deviceinfo);
+ param->invocation = g_object_ref(invocation);
+ param->mtp_ctx = (mtp_context *)user_data;
+ param->param1 = handle;
+
+ if (mtp_daemon_controller_push(__deviceinfo_get_stitching_engine_version_thread_func,
+ param, param->mtp_ctx) != MTP_ERROR_NONE) {
+ /* return error if queue was blocked */
+ MTP_LOGE("controller is processing important message");
+ result = MTP_ERROR_CONTROLLER;
+
+ goto OUT;
+ }
+
+ return TRUE;
+
+OUT:
+ if (param != NULL) {
+ g_object_unref(param->invocation);
+ g_object_unref(param->object);
+
+ g_free(param);
+ }
+
+ mtp_gdbuslib_deviceinfo_complete_get_stitching_engine_version(deviceinfo, invocation, 0, result);
+
+ return TRUE;
+}
+
g_assert(param->invocation != NULL);
g_assert(param->mtp_ctx != NULL);
- /*MTP_LOGI("%s", __func__);*/
-
/* parameter unpacking */
object = (mtpgdbuslibManager *)(param->object);
g_variant_builder_init(&b, G_VARIANT_TYPE("aa{sv}"));
count = param->mtp_ctx->device_list->device_num;
- MTP_LOGI("devices_num: %d", count);
for (slot = 1; slot < MTP_MAX_SLOT; slot++) {
mtp_device_info *device_info;
g_variant_new_int32(slot));
g_variant_builder_close(&b);
-
- MTP_LOGI("mtp_device : %d, bus_location: %d, device_number : %d",
- slot, device_info->bus_location, device_info->device_number);
}
}
gv = g_variant_builder_end(&b);
+ MTP_LOGI("devices_num: %d", count);
+
mtp_gdbuslib_manager_complete_get_devices(object, param->invocation, count, gv, result);
/* deinitializing */
g_assert(param->invocation != NULL);
g_assert(param->mtp_ctx != NULL);
- /*MTP_LOGI("%s", __func__);*/
-
/* parameter unpacking */
device_id = param->param1;
device_info = (mtp_device_info *)param->mtp_ctx->device_list->device_info_list[device_id];
if (device_info != NULL)
device = (LIBMTP_mtpdevice_t *)device_info->device;
- MTP_LOGI("device_id: %d, device: %p", device_id, device);
-
/* loop over storages */
g_variant_builder_init(&b, G_VARIANT_TYPE("aa{sv}"));
if (device_info != NULL) {
for (storage = device->storage; storage != NULL; storage = storage->next) {
- MTP_LOGI("storage: %p", storage);
-
g_variant_builder_open(&b, G_VARIANT_TYPE("a{sv}"));
g_variant_builder_add(&b, "{sv}", "mtp_storage",
count++;
}
} else {
- MTP_LOGE("!!! no MTP device");
result = MTP_ERROR_NO_DEVICE;
}
g_assert(param->invocation != NULL);
g_assert(param->mtp_ctx != NULL);
- /*MTP_LOGI("%s", __func__);*/
-
/* parameter unpacking */
device_id = param->param1;
mtp_storage = param->param2;
goto END;
}
- MTP_LOGI("device_id: %d, storage id: %d, format: %d, parent: %d, device: %p",
- param->param1, param->param2, param->param3, param->param4, device);
+ MTP_LOGI("device_id: %d, storage id: %d, format: %d, parent: %d",
+ param->param1, param->param2, param->param3, param->param4);
if (parent_object_handle > 0) {
MTPObjectInfo *object_info = NULL;
END:
gv = g_variant_builder_end(&b);
- MTP_LOGI("Real object_num: %d", target_object_num);
+ MTP_LOGI("object_num: %d", target_object_num);
mtp_gdbuslib_manager_complete_get_object_handles(param->object,
param->invocation, target_object_num, gv, result);
g_assert(param->invocation != NULL);
g_assert(param->mtp_ctx != NULL);
- /*MTP_LOGI("%s", __func__);*/
-
/* parameter unpacking */
device_id = param->param1;
object_handle = param->param2;
if (device_info != NULL) {
device = (LIBMTP_mtpdevice_t *)device_info->device;
- MTP_LOGI("device_id: %d, device: %p, dest_path: %s", device_id, device, dest_path);
+ MTP_LOGI("device_id: %d, oh: %d, dest_path: %s", device_id, object_handle, dest_path);
/* file remove */
unlink(dest_path);
close(fd);
}
} else {
- MTP_LOGE("!!! no MTP device");
+ MTP_LOGE("No MTP device");
result = MTP_ERROR_NO_DEVICE;
}
g_assert(param->invocation != NULL);
g_assert(param->mtp_ctx != NULL);
- /*MTP_LOGI("%s", __func__);*/
-
/* parameter unpacking */
device_id = param->param1;
object_handle = param->param2;
if (device_info != NULL) {
device = (LIBMTP_mtpdevice_t *)device_info->device;
- MTP_LOGI("device_id: %d, device: %p, oh : %d, dest_path: %s", device_id, device, object_handle, dest_path);
/* file remove */
unlink(dest_path);
MTP_LOGE("file open fail - fd: %d, dest_path: %s", fd, dest_path);
result = MTP_ERROR_IO_ERROR;
} else {
- MTP_LOGI("offset : %d, max_bytes : %d", offset, max_bytes);
ret = LIBMTP_GetPartialObject(device, object_handle, (uint32_t)offset, (uint32_t)max_bytes, &data, &actual_written);
- MTP_LOGI("actual_written : %d", actual_written);
if (ret == 0) {
ret = write(fd, data, actual_written);
result = MTP_ERROR_PLUGIN_FAIL;
}
+ if (data != NULL)
+ free (data);
+
close(fd);
}
} else {
- MTP_LOGE("!!! no MTP device");
+ MTP_LOGE("No MTP device");
result = MTP_ERROR_NO_DEVICE;
}
g_assert(param->invocation != NULL);
g_assert(param->mtp_ctx != NULL);
- /*MTP_LOGI("%s", __func__);*/
-
/* parameter unpacking */
device_id = param->param1;
object_handle = param->param2;
if (device_info != NULL) {
device = (LIBMTP_mtpdevice_t *)device_info->device;
- MTP_LOGI("device_id: %d, device: %p, dest_path: %s", device_id, device, dest_path);
/* file remove */
unlink(dest_path);
result = MTP_ERROR_PLUGIN_FAIL;
}
+ if (thumb_data != NULL)
+ free (thumb_data);
+
close(fd);
}
} else {
- MTP_LOGE("!!! no MTP device");
+ MTP_LOGE("No MTP device");
result = MTP_ERROR_NO_DEVICE;
}
g_assert(param->invocation != NULL);
g_assert(param->mtp_ctx != NULL);
- MTP_LOGI("%s", __func__);
-
/* parameter unpacking */
device_id = param->param1;
device_info = (mtp_device_info *)param->mtp_ctx->device_list->device_info_list[device_id];
if (device_info != NULL) {
device = (LIBMTP_mtpdevice_t *)device_info->device;
- MTP_LOGI("device_id: %d, device: %p", device_id, device);
-
object_handle = param->param2;
ret = LIBMTP_Delete_Object(device, object_handle);
if (ret != 0)
result = MTP_ERROR_PLUGIN_FAIL;
} else {
- MTP_LOGE("!!! no MTP device");
+ MTP_LOGE("No MTP device");
result = MTP_ERROR_NO_DEVICE;
}
mtp_param *param = NULL;
gint result = MTP_ERROR_NONE;
- MTP_LOGI(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
-
param = g_try_new0(mtp_param, 1);
if (param == NULL) {
MTP_LOGE("Memory allocation failed");
if (mtp_daemon_controller_push(__manager_get_devices_thread_func, param, param->mtp_ctx)
!= MTP_ERROR_NONE) {
/* return error if queue was blocked */
- MTP_LOGE("controller is processing important message..");
+ MTP_LOGE("controller is processing important message");
result = MTP_ERROR_CONTROLLER;
goto OUT;
mtp_param *param = NULL;
gint result = MTP_ERROR_NONE;
- MTP_LOGI(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
-
param = g_try_new0(mtp_param, 1);
if (param == NULL) {
MTP_LOGE("Memory allocation failed");
if (mtp_daemon_controller_push(__manager_get_storages_thread_func,
param, param->mtp_ctx) != MTP_ERROR_NONE) {
/* return error if queue was blocked */
- MTP_LOGE("controller is processing important message..");
+ MTP_LOGE("controller is processing important message");
result = MTP_ERROR_CONTROLLER;
goto OUT;
mtp_param *param = NULL;
gint result = MTP_ERROR_NONE;
- /*MTP_LOGI(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));*/
-
param = g_try_new0(mtp_param, 1);
if (param == NULL) {
MTP_LOGE("Memory allocation failed");
if (mtp_daemon_controller_push(__manager_get_object_handles_thread_func,
param, param->mtp_ctx) != MTP_ERROR_NONE) {
/* return error if queue was blocked */
- MTP_LOGE("controller is processing important message..");
+ MTP_LOGE("controller is processing important message");
result = MTP_ERROR_CONTROLLER;
goto OUT;
mtp_param *param = NULL;
gint result = MTP_ERROR_NONE;
- /*MTP_LOGI(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));*/
-
param = g_try_new0(mtp_param, 1);
if (param == NULL) {
MTP_LOGE("Memory allocation failed");
if (mtp_daemon_controller_push(__manager_get_object_thread_func,
param, param->mtp_ctx) != MTP_ERROR_NONE) {
/* return error if queue was blocked */
- MTP_LOGE("controller is processing important message..");
+ MTP_LOGE("controller is processing important message");
result = MTP_ERROR_CONTROLLER;
goto OUT;
mtp_param *param = NULL;
gint result = MTP_ERROR_NONE;
- /*MTP_LOGI(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));*/
param = g_try_new0(mtp_param, 1);
if (param == NULL) {
if (mtp_daemon_controller_push(__manager_get_partial_object_thread_func,
param, param->mtp_ctx) != MTP_ERROR_NONE) {
/* return error if queue was blocked */
- MTP_LOGE("controller is processing important message..");
+ MTP_LOGE("controller is processing important message");
result = MTP_ERROR_CONTROLLER;
goto OUT;
mtp_param *param = NULL;
gint result = MTP_ERROR_NONE;
- /*MTP_LOGI(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));*/
param = g_try_new0(mtp_param, 1);
if (param == NULL) {
if (mtp_daemon_controller_push(__manager_get_thumbnail_thread_func,
param, param->mtp_ctx) != MTP_ERROR_NONE) {
/* return error if queue was blocked */
- MTP_LOGE("controller is processing important message..");
+ MTP_LOGE("controller is processing important message");
result = MTP_ERROR_CONTROLLER;
goto OUT;
mtp_param *param = NULL;
gint result = MTP_ERROR_NONE;
- MTP_LOGI(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
-
param = g_try_new0(mtp_param, 1);
if (param == NULL) {
MTP_LOGE("Memory allocation failed");
if (mtp_daemon_controller_push(__manager_delete_object_thread_func,
param, param->mtp_ctx) != MTP_ERROR_NONE) {
/* return error if queue was blocked */
- MTP_LOGE("controller is processing important message..");
+ MTP_LOGE("controller is processing important message");
result = MTP_ERROR_CONTROLLER;
goto OUT;
g_assert(param->object != NULL);
g_assert(param->invocation != NULL);
- /*MTP_LOGI("%s", __func__);*/
-
/* parameter unpacking */
device_id = param->param1;
object_handle = param->param2;
device_info = (mtp_device_info *)param->mtp_ctx->device_list->device_info_list[device_id];
if (device_info != NULL) {
- MTP_LOGI("Get property start - property %d", property);
mtp_device = (LIBMTP_mtpdevice_t *)device_info->device;
object_info = LIBMTP_Get_Object_Info(mtp_device, object_handle);
property_value = 0;
break;
}
- MTP_LOGI("Get property end, value is %d", property_value);
+ MTP_LOGI("property value is %d", property_value);
} else {
property_value = -999;
- MTP_LOGE("object_info is NULL!!");
+ MTP_LOGE("object_info is NULL");
}
} else {
- MTP_LOGE("!!! no MTP device");
+ MTP_LOGE("No MTP device");
property_value = -999;
result = MTP_ERROR_NO_DEVICE;
}
g_assert(param->object != NULL);
g_assert(param->invocation != NULL);
- /*MTP_LOGI("%s", __func__);*/
-
/* parameter unpacking */
device_id = param->param1;
object_handle = param->param2;
device_info = (mtp_device_info *)param->mtp_ctx->device_list->device_info_list[device_id];
if (device_info != NULL) {
- MTP_LOGI("Get property start - property %d", property);
mtp_device = (LIBMTP_mtpdevice_t *)device_info->device;
object_info = LIBMTP_Get_Object_Info(mtp_device, object_handle);
property_value = NULL;
break;
}
- MTP_LOGI("Get property end, value is %d", property_value);
+ MTP_LOGI("property_value is %d", property_value);
} else {
property_value = NULL;
- MTP_LOGE("object_info is NULL!!");
+ MTP_LOGE("object_info is NULL");
}
} else {
- MTP_LOGE("!!! no MTP device");
+ MTP_LOGE("No MTP device");
property_value = NULL;
result = MTP_ERROR_NO_DEVICE;
}
mtp_param *param = NULL;
gint result = MTP_ERROR_NONE;
- MTP_LOGI(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
-
param = g_try_new0(mtp_param, 1);
if (param == NULL) {
MTP_LOGE("Memory allocation failed");
if (mtp_daemon_controller_push(__objectinfo_get_property_thread_func,
param, param->mtp_ctx) != MTP_ERROR_NONE) {
/* return error if queue was blocked */
- MTP_LOGE("controller is processing important message..");
+ MTP_LOGE("controller is processing important message");
result = MTP_ERROR_CONTROLLER;
goto OUT;
mtp_param *param = NULL;
gint result = MTP_ERROR_NONE;
- MTP_LOGI(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
-
param = g_try_new0(mtp_param, 1);
if (param == NULL) {
MTP_LOGE("Memory allocation failed");
if (mtp_daemon_controller_push(__objectinfo_get_property_string_thread_func,
param, param->mtp_ctx) != MTP_ERROR_NONE) {
/* return error if queue was blocked */
- MTP_LOGE("controller is processing important message..");
+ MTP_LOGE("controller is processing important message");
result = MTP_ERROR_CONTROLLER;
goto OUT;
g_assert(param->object != NULL);
g_assert(param->invocation != NULL);
- /*MTP_LOGI("%s", __func__);*/
-
/* parameter unpacking */
device_id = param->param1;
device_info = (mtp_device_info *)param->mtp_ctx->device_list->device_info_list[device_id];
device = (LIBMTP_mtpdevice_t *)device_info->device;
mtp_storage = param->param2;
- MTP_LOGI("device_id: %d, device: %p, mtp_storage: %d", device_id, device, mtp_storage);
+
storage = mtp_daemon_util_get_storage_handle(device,
mtp_storage, param->mtp_ctx);
if (storage)
name = storage->StorageDescription;
- MTP_LOGI("StorageDescription: %s, storage handle: %p", name, storage);
+ MTP_LOGI("device_id: %d, mtp_storage: %d, StorageDescription: %s",
+ device_id, mtp_storage, name);
} else {
- MTP_LOGE("!!! no MTP device");
+ MTP_LOGE("No MTP device");
result = MTP_ERROR_NO_DEVICE;
}
g_assert(param->object != NULL);
g_assert(param->invocation != NULL);
- /*MTP_LOGI("%s", __func__);*/
-
/* parameter unpacking */
device_id = param->param1;
device_info = (mtp_device_info *)param->mtp_ctx->device_list->device_info_list[device_id];
device = (LIBMTP_mtpdevice_t *)device_info->device;
mtp_storage = param->param2;
- MTP_LOGI("device_id: %d, device: %p, mtp_storage: %d", device_id, device, mtp_storage);
+
storage = mtp_daemon_util_get_storage_handle(device,
mtp_storage, param->mtp_ctx);
if (storage)
value = storage->FreeSpaceInBytes;
- MTP_LOGI("FreeSpaceInBytes: %llu, storage handle: %p", value, storage);
+ MTP_LOGI("device_id: %d, mtp_storage: %d, FreeSpaceInBytes: %llu",
+ device_id, mtp_storage, value);
} else {
- MTP_LOGE("!!! no MTP device");
+ MTP_LOGE("No MTP device");
result = MTP_ERROR_NO_DEVICE;
}
g_assert(param->object != NULL);
g_assert(param->invocation != NULL);
- /*MTP_LOGI("%s", __func__);*/
-
/* parameter unpacking */
device_id = param->param1;
device_info = (mtp_device_info *)param->mtp_ctx->device_list->device_info_list[device_id];
device = (LIBMTP_mtpdevice_t *)device_info->device;
mtp_storage = param->param2;
- MTP_LOGI("device_id: %d, device: %p, mtp_storage: %d", device_id, device, mtp_storage);
storage = mtp_daemon_util_get_storage_handle(device,
mtp_storage, param->mtp_ctx);
if (storage)
value = storage->MaxCapacity;
- MTP_LOGI("MaxCapacity: %llu, storage handle: %p", value, storage);
+ MTP_LOGI("device_id: %d, mtp_storage: %d, MaxCapacity: %llu",
+ device_id, mtp_storage, value);
} else {
- MTP_LOGE("!!! no MTP device");
+ MTP_LOGE("No MTP device");
result = MTP_ERROR_NO_DEVICE;
}
g_assert(param->object != NULL);
g_assert(param->invocation != NULL);
- /*MTP_LOGI("%s", __func__);*/
-
/* parameter unpacking */
device_id = param->param1;
device_info = (mtp_device_info *)param->mtp_ctx->device_list->device_info_list[device_id];
device = (LIBMTP_mtpdevice_t *)device_info->device;
mtp_storage = param->param2;
- MTP_LOGI("device_id: %d, device: %p, mtp_storage: %d", device_id, device, mtp_storage);
storage = mtp_daemon_util_get_storage_handle(device,
mtp_storage, param->mtp_ctx);
if (storage)
value = storage->StorageType;
- MTP_LOGI("StorageType: %d, storage handle: %p", value, storage);
+ MTP_LOGI("device_id: %d, mtp_storage: %d, StorageType: %d",
+ device_id, mtp_storage, value);
} else {
- MTP_LOGE("!!! no MTP device");
+ MTP_LOGE("No MTP device");
result = MTP_ERROR_NO_DEVICE;
}
g_assert(param->object != NULL);
g_assert(param->invocation != NULL);
- /*MTP_LOGI("%s", __func__);*/
-
/* parameter unpacking */
device_id = param->param1;
device_info = (mtp_device_info *)param->mtp_ctx->device_list->device_info_list[device_id];
device = (LIBMTP_mtpdevice_t *)device_info->device;
mtp_storage = param->param2;
- MTP_LOGI("device_id: %d, device: %p, mtp_storage: %d", device_id, device, mtp_storage);
storage = mtp_daemon_util_get_storage_handle(device,
mtp_storage, param->mtp_ctx);
if (storage)
name = storage->VolumeIdentifier;
- MTP_LOGI("VolumeIdentifier: %s, storage handle: %p", name, storage);
+ MTP_LOGI("device_id: %d, mtp_storage: %d, VolumeIdentifier: %s",
+ device_id, mtp_storage, name);
} else {
- MTP_LOGE("!!! no MTP device");
+ MTP_LOGE("No MTP device");
result = MTP_ERROR_NO_DEVICE;
}
mtp_param *param = NULL;
gint result = MTP_ERROR_NONE;
- MTP_LOGI(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
-
param = g_try_new0(mtp_param, 1);
if (param == NULL) {
MTP_LOGE("Memory allocation failed");
if (mtp_daemon_controller_push(__storageinfo_get_description_thread_func,
param, param->mtp_ctx) != MTP_ERROR_NONE) {
/* return error if queue was blocked */
- MTP_LOGE("controller is processing important message..");
+ MTP_LOGE("controller is processing important message");
result = MTP_ERROR_CONTROLLER;
goto OUT;
mtp_param *param = NULL;
gint result = MTP_ERROR_NONE;
- MTP_LOGI(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
-
param = g_try_new0(mtp_param, 1);
if (param == NULL) {
MTP_LOGE("Memory allocation failed");
if (mtp_daemon_controller_push(__storageinfo_get_freespace_thread_func,
param, param->mtp_ctx) != MTP_ERROR_NONE) {
/* return error if queue was blocked */
- MTP_LOGE("controller is processing important message..");
+ MTP_LOGE("controller is processing important message");
result = MTP_ERROR_CONTROLLER;
goto OUT;
mtp_param *param = NULL;
gint result = MTP_ERROR_NONE;
- MTP_LOGI(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
-
param = g_try_new0(mtp_param, 1);
if (param == NULL) {
MTP_LOGE("Memory allocation failed");
if (mtp_daemon_controller_push(__storageinfo_get_maxcapacity_thread_func,
param, param->mtp_ctx) != MTP_ERROR_NONE) {
/* return error if queue was blocked */
- MTP_LOGE("controller is processing important message..");
+ MTP_LOGE("controller is processing important message");
result = MTP_ERROR_CONTROLLER;
goto OUT;
mtp_param *param = NULL;
gint result = MTP_ERROR_NONE;
- MTP_LOGI(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
-
param = g_try_new0(mtp_param, 1);
if (param == NULL) {
MTP_LOGE("Memory allocation failed");
if (mtp_daemon_controller_push(__storageinfo_get_storagetype_thread_func,
param, param->mtp_ctx) != MTP_ERROR_NONE) {
/* return error if queue was blocked */
- MTP_LOGE("controller is processing important message..");
+ MTP_LOGE("controller is processing important message");
result = MTP_ERROR_CONTROLLER;
goto OUT;
mtp_param *param = NULL;
gint result = MTP_ERROR_NONE;
- MTP_LOGI(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
-
param = g_try_new0(mtp_param, 1);
if (param == NULL) {
MTP_LOGE("Memory allocation failed");
if (mtp_daemon_controller_push(__storageinfo_get_volumeidentifier_thread_func,
param, param->mtp_ctx) != MTP_ERROR_NONE) {
/* return error if queue was blocked */
- MTP_LOGE("controller is processing important message..");
+ MTP_LOGE("controller is processing important message");
result = MTP_ERROR_CONTROLLER;
goto OUT;
{
LIBMTP_devicestorage_t *storage = NULL;
int slot;
- int device_num = mtp_ctx->device_list->device_num;
-
- MTP_LOGI("device_num: %d", device_num);
/* search device */
for (slot = 1; slot < MTP_MAX_SLOT; slot++) {
{
int slot;
- MTP_LOGI("device: %p, device_num: %d", device, mtp_ctx->device_list->device_num);
-
for (slot = 1; slot < MTP_MAX_SLOT; slot++) {
mtp_device_info *device_info;
device_info = mtp_ctx->device_list->device_info_list[slot];
- if (device_info != NULL && device_info->device == device) {
- MTP_LOGI("device id: %d", slot);
+ if (device_info != NULL && device_info->device == device)
return slot;
- }
}
return -1;
<arg type="i" name="device_number" direction="out" />
<arg type="i" name="result" direction="out" />
</method>
+
+ <method name="GetStitchingEngineVersion">
+ <arg type="i" name="mtp_device" direction="in" />
+ <arg type="s" name="stitching_engine_version" direction="out" />
+ <arg type="i" name="result" direction="out" />
+ </method>
</interface>
<interface name="org.tizen.mtp.storageinfo">
<method name="GetDescription">