From 771837ee55987a11ef8b339cf3aa8a933c731f20 Mon Sep 17 00:00:00 2001 From: Luca Silva Date: Sat, 25 Apr 2026 21:04:59 +0200 Subject: [PATCH] USB: use libusb enums for endpoint bitmask checks Address review: replace raw 0x80 / 0x03 / 0x02 with LIBUSB_ENDPOINT_IN, LIBUSB_TRANSFER_TYPE_MASK, and LIBUSB_TRANSFER_TYPE_BULK. --- rpcs3/Emu/Io/usb_device.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/Io/usb_device.cpp b/rpcs3/Emu/Io/usb_device.cpp index 25fa387d0d..8c28517b94 100644 --- a/rpcs3/Emu/Io/usb_device.cpp +++ b/rpcs3/Emu/Io/usb_device.cpp @@ -191,7 +191,7 @@ void usb_device_passthrough::interrupt_transfer(u32 buf_size, u8* buf, u32 endpo // Zero-length bulk/interrupt IN URBs hang in libusb until the device sends a ZLP. // The emulated path fake-completes these immediately with count=0; mirror that here // so games that do drain-polls between transfers don't stall the worker thread. - if (buf_size == 0 && (endpoint & 0x80)) + if (buf_size == 0 && (endpoint & LIBUSB_ENDPOINT_IN)) { transfer->fake = true; transfer->expected_count = 0; @@ -204,7 +204,7 @@ void usb_device_passthrough::interrupt_transfer(u32 buf_size, u8* buf, u32 endpo // stack routes both bulk and interrupt transfers through this method, but submitting // an interrupt URB to a bulk endpoint fails with EINVAL on Linux. const UsbDeviceEndpoint* ep_desc = find_endpoint(static_cast(endpoint)); - const bool is_bulk = ep_desc && (ep_desc->bmAttributes & 0x03) == 0x02; + const bool is_bulk = ep_desc && (ep_desc->bmAttributes & LIBUSB_TRANSFER_TYPE_MASK) == LIBUSB_TRANSFER_TYPE_BULK; if (is_bulk) {