示例#1
0
int firestep_init(){
  if (fdrTinyG >= 0) {
    return 0; // already started
  }

  const char * path = "/dev/ttyUSB0";
  char cmdbuf[CMDMAX+1];
	int rc;

  sprintf(cmdbuf, "stty 115200 -F %s", path);
  rc = callSystem(cmdbuf);
  if (rc) { return rc; }

  sprintf(cmdbuf, "stty 1400:4:1cb2:a00:3:1c:7f:15:4:1:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0 -F %s", path);
  rc = callSystem(cmdbuf);
  if (rc) { return rc; }

  fdwTinyG = fdrTinyG = open(path, O_RDWR | O_ASYNC | O_NONBLOCK);
  if (fdrTinyG < 0) {
    rc = errno;
    LOGERROR2("Cannot open %s (errno %d)", path, rc);
    return rc;
  }
  LOGINFO1("firestep_init %s (open for write) ", path);

  LOGRC(rc, "pthread_create(firestep_reader) -> ", pthread_create(&tidReader, NULL, &firestep_reader, NULL));

	//firestep_config();

  return rc;
}
示例#2
0
文件: fuse.c 项目: firepick1/FireFuse
static void * firefuse_init(struct fuse_conn_info *conn) {
    int rc = 0;

    firelog_init(FIRELOG_FILE, FIRELOG_INFO);
    //firelog_init(FIRELOG_FILE, FIRELOG_TRACE);
    LOGINFO4("FireFUSE %d.%d.%d fuse_root:%s", FireFUSE_VERSION_MAJOR, FireFUSE_VERSION_MINOR, FireFUSE_VERSION_PATCH, fuse_root);
    LOGINFO3("PID:%d UID:%d GIT:%s", (int) getpid(), (int)getuid(), FIREFUSE_GIT_COMMIT);

    pConfigJson = firerest_config(CONFIG_JSON);

    memset(echoBuf, 0, sizeof(echoBuf));

    headcam_image.pData = NULL;
    headcam_image.length = 0;
    headcam_image_fstat.pData = NULL;
    headcam_image_fstat.length = 0;

    LOGRC(rc, "pthread_create(&tidCamera...) -> ", pthread_create(&tidCamera, NULL, &firefuse_cameraThread, NULL));

    //firestep_init();

    return NULL; /* init */
}