diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-07-15 15:55:22 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-07-15 16:09:55 +0200 |
commit | f1c60623ae07b9ce87df0567ec6e5b91c41daa95 (patch) | |
tree | 3ebf82214d215fcb6c0837f0335d31eea44a4e51 /host | |
parent | 83e051ce6e26fa5626d12e0bd1e01d1af33e040b (diff) |
misc: Use osmo_hexdump instead of the local variant
Diffstat (limited to 'host')
-rw-r--r-- | host/apdu_split.c | 2 | ||||
-rw-r--r-- | host/main.c | 5 | ||||
-rw-r--r-- | host/usb_helper.c | 20 | ||||
-rw-r--r-- | host/usb_helper.h | 2 |
4 files changed, 4 insertions, 25 deletions
diff --git a/host/apdu_split.c b/host/apdu_split.c index 53c196a..f2cfb7a 100644 --- a/host/apdu_split.c +++ b/host/apdu_split.c @@ -136,7 +136,7 @@ static void apdu_split_inbyte(struct apdu_split *as, uint8_t ch) break; case APDU_S_SW2: apdu_buf_append(as, ch); - //printf("APDU: %s\n", hexdump(as->apdu_buf, as->apdu_len)); + //printf("APDU: %s\n", osmo_hexdump(as->apdu_buf, as->apdu_len)); as->apdu_out_cb(as->apdu_buf, as->apdu_len, as->user_data); set_state(as, APDU_S_CLA); break; diff --git a/host/main.c b/host/main.c index a913d1d..a1e5600 100644 --- a/host/main.c +++ b/host/main.c @@ -40,6 +40,7 @@ #include <osmocom/core/gsmtap.h> #include <osmocom/core/gsmtap_util.h> +#include <osmocom/core/utils.h> static struct usb_dev_handle *udev; static struct apdu_split *as; @@ -76,7 +77,7 @@ static int gsmtap_send_sim(const uint8_t *apdu, unsigned int len) static void apdu_out_cb(uint8_t *buf, unsigned int len, void *user_data) { - printf("APDU: %s\n", hexdump(buf, len)); + printf("APDU: %s\n", osmo_hexdump(buf, len)); gsmtap_send_sim(buf, len); } @@ -189,7 +190,7 @@ int main(int argc, char **argv) exit(1); } if (rc > 0) { - //printf("URB: %s\n", hexdump(buf, rc)); + //printf("URB: %s\n", osmo_hexdump(buf, rc)); process_usb_msg(buf, rc); msg_count++; byte_count += rc; diff --git a/host/usb_helper.c b/host/usb_helper.c index 0830fe4..231363a 100644 --- a/host/usb_helper.c +++ b/host/usb_helper.c @@ -28,26 +28,6 @@ #include <usb.h> -const char * -hexdump(const void *data, unsigned int len) -{ - static char string[65535]; - unsigned char *d = (unsigned char *) data; - unsigned int i, left, ofs; - - string[0] = '\0'; - ofs = snprintf(string, sizeof(string)-1, "(%u): ", len); - - left = sizeof(string) - ofs; - for (i = 0; len--; i += 3) { - if (i >= sizeof(string) -4) - break; - snprintf(string+ofs+i, 4, " %02x", *d++); - } - string[sizeof(string)-1] = '\0'; - return string; -} - static struct usb_device *find_usb_device (uint16_t vendor_id, uint16_t product_id) { struct usb_bus *bus; diff --git a/host/usb_helper.h b/host/usb_helper.h index 60c802a..13f96f8 100644 --- a/host/usb_helper.h +++ b/host/usb_helper.h @@ -21,8 +21,6 @@ #include <stdint.h> -const char *hexdump(const void *data, unsigned int len); - struct usb_dev_handle *usb_find_open(uint16_t vendor_id, uint16_t product_id); #endif |