Skip to content

Commit

Permalink
fixup! refactor: modernize bulksupport allowlist
Browse files Browse the repository at this point in the history
  • Loading branch information
Swiftb0y committed Sep 5, 2024
1 parent 4f4c424 commit 14f0ea8
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/controllers/bulk/bulkcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,21 +150,20 @@ int BulkController::open() {
}

/* Look up endpoint addresses in supported database */
const bulk_supported_t* device = std::find(
std::begin(bulk_supported), std::end(bulk_supported), bulk_supported_t {
m_vendorId,
m_productId,
m_inEndpointAddr,
m_outEndpointAddr,
#if defined(__WINDOWS__) || defined(__APPLE__)
m_interfaceNumber,
#endif
});

const bulk_supported_t* device = std::find_if(
std::begin(bulk_supported), std::end(bulk_supported), [this](const auto& dev) {
return dev.vendor_id == m_vendorId && dev.product_id == m_productId;
});
if (!device) {
qCWarning(m_logBase) << "USB Bulk device" << getName() << "unsupported";
return -1;
}
m_inEndpointAddr = device->in_epaddr;
m_outEndpointAddr = device->out_epaddr;
#if defined(__WINDOWS__) || defined(__APPLE__)
m_interfaceNumber = device->interface_number;
#endif

// XXX: we should enumerate devices and match vendor, product, and serial
if (m_phandle == nullptr) {
Expand Down

0 comments on commit 14f0ea8

Please sign in to comment.