Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 55ad36e0 authored by Yun-Hao Chung's avatar Yun-Hao Chung
Browse files

Floss: Fix cleanup procedure when chipset is down

In the current implementation, when the chipset is down, we raise SIGINT
directly, then the upper layer exit the process. The OS will then free
the resources but in an undetermined order. This could cause some
thread (usually caused by DoInThreadDelayed) to run in a bad state
during this cleanup and cause crashes.

This CL implements the following to prevent the above from happening.
1. instead of raise, only send the sigal so that the thread can continue
   to run and avoid fall into a bad state, which makes the module unable
   to be unregistered.
2. as soon as we know the chipset is unable to use, flag it and prevent
   any read and write operation.
3. when btadapterd receive the signal, don't terminate the process
   directly, instead, follow the normal terminating procedure to cleanup
   all resources.

NO_IFTTT= Floss only change.

Bug: 335146967, 304997914, 353900236
Tag: #floss
Test: mmm packages/modules/Bluetooth
Test: run below test mannually while a2dp and hogp is in used
      1. rmmod btusb && modprobe btusb while
      2. hcitool cmd 3f 4e (to trigger hardware error)
Flag: EXEMPT, Floss-only changes
Change-Id: I74ca9762d98a89a76f43e4fd78c457a4c97c0278
parent 1b652bd8
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment