cake
/
p7utils
Archived
1
0
Fork 0

Modified dump to use new packet I/O interface

This commit is contained in:
Thomas Touhey 2017-01-04 13:38:40 +01:00
parent 081b4e0ab3
commit 678ee10811
1 changed files with 26 additions and 27 deletions

View File

@ -10,7 +10,6 @@
#include "main.h"
#include <inttypes.h>
#include <libp7/packetio.h>
#define info (response->ack)
#define numformat "%" PRIuFAST32
#define addrformat "0x%08" PRIxFAST32
@ -25,58 +24,58 @@
int dump(p7_handle_t *handle)
{
/* get response buffer */
const p7_packet_t *response = p7_get_response(handle);
const p7_packet_t *resp = 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)
if (resp->type != p7_pt_ack || !resp->extended)
return (p7_error_unknown);
/* dump information */
/* - wiped out things - */
if (info.preprog_rom_wiped)
if (resp->preprog_rom_wiped)
log("Warning: Preprogrammed ROM information looks wiped out !\n");
if (info.bootcode_wiped)
if (resp->bootcode_wiped)
log("Warning: Bootcode information looks wiped out !\n");
/* - preprogrammed ROM - */
if (!info.preprog_rom_wiped) {
if (!resp->preprog_rom_wiped) {
printf("Preprogrammed ROM capacity : " numformat "o\n",
info.preprog_rom_capacity);
resp->preprog_rom_capacity);
printf("Preprogrammed ROM version : %02u.%02u.%04u\n",
info.preprog_rom_version.major, info.preprog_rom_version.minor,
info.preprog_rom_version.rev);
resp->preprog_rom_version.major, resp->preprog_rom_version.minor,
resp->preprog_rom_version.rev);
printf("Preprogrammed ROM type : %s\n",
info.preprog_rom_version.type);
resp->preprog_rom_version.type);
}
/* - ROM - */
printf("ROM capacity: " numformat "o\n", info.flash_rom_capacity);
printf("ROM capacity: " numformat "o\n", resp->flash_rom_capacity);
/* - RAM - */
printf("RAM capacity: " numformat "o\n", info.ram_capacity);
printf("RAM capacity: " numformat "o\n", resp->ram_capacity);
/* - Bootcode - */
if (!info.bootcode_wiped) {
if (!resp->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: " addrformat "\n", info.bootcode_offset);
printf("Bootcode size: " numformat "o\n", info.bootcode_size);
resp->bootcode_version.major, resp->bootcode_version.minor,
resp->bootcode_version.rev);
printf("Bootcode type: %s\n", resp->bootcode_version.type);
printf("Bootcode offset: " addrformat "\n", resp->bootcode_offset);
printf("Bootcode size: " numformat "o\n", resp->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: " addrformat "\n", info.os_offset);
printf("OS size: " numformat "o\n", info.os_size);
resp->os_version.major, resp->os_version.minor, resp->os_version.rev);
printf("OS type: %s\n", resp->os_version.type);
printf("OS offset: " addrformat "\n", resp->os_offset);
printf("OS size: " numformat "o\n", resp->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 (probably out of date): %s\n", info.cpuid);
resp->protocol_version.major, resp->protocol_version.minor);
printf("Product ID: %s\n", resp->product_id);
printf("Username: %s\n", resp->username);
printf("Hardware ID: %s\n", resp->hwid);
printf("CPU ID (probably out of date): %s\n", resp->cpuid);
return (0);
}