* [RFC v5 0/5] Bluetooth LE 6LoWPAN
From: Jukka Rissanen @ 2013-11-20 12:07 UTC (permalink / raw)
To: linux-bluetooth
Hi,
this is 6LoWPAN code for BT LE as described in
http://tools.ietf.org/html/draft-ietf-6lo-btle-00
v5:
- Moved the header compression functionality to net/core/6lowpan.c
and rebased both BT and IEEE 802154 code to use it in patch 1.
I will send a separate patch to net-next for comments.
- locking fixes
- debugfs handling moved to hci_core.c
- misc changes according to Marcel's comments
v4:
- removed the route setting code, neighbour discovery
should allow the devices to discover each other
- fix the uncompression of Traffic Class in IPv6 header,
this makes ssh to work between devices over a BT 6lowpan link
- removed setting of /proc conf options, they were useless
and not to be done in kernel module anyway
v3:
- misc changes according to Marcel's comments
- supports multiple connections / interface
- removed unused fragmentation code
- setup 6lowpan connection automatically if enabled via debugfs
The automatic 6lowpan enabling is done by setting
echo 1 > /sys/kernel/debug/bluetooth/hci0/6lowpan
before devices are connected.
v2:
- Change ARPHRD_IEEE802154 to ARPHRD_RAWIP. The generic code
in patches 1 and 2 is also sent to netdev mailing list.
- Sending route exporting patch 5 to netdev ml
- Check private/public BT address and toggle universal/local bit
accordingly in patch 3.
- The virtual interface template name is now shorter (bt%d)
- Various function name renames
- devtype of the interface set to "bluetooth"
v1:
- initial release
TODO:
- Discovery of 6LoWPAN service needs be automatic (UUID support)
- Enable/disable header compression for easier debugging
Known issues:
- no UUID handling yet
Cheers,
Jukka
Jukka Rissanen (5):
6lowpan: Moving generic parts into net/core/6lowpan.c
net: if_arp: add ARPHRD_RAWIP type
ipv6: Add checks for RAWIP ARP type
Bluetooth: Enable 6LoWPAN support for BT LE devices
Bluetooth: Manually enable or disable 6LoWPAN between devices
include/net/bluetooth/hci.h | 1 +
include/net/bluetooth/hci_core.h | 1 +
include/net/bluetooth/l2cap.h | 1 +
include/uapi/linux/if_arp.h | 1 +
net/bluetooth/6lowpan.c | 880 +++++++++++++++++++++++++++++++++++++++
net/bluetooth/6lowpan.h | 26 ++
net/bluetooth/Makefile | 2 +-
net/bluetooth/hci_core.c | 93 +++++
net/bluetooth/hci_event.c | 3 +
net/bluetooth/l2cap_core.c | 14 +-
net/core/6lowpan.c | 812 ++++++++++++++++++++++++++++++++++++
net/core/6lowpan.h | 279 +++++++++++++
net/core/Makefile | 8 +
net/ieee802154/6lowpan.c | 708 +------------------------------
net/ieee802154/6lowpan.h | 247 -----------
net/ipv6/addrconf.c | 4 +-
16 files changed, 2135 insertions(+), 945 deletions(-)
create mode 100644 net/bluetooth/6lowpan.c
create mode 100644 net/bluetooth/6lowpan.h
create mode 100644 net/core/6lowpan.c
create mode 100644 net/core/6lowpan.h
delete mode 100644 net/ieee802154/6lowpan.h
--
1.8.3.1
^ permalink raw reply
* [PATCHv6 19/19] android/socket: Add SPP SDP record
From: Andrei Emeltchenko @ 2013-11-20 10:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1384943077-5366-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
android/socket.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 63 insertions(+), 1 deletion(-)
diff --git a/android/socket.c b/android/socket.c
index a71c51c..15aa77d 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -237,9 +237,69 @@ static sdp_record_t *create_pbap_record(uint8_t chan)
sdp_list_free(proto[1], NULL);
sdp_list_free(apseq, NULL);
sdp_list_free(pfseq, NULL);
+ sdp_list_free(aproto, NULL);
sdp_list_free(root, NULL);
sdp_list_free(svclass_id, NULL);
+
+ return record;
+}
+
+static sdp_record_t *create_spp_record(uint8_t chan)
+{
+ sdp_list_t *svclass_id, *apseq, *profiles, *root;
+ uuid_t root_uuid, sp_uuid, rfcomm;
+ sdp_profile_desc_t profile;
+ sdp_list_t *aproto, *proto[1];
+ sdp_data_t *channel;
+ sdp_record_t *record;
+
+ record = sdp_record_alloc();
+ if (!record)
+ return NULL;
+
+ record->handle = sdp_next_handle();
+
+ sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP);
+ root = sdp_list_append(NULL, &root_uuid);
+ sdp_set_browse_groups(record, root);
+
+ sdp_uuid16_create(&sp_uuid, SERIAL_PORT_SVCLASS_ID);
+ svclass_id = sdp_list_append(NULL, &sp_uuid);
+ sdp_set_service_classes(record, svclass_id);
+
+ sdp_uuid16_create(&profile.uuid, SERIAL_PORT_PROFILE_ID);
+ profile.version = 0x0100;
+ profiles = sdp_list_append(NULL, &profile);
+ sdp_set_profile_descs(record, profiles);
+
+ sdp_uuid16_create(&rfcomm, RFCOMM_UUID);
+ proto[0] = sdp_list_append(NULL, &rfcomm);
+ channel = sdp_data_alloc(SDP_UINT8, &chan);
+ proto[0] = sdp_list_append(proto[0], channel);
+ apseq = sdp_list_append(NULL, proto[0]);
+
+ aproto = sdp_list_append(NULL, apseq);
+ sdp_set_access_protos(record, aproto);
+
+ sdp_add_lang_attr(record);
+
+ sdp_set_info_attr(record, "Serial Port", "BlueZ", "COM Port");
+
+ sdp_set_url_attr(record, "http://www.bluez.org/",
+ "http://www.bluez.org/", "http://www.bluez.org/");
+
+ sdp_set_service_id(record, sp_uuid);
+ sdp_set_service_ttl(record, 0xffff);
+ sdp_set_service_avail(record, 0xff);
+ sdp_set_record_state(record, 0x00001234);
+
+ sdp_data_free(channel);
+ sdp_list_free(proto[0], NULL);
+ sdp_list_free(apseq, NULL);
sdp_list_free(aproto, NULL);
+ sdp_list_free(root, NULL);
+ sdp_list_free(svclass_id, NULL);
+ sdp_list_free(profiles, NULL);
return record;
}
@@ -278,7 +338,9 @@ static struct profile_info {
0x00, 0x00, 0x11, 0x01, 0x00, 0x00, 0x10, 0x00,
0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB
},
- .channel = SPP_DEFAULT_CHANNEL
+ .channel = SPP_DEFAULT_CHANNEL,
+ .svc_hint = 0,
+ .create_record = create_spp_record
},
};
--
1.7.10.4
^ permalink raw reply related
* [PATCHv6 18/19] android/socket: Add PBAP SDP record
From: Andrei Emeltchenko @ 2013-11-20 10:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1384943077-5366-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This adds SDP service record like shown below:
Service Name: OBEX Phonebook Access Server
Service RecHandle: 0x10002
Service Class ID List:
"Phonebook Access - PSE" (0x112f)
Protocol Descriptor List:
"RFCOMM" (0x0003)
Channel: 15
"OBEX" (0x0008)
Profile Descriptor List:
"Phonebook Access" (0x1130)
Version: 0x0100
---
android/socket.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 64 insertions(+), 1 deletion(-)
diff --git a/android/socket.c b/android/socket.c
index 32b2db6..a71c51c 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -183,6 +183,67 @@ static sdp_record_t *create_opp_record(uint8_t chan)
return record;
}
+static sdp_record_t *create_pbap_record(uint8_t chan)
+{
+ sdp_list_t *svclass_id, *pfseq, *apseq, *root;
+ uuid_t root_uuid, pbap_uuid, rfcomm_uuid, obex_uuid;
+ sdp_profile_desc_t profile[1];
+ sdp_list_t *aproto, *proto[2];
+ sdp_data_t *channel;
+ uint8_t formats[] = { 0x01 };
+ uint8_t dtd = SDP_UINT8;
+ sdp_data_t *sflist;
+ sdp_record_t *record;
+
+ record = sdp_record_alloc();
+ if (!record)
+ return NULL;
+
+ record->handle = sdp_next_handle();
+
+ sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP);
+ root = sdp_list_append(NULL, &root_uuid);
+ sdp_set_browse_groups(record, root);
+
+ sdp_uuid16_create(&pbap_uuid, PBAP_PSE_SVCLASS_ID);
+ svclass_id = sdp_list_append(NULL, &pbap_uuid);
+ sdp_set_service_classes(record, svclass_id);
+
+ sdp_uuid16_create(&profile[0].uuid, PBAP_PROFILE_ID);
+ profile[0].version = 0x0100;
+ pfseq = sdp_list_append(NULL, profile);
+ sdp_set_profile_descs(record, pfseq);
+
+ sdp_uuid16_create(&rfcomm_uuid, RFCOMM_UUID);
+ proto[0] = sdp_list_append(NULL, &rfcomm_uuid);
+ channel = sdp_data_alloc(SDP_UINT8, &chan);
+ proto[0] = sdp_list_append(proto[0], channel);
+ apseq = sdp_list_append(NULL, proto[0]);
+
+ sdp_uuid16_create(&obex_uuid, OBEX_UUID);
+ proto[1] = sdp_list_append(NULL, &obex_uuid);
+ apseq = sdp_list_append(apseq, proto[1]);
+
+ aproto = sdp_list_append(NULL, apseq);
+ sdp_set_access_protos(record, aproto);
+
+ sflist = sdp_data_alloc(dtd, formats);
+ sdp_attr_add(record, SDP_ATTR_SUPPORTED_REPOSITORIES, sflist);
+
+ sdp_set_info_attr(record, "OBEX Phonebook Access Server", NULL, NULL);
+
+ sdp_data_free(channel);
+ sdp_list_free(proto[0], NULL);
+ sdp_list_free(proto[1], NULL);
+ sdp_list_free(apseq, NULL);
+ sdp_list_free(pfseq, NULL);
+ sdp_list_free(root, NULL);
+ sdp_list_free(svclass_id, NULL);
+ sdp_list_free(aproto, NULL);
+
+ return record;
+}
+
static struct profile_info {
uint8_t uuid[16];
uint8_t channel;
@@ -195,7 +256,9 @@ static struct profile_info {
0x00, 0x00, 0x11, 0x2F, 0x00, 0x00, 0x10, 0x00,
0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB
},
- .channel = PBAP_DEFAULT_CHANNEL
+ .channel = PBAP_DEFAULT_CHANNEL,
+ .svc_hint = SVC_HINT_OBEX,
+ .create_record = create_pbap_record
}, {
.uuid = {
0x00, 0x00, 0x11, 0x05, 0x00, 0x00, 0x10, 0x00,
--
1.7.10.4
^ permalink raw reply related
* [PATCHv6 17/19] android/socket: Add SPP uuid to profile table
From: Andrei Emeltchenko @ 2013-11-20 10:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1384943077-5366-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
android/socket.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/android/socket.c b/android/socket.c
index 07588d5..32b2db6 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -45,6 +45,7 @@
#include "utils.h"
#include "socket.h"
+#define SPP_DEFAULT_CHANNEL 3
#define OPP_DEFAULT_CHANNEL 9
#define PBAP_DEFAULT_CHANNEL 15
#define MAS_DEFAULT_CHANNEL 16
@@ -209,7 +210,13 @@ static struct profile_info {
0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB
},
.channel = MAS_DEFAULT_CHANNEL
- }
+ }, {
+ .uuid = {
+ 0x00, 0x00, 0x11, 0x01, 0x00, 0x00, 0x10, 0x00,
+ 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB
+ },
+ .channel = SPP_DEFAULT_CHANNEL
+ },
};
static uint32_t sdp_service_register(struct profile_info *profile)
--
1.7.10.4
^ permalink raw reply related
* [PATCHv6 16/19] android/socket: Add MAS uuid to profile table
From: Andrei Emeltchenko @ 2013-11-20 10:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1384943077-5366-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
android/socket.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/android/socket.c b/android/socket.c
index 06b2906..07588d5 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -47,6 +47,7 @@
#define OPP_DEFAULT_CHANNEL 9
#define PBAP_DEFAULT_CHANNEL 15
+#define MAS_DEFAULT_CHANNEL 16
/* Use Object Transfer for all services */
#define SVC_HINT_OBEX 0x10
@@ -202,6 +203,12 @@ static struct profile_info {
.channel = OPP_DEFAULT_CHANNEL,
.svc_hint = SVC_HINT_OBEX,
.create_record = create_opp_record
+ }, {
+ .uuid = {
+ 0x00, 0x00, 0x11, 0x32, 0x00, 0x00, 0x10, 0x00,
+ 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB
+ },
+ .channel = MAS_DEFAULT_CHANNEL
}
};
--
1.7.10.4
^ permalink raw reply related
* [PATCHv6 15/19] android/socket: Add SDP record for OPP profile
From: Andrei Emeltchenko @ 2013-11-20 10:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1384943077-5366-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This adds SDP record for OPP shown below:
Service Name: OBEX Object Push
Service RecHandle: 0x10002
Service Class ID List:
"OBEX Object Push" (0x1105)
Protocol Descriptor List:
"RFCOMM" (0x0003)
Channel: 9
"OBEX" (0x0008)
Profile Descriptor List:
"OBEX Object Push" (0x1105)
Version: 0x0100
---
android/socket.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 98 insertions(+), 1 deletion(-)
diff --git a/android/socket.c b/android/socket.c
index 5862c9c..06b2906 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -35,7 +35,9 @@
#include "lib/sdp.h"
#include "lib/sdp_lib.h"
#include "src/sdp-client.h"
+#include "src/sdpd.h"
+#include "bluetooth.h"
#include "log.h"
#include "hal-msg.h"
#include "hal-ipc.h"
@@ -46,6 +48,9 @@
#define OPP_DEFAULT_CHANNEL 9
#define PBAP_DEFAULT_CHANNEL 15
+/* Use Object Transfer for all services */
+#define SVC_HINT_OBEX 0x10
+
static bdaddr_t adapter_addr;
/* Simple list of RFCOMM server sockets */
@@ -63,6 +68,7 @@ struct rfcomm_sock {
guint stack_watch;
bdaddr_t dst;
+ uint32_t service_handle;
};
static struct rfcomm_sock *create_rfsock(int sock, int *hal_fd)
@@ -102,9 +108,79 @@ static void cleanup_rfsock(struct rfcomm_sock *rfsock)
if (!g_source_remove(rfsock->stack_watch))
error("stack_watch source was not found");
+ if (rfsock->service_handle)
+ bt_adapter_remove_record(rfsock->service_handle);
+
g_free(rfsock);
}
+static sdp_record_t *create_opp_record(uint8_t chan)
+{
+ sdp_list_t *svclass_id, *pfseq, *apseq, *root;
+ uuid_t root_uuid, opush_uuid, rfcomm_uuid, obex_uuid;
+ sdp_profile_desc_t profile[1];
+ sdp_list_t *aproto, *proto[2];
+ uint8_t formats[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0xff };
+ void *dtds[sizeof(formats)], *values[sizeof(formats)];
+ unsigned int i;
+ uint8_t dtd = SDP_UINT8;
+ sdp_data_t *sflist;
+ sdp_data_t *channel;
+ sdp_record_t *record;
+
+ record = sdp_record_alloc();
+ if (!record)
+ return NULL;
+
+ record->handle = sdp_next_handle();
+
+ sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP);
+ root = sdp_list_append(NULL, &root_uuid);
+ sdp_set_browse_groups(record, root);
+
+ sdp_uuid16_create(&opush_uuid, OBEX_OBJPUSH_SVCLASS_ID);
+ svclass_id = sdp_list_append(NULL, &opush_uuid);
+ sdp_set_service_classes(record, svclass_id);
+
+ sdp_uuid16_create(&profile[0].uuid, OBEX_OBJPUSH_PROFILE_ID);
+ profile[0].version = 0x0100;
+ pfseq = sdp_list_append(NULL, profile);
+ sdp_set_profile_descs(record, pfseq);
+
+ sdp_uuid16_create(&rfcomm_uuid, RFCOMM_UUID);
+ proto[0] = sdp_list_append(NULL, &rfcomm_uuid);
+ channel = sdp_data_alloc(SDP_UINT8, &chan);
+ proto[0] = sdp_list_append(proto[0], channel);
+ apseq = sdp_list_append(NULL, proto[0]);
+
+ sdp_uuid16_create(&obex_uuid, OBEX_UUID);
+ proto[1] = sdp_list_append(NULL, &obex_uuid);
+ apseq = sdp_list_append(apseq, proto[1]);
+
+ aproto = sdp_list_append(NULL, apseq);
+ sdp_set_access_protos(record, aproto);
+
+ for (i = 0; i < sizeof(formats); i++) {
+ dtds[i] = &dtd;
+ values[i] = &formats[i];
+ }
+ sflist = sdp_seq_alloc(dtds, values, sizeof(formats));
+ sdp_attr_add(record, SDP_ATTR_SUPPORTED_FORMATS_LIST, sflist);
+
+ sdp_set_info_attr(record, "OBEX Object Push", NULL, NULL);
+
+ sdp_data_free(channel);
+ sdp_list_free(proto[0], NULL);
+ sdp_list_free(proto[1], NULL);
+ sdp_list_free(apseq, NULL);
+ sdp_list_free(pfseq, NULL);
+ sdp_list_free(aproto, NULL);
+ sdp_list_free(root, NULL);
+ sdp_list_free(svclass_id, NULL);
+
+ return record;
+}
+
static struct profile_info {
uint8_t uuid[16];
uint8_t channel;
@@ -123,10 +199,29 @@ static struct profile_info {
0x00, 0x00, 0x11, 0x05, 0x00, 0x00, 0x10, 0x00,
0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB
},
- .channel = OPP_DEFAULT_CHANNEL
+ .channel = OPP_DEFAULT_CHANNEL,
+ .svc_hint = SVC_HINT_OBEX,
+ .create_record = create_opp_record
}
};
+static uint32_t sdp_service_register(struct profile_info *profile)
+{
+ sdp_record_t *record;
+
+ record = profile->create_record(profile->channel);
+ if (!record)
+ return 0;
+
+ if (bt_adapter_add_record(record, profile->svc_hint) < 0) {
+ error("Failed to register on SDP record");
+ sdp_record_free(record);
+ return 0;
+ }
+
+ return record->handle;
+}
+
static int bt_sock_send_fd(int sock_fd, const void *buf, int len, int send_fd)
{
ssize_t ret;
@@ -421,6 +516,8 @@ static int handle_listen(void *buf)
return -1;
}
+ rfsock->service_handle = sdp_service_register(profile);
+
return hal_fd;
}
--
1.7.10.4
^ permalink raw reply related
* [PATCHv6 14/19] android/socket: Close file descriptor after sending
From: Andrei Emeltchenko @ 2013-11-20 10:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1384943077-5366-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
android/socket.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/android/socket.c b/android/socket.c
index d8e922d..5862c9c 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -613,6 +613,7 @@ void bt_sock_handle_cmd(int sk, uint8_t opcode, void *buf, uint16_t len)
break;
ipc_send(sk, HAL_SERVICE_ID_SOCK, opcode, 0, NULL, fd);
+ close(fd);
return;
case HAL_OP_SOCK_CONNECT:
fd = handle_connect(buf);
@@ -620,6 +621,7 @@ void bt_sock_handle_cmd(int sk, uint8_t opcode, void *buf, uint16_t len)
break;
ipc_send(sk, HAL_SERVICE_ID_SOCK, opcode, 0, NULL, fd);
+ close(fd);
return;
default:
DBG("Unhandled command, opcode 0x%x", opcode);
--
1.7.10.4
^ permalink raw reply related
* [PATCHv6 13/19] android/socket: Send connect signal to Android framework
From: Andrei Emeltchenko @ 2013-11-20 10:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1384943077-5366-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Android framework expects connect signal to be sent when
remote device is connected.
---
android/socket.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/android/socket.c b/android/socket.c
index 1d16bc7..d8e922d 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -424,6 +424,33 @@ static int handle_listen(void *buf)
return hal_fd;
}
+static bool sock_send_connect(struct rfcomm_sock *rfsock, bdaddr_t *bdaddr)
+{
+ struct hal_sock_connect_signal cmd;
+ int len;
+
+ DBG("");
+
+ memset(&cmd, 0, sizeof(cmd));
+ cmd.size = sizeof(cmd);
+ bdaddr2android(bdaddr, cmd.bdaddr);
+ cmd.channel = rfsock->channel;
+ cmd.status = 0;
+
+ len = write(rfsock->fd, &cmd, sizeof(cmd));
+ if (len < 0) {
+ error("%s", strerror(errno));
+ return false;
+ }
+
+ if (len != sizeof(cmd)) {
+ error("Error sending connect signal");
+ false;
+ }
+
+ return true;
+}
+
static void connect_cb(GIOChannel *io, GError *err, gpointer user_data)
{
struct rfcomm_sock *rfsock = user_data;
@@ -456,6 +483,9 @@ static void connect_cb(GIOChannel *io, GError *err, gpointer user_data)
rfsock->fd, rfsock->real_sock, rfsock->channel,
g_io_channel_unix_get_fd(io));
+ if (!sock_send_connect(rfsock, &dst))
+ goto fail;
+
/* Handle events from Android */
cond = G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL;
io_stack = g_io_channel_unix_new(rfsock->fd);
--
1.7.10.4
^ permalink raw reply related
* [PATCHv6 12/19] android/socket: Send RFCOMM channel to framework
From: Andrei Emeltchenko @ 2013-11-20 10:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1384943077-5366-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Framework expects channel to be send.
---
android/socket.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/android/socket.c b/android/socket.c
index e188c3f..1d16bc7 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -530,6 +530,11 @@ static void sdp_search_cb(sdp_list_t *recs, int err, gpointer data)
goto fail;
}
+ if (write(rfsock->fd, &chan, sizeof(chan)) != sizeof(chan)) {
+ error("Error sending RFCOMM channel");
+ goto fail;
+ }
+
rfsock->real_sock = g_io_channel_unix_get_fd(io);
rfsock->channel = chan;
connections = g_list_append(connections, rfsock);
--
1.7.10.4
^ permalink raw reply related
* [PATCHv6 11/19] android/socket: Implement HAL connect call
From: Andrei Emeltchenko @ 2013-11-20 10:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1384943077-5366-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
HAL connect uses similar event handlers like listen call.
---
android/socket.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/android/socket.c b/android/socket.c
index a5b28b7..e188c3f 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -426,6 +426,53 @@ static int handle_listen(void *buf)
static void connect_cb(GIOChannel *io, GError *err, gpointer user_data)
{
+ struct rfcomm_sock *rfsock = user_data;
+ GIOChannel *io_stack;
+ GError *gerr = NULL;
+ bdaddr_t dst;
+ char address[18];
+ int chan = -1;
+ guint id;
+ GIOCondition cond;
+
+ if (err) {
+ error("%s", err->message);
+ goto fail;
+ }
+
+ bt_io_get(io, &gerr,
+ BT_IO_OPT_DEST_BDADDR, &dst,
+ BT_IO_OPT_INVALID);
+ if (gerr) {
+ error("%s", gerr->message);
+ g_error_free(gerr);
+ goto fail;
+ }
+
+ ba2str(&dst, address);
+ DBG("Connected to %s rfsock %p chan %d", address, rfsock, chan);
+
+ DBG("rfsock: fd %d real_sock %d chan %u sock %d",
+ rfsock->fd, rfsock->real_sock, rfsock->channel,
+ g_io_channel_unix_get_fd(io));
+
+ /* Handle events from Android */
+ cond = G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL;
+ io_stack = g_io_channel_unix_new(rfsock->fd);
+ id = g_io_add_watch(io_stack, cond, sock_stack_event_cb, rfsock);
+ g_io_channel_unref(io_stack);
+
+ rfsock->stack_watch = id;
+
+ /* Handle rfcomm events */
+ cond = G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL;
+ id = g_io_add_watch(io, cond, sock_rfcomm_event_cb, rfsock);
+
+ rfsock->rfcomm_watch = id;
+
+ return;
+fail:
+ cleanup_rfsock(rfsock);
}
static void sdp_search_cb(sdp_list_t *recs, int err, gpointer data)
--
1.7.10.4
^ permalink raw reply related
* [PATCHv6 10/19] android/socket: Parse SDP response and connect
From: Andrei Emeltchenko @ 2013-11-20 10:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1384943077-5366-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Parse SDP response, find RFCOMM channel and connect.
---
android/socket.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 63 insertions(+)
diff --git a/android/socket.c b/android/socket.c
index 1815367..a5b28b7 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -424,9 +424,72 @@ static int handle_listen(void *buf)
return hal_fd;
}
+static void connect_cb(GIOChannel *io, GError *err, gpointer user_data)
+{
+}
+
static void sdp_search_cb(sdp_list_t *recs, int err, gpointer data)
{
+ struct rfcomm_sock *rfsock = data;
+ GError *gerr = NULL;
+ sdp_list_t *list;
+ GIOChannel *io;
+ int chan;
+
DBG("");
+
+ if (err < 0) {
+ error("Unable to get SDP record: %s", strerror(-err));
+ goto fail;
+ }
+
+ if (!recs || !recs->data) {
+ error("No SDP records found");
+ goto fail;
+ }
+
+ for (list = recs; list != NULL; list = list->next) {
+ sdp_record_t *rec = list->data;
+ sdp_list_t *protos;
+
+ if (sdp_get_access_protos(rec, &protos) < 0) {
+ error("Unable to get proto list");
+ goto fail;
+ }
+
+ chan = sdp_get_proto_port(protos, RFCOMM_UUID);
+
+ sdp_list_foreach(protos, (sdp_list_func_t) sdp_list_free,
+ NULL);
+ sdp_list_free(protos, NULL);
+ }
+
+ if (chan <= 0) {
+ error("Could not get RFCOMM channel %d", chan);
+ goto fail;
+ }
+
+ DBG("Got RFCOMM channel %d", chan);
+
+ io = bt_io_connect(connect_cb, rfsock, NULL, &gerr,
+ BT_IO_OPT_SOURCE_BDADDR, &adapter_addr,
+ BT_IO_OPT_DEST_BDADDR, &rfsock->dst,
+ BT_IO_OPT_CHANNEL, chan,
+ BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW,
+ BT_IO_OPT_INVALID);
+ if (!io) {
+ error("Failed connect: %s", gerr->message);
+ g_error_free(gerr);
+ goto fail;
+ }
+
+ rfsock->real_sock = g_io_channel_unix_get_fd(io);
+ rfsock->channel = chan;
+ connections = g_list_append(connections, rfsock);
+ return;
+
+fail:
+ cleanup_rfsock(rfsock);
}
static int handle_connect(void *buf)
--
1.7.10.4
^ permalink raw reply related
* [PATCHv6 09/19] android/socket: Implement socket connect HAL method
From: Andrei Emeltchenko @ 2013-11-20 10:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1384943077-5366-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
First step is to query remote device for RFCOMM channel.
---
android/socket.c | 35 +++++++++++++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/android/socket.c b/android/socket.c
index 90561dc..1815367 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -33,6 +33,9 @@
#include "lib/bluetooth.h"
#include "btio/btio.h"
#include "lib/sdp.h"
+#include "lib/sdp_lib.h"
+#include "src/sdp-client.h"
+
#include "log.h"
#include "hal-msg.h"
#include "hal-ipc.h"
@@ -58,6 +61,8 @@ struct rfcomm_sock {
guint rfcomm_watch;
guint stack_watch;
+
+ bdaddr_t dst;
};
static struct rfcomm_sock *create_rfsock(int sock, int *hal_fd)
@@ -419,11 +424,37 @@ static int handle_listen(void *buf)
return hal_fd;
}
+static void sdp_search_cb(sdp_list_t *recs, int err, gpointer data)
+{
+ DBG("");
+}
+
static int handle_connect(void *buf)
{
- DBG("Not implemented");
+ struct hal_cmd_sock_connect *cmd = buf;
+ struct rfcomm_sock *rfsock;
+ bdaddr_t dst;
+ uuid_t uuid;
+ int hal_fd = -1;
- return -1;
+ DBG("");
+
+ android2bdaddr(cmd->bdaddr, &dst);
+ rfsock = create_rfsock(-1, &hal_fd);
+ bacpy(&rfsock->dst, &dst);
+
+ memset(&uuid, 0, sizeof(uuid));
+ uuid.type = SDP_UUID128;
+ memcpy(&uuid.value.uuid128, cmd->uuid, sizeof(uint128_t));
+
+ if (bt_search_service(&adapter_addr, &dst, &uuid, sdp_search_cb, rfsock,
+ NULL) < 0) {
+ error("Failed to search SDP records");
+ cleanup_rfsock(rfsock);
+ return -1;
+ }
+
+ return hal_fd;
}
void bt_sock_handle_cmd(int sk, uint8_t opcode, void *buf, uint16_t len)
--
1.7.10.4
^ permalink raw reply related
* [PATCHv6 08/19] android/socket: Notify channel to Android framework
From: Andrei Emeltchenko @ 2013-11-20 10:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1384943077-5366-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Android framework expects to receive channel number as int.
---
android/socket.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/android/socket.c b/android/socket.c
index 5901d45..90561dc 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -410,6 +410,12 @@ static int handle_listen(void *buf)
DBG("real_sock %d fd %d hal_fd %d", rfsock->real_sock, rfsock->fd,
hal_fd);
+ if (write(rfsock->fd, &chan, sizeof(chan)) != sizeof(chan)) {
+ error("Error sending RFCOMM channel");
+ cleanup_rfsock(rfsock);
+ return -1;
+ }
+
return hal_fd;
}
--
1.7.10.4
^ permalink raw reply related
* [PATCHv6 07/19] android/socket: Send accept signal to Android framework
From: Andrei Emeltchenko @ 2013-11-20 10:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1384943077-5366-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Android expects to get accept signal over file descriptor which was
set during listen HAL call.
---
android/socket.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 67 insertions(+)
diff --git a/android/socket.c b/android/socket.c
index 3e738a4..5901d45 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -37,6 +37,7 @@
#include "hal-msg.h"
#include "hal-ipc.h"
#include "ipc.h"
+#include "utils.h"
#include "socket.h"
#define OPP_DEFAULT_CHANNEL 9
@@ -121,6 +122,45 @@ static struct profile_info {
}
};
+static int bt_sock_send_fd(int sock_fd, const void *buf, int len, int send_fd)
+{
+ ssize_t ret;
+ struct msghdr msg;
+ struct cmsghdr *cmsg;
+ struct iovec iv;
+ char msgbuf[CMSG_SPACE(1)];
+
+ DBG("len %d sock_fd %d send_fd %d", len, sock_fd, send_fd);
+
+ if (sock_fd == -1 || send_fd == -1)
+ return -1;
+
+ memset(&msg, 0, sizeof(msg));
+
+ msg.msg_control = msgbuf;
+ msg.msg_controllen = sizeof(msgbuf);
+ cmsg = CMSG_FIRSTHDR(&msg);
+ cmsg->cmsg_level = SOL_SOCKET;
+ cmsg->cmsg_type = SCM_RIGHTS;
+ cmsg->cmsg_len = CMSG_LEN(sizeof(send_fd));
+ memcpy(CMSG_DATA(cmsg), &send_fd, sizeof(send_fd));
+
+ iv.iov_base = (unsigned char *) buf;
+ iv.iov_len = len;
+
+ msg.msg_iov = &iv;
+ msg.msg_iovlen = 1;
+
+ ret = sendmsg(sock_fd, &msg, MSG_NOSIGNAL);
+ if (ret < 0) {
+ error("sendmsg(): sock_fd %d send_fd %d: %s",
+ sock_fd, send_fd, strerror(errno));
+ return ret;
+ }
+
+ return ret;
+}
+
static struct profile_info *get_profile_by_uuid(const uint8_t *uuid)
{
unsigned int i;
@@ -240,6 +280,28 @@ fail:
return FALSE;
}
+static bool sock_send_accept(struct rfcomm_sock *rfsock, bdaddr_t *bdaddr,
+ int fd_accepted)
+{
+ struct hal_sock_connect_signal cmd;
+ int len;
+
+ DBG("");
+
+ cmd.size = sizeof(cmd);
+ bdaddr2android(bdaddr, cmd.bdaddr);
+ cmd.channel = rfsock->channel;
+ cmd.status = 0;
+
+ len = bt_sock_send_fd(rfsock->fd, &cmd, sizeof(cmd), fd_accepted);
+ if (len != sizeof(cmd)) {
+ error("Error sending accept signal");
+ return false;
+ }
+
+ return true;
+}
+
static void accept_cb(GIOChannel *io, GError *err, gpointer user_data)
{
struct rfcomm_sock *rfsock = user_data;
@@ -279,6 +341,11 @@ static void accept_cb(GIOChannel *io, GError *err, gpointer user_data)
rfsock->fd, rfsock->real_sock, rfsock->channel,
sock_acc);
+ if (!sock_send_accept(rfsock, &dst, hal_fd)) {
+ cleanup_rfsock(rfsock_acc);
+ return;
+ }
+
/* Handle events from Android */
cond = G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL;
io_stack = g_io_channel_unix_new(rfsock_acc->fd);
--
1.7.10.4
^ permalink raw reply related
* [PATCHv6 06/19] android/socket: Implement RFCOMM events
From: Andrei Emeltchenko @ 2013-11-20 10:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1384943077-5366-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Copy data from RFCOMM socket to Android framework. Consider splice
in the future.
---
android/socket.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/android/socket.c b/android/socket.c
index 49b7413..3e738a4 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -201,7 +201,43 @@ fail:
static gboolean sock_rfcomm_event_cb(GIOChannel *io, GIOCondition cond,
gpointer data)
{
+ struct rfcomm_sock *rfsock = data;
+ unsigned char buf[1024];
+ int len, sent;
+
+ DBG("rfsock: fd %d real_sock %d chan %u sock %d",
+ rfsock->fd, rfsock->real_sock, rfsock->channel,
+ g_io_channel_unix_get_fd(io));
+
+ if (cond & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) {
+ error("Socket error: sock %d cond %d",
+ g_io_channel_unix_get_fd(io), cond);
+ goto fail;
+ }
+
+ len = read(rfsock->real_sock, buf, sizeof(buf));
+ if (len <= 0) {
+ error("read(): %s", strerror(errno));
+ /* Read again */
+ return TRUE;
+ }
+
+ DBG("read %d bytes, write to fd %d", len, rfsock->fd);
+
+ sent = try_write_all(rfsock->fd, buf, len);
+ if (sent < 0) {
+ error("write(): %s", strerror(errno));
+ goto fail;
+ }
+
+ DBG("Written %d bytes", sent);
+
return TRUE;
+fail:
+ connections = g_list_remove(connections, rfsock);
+ cleanup_rfsock(rfsock);
+
+ return FALSE;
}
static void accept_cb(GIOChannel *io, GError *err, gpointer user_data)
--
1.7.10.4
^ permalink raw reply related
* [PATCHv6 05/19] android/socket: Implement Android RFCOMM stack events
From: Andrei Emeltchenko @ 2013-11-20 10:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1384943077-5366-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Handle events from Android framework. Write everything to real RFCOMM
socket. Consider splice() in the future.
---
android/socket.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
diff --git a/android/socket.c b/android/socket.c
index 48afd4b..49b7413 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -133,10 +133,69 @@ static struct profile_info *get_profile_by_uuid(const uint8_t *uuid)
return NULL;
}
+static int try_write_all(int fd, unsigned char *buf, int len)
+{
+ int sent = 0;
+
+ while (len > 0) {
+ int written;
+
+ written = write(fd, buf, len);
+ if (written < 0) {
+ if (errno == EINTR || errno == EAGAIN)
+ continue;
+ return -1;
+ }
+
+ if (!written)
+ return 0;
+
+ len -= written; buf += written; sent += written;
+ }
+
+ return sent;
+}
+
static gboolean sock_stack_event_cb(GIOChannel *io, GIOCondition cond,
gpointer data)
{
+ struct rfcomm_sock *rfsock = data;
+ unsigned char buf[1024];
+ int len, sent;
+
+ DBG("rfsock: fd %d real_sock %d chan %u sock %d",
+ rfsock->fd, rfsock->real_sock, rfsock->channel,
+ g_io_channel_unix_get_fd(io));
+
+ if (cond & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) {
+ error("Socket error: sock %d cond %d",
+ g_io_channel_unix_get_fd(io), cond);
+ goto fail;
+ }
+
+ len = read(rfsock->fd, buf, sizeof(buf));
+ if (len <= 0) {
+ error("read(): %s", strerror(errno));
+ /* Read again */
+ return TRUE;
+ }
+
+ DBG("read %d bytes write to %d", len, rfsock->real_sock);
+
+ sent = try_write_all(rfsock->real_sock, buf, len);
+ if (sent < 0) {
+ error("write(): %s", strerror(errno));
+ goto fail;
+ }
+
+ DBG("Written %d bytes", sent);
+
return TRUE;
+fail:
+ connections = g_list_remove(connections, rfsock);
+ cleanup_rfsock(rfsock);
+
+ return FALSE;
}
static gboolean sock_rfcomm_event_cb(GIOChannel *io, GIOCondition cond,
--
1.7.10.4
^ permalink raw reply related
* [PATCHv6 04/19] android/socket: Implement socket accepted event
From: Andrei Emeltchenko @ 2013-11-20 10:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1384943077-5366-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
When we get accepted event we create rfcomm slot and start listening
for events from Android framework and from RFCOMM real socket.
---
android/socket.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/android/socket.c b/android/socket.c
index b8d96f9..48afd4b 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -133,8 +133,74 @@ static struct profile_info *get_profile_by_uuid(const uint8_t *uuid)
return NULL;
}
+static gboolean sock_stack_event_cb(GIOChannel *io, GIOCondition cond,
+ gpointer data)
+{
+ return TRUE;
+}
+
+static gboolean sock_rfcomm_event_cb(GIOChannel *io, GIOCondition cond,
+ gpointer data)
+{
+ return TRUE;
+}
+
static void accept_cb(GIOChannel *io, GError *err, gpointer user_data)
{
+ struct rfcomm_sock *rfsock = user_data;
+ struct rfcomm_sock *rfsock_acc;
+ GIOChannel *io_stack;
+ GError *gerr = NULL;
+ bdaddr_t dst;
+ char address[18];
+ int sock_acc;
+ int hal_fd;
+ guint id;
+ GIOCondition cond;
+
+ if (err) {
+ error("%s", err->message);
+ return;
+ }
+
+ bt_io_get(io, &gerr,
+ BT_IO_OPT_DEST_BDADDR, &dst,
+ BT_IO_OPT_INVALID);
+ if (gerr) {
+ error("%s", gerr->message);
+ g_error_free(gerr);
+ g_io_channel_shutdown(io, TRUE, NULL);
+ return;
+ }
+
+ ba2str(&dst, address);
+ DBG("Incoming connection from %s rfsock %p", address, rfsock);
+
+ sock_acc = g_io_channel_unix_get_fd(io);
+ rfsock_acc = create_rfsock(sock_acc, &hal_fd);
+ connections = g_list_append(connections, rfsock_acc);
+
+ DBG("rfsock: fd %d real_sock %d chan %u sock %d",
+ rfsock->fd, rfsock->real_sock, rfsock->channel,
+ sock_acc);
+
+ /* Handle events from Android */
+ cond = G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL;
+ io_stack = g_io_channel_unix_new(rfsock_acc->fd);
+ id = g_io_add_watch(io_stack, cond, sock_stack_event_cb, rfsock_acc);
+ g_io_channel_unref(io_stack);
+
+ rfsock_acc->stack_watch = id;
+
+ /* Handle rfcomm events */
+ cond = G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL;
+ id = g_io_add_watch(io, cond, sock_rfcomm_event_cb, rfsock_acc);
+
+ rfsock_acc->rfcomm_watch = id;
+
+ DBG("rfsock %p rfsock_acc %p stack_watch %d rfcomm_watch %d",
+ rfsock, rfsock_acc, rfsock_acc->stack_watch,
+ rfsock_acc->rfcomm_watch);
}
static int handle_listen(void *buf)
--
1.7.10.4
^ permalink raw reply related
* [PATCHv6 03/19] android/socket: Implement listen on RFCOMM socket
From: Andrei Emeltchenko @ 2013-11-20 10:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1384943077-5366-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Handle HAL socket listen call. Create RFCOMM socket and wait for events.
---
android/socket.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/android/socket.c b/android/socket.c
index e19b2aa..b8d96f9 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -133,11 +133,17 @@ static struct profile_info *get_profile_by_uuid(const uint8_t *uuid)
return NULL;
}
+static void accept_cb(GIOChannel *io, GError *err, gpointer user_data)
+{
+}
+
static int handle_listen(void *buf)
{
struct hal_cmd_sock_listen *cmd = buf;
struct profile_info *profile;
struct rfcomm_sock *rfsock;
+ GIOChannel *io;
+ GError *err = NULL;
int hal_fd;
int chan;
@@ -155,6 +161,27 @@ static int handle_listen(void *buf)
if (!rfsock)
return -1;
+ io = bt_io_listen(accept_cb, NULL, rfsock, NULL, &err,
+ BT_IO_OPT_SOURCE_BDADDR, &adapter_addr,
+ BT_IO_OPT_CHANNEL, chan,
+ BT_IO_OPT_INVALID);
+ if (!io) {
+ error("Failed listen: %s", err->message);
+ g_error_free(err);
+ cleanup_rfsock(rfsock);
+ return -1;
+ }
+
+ rfsock->real_sock = g_io_channel_unix_get_fd(io);
+ servers = g_list_append(servers, rfsock);
+
+ /* TODO: Add server watch */
+ g_io_channel_set_close_on_unref(io, TRUE);
+ g_io_channel_unref(io);
+
+ DBG("real_sock %d fd %d hal_fd %d", rfsock->real_sock, rfsock->fd,
+ hal_fd);
+
return hal_fd;
}
--
1.7.10.4
^ permalink raw reply related
* [PATCHv6 02/19] android/socket: Handling rfcomm sockets
From: Andrei Emeltchenko @ 2013-11-20 10:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1384943077-5366-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Implement functions creating and destroying rfcomm_socket structures.
---
android/socket.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 63 insertions(+), 1 deletion(-)
diff --git a/android/socket.c b/android/socket.c
index d4c7674..e19b2aa 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -27,6 +27,7 @@
#include <glib.h>
#include <stdbool.h>
+#include <unistd.h>
#include <errno.h>
#include "lib/bluetooth.h"
@@ -43,6 +44,61 @@
static bdaddr_t adapter_addr;
+/* Simple list of RFCOMM server sockets */
+GList *servers = NULL;
+
+/* Simple list of RFCOMM connected sockets */
+GList *connections = NULL;
+
+struct rfcomm_sock {
+ int fd; /* descriptor for communication with Java framework */
+ int real_sock; /* real RFCOMM socket */
+ int channel; /* RFCOMM channel */
+
+ guint rfcomm_watch;
+ guint stack_watch;
+};
+
+static struct rfcomm_sock *create_rfsock(int sock, int *hal_fd)
+{
+ int fds[2] = {-1, -1};
+ struct rfcomm_sock *rfsock;
+
+ if (socketpair(AF_LOCAL, SOCK_STREAM, 0, fds) < 0) {
+ error("socketpair(): %s", strerror(errno));
+ *hal_fd = -1;
+ return NULL;
+ }
+
+ rfsock = g_new0(struct rfcomm_sock, 1);
+ rfsock->fd = fds[0];
+ *hal_fd = fds[1];
+ rfsock->real_sock = sock;
+
+ return rfsock;
+}
+
+static void cleanup_rfsock(struct rfcomm_sock *rfsock)
+{
+ DBG("rfsock: %p fd %d real_sock %d chan %u",
+ rfsock, rfsock->fd, rfsock->real_sock, rfsock->channel);
+
+ if (rfsock->fd > 0)
+ close(rfsock->fd);
+ if (rfsock->real_sock > 0)
+ close(rfsock->real_sock);
+
+ if (rfsock->rfcomm_watch > 0)
+ if (!g_source_remove(rfsock->rfcomm_watch))
+ error("rfcomm_watch source was not found");
+
+ if (rfsock->stack_watch > 0)
+ if (!g_source_remove(rfsock->stack_watch))
+ error("stack_watch source was not found");
+
+ g_free(rfsock);
+}
+
static struct profile_info {
uint8_t uuid[16];
uint8_t channel;
@@ -81,6 +137,8 @@ static int handle_listen(void *buf)
{
struct hal_cmd_sock_listen *cmd = buf;
struct profile_info *profile;
+ struct rfcomm_sock *rfsock;
+ int hal_fd;
int chan;
DBG("");
@@ -93,7 +151,11 @@ static int handle_listen(void *buf)
DBG("rfcomm channel %d", chan);
- return -1;
+ rfsock = create_rfsock(-1, &hal_fd);
+ if (!rfsock)
+ return -1;
+
+ return hal_fd;
}
static int handle_connect(void *buf)
--
1.7.10.4
^ permalink raw reply related
* [PATCHv6 01/19] android/socket: Add get RFCOMM default channel
From: Andrei Emeltchenko @ 2013-11-20 10:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1384943077-5366-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
RFCOMM default channel is the same like in other BlueZ code, it is
defined in src/profile.c
---
android/socket.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 53 insertions(+), 1 deletion(-)
diff --git a/android/socket.c b/android/socket.c
index 04bb7d1..d4c7674 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -27,19 +27,71 @@
#include <glib.h>
#include <stdbool.h>
+#include <errno.h>
#include "lib/bluetooth.h"
+#include "btio/btio.h"
+#include "lib/sdp.h"
#include "log.h"
#include "hal-msg.h"
#include "hal-ipc.h"
#include "ipc.h"
#include "socket.h"
+#define OPP_DEFAULT_CHANNEL 9
+#define PBAP_DEFAULT_CHANNEL 15
+
static bdaddr_t adapter_addr;
+static struct profile_info {
+ uint8_t uuid[16];
+ uint8_t channel;
+ uint8_t svc_hint;
+ BtIOSecLevel sec_level;
+ sdp_record_t * (*create_record)(uint8_t chan);
+} profiles[] = {
+ {
+ .uuid = {
+ 0x00, 0x00, 0x11, 0x2F, 0x00, 0x00, 0x10, 0x00,
+ 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB
+ },
+ .channel = PBAP_DEFAULT_CHANNEL
+ }, {
+ .uuid = {
+ 0x00, 0x00, 0x11, 0x05, 0x00, 0x00, 0x10, 0x00,
+ 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB
+ },
+ .channel = OPP_DEFAULT_CHANNEL
+ }
+};
+
+static struct profile_info *get_profile_by_uuid(const uint8_t *uuid)
+{
+ unsigned int i;
+
+ for (i = 0; i < G_N_ELEMENTS(profiles); i++) {
+ if (!memcmp(profiles[i].uuid, uuid, 16))
+ return &profiles[i];
+ }
+
+ return NULL;
+}
+
static int handle_listen(void *buf)
{
- DBG("Not implemented");
+ struct hal_cmd_sock_listen *cmd = buf;
+ struct profile_info *profile;
+ int chan;
+
+ DBG("");
+
+ profile = get_profile_by_uuid(cmd->uuid);
+ if (!profile)
+ return -1;
+
+ chan = profile->channel;
+
+ DBG("rfcomm channel %d", chan);
return -1;
}
--
1.7.10.4
^ permalink raw reply related
* [PATCHv6 00/19] Socket HAL
From: Andrei Emeltchenko @ 2013-11-20 10:24 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This is initial code implementing socket HAL. OPP currently works with send/receive files. Probaly
other profiles works as well, not tested yet.
Changes:
* v6: Use watch_id to remove source and general cleanup
* v5: Changed uuid_to_chan table to profile table keeping information about profile like: channel, create_record,
svc_hint and sec_level.
* v4: Changed name rfslot -> rfsock following Johan's comment and other cosmetic changes, fixed one bug in SDP
record, use NULL instead of 0 for sdp functions.
* v3: Fixed coding style with write/send between file descriptors.
* v2: Following Marcel comments changed way copying between file descriptors works, added SDP record
for OPP and now it is possible to send files through GUI. Merged one patch with structures with actual user.
* v1: Rebased and use static src address, hal_fd removed from structure and closed after sent to framework,
added connect calls and SDP parsing, added cleanup_rfcomm function, minor fixes.
* RFC Initial
TODO:
* Use sec_level / check what to do with Android supplied security flags.
* Use splice() (requires bionic change first)
For tracking rfcomm sockets I use structure rfslot which has following
fields:
- real_sock - real RFCOMM socket
- fd - fd to communicate with Android framework
create_rfslot sets hal_fd which is fd passed to Android framework with CMSG
Andrei Emeltchenko (19):
android/socket: Add get RFCOMM default channel
android/socket: Handling rfcomm sockets
android/socket: Implement listen on RFCOMM socket
android/socket: Implement socket accepted event
android/socket: Implement Android RFCOMM stack events
android/socket: Implement RFCOMM events
android/socket: Send accept signal to Android framework
android/socket: Notify channel to Android framework
android/socket: Implement socket connect HAL method
android/socket: Parse SDP response and connect
android/socket: Implement HAL connect call
android/socket: Send RFCOMM channel to framework
android/socket: Send connect signal to Android framework
android/socket: Close file descriptor after sending
android/socket: Add SDP record for OPP profile
android/socket: Add MAS uuid to profile table
android/socket: Add SPP uuid to profile table
android/socket: Add PBAP SDP record
android/socket: Add SPP SDP record
android/socket.c | 797 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 793 insertions(+), 4 deletions(-)
--
1.7.10.4
^ permalink raw reply
* [PATCH BlueZ] android/a2dp: Cleanup devices on unregister
From: Luiz Augusto von Dentz @ 2013-11-20 9:39 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This cleanup any existing devices in bt_a2dp_unregister
---
android/a2dp.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/android/a2dp.c b/android/a2dp.c
index a9e7c65..55a433e 100644
--- a/android/a2dp.c
+++ b/android/a2dp.c
@@ -109,6 +109,11 @@ static void bt_a2dp_notify_state(struct a2dp_device *dev, uint8_t state)
ipc_send(notification_sk, HAL_SERVICE_ID_A2DP,
HAL_EV_A2DP_CONN_STATE, sizeof(ev), &ev, -1);
+
+ if (state != HAL_A2DP_STATE_DISCONNECTED)
+ return;
+
+ a2dp_device_free(dev);
}
static gboolean watch_cb(GIOChannel *chan, GIOCondition cond, gpointer data)
@@ -117,8 +122,6 @@ static gboolean watch_cb(GIOChannel *chan, GIOCondition cond, gpointer data)
bt_a2dp_notify_state(dev, HAL_A2DP_STATE_DISCONNECTED);
- a2dp_device_free(dev);
-
return FALSE;
}
@@ -130,7 +133,6 @@ static void signaling_connect_cb(GIOChannel *chan, GError *err,
if (err) {
bt_a2dp_notify_state(dev, HAL_A2DP_STATE_DISCONNECTED);
error("%s", err->message);
- a2dp_device_free(dev);
return;
}
@@ -364,6 +366,13 @@ bool bt_a2dp_register(int sk, const bdaddr_t *addr)
return true;
}
+static void a2dp_device_disconnected(gpointer data, gpointer user_data)
+{
+ struct a2dp_device *dev = data;
+
+ bt_a2dp_notify_state(dev, HAL_A2DP_STATE_DISCONNECTED);
+}
+
void bt_a2dp_unregister(void)
{
DBG("");
@@ -371,6 +380,9 @@ void bt_a2dp_unregister(void)
if (notification_sk < 0)
return;
+ g_slist_foreach(devices, a2dp_device_disconnected, NULL);
+ devices = NULL;
+
notification_sk = -1;
bt_adapter_remove_record(record_id);
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH_v2 2/4] android: Handle multiple init(register) and cleanup(unregister) calls properly
From: Luiz Augusto von Dentz @ 2013-11-20 9:09 UTC (permalink / raw)
To: Szymon Janc; +Cc: Ravi kumar Veeramally, BlueZ development
In-Reply-To: <CAOR4+gJGyU2Fh1bRq85kaJcdD5Ranc1uEutSmbtDBZvF4uo_7w@mail.gmail.com>
Hi Szymon,
On Wed, Nov 20, 2013 at 9:02 AM, Szymon Janc <szymon.janc@tieto.com> wrote:
> Hi Ravi,
>
> On Tue, Nov 19, 2013 at 3:56 PM, Ravi kumar Veeramally
> <ravikumar.veeramally@linux.intel.com> wrote:
>> This can be tested with haltest.
>
> I think this should be already handled by Core service. Were you able
> to get success response from daemon on multiple sequent init or
> cleanup calls?
>
> btw: I think we should fix this on hal side as well, currently only
> bluetooth hal is handling error from daemon correctly. There is also
> question if we should return success on second init call...
I would just return success if init was already called and should
probably be done in a central place, perhaps in the HAL side.
--
Luiz Augusto von Dentz
^ permalink raw reply
* Re: [PATCH 2/3] all: Use G_SOURCE_REMOVE/G_SOURCE_CONTINUE macros
From: Bastien Nocera @ 2013-11-20 8:57 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth@vger.kernel.org development
In-Reply-To: <1384169302.1898.1.camel@nuvo>
On Mon, 2013-11-11 at 12:28 +0100, Bastien Nocera wrote:
> On Mon, 2013-11-11 at 17:04 +0900, Marcel Holtmann wrote:
> <snip>
> > problem is that we currently only require GLib 2.28 and this got introduced in GLib 2.32.
>
> You'd take that with an if GLIB_VERSION() #define G_SOURCE_... compat
> helper?
Done with a small configure.ac snippet, and tested against glib 2.39 and
2.28 (from GNOME 3.0).
^ permalink raw reply
* [PATCH] all: Use G_SOURCE_REMOVE/G_SOURCE_CONTINUE macros
From: Bastien Nocera @ 2013-11-20 8:56 UTC (permalink / raw)
To: linux-bluetooth
Instead of TRUE/FALSE. This makes the source more readable.
---
attrib/gattrib.c | 2 +-
attrib/gatttool.c | 2 +-
configure.ac | 8 ++++++++
gdbus/mainloop.c | 6 +++---
gdbus/object.c | 2 +-
gdbus/watch.c | 2 +-
gobex/gobex.c | 4 ++--
obexd/client/session.c | 4 ++--
obexd/client/transfer.c | 6 +++---
obexd/plugins/messages-dummy.c | 2 +-
obexd/plugins/messages-tracker.c | 2 +-
obexd/plugins/phonebook-dummy.c | 6 +++---
plugins/policy.c | 6 +++---
profiles/audio/a2dp.c | 16 ++++++++--------
profiles/audio/avctp.c | 12 ++++++------
profiles/audio/avdtp.c | 14 +++++++-------
profiles/audio/avrcp.c | 2 +-
profiles/audio/player.c | 4 ++--
profiles/cyclingspeed/cyclingspeed.c | 2 +-
profiles/health/hdp.c | 4 ++--
profiles/health/mcap.c | 2 +-
profiles/health/mcap_sync.c | 18 +++++++++---------
profiles/input/device.c | 10 +++++-----
profiles/network/connection.c | 2 +-
profiles/proximity/monitor.c | 4 ++--
profiles/sap/server.c | 4 ++--
src/adapter.c | 20 ++++++++++----------
src/device.c | 16 ++++++++--------
src/main.c | 4 ++--
src/sdp-client.c | 2 +-
src/shared/hciemu.c | 2 +-
src/shared/tester.c | 18 +++++++++---------
tools/btiotest.c | 6 +++---
unit/test-gdbus-client.c | 4 ++--
unit/test-gobex-transfer.c | 2 +-
unit/test-gobex.c | 4 ++--
unit/test-sdp.c | 2 +-
37 files changed, 117 insertions(+), 109 deletions(-)
diff --git a/attrib/gattrib.c b/attrib/gattrib.c
index 609b908..4d93902 100644
--- a/attrib/gattrib.c
+++ b/attrib/gattrib.c
@@ -284,7 +284,7 @@ done:
g_attrib_unref(attrib);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static gboolean can_write_data(GIOChannel *io, GIOCondition cond,
diff --git a/attrib/gatttool.c b/attrib/gatttool.c
index f211dcd..7ef26aa 100644
--- a/attrib/gatttool.c
+++ b/attrib/gatttool.c
@@ -116,7 +116,7 @@ static gboolean listen_start(gpointer user_data)
g_attrib_register(attrib, ATT_OP_HANDLE_IND, GATTRIB_ALL_HANDLES,
events_handler, attrib, NULL);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void connect_cb(GIOChannel *io, GError *err, gpointer user_data)
diff --git a/configure.ac b/configure.ac
index 949846e..5373545 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,6 +54,14 @@ PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
+# Remove when glib dep is bumped
+PKG_CHECK_MODULES(SOURCE_CHECK, glib-2.0 >= 2.32,
+ has_source_macro=yes, has_source_macro=no)
+if (test "${has_source_macro}" = "no"); then
+ AC_DEFINE(G_SOURCE_REMOVE, 0, [Macro available from glib 2.32])
+ AC_DEFINE(G_SOURCE_CONTINUE, 1, [Macro available from glib 2.32])
+fi
+
if (test "${enable_threads}" = "yes"); then
AC_DEFINE(NEED_THREADS, 1, [Define if threading support is required])
PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes,
diff --git a/gdbus/mainloop.c b/gdbus/mainloop.c
index 099b67f..d00db33 100644
--- a/gdbus/mainloop.c
+++ b/gdbus/mainloop.c
@@ -77,7 +77,7 @@ static gboolean message_dispatch(void *data)
dbus_connection_unref(conn);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static inline void queue_dispatch(DBusConnection *conn,
@@ -186,11 +186,11 @@ static gboolean timeout_handler_dispatch(gpointer data)
/* if not enabled should not be polled by the main loop */
if (!dbus_timeout_get_enabled(handler->timeout))
- return FALSE;
+ return G_SOURCE_REMOVE;
dbus_timeout_handle(handler->timeout);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void timeout_handler_free(void *data)
diff --git a/gdbus/object.c b/gdbus/object.c
index b248cbb..72c542e 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -1008,7 +1008,7 @@ static gboolean process_changes(gpointer user_data)
data->process_id = 0;
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void generic_unregister(DBusConnection *connection, void *user_data)
diff --git a/gdbus/watch.c b/gdbus/watch.c
index 0f99f4f..f357cd1 100644
--- a/gdbus/watch.c
+++ b/gdbus/watch.c
@@ -599,7 +599,7 @@ static gboolean update_service(void *user_data)
dbus_connection_unref(conn);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void service_reply(DBusPendingCall *call, void *user_data)
diff --git a/gobex/gobex.c b/gobex/gobex.c
index 8c08b1e..e107c0c 100644
--- a/gobex/gobex.c
+++ b/gobex/gobex.c
@@ -253,7 +253,7 @@ static gboolean req_timeout(gpointer user_data)
g_error_free(err);
pending_pkt_free(p);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static gboolean write_stream(GObex *obex, GError **err)
@@ -720,7 +720,7 @@ static gboolean cancel_complete(gpointer user_data)
pending_pkt_free(p);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
gboolean g_obex_cancel_req(GObex *obex, guint req_id, gboolean remove_callback)
diff --git a/obexd/client/session.c b/obexd/client/session.c
index 8138b1e..72fcc6d 100644
--- a/obexd/client/session.c
+++ b/obexd/client/session.c
@@ -435,7 +435,7 @@ static gboolean connection_complete(gpointer data)
g_free(cb);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static int session_connect(struct obc_session *session,
@@ -730,7 +730,7 @@ static gboolean session_process(gpointer data)
session_process_queue(session);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void session_queue(struct pending_request *p)
diff --git a/obexd/client/transfer.c b/obexd/client/transfer.c
index 5a8d4f2..54713a9 100644
--- a/obexd/client/transfer.c
+++ b/obexd/client/transfer.c
@@ -680,13 +680,13 @@ static gboolean report_progress(gpointer data)
struct obc_transfer *transfer = data;
if (transfer->transferred == transfer->progress)
- return TRUE;
+ return G_SOURCE_CONTINUE;
transfer->progress = transfer->transferred;
if (transfer->transferred == transfer->size) {
transfer->progress_id = 0;
- return FALSE;
+ return G_SOURCE_REMOVE;
}
if (transfer->status != TRANSFER_STATUS_ACTIVE)
@@ -695,7 +695,7 @@ static gboolean report_progress(gpointer data)
g_dbus_emit_property_changed(transfer->conn, transfer->path,
TRANSFER_INTERFACE, "Transferred");
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
static gboolean transfer_start_get(struct obc_transfer *transfer, GError **err)
diff --git a/obexd/plugins/messages-dummy.c b/obexd/plugins/messages-dummy.c
index bb0627f..439ea95 100644
--- a/obexd/plugins/messages-dummy.c
+++ b/obexd/plugins/messages-dummy.c
@@ -198,7 +198,7 @@ static gboolean get_folder_listing(void *d)
return_folder_listing(fld, list);
g_slist_free_full(list, g_free);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
int messages_init(void)
diff --git a/obexd/plugins/messages-tracker.c b/obexd/plugins/messages-tracker.c
index 60f3a80..6df57ad 100644
--- a/obexd/plugins/messages-tracker.c
+++ b/obexd/plugins/messages-tracker.c
@@ -282,7 +282,7 @@ static gboolean async_get_folder_listing(void *s)
g_free(path);
g_free(session->name);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
int messages_get_folder_listing(void *s, const char *name,
diff --git a/obexd/plugins/phonebook-dummy.c b/obexd/plugins/phonebook-dummy.c
index 6b9d040..ca266ef 100644
--- a/obexd/plugins/phonebook-dummy.c
+++ b/obexd/plugins/phonebook-dummy.c
@@ -252,7 +252,7 @@ done:
g_string_free(buffer, TRUE);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void entry_notify(const char *filename, VObject *v, void *user_data)
@@ -326,7 +326,7 @@ static gboolean create_cache(void *user_data)
query->ready_cb(query->user_data);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static gboolean read_entry(void *user_data)
@@ -348,7 +348,7 @@ static gboolean read_entry(void *user_data)
dummy->cb(buffer, count, 1, 0, TRUE, dummy->user_data);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static gboolean is_dir(const char *dir)
diff --git a/plugins/policy.c b/plugins/policy.c
index 0292482..787371f 100644
--- a/plugins/policy.c
+++ b/plugins/policy.c
@@ -90,7 +90,7 @@ static gboolean policy_connect_ct(gpointer user_data)
if (service != NULL)
policy_connect(data, service);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void policy_set_ct_timer(struct policy_data *data)
@@ -163,7 +163,7 @@ static gboolean policy_connect_sink(gpointer user_data)
if (service != NULL)
policy_connect(data, service);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void policy_set_sink_timer(struct policy_data *data)
@@ -272,7 +272,7 @@ static gboolean policy_connect_source(gpointer user_data)
if (service != NULL)
policy_connect(data, service);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void policy_set_source_timer(struct policy_data *data)
diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index 29a1593..6689d72 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -224,7 +224,7 @@ static gboolean finalize_config(gpointer data)
setup_cb_free(cb);
}
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static gboolean finalize_resume(gpointer data)
@@ -244,7 +244,7 @@ static gboolean finalize_resume(gpointer data)
setup_cb_free(cb);
}
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static gboolean finalize_suspend(gpointer data)
@@ -264,7 +264,7 @@ static gboolean finalize_suspend(gpointer data)
setup_cb_free(cb);
}
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void finalize_select(struct a2dp_setup *s)
@@ -384,7 +384,7 @@ static gboolean auto_config(gpointer data)
/* Check if configuration was aborted */
if (setup->sep->stream == NULL)
- return FALSE;
+ return G_SOURCE_REMOVE;
if (setup->err != NULL)
goto done;
@@ -413,7 +413,7 @@ done:
setup_unref(setup);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void endpoint_setconf_cb(struct a2dp_setup *setup, gboolean ret)
@@ -727,7 +727,7 @@ static gboolean suspend_timeout(struct a2dp_sep *sep)
avdtp_unref(sep->session);
sep->session = NULL;
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static gboolean start_ind(struct avdtp *session, struct avdtp_local_sep *sep,
@@ -928,11 +928,11 @@ static gboolean a2dp_reconfigure(gpointer data)
goto failed;
}
- return FALSE;
+ return G_SOURCE_REMOVE;
failed:
finalize_setup_errno(setup, posix_err, finalize_config, NULL);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void close_cfm(struct avdtp *session, struct avdtp_local_sep *sep,
diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c
index 476f61a..4f688c8 100644
--- a/profiles/audio/avctp.c
+++ b/profiles/audio/avctp.c
@@ -299,7 +299,7 @@ static gboolean auto_release(gpointer user_data)
send_key(session->uinput, session->key.op, 0);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static size_t handle_panel_passthrough(struct avctp *session,
@@ -697,7 +697,7 @@ static gboolean req_timeout(gpointer user_data)
if (chan->process_id == 0)
chan->process_id = g_idle_add(process_queue, chan);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static int process_control(void *data)
@@ -727,7 +727,7 @@ static gboolean process_queue(void *user_data)
chan->process_id = 0;
if (p != NULL)
- return FALSE;
+ return G_SOURCE_REMOVE;
while ((p = g_queue_pop_head(chan->queue))) {
@@ -738,12 +738,12 @@ static gboolean process_queue(void *user_data)
}
if (p == NULL)
- return FALSE;
+ return G_SOURCE_REMOVE;
chan->p = p;
p->timeout = g_timeout_add_seconds(2, req_timeout, chan);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
@@ -1653,7 +1653,7 @@ static gboolean repeat_timeout(gpointer user_data)
avctp_passthrough_release(session, session->key.op);
avctp_passthrough_press(session, session->key.op);
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
static void release_pressed(struct avctp *session)
diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index b7a7d9c..f1815cb 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
@@ -627,7 +627,7 @@ static gboolean stream_close_timeout(gpointer user_data)
close_stream(stream);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static gboolean stream_open_timeout(gpointer user_data)
@@ -642,7 +642,7 @@ static gboolean stream_open_timeout(gpointer user_data)
avdtp_abort(stream->session, stream);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
void avdtp_error_init(struct avdtp_error *err, uint8_t category, int id)
@@ -1178,18 +1178,18 @@ static gboolean disconnect_timeout(gpointer user_data)
service = btd_device_get_service(session->device, A2DP_SINK_UUID);
if (service && stream_setup) {
sink_setup_stream(service, session);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
service = btd_device_get_service(session->device, A2DP_SOURCE_UUID);
if (service && stream_setup) {
source_setup_stream(service, session);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
connection_lost(session, ETIMEDOUT);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void set_disconnect_timer(struct avdtp *session)
@@ -2667,7 +2667,7 @@ static gboolean request_timeout(gpointer user_data)
cancel_request(session, ETIMEDOUT);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static int send_req(struct avdtp *session, gboolean priority,
@@ -3298,7 +3298,7 @@ static gboolean process_discover(gpointer data)
finalize_discovery(session, 0);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
int avdtp_discover(struct avdtp *session, avdtp_discover_cb_t cb,
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index cd027c6..b3a1873 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -3323,7 +3323,7 @@ static gboolean connect_browsing(gpointer user_data)
avctp_connect_browsing(session->conn);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void avrcp_connect_browsing(struct avrcp *session)
diff --git a/profiles/audio/player.c b/profiles/audio/player.c
index 6150c8a..bce72e9 100644
--- a/profiles/audio/player.c
+++ b/profiles/audio/player.c
@@ -1306,13 +1306,13 @@ static gboolean process_metadata_changed(void *user_data)
item = g_hash_table_lookup(mp->track, "Item");
if (item == NULL)
- return FALSE;
+ return G_SOURCE_REMOVE;
g_dbus_emit_property_changed(btd_get_dbus_connection(),
item, MEDIA_ITEM_INTERFACE,
"Metadata");
- return FALSE;
+ return G_SOURCE_REMOVE;
}
void media_player_set_metadata(struct media_player *mp,
diff --git a/profiles/cyclingspeed/cyclingspeed.c b/profiles/cyclingspeed/cyclingspeed.c
index 6ecc985..3ad9e75 100644
--- a/profiles/cyclingspeed/cyclingspeed.c
+++ b/profiles/cyclingspeed/cyclingspeed.c
@@ -307,7 +307,7 @@ static gboolean controlpoint_timeout(gpointer user_data)
req->csc->pending_req = NULL;
g_free(req);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void controlpoint_write_cb(guint8 status, const guint8 *pdu, guint16 len,
diff --git a/profiles/health/hdp.c b/profiles/health/hdp.c
index 7b4e799..d7d0699 100644
--- a/profiles/health/hdp.c
+++ b/profiles/health/hdp.c
@@ -1536,12 +1536,12 @@ static gboolean echo_timeout(gpointer data)
fd = mcap_mdl_get_fd(chan->mdl);
if (fd < 0)
- return FALSE;
+ return G_SOURCE_REMOVE;
io = g_io_channel_unix_new(fd);
g_io_channel_shutdown(io, TRUE, NULL);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void hdp_echo_connect_cb(struct mcap_mdl *mdl, GError *err,
diff --git a/profiles/health/mcap.c b/profiles/health/mcap.c
index 6d821f3..37b5789 100644
--- a/profiles/health/mcap.c
+++ b/profiles/health/mcap.c
@@ -463,7 +463,7 @@ static gboolean wait_response_timer(gpointer data)
mcl->mi->mcl_disconnected_cb(mcl, mcl->mi->user_data);
mcap_cache_mcl(mcl);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
gboolean mcap_create_mdl(struct mcap_mcl *mcl,
diff --git a/profiles/health/mcap_sync.c b/profiles/health/mcap_sync.c
index 0d9f17d..aea0202 100644
--- a/profiles/health/mcap_sync.c
+++ b/profiles/health/mcap_sync.c
@@ -517,15 +517,15 @@ static gboolean sync_send_indication(gpointer user_data)
int sent;
if (!user_data)
- return FALSE;
+ return G_SOURCE_REMOVE;
mcl = user_data;
if (!caps(mcl))
- return FALSE;
+ return G_SOURCE_REMOVE;
if (!get_all_clocks(mcl, &btclock, &base_time, &tmstamp))
- return FALSE;
+ return G_SOURCE_REMOVE;
cmd = g_new0(mcap_md_sync_info_ind, 1);
@@ -557,12 +557,12 @@ static gboolean proc_sync_set_req_phase2(gpointer user_data)
int delay;
if (!user_data)
- return FALSE;
+ return G_SOURCE_REMOVE;
mcl = user_data;
if (!mcl->csp->set_data)
- return FALSE;
+ return G_SOURCE_REMOVE;
data = mcl->csp->set_data;
update = data->update;
@@ -573,17 +573,17 @@ static gboolean proc_sync_set_req_phase2(gpointer user_data)
if (!caps(mcl)) {
send_sync_set_rsp(mcl, MCAP_UNSPECIFIED_ERROR, 0, 0, 0);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
if (!get_all_clocks(mcl, &btclock, &base_time, &tmstamp)) {
send_sync_set_rsp(mcl, MCAP_UNSPECIFIED_ERROR, 0, 0, 0);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
if (get_btrole(mcl) != role) {
send_sync_set_rsp(mcl, MCAP_INVALID_OPERATION, 0, 0, 0);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
reset = (new_tmstamp != MCAP_TMSTAMP_DONTSET);
@@ -624,7 +624,7 @@ static gboolean proc_sync_set_req_phase2(gpointer user_data)
if (update)
sync_send_indication(mcl);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void proc_sync_set_req(struct mcap_mcl *mcl, uint8_t *cmd, uint32_t len)
diff --git a/profiles/input/device.c b/profiles/input/device.c
index 6523161..bd0886e 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
@@ -668,23 +668,23 @@ static gboolean input_device_auto_reconnect(gpointer user_data)
* or is marked for removal. */
if (device_is_temporary(idev->device) ||
device_is_connected(idev->device))
- return FALSE;
+ return G_SOURCE_REMOVE;
/* Only attempt an auto-reconnect for at most 3 minutes (6 * 30s). */
if (idev->reconnect_attempt >= 6)
- return FALSE;
+ return G_SOURCE_REMOVE;
/* Check if the profile is already connected. */
if (idev->ctrl_io)
- return FALSE;
+ return G_SOURCE_REMOVE;
if (is_connected(idev))
- return FALSE;
+ return G_SOURCE_REMOVE;
idev->reconnect_attempt++;
dev_connect(idev);
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
static const char * const _reconnect_mode_str[] = {
diff --git a/profiles/network/connection.c b/profiles/network/connection.c
index 960a1fe..5008ea1 100644
--- a/profiles/network/connection.c
+++ b/profiles/network/connection.c
@@ -354,7 +354,7 @@ static gboolean bnep_conn_req_to(gpointer user_data)
cancel_connection(nc, -ETIMEDOUT);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static int bnep_connect(struct network_conn *nc)
diff --git a/profiles/proximity/monitor.c b/profiles/proximity/monitor.c
index eaa5b0d..a894235 100644
--- a/profiles/proximity/monitor.c
+++ b/profiles/proximity/monitor.c
@@ -304,7 +304,7 @@ static gboolean immediate_timeout(gpointer user_data)
monitor->immediateto = 0;
if (g_strcmp0(monitor->immediatelevel, "none") == 0)
- return FALSE;
+ return G_SOURCE_REMOVE;
if (monitor->attrib) {
uint8_t value = ALERT_NONE;
@@ -319,7 +319,7 @@ static gboolean immediate_timeout(gpointer user_data)
g_dbus_emit_property_changed(btd_get_dbus_connection(), path,
PROXIMITY_INTERFACE, "ImmediateAlertLevel");
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void immediate_written(gpointer user_data)
diff --git a/profiles/sap/server.c b/profiles/sap/server.c
index 63314a7..81a5c58 100644
--- a/profiles/sap/server.c
+++ b/profiles/sap/server.c
@@ -583,7 +583,7 @@ static gboolean guard_timeout(gpointer data)
struct sap_connection *conn = server->conn;
if (!conn)
- return FALSE;
+ return G_SOURCE_REMOVE;
DBG("conn %p state %d pr 0x%02x", conn, conn->state,
conn->processing_req);
@@ -613,7 +613,7 @@ static gboolean guard_timeout(gpointer data)
break;
}
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void sap_set_connected(struct sap_server *server)
diff --git a/src/adapter.c b/src/adapter.c
index d904a56..80e7903 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -542,7 +542,7 @@ static gboolean pairable_timeout_handler(gpointer user_data)
set_mode(adapter, MGMT_OP_SET_PAIRABLE, 0x00);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void trigger_pairable_timeout(struct btd_adapter *adapter)
@@ -1125,7 +1125,7 @@ static gboolean passive_scanning_timeout(gpointer user_data)
adapter->dev_id, sizeof(cp), &cp,
passive_scanning_complete, adapter, NULL);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void trigger_passive_scanning(struct btd_adapter *adapter)
@@ -1300,12 +1300,12 @@ static gboolean start_discovery_timeout(gpointer user_data)
*/
if (adapter->discovery_type == new_type) {
if (adapter->discovering)
- return FALSE;
+ return G_SOURCE_REMOVE;
adapter->discovering = true;
g_dbus_emit_property_changed(dbus_conn, adapter->path,
ADAPTER_INTERFACE, "Discovering");
- return FALSE;
+ return G_SOURCE_REMOVE;
}
/*
@@ -1328,7 +1328,7 @@ static gboolean start_discovery_timeout(gpointer user_data)
adapter->dev_id, sizeof(cp), &cp,
start_discovery_complete, adapter, NULL);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void trigger_start_discovery(struct btd_adapter *adapter, guint delay)
@@ -1534,7 +1534,7 @@ static gboolean remove_temp_devices(gpointer user_data)
adapter_remove_device(adapter, dev);
}
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void discovery_destroy(void *user_data)
@@ -2381,7 +2381,7 @@ static gboolean load_ltks_timeout(gpointer user_data)
mgmt_cancel(adapter->mgmt, adapter->load_ltks_id);
adapter->load_ltks_id = 0;
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void load_ltks_complete(uint8_t status, uint16_t length,
@@ -4006,7 +4006,7 @@ static gboolean confirm_name_timeout(gpointer user_data)
mgmt_cancel(adapter->mgmt, adapter->confirm_name_id);
adapter->confirm_name_id = 0;
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void confirm_name_complete(uint8_t status, uint16_t length,
@@ -4412,7 +4412,7 @@ next:
dbus_error_free(&err);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static int adapter_authorize(struct btd_adapter *adapter, const bdaddr_t *dst,
@@ -5029,7 +5029,7 @@ static gboolean pair_device_timeout(gpointer user_data)
adapter_cancel_bonding(adapter, &data->bdaddr, data->addr_type);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void pair_device_complete(uint8_t status, uint16_t length,
diff --git a/src/device.c b/src/device.c
index 82b66e6..183c4bf 100644
--- a/src/device.c
+++ b/src/device.c
@@ -364,7 +364,7 @@ static gboolean store_device_info_cb(gpointer user_data)
g_key_file_free(key_file);
g_free(uuids);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static bool device_address_is_private(struct btd_device *dev)
@@ -966,7 +966,7 @@ static gboolean do_disconnect(gpointer user_data)
btd_adapter_disconnect_device(device->adapter, &device->bdaddr,
device->bdaddr_type);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
int device_block(struct btd_device *device, gboolean update_only)
@@ -3680,7 +3680,7 @@ static gboolean start_discovery(gpointer user_data)
device->discov_timer = 0;
- return FALSE;
+ return G_SOURCE_REMOVE;
}
void device_set_paired(struct btd_device *device, gboolean value)
@@ -3794,7 +3794,7 @@ static gboolean svc_idle_cb(gpointer user_data)
g_free(cb);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
unsigned int device_wait_for_svc_complete(struct btd_device *dev,
@@ -3867,7 +3867,7 @@ static gboolean device_bonding_retry(gpointer data)
int err;
if (!bonding)
- return FALSE;
+ return G_SOURCE_REMOVE;
DBG("retrying bonding");
bonding->retry_timer = 0;
@@ -3888,7 +3888,7 @@ static gboolean device_bonding_retry(gpointer data)
if (err < 0)
device_bonding_complete(device, bonding->status);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
int device_bonding_attempt_retry(struct btd_device *device)
@@ -4381,13 +4381,13 @@ static gboolean notify_attios(gpointer user_data)
struct btd_device *device = user_data;
if (device->attrib == NULL)
- return FALSE;
+ return G_SOURCE_REMOVE;
g_slist_foreach(device->attios_offline, attio_connected, device->attrib);
device->attios = g_slist_concat(device->attios, device->attios_offline);
device->attios_offline = NULL;
- return FALSE;
+ return G_SOURCE_REMOVE;
}
guint btd_device_add_attio_callback(struct btd_device *device,
diff --git a/src/main.c b/src/main.c
index 91d90b4..d88b1d5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -298,7 +298,7 @@ void btd_exit(void)
static gboolean quit_eventloop(gpointer user_data)
{
btd_exit();
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static gboolean signal_handler(GIOChannel *channel, GIOCondition cond,
@@ -446,7 +446,7 @@ static gboolean watchdog_callback(gpointer user_data)
{
sd_notify(0, "WATCHDOG=1");
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
static gboolean parse_debug(const char *key, const char *value,
diff --git a/src/sdp-client.c b/src/sdp-client.c
index 51f3048..35e2bfd 100644
--- a/src/sdp-client.c
+++ b/src/sdp-client.c
@@ -59,7 +59,7 @@ static gboolean cached_session_expired(gpointer user_data)
g_free(cached);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static sdp_session_t *get_cached_sdp_session(const bdaddr_t *src, const bdaddr_t *dst)
diff --git a/src/shared/hciemu.c b/src/shared/hciemu.c
index 0ea191f..5cae951 100644
--- a/src/shared/hciemu.c
+++ b/src/shared/hciemu.c
@@ -284,7 +284,7 @@ static gboolean start_stack(gpointer user_data)
bthost_start(hciemu->host_stack);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
struct hciemu *hciemu_new(enum hciemu_type type)
diff --git a/src/shared/tester.c b/src/shared/tester.c
index f3edd74..24d5bb9 100644
--- a/src/shared/tester.c
+++ b/src/shared/tester.c
@@ -311,7 +311,7 @@ static gboolean teardown_callback(gpointer user_data)
print_progress(test->name, COLOR_MAGENTA, "teardown");
test->teardown_func(test->test_data);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static gboolean test_timeout(gpointer user_data)
@@ -321,14 +321,14 @@ static gboolean test_timeout(gpointer user_data)
test->timeout_id = 0;
if (!test_current)
- return FALSE;
+ return G_SOURCE_REMOVE;
test->result = TEST_RESULT_TIMED_OUT;
print_progress(test->name, COLOR_RED, "test timed out");
g_idle_add(teardown_callback, test);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void next_test_case(void)
@@ -372,7 +372,7 @@ static gboolean setup_callback(gpointer user_data)
print_progress(test->name, COLOR_BLUE, "setup");
test->setup_func(test->test_data);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static gboolean run_callback(gpointer user_data)
@@ -384,7 +384,7 @@ static gboolean run_callback(gpointer user_data)
print_progress(test->name, COLOR_BLACK, "run");
test->test_func(test->test_data);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static gboolean done_callback(gpointer user_data)
@@ -396,7 +396,7 @@ static gboolean done_callback(gpointer user_data)
print_progress(test->name, COLOR_BLACK, "done");
next_test_case();
- return FALSE;
+ return G_SOURCE_REMOVE;
}
void tester_pre_setup_complete(void)
@@ -585,7 +585,7 @@ static gboolean start_tester(gpointer user_data)
next_test_case();
- return FALSE;
+ return G_SOURCE_REMOVE;
}
struct wait_data {
@@ -605,7 +605,7 @@ static gboolean wait_callback(gpointer user_data)
if (wait->seconds > 0) {
print_progress(test->name, COLOR_BLACK, "%u seconds left",
wait->seconds);
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
print_progress(test->name, COLOR_BLACK, "waiting done");
@@ -614,7 +614,7 @@ static gboolean wait_callback(gpointer user_data)
g_free(wait);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
void tester_wait(unsigned int seconds, tester_wait_func_t func,
diff --git a/tools/btiotest.c b/tools/btiotest.c
index a77eba1..562de58 100644
--- a/tools/btiotest.c
+++ b/tools/btiotest.c
@@ -96,7 +96,7 @@ static gboolean disconn_timeout(gpointer user_data)
g_io_channel_shutdown(data->io, TRUE, NULL);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void update_sec_level(struct io_data *data)
@@ -199,7 +199,7 @@ static gboolean confirm_timeout(gpointer user_data)
if (data->reject >= 0) {
printf("Rejecting connection\n");
g_io_channel_shutdown(data->io, TRUE, NULL);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
printf("Accepting connection\n");
@@ -215,7 +215,7 @@ static gboolean confirm_timeout(gpointer user_data)
io_data_unref(data);
}
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void confirm_cb(GIOChannel *io, gpointer user_data)
diff --git a/unit/test-gdbus-client.c b/unit/test-gdbus-client.c
index 685729a..6353b59 100644
--- a/unit/test-gdbus-client.c
+++ b/unit/test-gdbus-client.c
@@ -715,7 +715,7 @@ static gboolean timeout_test(gpointer user_data)
g_assert_not_reached();
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static gboolean emit_string_change(void *user_data)
@@ -730,7 +730,7 @@ static gboolean emit_string_change(void *user_data)
context->timeout_source = g_timeout_add_seconds(2, timeout_test,
context);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void proxy_string_changed(GDBusProxy *proxy, void *user_data)
diff --git a/unit/test-gobex-transfer.c b/unit/test-gobex-transfer.c
index ef05047..171e663 100644
--- a/unit/test-gobex-transfer.c
+++ b/unit/test-gobex-transfer.c
@@ -464,7 +464,7 @@ static gboolean cancel_transfer(gpointer user_data)
if (d->id > 0)
g_obex_cancel_transfer(d->id, transfer_complete, user_data);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static gssize abort_data(void *buf, gsize len, gpointer user_data)
diff --git a/unit/test-gobex.c b/unit/test-gobex.c
index 66307c2..cd51009 100644
--- a/unit/test-gobex.c
+++ b/unit/test-gobex.c
@@ -92,13 +92,13 @@ static gboolean timeout(gpointer user_data)
GError **err = user_data;
if (!g_main_loop_is_running(mainloop))
- return FALSE;
+ return G_SOURCE_REMOVE;
g_set_error(err, TEST_ERROR, TEST_ERROR_TIMEOUT, "Timed out");
g_main_loop_quit(mainloop);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void connect_rsp(GObex *obex, GError *err, GObexPacket *rsp,
diff --git a/unit/test-sdp.c b/unit/test-sdp.c
index 6d699e2..03046d7 100644
--- a/unit/test-sdp.c
+++ b/unit/test-sdp.c
@@ -209,7 +209,7 @@ static gboolean send_pdu(gpointer user_data)
g_assert(len == pdu_len);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void context_increment(struct context *context)
--
1.8.4.2
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox