#include <string.h>
#include <errno.h>
-//#define TRACE_TAG TRACE_APPCMD
-#define LOG_TAG "SDBD_TRACE_APPCMD"
+#define TRACE_TAG TRACE_APPCMD
#include "sysdeps.h"
#include "sdb.h"
int len = sizeof(p_info->shell_cmd);
if (p_info->args_cnt != 5) {
- E("failed to parse appcmd.(cnt=%zu)\n", p_info->args_cnt);
+ D("failed to parse appcmd.(cnt=%zu)\n", p_info->args_cnt);
return -1;
}
int len = sizeof(p_info->shell_cmd);
if (p_info->args_cnt != 2) {
- E("failed to parse appcmd.(cnt=%zu)\n", p_info->args_cnt);
+ D("failed to parse appcmd.(cnt=%zu)\n", p_info->args_cnt);
return -1;
}
int len = sizeof(p_info->shell_cmd);
if (p_info->args_cnt != 2) {
- E("failed to parse appcmd.(cnt=%zu)\n", p_info->args_cnt);
+ D("failed to parse appcmd.(cnt=%zu)\n", p_info->args_cnt);
return -1;
}
p_service = strtok_r(p_info->raw_command, ":", &ptr);
p_appid = strtok_r(NULL, ":", &ptr);
if (p_service == NULL || p_appid == NULL) {
- E("failed to parse appcmd.(cnt=%zu)\n", p_info->args_cnt);
+ D("failed to parse appcmd.(cnt=%zu)\n", p_info->args_cnt);
return -1;
}
int len = sizeof(p_info->shell_cmd);
if (p_info->args_cnt != 2) {
- E("failed to parse appcmd.(cnt=%zu)\n", p_info->args_cnt);
+ D("failed to parse appcmd.(cnt=%zu)\n", p_info->args_cnt);
return -1;
}
int len = sizeof(p_info->shell_cmd);
if (p_info->args_cnt != 2) {
- E("failed to parse appcmd.(cnt=%zu)\n", p_info->args_cnt);
+ D("failed to parse appcmd.(cnt=%zu)\n", p_info->args_cnt);
return -1;
}
int len = sizeof(p_info->shell_cmd);
if (p_info->args_cnt != 2) {
- E("failed to parse appcmd.(cnt=%zu)\n", p_info->args_cnt);
+ D("failed to parse appcmd.(cnt=%zu)\n", p_info->args_cnt);
return -1;
}
int len = sizeof(p_info->shell_cmd);
if (p_info->args_cnt != 5) {
- E("failed to parse appcmd.(cnt=%zu)\n", p_info->args_cnt);
+ D("failed to parse appcmd.(cnt=%zu)\n", p_info->args_cnt);
return -1;
}
int len = sizeof(p_info->shell_cmd);
if (p_info->args_cnt != 2) {
- E("failed to parse appcmd.(cnt=%zu)\n", p_info->args_cnt);
+ D("failed to parse appcmd.(cnt=%zu)\n", p_info->args_cnt);
return -1;
}
ptm_fd = create_subprocess(SHELL_COMMAND, &pid, (char * const*)args, (char * const*)envp);
if (ptm_fd < 0) {
- E("cannot create service thread\n");
+ D("cannot create service thread\n");
return -1;
}
D("create_subprocess() ptm_fd=%d pid=%d\n", ptm_fd, pid);
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret < 0) {
- E("failed to get pkginfo handle.\n");
+ D("failed to get pkginfo handle.\n");
return -1;
}
ret = pkgmgrinfo_pkginfo_get_mainappid(handle, &pkgname);
if (ret < 0) {
- E("failed to get pkg name\n");
+ D("failed to get pkg name\n");
return -1;
}
ret = pkgmgrinfo_pkginfo_get_type(handle, &type);
if (ret < 0) {
- E("failed to get pkg type.\n");
+ D("failed to get pkg type.\n");
return -1;
}
ret = pkgmgrinfo_pkginfo_is_removable(handle, &is_removable);
if (ret < 0) {
- E("failed to get removable info.\n");
+ D("failed to get removable info.\n");
return -1;
}
pc = pkgmgr_client_new(PC_REQUEST);
if (pc == NULL) {
- E("failed to create pkgmgr client.\n");
+ D("failed to create pkgmgr client.\n");
return -1;
}
ret = pkgmgr_client_request_service(PM_REQUEST_CHECK_APP, 0, pc, NULL, pkgid, NULL, NULL, &pid);
if (ret < 0) {
- E("failed to get running state.\n");
+ D("failed to get running state.\n");
return -1;
}
is_running = ((pid > 0) ? 1:0);
p_info->exitcode = -1;
if (p_info->args_cnt != 3) {
- E("failed to parse appcmd.(cnt=%zu)\n", p_info->args_cnt);
+ D("failed to parse appcmd.(cnt=%zu)\n", p_info->args_cnt);
return;
}
snprintf(result_buf, sizeof(result_buf), "\n%s:%s\n", MESSAGE_PREFIX_APPCMD_RETURN, pkginfo_buf);
writex(p_info->fd, result_buf, strlen(result_buf));
} else {
- E("failed to get pkginfo.\n");
+ D("failed to get pkginfo.\n");
}
free(type);
int len = sizeof(p_info->shell_cmd);
if (p_info->args_cnt != 2) {
- E("failed to parse appcmd.(cnt=%zu)\n", p_info->args_cnt);
+ D("failed to parse appcmd.(cnt=%zu)\n", p_info->args_cnt);
return -1;
}
snprintf(result_buf, sizeof(result_buf), "\n%s:%s\n", MESSAGE_PREFIX_APPCMD_RETURN, path);
writex(p_info->fd, result_buf, strlen(result_buf));
} else {
- E("failed to get application install path from tzplatform_getenv.");
+ D("failed to get application install path from tzplatform_getenv.");
}
}
int ret = -1;
if (p_info == NULL) {
- E("Invalid arguments. p_info is null\n");
+ D("Invalid arguments. p_info is null\n");
return;
}
if (p_info->gen_cmd_func == NULL) {
- E("Invalid arguments.\n");
+ D("Invalid arguments.\n");
p_info->exitcode = -1;
return;
}
ret = p_info->gen_cmd_func(p_info);
if (ret < 0) {
- E("failed to generate install shell command.\n");
+ D("failed to generate install shell command.\n");
p_info->exitcode = -1;
} else {
ret = exec_appcmd_shell_process(p_info);
D("exec_appcmd_shell_process: ret=%d, exitcode=%d\n", ret, p_info->exitcode);
if (ret < 0) {
- E("failed to run shell process\n");
+ D("failed to run shell process\n");
p_info->exitcode = -1;
}
}
info.args_cnt = tokenize(command, ":", info.args, MAX_TOKENS);
D("args_cnt=%zu\n", info.args_cnt);
if (info.args_cnt < 1) {
- E("failed to parse appcmd for install. (%s)\n", command);
+ D("failed to parse appcmd for install. (%s)\n", command);
info.exitcode = -1;
goto appcmd_done;
}
info.gen_cmd_func = appcmd_debugnativeapp_gen_shellcmd;
run_appcmd_with_shell_process(&info);
} else {
- E("not supported appcmd service. (%s)\n", service_name);
+ D("not supported appcmd service. (%s)\n", service_name);
info.exitcode = -1;
goto appcmd_done;
}
#include <stdlib.h>
-//#define TRACE_TAG TRACE_SDB
-#define LOG_TAG "SDBD_TRACE_SDB"
+#define TRACE_TAG TRACE_SDB
#include "log.h"
#include "parameter.h"
int auth_support ( parameters* in, parameters* out )
{
if ( out == NULL ) {
- E ( "Invalid argument\n" );
+ D ( "Invalid argument\n" );
return PLUGIN_CMD_FAIL;
}
out->number_of_parameter = 1;
out->array_of_parameter = ( parameter* ) malloc ( sizeof ( parameter ) );
if (out->array_of_parameter == NULL) {
- E("failed to allocate memory for the parameter\n");
+ D("failed to allocate memory for the parameter\n");
return PLUGIN_CMD_FAIL;
}
out->array_of_parameter[0].type = type_int32;
#include <tzplatform_config.h>
-//#define TRACE_TAG TRACE_SDB
-#define LOG_TAG "SDBD_TRACE_SDB"
+#define TRACE_TAG TRACE_SDB
#include "log.h"
#include "sdb.h"
if ( in == NULL || in->number_of_parameter != 1 || in->array_of_parameter == NULL
|| in->array_of_parameter[0].type != type_int32 ) {
- E ( "Invalid argument\n" );
+ D ( "Invalid argument\n" );
return PLUGIN_CMD_FAIL;
}
if ( out == NULL ) {
- E ( "Invalid argument\n" );
+ D ( "Invalid argument\n" );
return PLUGIN_CMD_FAIL;
}
out->number_of_parameter = 1;
out->array_of_parameter = ( parameter* ) malloc ( sizeof ( parameter ) );
if (out->array_of_parameter == NULL) {
- E("failed to allocate memory for the parameter\n");
+ D("failed to allocate memory for the parameter\n");
return PLUGIN_CMD_FAIL;
}
{
if ( in == NULL || in->number_of_parameter != 1 || in->array_of_parameter == NULL
|| in->array_of_parameter[0].type != type_string ) {
- E ( "Invalid argument\n" );
+ D ( "Invalid argument\n" );
return PLUGIN_CMD_FAIL;
}
if ( out == NULL ) {
- E ( "Invalid argument\n" );
+ D ( "Invalid argument\n" );
return PLUGIN_CMD_FAIL;
}
out->number_of_parameter = 1;
out->array_of_parameter = ( parameter* ) malloc ( sizeof ( parameter ) );
if (out->array_of_parameter == NULL) {
- E("failed to allocate memory for the parameter\n");
+ D("failed to allocate memory for the parameter\n");
return PLUGIN_CMD_FAIL;
}
out->array_of_parameter[0].type = type_int32;
{
if ( in == NULL || in->number_of_parameter != 1 || in->array_of_parameter == NULL
|| in->array_of_parameter[0].type != type_string ) {
- E ( "Invalid argument\n" );
+ D ( "Invalid argument\n" );
return PLUGIN_CMD_FAIL;
}
if ( out == NULL ) {
- E ( "Invalid argument\n" );
+ D ( "Invalid argument\n" );
return PLUGIN_CMD_FAIL;
}
out->number_of_parameter = 1;
out->array_of_parameter = ( parameter* ) malloc ( sizeof ( parameter ) );
if (out->array_of_parameter == NULL) {
- E("failed to allocate memory for the parameter\n");
+ D("failed to allocate memory for the parameter\n");
return PLUGIN_CMD_FAIL;
}
{
if ( in == NULL || in->number_of_parameter != 1 || in->array_of_parameter == NULL
|| in->array_of_parameter[0].type != type_string ) {
- E ( "Invalid argument\n" );
+ D ( "Invalid argument\n" );
return PLUGIN_CMD_FAIL;
}
if ( out == NULL ) {
- E ( "Invalid argument\n" );
+ D ( "Invalid argument\n" );
return PLUGIN_CMD_FAIL;
}
out->number_of_parameter = 1;
out->array_of_parameter = ( parameter* ) malloc ( sizeof ( parameter ) );
if (out->array_of_parameter == NULL) {
- E("failed to allocate memory for the parameter\n");
+ D("failed to allocate memory for the parameter\n");
return PLUGIN_CMD_FAIL;
}
out->array_of_parameter[0].type = type_int32;
int verify_sdbd_launch ( parameters* in, parameters* out )
{
if ( out == NULL ) {
- E ( "Invalid argument\n" );
+ D ( "Invalid argument\n" );
return PLUGIN_CMD_FAIL;
}
out->number_of_parameter = 1;
out->array_of_parameter = ( parameter* ) malloc ( sizeof ( parameter ) );
if (out->array_of_parameter == NULL) {
- E("failed to allocate memory for the parameter\n");
+ D("failed to allocate memory for the parameter\n");
return PLUGIN_CMD_FAIL;
}
out->array_of_parameter[0].type = type_int32;
{
if ( in == NULL || in->number_of_parameter != 1 || in->array_of_parameter == NULL
|| in->array_of_parameter[0].type != type_string ) {
- E ( "Invalid argument\n" );
+ D ( "Invalid argument\n" );
return PLUGIN_CMD_FAIL;
}
if ( out == NULL ) {
- E ( "Invalid argument\n" );
+ D ( "Invalid argument\n" );
return PLUGIN_CMD_FAIL;
}
out->number_of_parameter = 1;
out->array_of_parameter = ( parameter* ) malloc ( sizeof ( parameter ) );
if (out->array_of_parameter == NULL) {
- E("failed to allocate memory for the parameter\n");
+ D("failed to allocate memory for the parameter\n");
return PLUGIN_CMD_FAIL;
}
out->array_of_parameter[0].type = type_int32;
int get_shell_env ( parameters* in, parameters* out )
{
if ( out == NULL ) {
- E ( "Invalid argument\n" );
+ D ( "Invalid argument\n" );
return PLUGIN_CMD_FAIL;
}
out->number_of_parameter = 1;
out->array_of_parameter = ( parameter* ) malloc ( sizeof ( parameter ) );
if (out->array_of_parameter == NULL) {
- E("failed to allocate memory for the parameter\n");
+ D("failed to allocate memory for the parameter\n");
return PLUGIN_CMD_FAIL;
}
{
if ( in == NULL || in->number_of_parameter != 1 || in->array_of_parameter == NULL
|| in->array_of_parameter[0].type != type_string ) {
- E ( "Invalid argument\n" );
+ D ( "Invalid argument\n" );
return PLUGIN_CMD_FAIL;
}
if ( out == NULL ) {
- E ( "Invalid argument\n" );
+ D ( "Invalid argument\n" );
return PLUGIN_CMD_FAIL;
}
out->number_of_parameter = 1;
out->array_of_parameter = ( parameter* ) malloc ( sizeof ( parameter ) );
if (out->array_of_parameter == NULL) {
- E("failed to allocate memory for the parameter\n");
+ D("failed to allocate memory for the parameter\n");
return PLUGIN_CMD_FAIL;
}
out->array_of_parameter[0].type = type_int32;
#include <linux/usb/ch9.h>
#include <linux/usb/functionfs.h>
-//#define TRACE_TAG TRACE_USB
-#define LOG_TAG "SDBD_TRACE_USB"
+#define TRACE_TAG TRACE_USB
#define MAX_PACKET_SIZE_FS 64
#define MAX_PACKET_SIZE_HS 512
#include <sys/smack.h>
#include <tzplatform_config.h>
-//#define TRACE_TAG TRACE_SYNC
-#define LOG_TAG "SDBD_TRACE_SYNC"
+#define TRACE_TAG TRACE_SYNC
#include "log.h"
#include "sdb.h"
sync_send_label_notify(noti_fd, name, 1);
}
if((ret < 0) && (errno != EEXIST)) {
- E("mkdir(\"%s\") -> errno:%d\n", name, errno);
+ D("mkdir(\"%s\") -> errno:%d\n", name, errno);
*x = '/';
return ret;
}
d = opendir(path);
if(d == NULL) {
- E("failed to open dir due to: errno:%d\n", errno);
+ D("failed to open dir due to: errno:%d\n", errno);
goto done;
}
syncmsg msg;
size_t len = strlen(reason);
- E("sync: failure: %s\n", reason);
+ D("sync: failure: %s\n", reason);
msg.data.id = ID_FAIL;
msg.data.size = htoll(len);
static void sync_mediadb(char *path) {
if (access(CMD_MEDIADB_UPDATE, F_OK) != 0) {
- E("%s: command not found\n", CMD_MEDIADB_UPDATE);
+ D("%s: command not found\n", CMD_MEDIADB_UPDATE);
return;
}
goto fail;
}
if(readx(s, buffer, len)) {
- E("read failed due to unknown reason\n");
+ D("read failed due to unknown reason\n");
goto fail;
}
// flush file system buffers due to N_SE-22305
sync();
} else {
- E("sync error: %d!!!\n", fd);
+ D("sync error: %d!!!\n", fd);
return -1;
}
sync_send_label_notify(noti_fd, path, 1);
int s[2];
if(sdb_socketpair(s)) {
- E("cannot create service socket pair\n");
+ D("cannot create service socket pair\n");
exit(-1);
}
rv = select(fd + 1, &set, NULL, NULL, &timeout);
if (rv == -1) {
- E("sync file descriptor select failed\n");
+ D("sync file descriptor select failed\n");
} else if (rv == 0) {
D("sync file descriptor timeout: (took %d sec over)\n", SYNC_TIMEOUT);
fail_message(fd, "sync timeout");
sdb_close(s[1]);
}
- I("sync: done\n");
+ D("sync: done\n");
sync_send_label_notify(s[0], name, 0);
sdb_close(s[0]);
sdb_close(fd);
#define __LOG_H
#include <errno.h>
-#include <dlog.h>
#include "sysdeps.h"
extern unsigned char sdb_trace_output_count;
void sdb_trace_init(void);
-//# define SDB_TRACING ((sdb_trace_mask & (1 << TRACE_TAG)) != 0)
+# define SDB_TRACING ((sdb_trace_mask & (1 << TRACE_TAG)) != 0)
/* you must define TRACE_TAG before using this macro */
-
-#define D(fmt, arg...) SECURE_SLOGD(fmt, ##arg)
-#define I(fmt, arg...) SECURE_SLOGI(fmt, ##arg)
-#define E(fmt, arg...) SECURE_SLOGE(fmt, ##arg)
-/*# define D(...) \
+# define D(...) \
do { \
if (SDB_TRACING) { \
sdb_mutex_lock(&D_lock); \
errno = save_errno; \
sdb_mutex_unlock(&D_lock); \
} \
- } while (0)*/
+ } while (0)
#else
# define D(...) ((void)0)
# define DR(...) ((void)0)
#include <string.h>
#include <dlfcn.h>
-//#define TRACE_TAG TRACE_SDB
-#define LOG_TAG "SDBD_TRACE_SDB"
+#define TRACE_TAG TRACE_SDB
#include "log.h"
#include "sdb.h"
int ret = hashtable_put ( plugin_cmd_hashtable, command, cmd_priority );
D ("register plugin command : cmd(%d), result(%d)\n", command, ret);
} else {
- I ("hashtable is not created\n");
+ D ("hashtable is not created\n");
}
return 0;
}
g_plugin_handle = dlopen ( PLUGIN_PATH, RTLD_NOW );
if ( g_plugin_handle == NULL ) {
- E ( "failed to dlopen(%s). error: %s\n", PLUGIN_PATH, dlerror() );
+ D ( "failed to dlopen(%s). error: %s\n", PLUGIN_PATH, dlerror() );
return 0;
}
plugin_init_proc = dlsym ( g_plugin_handle, PLUGIN_PROC_NAME_INIT );
if ( plugin_init_proc == NULL ) {
- E ( "failed to get the sdbd plugin init function. error: %s\n", dlerror() );
+ D ( "failed to get the sdbd plugin init function. error: %s\n", dlerror() );
dlclose ( g_plugin_handle );
g_plugin_handle = NULL;
return 0;
plugin_sync_proc = default_plugin_sync_proc;
plugin_async_proc = default_plugin_async_proc;
- I ( "using default plugin interface.\n" );
+ D ( "using default plugin interface.\n" );
} else {
D ( "using sdbd plugin interface.(%s)\n", PLUGIN_PATH );
if (sdb_socketpair(s)) {
release_parameters(in);
free(in);
- E("cannot create async proc socket pair\n");
+ D("cannot create async proc socket pair\n");
return -1;
}
sdb_close(s[1]);
release_parameters(in);
free(in);
- E("cannot create async proc thread\n");
+ D("cannot create async proc thread\n");
return -1;
}
in.number_of_parameter = 1;
in.array_of_parameter = ( parameter* ) malloc ( sizeof ( parameter ) );
if (in.array_of_parameter == NULL) {
- E("failed to allocate memory for the parameter\n");
+ D("failed to allocate memory for the parameter\n");
return success;
}
in.array_of_parameter[0].type = type_int32;
in.number_of_parameter = 1;
in.array_of_parameter = ( parameter* ) malloc ( sizeof ( parameter ) );
if (in.array_of_parameter == NULL) {
- E("failed to allocate memory for the parameter\n");
+ D("failed to allocate memory for the parameter\n");
return success;
}
in.array_of_parameter[0].type = type_string;
in.number_of_parameter = 1;
in.array_of_parameter = ( parameter* ) malloc ( sizeof ( parameter ) );
if (in.array_of_parameter == NULL) {
- E("failed to allocate memory for the parameter\n");
+ D("failed to allocate memory for the parameter\n");
return result;
}
in.array_of_parameter[0].type = type_int32;
in = (parameters*)malloc(sizeof(parameters));
if (in == NULL) {
- E("failed to allocate memory for the parameters\n");
+ D("failed to allocate memory for the parameters\n");
return -1;
}
in->array_of_parameter = ( parameter* ) malloc ( sizeof ( parameter ) );
if (in->array_of_parameter == NULL) {
free(in);
- E("failed to allocate memory for the parameter\n");
+ D("failed to allocate memory for the parameter\n");
return -1;
}
in->array_of_parameter[0].type = type_string;
//#define LOG_TAG "SDBD"
//#include <dlog.h>
-//#define TRACE_TAG TRACE_SDB
-#define LOG_TAG "SDBD_TRACE_SDB"
+#define TRACE_TAG TRACE_SDB
#include "log.h"
#include "plugin.h"
in.number_of_parameter = 1;
in.array_of_parameter = ( parameter* ) malloc ( sizeof (parameter) );
if (in.array_of_parameter == NULL) {
- E("failed to allocate memory for the parameter\n");
+ D("failed to allocate memory for the parameter\n");
return success;
}
in.array_of_parameter[0].type = type_int32;
in.number_of_parameter = 2;
in.array_of_parameter = ( parameter* ) malloc ( sizeof (parameter) * in.number_of_parameter );
if (in.array_of_parameter == NULL) {
- E("failed to allocate memory for the parameter\n");
+ D("failed to allocate memory for the parameter\n");
return success;
}
in.array_of_parameter[0].type = type_int32;
in.number_of_parameter = 1;
in.array_of_parameter = ( parameter* ) malloc ( sizeof (parameter) );
if (in.array_of_parameter == NULL) {
- E("failed to allocate memory for the parameter\n");
+ D("failed to allocate memory for the parameter\n");
return success;
}
in.array_of_parameter[0].type = type_int32;
in.number_of_parameter = 2;
in.array_of_parameter = ( parameter* ) malloc ( sizeof (parameter) * in.number_of_parameter );
if (in.array_of_parameter == NULL) {
- E("failed to allocate memory for the parameter\n");
+ D("failed to allocate memory for the parameter\n");
return success;
}
in.array_of_parameter[0].type = type_int32;
in.number_of_parameter = 1;
in.array_of_parameter = ( parameter* ) malloc ( sizeof (parameter) );
if (in.array_of_parameter == NULL) {
- E("failed to allocate memory for the parameter\n");
+ D("failed to allocate memory for the parameter\n");
return success;
}
in.array_of_parameter[0].type = type_int32;
in.number_of_parameter = 2;
in.array_of_parameter = ( parameter* ) malloc ( sizeof (parameter) * in.number_of_parameter );
if (in.array_of_parameter == NULL) {
- E("failed to allocate memory for the parameter\n");
+ D("failed to allocate memory for the parameter\n");
return success;
}
in.array_of_parameter[0].type = type_int32;
in.number_of_parameter = 2;
in.array_of_parameter = ( parameter* ) malloc ( sizeof (parameter) * in.number_of_parameter );
if (in.array_of_parameter == NULL) {
- E("failed to allocate memory for the parameter\n");
+ D("failed to allocate memory for the parameter\n");
return success;
}
in.array_of_parameter[0].type = type_int32;
* limitations under the License.
*/
-//#define TRACE_TAG TRACE_SDB
-#define LOG_TAG "SDBD_TRACE_SDB"
+#define TRACE_TAG TRACE_SDB
#include <stdio.h>
#include <stdlib.h>
int ret;
ret = system_info_get_platform_bool("tizen.org/feature/container", &value);
if (ret != SYSTEM_INFO_ERROR_NONE) {
- E("failed to get container information: %d\n", errno);
+ D("failed to get container information: %d\n", errno);
return 0;
} else {
D("tizen container: %d\n", value);
fd = unix_open(SDB_LOGCONF_PATH, O_RDONLY);
if (fd < 0) {
- E("failed to open '%s' file: %d\n", SDB_LOGCONF_PATH, errno);
+ D("failed to open '%s' file: %d\n", SDB_LOGCONF_PATH, errno);
return NULL;
}
void handle_online(void)
{
- I("sdb: online\n");
+ D("sdb: online\n");
}
void handle_offline(atransport *t)
{
- I("sdb: offline\n");
+ D("sdb: offline\n");
//Close the associated usb
run_transport_disconnects(t);
}
t->sessionID = sessionID;
if((retVal = security_init(t->sessionID, NULL)) == 1){ // 암호화 handshaking을 위한 init
if(security_parse_server_hello(t->sessionID, p) == 1){ // hello 메시지 파싱
- I("security_parse_server_hello success\n");
+ D("security_parse_server_hello success\n");
enc_p = get_apacket();
if(security_gen_client_hello(t->sessionID, enc_p) == 1){ // hello 메시지 생성
- I("security_gen_client_hello success\n");
+ D("security_gen_client_hello success\n");
enc_p->msg.command = A_ENCR;
enc_p->msg.arg0 = ENCR_SET_ON_REQ;
enc_p->msg.arg1 = p->msg.arg1;
send_packet(enc_p, t);
}
else { // hello 메시지 생성 실패
- E("security_gen_client_hello error\n");
+ D("security_gen_client_hello error\n");
send_encr_fail(p, t, ENCR_ON_FAIL); // 암호화 on 실패 메시지 전송
t->encryption = ENCR_OFF; // 암호화 모드는 off
security_deinit(t->sessionID);
}
}
else{ // hello 메시지 파싱 실패
- E("security_parse_server_hello error\n");
+ D("security_parse_server_hello error\n");
send_encr_fail(p, t, ENCR_ON_FAIL);
t->encryption = ENCR_OFF;
security_deinit(t->sessionID);
return -1;
}
} else { // init 실패
- E("security_init error\n");
+ D("security_init error\n");
send_encr_fail(p, t, ENCR_ON_FAIL);
t->encryption = ENCR_OFF;
if (retVal == 0)
if(security_parse_server_ack(t->sessionID, p) == 1){ // ack 메시지 파싱
enc_p = get_apacket();
if(security_gen_client_ack(t->sessionID, enc_p) == 1){ // ack 메시지 생성
- I("security_gen_client_ack success\n");
+ D("security_gen_client_ack success\n");
enc_p->msg.command = A_ENCR;
enc_p->msg.arg0 = ENCR_SET_ON_OK;
enc_p->msg.arg1 = p->msg.arg1;
send_packet(enc_p, t);
}
else { // ack 메시지 생성에 실패한 경우
- E("security_gen_client_ack error\n");
+ D("security_gen_client_ack error\n");
send_encr_fail(p, t, ENCR_ON_FAIL);
t->encryption = ENCR_OFF;
security_deinit(t->sessionID);
}
}
else { // ack 메시지 파싱에 실패한 경우
- E("security_parse_server_ack error\n");
+ D("security_parse_server_ack error\n");
send_encr_fail(p, t, ENCR_ON_FAIL);
t->encryption = ENCR_OFF;
security_deinit(t->sessionID);
send_packet(enc_p, t);
}
else { // 암호화 모드 off에 실패한 경우
- E("security_deinit error\n");
+ D("security_deinit error\n");
send_encr_fail(p, t, ENCR_OFF_FAIL); // 암호화 모드 off 실패 메시지 전송
return -1;
}
else if (p->msg.arg0 == ENCR_ON_FAIL) // 암호화 모드를 on 하는 도중 실패한 경우 받는 메시지
{
t->encryption = ENCR_OFF; // 암호화 모드를 다시 off
- E("encryption on failed\n");
+ D("encryption on failed\n");
}
else if (p->msg.arg0 == ENCR_OFF_FAIL) // 암호화 모드를 off하는 도중 실패한 경우 받는 메시지
{
//t->encryption = ENCR_ON;
- E("encryption off failed\n");
+ D("encryption off failed\n");
}
//put_apacket(enc_p);
return 0;
static void send_ready(unsigned local, unsigned remote, atransport *t)
{
- I("Calling send_ready \n");
+ D("Calling send_ready \n");
apacket *p = get_apacket();
p->msg.command = A_OKAY;
p->msg.arg0 = local;
static void send_close(unsigned local, unsigned remote, atransport *t)
{
- I("Calling send_close \n");
+ D("Calling send_close \n");
apacket *p = get_apacket();
p->msg.command = A_CLSE;
p->msg.arg0 = local;
static void send_connect(atransport *t)
{
- I("Calling send_connect \n");
+ D("Calling send_connect \n");
apacket *cp = get_apacket();
cp->msg.command = A_CNXN;
cp->msg.arg0 = A_VERSION;
void send_device_status()
{
- I("broadcast device status\n");
+ D("broadcast device status\n");
apacket* cp = get_apacket();
cp->msg.command = A_STAT;
cp->msg.arg0 = is_pwlocked;
int len = e-s-strlen(dest);
if (len >= str_size) {
- E("buffer size(%d) should be bigger than %d\n", str_size, len+1);
+ D("buffer size(%d) should be bigger than %d\n", str_size, len+1);
return -1;
}
char *value = NULL;
int r = system_info_get_platform_string("http://tizen.org/system/model_name", &value);
if (r != SYSTEM_INFO_ERROR_NONE) {
- E("fail to get system model:%d\n", errno);
+ D("fail to get system model:%d\n", errno);
return -1;
} else {
s_strncpy(str, value, str_size);
int fd = unix_open(PROC_CMDLINE_PATH, O_RDONLY);
if (fd < 0) {
- E("fail to read /proc/cmdline\n");
+ D("fail to read /proc/cmdline\n");
return -1;
}
if(read_line(fd, cmdline, sizeof(cmdline))) {
D("qemu cmd: %s\n", cmdline);
if (get_str_cmdline(cmdline, split, str, str_size) < 1) {
- E("could not get the (%s) value from cmdline\n", split);
+ D("could not get the (%s) value from cmdline\n", split);
sdb_close(fd);
return -1;
}
s = socket(AF_INET, SOCK_DGRAM, 0);
if(s < 0) {
- E("socket error\n");
+ D("socket error\n");
return -1;
}
snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s", GUEST_IP_INTERFACE);
if(ioctl(s, SIOCGIFHWADDR, &ifr) < 0) {
- E("ioctl hwaddr error\n");
+ D("ioctl hwaddr error\n");
sdb_close(s);
return -1;
}
if(ioctl(s, SIOCGIFADDR, &ifr) < 0) {
- E("ioctl addr error\n");
+ D("ioctl addr error\n");
sdb_close(s);
return -1;
}
}
if(!strcmp(type, "bootloader")){
- I("setting connection_state to CS_BOOTLOADER\n");
+ D("setting connection_state to CS_BOOTLOADER\n");
t->connection_state = CS_BOOTLOADER;
update_transports();
return;
}
if(!strcmp(type, "device")) {
- I("setting connection_state to CS_DEVICE\n");
+ D("setting connection_state to CS_DEVICE\n");
t->connection_state = CS_DEVICE;
update_transports();
return;
}
if(!strcmp(type, "recovery")) {
- I("setting connection_state to CS_RECOVERY\n");
+ D("setting connection_state to CS_RECOVERY\n");
t->connection_state = CS_RECOVERY;
update_transports();
return;
}
if(!strcmp(type, "sideload")) {
- I("setting connection_state to CS_SIDELOAD\n");
+ D("setting connection_state to CS_SIDELOAD\n");
t->connection_state = CS_SIDELOAD;
update_transports();
return;
asocket *s;
-// D("handle_packet() %c%c%c%c\n", ((char*) (&(p->msg.command)))[0],
-// ((char*) (&(p->msg.command)))[1],
-// ((char*) (&(p->msg.command)))[2],
-// ((char*) (&(p->msg.command)))[3]);
+ D("handle_packet() %c%c%c%c\n", ((char*) (&(p->msg.command)))[0],
+ ((char*) (&(p->msg.command)))[1],
+ ((char*) (&(p->msg.command)))[2],
+ ((char*) (&(p->msg.command)))[3]);
print_packet("recv", p);
case A_OPEN: /* OPEN(local-id, 0, "destination") */
if (request_lock_state_to_plugin(LOCKTYPE_PASSWORD) == 1 && t->connection_state == CS_PWLOCK) {
// in case of already locked before get A_CNXN
- E("open failed due to password locked before get A_CNXN:%d\n", t->connection_state);
+ D("open failed due to password locked before get A_CNXN:%d\n", t->connection_state);
send_close(0, p->msg.arg0, t);
} else {
if(t->connection_state != CS_OFFLINE) {
p->len = p->msg.data_length;
if(s->enqueue(s, p) == 0) {
- I("Enqueue the socket\n");
+ D("Enqueue the socket\n");
send_ready(s->id, rid, t);
}
return;
}
if (close_on_exec(l->fd) < 0) {
- E("fail to close fd exec:%d\n",l->fd);
+ D("fail to close fd exec:%d\n",l->fd);
}
if(!strcmp(l->connect_to, "*smartsocket*")) {
fdevent_install(&l->fde, l->fd, ss_listener_event_func, l);
booting_done = 1;
if (access(SDBD_BOOT_INFO_FILE, F_OK) == 0) {
- I("booting is already done\n");
+ D("booting is already done\n");
} else {
FILE *info_file = fopen(SDBD_BOOT_INFO_FILE, "w");
if (info_file != NULL) {
fprintf(info_file, "%d", 1);
fclose(info_file);
}
- I("booting is done\n");
+ D("booting is done\n");
}
- I("handled the booting done signal\n");
+ D("handled the booting done signal\n");
g_main_loop_quit(g_mainloop);
}
connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
if (connection == NULL) {
if (error != NULL) {
- E("failed to connect to the system bus: %s\n", error->message);
+ D("failed to connect to the system bus: %s\n", error->message);
g_error_free(error);
} else {
- E("failed to connect to the system bus\n");
+ D("failed to connect to the system bus\n");
}
return NULL;
}
g_mainloop = g_main_loop_new(NULL, false);
if (g_mainloop == NULL) {
- E("failed to create a g_main_loop\n");
+ D("failed to create a g_main_loop\n");
goto bootdone_out;
}
DEVICED_CORE_PATH, NULL, G_DBUS_SIGNAL_FLAGS_NONE,
booting_done_signal_subscriber, NULL, NULL);
if (id == 0) {
- E("failed to subscribe to the booting done signal\n");
+ D("failed to subscribe to the booting done signal\n");
goto bootdone_out;
}
- I("wait for the booting done signal\n");
+ D("wait for the booting done signal\n");
g_main_loop_run(g_mainloop);
g_dbus_connection_signal_unsubscribe(connection, id);
if (connection != NULL) {
g_object_unref(connection);
}
- I("exit the bootdone_cb thread\n");
+ D("exit the bootdone_cb thread\n");
return NULL;
}
{
sdb_thread_t t;
if (sdb_thread_create(&t, bootdone_cb, NULL)) {
- E("can not create a service thread to check the booting done\n");
+ D("can not create a service thread to check the booting done\n");
return;
}
- I("created the bootdone_cb thread\n");
+ D("created the bootdone_cb thread\n");
}
static int sdbd_set_groups(const char *name, int gid, struct group_info default_groups[], int default_groups_size) {
}
group_ids = malloc((ngroups + default_groups_size) * sizeof(gid_t));
if (group_ids == NULL) {
- E("failed to allocate group_ids(%zu)\n", (ngroups + default_groups_size) * sizeof(gid_t));
+ D("failed to allocate group_ids(%zu)\n", (ngroups + default_groups_size) * sizeof(gid_t));
return -1;
}
if (getgrouplist(name, gid, group_ids, &ngroups) == -1) {
- E("failed to getgrouplist(), ngroups = %d\n", ngroups);
+ D("failed to getgrouplist(), ngroups = %d\n", ngroups);
free(group_ids);
return -1;
}
}
}
if (setgroups(ngroups+added_group_cnt, group_ids) != 0) {
- E("failed to setgroups().\n");
+ D("failed to setgroups().\n");
free(group_ids);
return -1;
}
ret = getpwnam_r(user_name, pwd, buf, bufsize, &result);
if (result == NULL) {
if (ret == 0) {
- E("Not found passwd : username(%s)\n", user_name);
+ D("Not found passwd : username(%s)\n", user_name);
} else {
errno = ret;
- E("failed to getpwnam_r\n");
+ D("failed to getpwnam_r\n");
}
return -1;
}
ret = getgrnam_r(group_name, grp, buf, bufsize, &result);
if (result == NULL) {
if (ret == 0) {
- E("Not found group : groupname(%s)\n", group_name);
+ D("Not found group : groupname(%s)\n", group_name);
} else {
errno = ret;
- E("failed to getgrnam_r\n");
+ D("failed to getgrnam_r\n");
}
return -1;
}
int set_sdk_user_privileges(int is_drop_capability_after_fork) {
if (!is_init_sdk_userinfo) {
- E("failed to init sdk user information.\n");
+ D("failed to init sdk user information.\n");
return -1;
}
if(is_drop_capability_after_fork) {
if (setuid(g_root_user_id) != 0) {
- E("set root user id failed (errno: %d)\n", errno);
+ D("set root user id failed (errno: %d)\n", errno);
return -1;
}
}
if (sdbd_set_groups(SDK_USER_NAME, g_sdk_group_id, g_default_groups, SDB_DEFAULT_GROUPS_CNT) < 0) {
- E("set groups failed (errno: %d)\n", errno);
+ D("set groups failed (errno: %d)\n", errno);
return -1;
}
if (setgid(g_sdk_group_id) != 0) {
- E("set group id failed (errno: %d)\n", errno);
+ D("set group id failed (errno: %d)\n", errno);
return -1;
}
if (setuid(g_sdk_user_id) != 0) {
- E("set user id failed (errno: %d)\n", errno);
+ D("set user id failed (errno: %d)\n", errno);
return -1;
// if(is_drop_capability_after_fork) {
// return -1;
}
if (chdir(g_sdk_home_dir) < 0) {
- E("unable to change working directory to %s\n", g_sdk_home_dir);
+ D("unable to change working directory to %s\n", g_sdk_home_dir);
}
// TODO: use pam later
int set_root_privileges() {
if (sdbd_set_groups(ROOT_USER_NAME, g_root_group_id, NULL, 0) < 0) {
- E("set root groups failed (errno: %d)\n", errno);
+ D("set root groups failed (errno: %d)\n", errno);
}
if (setgid(g_root_group_id) != 0) {
- E("set root group id failed (errno: %d)\n", errno);
+ D("set root group id failed (errno: %d)\n", errno);
}
if (setuid(g_root_user_id) != 0) {
- E("set root user id failed (errno: %d)\n", errno);
+ D("set root user id failed (errno: %d)\n", errno);
}
if (chdir(g_root_home_dir) < 0) {
- E("unable to change root working directory to %s\n", g_sdk_home_dir);
+ D("unable to change root working directory to %s\n", g_sdk_home_dir);
}
// TODO: use pam later
bufsize = get_group_bufsize();
buf = malloc(bufsize);
if (buf == NULL) {
- E("failed to allocate gruop buf(%ld)\n", bufsize);
+ D("failed to allocate gruop buf(%ld)\n", bufsize);
return -1;
}
if (sdbd_get_group(g_default_groups[i].name, &grp, buf, bufsize) == 0) {
g_default_groups[i].gid = grp.gr_gid;
} else {
- E("failed get group info.(errno: %d)\n", errno);
+ D("failed get group info.(errno: %d)\n", errno);
}
}
bufsize = get_passwd_bufsize();
buf = malloc(bufsize);
if (buf == NULL) {
- E("failed to allocate passwd buf(%ld)\n", bufsize);
+ D("failed to allocate passwd buf(%ld)\n", bufsize);
set_static_root_userinfo();
} else {
if (sdbd_get_user_pwd(ROOT_USER_NAME, &pwd, buf, bufsize) < 0) {
- E("failed to get root user passwd info.(errno: %d)\n", errno);
+ D("failed to get root user passwd info.(errno: %d)\n", errno);
set_static_root_userinfo();
} else {
D("username=%s, uid=%d, gid=%d, dir=%s\n", pwd.pw_name, pwd.pw_uid, pwd.pw_gid, pwd.pw_dir);
int env_size = strlen("HOME=") + strlen(g_root_home_dir) + 1;
g_root_home_dir_env = malloc(env_size);
if(g_root_home_dir_env == NULL) {
- E("failed to allocate for home dir env string\n");
+ D("failed to allocate for home dir env string\n");
} else {
snprintf(g_root_home_dir_env, env_size, "HOME=%s", g_root_home_dir);
}
}
if (init_sdb_default_groups() < 0) {
- E("failed to initialize default groups.\n");
+ D("failed to initialize default groups.\n");
}
bufsize = get_passwd_bufsize();
buf = malloc(bufsize);
if (buf == NULL) {
- E("failed to allocate passwd buf(%ld)\n", bufsize);
+ D("failed to allocate passwd buf(%ld)\n", bufsize);
set_static_sdk_userinfo();
} else {
if (sdbd_get_user_pwd(SDK_USER_NAME, &pwd, buf, bufsize) < 0) {
- E("get user passwd info.(errno: %d)\n", errno);
+ D("get user passwd info.(errno: %d)\n", errno);
set_static_sdk_userinfo();
} else {
D("username=%s, uid=%d, gid=%d, dir=%s\n", pwd.pw_name, pwd.pw_uid, pwd.pw_gid, pwd.pw_dir);
int env_size = strlen("HOME=") + strlen(g_sdk_home_dir) + 1;
g_sdk_home_dir_env = malloc(env_size);
if(g_sdk_home_dir_env == NULL) {
- E("failed to allocate for home dir env string\n");
+ D("failed to allocate for home dir env string\n");
} else {
snprintf(g_sdk_home_dir_env, env_size, "HOME=%s", g_sdk_home_dir);
}
return -1;
case 0:
execve(cmd, argv, envp);
- E("- exec '%s' failed: (errno:%d) -\n", cmd, errno);
+ D("- exec '%s' failed: (errno:%d) -\n", cmd, errno);
exit(-1);
default:
for (;;) {
NULL,
};
if (safe_system(cmd, args, envp) < 0) {
- E("failed to change ownership to sdk user to %s\n", g_sdk_home_dir);
+ D("failed to change ownership to sdk user to %s\n", g_sdk_home_dir);
}
/* free environment variables */
if (ret != SYSTEM_INFO_ERROR_NONE) {
snprintf(g_capabilities.cpu_arch, sizeof(g_capabilities.cpu_arch),
"%s", UNKNOWN);
- E("fail to get the CPU architecture of model:%d\n", errno);
+ D("fail to get the CPU architecture of model:%d\n", errno);
} else {
snprintf(g_capabilities.cpu_arch, sizeof(g_capabilities.cpu_arch),
"%s", value);
// Secure protocol support
if(!request_capability_to_plugin(CAPABILITY_SECURE, g_capabilities.secure_protocol,
sizeof(g_capabilities.secure_protocol))) {
- E("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_SECURE);
+ D("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_SECURE);
snprintf(g_capabilities.secure_protocol, sizeof(g_capabilities.secure_protocol),
"%s", DISABLED);
}
// Interactive shell support
if(!request_capability_to_plugin(CAPABILITY_INTER_SHELL, g_capabilities.intershell_support,
sizeof(g_capabilities.intershell_support))) {
- E("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_INTER_SHELL);
+ D("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_INTER_SHELL);
snprintf(g_capabilities.intershell_support, sizeof(g_capabilities.intershell_support),
"%s", DISABLED);
}
// File push/pull support
if(!request_capability_to_plugin(CAPABILITY_FILESYNC, g_capabilities.filesync_support,
sizeof(g_capabilities.filesync_support))) {
- E("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_FILESYNC);
+ D("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_FILESYNC);
snprintf(g_capabilities.filesync_support, sizeof(g_capabilities.filesync_support),
"%s", DISABLED);
}
// USB protocol support
if(!request_capability_to_plugin(CAPABILITY_USB_PROTOCOL, g_capabilities.usbproto_support,
sizeof(g_capabilities.usbproto_support))) {
- E("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_USB_PROTOCOL);
+ D("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_USB_PROTOCOL);
snprintf(g_capabilities.usbproto_support, sizeof(g_capabilities.usbproto_support),
"%s", DISABLED);
}
// Socket protocol support
if(!request_capability_to_plugin(CAPABILITY_SOCK_PROTOCOL, g_capabilities.sockproto_support,
sizeof(g_capabilities.sockproto_support))) {
- E("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_SOCK_PROTOCOL);
+ D("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_SOCK_PROTOCOL);
snprintf(g_capabilities.sockproto_support, sizeof(g_capabilities.sockproto_support),
"%s", DISABLED);
}
// Root command support
if(!request_capability_to_plugin(CAPABILITY_ROOT_ONOFF, g_capabilities.rootonoff_support,
sizeof(g_capabilities.rootonoff_support))) {
- E("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_ROOT_ONOFF);
+ D("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_ROOT_ONOFF);
snprintf(g_capabilities.rootonoff_support, sizeof(g_capabilities.rootonoff_support),
"%s", DISABLED);
}
// Encryption support
if(!request_capability_to_plugin(CAPABILITY_ENCRYPTION, g_capabilities.encryption_support,
sizeof(g_capabilities.encryption_support))) {
- E("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_ENCRYPTION);
+ D("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_ENCRYPTION);
snprintf(g_capabilities.encryption_support, sizeof(g_capabilities.encryption_support),
"%s", DISABLED);
}
// SDK Tool path
if (SDK_TOOL_PATH == NULL) {
- E("fail to get SDK tool path.\n");
+ D("fail to get SDK tool path.\n");
snprintf(g_capabilities.sdk_toolpath, sizeof(g_capabilities.sdk_toolpath),
"%s", UNKNOWN);
} else {
if (ret != SYSTEM_INFO_ERROR_NONE) {
snprintf(g_capabilities.profile_name, sizeof(g_capabilities.profile_name),
"%s", UNKNOWN);
- E("fail to get profile name:%d\n", errno);
+ D("fail to get profile name:%d\n", errno);
} else {
snprintf(g_capabilities.profile_name, sizeof(g_capabilities.profile_name),
"%s", value);
if (ret != SYSTEM_INFO_ERROR_NONE) {
snprintf(g_capabilities.vendor_name, sizeof(g_capabilities.vendor_name),
"%s", UNKNOWN);
- E("fail to get the Vendor name:%d\n", errno);
+ D("fail to get the Vendor name:%d\n", errno);
} else {
snprintf(g_capabilities.vendor_name, sizeof(g_capabilities.vendor_name),
"%s", value);
// Target name of the launch possible
if(!request_capability_to_plugin(CAPABILITY_CAN_LAUNCH, g_capabilities.can_launch,
sizeof(g_capabilities.can_launch))) {
- E("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_CAN_LAUNCH);
+ D("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_CAN_LAUNCH);
snprintf(g_capabilities.can_launch, sizeof(g_capabilities.can_launch),
"%s", UNKNOWN);
}
} else {
snprintf(g_capabilities.device_name, sizeof(g_capabilities.device_name),
"%s", UNKNOWN);
- E("fail to get the Device name:%d\n", errno);
+ D("fail to get the Device name:%d\n", errno);
}
if (ret != SYSTEM_INFO_ERROR_NONE) {
snprintf(g_capabilities.platform_version, sizeof(g_capabilities.platform_version),
"%s", UNKNOWN);
- E("fail to get platform version:%d\n", errno);
+ D("fail to get platform version:%d\n", errno);
} else {
snprintf(g_capabilities.platform_version, sizeof(g_capabilities.platform_version),
"%s", value);
// Product version
if(!request_capability_to_plugin(CAPABILITY_PRODUCT_VER, g_capabilities.product_version,
sizeof(g_capabilities.product_version))) {
- E("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_PRODUCT_VER);
+ D("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_PRODUCT_VER);
snprintf(g_capabilities.product_version, sizeof(g_capabilities.product_version),
"%s", UNKNOWN);
}
// Sdbd plugin version
if(!request_capability_to_plugin(CAPABILITY_PLUGIN_VER, g_capabilities.sdbd_plugin_version,
sizeof(g_capabilities.sdbd_plugin_version))) {
- E("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_PLUGIN_VER);
+ D("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_PLUGIN_VER);
snprintf(g_capabilities.sdbd_plugin_version, sizeof(g_capabilities.sdbd_plugin_version),
"%s", UNKNOWN);
}
// sdbd log enable
if(!request_capability_to_plugin(CAPABILITY_LOG_ENABLE, g_capabilities.log_enable,
sizeof(g_capabilities.log_enable))) {
- E("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_LOG_ENABLE);
+ D("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_LOG_ENABLE);
snprintf(g_capabilities.log_enable, sizeof(g_capabilities.log_enable),
"%s", DISABLED);
}
// sdbd log path
if(!request_capability_to_plugin(CAPABILITY_LOG_PATH, g_capabilities.log_path,
sizeof(g_capabilities.log_path))) {
- E("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_LOG_PATH);
+ D("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_LOG_PATH);
snprintf(g_capabilities.log_path, sizeof(g_capabilities.log_path),
"%s", UNKNOWN);
}
// Application command support
if(!request_capability_to_plugin(CAPABILITY_APPCMD, g_capabilities.appcmd_support,
sizeof(g_capabilities.appcmd_support))) {
- E("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_APPCMD);
+ D("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_APPCMD);
snprintf(g_capabilities.appcmd_support, sizeof(g_capabilities.appcmd_support),
"%s", UNKNOWN);
}
// pkgcmd debug mode support
if(!request_capability_to_plugin(CAPABILITY_DEBUGMODE, g_capabilities.pkgcmd_debugmode,
sizeof(g_capabilities.pkgcmd_debugmode))) {
- E("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_DEBUGMODE);
+ D("failed to request. (%d:%d) \n", PLUGIN_SYNC_CMD_CAPABILITY, CAPABILITY_DEBUGMODE);
snprintf(g_capabilities.pkgcmd_debugmode, sizeof(g_capabilities.pkgcmd_debugmode),
"%s", ENABLED);
}
if (ret == 0) {
if(!strncmp(model_name, EMULATOR_MODEL_NAME, sizeof(EMULATOR_MODEL_NAME))){
g_is_emulator = 1;
- I("This target type is Emulator\n");
+ D("This target type is Emulator\n");
} else {
g_is_emulator = 0;
- I("This target type is Device\n");
+ D("This target type is Device\n");
}
} else {
g_is_emulator = -1;
- E("failed to get the model name.\n");
+ D("failed to get the model name.\n");
}
}
init_capabilities();
- //sdb_trace_init();
- //start_device_log();
+ sdb_trace_init();
+ start_device_log();
init_drop_privileges();
init_sdk_requirements();
if (!request_validity_to_plugin(PLUGIN_SYNC_CMD_VERIFY_LAUNCH, NULL)) {
- E("sdbd should be launched in develop mode.\n");
+ D("sdbd should be launched in develop mode.\n");
return -1;
}
cap.inheritable = 0;
capset(&header, &cap);
#endif
- I("Local port disabled\n");
+ D("Local port disabled\n");
} else {
char local_name[30];
build_local_name(local_name, sizeof(local_name), server_port);
sdb_notify_startup(0, "READY=1");
- I("Event loop starting\n");
+ D("Event loop starting\n");
fdevent_loop();
int copy_packet(apacket* dest, apacket* src) {
if(dest == NULL) {
- E("dest packet is NULL\n");
+ D("dest packet is NULL\n");
return -1;
}
if(src == NULL) {
- E("src packet is NULL\n");
+ D("src packet is NULL\n");
return -1;
}
return EXIT_FAILURE;
}
- I("Handling main()\n");
+ D("Handling main()\n");
//sdbd will never die on emulator!
signal(SIGTERM, handle_sig_term); /* tizen specific */
#include "sysdeps.h"
#include "sdktools.h"
-//#define TRACE_TAG TRACE_SERVICES
-#define LOG_TAG "SDBD_TRACE_SEVICES"
+#define TRACE_TAG TRACE_SERVICES
#include "log.h"
#include "sdb.h"
fp = popen("/usr/bin/pkgcmd -a", "r");
if (fp == NULL) {
- E("failed : popen pkgcmd -a\n");
+ D("failed : popen pkgcmd -a\n");
return 0;
}
if (!fgets(ret_str, PATH_MAX+64, fp)) {
- E("failed : fgets pkgcmd -a\n");
+ D("failed : fgets pkgcmd -a\n");
pclose(fp);
return 0;
}
ret_str[len + 1] = '\0';
if (sscanf(ret_str, "Tizen Application Installation Path: %4095s", pkg_path) != 1) {
- E("failed : parsing fail (str:%s)\n", ret_str);
+ D("failed : parsing fail (str:%s)\n", ret_str);
return 0;
}
char pkg_path_regx[PATH_MAX+64] = {0,};
if (!get_application_install_path(pkg_path)) {
- E("failed to get application install path\n");
+ D("failed to get application install path\n");
return 0;
}
ret = regcomp(®ex, pkg_path_regx, REG_EXTENDED);
if (ret){
- E("failed : recomp (error:%d)\n", ret);
+ D("failed : recomp (error:%d)\n", ret);
return 0;
}
regfree(®ex);
if (ret){
- E("This path is NOT package file: %s\n", path);
+ D("This path is NOT package file: %s\n", path);
return 0;
}
#include "sysdeps.h"
-//#define TRACE_TAG TRACE_SERVICES
-#define LOG_TAG "SDBD_TRACE_SERVICES"
+#define TRACE_TAG TRACE_SERVICES
#include "log.h"
#include "sdb.h"
D("environment value : %s\n", env_value);
snprintf(buf, sizeof(buf), "%d%s", NO_ERROR_TZPLATFORM_ENV, env_value);
} else {
- E("failed to get environment value using tzplatform_getenv");
+ D("failed to get environment value using tzplatform_getenv");
snprintf(buf, sizeof(buf), "%d", ERROR_TZPLATFORM_ENV_GENERAL);
}
} else {
- E("environment name (%s) is invalid\n", env_name);
+ D("environment name (%s) is invalid\n", env_name);
snprintf(buf, sizeof(buf), "%d", ERROR_TZPLATFORM_ENV_INVALID_VARIABLES);
}
writex(fd, buf, strlen(buf));
int ifd;
char buffer[BUF_LEN];
- I( "inoti_service start\n");
+ D( "inoti_service start\n");
ifd = inotify_init();
if ( ifd < 0 ) {
- E( "inotify_init failed\n");
+ D( "inotify_init failed\n");
sdb_close(fd);
return;
}
wd = inotify_add_watch(ifd, CS_PATH, IN_CREATE | IN_MOVE);
if ( wd < 0 ) {
- E("inotify_add_watch failed (errno :%d)\n", errno);
+ D("inotify_add_watch failed (errno :%d)\n", errno);
sdb_close(ifd);
sdb_close(fd);
return;
length = sdb_read( ifd, buffer, BUF_LEN );
if ( length < 0 ) {
- E( "inoti read failed\n");
+ D( "inoti read failed\n");
goto done;
}
int payload = length >= EVENT_SIZE ? length - EVENT_SIZE : 0;
writex(fd, cspath, len);
free(cspath);
} else {
- E( "asprintf was failed\n" );
+ D( "asprintf was failed\n" );
}
}
} else if (event->mask & IN_MOVE) {
writex(fd, cspath, len);
free(cspath);
} else {
- E("asprintf was failed\n");
+ D("asprintf was failed\n");
}
}
}
inotify_rm_watch( ifd, wd );
sdb_close(ifd);
sdb_close(fd);
- I( "inoti_service end\n");
+ D( "inoti_service end\n");
}
#if 0
int s[2];
if(sdb_socketpair(s)) {
- E("cannot create service socket pair\n");
+ D("cannot create service socket pair\n");
return -1;
}
free(sti);
sdb_close(s[0]);
sdb_close(s[1]);
- E("cannot create service thread\n");
+ D("cannot create service thread\n");
return -1;
}
ptm = unix_open("/dev/ptmx", O_RDWR); // | O_NOCTTY);
if(ptm < 0){
- E("[ cannot open /dev/ptmx - errno:%d ]\n",errno);
+ D("[ cannot open /dev/ptmx - errno:%d ]\n",errno);
return -1;
}
if (fcntl(ptm, F_SETFD, FD_CLOEXEC) < 0) {
- E("[ cannot set cloexec to /dev/ptmx - errno:%d ]\n",errno);
+ D("[ cannot set cloexec to /dev/ptmx - errno:%d ]\n",errno);
}
if(grantpt(ptm) || unlockpt(ptm) ||
ptsname_r(ptm, devname, sizeof(devname)) != 0 ){
- E("[ trouble with /dev/ptmx - errno:%d ]\n", errno);
+ D("[ trouble with /dev/ptmx - errno:%d ]\n", errno);
sdb_close(ptm);
return -1;
}
*pid = fork();
if(*pid < 0) {
- E("- fork failed: errno:%d -\n", errno);
+ D("- fork failed: errno:%d -\n", errno);
sdb_close(ptm);
return -1;
}
sdb_close(fd);
} else {
// FIXME: not supposed to be here
- E("sdb: unable to open %s due to errno:%d\n", text, errno);
+ D("sdb: unable to open %s due to errno:%d\n", text, errno);
}
}
if ((pheader = CMSG_FIRSTHDR(&msg)) != NULL &&
pheader->cmsg_len == CMSG_LEN(sizeof(int))) {
if (pheader->cmsg_level != SOL_SOCKET) {
- I("sdb: control level != SOL_SOCKET");
+ D("sdb: control level != SOL_SOCKET");
exit(-1);
}
if (pheader->cmsg_type != SCM_RIGHTS) {
- I("sdb: control type != SCM_RIGHTS");
+ D("sdb: control type != SCM_RIGHTS");
exit(-1);
}
memcpy(recvfd, CMSG_DATA(pheader), sizeof(int));
{
*pid = fork();
if(*pid < 0) {
- E("- fork failed: errno:%d -\n", errno);
+ D("- fork failed: errno:%d -\n", errno);
return -1;
}
D("sdb: executes root commands!!:%s\n", argv[2]);
} else {
if (getuid() != g_sdk_user_id && set_sdk_user_privileges(RESERVE_CAPABILITIES_AFTER_FORK) < 0) {
- E("failed to set SDK user privileges\n");
+ D("failed to set SDK user privileges\n");
exit(-1);
}
}
}
/* exec sdbduser */
execve(cmd, argv, envp);
- E("- exec '%s' failed: (errno:%d) -\n", cmd, errno);
+ D("- exec '%s' failed: (errno:%d) -\n", cmd, errno);
exit(-1);
} else {
// Don't set child's OOM adjustment to zero.
snprintf(tmptext, sizeof tmptext, "/tmp/.sdbduser_%d.sock", (int)(*pid));
char *sockpath = strdup(tmptext);
if (sockpath == NULL) {
- E("failed to get socket path, %d\n", errno);
+ D("failed to get socket path, %d\n", errno);
return -1;
}
D("read fd socket is %s\n", sockpath);
sock = socket(PF_LOCAL, SOCK_STREAM, 0);
if (sock == -1) {
- E("socket error, %d\n", errno);
+ D("socket error, %d\n", errno);
free(sockpath);
return -1;
}
usleep(10000);
}
if (trycnt == 100) {
- E("failed to connect, errno: %d\n", errno);
+ D("failed to connect, errno: %d\n", errno);
if (sdb_close(sock) == -1) {
- E("close sock error, %d\n", errno);
+ D("close sock error, %d\n", errno);
}
free(sockpath);
return -1;
char c;
if (recv_fd(sock, &c, 1, &ptm) == -1) {
- E("recv_fd error, %d\n", errno);
+ D("recv_fd error, %d\n", errno);
if (sdb_close(sock) == -1) {
- E("close sock error, %d\n", errno);
+ D("close sock error, %d\n", errno);
}
free(sockpath);
return -1;
}
if (sdb_close(sock) == -1) {
- E("close sock error, %d\n", errno);
+ D("close sock error, %d\n", errno);
}
free(sockpath);
- I("getting child's ptm successed.\n");
+ D("getting child's ptm successed.\n");
return ptm;
}
}
char *envp_plugin = NULL;
envp_plugin = malloc(ENV_BUF_MAX);
if (envp_plugin == NULL) {
- E("Cannot allocate the shell commnad buffer.");
+ D("Cannot allocate the shell commnad buffer.");
return -1;
}
memset(envp_plugin, 0, ENV_BUF_MAX);
if (!request_conversion_to_plugin(PLUGIN_SYNC_CMD_GET_SHELL_ENV, NULL,
envp_plugin, ENV_BUF_MAX)) {
- E("Failed to convert the shell command. (%s)\n", name);
+ D("Failed to convert the shell command. (%s)\n", name);
free(envp_plugin);
return -1;
} else {
if(name) { // in case of shell execution directly
// Check the shell command validation.
if (!request_validity_to_plugin(PLUGIN_SYNC_CMD_VERIFY_SHELLCMD, name)) {
- E("This shell command is invalid. (%s)\n", name);
+ D("This shell command is invalid. (%s)\n", name);
return -1;
}
char *new_cmd = NULL;
new_cmd = malloc(SDBD_SHELL_CMD_MAX);
if(new_cmd == NULL) {
- E("Cannot allocate the shell commnad buffer.");
+ D("Cannot allocate the shell commnad buffer.");
return -1;
}
memset(new_cmd, 0, SDBD_SHELL_CMD_MAX);
if(!request_conversion_to_plugin(PLUGIN_SYNC_CMD_CONVERT_SHELLCMD, name, new_cmd, SDBD_SHELL_CMD_MAX)) {
- E("Failed to convert the shell command. (%s)\n", name);
+ D("Failed to convert the shell command. (%s)\n", name);
free(new_cmd);
return -1;
}
} else { // in case of shell interactively
// Check the capability for interactive shell support.
if (!is_support_interactive_shell()) {
- E("This platform dose NOT support the interactive shell\n");
+ D("This platform dose NOT support the interactive shell\n");
return -1;
}
D("create_subprocess() ret_fd=%d pid=%d\n", ret_fd, pid);
if (ret_fd < 0) {
- E("cannot create service thread\n");
+ D("cannot create service thread\n");
return -1;
}
win_sz.ws_col = columns;
if (ioctl(ret_fd, TIOCSWINSZ, &win_sz) < 0) {
- E("failed to sync window size.\n");
+ D("failed to sync window size.\n");
}
}
if(sdb_thread_create( &t, service_bootstrap_func, sti)){
free(sti);
sdb_close(ret_fd);
- E("cannot create service thread\n");
+ D("cannot create service thread\n");
return -1;
}
int s[2];
if(sdb_socketpair(s)) {
- E("cannot create service socket pair\n");
+ D("cannot create service socket pair\n");
return -1;
}
// FIXME: do not wait child process hear
//waitpid(pid, &ret, 0);
} else {
- E("- fork failed: errno:%d -\n", errno);
+ D("- fork failed: errno:%d -\n", errno);
sdb_close(s[0]);
sdb_close(s[1]);
- E("cannot create sync service sub process\n");
+ D("cannot create sync service sub process\n");
return -1;
}
int r = system_info_get_platform_string("http://tizen.org/system/model_name", &value);
if (r != SYSTEM_INFO_ERROR_NONE) {
s_strncpy(sysinfo.model_name, UNKNOWN, sizeof(sysinfo.model_name));
- E("fail to get system model:%d\n", errno);
+ D("fail to get system model:%d\n", errno);
} else {
s_strncpy(sysinfo.model_name, value, sizeof(sysinfo.model_name));
D("returns model_name:%s\n", value);
r = system_info_get_platform_string("http://tizen.org/system/platform.name", &value);
if (r != SYSTEM_INFO_ERROR_NONE) {
s_strncpy(sysinfo.platform_name, UNKNOWN, sizeof(sysinfo.platform_name));
- E("fail to get platform name:%d\n", errno);
+ D("fail to get platform name:%d\n", errno);
} else {
s_strncpy(sysinfo.platform_name, value, sizeof(sysinfo.platform_name));
D("returns platform_name:%s\n", value);
r = system_info_get_platform_string("tizen.org/feature/platform.version", &value);
if (r != SYSTEM_INFO_ERROR_NONE) {
s_strncpy(sysinfo.platform_version, UNKNOWN, sizeof(sysinfo.platform_version));
- E("fail to get platform version:%d\n", errno);
+ D("fail to get platform version:%d\n", errno);
} else {
s_strncpy(sysinfo.platform_version, value, sizeof(sysinfo.platform_version));
D("returns platform_version:%s\n", value);
r = system_info_get_platform_string("tizen.org/feature/profile", &value);
if (r != SYSTEM_INFO_ERROR_NONE) {
s_strncpy(sysinfo.profile_name, UNKNOWN, sizeof(sysinfo.profile_name));
- E("fail to get profile name:%d\n", errno);
+ D("fail to get profile name:%d\n", errno);
} else {
s_strncpy(sysinfo.profile_name, value, sizeof(sysinfo.profile_name));
D("returns profile name:%s\n", value);
win_sz.ws_col = columns;
if (ioctl(s->fd, TIOCSWINSZ, &win_sz) < 0) {
- E("failed to sync window size.\n");
+ D("failed to sync window size.\n");
return;
}
- I("success to sync window size.\n");
+ D("success to sync window size.\n");
}
}
int interval = 1000;
while (time < COMMAND_TIMEOUT) {
if (booting_done == 1) {
- I("get_boot:platform booting is done\n");
+ D("get_boot:platform booting is done\n");
snprintf(buf, sizeof(buf), "%s", "1");
break;
}
- I("get_boot:platform booting is in progress\n");
+ D("get_boot:platform booting is in progress\n");
sdb_sleep_ms(interval);
time += interval;
}
if (ret >= 0) {
if (close_on_exec(ret) < 0) {
- E("failed to close fd exec\n");
+ D("failed to close fd exec\n");
}
}
return ret;
#include "sysdeps.h"
-//#define TRACE_TAG TRACE_SOCKETS
-#define LOG_TAG "SDBD_TRACE_SOCKETS"
+#define TRACE_TAG TRACE_SOCKETS
#include "log.h"
#include "sdb.h"
continue;
}
if((r == 0) || (errno != EAGAIN)) {
- E( "LS(%d): not ready, errno=%d\n", s->id, errno);
+ D( "LS(%d): not ready, errno=%d\n", s->id, errno);
s->close(s);
return 1; /* not ready (error) */
} else {
{
asocket *s = _s;
- //D("LS(%d): event_func(fd=%d(==%d), ev=%04x)\n", s->id, s->fd, fd, ev);
+ D("LS(%d): event_func(fd=%d(==%d), ev=%04x)\n", s->id, s->fd, fd, ev);
/* put the FDE_WRITE processing before the FDE_READ
** in order to simplify the code.
while (avail > 0) {
r = sdb_read(fd, x, avail);
-// D("LS(%d): post sdb_read(fd=%d,...) r=%d (errno=%d) avail=%d\n",
-// s->id, s->fd, r, r < 0 ? errno : 0, avail);
+ D("LS(%d): post sdb_read(fd=%d,...) r=%d (errno=%d) avail=%d\n",
+ s->id, s->fd, r, r < 0 ? errno : 0, avail);
if (r > 0 && r <= avail) {
avail -= r;
x += r;
is_eof = 1;
break;
}
-// D("LS(%d): fd=%d post avail loop. r=%d is_eof=%d forced_eof=%d\n",
-// s->id, s->fd, r, is_eof, s->fde.force_eof);
+ D("LS(%d): fd=%d post avail loop. r=%d is_eof=%d forced_eof=%d\n",
+ s->id, s->fd, r, is_eof, s->fde.force_eof);
//변경된 최대 패킷 크기로 코드 수정
if ((avail == max_payload) || (s->peer == 0)) {
} else {
p->len = max_payload >= avail ? max_payload - avail : 0;
r = s->peer->enqueue(s->peer, p);
- //D("LS(%d): fd=%d post peer->enqueue(). r=%d\n", s->id, s->fd, r);
+ D("LS(%d): fd=%d post peer->enqueue(). r=%d\n", s->id, s->fd, r);
if(r < 0) {
/* error return means they closed us as a side-effect
** bytes of readable data.
*/
// s->close(s);
- E("LS(%d): FDE_ERROR (fd=%d)\n", s->id, s->fd);
+ D("LS(%d): FDE_ERROR (fd=%d)\n", s->id, s->fd);
return;
}
static int remote_socket_enqueue(asocket *s, apacket *p)
{
-// D("entered remote_socket_enqueue RS(%d) WRITE fd=%d peer.fd=%d\n",
-// s->id, s->fd, s->peer->fd);
+ D("entered remote_socket_enqueue RS(%d) WRITE fd=%d peer.fd=%d\n",
+ s->id, s->fd, s->peer->fd);
p->msg.command = A_WRTE;
p->msg.arg0 = s->peer->id;
p->msg.arg1 = s->id;
void connect_to_remote(asocket *s, const char *destination)
{
- //D("Connect_to_remote call RS(%d) fd=%d\n", s->id, s->fd);
+ D("Connect_to_remote call RS(%d) fd=%d\n", s->id, s->fd);
apacket *p = get_apacket();
size_t len = strlen(destination) + 1;
fatal("destination oversized");
}
- //D("LS(%d): connect('%s')\n", s->id, destination);
+ D("LS(%d): connect('%s')\n", s->id, destination);
p->msg.command = A_OPEN;
p->msg.arg0 = s->id;
p->msg.data_length = len;
len = unhex(p->data, 4);
if((len < 1) || (len > 1024)) {
- E("SS(%d): bad size (%d)\n", s->id, len);
+ D("SS(%d): bad size (%d)\n", s->id, len);
goto fail;
}
- //D("SS(%d): len is %d\n", s->id, len );
+ D("SS(%d): len is %d\n", s->id, len );
/* can't do anything until we have the full header */
if((len + 4) > p->len) {
D("SS(%d): waiting for %d more bytes\n", s->id, len+4 - p->len);
p->data[len + 4] = 0;
- //D("SS(%d): '%s'\n", s->id, (char*) (p->data + 4));
+ D("SS(%d): '%s'\n", s->id, (char*) (p->data + 4));
if (s->transport == NULL) {
char* error_string = "unknown failure";
#include "sysdeps.h"
-//#define TRACE_TAG TRACE_TRANSPORT
-#define LOG_TAG "SDBD_TRACE_TRANSPORT"
+#define TRACE_TAG TRACE_TRANSPORT
#include "log.h"
#include "sdb.h"
*pb++ = c;
}
*pb++ = '\0';
-// D("%s\n", buffer);
+ DR("%s\n", buffer);
}
static const char *statename(atransport *t)
else
snprintf(arg1, sizeof arg1, "0x%x", p->msg.arg1);
- //D("%s: %s: [%s] arg0=%s arg1=%s (len=%d) ", name, func, cmd, arg0, arg1, len);
+ D("%s: %s: [%s] arg0=%s arg1=%s (len=%d) ",
+ name, func, cmd, arg0, arg1, len);
dump_hex(p->data, len);
}
#endif /* SDB_TRACE */
len -= r;
p += r;
} else {
- E("%s: read_packet (fd=%d), error ret=%d errno=%d\n", name, fd, r, errno);
+ D("%s: read_packet (fd=%d), error ret=%d errno=%d\n", name, fd, r, errno);
if((r < 0) && (errno == EINTR)) continue;
return -1;
}
}
#if SDB_TRACE
- dump_packet(name, "from remote", *ppacket);
+ if (SDB_TRACING) {
+ dump_packet(name, "from remote", *ppacket);
+ }
#endif
return 0;
}
}
#if SDB_TRACE
- dump_packet(name, "to remote", *ppacket);
+ if (SDB_TRACING) {
+ dump_packet(name, "to remote", *ppacket);
+ }
#endif
while(len > 0) {
r = sdb_write(fd, p, len);
len -= r;
p += r;
} else {
- E("%s: write_packet (fd=%d) error ret=%d errno=%d\n", name, fd, r, errno);
+ D("%s: write_packet (fd=%d) error ret=%d errno=%d\n", name, fd, r, errno);
if((r < 0) && (errno == EINTR)) continue;
return -1;
}
static void transport_socket_events(int fd, unsigned events, void *_t)
{
atransport *t = _t;
- //D("transport_socket_events(fd=%d, events=%04x,...)\n", fd, events);
+ D("transport_socket_events(fd=%d, events=%04x,...)\n", fd, events);
if(events & FDE_READ){
apacket *p = 0;
if(read_packet(fd, t->serial, &p)){
- E("%s: failed to read packet from transport socket on fd %d\n", t->serial, fd);
+ D("%s: failed to read packet from transport socket on fd %d\n", t->serial, fd);
} else {
handle_packet(p, (atransport *) _t);
}
print_packet("send", p);
if (t == NULL) {
- E("Transport is null \n");
+ D("Transport is null \n");
fatal("Transport is null");
}
p->msg.magic = A_SYNC ^ 0xffffffff;
if(write_packet(t->fd, t->serial, &p)) {
put_apacket(p);
- E("%s: failed to write SYNC packet\n", t->serial);
+ D("%s: failed to write SYNC packet\n", t->serial);
goto oops;
}
p = get_apacket();
if(t->read_from_remote(p, t) == 0){
- //D("%s: received remote packet, sending to transport\n", t->serial);
+ D("%s: received remote packet, sending to transport\n",
+ t->serial);
#ifdef SUPPORT_ENCRYPT
if (t->encryption == ENCR_ON && p->msg.command != A_ENCR) // 현재 연결이 암호화 모드이고, 암호화 관련 메시지가 아닌 경우, 메시지 복호화
if(write_packet(t->fd, t->serial, &p)){
put_apacket(p);
- E("%s: failed to write apacket to transport\n", t->serial);
+ D("%s: failed to write apacket to transport\n", t->serial);
goto oops;
}
} else {
- E("%s: remote read failed for transport\n", t->serial);
+ D("%s: remote read failed for transport\n", t->serial);
put_apacket(p);
break;
}
p->msg.magic = A_SYNC ^ 0xffffffff;
if(write_packet(t->fd, t->serial, &p)) {
put_apacket(p);
- E("%s: failed to write SYNC apacket to transport", t->serial);
+ D("%s: failed to write SYNC apacket to transport", t->serial);
}
oops:
for(;;){
if(read_packet(t->fd, t->serial, &p)) {
- E("%s: failed to read apacket from transport on fd %d\n",
+ D("%s: failed to read apacket from transport on fd %d\n",
t->serial, t->fd );
break;
}
}
} else {
if(active) {
- //D("%s: transport got packet, sending to remote, state(%s)\n", t->serial, statename(t));
+ D("%s: transport got packet, sending to remote, state(%s)\n", t->serial, statename(t));
#ifdef SUPPORT_ENCRYPT
if (t->encryption == ENCR_ON && p->msg.command != A_ENCR) // 현재 연결이 암호화 모드이고, 암호화 관련 메시지가 아닌 경우, 메시지를 암호화
p += r;
} else {
if((r < 0) && (errno == EINTR)) continue;
- E("transport_read_action: on fd %d, error %d\n",
+ D("transport_read_action: on fd %d, error %d\n",
fd, errno);
return -1;
}
p += r;
} else {
if((r < 0) && (errno == EINTR)) continue;
- E("transport_write_action: on fd %d, error %d\n",
+ D("transport_write_action: on fd %d, error %d\n",
fd, errno);
return -1;
}
{
atransport *t = calloc(1, sizeof(atransport));
if (t == NULL) {
- E("failed to allocate memory of transport struct\n");
+ D("failed to allocate memory of transport struct\n");
return;
}
char buff[32];
char device_name[256];
atransport *t = calloc(1, sizeof(atransport));
if (t == NULL) {
- E("failed to allocate memory of transport struct\n");
+ D("failed to allocate memory of transport struct\n");
return;
}
sdb_mutex_unlock(&transport_lock);
}
-//#undef TRACE_TAG
-//#define TRACE_TAG TRACE_RWX
-#undef LOG_TAG
-#define LOG_TAG "SDBD_TRACE_RWX"
+#undef TRACE_TAG
+#define TRACE_TAG TRACE_RWX
int readx(int fd, void *ptr, size_t len)
{
int r;
int l = len;
- //D("readx: fd=%d wanted=%zu\n", fd, len);
+ D("readx: fd=%d wanted=%zu\n", fd, len);
while (l > 0) {
r = sdb_read(fd, p, l);
if (r > 0 && r <= l) {
p += r;
} else {
if (r < 0) {
- E("readx: fd=%d error %d\n", fd, errno);
+ D("readx: fd=%d error %d\n", fd, errno);
if (errno == EINTR)
continue;
} else {
- E("readx: fd=%d disconnected\n", fd);
+ D("readx: fd=%d disconnected\n", fd);
}
return -1;
}
}
#if SDB_TRACE
- //D("readx: fd=%d wanted=%zu got=%zu\n", fd, len, len - l);
+ D("readx: fd=%d wanted=%zu got=%zu\n", fd, len, len - l);
dump_hex( ptr, len );
#endif
return 0;
int r;
#if SDB_TRACE
- //D("writex: fd=%d len=%zu: ", fd, len);
+ D("writex: fd=%d len=%zu: ", fd, len);
dump_hex( ptr, len );
#endif
while(len > 0) {
p += r;
} else {
if (r < 0) {
- E("writex: fd=%d error %d\n", fd, errno);
+ D("writex: fd=%d error %d\n", fd, errno);
if (errno == EINTR)
continue;
} else {
- E("writex: fd=%d disconnected\n", fd);
+ D("writex: fd=%d disconnected\n", fd);
}
return -1;
}
int check_header(apacket *p, atransport *t)
{
if(p->msg.magic != (p->msg.command ^ 0xffffffff)) {
- E("check_header(): invalid magic\n");
+ D("check_header(): invalid magic\n");
return -1;
}
if(p->msg.data_length > t->max_payload) {
- E("check_header(): %d > transport->max_payload(%zu)\n", p->msg.data_length, t->max_payload);
+ D("check_header(): %d > transport->max_payload(%zu)\n", p->msg.data_length, t->max_payload);
return -1;
}
#include <unistd.h>
#endif
-//#define TRACE_TAG TRACE_TRANSPORT
-#define LOG_TAG "SDBD_TRACE_TRANSPORT"
+#define TRACE_TAG TRACE_TRANSPORT
#include "log.h"
#include "sdb.h"
static int remote_read(apacket *p, atransport *t)
{
if(readx(t->sfd, &p->msg, sizeof(amessage))){
- E("remote local: read terminated (message)\n");
+ D("remote local: read terminated (message)\n");
return -1;
}
p->msg.command, p->msg.arg0, p->msg.arg1, p->msg.data_length, p->msg.data_check, p->msg.magic);
#endif
if(check_header(p, t)) {
- E("bad header: terminated (data)\n");
+ D("bad header: terminated (data)\n");
return -1;
}
if(readx(t->sfd, p->data, p->msg.data_length)){
- E("remote local: terminated (data)\n");
+ D("remote local: terminated (data)\n");
return -1;
}
if(check_data(p)) {
- E("bad data: terminated (data)\n");
+ D("bad data: terminated (data)\n");
return -1;
}
p->msg.command, p->msg.arg0, p->msg.arg1, p->msg.data_length, p->msg.data_check, p->msg.magic);
#endif
if(writex(t->sfd, &p->msg, sizeof(amessage) + length)) {
- E("remote local: write terminated\n");
+ D("remote local: write terminated\n");
return -1;
}
if (fd >= 0) {
D("client: connected on remote on fd %d\n", fd);
if (close_on_exec(fd) < 0) {
- E("failed to close fd exec\n");
+ D("failed to close fd exec\n");
}
disable_tcp_nagle(fd);
snprintf(buf, sizeof buf, "%s%d", LOCAL_CLIENT_PREFIX, console_port);
continue;
}
if (close_on_exec(serverfd) < 0) {
- E("failed to close serverfd exec\n");
+ D("failed to close serverfd exec\n");
}
}
if(fd >= 0) {
D("server: new connection on fd %d\n", fd);
if (close_on_exec(fd) < 0) {
- E("failed to close fd exec\n");
+ D("failed to close fd exec\n");
}
disable_tcp_nagle(fd);
int ret = -1;
ret = keep_alive(fd, 1, SDB_KEEPALIVE_CNT, SDB_KEEPALIVE_IDLE, SDB_KEEPALIVE_INTVL);
if (ret < 0) {
- E("failed to set keep alive option. FD(%d), errno=%d\n", fd, errno);
+ D("failed to set keep alive option. FD(%d), errno=%d\n", fd, errno);
} else {
D("Success to set keep alive option. FD(%d), cnt=%d, idle=%d(sec), interval=%d(sec)\n",
fd, SDB_KEEPALIVE_CNT, SDB_KEEPALIVE_IDLE, SDB_KEEPALIVE_INTVL);
register_socket_transport(fd, "host", port, 1, NULL);
}
} else {
- E("failed to accept() from sdb server\n");
+ D("failed to accept() from sdb server\n");
//FIXME: implements error handle for EMFILE or ENFILE
}
}
flags = fcntl(sockfd, F_GETFL, 0);
if(fcntl(sockfd, F_SETFL, flags | O_NONBLOCK) == -1) {
- E("failed to set file O_NONBLOCK status flag for socket %d: errno:%d\n",
+ D("failed to set file O_NONBLOCK status flag for socket %d: errno:%d\n",
sockfd, errno);
}
if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &error, &len) < 0)
return (-1); /* Solaris pending error */
} else
- E("select error: sockfd not set\n");
+ D("select error: sockfd not set\n");
done:
if(fcntl(sockfd, F_SETFL, flags) == -1) { /* restore file status flags */
- E("failed to restore file status flag for socket %d\n",
+ D("failed to restore file status flag for socket %d\n",
sockfd);
}
s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
}
if (s < 0) {
- E("could not create socket\n");
+ D("could not create socket\n");
return -1;
}
ret = connect_nonb(s, (struct sockaddr*) &server, sizeof(server), connect_timeout);
if (ret < 0) {
- E("could not connect to server\n");
+ D("could not connect to server\n");
sdb_close(s);
return -1;
}
if (writex(s, request, strlen(request)) != 0) {
- E("could not send notification request to host\n");
+ D("could not send notification request to host\n");
sdb_close(s);
return -1;
}
sdb_close(s);
- I("sent notification request to host\n");
+ D("sent notification request to host\n");
return 0;
}
return NULL;
}
if (get_emulator_hostip(host_ip, sizeof host_ip) == -1) {
- E("failed to get emulator host ip\n");
+ D("failed to get emulator host ip\n");
return NULL;
}
// XXX: Known issue - log collision
}
if (get_emulator_guestip(guest_ip, sizeof guest_ip) == -1) {
- E("failed to get emulator guest ip\n");
+ D("failed to get emulator guest ip\n");
goto sleep_and_continue;
}
#include <sysdeps.h>
-//#define TRACE_TAG TRACE_TRANSPORT
-#define LOG_TAG "SDBD_TRACE_TRANSPORT"
+#define TRACE_TAG TRACE_TRANSPORT
#include "log.h"
#include "sdb.h"
static int remote_read(apacket *p, atransport *t)
{
if(usb_read(t->usb, &p->msg, sizeof(amessage))){
- E("remote usb: read terminated (message)\n");
+ D("remote usb: read terminated (message)\n");
return -1;
}
fix_endians(p);
if(check_header(p, t)) {
- E("remote usb: check_header failed\n");
+ D("remote usb: check_header failed\n");
return -1;
}
if(p->msg.data_length) {
if(usb_read(t->usb, p->data, p->msg.data_length)){
- E("remote usb: terminated (data)\n");
+ D("remote usb: terminated (data)\n");
return -1;
}
}
if(check_data(p)) {
- E("remote usb: check_data failed\n");
+ D("remote usb: check_data failed\n");
return -1;
}
fix_endians(p);
if(usb_write(t->usb, &p->msg, sizeof(amessage))) {
- E("remote usb: 1 - write terminated\n");
+ D("remote usb: 1 - write terminated\n");
return -1;
}
if(p->msg.data_length == 0) return 0;
if(usb_write(t->usb, &p->data, size)) {
- E("remote usb: 2 - write terminated\n");
+ D("remote usb: 2 - write terminated\n");
return -1;
}
#include "sysdeps.h"
-//#define TRACE_TAG TRACE_USB
-#define LOG_TAG "SDBD_TRACE_USB"
+#define TRACE_TAG TRACE_USB
#include "log.h"
#include "sdb.h"
D("OPENING %s\n", h->EP0_NAME);
h->control = sdb_open(h->EP0_NAME, O_RDWR);
if (h->control < 0) {
- E("[ %s: cannot open control endpoint ]\n", h->EP0_NAME);
+ D("[ %s: cannot open control endpoint ]\n", h->EP0_NAME);
h->control = -errno;
sdb_mutex_unlock(&h->control_lock);
goto error;
D("[ %s: writing descriptors ]\n", h->EP0_NAME);
ret = sdb_write(h->control, &descriptors, sizeof(descriptors));
if (ret < 0) {
- E("[ %s: cannot write descriptors ]\n", h->EP0_NAME);
+ D("[ %s: cannot write descriptors ]\n", h->EP0_NAME);
sdb_mutex_unlock(&h->control_lock);
goto error;
}
D("[ %s: writing strings ]\n", h->EP0_NAME);
ret = sdb_write(h->control, &strings, sizeof(strings));
if(ret < 0) {
- E("[ %s: cannot write strings ]\n", h->EP0_NAME);
+ D("[ %s: cannot write strings ]\n", h->EP0_NAME);
sdb_mutex_unlock(&h->control_lock);
goto error;
}
/* open output endpoint */
D("[ %s: opening ]\n", h->EP_OUT_NAME);
if ((h->bulk_out = sdb_open(h->EP_OUT_NAME, O_RDWR)) < 0) {
- E("[ %s: cannot open bulk-out endpoint ]\n", h->EP_OUT_NAME);
+ D("[ %s: cannot open bulk-out endpoint ]\n", h->EP_OUT_NAME);
h->bulk_out = -errno;
goto error;
}
/* open input endpoint */
D("[ %s: opening ]\n", h->EP_IN_NAME);
if ((h->bulk_in = sdb_open(h->EP_IN_NAME, O_RDWR)) < 0) {
- E("[ %s: cannot open bulk-in endpoint ]\n", h->EP_IN_NAME);
+ D("[ %s: cannot open bulk-in endpoint ]\n", h->EP_IN_NAME);
h->bulk_in = -errno;
goto error;
}
}
if (usb->control < 0 || usb->bulk_in < 0 || usb->bulk_out < 0) {
- E("[ opening device failed ]\n");
+ D("[ opening device failed ]\n");
return (void *)-1;
}
n = bulk_write(h->bulk_in, data, len);
if(n != len) {
- E("ERROR: fd = %d, n = %d, errno = %d\n",
+ D("ERROR: fd = %d, n = %d, errno = %d\n",
h->bulk_in, n, errno);
return -1;
}
n = bulk_read(h->bulk_out, data, len);
if(n != len) {
- E("ERROR: fd = %d, n = %d, errno = %d\n",
+ D("ERROR: fd = %d, n = %d, errno = %d\n",
h->bulk_out, n, errno);
return -1;
}
#include "sysdeps.h"
-//#define TRACE_TAG TRACE_USB
-#define LOG_TAG "SDBD_TRACE_USB"
+#define TRACE_TAG TRACE_USB
#include "log.h"
#include "sdb.h"
// should have device and configuration descriptors, and atleast two endpoints
if (desclength < USB_DT_DEVICE_SIZE + USB_DT_CONFIG_SIZE) {
- E("desclength %d is too small\n", desclength);
+ D("desclength %d is too small\n", desclength);
sdb_close(fd);
continue;
}
bufptr += USB_DT_CONFIG_SIZE;
if (config->bLength != USB_DT_CONFIG_SIZE || config->bDescriptorType != USB_DT_CONFIG) {
- E("usb_config_descriptor not found\n");
+ D("usb_config_descriptor not found\n");
sdb_close(fd);
continue;
}
bufptr += length;
if (length != USB_DT_INTERFACE_SIZE) {
- E("interface descriptor has wrong size\n");
+ D("interface descriptor has wrong size\n");
break;
}
is_sdb_interface(vid, pid, interface->bInterfaceClass,
interface->bInterfaceSubClass, interface->bInterfaceProtocol)) {
- I("looking for bulk endpoints\n");
+ D("looking for bulk endpoints\n");
// looks like SDB...
ep1 = (struct usb_endpoint_descriptor *)bufptr;
bufptr += USB_DT_ENDPOINT_SIZE;
ep1->bDescriptorType != USB_DT_ENDPOINT ||
ep2->bLength != USB_DT_ENDPOINT_SIZE ||
ep2->bDescriptorType != USB_DT_ENDPOINT) {
- I("endpoints not found\n");
+ D("endpoints not found\n");
break;
}
// both endpoints should be bulk
if (ep1->bmAttributes != USB_ENDPOINT_XFER_BULK ||
ep2->bmAttributes != USB_ENDPOINT_XFER_BULK) {
- I("bulk endpoints not found\n");
+ D("bulk endpoints not found\n");
continue;
}
/* aproto 01 needs 0 termination */
urb->buffer = (void*) data;
urb->buffer_length = len;
- I("++ write ++\n");
+ D("++ write ++\n");
sdb_mutex_lock(&h->lock);
if(h->dead) {
}
fail:
sdb_mutex_unlock(&h->lock);
- I("-- write --\n");
+ D("-- write --\n");
return res;
}
h->urb_in_busy = 1;
for(;;) {
- I("[ reap urb - wait ]\n");
+ D("[ reap urb - wait ]\n");
h->reaper_thread = pthread_self();
sdb_mutex_unlock(&h->lock);
res = ioctl(h->desc, USBDEVFS_REAPURB, &out);
if(saved_errno == EINTR) {
continue;
}
- E("[ reap urb - error ]\n");
+ D("[ reap urb - error ]\n");
break;
}
D("[ urb @%p status = %d, actual = %d ]\n",
break;
}
if(out == &h->urb_out) {
- I("[ reap urb - OUT compelete ]\n");
+ D("[ reap urb - OUT compelete ]\n");
h->urb_out_busy = 0;
sdb_cond_broadcast(&h->notify);
}
n = usb_bulk_write(h, data, xfer);
if(n != xfer) {
- E("ERROR: n = %d, errno = %d\n",
+ D("ERROR: n = %d, errno = %d\n",
n, errno);
return -1;
}
unsigned char *data = (unsigned char*) _data;
int n;
- I("++ usb_read ++\n");
+ D("++ usb_read ++\n");
while(len > 0) {
int xfer = (len > 4096) ? 4096 : len;
D("[ usb read %d ] = %d, fname=%s\n", xfer, n, h->fname);
if(n != xfer) {
if((errno == ETIMEDOUT) && (h->desc != -1)) {
- I("[ timeout ]\n");
+ D("[ timeout ]\n");
if(n > 0){
data += n;
len -= n;
}
continue;
}
- E("ERROR: n = %d, errno = %d \n",
+ D("ERROR: n = %d, errno = %d \n",
n, errno);
return -1;
}
data += xfer;
}
- I("-- usb_read --\n");
+ D("-- usb_read --\n");
return 0;
}
int usb_close(usb_handle *h)
{
- I("[ usb close ... ]\n");
+ D("[ usb close ... ]\n");
sdb_mutex_lock(&usb_lock);
h->next->prev = h->prev;
h->prev->next = h->next;
/* tizen specific */
n = ioctl(usb->desc, USBDEVFS_RESET);
if(n != 0) {
- E("[ usb reset failed %s fd = %d]\n", usb->fname, usb->desc);
+ D("[ usb reset failed %s fd = %d]\n", usb->fname, usb->desc);
goto fail;
}
n = ioctl(usb->desc, USBDEVFS_SETCONFIGURATION, &bConfigurationValue);
n = ioctl(usb->desc, USBDEVFS_CLAIMINTERFACE, &interface);
if(n != 0) {
- E("[ usb claim failed %s fd = %d]\n", usb->fname, usb->desc);
+ D("[ usb claim failed %s fd = %d]\n", usb->fname, usb->desc);
goto fail;
}
}
return;
fail:
- E("[ usb open %s error=%d]\n",
+ D("[ usb open %s error=%d]\n",
usb->fname, errno);
if(usb->desc >= 0) {
sdb_close(usb->desc);
void* device_poll_thread(void* unused)
{
- I("Created device thread\n");
+ D("Created device thread\n");
for(;;) {
/* XXX use inotify */
find_usb_device("/dev/bus/usb", register_device);
#include "sysdeps.h"
-//#define TRACE_TAG TRACE_USB
-#define LOG_TAG "SDBD_TRACE_USB"
+#define TRACE_TAG TRACE_USB
#include "log.h"
#include "sdb.h"
if (fd < 0) {
// to support older kernels
//fd = unix_open("/dev/android", O_RDWR);
- E("[ opening %s device failed ]\n", USB_NODE_FILE);
+ D("[ opening %s device failed ]\n", USB_NODE_FILE);
}
if (fd < 0) {
sdb_sleep_ms(1000);
}
} while (fd < 0);
- //D("[ opening device succeeded ]\n");
+ D("[ opening device succeeded ]\n");
if (close_on_exec(fd) < 0) {
- E("[closing fd exec failed ]\n");
+ D("[closing fd exec failed ]\n");
}
usb->fd = fd;
- //D("[ usb_thread - registering device ]\n");
+ D("[ usb_thread - registering device ]\n");
register_usb_transport(usb, 0, 1);
}
{
int n;
- //D("about to write (fd=%d, len=%d)\n", h->fd, len);
+ D("about to write (fd=%d, len=%d)\n", h->fd, len);
n = sdb_write(h->fd, data, len);
if(n != len) {
- E("ERROR: fd = %d, n = %d, errno = %d\n",
+ D("ERROR: fd = %d, n = %d, errno = %d\n",
h->fd, n, errno);
return -1;
}
- //D("[ done fd=%d ]\n", h->fd);
+ D("[ done fd=%d ]\n", h->fd);
return 0;
}
int linux_usb_read(usb_handle *h, void *data, size_t len)
{
- //D("about to read (fd=%d, len=%zu)\n", h->fd, len);
+ D("about to read (fd=%d, len=%zu)\n", h->fd, len);
int l = len;
while (l > 0) {
/* The sdb_read does not support read larger than 4096 bytes at once.
if (errno == EINTR) {
continue;
} else {
- E("ERROR: fd = %d, n = %d, errno = %d\n", h->fd, n, errno);
+ D("ERROR: fd = %d, n = %d, errno = %d\n", h->fd, n, errno);
return -1;
}
}
l = (l >= n) ? l - n : 0;
data = ((char*)data) + n;
}
- //D("[ done fd=%d ]\n", h->fd);
+ D("[ done fd=%d ]\n", h->fd);
return 0;
}
h = calloc(1, sizeof(usb_handle));
if (h == NULL) {
- E("failed to allocate memory of usb_handle\n");
+ D("failed to allocate memory of usb_handle\n");
return;
}
#if 0 /* tizen specific */
fd = unix_open("/dev/android_sdb_enable", O_RDWR);
if (fd < 0) {
- E("failed to open /dev/android_sdb_enable\n");
+ D("failed to open /dev/android_sdb_enable\n");
} else {
close_on_exec(fd);
}
#endif
- I("[ usb_init - starting thread ]\n");
+ D("[ usb_init - starting thread ]\n");
if(sdb_thread_create(&tid, usb_open_thread, h)){
fatal_errno("cannot create usb thread");
}
void linux_usb_kick(usb_handle *h)
{
- I("usb_kick\n");
+ D("usb_kick\n");
sdb_mutex_lock(&h->lock);
sdb_close(h->fd);
h->fd = -1;