Skip to content

Commit

Permalink
xusb/testlibusb: Print vid:pid consistently and with small hex digits
Browse files Browse the repository at this point in the history
Make testlibusb output align better, like lsusb does it.

Signed-off-by: Tormod Volden <[email protected]>
  • Loading branch information
tormodvolden committed Jul 28, 2024
1 parent 283821d commit 9fb7da7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/testlibusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions examples/xusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9fb7da7

Please sign in to comment.