mirror of
https://github.com/linux-msm/rmtfs.git
synced 2024-11-12 01:19:17 +00:00
1f12cea75b
The rmtfs tool pushlishes the two QMI services "rmtfs" and "rfsa", and implements the necessary requests for rmtfs that's needed to boot the modem subsystem on a Qualcomm based board. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
49 lines
830 B
C
49 lines
830 B
C
#include <ctype.h>
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include "util.h"
|
|
|
|
static uint8_t to_hex(uint8_t ch)
|
|
{
|
|
ch &= 0xf;
|
|
return ch <= 9 ? '0' + ch : 'a' + ch - 10;
|
|
}
|
|
|
|
void print_hex_dump(const char *prefix, const void *buf, size_t len)
|
|
{
|
|
const uint8_t *ptr = buf;
|
|
size_t linelen;
|
|
uint8_t ch;
|
|
char line[16 * 3 + 16 + 1];
|
|
int li;
|
|
int i;
|
|
int j;
|
|
|
|
for (i = 0; i < len; i += 16) {
|
|
linelen = MIN(16, len - i);
|
|
li = 0;
|
|
|
|
for (j = 0; j < linelen; j++) {
|
|
ch = ptr[i + j];
|
|
line[li++] = to_hex(ch >> 4);
|
|
line[li++] = to_hex(ch);
|
|
line[li++] = ' ';
|
|
}
|
|
|
|
for (; j < 16; j++) {
|
|
line[li++] = ' ';
|
|
line[li++] = ' ';
|
|
line[li++] = ' ';
|
|
}
|
|
|
|
for (j = 0; j < linelen; j++) {
|
|
ch = ptr[i + j];
|
|
line[li++] = isprint(ch) ? ch : '.';
|
|
}
|
|
|
|
line[li] = '\0';
|
|
|
|
printf("%s %04x: %s\n", prefix, i, line);
|
|
}
|
|
}
|