Example #1
0
int main(int argc, char *argv[])
{
	message_set_logfile ("NEMO.LOG");

#ifdef _WIN32
	const char* name = "COM1";
#else
	const char* name = "/dev/ttyS0";
#endif

	if (argc > 1) {
		name = argv[1];
	}

	message ("DEVICE=%s\n", name);

	dc_status_t a = test_dump_memory (name, "NEMO.DMP");

	message ("\nSUMMARY\n");
	message ("-------\n");
	message ("test_dump_memory:          %s\n", errmsg (a));

	message_set_logfile (NULL);

	return 0;
}
int main(int argc, char *argv[])
{
	message_set_logfile ("SENSUSULTRA.LOG");

#ifdef _WIN32
	const char* name = "COM1";
#else
	const char* name = "/dev/ttyS0";
#endif

	if (argc > 1) {
		name = argv[1];
	}

	message ("DEVICE=%s\n", name);

	device_status_t a = test_dump_memory_data (name, "SENSUSULTRA_DATA.DMP");
	device_status_t b = test_dump_memory_user (name, "SENSUSULTRA_USER.DMP");
	device_status_t c = test_dump_memory_dives (name, "SENSUSULTRA_DIVES.DMP");

	message ("SUMMARY\n");
	message ("-------\n");
	message ("test_dump_memory_data:     %s\n", errmsg (a));
	message ("test_dump_memory_user:     %s\n", errmsg (b));
	message ("test_dump_memory_dives:    %s\n", errmsg (c));

	message_set_logfile (NULL);

	return 0;
}
Example #3
0
int dump_dives(program_options_t *options) {
    dc_family_t backend = DC_FAMILY_NULL;
    dc_loglevel_t loglevel = DC_LOGLEVEL_WARNING;
    const char *logfile = "output.log";
    const char *name = NULL;
    const char *fingerprint = NULL;
    unsigned int model = 0;

    if (options->backend != NULL) {
        backend = lookup_type(options->backend);
    }
    signal (SIGINT, sighandler);

    message_set_logfile(logfile);

    dc_context_t *context = NULL;

    /* create a new context */
    dc_status_t rc = dc_context_new(&context);
    if (rc != DC_STATUS_SUCCESS) {
        message_set_logfile(NULL);
        return EXIT_FAILURE;
    }

    dc_context_set_loglevel(context, loglevel);
    dc_context_set_logfunc(context, logfunc, NULL);

    dc_descriptor_t *descriptor = NULL;
    rc = search(&descriptor, name, backend, model);
    if (rc != DC_STATUS_SUCCESS) {
        message_set_logfile(NULL);
        return EXIT_FAILURE;
    }

    /* fail if no device descriptor found */
    if (descriptor == NULL) {
        WARNING("No matching device found");
        /* FIXME: bail out to usage information */
        message_set_logfile(NULL);
        return EXIT_FAILURE;
    }

    dc_buffer_t *fp = fpconvert(fingerprint);
    rc = dowork(context, descriptor, options, fp);
    dc_buffer_free(fp);
    /* FIXME: why aren't calls to errmsg working? */
    // message("Result: %s\n", errmsg(rc));

    dc_descriptor_free(descriptor);
    dc_context_free(context);

    message_set_logfile(NULL);

    return rc != DC_STATUS_SUCCESS ? EXIT_FAILURE : EXIT_SUCCESS;
}
int main(int argc, char *argv[])
{
	message_set_logfile ("SMART.LOG");

	device_status_t a = test_dump_memory ("SMART.DMP");

	message ("\nSUMMARY\n");
	message ("-------\n");
	message ("test_dump_memory:          %s\n", errmsg (a));

	message_set_logfile (NULL);

	return 0;
}
Example #5
0
int main(int argc, char *argv[])
{
	message_set_logfile ("OSTC-FWUPDATE.LOG");

#ifdef _WIN32
	const char* name = "COM1";
#else
	const char* name = "/dev/ttyUSB0";
#endif
	const char *hexfile = NULL;
	int ostc3 = 0;

	if (argc > 1) {
		name = argv[1];
	}
	if (argc > 2) {
		hexfile = argv[2];
	}
	if (argc > 3) {
	   if (strcmp(argv[3], "-3") == 0) {
		   ostc3 = 1;
	   } else {
		   ostc3 = 0;
	   }
	}

	message ("DEVICE=%s\n", name);
	message ("HEXFILE=%s\n", hexfile);

	dc_status_t a = fwupdate (name, hexfile, ostc3);

	message ("SUMMARY\n");
	message ("-------\n");
	message ("fwupdate: %s\n", errmsg (a));

	message_set_logfile (NULL);

	return 0;
}