Add just enough support for being able to bring up LE capable virtual
controllers using "btvirt".
Fixes this error on "btvirt -l2":
Unsupported command 0x2010
And on "hciconfig hci0 up":
Can't init device hci0: Invalid request code (56)
Now new commands will be pushed to tail. Queue will be consumed
from head, firstly added commands will be sent. It repairs this
warning from android-tester:
==20561== 1,904 bytes in 7 blocks are definitely
lost in loss record 30 of 31
==20561== at 0x4006AB1: malloc (in /usr/lib/valgrind/
vgpreload_memcheck-x86-linux.so)
==20561== by 0x8050293: send_command (bthost.c:389)
==20561== by 0x80543E1: start_stack (hciemu.c:299)
==20561== by 0x41043D00: ??? (in /usr/lib/libglib-2.0.so.0.3600.4)
==20561== by 0x410470E5: g_main_context_dispatch (in
/usr/lib/libglib-2.0.so.0.3600.4)
==20561== by 0x41047497: ??? (in
/usr/lib/libglib-2.0.so.0.3600.4)
==20561== by 0x41047912: g_main_loop_run (in
/usr/lib/libglib-2.0.so.0.3600.4)
==20561== by 0x8055870: tester_run (tester.c:798)
==20561== by 0x804B980: main (android-tester.c:3984)
This will make RFCOMM UIH frame and fill with data passed by user.
It also adds bthost internal tracking of RFCOMM connections to store
cid and channel - user have to pass only conenction handle and channel.
In this situation, smp_stop() was being called with NULL pointer.
Crash detected by valgrind:
==7925== Invalid read of size 4
==7925== at 0x8052F18: smp_stop (smp.c:480)
==7925== by 0x8052542: bthost_stop (bthost.c:2073)
==7925== by 0x805521D: hciemu_unref (hciemu.c:372)
==7925== by 0x8058C65: test_post_teardown (android-tester.c:464)
==7925== by 0x8055DE7: tester_teardown_complete (tester.c:533)
==7925== by 0x8055501: teardown_callback (tester.c:312)
==7925== by 0x408348F: g_idle_dispatch (gmain.c:5250)
==7925== by 0x4086A75: g_main_context_dispatch (gmain.c:3065)
==7925== by 0x4086E14: g_main_context_iterate.isra.23 (gmain.c:3712)
==7925== by 0x40872FA: g_main_loop_run (gmain.c:3906)
==7925== by 0x41744D2: (below main) (libc-start.c:226)
==7925== Address 0x8 is not stack'd, malloc'd or (recently) free'd