Commit Graph

247 Commits

Author SHA1 Message Date
Johan Hedberg
18f0cdaac1 emulator/btdev: Add support for negative LTK reply 2014-03-14 13:17:09 +02:00
Johan Hedberg
01095e7774 emulator/bthost: Set advertising parameters before enabling advertising 2014-03-14 12:51:12 +02:00
Johan Hedberg
e392404950 emulator/btdev: Fix checking for non-connectable advertising 2014-03-14 12:42:14 +02:00
Johan Hedberg
2f410a63c2 emulator/btdev: Do correct matching for direct advertising when connecting 2014-03-14 09:44:37 +02:00
Johan Hedberg
c23be68fa2 emulator/btdev: Add proper matching for direct advertising 2014-03-14 09:39:13 +02:00
Johan Hedberg
d45529c987 emulator/btdev: Add helper for selecting advertising address 2014-03-14 09:35:06 +02:00
Johan Hedberg
584e9dc6e6 emulator/btdev: Track direct advertising address 2014-03-14 09:34:29 +02:00
Johan Hedberg
141c10827b emulator/btdev: Track LE scanning own address type 2014-03-14 09:32:58 +02:00
Johan Hedberg
dcf9c2a9aa emulator/btdev: Fix using correct address in advertising reports 2014-03-11 14:27:42 +02:00
Johan Hedberg
a37c747a59 emulator/btdev: Add support for sending LE Scan Response events 2014-03-11 14:25:38 +02:00
Johan Hedberg
b1b55dda9c emulator/btdev: Fix LE adv report types to match adv parameters 2014-03-11 14:16:31 +02:00
Johan Hedberg
1b4a46fec3 emulator/btdev: Store LE adv params for later use 2014-03-11 14:10:49 +02:00
Johan Hedberg
6375533b7f emulator/btdev: Add storing of LE Scan Response Data 2014-03-11 13:42:52 +02:00
Johan Hedberg
9ecff0151c emulator/btdev: Store LE Scan type for later use 2014-03-11 13:42:52 +02:00
Grzegorz Kolodziejczyk
d5ac1d2cda emulator/btdev: Add support for LE set scan response command
This adds support for btdev LE set scan response command.
2014-03-11 13:42:52 +02:00
Anderson Lizardo
6d67d8da9f emulator/btdev: Add dummy support for clearing the LE white list
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)
2014-03-07 11:25:03 +02:00
Marcel Holtmann
8e5ad50cd3 emulator: List LE commands, event and features from Bluetooth 4.1 2014-02-28 20:17:45 -08:00
Marcel Holtmann
53dde8be6c emulator: Add dummy support for clearing the LE white list 2014-02-28 15:09:55 -08:00
Marcel Holtmann
d1c6a543c7 monitor: Use 64-bit unsigned integer for random number 2014-02-27 14:37:41 -08:00
Johan Hedberg
a83d698f5a emulator: Add HCI_LE_Set_Random_Address support 2014-02-26 19:10:52 +02:00
Johan Hedberg
502407f176 emulator: Use shared crypto code instead of custom functions 2014-02-26 17:59:37 +02:00
Marcin Kraglak
f79a9e3b44 emulator/bthost: Fix command queue
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)
2014-02-19 17:22:05 +02:00
Johan Hedberg
dd78814e7f tools/bthost: Fix RFCOMM channel variable type 2014-02-19 15:11:08 +02:00
Johan Hedberg
4ead1cb1ec emulator/bthost: Rename rfcomm_channel to rfcomm_chan for shorter symbol names 2014-02-19 15:09:34 +02:00
Marcin Kraglak
e157b7f28e emulator/bthost: Add function to send RFCOMM UIH frames from bthost
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.
2014-02-19 15:03:27 +02:00
Marcin Kraglak
f5e82813af emulator/bthost: Add api to handle RFCOMM data on bthost
With this change user can handle data received on RFCOMM connection.
2014-02-19 15:00:20 +02:00
Marcin Kraglak
68e94df753 emulator/bthost: Check length of received RFCOMM UIH frames
Add correct calculation of frame length. If frame is too short, ignore it.
2014-02-17 15:49:22 +02:00
Marcin Kraglak
8e9e005aa0 emulator/bthost: Check length of received RFCOMM UA frames
Check length of RFCOMM UA frames and ignore if frame is too short.
2014-02-17 14:31:20 +02:00
Marcin Kraglak
be3841b10d emulator/bthost: Check length of received RFCOMM DM frames
Ignore too short received RFCOMM DM frames.
2014-02-17 14:31:18 +02:00
Marcin Kraglak
fba18071c6 emulator/bthost: Check length of received RFCOMM DISC frame
Don't access rfcomm_hdr struct and ignore if frame is too short.
2014-02-17 14:31:16 +02:00
Marcin Kraglak
b2b4716b3c emulator/bthost: Check length of received RFCOMM SABM frame
This will check length of received SABM frame. Ignore frame if
it is too short.
2014-02-17 14:31:14 +02:00
Marcel Holtmann
69c85b61aa emulator: Add support LE_Encrypt and LE_Rand support 2014-02-17 02:06:05 -08:00
Marcel Holtmann
6898ecdf0e emulator: Update copyright and license details 2014-02-12 09:24:13 -08:00
Johan Hedberg
88373d735a emulator: Fix correct link key type generation 2014-02-03 07:49:42 +02:00
Johan Hedberg
df39364122 emulator: Add HCI_Write_SSP_Debug_Mode support 2014-02-03 07:49:25 +02:00
Anderson Lizardo
64bc96534b emulator: Fix crash if socket(AF_ALG) is not supported by the kernel
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
2014-01-27 09:59:28 -08:00
Marcel Holtmann
ccbbb8dd3c emulator: Add simple HFP emulator for testing 2014-01-25 12:17:09 -08:00
Anderson Lizardo
b23ed9bf8d emulator: Fix unaligned memory access compilation errors
The u128_xor() function does proper aligned access and accepts void *
arguments, therefore the casts are unnecessary and trigger clang errors.
2014-01-21 11:07:37 +02:00
Johan Hedberg
35b50f0f34 emulator/bthost: Add dummy entries for LTK reply completion 2014-01-20 16:28:03 +02:00
Johan Hedberg
f3db25a05b emulator/bthost: Add SMP callback to fetch LTK 2014-01-20 16:28:03 +02:00
Johan Hedberg
741d28de64 emulator/bthost: Add warning for unsupported LE Meta events 2014-01-20 16:27:57 +02:00
Johan Hedberg
fb922ee610 emulator/bthost: Add SMP support 2014-01-20 16:26:33 +02:00
Johan Hedberg
2688bf5c6e emulator/bthost: Add dummy handler for User Confirm Request Reply completion 2014-01-20 13:14:28 +02:00
Johan Hedberg
23b2191c07 emulator/bthost: Remove unnecessary printf 2014-01-17 15:29:31 +02:00
Johan Hedberg
dee79b4635 emulator/bthost: More RFCOMM code cleanups 2014-01-16 12:23:16 +02:00
Johan Hedberg
d11ac83a18 emulator/bthost: Further cleanups to the RFCOMM code 2014-01-16 12:23:15 +02:00
Johan Hedberg
bce8cc0159 emulator/bthost: Clean up RFCOMM related code 2014-01-16 12:23:15 +02:00
Johan Hedberg
a48b49121f tools/bthost: Remove useless channel parameter from RFCOMM callback 2014-01-16 12:23:15 +02:00
Marcin Kraglak
c64b9baa99 emulator/bthost: Call rfcomm_connect_cb when connected
This will call connect callback when connected or failed to connect.
2014-01-16 12:23:15 +02:00
Marcin Kraglak
37a1b0fa3d emulator/bthost: Add implementation to PN RSP
This will send sabm command if PN_RSP will be received.
2014-01-16 12:23:15 +02:00