summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorConnor McLaughlin <stenzek@gmail.com>2019-08-20 12:24:57 +1000
committerGitHub <noreply@github.com>2019-08-20 12:24:57 +1000
commit674a66aab2fa54c9b4c39a027d1701620fc0bafa (patch)
treeab4d530da36030be25a4d47f9b078fa9d10f2703 /Source/Core
parent82fe8f61b6de80549a6afc9542120efffbedc0d1 (diff)
parentf3dac2c041c3441fec7e329a41b6628ca7a83ecb (diff)
Merge pull request #8312 from JosJuice/btreal-bitwise-enum
BTReal.cpp: Don't use bitwise operators on enum values
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp b/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp
index 917ef41223..0f7fa8c5a8 100644
--- a/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp
+++ b/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp
@@ -32,6 +32,10 @@
namespace IOS::HLE::Device
{
+constexpr u8 REQUEST_TYPE = static_cast<u8>(LIBUSB_ENDPOINT_OUT) |
+ static_cast<u8>(LIBUSB_REQUEST_TYPE_CLASS) |
+ static_cast<u8>(LIBUSB_RECIPIENT_INTERFACE);
+
static bool IsWantedDevice(const libusb_device_descriptor& descriptor)
{
const int vid = SConfig::GetInstance().m_bt_passthrough_vid;
@@ -347,17 +351,15 @@ void BluetoothReal::WaitForHCICommandComplete(const u16 opcode)
void BluetoothReal::SendHCIResetCommand()
{
- const u8 type = LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE;
u8 packet[3] = {};
const u16 payload[] = {HCI_CMD_RESET};
memcpy(packet, payload, sizeof(payload));
- libusb_control_transfer(m_handle, type, 0, 0, 0, packet, sizeof(packet), TIMEOUT);
+ libusb_control_transfer(m_handle, REQUEST_TYPE, 0, 0, 0, packet, sizeof(packet), TIMEOUT);
INFO_LOG(IOS_WIIMOTE, "Sent a reset command to adapter");
}
void BluetoothReal::SendHCIDeleteLinkKeyCommand()
{
- const u8 type = LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE;
struct Payload
{
hci_cmd_hdr_t header;
@@ -369,7 +371,7 @@ void BluetoothReal::SendHCIDeleteLinkKeyCommand()
payload.command.bdaddr = {};
payload.command.delete_all = true;
- libusb_control_transfer(m_handle, type, 0, 0, 0, reinterpret_cast<u8*>(&payload),
+ libusb_control_transfer(m_handle, REQUEST_TYPE, 0, 0, 0, reinterpret_cast<u8*>(&payload),
static_cast<u16>(sizeof(payload)), TIMEOUT);
}
@@ -378,7 +380,6 @@ bool BluetoothReal::SendHCIStoreLinkKeyCommand()
if (m_link_keys.empty())
return false;
- const u8 type = LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE;
// The HCI command field is limited to uint8_t, and libusb to uint16_t.
const u8 payload_size =
static_cast<u8>(sizeof(hci_write_stored_link_key_cp)) +
@@ -408,8 +409,8 @@ bool BluetoothReal::SendHCIStoreLinkKeyCommand()
iterator += entry.second.size();
}
- libusb_control_transfer(m_handle, type, 0, 0, 0, packet.data(), static_cast<u16>(packet.size()),
- TIMEOUT);
+ libusb_control_transfer(m_handle, REQUEST_TYPE, 0, 0, 0, packet.data(),
+ static_cast<u16>(packet.size()), TIMEOUT);
return true;
}