Device cleanup (#592)

- Replaced device_find_\* usage by device_get_\* variants.
- Removed deprecated device_find_\* functions.
- Improved reliability of Bluetooth scanning, pairing, connection, and HID host lifecycle behavior, including peer auto-connect handling.
- Improved Bluetooth/USB status indicators and clarified “Eject failed” alerts with the affected mount path.
This commit is contained in:
Ken Van Hoeylandt
2026-07-27 17:29:12 +02:00
committed by GitHub
parent 3354924359
commit d1f06cb774
20 changed files with 328 additions and 204 deletions
@@ -121,8 +121,12 @@ public:
}
void onShow(AppContext& app, lv_obj_t* parent) override {
if (Device* dev = device_find_first_active_by_type(&BLUETOOTH_TYPE)) {
bluetooth_add_event_callback(dev, this, onKernelBtEvent);
{
Device* dev;
if (device_get_first_active_by_type(&BLUETOOTH_TYPE, &dev) == ERROR_NONE) {
bluetooth_add_event_callback(dev, this, onKernelBtEvent);
device_put(dev);
}
}
// Load stored settings (name, autoConnect)
@@ -189,8 +193,10 @@ public:
}
void onHide(AppContext& app) override {
if (Device* dev = device_find_first_active_by_type(&BLUETOOTH_TYPE)) {
Device* dev;
if (device_get_first_active_by_type(&BLUETOOTH_TYPE, &dev) == ERROR_NONE) {
bluetooth_remove_event_callback(dev, onKernelBtEvent);
device_put(dev);
}
viewEnabled = false;
}