mirror of
https://gitea.osmocom.org/sim-card/simtrace.git
synced 2026-03-16 21:28:36 +03:00
misc: Use osmo_hexdump instead of the local variant
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user