Fix crash in iButton notifications routine (#2074)

* iButton: send notifications less strictly
* iButton: set notification callback earlier
This commit is contained in:
Sergey Gavrilov 2022-12-02 04:28:46 +10:00 committed by GitHub
parent 2a6a3a1bf7
commit eb3a8734fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -131,7 +131,9 @@ void ibutton_worker_switch_mode(iButtonWorker* worker, iButtonWorkerMode mode) {
void ibutton_worker_notify_emulate(iButtonWorker* worker) { void ibutton_worker_notify_emulate(iButtonWorker* worker) {
iButtonMessage message = {.type = iButtonMessageNotifyEmulate}; iButtonMessage message = {.type = iButtonMessageNotifyEmulate};
furi_check(furi_message_queue_put(worker->messages, &message, 0) == FuriStatusOk); // we're running in an interrupt context, so we can't wait
// and we can drop message if queue is full, that's ok for that message
furi_message_queue_put(worker->messages, &message, 0);
} }
void ibutton_worker_set_key_p(iButtonWorker* worker, iButtonKey* key) { void ibutton_worker_set_key_p(iButtonWorker* worker, iButtonKey* key) {

View File

@ -222,8 +222,8 @@ void ibutton_worker_emulate_dallas_start(iButtonWorker* worker) {
memcpy(device_id, key_id, key_size); memcpy(device_id, key_id, key_size);
onewire_slave_attach(worker->slave, worker->device); onewire_slave_attach(worker->slave, worker->device);
onewire_slave_start(worker->slave);
onewire_slave_set_result_callback(worker->slave, onewire_slave_callback, worker); onewire_slave_set_result_callback(worker->slave, onewire_slave_callback, worker);
onewire_slave_start(worker->slave);
} }
void ibutton_worker_emulate_dallas_stop(iButtonWorker* worker) { void ibutton_worker_emulate_dallas_stop(iButtonWorker* worker) {