diff --git a/doc/p7screen.1.txt b/doc/p7screen.1.txt index c12010f..a13a13a 100644 --- a/doc/p7screen.1.txt +++ b/doc/p7screen.1.txt @@ -30,15 +30,10 @@ value next to them. Display help page and quit. *-v, --version*:: Display version and quit. -*--com *:: - The serial device, if you want to communicate with a calculator connected - using a USB-to-serial cable. - :: - If this option isn't used, the program will look for a calculator connected - using direct USB. *-z ZOOM, --zoom=ZOOM*:: Change the zoom (will change the window size too). SEE ALSO -------- +*p7*(1), *libp7*(3) diff --git a/src/p7/main.c b/src/p7/main.c index 578b4c4..77dcc72 100644 --- a/src/p7/main.c +++ b/src/p7/main.c @@ -191,7 +191,8 @@ int main(int ac, char **av) /* Initialize libp7 and communication */ p7_handle_t *handle = NULL; int err; - if (args.com) err = p7_cominit(&handle, args.initflags, args.com); + if (args.com) err = p7_cominit(&handle, args.initflags, args.com, + &p7_default_settings); else err = p7_init(&handle, args.initflags); if (err) { /* display error */ diff --git a/src/p7os/main.c b/src/p7os/main.c index c1e04dc..840a600 100644 --- a/src/p7os/main.c +++ b/src/p7os/main.c @@ -114,7 +114,8 @@ int main(int ac, char **av) /* Initialize libp7 and communication */ p7_handle_t *handle = NULL; int err; - if (args.com) err = p7_cominit(&handle, initflags, args.com); + if (args.com) err = p7_cominit(&handle, initflags, args.com, + &p7_default_settings); else err = p7_init(&handle, initflags); if (err) goto fail; @@ -139,7 +140,8 @@ int main(int ac, char **av) sleep(1); /* re-open the handle */ - if (args.com) err = p7_cominit(&handle, initflags, args.com); + if (args.com) err = p7_cominit(&handle, initflags, args.com, + &p7_default_settings); else err = p7_init(&handle, initflags); if (err) { p7_exit(handle); diff --git a/src/p7os/prepare.c b/src/p7os/prepare.c index 2f6c36a..7160d12 100644 --- a/src/p7os/prepare.c +++ b/src/p7os/prepare.c @@ -12,8 +12,8 @@ /* ************************************************************************** */ /* Embedded update.exe */ /* ************************************************************************** */ -#define cake_exe_str (_binary_cake_exe_bin_start) -#define cake_exe_end (_binary_cake_exe_bin_end) +#define cake_exe_str ((char*)&_binary_cake_exe_bin_start) +#define cake_exe_end ((char*)&_binary_cake_exe_bin_end) extern char _binary_cake_exe_bin_start[]; extern char _binary_cake_exe_bin_end[]; @@ -38,7 +38,7 @@ int prepare_ops(p7_handle_t *handle, FILE *uexe, p7_disp_t disp) err = p7_sendexe_file(handle, uexe, 0x88030000, 0x88030000, disp); else { err = p7_sendexe_mem(handle, cake_exe_str, - (size_t)((char*)&cake_exe_end - (char*)&cake_exe_str), + (size_t)(cake_exe_end - cake_exe_str), 0x88030000, 0x88030000, disp); fclose(uexe); } diff --git a/src/p7screen/args.c b/src/p7screen/args.c index 1f923ee..b2f9e53 100644 --- a/src/p7screen/args.c +++ b/src/p7screen/args.c @@ -27,17 +27,12 @@ QUOTE(BIN) " - from " QUOTE(NAME) " v" QUOTE(VERSION) " (licensed under GPLv2)\n /* Help message */ static const char help_main[] = "Usage: " QUOTE(BIN) " [--help|-h] [--version|-v]\n" -" [--com ]\n" "\n" "Displays the streamed screen from a CASIO fx calculator.\n" "\n" "Options are:\n" " -h, --help Display this help page\n" " -v, --version Displays the version\n" -" --com The serial device, if you want to communicate with a\n" -" calculator connected using a USB-to-serial cable.\n" -" If this option isn't used, the program will look for a\n" -" calculator connected using direct USB.\n" " -z ZOOM Change the zoom (1 to 16)\n" " By default, the zoom will be " QUOTE(DEFAULT_ZOOM) ".\n" "\n" @@ -55,16 +50,13 @@ static const char help_main[] = * * @arg ac the arguments count * @arg av the arguments values - * @arg device pointer to the device * @arg zoom pointer the zoom - * @arg args the parsed args pointer * @return 0 if ok, other if not. */ -int parse_args(int ac, char **av, const char **com, int *zoom) +int parse_args(int ac, char **av, int *zoom) { /* initialize args */ - *com = 0; *zoom = DEFAULT_ZOOM; /* define options */ @@ -72,7 +64,6 @@ int parse_args(int ac, char **av, const char **com, int *zoom) const struct option long_options[] = { {"help", no_argument, NULL, 'h'}, {"version", no_argument, NULL, 'v'}, - {"com", required_argument, NULL, 'c'}, {"zoom", required_argument, NULL, 'z'}, {NULL, 0, NULL, 0} }; @@ -86,8 +77,6 @@ int parse_args(int ac, char **av, const char **com, int *zoom) case 'h': help = 1; break; /* version */ case 'v': version = 1; break; - /* com port */ - case 'c': *com = optarg; break; /* zoom */ case 'z': *zoom = atoi(optarg); @@ -101,8 +90,6 @@ int parse_args(int ac, char **av, const char **com, int *zoom) case '?': if (optopt == 'z') log("-z, --zoom: expected an argument\n"); - else if (optopt == 'c') - log("--com: expected an argument\n"); else break; return (1); diff --git a/src/p7screen/main.c b/src/p7screen/main.c index f6b2542..ae8b7e2 100644 --- a/src/p7screen/main.c +++ b/src/p7screen/main.c @@ -122,14 +122,12 @@ static int display_callback(int w, int h, uint32_t **pixels) int main(int ac, char **av) { /* parse args */ - const char *com; - if (parse_args(ac, av, &com, &zoom)) + if (parse_args(ac, av, &zoom)) return (0); /* Initialize libp7 */ p7_handle_t *handle = NULL; int err; - if (com) err = p7_cominit(&handle, 0, com); - else err = p7_init(&handle, 0); + err = p7_init(&handle, 0); if (err) { /* display error */ switch (err) { diff --git a/src/p7screen/main.h b/src/p7screen/main.h index 68c9f9f..ccbed2d 100644 --- a/src/p7screen/main.h +++ b/src/p7screen/main.h @@ -15,6 +15,6 @@ # define log(S, ...) fprintf(stderr, S, ##__VA_ARGS__) /* all functions */ -int parse_args(int ac, char **av, const char **com, int *zoom); +int parse_args(int ac, char **av, int *zoom); #endif /* MAIN_H */ diff --git a/src/p7servtest/client.c b/src/p7servtest/client.c index aa3da48..62a1325 100644 --- a/src/p7servtest/client.c +++ b/src/p7servtest/client.c @@ -17,7 +17,7 @@ void run_client(int in, int out) /* make the handle */ p7_handle_t *handle = NULL; int err; if ((err = p7_fdinit(&handle, P7_ACTIVE | P7_CHECK | P7_TERM, "client", - in, out))) { + in, out, &p7_default_settings))) { fprintf(stderr, "Client initialization encountered an error: %s\n", p7_strerror(err)); return ; diff --git a/src/p7servtest/server.c b/src/p7servtest/server.c index 850123f..ad20f84 100644 --- a/src/p7servtest/server.c +++ b/src/p7servtest/server.c @@ -84,7 +84,8 @@ static p7_filesystem_t server_filesystems[] = { void run_server(int in, int out) { p7_handle_t *handle = NULL; int err; - if ((err = p7_fdinit(&handle, 0, "server", in, out))) { + if ((err = p7_fdinit(&handle, 0, "server", in, out, + &p7_default_settings))) { fprintf(stderr, "Server encountered an error while initializing: %s\n", p7_strerror(err)); return ;