Conversation
Issue: Inverted logic in onInterfacesRemoved() method causes incorrect cleanup behavior.
if (!adapters_.contains(objectPath)) {
if (adapters_.contains(objectPath)) { // This will never execute!
adapters_[objectPath].reset();
adapters_.erase(objectPath);
}
}
Impact:
Memory leaks when adapters/devices are removed
Orphaned proxy objects continue to exist
Map continues to grow with removed entries
Potential use-after-free if removed devices are accessed
Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
Issue: Programs use std::this_thread::sleep_for() with hardcoded durations (120000ms = 2 minutes) and no signal handling for graceful shutdown. Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
Issue: Race condition between destructor and run() thread accessing pipe_fds_. Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
Issue: gatt_characteristics_ and gatt_descriptors_ accessed within gatt_services_mutex_ lock, but they may need separate synchronization for concurrent access. Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
Issue: Callback invoked without null check, though constructor allows null callbacks. Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
Issue: No overflow protection when dividing by 1024. Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
Issue: Exception handling in async callback may not work correctly. Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
Issue: String operations assume format without validation. Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
Issue: enterEventLoopAsync() followed by sleep creates a fixed-duration program with no early exit capability. Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
Issue: Many D-Bus operations lack try-catch blocks. Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
Issue: Classes with detached threads lack proper move semantics. Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
Issue: Properties retrieved with .get<T>() without checking types or handling exceptions. Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
Issue: Multiple mutexes (adapters_mutex_, devices_mutex_, gatt_services_mutex_, etc.) could deadlock if acquired in different orders. Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
Issue: No limits on number of tracked devices/adapters/services. Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
Issue: All sleep durations are hardcoded (120000ms, 30000ms, 5s). Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
Issue: spdlog used without configuration - no control over log levels, output destinations. Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
| spdlog::info("\tSpiderDspFwVersion: 0x{:08X}", | ||
| version.Data.SpiderDspFwVersion); | ||
| LOG_INFO("\tFirmwareVersion: {}", firmware_version_str.str()); | ||
| // LOG_INFO("\tFirmwareVersion: 0x{:08X}", version.Data.FirmwareVersion); |
Check notice
Code scanning / CodeQL
Commented-out code Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 month ago
To fix the problem, remove the commented-out logging statement or turn it into a non-code explanatory comment. Since the surrounding code already logs the firmware version in a human-readable dotted format, and we want to avoid commented-out executable code, the best fix is to delete the line entirely.
Concretely, in src/bluez/ps5_dual_sense/input_reader.cc, within InputReader::PrintControllerVersion, delete line 447:
// LOG_INFO("\tFirmwareVersion: 0x{:08X}", version.Data.FirmwareVersion);No new methods, imports, or definitions are needed. This change does not alter existing functionality; it only cleans up dead/commented-out code.
| @@ -444,7 +444,6 @@ | ||
| << std::setw(4) << std::setfill('0') | ||
| << (firmware_version & 0xFFFF); | ||
| LOG_INFO("\tFirmwareVersion: {}", firmware_version_str.str()); | ||
| // LOG_INFO("\tFirmwareVersion: 0x{:08X}", version.Data.FirmwareVersion); | ||
| LOG_INFO("\tDeviceInfo: {}", version.Data.DeviceInfo); | ||
| LOG_INFO("\tUpdateVersion: 0x{:04X}", version.Data.UpdateVersion); | ||
| LOG_INFO("\tUpdateImageInfo: 0x{:02}", |
No description provided.