Message ID | 20240728075622.333056-1-uhrmar@gmail.com |
---|---|
State | Superseded |
Headers | show |
Series | Add pattern matching for service UUIDs | expand |
This is automated email and please do not reply to this email! Dear submitter, Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series: PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=874291 ---Test result--- Test Summary: CheckPatch FAIL 0.67 seconds GitLint PASS 0.32 seconds BuildEll PASS 24.47 seconds BluezMake PASS 1640.03 seconds MakeCheck PASS 13.64 seconds MakeDistcheck PASS 176.29 seconds CheckValgrind PASS 249.80 seconds CheckSmatch PASS 355.35 seconds bluezmakeextell PASS 118.88 seconds IncrementalBuild PASS 1402.63 seconds ScanBuild PASS 977.20 seconds Details ############################## Test: CheckPatch - FAIL Desc: Run checkpatch.pl script Output: Add pattern matching for service UUIDs WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #89: This commit extends the pattern matching capabilities of advertisement monitors WARNING:LINE_SPACING: Missing a blank line after declarations #109: FILE: src/shared/ad.c:1370: + const struct bt_ad_pattern *pattern; + if (!uuid || !info) /github/workspace/src/src/13743839.patch total: 0 errors, 2 warnings, 59 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /github/workspace/src/src/13743839.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. --- Regards, Linux Bluetooth
diff --git a/src/shared/ad.c b/src/shared/ad.c index d08ce7af9..4a76d42ac 100644 --- a/src/shared/ad.c +++ b/src/shared/ad.c @@ -1362,6 +1362,45 @@ static bool match_manufacturer(const void *data, const void *user_data) return false; } +static bool match_uuid(const void *data, const void *user_data) +{ + const bt_uuid_t *uuid = data; + const struct pattern_match_info *info = user_data; + const struct bt_ad_pattern *pattern; + if (!uuid || !info) + return false; + + if (info->matched_pattern) + return false; + + pattern = info->current_pattern; + + if (!pattern) + return false; + + switch (pattern->type) { + case BT_AD_UUID16_ALL: + case BT_AD_UUID16_SOME: + if (pattern->offset != 0 || pattern->len != sizeof(uint16_t)) + return false; + break; + case BT_AD_UUID32_ALL: + case BT_AD_UUID32_SOME: + if (pattern->offset != 0 || pattern->len != sizeof(uint32_t)) + return false; + break; + case BT_AD_UUID128_ALL: + case BT_AD_UUID128_SOME: + if (pattern->offset != 0 || pattern->len != sizeof(uint128_t)) + return false; + break; + default: + return false; + } + + return !memcmp(&uuid->value, pattern->data, pattern->len); +} + static bool match_service(const void *data, const void *user_data) { const struct bt_ad_service_data *service_data = data; @@ -1451,6 +1490,14 @@ static void pattern_match(void *data, void *user_data) matched = queue_find(ad->manufacturer_data, match_manufacturer, user_data); break; + case BT_AD_UUID16_ALL: + case BT_AD_UUID16_SOME: + case BT_AD_UUID32_ALL: + case BT_AD_UUID32_SOME: + case BT_AD_UUID128_ALL: + case BT_AD_UUID128_SOME: + matched = queue_find(ad->service_uuids, match_uuid, user_data); + break; case BT_AD_SERVICE_DATA16: case BT_AD_SERVICE_DATA32: case BT_AD_SERVICE_DATA128: