Avoid PRIx16 printf format on Windows
Convert uint16_t to unsigned to avoid using PRIx16, which may not exist on Windows. PR #3011 <https://github.com/Genymobile/scrcpy/pull/3011>
This commit is contained in:
parent
b9b2879789
commit
06243e7c3c
2 changed files with 9 additions and 6 deletions
|
@ -91,8 +91,8 @@ scrcpy_otg(struct scrcpy_options *options) {
|
|||
|
||||
usb_device_initialized = true;
|
||||
|
||||
LOGI("USB device: %s (%04" PRIx16 ":%04" PRIx16 ") %s %s",
|
||||
usb_device.serial, usb_device.vid, usb_device.pid,
|
||||
LOGI("USB device: %s (%04x:%04x) %s %s", usb_device.serial,
|
||||
(unsigned) usb_device.vid, (unsigned) usb_device.pid,
|
||||
usb_device.manufacturer, usb_device.product);
|
||||
|
||||
ok = sc_usb_connect(&s->usb, usb_device.device, &cbs, NULL);
|
||||
|
|
|
@ -40,8 +40,9 @@ sc_usb_read_device(libusb_device *device, struct sc_usb_device *out) {
|
|||
if (result < 0) {
|
||||
// Log at debug level because it is expected that some non-Android USB
|
||||
// devices present on the computer require special permissions
|
||||
LOGD("Open USB device %04" PRIx16 ":%04" PRIx16 ": libusb error: %s",
|
||||
desc.idVendor, desc.idProduct, libusb_strerror(result));
|
||||
LOGD("Open USB device %04x:%04x: libusb error: %s",
|
||||
(unsigned) desc.idVendor, (unsigned) desc.idProduct,
|
||||
libusb_strerror(result));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -146,8 +147,10 @@ sc_usb_devices_log(enum sc_log_level level, struct sc_usb_device *devices,
|
|||
for (size_t i = 0; i < count; ++i) {
|
||||
struct sc_usb_device *d = &devices[i];
|
||||
const char *selection = d->selected ? "-->" : " ";
|
||||
LOG(level, " %s %-18s (%04" PRIx16 ":%04" PRIx16 ") %s %s",
|
||||
selection, d->serial, d->vid, d->pid, d->manufacturer, d->product);
|
||||
// Convert uint16_t to unsigned because PRIx16 may not exist on Windows
|
||||
LOG(level, " %s %-18s (%04x:%04x) %s %s",
|
||||
selection, d->serial, (unsigned) d->vid, (unsigned) d->pid,
|
||||
d->manufacturer, d->product);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue