FreeCalypso > hg > freecalypso-tools
annotate uptools/libcoding/hexencode.c @ 1012:11391cb6bdc0
patch from fixeria: doc change from SE K2x0 to K2xx
Since their discovery in late 2022, Sony Ericsson K200 and K220 phones
were collectively referred to as SE K2x0 in FreeCalypso documentation.
However, now that SE K205 has been discovered as yet another member
of the same family (same PCBA in different case), it makes more sense
to refer to the whole family as SE K2xx.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 23 Sep 2024 12:23:20 +0000 |
parents | ae2556e256a4 |
children |
rev | line source |
---|---|
361
ae2556e256a4
uptools/libcoding: implemented function for generating hex strings
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
ae2556e256a4
uptools/libcoding: implemented function for generating hex strings
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This module contains the function for generating hex strings. |
ae2556e256a4
uptools/libcoding: implemented function for generating hex strings
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
ae2556e256a4
uptools/libcoding: implemented function for generating hex strings
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
ae2556e256a4
uptools/libcoding: implemented function for generating hex strings
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <sys/types.h> |
ae2556e256a4
uptools/libcoding: implemented function for generating hex strings
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdio.h> |
ae2556e256a4
uptools/libcoding: implemented function for generating hex strings
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 |
ae2556e256a4
uptools/libcoding: implemented function for generating hex strings
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 make_hex_string(inbuf, len, outbuf) |
ae2556e256a4
uptools/libcoding: implemented function for generating hex strings
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 u_char *inbuf; |
ae2556e256a4
uptools/libcoding: implemented function for generating hex strings
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 unsigned len; |
ae2556e256a4
uptools/libcoding: implemented function for generating hex strings
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 char *outbuf; |
ae2556e256a4
uptools/libcoding: implemented function for generating hex strings
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 { |
ae2556e256a4
uptools/libcoding: implemented function for generating hex strings
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 char *dp = outbuf; |
ae2556e256a4
uptools/libcoding: implemented function for generating hex strings
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 unsigned n; |
ae2556e256a4
uptools/libcoding: implemented function for generating hex strings
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 |
ae2556e256a4
uptools/libcoding: implemented function for generating hex strings
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 for (n = 0; n < len; n++) { |
ae2556e256a4
uptools/libcoding: implemented function for generating hex strings
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 sprintf(dp, "%02X", inbuf[n]); |
ae2556e256a4
uptools/libcoding: implemented function for generating hex strings
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 dp += 2; |
ae2556e256a4
uptools/libcoding: implemented function for generating hex strings
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 } |
ae2556e256a4
uptools/libcoding: implemented function for generating hex strings
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 *dp = '\0'; |
ae2556e256a4
uptools/libcoding: implemented function for generating hex strings
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 } |