misc: Use osmo_hexdump instead of the local variant

This commit is contained in:
Holger Hans Peter Freyther
2011-07-15 15:55:22 +02:00
parent 83e051ce6e
commit f1c60623ae
4 changed files with 4 additions and 25 deletions

View File

@@ -136,7 +136,7 @@ static void apdu_split_inbyte(struct apdu_split *as, uint8_t ch)
break; break;
case APDU_S_SW2: case APDU_S_SW2:
apdu_buf_append(as, ch); 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); as->apdu_out_cb(as->apdu_buf, as->apdu_len, as->user_data);
set_state(as, APDU_S_CLA); set_state(as, APDU_S_CLA);
break; break;

View File

@@ -40,6 +40,7 @@
#include <osmocom/core/gsmtap.h> #include <osmocom/core/gsmtap.h>
#include <osmocom/core/gsmtap_util.h> #include <osmocom/core/gsmtap_util.h>
#include <osmocom/core/utils.h>
static struct usb_dev_handle *udev; static struct usb_dev_handle *udev;
static struct apdu_split *as; 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) 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); gsmtap_send_sim(buf, len);
} }
@@ -189,7 +190,7 @@ int main(int argc, char **argv)
exit(1); exit(1);
} }
if (rc > 0) { if (rc > 0) {
//printf("URB: %s\n", hexdump(buf, rc)); //printf("URB: %s\n", osmo_hexdump(buf, rc));
process_usb_msg(buf, rc); process_usb_msg(buf, rc);
msg_count++; msg_count++;
byte_count += rc; byte_count += rc;

View File

@@ -28,26 +28,6 @@
#include <usb.h> #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) static struct usb_device *find_usb_device (uint16_t vendor_id, uint16_t product_id)
{ {
struct usb_bus *bus; struct usb_bus *bus;

View File

@@ -21,8 +21,6 @@
#include <stdint.h> #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); struct usb_dev_handle *usb_find_open(uint16_t vendor_id, uint16_t product_id);
#endif #endif