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
Loading
Please register or sign in to comment