From 9fb7da7b76fb14520e59dd29f43ac78b9083d141 Mon Sep 17 00:00:00 2001 From: Tormod Volden Date: Thu, 30 Nov 2023 21:21:41 +0100 Subject: [PATCH] xusb/testlibusb: Print vid:pid consistently and with small hex digits Make testlibusb output align better, like lsusb does it. Signed-off-by: Tormod Volden --- examples/testlibusb.c | 2 +- examples/xusb.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/testlibusb.c b/examples/testlibusb.c index 07d54262b..fb5799d03 100644 --- a/examples/testlibusb.c +++ b/examples/testlibusb.c @@ -184,7 +184,7 @@ static void print_device(libusb_device *dev, libusb_device_handle *handle) return; } - printf("Dev (bus %u, device %u): %04X - %04X speed: %s\n", + printf("Bus %03u Device %03u: ID %04x:%04x Speed: %s\n", libusb_get_bus_number(dev), libusb_get_device_address(dev), desc.idVendor, desc.idProduct, speed); diff --git a/examples/xusb.c b/examples/xusb.c index 7df212fb1..7729887b8 100644 --- a/examples/xusb.c +++ b/examples/xusb.c @@ -870,7 +870,7 @@ static int test_device(uint16_t vid, uint16_t pid) uint8_t string_index[3]; // indexes of the string descriptors uint8_t endpoint_in = 0, endpoint_out = 0; // default IN and OUT endpoints - printf("Opening device %04X:%04X...\n", vid, pid); + printf("Opening device %04x:%04x ...\n", vid, pid); handle = libusb_open_device_with_vid_pid(NULL, vid, pid); if (handle == NULL) { @@ -902,8 +902,8 @@ static int test_device(uint16_t vid, uint16_t pid) printf(" length: %d\n", dev_desc.bLength); printf(" device class: %d\n", dev_desc.bDeviceClass); printf(" S/N: %d\n", dev_desc.iSerialNumber); - printf(" VID:PID: %04X:%04X\n", dev_desc.idVendor, dev_desc.idProduct); - printf(" bcdDevice: %04X\n", dev_desc.bcdDevice); + printf(" VID:PID: %04x:%04x\n", dev_desc.idVendor, dev_desc.idProduct); + printf(" bcdDevice: 0x%04x\n", dev_desc.bcdDevice); printf(" iMan:iProd:iSer: %d:%d:%d\n", dev_desc.iManufacturer, dev_desc.iProduct, dev_desc.iSerialNumber); printf(" nb confs: %d\n", dev_desc.bNumConfigurations); // Copy the string descriptors for easier parsing