Cleanup compiler warnings when using HID device or bonds disabled. #1120
Conversation
📝 WalkthroughWalkthroughArr, these changes be securin' yer NimBLE treasure chest! Conditional compilation guards added for bond management and security functions, runtime-safe fallbacks implemented fer disabled features, and a deprecated method be marked fer future removal. Minor safety fix fer array bounds checkin' as well. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/NimBLEDevice.cpp`:
- Around line 1280-1291: The injectPassKey function is incorrectly guarded by
MYNEWT_VAL(BLE_SM_LEGACY) which disables BLE_SM_IOACT_INPUT support in Secure
Connections-only builds; remove the `#if/`#else and always build the passkey
injection path: construct a ble_sm_io with action BLE_SM_IOACT_INPUT and
passkey, call ble_sm_inject_io(peerInfo.getConnHandle(), &pkey), log the result
via NIMBLE_LOGD, and return rc == 0; eliminate the dead
(void)peerInfo/(void)passkey branch and the "not supported" error so
injectPassKey, ble_sm_io, ble_sm_inject_io, BLE_SM_IOACT_INPUT and
NimBLEConnInfo are used unconditionally when the security manager is present.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: fbf001f1-5d82-4340-8016-e8a93f7d32e4
📒 Files selected for processing (3)
src/NimBLEDevice.cppsrc/NimBLEHIDDevice.cppsrc/NimBLEHIDDevice.h
Summary by CodeRabbit
Bug Fixes
Improvements
Deprecations
startServices()in HID device; service initialization now handled by server startup.