Commit Graph

259 Commits

Author SHA1 Message Date
Marcel Holtmann
5182dc7c3d emulator: Reopen PTY master when slave closes it 2014-07-12 19:49:13 +02:00
Marcel Holtmann
096799fd52 emulator: Add support for providing a pseudo terminal 2014-07-12 15:53:16 +02:00
Johan Hedberg
45749f6aad emulator: Fix random address type in LE conn complete events 2014-06-02 13:09:00 +03:00
Johan Hedberg
895e0a16f1 emulator: Fix matching up connections to random addresses 2014-06-02 13:08:53 +03:00
Andrzej Kaczmarek
f5b1a7289a emulator/btdev: Add support for Read TX Power command 2014-05-20 21:55:14 +03:00
Andrzej Kaczmarek
5d1d3dc192 emulator/btdev: Add support for Read RSSI command 2014-05-20 21:55:14 +03:00
Andrzej Kaczmarek
1a4cb1a207 emulator/bthost: Add support to set auth_req for bthost
This patch makes possible to set Authentication_Requirements to be used
in io_capa_request_reply when replying for io_capa_request_evt.
2014-05-19 14:14:14 +03:00
Johan Hedberg
0e6b13b702 emulator: Minor coding style fix 2014-03-20 14:15:31 +02:00
Lukasz Rymanowski
fa34a2dc71 emulator: Add handling inquiry_lenght from inquiry command
With this patch, btdev is taking into accoung inquiry_lenght from hci
inquiry command.
Inquiry session will last that long unless number of devices parameter
has been provided different then 0
2014-03-20 14:15:14 +02:00
Lukasz Rymanowski
400cb2885c emulator: Add handling inquiry number of responses 2014-03-20 14:12:52 +02:00
Lukasz Rymanowski
ce83fbee7c emulator: Add inquiry cancel
With this patch, scheduled inquiry session in btdev can be canceled
2014-03-20 14:12:18 +02:00
Lukasz Rymanowski
f1f2ad6046 emulator: Use timeout for sending inquiry results
With this patch btdev uses timeout to schedule inquiry results
It also allows btdev to receive hci commands during inquiry.
Previously btdev was blocked since all the inquiry result were sent in
single loop
2014-03-20 14:11:25 +02:00
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