cake
/
libp7
Archived
1
0
Fork 1

Updated doc, and here we are, v2!

This commit is contained in:
Thomas Touhey 2017-01-06 15:14:30 +01:00
parent dee0e5a1d9
commit 55a3892d50
7 changed files with 34 additions and 26 deletions

View File

@ -28,7 +28,7 @@
# Project version
MAJOR := 2
MINOR := 0
INDEV := y
INDEV :=
VERSION := $(MAJOR).$(MINOR)$(if $(INDEV),-indev)
#******************************************************************************#

View File

@ -17,9 +17,9 @@ SYNOPSIS
int err;
p7_handle_t *handle;
err = p7_cinit(&handle, 1, 1, NULL);
err = p7_init(&handle, 1, 1);
if (err) {
printf("Couldn't initialize libp7/communication: %s\n", p7_strerror(err));
printf("Couldn't initialize communication: %s\n", p7_strerror(err));
return (3);
}
@ -28,17 +28,17 @@ err = fp ? p7_sendfile(handle, fp, NULL, "myaddin.g1a", "fls0", 1, NULL, NULL)
: p7_error_unknown;
if (err) {
printf("Couldn't send file: %s\n", p7_strerror(err));
p7_exit(handle, 1);
return (3);
}
p7_exit(handle);
p7_exit(handle, 1);
----
DESCRIPTION
-----------
libp7 implements casio's communication protocol 7.00, which allows users to
send and receive files and information from their calculators. It will read and
write from a filestream, generally with a char device behind, like */dev/ttyUSBx*.
send and receive files and information from their calculators.
SEE ALSO
--------

View File

@ -0,0 +1 @@
p7_backup_rom.3.txt

View File

@ -7,7 +7,7 @@ Thomas "Cakeisalie5" Touhey
NAME
----
p7_backup_rom, p7_backup_boot - backup software element of the calculator
p7_backup_rom, p7_backup_boot, p7_backup_casiowin_entry - backup software element of the calculator
SYNOPSIS
--------
@ -17,9 +17,12 @@ SYNOPSIS
int p7_backup_rom(p7_handle_t *handle, FILE *file);
int p7_backup_boot(p7_handle_t *handle, FILE *file);
int p7_backup_casiowin_entry(p7_handle_t *handle, p7_casiowin_entry_t *entry);
p7_casiowin_entry_t cwe;
p7_backup_rom(handle, stdout);
p7_backup_boot(handle, stdout);
p7_backup_casiowin_entry(handle, &cwe);
----
DESCRIPTION
@ -28,6 +31,7 @@ These functions backup software elements from the calculator using Protocol 7:
* *p7_backup_rom* backups the flash ROM (0x400000 bytes)
* *p7_backup_boot* backups the boot code (0x100000 bytes)
* *p7_backup_casiowin_entry* backups the CASIOWIN entry (0x80 bytes)
RETURN VALUE
------------

View File

@ -16,7 +16,8 @@ SYNOPSIS
#include <libp7.h>
int p7_copyfile(p7_handle_t *handle,
char *dirname, char *filename, char *newdir, char *newname, char *devname);
char *dirname, char *filename,
char *newdir, char *newname, char *devname);
p7_copyfile(handle, "hidden", "file.txt", NULL, "VISIBLE.txt", "fls0");
----

View File

@ -34,7 +34,9 @@ the code of the error that happened. This used to be stored in a global called
*p7_error_nocalc*::
Calculator was disconnected.
*p7_error_noaccess*::
Could not get access to the char device.
Could not get access to the calculator.
*p7_error_nochar*::
Provided file wasn't a char device.
*p7_error_timeout*::
Calculator has timed out.
*p7_error_irrecoverable*::

View File

@ -15,10 +15,12 @@ SYNOPSIS
----
#include <libp7.h>
int p7_init(p7_handle_t **handle, int active, int check,
FILE *readstream, FILE *writestream);
int p7_init(p7_handle_t **handle, int active, int check);
int p7_finit(p7_handle_t **handle, int active, int check,
FILE *rstream, FILE *wstream);
int p7_cinit(p7_handle_t **handle, int active, int check,
const char *path);
const char *path, int tries);
void p7_exit(p7_handle_t *handle, int term);
p7_handle_t *handle;
@ -33,29 +35,27 @@ p7_exit(handle, 1);
DESCRIPTION
-----------
*p7_init* will create a handle that other functions will use to communicate with
the calculator - it must be called before any other function from libp7. It
will also initiate communication and detect environment - what *p7_start* used
to do in previous versions of the library.
All initialization functions will create a handle that other functions will use
to communicate with the calculator - one of them has to be called before any
other function from libp7. They will also initiate communication and detect
the environment - what *p7_start* used to do in previous versions of the
library.
*p7_cinit* will also do that, but by opening the char device that has got the
path you give to it. Technically, you can use a regular file or anything else,
but this is a *bad* idea, use it only with char devices (like */dev/ttyUSBx*).
*p7_init* will try to find a device using the other functions.
For *p7_cinit*, if the passed character device is *NULL*, the library will use
the first appropriate character device it finds (direct calculator
communication, Util-Pocket cable, official CASIO cable).
*p7_cinit* will try to find a character device corresponding to the calculator
(*/dev/ttyUSBx*), or will use the one you give to it (if *path* is not *NULL*).
Use *tries = 0* to use the default number of tries.
*p7_finit* will use the libc filestreams you give to it as the calculator.
*p7_exit* will terminate communication (if active) and free the handle. It will
also close the given stream.
*rstream* and *wstream* are the filestreams from which the handle will read
and write. It is generally generated from a char device like */dev/ttyUSBx*.
The *active* parameter is a boolean indicating if we start as the active or
the passive side. Active side is useful for sending files and commands (client)
where passive side receives straight away commands (and files) and screen
streaming (server). Your application will most likely start in active mode.
streaming (server). Your application will most likely start in *active* mode.
Communications start with an initial check packet and end with a termination
packet. You may want to start communication with the first instance of your