Commit Graph

403 Commits

Author SHA1 Message Date
Johan Hedberg
a530b1d2e5 emulator: Update emulated controller HCI version from 4.2 to 5.0 2017-05-09 17:27:51 +03:00
Marcel Holtmann
e60516495a emulator: Improved handling of Set Default PHY command 2017-05-02 02:06:31 -07:00
Marcel Holtmann
953541817f emulator: Enable LE power class and minimum channels feature 2017-05-01 23:43:18 -07:00
Marcel Holtmann
8d6646fccc emulator: Fix comments for event mask descriptions 2017-05-01 23:04:59 -07:00
Marcel Holtmann
cea8ed9942 emulator: Add basic PHY command handling to LE only controller 2017-05-01 22:26:17 -07:00
Marcel Holtmann
d2af5c68e8 emulator: Add Bluetooth 5.0 defines to LE only controller 2017-05-01 21:23:56 -07:00
Michał Narajowski
968fdffb92 tools/mgmt-tester: Test read extended controller info
This patch tests read extended controller info command added in kernel.
It also adds support for sending multiple mgmt commands on setup and
expecting hci command on setup.
2016-09-07 22:35:58 +02:00
Luiz Augusto von Dentz
a1c86eba31 build: Fix checking result of sizeof instead of memcmp
This can be easily spot when building with clang:

emulator/smp.c:373:53: error: size argument in 'memcmp' call is a comparison
      [-Werror,-Wmemsize-comparison]
        if (memcmp(conn->pcnf, confirm, sizeof(conn->pcnf) != 0)) {

tools/smp-tester.c:596:53: error: size argument in 'memcmp' call is a comparison
      [-Werror,-Wmemsize-comparison]
        if (memcmp(data->pcnf, confirm, sizeof(data->pcnf) != 0)) {
2016-08-25 17:02:22 +03:00
Marcel Holtmann
12cd2eda1a lib: Define HCI_PRIMARY and use it instead of HCI_BREDR 2016-07-04 19:21:44 +02:00
Johan Hedberg
faac282603 emulator: Fix status value for DHKey Complete event
The value wasn't properly initialized, leading to arbitrary values.
2016-07-02 09:37:07 +03:00
Johan Hedberg
28de3782a2 emulator: Include Link Key in key distribution if BR/EDR is supported 2016-06-07 12:47:43 +03:00
Gowtham Anandha Babu
ca20149656 emulator/hciemu: Fix return value
make throws out the following errors.

emulator/hciemu.c: In function ‘hciemu_get_master_scan_enable’:
emulator/hciemu.c:433:3: error: return makes integer from pointer without a cast [-Werror]
   return NULL;
   ^
emulator/hciemu.c: In function ‘hciemu_get_master_le_scan_enable’:
emulator/hciemu.c:441:3: error: return makes integer from pointer without a cast [-Werror]
   return NULL;
   ^
cc1: all warnings being treated as errors

Fixed by returning zero.
2015-11-16 15:49:46 +02:00
Johan Hedberg
fa6c85299a emulator: Add API to get BR/EDR scan_enable value 2015-11-16 12:26:13 +02:00
Johan Hedberg
04f68f5418 emulator: Return raw LE scan_enable value
This is more future proof (in case other values besides 0x00/0x01 are
introduced) and consistent with a similar BR/EDR API that will be
added soon.
2015-11-16 12:22:46 +02:00
Johan Hedberg
1051531f2d emulator: Fix sending valid HCI_LE_Create_Connection parameters 2015-11-12 11:08:34 +02:00
Jakub Pawlowski
51fdcde66c emulator: add support for checking le scan state 2015-11-11 09:58:56 +02:00
Mariusz Skamra
5eb2973b8f emulator: Refactor le set scan enable command handler
le_set_scan_enable_complete should be called as post hook action.
2015-10-05 11:02:19 +03:00
Mariusz Skamra
0d0fe88ab2 emulator: Enable Slave-initiated Features Exchange feature 2015-10-05 11:01:54 +03:00
Mariusz Skamra
576ccb079a emulator: Add support for LE Remote Connection Parameter Request Negative Reply
< HCI Command: LE Connection Update (0x08|0x0013) plen 14
                                                 [hci1] 915.472416
        Handle: 42
        Min connection interval: 0.00 msec (0x0000)
        Max connection interval: 18.75 msec (0x000f)
        Connection latency: 0x0000
        Supervision timeout: 32000 msec (0x0c80)
        Min connection length: 0.625 msec (0x0001)
        Max connection length: 0.625 msec (0x0001)
> HCI Event: Command Status (0x0f) plen 4         [hci1] 915.472432
      LE Connection Update (0x08|0x0013) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 11         [hci0] 915.472443
      LE Remote Connection Parameter Request (0x06)
        Handle: 42
        Min connection interval: 0.00 msec (0x0000)
        Max connection interval: 18.75 msec (0x000f)
        Connection latency: 0x0000
        Supervision timeout: 32000 msec (0x0c80)
< HCI Command: LE Remote Connection Parameter Request Negative Reply
			(0x08|0x0021) plen 3       [hci0] 915.474095
        Handle: 42
        Reason: Invalid LMP Parameters / Invalid LL Parameters (0x1e)
> HCI Event: Command Complete (0x0e) plen 6        [hci0] 915.474119
      LE Remote Connection Parameter Request Negative Reply
				(0x08|0x0021) ncmd 1
        Status: Success (0x00)
        Handle: 42
> HCI Event: LE Meta Event (0x3e) plen 10          [hci1] 915.474124
      LE Connection Update Complete (0x03)
        Status: Invalid LMP Parameters / Invalid LL Parameters (0x1e)
        Handle: 42
        Connection interval: 4800.00 msec (0x0f00)
        Connection latency: 0.00 msec (0x0000)
        Supervision timeout: 327680 msec (0x8000)

LE Connection Update rejected due to invalid parameter:
	Min connection interval: 0.00 msec (0x0000)
2015-10-05 11:01:53 +03:00
Mariusz Skamra
78fbfd3fb2 emulator: Add support for LE Remote Connection Parameter Request Reply
< HCI Command: LE Connection Update (0x08|0x0013) plen 14
		                          [hci0] 92750.079447
        Handle: 42
        Min connection interval: 50.00 msec (0x0028)
        Max connection interval: 70.00 msec (0x0038)
        Connection latency: 0x0000
        Supervision timeout: 420 msec (0x002a)
        Min connection length: 0.000 msec (0x0000)
        Max connection length: 0.000 msec (0x0000)
> HCI Event: Command Status (0x0f) plen 4
	                                  [hci0] 92750.079459
      LE Connection Update (0x08|0x0013) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 11
                                          [hci1] 92750.079462
      LE Remote Connection Parameter Request (0x06)
        Handle: 42
        Min connection interval: 50.00 msec (0x0028)
        Max connection interval: 70.00 msec (0x0038)
        Connection latency: 0x0000
        Supervision timeout: 420 msec (0x002a)
< HCI Command: LE Remote Connection Parameter Request Reply
(0x08|0x0020) plen 14			  [hci1] 92750.079476
        Handle: 42
        Min connection interval: 50.00 msec (0x0028)
        Max connection interval: 70.00 msec (0x0038)
        Connection latency: 0x0000
        Supervision timeout: 420 msec (0x002a)
        Min connection length: 0.000 msec (0x0000)
        Max connection length: 0.000 msec (0x0000)
> HCI Event: Command Complete (0x0e) plen 6
					  [hci1] 92750.079507
      LE Remote Connection Parameter Request Reply (0x08|0x0020)
							ncmd 1
        Status: Success (0x00)
        Handle: 42
> HCI Event: LE Meta Event (0x3e) plen 10
                                          [hci0] 92750.079510
      LE Connection Update Complete (0x03)
        Status: Success (0x00)
        Handle: 42
        Connection interval: 50.00 msec (0x0028)
        Connection latency: 0.00 msec (0x0000)
        Supervision timeout: 420 msec (0x002a)
> HCI Event: LE Meta Event (0x3e) plen 10
                                          [hci1] 92750.079509
      LE Connection Update Complete (0x03)
        Status: Success (0x00)
        Handle: 42
        Connection interval: 50.00 msec (0x0028)
        Connection latency: 0.00 msec (0x0000)
        Supervision timeout: 420 msec (0x002a)
@ New Conn Param: 00:AA:01:00:00:23 (1) hint 0 min 0x0028 max 0x0038
					latency 0x0000 timeout 0x002a
2015-10-05 10:58:53 +03:00
Mariusz Skamra
658ab4f3aa emulator: Remove duplicated assignment
Connection handle has been already assigned few lines earlier.
2015-10-05 10:58:13 +03:00
Mariusz Skamra
ee014e7fff emulator: Fix LE Connection Complete Event data
This sets LE Connection Complete Event paramaters based on parameters
from LE Create Connection command.
Event parameters like Conn_Interval and Supervision_Timeout
shouldn't be set to 0.
2015-10-05 10:56:13 +03:00
Mariusz Skamra
24e8a28430 emulator: Update LE supported commands 2015-08-29 06:22:56 +03:00
Johan Hedberg
a9f7862172 emulator: Fix parameter order in le_conn_update()
The values are passed by the only caller in min, max order, which
makes sense since that's how they are over HCI as well. Update the
function to match this.
2015-08-14 08:37:47 +03:00
Abhirup Ghosh
cb65b949d1 emulator: Add support for ACL data transfer for servers 2015-07-30 13:29:14 +02:00
Marcel Holtmann
838abde25b emulator: Add support for scanning on different channels 2015-07-14 23:25:45 +02:00
Marcel Holtmann
81596d12b1 emulator: Add support for scan window and scan interval handling 2015-07-14 23:09:34 +02:00
Marcel Holtmann
8a4b1bd1bb emulator: Add support for using advertising delay values 2015-07-14 22:19:39 +02:00
Johan Hedberg
d7a375c0fc emulator: Add support for Read Encryption Key Size command 2015-06-11 13:14:38 +03:00
Johan Hedberg
b2d2df7433 emulator: Fix 2.0 HCI version (it's 0x03 and not 0x04) 2015-06-11 13:14:06 +03:00
Andrei Emeltchenko
30965b6a8c btdev: Indicate support for 4.2 encryption commands
Indicate btdev support for LE Generate DHKey and LE Read Local P-256
Public Key.
2015-05-22 14:47:47 +03:00
Johan Hedberg
665143e1cd emulator: Fix passing correct EDiv & Rand values 2015-05-22 14:42:20 +03:00
Szymon Janc
4453f67fcf emulator: Handle Host Number Of Completed Packets Command
The Host_Number_Of_Completed_Packets command is a special command in
the sense that no event is normally generated after the command
has completed.
2015-05-20 20:55:08 +03:00
Szymon Janc
7c2c6fbf57 emulator: Move Host Buffer Size Command handling block
Commands codes in switch-case are kept in ascending order.
2015-05-20 20:55:07 +03:00
Szymon Janc
fac4629544 emulator: Verify Set Controller To Host Flow Control Command
Return invalid parameters error if reserved value is used.
2015-05-20 20:55:05 +03:00
Johan Hedberg
8cd59c7734 emulator: Reset LE scan & adv state upon HCI_Reset 2015-05-20 11:11:40 +03:00
Johan Hedberg
5f5094dc55 emulator: Pretend to support host flow control command 2015-05-19 11:07:37 +03:00
Andrei Emeltchenko
26b9d72adf btdev: Add DHKey generation command to emulator
Add LE Generate DHKey Command available in Bluetooth Spec 4.2.
Controller sends Command Status and LE Meta event LE Generate DHKey
Complete.
...
> HCI Event: Command Status (0x0f) plen 4
      LE Generate DHKey (0x08|0x0026) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 34
      LE Generate DHKey Complete (0x09)
        Status: Success (0x00)
        Diffie-Hellman key:<key>
...
2015-05-17 10:39:13 +03:00
Andrei Emeltchenko
409de18730 btdev: Add LE Read Local Public Key cmd to emulator
Support LE Read Local P-256 Public Key Command introduced in Bluetooth
Spec 4.2. The Controller shall generate a new P-256 public/private key
pair upon receipt of this command so private key is saved to btdev.
2015-05-17 10:39:11 +03:00
Andrei Emeltchenko
9626d1e5b6 btdev: Refactor Le Rand using Linux crypto infrastructure
Use standard Linux crypto infrastructure for emulating HCI LE Rand
command.
2015-05-17 10:39:08 +03:00
Andrei Emeltchenko
1c8f39a843 btdev: Add LE Encrypt command support to emulator
Add basic crypto support to btdev using Linux crypto infrastructure.
2015-05-17 10:39:07 +03:00
Szymon Janc
f41312b893 emulator/bthost: Add support for setting custom ADV data
This allows to set any ADV data and not just flags.
2015-05-17 10:39:00 +03:00
Johan Hedberg
778e72c0c6 emulator: Fix ACL packet types from controller to host
The ACL packet type 0x00 is only allowed from host to controller. When
the packet is received at the remote end and is sent from controller
to host the type needs to be converted to 0x02.
2015-05-13 14:54:29 +03:00
Marcel Holtmann
f9796b5c35 emulator: Add support for LE remote features command 2015-04-08 01:18:30 -07:00
Marcel Holtmann
55ae8e29c0 emulator: Handle event for LE connection update complete indication 2015-04-01 15:45:03 -07:00
Marcel Holtmann
a0e24ed810 emulator: Add support for emulating Bluetooth 2.0 controllers 2015-03-29 15:15:48 -07:00
Szymon Janc
403de42ac2 emulator: Fix missing includes
writev requires #include <sys/uio.h>
memcpy and memset require #include <string.h>

This fix compilation error with musl.
2015-03-12 13:12:26 +01:00
Johan Hedberg
731e9954b3 emulator/bthost: Fix calling RFCOMM callback for zero-length data 2015-02-27 13:22:46 +02:00
Johan Hedberg
c2610013f9 emulator/smp: Fix sending BR/EDR SMP Pairing Request as slave 2015-02-16 12:51:08 +02:00
Marcel Holtmann
afdd96340a emulator: Use local includes for libbluetooth headers 2015-02-12 21:47:56 +01:00