78 lines
2.9 KiB
C
78 lines
2.9 KiB
C
/* ************************************************************************** */
|
|
/* _____ _ */
|
|
/* dump.c |_ _|__ _ _| |__ ___ _ _ */
|
|
/* | Project : p7 | |/ _ \| | | | '_ \ / _ \ | | | */
|
|
/* | | (_) | |_| | | | | __/ |_| | */
|
|
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
|
|
/* Last updated: 2016/08/26 20:14:25 |___/ */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
#include "main.h"
|
|
#include <libp7/packetio.h>
|
|
#define info (response->ack)
|
|
|
|
/**
|
|
* dump:
|
|
* Dump calculator information.
|
|
*
|
|
* @arg handle the libp7 handle
|
|
* @return the error code (0 if ok).
|
|
*/
|
|
|
|
int dump(p7_handle_t *handle)
|
|
{
|
|
/* get response buffer */
|
|
const p7_packet_t *response = p7_get_response(handle);
|
|
|
|
/* send get info command and check response */
|
|
int err;
|
|
if ((err = p7_send_cmdsys_getinfo(handle)))
|
|
return (err);
|
|
if (response->type != p7_pt_ack || !response->ack.extended)
|
|
return (p7_error_unknown);
|
|
|
|
/* dump information */
|
|
/* - wiped out things - */
|
|
if (info.preprog_rom_wiped)
|
|
log("Warning: Preprogrammed ROM information looks wiped out !\n");
|
|
if (info.bootcode_wiped)
|
|
log("Warning: Bootcode information looks wiped out !\n");
|
|
|
|
/* - preprogrammed ROM - */
|
|
if (!info.preprog_rom_wiped) {
|
|
printf("Preprogrammed ROM capacity : %luo\n", info.preprog_rom_capacity);
|
|
printf("Preprogrammed ROM version : %02u.%02u.%02u\n",
|
|
info.preprog_rom_version.major, info.preprog_rom_version.minor,
|
|
info.preprog_rom_version.rev);
|
|
printf("Preprogrammed ROM type : \"%s\"\n", info.preprog_rom_version.type);
|
|
}
|
|
/* - ROM - */
|
|
printf("ROM capacity : %luo\n", info.flash_rom_capacity);
|
|
/* - RAM - */
|
|
printf("RAM capacity : %luo\n", info.ram_capacity);
|
|
/* - Bootcode - */
|
|
if (!info.bootcode_wiped) {
|
|
printf("Bootcode version : %02u.%02u.%02u\n",
|
|
info.bootcode_version.major, info.bootcode_version.minor,
|
|
info.bootcode_version.rev);
|
|
printf("Bootcode type : \"%s\"\n", info.bootcode_version.type);
|
|
printf("Bootcode offset : %#08lx\n", info.bootcode_offset);
|
|
printf("Bootcode size : %luo\n", info.bootcode_size);
|
|
}
|
|
/* - OS - */
|
|
printf("OS version : %02u.%02u.%02u\n",
|
|
info.os_version.major, info.os_version.minor, info.os_version.rev);
|
|
printf("OS type : \"%s\"\n", info.os_version.type);
|
|
printf("OS offset : %#08lx\n", info.os_offset);
|
|
printf("OS size : %luo\n", info.os_size);
|
|
/* - Miscallenous info - */
|
|
printf("Protocol version : %01u.%02u\n",
|
|
info.protocol_version.major, info.protocol_version.minor);
|
|
printf("Product ID : \"%s\"\n", info.product_id);
|
|
printf("Username : \"%s\"\n", info.username);
|
|
printf("Hardware ID : \"%s\"\n", info.hwid);
|
|
printf("CPU ID : \"%s\"\n", info.cpuid);
|
|
|
|
return (0);
|
|
}
|