Commit Graph

53 Commits

Author SHA1 Message Date
Archie Pusaka
a777d7d535 btio: Inclusive language changes
BT core spec 5.3 promotes the usage of inclusive languages.
This CL uses "central" as it is deemed to be more appropriate.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2021-09-21 10:51:53 +02:00
Luiz Augusto von Dentz
dfc2829b8c btio: Use G_PRIORITY_HIGH for watches
This makes btio watches default to G_PRIORITY_HIGH instead of
G_PRIORITY_DEFAULT so it takes priority over regular traffic or
timeout handling.
2021-02-16 14:51:04 -08:00
Tedd Ho-Jeong An
66b360a5ba btio: Fix the unchecked return value
This patch fixes the unchecked return value.
2020-11-24 13:03:46 -08:00
Tedd Ho-Jeong An
69af7d92b5 btio: Add SPDX License Identifier
This patch adds SPDX License Identifier and removes the license text.

-------------------------------------
       License            COUNT
-------------------------------------
 GPL-2.0-or-later     :      2

License: GPL-2.0-or-later
   btio/btio.h
   btio/btio.c
2020-09-21 16:19:33 -07:00
Luiz Augusto von Dentz
81629d982c btio: Fix not translation mode to L2CAP mode
When using L2CAP_OPTIONS legacy modes need to be used since they are
not compatible with BT_MODE.
2020-06-05 11:16:40 -07:00
Pali Rohár
f0b7c11ad7 btio: Fix error number
In commit d20ee8273e was unintentionally
negated error number. Fix this mistake.
2020-04-24 10:03:55 -07:00
Pali Rohár
d20ee8273e btio: Show destination address in connect error message
When connect() fails it is not possible to retrieve destination address as
socket is not bound. So put destination address into error message.
2020-04-22 11:20:20 -07:00
Luiz Augusto von Dentz
f2418bf97d btio: Add mode to for Enhanced Credit Mode
This adds BT_IO_MODE_EXT_FLOWCTL which directly maps to
BT_MODE_EXT_FLOWCTL.
2020-03-30 15:23:11 -07:00
Luiz Augusto von Dentz
ba1c07d2c4 btio: Add BT_IO_PHY option
This adds BT_IO_PHY option which can be used to read the underline
packet types/PHY in use by the link layer.
2020-02-19 13:44:54 -08:00
Marcel Holtmann
261948090e build: Move declaration of _GNU_SOURCE back into individual source files 2018-12-06 21:28:18 +01:00
Marcel Holtmann
2f77283513 btio: Use local libbluetooth includes 2015-02-28 22:29:12 -08:00
Szymon Janc
552d63be30 btio: List all enum values in switch
As described in coding style M10.
2014-12-08 14:00:28 +01:00
Michael Janssen
6353123e76 btio: Fix uninitialized usage compilation error
When compiling with --enable-maintainer-mode these throw
errors because of -Werror=maybe-uninitialized
2014-11-03 17:17:12 +02:00
Marcel Holtmann
cf866e55ad btio: Make sure voice setting are all zeroed first 2014-09-20 02:24:40 +02:00
Szymon Janc
2c8e43efc9 btio: Fix not setting getsockopt optlen for BT_SNDMTU 2014-06-13 14:30:33 +03:00
Szymon Janc
24aaa5c9d6 btio: Fix typo in error message 2014-06-13 14:30:33 +03:00
Johan Hedberg
ccd67f611c btio: Remove unnecessary get_peers() function 2014-04-02 14:06:53 +03:00
Johan Hedberg
8dec0f65b4 btio: Do RFCOMM peer address lookup only when really necessary 2014-04-02 14:06:53 +03:00
Johan Hedberg
56f443387e btio: Do L2CAP peer address lookup only when really necessary 2014-04-02 14:06:53 +03:00
Johan Hedberg
e87dadbe1b btio: Add missing BT_IO_OPT_DEST_TYPE getting support 2014-02-21 15:36:35 +02:00
Johan Hedberg
31bcaff56e tools/l2cap-tester: Add MTU checks after successful connections 2014-01-26 00:09:42 +02:00
Johan Hedberg
df8c064867 btio: Fix falling back to L2CAP_OPTIONS if BT_RCVMTU fails 2013-12-30 14:15:58 +02:00
Johan Hedberg
2de1d5a179 btio: Update to support sockopts for LE CoC sockets 2013-12-13 12:51:23 +02:00
Frédéric Dalleau
cf721a5364 btio: Add option for SCO voice setting 2013-08-01 12:36:25 +03:00
Johan Hedberg
ad17eb4eba btio: Add BT_IO_OPT_SOURCE_TYPE option for source bdaddr type 2013-05-17 11:03:11 +03:00
Cristian Rodríguez
c43a49ba67 btio: Fix missing config.h includes 2012-12-23 18:59:41 -08:00
Luiz Augusto von Dentz
2d0b8b0bb2 btio: Fix type detection for L2CAP fixed channels 2012-11-14 15:19:46 +02:00
Luiz Augusto von Dentz
99cf59d0b4 btio: Fix type detection when psm or channel are 0
They could be set to 0 on purpose so the kernel would automatically pick
one available.

To fix this now the detection is done while parsing the options, so in
case the user set the option to 0 it will automatically set the type
as well.
2012-11-14 15:10:07 +02:00
Johan Hedberg
b643623460 btio: Remove BT_IO_L2ERTM
There's no need to have a separate type for ERTM. The mode parameter
takes care of most needs and if necessary a "reliable" parameter can be
added later which will map to SOCK_STREAM usage.
2012-08-29 09:03:39 -07:00
Johan Hedberg
a0d52c9ad0 btio: Make BtIOType private
Since the socket type can be inferred from the socket itself or from the
PSM/Channel/CID/etc parameters provided to listen() and connect() it
doesn't make sense to expose this in the BtIO API.
2012-08-28 17:18:28 -07:00
Johan Hedberg
84bc0d0e57 btio: Remove unneeded L2CAP raw socket support
Now that pairing is done through mgmt this support is no-longer needed.
2012-08-28 13:58:05 -07:00
Claudio Takahasi
58a1819a44 btio: Connect callback errors handling cleanup
Condition verification is not required for this watch since the
condition to watch for was previously informed when it was added
in the mainloop.
2012-07-29 17:01:17 +02:00
Claudio Takahasi
5a3507c104 btio: Replace g_set_error by ERROR_FAILED macro
This patch replaces the calls of g_set_error function by the local
defined macro "ERROR_FAILED".
2012-07-29 16:58:51 +02:00
Paulo Alcantara
d9e204c065 btio: Rescue lost errorneous numbers
The BT_IO_ERROR_* flags are not used for anything else and we just
loosing errorneous numbers set in the sockets that might be more
useful for handling specific errors.

A use case would be disconnect errors that should not allow BlueZ to
enable auto connections since the connection would never be possible in
some cases.

This patch removes BT_IO_ERROR_* flags and use the errors set in the
sockets instead. Now, the errors passed in connect/disconnect callbacks
should contain proper error numbers passed to them.
2012-07-24 11:48:21 +02:00
Claudio Takahasi
d94f9cbf75 btio: Add address type in bt_io_connect
This patch adds a new BtIO option to allow setting the remote Bluetooth
address type for BLE connections. Allowed values for BT_IO_OPT_DEST_TYPE
option are: BDADDR_BREDR, BDADDR_LE_PUBLIC, and BDADDR_LE_RANDOM.
2012-04-25 12:58:48 +03:00
Luiz Augusto von Dentz
c2452f3d45 btio: Add BtIOMode enum to be used with BT_IO_OPT_MODE 2012-02-02 15:55:07 -08:00
Luiz Augusto von Dentz
11dbefe49d btio: Add L2ERTM type
L2ERTM type uses L2CAP socket in SOCK_STREAM instead of SOCK_SEQPACKET
2012-01-31 18:32:34 -08:00
Vinicius Costa Gomes
1e4c7d4379 btio: Remove the default security level from btio
The default value of sec_level when setting *any* option
using bt_io_set() was BT_SECURITY_MEDIUM. This was causing
the security procedure being started in some situations that
it should not.
2012-01-24 16:19:26 +02:00
Vinicius Costa Gomes
51886914ef btio: Add support for getting the Encryption Key Size via btio
Some profiles specify some restriction depending on the length
of the key used to encrypt the link, this adds an way to retrieve
that value from the kernel.
2012-01-24 16:19:19 +02:00
Marcel Holtmann
1d7a0c6997 btio: Remove support for hciX source addresses 2012-01-17 11:47:59 +01:00
Santiago Carot-Nemesio
14803c4e4f btio: Fix byte order conversion when getting L2CAP CID
The L2CAP CID is passed and received in little endian byte order
through the socket interface so a conversion is in place before
passing it onwards.
2011-12-08 14:23:04 +02:00
Santiago Carot-Nemesio
035c0bc524 btio: Fix byte order conversion when getting L2CAP PSM
The L2CAP PSM is passed and received in little endian byte order through
the socket interface so a conversion is in place before passing it
onwards.
2011-11-30 23:25:31 +02:00
Anderson Lizardo
467fcb8094 btio: Fix errno handling convention
Variables which are assigned to the errno variable (usually called
"err") should be negative, and "-err" should be used where a positive
value is needed.
2011-11-17 13:57:53 +02:00
Luiz Augusto von Dentz
992f24762f btio: add BT_IO_OPT_PRIORITY option
BT_IO_OPT_PRIORITY uses SO_PRIORITY to set the priority of the socket
2011-11-04 15:41:41 +02:00
Vinicius Costa Gomes
c141fcc366 btio: Fix the return value of bt_io functions
Some bt_io methods were ignoring the value stored in errno when
reporting the error to the caller.
2011-07-09 19:22:50 +03:00
Marcel Holtmann
29a46bf7db btio: Add workaround for not defined BT_FLUSHABLE 2011-05-27 10:22:07 -07:00
Johan Hedberg
9c7a6a48f2 btio: Fix unused variable warning 2011-05-15 01:55:16 +03:00
Anderson Briglia
b806430037 Fix btio.c compilation warning
This patch fixes a compilation warning regarding btio/btio.c. Actually
this warning seems a false positive by Ubuntu Natty GCC version. A new
bug on Ubuntu bug system was opened but if you do not want to wait until
it is analyzed, just apply this minor fix.

btio/btio.c: In function 'bt_io_get':
btio/btio.c:803:11: warning: 'flushable' may be used uninitialized in
this function
2011-05-05 22:14:03 +03:00
Johan Hedberg
071f7742be Add BT_FLUSHABLE support to BtIO
This patch adds support for the BT_FLUSHABLE L2CAP socket option through
BtIO. This can be used to mark data from specific L2CAP sockets to have
the flushable flag set in their corresponding ACL packets.
2011-04-21 10:15:04 +03:00
Luiz Augusto von Dentz
aef577312e Fix error message when getting SCO connection handle
Error message should indicate the transport correctly which is SCO
not RFCOMM.
2011-03-25 11:10:40 +02:00