#include "genmsg/ecs.pb-c.h"
+#include "debug_ch.h"
+MULTI_DEBUG_CHANNEL(qemu, ecs);
+
#define DEBUG
#ifndef min
static void* keepalive_buf;
static int payloadsize;
-static int log_fd = -1;
static int g_client_id = 1;
static pthread_mutex_t mutex_clilist = PTHREAD_MUTEX_INITIALIZER;
return suspend_state;
}
-static char* get_emulator_ecs_log_path(void)
-{
- gchar *emulator_ecs_log_path = NULL;
- gchar *tizen_sdk_data = NULL;
-#ifndef CONFIG_WIN32
- char emulator_ecs[] = "/emulator/vms/";
- char ecs_prop[] = "/logs/ecs.log";
-#else
- char emulator_ecs[] = "\\emulator\\vms\\";
- char ecs_prop[] = "\\logs\\ecs.log";
-#endif
-
- char* emul_name = get_emul_vm_name();
-
- tizen_sdk_data = get_tizen_sdk_data_path();
- if (!tizen_sdk_data) {
- LOG("failed to get tizen-sdk-data path.\n");
- return NULL;
- }
-
- emulator_ecs_log_path =
- g_malloc(strlen(tizen_sdk_data) + sizeof(emulator_ecs) + strlen(emul_name) + sizeof(ecs_prop) + 1);
- if (!emulator_ecs_log_path) {
- LOG("failed to allocate memory.\n");
- return NULL;
- }
-
- g_snprintf(emulator_ecs_log_path, strlen(tizen_sdk_data) + sizeof(emulator_ecs) + strlen(emul_name) + sizeof(ecs_prop),
- "%s%s%s%s", tizen_sdk_data, emulator_ecs, emul_name, ecs_prop);
-
- g_free(tizen_sdk_data);
-
- LOG("ecs log path: %s\n", emulator_ecs_log_path);
- return emulator_ecs_log_path;
-}
-
-static inline void start_logging(void) {
- char* path = get_emulator_ecs_log_path();
- if (!path)
- return;
-
-#ifdef _WIN32
- FILE* fnul;
- FILE* flog;
-
- fnul = fopen("NUL", "rt");
- if (fnul != NULL)
- stdin[0] = fnul[0];
-
- flog = fopen(path, "wt+");
- if (flog == NULL)
- flog = fnul;
-
- setvbuf(flog, NULL, _IONBF, 0);
-
- stdout[0] = flog[0];
- stderr[0] = flog[0];
-#else
- log_fd = creat(path, 0640);
- if (log_fd < 0) {
- log_fd = open("/dev/null", O_WRONLY);
- }
- if (log_fd < 0) {
- return;
- }
- dup2(log_fd, 1);
- dup2(log_fd, 2);
-#endif
-}
-
-static inline void stop_logging(void) {
- int ret = -1;
- if (log_fd >= 0) {
- ret = close(log_fd);
- if (ret != 0) {
- LOG("failed to close log fd.");
- }
- }
-}
-
int ecs_write(int fd, const uint8_t *buf, int len) {
- LOG("write buflen : %d, buf : %s", len, (char*)buf);
+ TRACE("write buflen : %d, buf : %s", len, (char*)buf);
if (fd < 0) {
return -1;
}
pthread_mutex_lock(&mutex_clilist);
if (clii->client_fd > 0) {
- LOG("ecs client closed with fd: %d", clii->client_fd);
+ INFO("ecs client closed with fd: %d", clii->client_fd);
closesocket(clii->client_fd);
#ifndef CONFIG_LINUX
FD_CLR(clii->client_fd, &clii->cs->reads);
}
bool send_to_all_client(const char* data, const int len) {
- LOG("data len: %d, data: %s", len, data);
+ TRACE("data len: %d, data: %s", len, data);
pthread_mutex_lock(&mutex_clilist);
ECS_Client *clii;
mon = g_malloc0(sizeof(*mon));
if (NULL == mon) {
- LOG("monitor allocation failed.");
+ ERR("monitor allocation failed.");
return NULL;
}
static void ecs_close(ECS_State *cs) {
ECS_Client *clii;
- LOG("### Good bye! ECS ###");
+ INFO("### Good bye! ECS ###");
if (cs == NULL)
return;
if (0 <= cs->listen_fd) {
- LOG("close listen_fd: %d", cs->listen_fd);
+ INFO("close listen_fd: %d", cs->listen_fd);
closesocket(cs->listen_fd);
cs->listen_fd = -1;
}
g_free(cs);
cs = NULL;
current_ecs = NULL;
-
- stop_logging();
}
#ifndef _WIN32
if (cli == NULL)
{
- LOG("client is null.");
+ ERR("client is null.");
return;
}
#ifndef __WIN32
if (ioctl(cli->client_fd, FIONREAD, &to_read_bytes) < 0)
{
- LOG("ioctl failed");
+ ERR("ioctl failed");
return;
}
#else
unsigned long to_read_bytes_long = 0;
if (ioctlsocket(cli->client_fd, FIONREAD, &to_read_bytes_long) < 0)
{
- LOG("ioctl failed");
+ ERR("ioctl failed");
return;
}
to_read_bytes = (int)to_read_bytes_long;
#endif
if (to_read_bytes == 0) {
- LOG("ioctl FIONREAD: 0\n");
+ ERR("ioctl FIONREAD: 0\n");
goto fail;
}
if (read < 4)
{
- LOG("insufficient header size");
+ ERR("insufficient header size");
goto fail;
}
cli->sbuf._netlen = payloadsize;
- LOG("payload size: %ld\n", payloadsize);
+ TRACE("payload size: %ld\n", payloadsize);
to_read_bytes -= 4;
}
events.data.fd = fd;
if (epoll_ctl(cs->epoll_fd, EPOLL_CTL_ADD, fd, &events) < 0) {
- LOG("Epoll control fails.in epoll_cli_add.");
+ ERR("Epoll control fails.in epoll_cli_add.");
}
}
#endif
ECS_Client *clii = g_malloc0(sizeof(ECS_Client));
if (NULL == clii) {
- LOG("ECS_Client allocation failed.");
+ ERR("ECS_Client allocation failed.");
return -1;
}
QTAILQ_INSERT_TAIL(&clients, clii, next);
- LOG("Add an ecs client. fd: %d", fd);
+ INFO("Add an ecs client. fd: %d", fd);
pthread_mutex_unlock(&mutex_clilist);
}
}
if (0 > ecs_add_client(cs, fd)) {
- LOG("failed to add client.");
+ ERR("failed to add client.");
}
}
keepalive_buf = g_malloc(len_pack + 4);
if (!keepalive_buf) {
- LOG("keep alive message creation is failed.");
+ ERR("keep alive message creation is failed.");
return;
}
QTAILQ_FOREACH(clii, &clients, next)
{
if (1 == clii->keep_alive) {
- LOG("get client fd %d - keep alive fail", clii->client_fd);
+ INFO("get client fd %d - keep alive fail", clii->client_fd);
ecs_client_close(clii);
continue;
}
- LOG("set client fd %d - keep alive 1", clii->client_fd);
+ TRACE("set client fd %d - keep alive 1", clii->client_fd);
clii->keep_alive = 1;
send_keep_alive_msg(clii);
}
if (current_ecs == NULL) {
- LOG("alive checking is failed because current ecs is null.");
+ ERR("alive checking is failed because current ecs is null.");
return;
}
return -1;
}
- LOG("Listen fd is %d", fd);
+ INFO("Listen fd is %d", fd);
qemu_set_nonblock(fd);
timeout.tv_usec = 0;
if (select(0, &temps, 0, 0, &timeout) < 0) {
- LOG("select error.");
+ ERR("select error.");
return -1;
}
timeout.tv_usec = 0;
if ((res = select(MAX_FD_NUM + 1, &temps, NULL, NULL, &timeout)) < 0) {
- LOG("select failed..");
+ ERR("select failed..");
return -1;
}
Monitor* mon = NULL;
char host_port[16];
int port = 0;
- start_logging();
- LOG("ecs starts initializing.");
+
+ INFO("ecs starts initializing.");
opts = qemu_opts_create(qemu_find_opts(ECS_OPTS_NAME), ECS_OPTS_NAME, 1, &local_err);
if (error_is_set(&local_err)) {
cs = g_malloc0(sizeof(ECS_State));
if (NULL == cs) {
- LOG("ECS_State allocation failed.");
+ ERR("ECS_State allocation failed.");
return NULL;
}
port = get_emul_ecs_port();
- LOG("ecs port: %d", port);
+ INFO("ecs port: %d", port);
sprintf(host_port, "%d", port);
qemu_opt_set(opts, "port", host_port);
ret = socket_initialize(cs, opts);
if (ret < 0) {
- LOG("Socket initialization is failed.");
+ ERR("Socket initialization is failed.");
ecs_close(cs);
return NULL;
}
mon = monitor_create();
if (NULL == mon) {
- LOG("monitor initialization failed.");
+ ERR("monitor initialization failed.");
ecs_close(cs);
return NULL;
}
current_ecs = cs;
cs->ecs_running = 1;
- LOG("ecs_loop entered.");
+ TRACE("ecs_loop entered.");
while (cs->ecs_running) {
ret = ecs_loop(cs);
if (0 > ret) {
break;
}
}
- LOG("ecs_loop exited.");
+ TRACE("ecs_loop exited.");
return NULL;
}
int stop_ecs(void) {
- LOG("ecs is closing.");
+ INFO("ecs is closing.");
if (NULL != current_ecs) {
current_ecs->ecs_running = 0;
ecs_close(current_ecs);
pthread_t thread_id;
if (0 != pthread_create(&thread_id, NULL, ecs_initialize, NULL)) {
- LOG("pthread creation failed.");
+ ERR("pthread creation failed.");
return -1;
}
return 0;
QTAILQ_INSERT_TAIL(&clients, cli, next);
}
else {
- LOG("unsupported category is found: %s", msg->category);
+ ERR("unsupported category is found: %s", msg->category);
pthread_mutex_unlock(&mutex_clilist);
goto fail;
}
ecs__master__free_unpacked(master, NULL);
return true;
fail:
- LOG("invalid message type");
+ ERR("invalid message type : %d", master->type);
ecs__master__free_unpacked(master, NULL);
return false;
}
#include "hw/maru_virtio_sensor.h"
#include "hw/maru_virtio_nfc.h"
+#include "debug_ch.h"
+MULTI_DEBUG_CHANNEL(qemu, ecs);
+
typedef struct mon_fd_t mon_fd_t;
struct mon_fd_t {
char *name;
for (;;) {
c = *data++;
if (outbuf_index >= OUT_BUF_SIZE - 1) {
- LOG("string is too long: overflow buffer.");
+ INFO("string is too long: overflow buffer.");
return;
}
#ifndef _WIN32
ECS__Master master = ECS__MASTER__INIT;
ECS__MonitorNtf ntf = ECS__MONITOR_NTF__INIT;
- LOG("data size : %d, data : %s", size, data);
+ TRACE("data size : %d, data : %s", size, data);
ntf.command = (char*) g_malloc(size + 1);
memcpy(ntf.command, data, size);
QDict *qmp;
QObject *obj;
- LOG("ecs_protocol_emitter called.");
+ TRACE("ecs_protocol_emitter called.");
//trace_monitor_protocol_emitter(clii->cs->mon);
if (!monitor_has_error(clii->cs->mon)) {
QDECREF(input);
QDECREF(args);
}
-#if 0
-static int check_key(QObject *input_obj, const char *key) {
- const QDictEntry *ent;
- QDict *input_dict;
-
- if (qobject_type(input_obj) != QTYPE_QDICT) {
- qerror_report(QERR_QMP_BAD_INPUT_OBJECT, "object");
- return -1;
- }
-
- input_dict = qobject_to_qdict(input_obj);
-
- for (ent = qdict_first(input_dict); ent;
- ent = qdict_next(input_dict, ent)) {
- const char *arg_name = qdict_entry_key(ent);
- if (!strcmp(arg_name, key)) {
- return 1;
- }
- }
-
- return 0;
-}
-
-static QObject* get_data_object(QObject *input_obj) {
- const QDictEntry *ent;
- QDict *input_dict;
-
- if (qobject_type(input_obj) != QTYPE_QDICT) {
- qerror_report(QERR_QMP_BAD_INPUT_OBJECT, "object");
- return NULL;
- }
-
- input_dict = qobject_to_qdict(input_obj);
-
- for (ent = qdict_first(input_dict); ent;
- ent = qdict_next(input_dict, ent)) {
- const char *arg_name = qdict_entry_key(ent);
- QObject *arg_obj = qdict_entry_value(ent);
- if (!strcmp(arg_name, COMMANDS_DATA)) {
- return arg_obj;
- }
- }
-
- return NULL;
-}
-
-static int ijcount = 0;
-
-static bool injector_command_proc(ECS_Client *clii, QObject *obj) {
- QDict* header = qdict_get_qdict(qobject_to_qdict(obj), "header");
-
- char cmd[10];
- memset(cmd, 0, 10);
- strcpy(cmd, qdict_get_str(header, "cat"));
- type_length length = (type_length) qdict_get_int(header, "length");
- type_group group = (type_action) (qdict_get_int(header, "group") & 0xff);
- type_action action = (type_group) (qdict_get_int(header, "action") & 0xff);
-
- // get data
- const char* data = qdict_get_str(qobject_to_qdict(obj), COMMANDS_DATA);
- LOG(">> count= %d", ++ijcount);
- LOG(">> print len = %zu, data\" %s\"", strlen(data), data);
- LOG(">> header = cmd = %s, length = %d, action=%d, group=%d", cmd, length,
- action, group);
-
- int datalen = strlen(data);
- int sndlen = datalen + 14;
- char* sndbuf = (char*) malloc(sndlen + 1);
- if (!sndbuf) {
- return false;
- }
-
- memset(sndbuf, 0, sndlen + 1);
-
- // set data
- memcpy(sndbuf, cmd, 10);
- memcpy(sndbuf + 10, &length, 2);
- memcpy(sndbuf + 12, &group, 1);
- memcpy(sndbuf + 13, &action, 1);
- memcpy(sndbuf + 14, data, datalen);
- send_to_evdi(route_ij, sndbuf, sndlen);
-
- free(sndbuf);
-
- return true;
-}
-
-static bool device_command_proc(ECS_Client *clii, QObject *obj) {
- QDict* header = qdict_get_qdict(qobject_to_qdict(obj), "header");
-
- char cmd[10];
- memset(cmd, 0, 10);
- strcpy(cmd, qdict_get_str(header, "cat"));
- type_length length = (type_length) qdict_get_int(header, "length");
- type_group group = (type_action) (qdict_get_int(header, "group") & 0xff);
- type_action action = (type_group) (qdict_get_int(header, "action") & 0xff);
-
- // get data
- const char* data = qdict_get_str(qobject_to_qdict(obj), COMMANDS_DATA);
- LOG(">> count= %d", ++ijcount);
- LOG(">> print len = %zu, data\" %s\"", strlen(data), data);
- LOG(">> header = cmd = %s, length = %d, action=%d, group=%d", cmd, length,
- action, group);
-
- if (!strncmp(cmd, MSG_TYPE_SENSOR, 6)) {
- if (group == MSG_GROUP_STATUS) {
- if (action ==MSG_ACTION_ACCEL) {
- get_sensor_accel();
- } else if (action == MSG_ACTION_GYRO) {
- get_sensor_gyro();
- } else if (action == MSG_ACTION_MAG) {
- get_sensor_mag();
- } else if (action == MSG_ACTION_LIGHT) {
- get_sensor_light();
- } else if (action == MSG_ACTION_PROXI) {
- get_sensor_proxi();
- }
- } else {
- set_sensor_data(length, data);
- }
- }
- /*
- else if (!strncmp(cmd, MSG_TYPE_NFC, 3)) {
- if (group == MSG_GROUP_STATUS) {
- send_to_nfc(request_nfc_get, data, length);
- }
- else
- {
- send_to_nfc(request_nfc_set, data, length);
- }
- }
- */
-
- return true;
-}
-void handle_ecs_command(JSONMessageParser *parser, QList *tokens,
- void *opaque) {
- const char *type_name;
- int def_target = 0;
-// int def_data = 0;
- QObject *obj;
- ECS_Client *clii = opaque;
-
- if (NULL == clii) {
- LOG("ClientInfo is null.");
- return;
- }
-
-#ifdef DEBUG
- LOG("Handle ecs command.");
-#endif
-
- obj = json_parser_parse(tokens, NULL);
- if (!obj) {
- qerror_report(QERR_JSON_PARSING);
- ecs_protocol_emitter(clii, NULL, NULL);
- return;
- }
-
- def_target = check_key(obj, COMMANDS_TYPE);
-#ifdef DEBUG
- LOG("check_key(COMMAND_TYPE): %d", def_target);
-#endif
- if (0 > def_target) {
- LOG("def_target failed.");
- return;
- } else if (0 == def_target) {
-#ifdef DEBUG
- LOG("call handle_qmp_command");
-#endif
- //handle_qmp_command(clii, NULL, obj);
- return;
- }
-
- type_name = qdict_get_str(qobject_to_qdict(obj), COMMANDS_TYPE);
-
- /*
- def_data = check_key(obj, COMMANDS_DATA);
- if (0 > def_data) {
- LOG("json format error: data.");
- return;
- } else if (0 == def_data) {
- LOG("data key is not found.");
- return;
- }
- */
-
- if (!strcmp(type_name, TYPE_DATA_SELF)) {
- LOG("set client fd %d keep alive 0", clii->client_fd);
- clii->keep_alive = 0;
- return;
- } else if (!strcmp(type_name, COMMAND_TYPE_INJECTOR)) {
- injector_command_proc(clii, obj);
- } else if (!strcmp(type_name, COMMAND_TYPE_CONTROL)) {
- //control_command_proc(clii, obj);
- } else if (!strcmp(type_name, COMMAND_TYPE_MONITOR)) {
- // handle_qmp_command(clii, type_name, get_data_object(obj));
- } else if (!strcmp(type_name, COMMAND_TYPE_DEVICE)) {
- device_command_proc(clii, obj);
- } else if (!strcmp(type_name, ECS_MSG_STARTINFO_REQ)) {
- //ecs_startinfo_req(clii);
- } else {
- LOG("handler not found");
- }
-}
-#endif
bool msgproc_monitor_req(ECS_Client *ccli, ECS__MonitorReq* msg)
{
- LOG(">> monitor req: data = %s", msg->command);
+ TRACE(">> monitor req: data = %s", msg->command);
ecs_json_message_parser_feed(&(ccli->parser), (const char *) msg->command, strlen(msg->command));
return true;
}
#include "skin/maruskin_server.h"
#include "emulator.h"
+#include "debug_ch.h"
+MULTI_DEBUG_CHANNEL(qemu, ecs);
+
+
#define MAX_BUF_SIZE 255
// utility functions
{
int len_pack = ecs__master__get_packed_size(master);
*payloadsize = len_pack + 4;
- LOG("pack size=%d", len_pack);
+ TRACE("pack size=%d", len_pack);
void* buf = g_malloc(len_pack + 4);
if (!buf)
return NULL;
void* buf = build_master(master, &payloadsize);
if (!buf)
{
- LOG("invalid buf");
+ ERR("invalid buf");
return false;
}
void* buf = build_master(master, &payloadsize);
if (!buf)
{
- LOG("invalid buf");
+ ERR("invalid buf");
return false;
}
void* buf = build_master(master, &payloadsize);
if (!buf)
{
- LOG("invalid buf");
+ ERR("invalid buf");
return false;
}
ECS__Master master = ECS__MASTER__INIT;
ECS__InjectorAns ans = ECS__INJECTOR_ANS__INIT;
- LOG("injector ans - category : %s, succed : %d", category, succeed);
+ TRACE("injector ans - category : %s, succed : %d", category, succeed);
catlen = strlen(category);
ans.category = (char*) g_malloc0(catlen + 1);
ECS__Master master = ECS__MASTER__INIT;
ECS__DeviceAns ans = ECS__DEVICE_ANS__INIT;
- LOG("device ans - category : %s, succed : %d", category, succeed);
+ TRACE("device ans - category : %s, succed : %d", category, succeed);
catlen = strlen(category);
ans.category = (char*) g_malloc0(catlen + 1);
}
//LOG(">> count= %d", ++ijcount);
- LOG(">> header = cmd = %s, length = %d, action=%d, group=%d", cmd, length,
+ TRACE(">> header = cmd = %s, length = %d, action=%d, group=%d", cmd, length,
action, group);
/*SD CARD msg process*/
if (!strncmp(cmd, MSG_TYPE_SDCARD, strlen(MSG_TYPE_SDCARD))) {
if (msg->has_data) {
- LOG("msg(%zu) : %s", msg->data.len, msg->data.data);
+ TRACE("msg(%zu) : %s", msg->data.len, msg->data.data);
handle_sdcard((char*) msg->data.data, msg->data.len);
} else {
- LOG("has no msg");
+ ERR("has no msg");
}
} else if (!strncmp(cmd, MSG_TYPE_SENSOR, sizeof(MSG_TYPE_SENSOR))) {
} else {
goto injector_send;
}
- LOG("status : %s", data);
+ TRACE("status : %s", data);
send_status_injector_ntf(MSG_TYPE_SENSOR, 6, action, data);
ret = true;
goto injector_req_success;
{
const char* data = (const char*)msg->data.data;
memcpy(sndbuf + 14, data, datalen);
- LOG(">> print len = %zd, data\" %s\"", strlen(data), data);
+ TRACE(">> print len = %zd, data\" %s\"", strlen(data), data);
}
}
msgproc_injector_req(NULL, &msg);
}
-#if 0
-void msgproc_checkversion_req(ECS_Client* ccli, ECS__CheckVersionReq* msg)
-{
- int datalen = 0;
- if (msg->has_data)
- {
- datalen = msg->data.len;
- if (msg->data.data && msg->data.len > 0)
- {
- const char* data = (const char*)msg->data.data;
- memcpy(sndbuf + 14, data, datalen);
- LOG(">> print len = %zd, data\" %s\"", strlen(data), data);
- }
- }
-}
-
-void send_ecs_version_check(ECS_Client *ccli)
-{
- int len_pack = 0;
- int payloadsize = 0;
- const char* ecs_version = ECS_VERSION;
-
- ECS__Master master = ECS__MASTER__INIT;
- ECS__CheckVersionReq req = ECS__CHECK_VERSION_REQ__INIT;
-
- req.version_str = (char*) g_malloc(10);
-
- strncpy(req.version_str, ecs_version, strlen(ecs_version));
- LOG("ecs version: %s", req.version_str);
- master.type = ECS__MASTER__TYPE__CHECKVERSION_REQ;
- master.checkversion_req = &req;
-
- send_to_single_client(master, ccli);
-}
-#endif
void msgproc_keepalive_ans (ECS_Client* ccli, ECS__KeepAliveAns* msg)
{
ccli->keep_alive = 0;
ans.data.len = length;
memcpy(ans.data.data, tizen_target_img_path, length);
- LOG("data = %s, length = %hu", tizen_target_img_path, length);
+ TRACE("data = %s, length = %hu", tizen_target_img_path, length);
}
master.type = ECS__MASTER__TYPE__DEVICE_ANS;
memcpy(data, msg->data.data, msg->data.len);
}
- LOG(">> header = cmd = %s, length = %d, action=%d, group=%d", cmd, length,
+ TRACE(">> header = cmd = %s, length = %d, action=%d, group=%d", cmd, length,
action, group);
if (!strncmp(cmd, MSG_TYPE_SENSOR, 6)) {
if (data != NULL) {
set_injector_data(data);
} else {
- LOG("sensor set data is null");
+ ERR("sensor set data is null");
}
}
msgproc_device_ans(ccli, cmd, true);
} else if (!strncmp(cmd, "Network", 7)) {
if (data != NULL) {
- LOG(">>> Network msg: '%s'", data);
+ TRACE(">>> Network msg: '%s'", data);
if(net_slirp_redir(data) < 0) {
- LOG( "redirect [%s] fail", data);
+ ERR( "redirect [%s] fail", data);
} else {
- LOG("redirect [%s] success", data);
+ TRACE("redirect [%s] success", data);
}
} else {
- LOG("Network redirection data is null.");
+ ERR("Network redirection data is null.");
}
} else if (!strncmp(cmd, "HKeyboard", 8)) {
if (group == MSG_GROUP_STATUS) {
send_host_keyboard_ntf(mloop_evcmd_get_hostkbd_status());
} else {
if (data == NULL) {
- LOG("HKeyboard data is NULL");
+ ERR("HKeyboard data is NULL");
return false;
}
#endif
if (data == NULL) {
- LOG("gesture data is NULL");
+ ERR("gesture data is NULL");
return false;
}
- LOG("%s\n", data);
+ TRACE("%s\n", data);
char token[] = "#";
}
} else if (!strncmp(cmd, "info", 4)) {
// check to emulator target image path
- LOG("receive info message %s", tizen_target_img_path);
+ TRACE("receive info message %s", tizen_target_img_path);
send_target_image_information(ccli);
}
int datalen = msg->data.len;
void* data = (void*)g_malloc(datalen);
if(!data) {
- LOG("g_malloc failed!");
+ ERR("g_malloc failed!");
return false;
}
if (msg->has_data && msg->data.len > 0)
{
- LOG("recv from nfc injector: ");
+ TRACE("recv from nfc injector: %s, %z", msg->has_data, msg->data.len);
print_binary(data, datalen);
}
const char* ijdata = (data + catsize + 2 + 1 + 1);
const char *encoded_ijdata = "";
- LOG("<< header cat = %s, length = %d, action=%d, group=%d", cat, length,
+ TRACE("<< header cat = %s, length = %d, action=%d, group=%d", cat, length,
action, group);
QDict* obj_header = qdict_new();
qstring_append_chr(json, '\n');
const char* snddata = qstring_get_str(json);
- LOG("<< json str = %s", snddata);
+ TRACE("<< json str = %s", snddata);
send_to_all_client(snddata, strlen(snddata));
const char* ijdata = (data + catsize + 2 + 1 + 1);
- LOG("<< header cat = %s, length = %d, action=%d, group=%d", cat, length,action, group);
+ TRACE("<< header cat = %s, length = %d, action=%d, group=%d", cat, length,action, group);
ECS__Master master = ECS__MASTER__INIT;
ECS__InjectorNtf ntf = ECS__INJECTOR_NTF__INIT;
const char* ijdata = (data + catsize + 2 + 1 + 1);
- LOG("<< header cat = %s, length = %d, action=%d, group=%d", cat, length,action, group);
+ TRACE("<< header cat = %s, length = %d, action=%d, group=%d", cat, length,action, group);
ECS__Master master = ECS__MASTER__INIT;
ECS__DeviceNtf ntf = ECS__DEVICE_NTF__INIT;
ntf.data.len = length;
memcpy(ntf.data.data, ijdata, length);
- LOG("data = %s, length = %hu", ijdata, length);
+ TRACE("data = %s, length = %hu", ijdata, length);
}
master.type = ECS__MASTER__TYPE__DEVICE_NTF;
memset(cat, 0, catsize + 1);
print_binary((char*)msg->buf, msg->use);
- LOG("id: %02x, type: %02x, use: %d", msg->client_id, msg->client_type, msg->use);
+ TRACE("id: %02x, type: %02x, use: %d", msg->client_id, msg->client_type, msg->use);
clii = find_client(msg->client_id, msg->client_type);
if (clii) {
if(clii->client_type == TYPE_SIMUL_NFC) {
} else if (clii->client_type == TYPE_ECP) {
strncpy(cat, MSG_TYPE_SIMUL_NFC, 9);
}else {
- LOG("cannot find type!");
+ ERR("cannot find type! : %d", clii->client_type);
}
- LOG("header category = %s", cat);
+ TRACE("header category = %s", cat);
}
else {
- LOG("cannot find client!");
+ ERR("cannot find client!");
}
ECS__Master master = ECS__MASTER__INIT;
}
g_strlcat(sdcard_img_path, sdcard_img_name, sizeof(sdcard_img_path));
- LOG("sdcard path: [%s]\n", sdcard_img_path);
+ TRACE("sdcard path: [%s]\n", sdcard_img_path);
//mloop_evcmd_usbdisk(sdcard_img_path);
mloop_evcmd_sdcard(sdcard_img_path);
g_free(sdcard_path);
} else {
- LOG("failed to get sdcard path!!\n");
+ ERR("failed to get sdcard path!!\n");
}
} else if(ret == '2'){
- LOG("sdcard status 2 bypass" );
+ TRACE("sdcard status 2 bypass" );
}else {
- LOG("!!! unknown command : %c\n", ret);
+ ERR("!!! unknown command : %c\n", ret);
}
}else{
- LOG("!!! unknown data : %c\n", ret);
+ ERR("!!! unknown data : %c\n", ret);
}
}
char emulator_sdcard[] = "\\emulator\\sdcard\\";
#endif
- LOG("emulator_sdcard: %s, %zu\n", emulator_sdcard, sizeof(emulator_sdcard));
+ TRACE("emulator_sdcard: %s, %zu\n", emulator_sdcard, sizeof(emulator_sdcard));
tizen_sdk_data = get_tizen_sdk_data_path();
if (!tizen_sdk_data) {
- LOG("failed to get tizen-sdk-data path.\n");
+ ERR("failed to get tizen-sdk-data path.\n");
return NULL;
}
emulator_sdcard_path =
g_malloc(strlen(tizen_sdk_data) + sizeof(emulator_sdcard) + 1);
if (!emulator_sdcard_path) {
- LOG("failed to allocate memory.\n");
+ ERR("failed to allocate memory.\n");
return NULL;
}
g_free(tizen_sdk_data);
- LOG("sdcard path: %s\n", emulator_sdcard_path);
+ TRACE("sdcard path: %s\n", emulator_sdcard_path);
return emulator_sdcard_path;
}
FILE *sdk_info_fp = NULL;
int sdk_info_path_len = 0;
- LOG("%s\n", __func__);
+ TRACE("%s\n", __func__);
emul_bin_path = get_bin_path();
if (!emul_bin_path) {
- LOG("failed to get emulator path.\n");
+ ERR("failed to get emulator path.\n");
return NULL;
}
sdk_info_path_len = strlen(emul_bin_path) + strlen(sdk_info) + 1;
sdk_info_file_path = g_malloc(sdk_info_path_len);
if (!sdk_info_file_path) {
- LOG("failed to allocate sdk-data buffer.\n");
+ ERR("failed to allocate sdk-data buffer.\n");
return NULL;
}
g_snprintf(sdk_info_file_path, sdk_info_path_len, "%s%s",
emul_bin_path, sdk_info);
- LOG("sdk.info path: %s\n", sdk_info_file_path);
+ INFO("sdk.info path: %s\n", sdk_info_file_path);
sdk_info_fp = fopen(sdk_info_file_path, "r");
g_free(sdk_info_file_path);
if (sdk_info_fp) {
- LOG("Succeeded to open [sdk.info].\n");
+ TRACE("Succeeded to open [sdk.info].\n");
char tmp[256] = { '\0', };
char *tmpline = NULL;
tizen_sdk_data_path = g_malloc(strlen(tmpline) + 1);
g_strlcpy(tizen_sdk_data_path, tmpline, strlen(tmpline) + 1);
- LOG("tizen-sdk-data path: %s\n", tizen_sdk_data_path);
+ INFO("tizen-sdk-data path: %s\n", tizen_sdk_data_path);
fclose(sdk_info_fp);
return tizen_sdk_data_path;
}
// legacy mode
- LOG("Failed to open [sdk.info].\n");
+ ERR("Failed to open [sdk.info].\n");
return get_old_tizen_sdk_data_path();
}
{
char *tizen_sdk_data_path = NULL;
- LOG("try to search tizen-sdk-data path in another way.\n");
+ INFO("try to search tizen-sdk-data path in another way.\n");
#ifndef CONFIG_WIN32
char tizen_sdk_data[] = "/tizen-sdk-data";
tizen_sdk_data_len = strlen(home_dir) + sizeof(tizen_sdk_data) + 1;
tizen_sdk_data_path = g_malloc(tizen_sdk_data_len);
if (!tizen_sdk_data_path) {
- LOG("failed to allocate memory.\n");
+ ERR("failed to allocate memory.\n");
return NULL;
}
g_strlcpy(tizen_sdk_data_path, home_dir, tizen_sdk_data_len);
tizen_sdk_data_len = strlen(strLocalAppDataPath) + sizeof(tizen_sdk_data) + 1;
tizen_sdk_data_path = g_malloc(tizen_sdk_data_len);
if (!tizen_sdk_data_path) {
- LOG("failed to allocate memory.\n");
+ ERR("failed to allocate memory.\n");
return NULL;
}
g_strlcat(tizen_sdk_data_path, tizen_sdk_data, tizen_sdk_data_len);
#endif
- LOG("tizen-sdk-data path: %s\n", tizen_sdk_data_path);
+ INFO("tizen-sdk-data path: %s\n", tizen_sdk_data_path);
return tizen_sdk_data_path;
}
void send_tethering_sensor_status_ecp(void)
{
- LOG(">> send tethering_event_status to ecp");
+ INFO(">> send tethering_event_status to ecp");
send_tethering_status_ntf(ECS_TETHERING_MSG_GROUP_ECP,
ECS_TETHERING_MSG_ACTION_SENSOR_STATUS);
}
void send_tethering_connection_status_ecp(void)
{
- LOG(">> send tethering_connection_status to ecp");
+ INFO(">> send tethering_connection_status to ecp");
send_tethering_status_ntf(ECS_TETHERING_MSG_GROUP_ECP,
ECS_TETHERING_MSG_ACTION_CONNECTION_STATUS);
}
return;
}
- LOG(">> send port_num: %d", tethering_port);
+ TRACE(">> send port_num: %d", tethering_port);
g_snprintf(data, sizeof(data) - 1, "%d", tethering_port);
length = strlen(data);
memcpy(msg + 13, &action, sizeof(unsigned char));
memcpy(msg + 14, data, length);
- LOG(">> send tethering_ntf to ecp. action=%d, group=%d, data=%s",
+ TRACE(">> send tethering_ntf to ecp. action=%d, group=%d, data=%s",
action, group, data);
// send_tethering_ntf((const char *)msg, MSG_BUF_SIZE);
memcpy(msg + 13, &action, sizeof(unsigned char));
memcpy(msg + 14, data, 1);
- LOG(">> send tethering_ntf to ecp. action=%d, group=%d, data=%s",
+ TRACE(">> send tethering_ntf to ecp. action=%d, group=%d, data=%s",
action, group, data);
// send_tethering_ntf((const char *)msg, MSG_BUF_SIZE);
const char* ijdata = (data + catsize + 2 + 1 + 1);
- LOG("<< header cat = %s, length = %d, action=%d, group=%d", cat, length,action, group);
+ TRACE("<< header cat = %s, length = %d, action=%d, group=%d", cat, length,action, group);
ECS__Master master = ECS__MASTER__INIT;
ECS__TetheringNtf ntf = ECS__TETHERING_NTF__INIT;
ntf.data.len = length;
memcpy(ntf.data.data, ijdata, length);
- LOG("data = %s, length = %hu", ijdata, length);
+ TRACE("data = %s, length = %hu", ijdata, length);
}
master.type = ECS__MASTER__TYPE__TETHERING_NTF;
type_group group = (type_group) (msg->group & 0xff);
type_action action = (type_action) (msg->action & 0xff);
- LOG(">> header = cmd = %s, length = %d, action=%d, group=%d",
+ TRACE(">> header = cmd = %s, length = %d, action=%d, group=%d",
cmd, length, action, group);
if (group == ECS_TETHERING_MSG_GROUP_ECP) {
port = g_ascii_strtoull(data, NULL, 10);
- LOG(">> MSG_ACTION_CONNECT");
- LOG(">> len = %zd, data\" %s\"", strlen(data), data);
+ TRACE(">> MSG_ACTION_CONNECT");
+ TRACE(">> len = %zd, data\" %s\"", strlen(data), data);
connect_tethering_app(port);
tethering_port = port;
- LOG(">> port_num: %d, %d", port, tethering_port);
+ TRACE(">> port_num: %d, %d", port, tethering_port);
}
}
break;
case ECS_TETHERING_MSG_ACTION_DISCONNECT:
- LOG(">> MSG_ACTION_DISCONNECT");
+ INFO(">> MSG_ACTION_DISCONNECT");
disconnect_tethering_app();
tethering_port = 0;
break;
case ECS_TETHERING_MSG_ACTION_CONNECTION_STATUS:
case ECS_TETHERING_MSG_ACTION_SENSOR_STATUS:
case ECS_TETHERING_MSG_ACTION_TOUCH_STATUS:
- LOG(">> get_status_action");
+ TRACE(">> get_status_action");
send_tethering_status_ntf(group, action);
break;
default: