summaryrefslogtreecommitdiffstats
path: root/src/controllers/hid/hidcontroller.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/controllers/hid/hidcontroller.cpp')
-rw-r--r--src/controllers/hid/hidcontroller.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/controllers/hid/hidcontroller.cpp b/src/controllers/hid/hidcontroller.cpp
index 4ca0d444a8..b94eecc8cc 100644
--- a/src/controllers/hid/hidcontroller.cpp
+++ b/src/controllers/hid/hidcontroller.cpp
@@ -103,8 +103,9 @@ void HidController::visit(const HidControllerPreset* preset) {
bool HidController::matchPreset(const PresetInfo& preset) {
const QList<ProductInfo>& products = preset.getProducts();
for (const auto& product : products) {
- if (matchProductInfo(product))
+ if (matchProductInfo(product)) {
return true;
+ }
}
return false;
}
@@ -114,20 +115,30 @@ bool HidController::matchProductInfo(const ProductInfo& product) {
bool ok;
// Product and vendor match is always required
value = product.vendor_id.toInt(&ok,16);
- if (!ok || hid_vendor_id!=value) return false;
+ if (!ok || hid_vendor_id != value) {
+ return false;
+ }
value = product.product_id.toInt(&ok,16);
- if (!ok || hid_product_id!=value) return false;
+ if (!ok || hid_product_id != value) {
+ return false;
+ }
// Optionally check against interface_number / usage_page && usage
if (hid_interface_number!=-1) {
value = product.interface_number.toInt(&ok,16);
- if (!ok || hid_interface_number!=value) return false;
+ if (!ok || hid_interface_number != value) {
+ return false;
+ }
} else {
value = product.usage_page.toInt(&ok,16);
- if (!ok || hid_usage_page!=value) return false;
+ if (!ok || hid_usage_page != value) {
+ return false;
+ }
value = product.usage.toInt(&ok,16);
- if (!ok || hid_usage!=value) return false;
+ if (!ok || hid_usage != value) {
+ return false;
+ }
}
// Match found
return true;