* Re: [PATCH] Bluetooth: hidp: make sure input buffers are big enough
From: David Herrmann @ 2014-01-07 16:34 UTC (permalink / raw)
To: Jiri Kosina
Cc: Marcel Holtmann, open list:HID CORE LAYER,
linux-bluetooth@vger.kernel.org development, Gustavo F. Padovan
In-Reply-To: <alpine.LNX.2.00.1401071308020.4962@pobox.suse.cz>
Hi Jiri
On Tue, Jan 7, 2014 at 1:11 PM, Jiri Kosina <jkosina@suse.cz> wrote:
> On Fri, 27 Dec 2013, David Herrmann wrote:
>
>> >> I also haven't figured out a nice way to make HID-core honor the
>> >> "size" parameter. hid-input depends on getting the whole
>> >> input-report.
>> >
>> > I think this needs clearly fixing.
>>
>> And we have a volunteer, yippie! ;)
>>
>> I think hid_input_report() in hid-core.c is the only place that relies
>> on this. Maybe it really is easier to fix it. But I am not even
>> slightly familiar with that code. So if no-one of the HID core
>> developers steps up to fix it, we should take the transport-driver
>> fixes instead. As nearly all transport-drivers are affected by this,
>> maybe we should even move this buffer into hid_device and provide
>> hid_input_truncated_report() which does this.
>>
>> Anyhow, waiting for Jiri's comments on this.
>
> Hmm, this is really unfortunate situation.
>
> I am now looking into making hid_input_report() honor 'size' properly, but
> no matter how it'll be done in the end, it'll absolutely not be a simple
> 'fix'. So definitely can be done for 3.15 or so, but not as a fix for
> current kernels.
>
> So doing kzalloc(rsize, GFP_ATOMIC) in the HID-core for now, and copying
> the buffer around, seems like only viable solution for now, with the
> outlook of removing this ugliness once hid-core honors 'size' properly.
Should I resend the patches and move it to hid_input_report() for now?
Or are you getting something in yourself?
Given the amount of reports on the list and bugzilla, I think we
should get this fix in asap. We can always fix it properly in -next.
Thanks
David
> I will keep looking into this and maybe some easy way how to hack this
> together will materialize, but I don't currently see it.
>
> Hmm ...
>
> --
> Jiri Kosina
> SUSE Labs
^ permalink raw reply
* Re: [PATCH] Bluetooth: hidp: make sure input buffers are big enough
From: Jiri Kosina @ 2014-01-07 17:13 UTC (permalink / raw)
To: David Herrmann
Cc: Marcel Holtmann, open list:HID CORE LAYER,
linux-bluetooth@vger.kernel.org development, Gustavo F. Padovan
In-Reply-To: <CANq1E4SxrDnbOCsohZXYoYL-HQjEc-xcOnXfAm=npHG2QfMS9A@mail.gmail.com>
On Tue, 7 Jan 2014, David Herrmann wrote:
> > So doing kzalloc(rsize, GFP_ATOMIC) in the HID-core for now, and copying
> > the buffer around, seems like only viable solution for now, with the
> > outlook of removing this ugliness once hid-core honors 'size' properly.
>
> Should I resend the patches and move it to hid_input_report() for now?
> Or are you getting something in yourself?
Due to various reasons I will not have access to any testing HW for the
upcoming 2-3 days, so if you can cook something up in that timeframe, it'd
be appreciated.
Otherwise I'll be working on it by the end of this week.
> Given the amount of reports on the list and bugzilla, I think we should
> get this fix in asap. We can always fix it properly in -next.
Agreed.
Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [PATCHv2 1/5] tools/rfcomm-tester: Initial version of rfcomm-tester
From: Johan Hedberg @ 2014-01-07 18:27 UTC (permalink / raw)
To: Marcin Kraglak; +Cc: linux-bluetooth
In-Reply-To: <1389092354-32544-1-git-send-email-marcin.kraglak@tieto.com>
Hi Marcin,
On Tue, Jan 07, 2014, Marcin Kraglak wrote:
> + * Copyright (C) 2013 Intel Corporation. All rights reserved.
I suppose this should be 2014 and not 2013?
Johan
^ permalink raw reply
* Re: [PATCHv2 2/5] tools/rfcomm-tester: Add basic rfcomm test case
From: Johan Hedberg @ 2014-01-07 18:28 UTC (permalink / raw)
To: Marcin Kraglak; +Cc: linux-bluetooth
In-Reply-To: <1389092354-32544-2-git-send-email-marcin.kraglak@tieto.com>
Hi Marcin,
On Tue, Jan 07, 2014, Marcin Kraglak wrote:
> +#define test_rfcomm_bredr(name, data, setup, func) \
Since RFCOMM is anyway BR/EDR-only it seems a bit redundant to have
_bredr at the end here. I'd just call this test_rfcomm.
Johan
^ permalink raw reply
* Re: [PATCHv2 3/5] monitor: Add rfcomm.h to tree
From: Johan Hedberg @ 2014-01-07 18:28 UTC (permalink / raw)
To: Marcin Kraglak; +Cc: linux-bluetooth
In-Reply-To: <1389092354-32544-3-git-send-email-marcin.kraglak@tieto.com>
Hi Marcin,
On Tue, Jan 07, 2014, Marcin Kraglak wrote:
> + * Copyright (C) 2013 Intel Corporation
Again, I suppose this should be 2014.
Johan
^ permalink raw reply
* Re: [PATCHv2 4/5] emulator/bthost: Add initial rfcomm handling
From: Johan Hedberg @ 2014-01-07 18:30 UTC (permalink / raw)
To: Marcin Kraglak; +Cc: linux-bluetooth
In-Reply-To: <1389092354-32544-4-git-send-email-marcin.kraglak@tieto.com>
Hi Marcin,
On Tue, Jan 07, 2014, Marcin Kraglak wrote:
> + l2conn = btconn_find_l2cap_conn_by_scid(conn, cid);
> + if (l2conn->psm == 0x0003)
Looks like there a missing NULL check for the return value of
btconn_find_l2cap_conn_by_scid.
Johan
^ permalink raw reply
* [PATCH] android/pts: Add PTS test results for L2CAP
From: Sebastian Chlad @ 2014-01-07 22:06 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Sebastian Chlad
---
android/pts-l2cap.txt | 72 +++++++++++++++++++++++++--------------------------
1 file changed, 36 insertions(+), 36 deletions(-)
diff --git a/android/pts-l2cap.txt b/android/pts-l2cap.txt
index d293046..0cfda2c 100644
--- a/android/pts-l2cap.txt
+++ b/android/pts-l2cap.txt
@@ -1,7 +1,7 @@
PTS test results for L2CAP
PTS version: 5.0
-Tested: 18.12.2013
+Tested: 07.01.2014
Results:
PASS test passed
@@ -18,15 +18,15 @@ TC_COS_CED_BV_04_C N/A
TC_COS_CED_BV_05_C PASS
TC_COS_CED_BV_07_C PASS
TC_COS_CED_BV_08_C PASS
-TC_COS_CED_BV_09_C INC
+TC_COS_CED_BV_09_C PASS
TC_COS_CED_BV_10_C N/A
TC_COS_CED_BV_11_C PASS
TC_COS_CED_BI_01_C PASS
TC_COS_CFD_BV_01_C PASS
TC_COS_CFD_BV_02_C PASS
TC_COS_CFD_BV_03_C PASS
-TC_COS_CFD_BV_08_C INC
-TC_COS_CFD_BV_09_C INC
+TC_COS_CFD_BV_08_C PASS
+TC_COS_CFD_BV_09_C PASS
TC_COS_CFD_BV_10_C N/A
TC_COS_CFD_BI_11_C PASS
TC_COS_CFD_BV_12_C PASS
@@ -34,7 +34,7 @@ TC_COS_CFD_BV_13_C N/A
TC_COS_IEX_BV_01_C PASS
TC_COS_IEX_BV_02_C PASS
TC_COS_ECH_BV_01_C PASS
-TC_COS_ECH_BV_02_C INC
+TC_COS_ECH_BV_02_C PASS
TC_CLS_CLR_BV_01_C N/A
TC_CLS_UCD_BV_01_C N/A
TC_CLS_UCD_BV_02_C N/A
@@ -45,31 +45,31 @@ TC_EXF_BV_03_C PASS
TC_EXF_BV_04_C N/A
TC_EXF_BV_05_C PASS
TC_EXF_BV_06_C N/A
-TC_CMC_BV_01_C INC
-TC_CMC_BV_02_C INC
-TC_CMC_BV_03_C INC
-TC_CMC_BV_04_C INC
-TC_CMC_BV_05_C INC
-TC_CMC_BV_06_C INC
-TC_CMC_BV_07_C INC
-TC_CMC_BV_08_C INC
-TC_CMC_BV_09_C INC
-TC_CMC_BV_10_C INC
-TC_CMC_BV_11_C INC
-TC_CMC_BV_12_C INC
-TC_CMC_BV_13_C INC
-TC_CMC_BV_14_C INC
-TC_CMC_BV_15_C INC
-TC_CMC_BI_01_C INC
-TC_CMC_BI_02_C INC
-TC_CMC_BI_03_C INC
-TC_CMC_BI_04_C INC
-TC_CMC_BI_05_C INC
-TC_CMC_BI_06_C INC
-TC_FOC_BV_01_C INC
-TC_FOC_BV_02_C INC
-TC_FOC_BV_03_C INC
-TC_FOC_BV_04_C INC
+TC_CMC_BV_01_C PASS
+TC_CMC_BV_02_C PASS
+TC_CMC_BV_03_C PASS
+TC_CMC_BV_04_C PASS
+TC_CMC_BV_05_C PASS
+TC_CMC_BV_06_C PASS
+TC_CMC_BV_07_C PASS
+TC_CMC_BV_08_C PASS
+TC_CMC_BV_09_C PASS
+TC_CMC_BV_10_C PASS
+TC_CMC_BV_11_C PASS
+TC_CMC_BV_12_C PASS
+TC_CMC_BV_13_C PASS
+TC_CMC_BV_14_C PASS
+TC_CMC_BV_15_C PASS
+TC_CMC_BI_01_C PASS
+TC_CMC_BI_02_C PASS
+TC_CMC_BI_03_C PASS
+TC_CMC_BI_04_C PASS
+TC_CMC_BI_05_C PASS
+TC_CMC_BI_06_C PASS
+TC_FOC_BV_01_C PASS
+TC_FOC_BV_02_C PASS
+TC_FOC_BV_03_C PASS
+TC_FOC_BV_04_C PASS
TC_OFS_BV_01_C INC
TC_OFS_BV_02_C INC
TC_OFS_BV_03_C INC
@@ -78,11 +78,11 @@ TC_OFS_BV_05_C INC
TC_OFS_BV_06_C INC
TC_OFS_BV_07_C INC
TC_OFS_BV_08_C INC
-TC_ERM_BV_01_C INC
-TC_ERM_BV_02_C INC
-TC_ERM_BV_03_C INC
-TC_ERM_BV_04_C INC
-TC_ERM_BV_05_C INC
+TC_ERM_BV_01_C PASS
+TC_ERM_BV_02_C PASS
+TC_ERM_BV_03_C PASS
+TC_ERM_BV_04_C PASS
+TC_ERM_BV_05_C PASS
TC_ERM_BV_06_C INC
TC_ERM_BV_07_C INC
TC_ERM_BV_08_C INC
@@ -113,7 +113,7 @@ TC_STM_BV_11_C N/A
TC_STM_BV_12_C N/A
TC_STM_BV_13_C N/A
TC_FIX_BV_01_C PASS
-TC_FIX_BV_02_C PASS
+TC_FIX_BV_02_C N/A
TC_EWC_BV_01_C N/A
TC_EWC_BV_02_C N/A
TC_EWC_BV_03_C N/A
--
1.8.1.2
^ permalink raw reply related
* [PATCH] android/pixit: Add PTS version to respective pixit
From: Sebastian Chlad @ 2014-01-07 22:17 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Sebastian Chlad
---
android/pixit-did.txt | 2 ++
android/pixit-gap.txt | 2 ++
android/pixit-hid.txt | 2 ++
android/pixit-l2cap.txt | 2 ++
android/pixit-opp.txt | 2 ++
android/pixit-pan.txt | 2 ++
android/pixit-pbap.txt | 2 ++
7 files changed, 14 insertions(+)
diff --git a/android/pixit-did.txt b/android/pixit-did.txt
index 2527845..8c64d52 100644
--- a/android/pixit-did.txt
+++ b/android/pixit-did.txt
@@ -1,5 +1,7 @@
DID PIXIT for the PTS tool.
+PTS version: 5.0
+
* - different than PTS defaults
& - should be set to IUT Bluetooth address
diff --git a/android/pixit-gap.txt b/android/pixit-gap.txt
index 786c55e..f3c7726 100644
--- a/android/pixit-gap.txt
+++ b/android/pixit-gap.txt
@@ -1,5 +1,7 @@
GAP PIXIT for the PTS tool.
+PTS version: 5.0
+
* - different than PTS defaults
& - should be set to IUT Bluetooth address
diff --git a/android/pixit-hid.txt b/android/pixit-hid.txt
index f306615..1d36c92 100644
--- a/android/pixit-hid.txt
+++ b/android/pixit-hid.txt
@@ -1,5 +1,7 @@
HID PIXIT for the PTS tool.
+PTS version: 5.0
+
* - different than PTS defaults
& - should be set to IUT Bluetooth address
diff --git a/android/pixit-l2cap.txt b/android/pixit-l2cap.txt
index 7de6638..a307625 100644
--- a/android/pixit-l2cap.txt
+++ b/android/pixit-l2cap.txt
@@ -1,5 +1,7 @@
L2CAP PIXIT for the PTS tool.
+PTS version: 5.0
+
* - different than PTS defaults
& - should be set to IUT Bluetooth address
diff --git a/android/pixit-opp.txt b/android/pixit-opp.txt
index 1b1e834..93f6a29 100644
--- a/android/pixit-opp.txt
+++ b/android/pixit-opp.txt
@@ -1,5 +1,7 @@
OPP PIXIT for the PTS tool.
+PTS version: 5.0
+
* - different than PTS defaults
& - should be set to IUT Bluetooth address
diff --git a/android/pixit-pan.txt b/android/pixit-pan.txt
index 2d180da..6544a9c 100644
--- a/android/pixit-pan.txt
+++ b/android/pixit-pan.txt
@@ -1,5 +1,7 @@
PAN PIXIT for the PTS tool.
+PTS version: 5.0
+
* - different than PTS defaults
& - should be set to IUT Bluetooth address
diff --git a/android/pixit-pbap.txt b/android/pixit-pbap.txt
index 272cbc3..470f4c5 100644
--- a/android/pixit-pbap.txt
+++ b/android/pixit-pbap.txt
@@ -1,5 +1,7 @@
PBAP PIXIT for the PTS tool.
+PTS version: 5.0
+
* - different than PTS defaults
& - should be set to IUT Bluetooth address
--
1.8.1.2
^ permalink raw reply related
* [PATCH 0/7] sixaxis: Don't mark USB plugged device as trusted
From: Szymon Janc @ 2014-01-08 0:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bastien Nocera, Szymon Janc
Hi,
This serie removes marking USB plugged sixaxis DS3 devices as trusted.
Now agent is asked for service authorization before device is connected
over BT. This is to address conserns about possibly crafted USB devices.
This is implemented in PATCH 1. Rest are fixes for bugs that were uncovered
due this change and client functionality that I've found missing while
testing this.
Comments and testing are welcome.
--
BR
Szymon Janc
Szymon Janc (7):
sixaxis: Don't mark USB plugged device as trusted
input: Fix crash on authorization reply with first sixaxis connection
input: Fix check if device is sixaxis in auth_callback
input: Fix connecting new trusted sixaxis device
client: Add untrust command
client: Add block command
client: Add unblock command
client/main.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++++
plugins/sixaxis.c | 1 -
profiles/input/server.c | 37 ++++----------------
3 files changed, 99 insertions(+), 32 deletions(-)
--
1.8.5.2
^ permalink raw reply
* [PATCH 1/7] sixaxis: Don't mark USB plugged device as trusted
From: Szymon Janc @ 2014-01-08 0:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bastien Nocera, Szymon Janc
In-Reply-To: <1389139348-3552-1-git-send-email-szymon.janc@gmail.com>
There were some valid conserns raised against marking plugged device
as trusted. Mainly due to posibility of crafted USB device. With this
patch user will be asked to confirm service connection and device can
be marked as trusted like any other devices.
---
plugins/sixaxis.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c
index 1154c15..4fdeff3 100644
--- a/plugins/sixaxis.c
+++ b/plugins/sixaxis.c
@@ -228,7 +228,6 @@ static bool setup_device(int fd, int index, struct btd_adapter *adapter)
btd_device_set_pnpid(device, devices[index].source, devices[index].vid,
devices[index].pid, devices[index].version);
btd_device_set_temporary(device, FALSE);
- btd_device_set_trusted(device, TRUE);
return true;
}
--
1.8.5.2
^ permalink raw reply related
* [PATCH 2/7] input: Fix crash on authorization reply with first sixaxis connection
From: Szymon Janc @ 2014-01-08 0:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bastien Nocera, Szymon Janc
In-Reply-To: <1389139348-3552-1-git-send-email-szymon.janc@gmail.com>
Bogus unref in sixaxis_sdp_cb was resulting in NULL pointer dereference when
auth_callback was called.
src/adapter.c:connected_callback() hci0 device 00:06:F7:57:08:9E
connected eir_len 5
src/device.c:device_set_class() /org/bluez/hci0/dev_00_06_F7_57_08_9E
0x000508
profiles/input/server.c:connect_event_cb() Incoming connection from
00:06:F7:57:08:9E on PSM 17
profiles/input/device.c:input_device_set_channel() idev (nil) psm 17
profiles/input/server.c:confirm_event_cb()
src/agent.c:agent_ref() 0x8117eb8: ref=2
src/agent.c:agent_authorize_service() authorize service request was
sent for /org/bluez/hci0/dev_00_06_F7_57_08_9E
src/device.c:device_probe_profiles() Probing profiles for device
00:06:F7:57:08:9E
profiles/input/device.c:input_device_register()
/org/bluez/hci0/dev_00_06_F7_57_08_9E
src/service.c:btd_service_ref() 0x811f580: ref=2
src/service.c:change_state() 0x811f580: device 00:06:F7:57:08:9E
profile input-hid state changed: unavailable -> disconnected (0)
src/device.c:device_svc_resolved()
/org/bluez/hci0/dev_00_06_F7_57_08_9E err 0
profiles/input/server.c:sixaxis_sdp_cb() err 0 (Success)
profiles/input/device.c:input_device_set_channel() idev 0x8118568 psm
17
profiles/input/server.c:connect_event_cb() Incoming connection from
00:06:F7:57:08:9E on PSM 19
profiles/input/device.c:input_device_set_channel() idev 0x8118568 psm
19
src/service.c:change_state() 0x811f580: device 00:06:F7:57:08:9E
profile input-hid state changed: disconnected -> connected (0)
sixaxis: compatible device connected: PLAYSTATION(R)3 Controller
(054C:0268)
plugins/sixaxis.c:setup_leds() number 2
sixaxis: failed to set LEDS (0 bytes written)
src/agent.c:agent_ref() 0x8117eb8: ref=3
Program received signal SIGSEGV, Segmentation fault.
---
profiles/input/server.c | 28 ++--------------------------
1 file changed, 2 insertions(+), 26 deletions(-)
diff --git a/profiles/input/server.c b/profiles/input/server.c
index f6f85a0..f2e5836 100644
--- a/profiles/input/server.c
+++ b/profiles/input/server.c
@@ -68,15 +68,10 @@ struct sixaxis_data {
uint16_t psm;
};
-static void connect_event_cb(GIOChannel *chan, GError *err, gpointer data);
-
static void sixaxis_sdp_cb(struct btd_device *dev, int err, void *user_data)
{
struct sixaxis_data *data = user_data;
- struct input_server *server;
- GError *gerr = NULL;
const bdaddr_t *src;
- GSList *l;
DBG("err %d (%s)", err, strerror(-err));
@@ -85,29 +80,10 @@ static void sixaxis_sdp_cb(struct btd_device *dev, int err, void *user_data)
src = btd_adapter_get_address(device_get_adapter(dev));
- l = g_slist_find_custom(servers, src, server_cmp);
- if (!l)
- goto fail;
-
- server = l->data;
-
- err = input_device_set_channel(src, device_get_address(dev),
- data->psm, data->chan);
- if (err < 0)
+ if (input_device_set_channel(src, device_get_address(dev), data->psm,
+ data->chan) < 0)
goto fail;
- if (server->confirm) {
- if (!bt_io_accept(server->confirm, connect_event_cb, server,
- NULL, &gerr)) {
- error("bt_io_accept: %s", gerr->message);
- g_error_free(gerr);
- goto fail;
- }
-
- g_io_channel_unref(server->confirm);
- server->confirm = NULL;
- }
-
g_io_channel_unref(data->chan);
g_free(data);
--
1.8.5.2
^ permalink raw reply related
* [PATCH 3/7] input: Fix check if device is sixaxis in auth_callback
From: Szymon Janc @ 2014-01-08 0:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bastien Nocera, Szymon Janc
In-Reply-To: <1389139348-3552-1-git-send-email-szymon.janc@gmail.com>
We need to accept connection if idev is not present but device is sixaxis.
This fix not doing so for sixaxis devices.
---
profiles/input/server.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/profiles/input/server.c b/profiles/input/server.c
index f2e5836..d85d6a9 100644
--- a/profiles/input/server.c
+++ b/profiles/input/server.c
@@ -204,7 +204,7 @@ static void auth_callback(DBusError *derr, void *user_data)
goto reject;
}
- if (!input_device_exists(&src, &dst) && dev_is_sixaxis(&src, &dst))
+ if (!input_device_exists(&src, &dst) && !dev_is_sixaxis(&src, &dst))
return;
if (!bt_io_accept(server->confirm, connect_event_cb, server,
--
1.8.5.2
^ permalink raw reply related
* [PATCH 4/7] input: Fix connecting new trusted sixaxis device
From: Szymon Janc @ 2014-01-08 0:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bastien Nocera, Szymon Janc
In-Reply-To: <1389139348-3552-1-git-send-email-szymon.janc@gmail.com>
If sixaxis device was trusted before first connection over Bluetooth
connection might get accepted before device services were discovered.
This results in conection to PSM19 not being added to idev. To fix
this channel for PSM19 is also added to SDP complete callback so that
both channels are added.
---
profiles/input/server.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/profiles/input/server.c b/profiles/input/server.c
index d85d6a9..3814eaf 100644
--- a/profiles/input/server.c
+++ b/profiles/input/server.c
@@ -101,9 +101,6 @@ static void sixaxis_browse_sdp(const bdaddr_t *src, const bdaddr_t *dst,
struct btd_device *device;
struct sixaxis_data *data;
- if (psm != L2CAP_PSM_HIDP_CTRL)
- return;
-
device = btd_adapter_find_device(adapter_find(src), dst);
if (!device)
return;
@@ -112,7 +109,9 @@ static void sixaxis_browse_sdp(const bdaddr_t *src, const bdaddr_t *dst,
data->chan = g_io_channel_ref(chan);
data->psm = psm;
- device_discover_services(device);
+ if (psm == L2CAP_PSM_HIDP_CTRL)
+ device_discover_services(device);
+
device_wait_for_svc_complete(device, sixaxis_sdp_cb, data);
}
--
1.8.5.2
^ permalink raw reply related
* [PATCH 5/7] client: Add untrust command
From: Szymon Janc @ 2014-01-08 0:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bastien Nocera, Szymon Janc
In-Reply-To: <1389139348-3552-1-git-send-email-szymon.janc@gmail.com>
---
client/main.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/client/main.c b/client/main.c
index ebc85c6..a6e7906 100644
--- a/client/main.c
+++ b/client/main.c
@@ -851,6 +851,35 @@ static void cmd_trust(const char *arg)
g_free(str);
}
+static void cmd_untrust(const char *arg)
+{
+ GDBusProxy *proxy;
+ dbus_bool_t trusted;
+ char *str;
+
+ if (!arg || !strlen(arg)) {
+ rl_printf("Missing device address argument\n");
+ return;
+ }
+
+ proxy = find_proxy_by_address(dev_list, arg);
+ if (!proxy) {
+ rl_printf("Device %s not available\n", arg);
+ return;
+ }
+
+ trusted = FALSE;
+
+ str = g_strdup_printf("%s untrust", arg);
+
+ if (g_dbus_proxy_set_property_basic(proxy, "Trusted",
+ DBUS_TYPE_BOOLEAN, &trusted,
+ generic_callback, str, g_free) == TRUE)
+ return;
+
+ g_free(str);
+}
+
static void remove_device_reply(DBusMessage *message, void *user_data)
{
DBusError error;
@@ -1088,6 +1117,8 @@ static const struct {
dev_generator },
{ "trust", "<dev>", cmd_trust, "Trust device",
dev_generator },
+ { "untrust", "<dev>", cmd_untrust, "Untrust device",
+ dev_generator },
{ "remove", "<dev>", cmd_remove, "Remove device",
dev_generator },
{ "connect", "<dev>", cmd_connect, "Connect device",
--
1.8.5.2
^ permalink raw reply related
* [PATCH 6/7] client: Add block command
From: Szymon Janc @ 2014-01-08 0:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bastien Nocera, Szymon Janc
In-Reply-To: <1389139348-3552-1-git-send-email-szymon.janc@gmail.com>
---
client/main.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/client/main.c b/client/main.c
index a6e7906..9f9231a 100644
--- a/client/main.c
+++ b/client/main.c
@@ -880,6 +880,35 @@ static void cmd_untrust(const char *arg)
g_free(str);
}
+static void cmd_block(const char *arg)
+{
+ GDBusProxy *proxy;
+ dbus_bool_t blocked;
+ char *str;
+
+ if (!arg || !strlen(arg)) {
+ rl_printf("Missing device address argument\n");
+ return;
+ }
+
+ proxy = find_proxy_by_address(dev_list, arg);
+ if (!proxy) {
+ rl_printf("Device %s not available\n", arg);
+ return;
+ }
+
+ blocked = TRUE;
+
+ str = g_strdup_printf("%s block", arg);
+
+ if (g_dbus_proxy_set_property_basic(proxy, "Blocked",
+ DBUS_TYPE_BOOLEAN, &blocked,
+ generic_callback, str, g_free) == TRUE)
+ return;
+
+ g_free(str);
+}
+
static void remove_device_reply(DBusMessage *message, void *user_data)
{
DBusError error;
@@ -1119,6 +1148,8 @@ static const struct {
dev_generator },
{ "untrust", "<dev>", cmd_untrust, "Untrust device",
dev_generator },
+ { "block", "<dev>", cmd_block, "Block device",
+ dev_generator },
{ "remove", "<dev>", cmd_remove, "Remove device",
dev_generator },
{ "connect", "<dev>", cmd_connect, "Connect device",
--
1.8.5.2
^ permalink raw reply related
* [PATCH 7/7] client: Add unblock command
From: Szymon Janc @ 2014-01-08 0:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bastien Nocera, Szymon Janc
In-Reply-To: <1389139348-3552-1-git-send-email-szymon.janc@gmail.com>
---
client/main.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/client/main.c b/client/main.c
index 9f9231a..5791e95 100644
--- a/client/main.c
+++ b/client/main.c
@@ -909,6 +909,35 @@ static void cmd_block(const char *arg)
g_free(str);
}
+static void cmd_unblock(const char *arg)
+{
+ GDBusProxy *proxy;
+ dbus_bool_t blocked;
+ char *str;
+
+ if (!arg || !strlen(arg)) {
+ rl_printf("Missing device address argument\n");
+ return;
+ }
+
+ proxy = find_proxy_by_address(dev_list, arg);
+ if (!proxy) {
+ rl_printf("Device %s not available\n", arg);
+ return;
+ }
+
+ blocked = FALSE;
+
+ str = g_strdup_printf("%s unblock", arg);
+
+ if (g_dbus_proxy_set_property_basic(proxy, "Blocked",
+ DBUS_TYPE_BOOLEAN, &blocked,
+ generic_callback, str, g_free) == TRUE)
+ return;
+
+ g_free(str);
+}
+
static void remove_device_reply(DBusMessage *message, void *user_data)
{
DBusError error;
@@ -1150,6 +1179,8 @@ static const struct {
dev_generator },
{ "block", "<dev>", cmd_block, "Block device",
dev_generator },
+ { "unblock", "<dev>", cmd_unblock, "Unblock device",
+ dev_generator },
{ "remove", "<dev>", cmd_remove, "Remove device",
dev_generator },
{ "connect", "<dev>", cmd_connect, "Connect device",
--
1.8.5.2
^ permalink raw reply related
* RFCOMM help
From: code jug @ 2014-01-08 7:43 UTC (permalink / raw)
To: linux-bluetooth
Hi Everyone,
I have a requirement where I have to
1.get data from bluetooth low energy peripheral.
2.send data to bluetooth classic Device. ( by setting up rfcomm server )
3.Use a single dongle to do both ( if possible ) I have IOgear GBU521
The whole setup needs to run on a raspberry pi "without any user
intervention" for pairing etc.
I have the means to get data from the peripheral..
I want to set a default password (like "1234") so that any device can just
connect to it and receive the data via rfcomm.
Pairing always generates a key on my phone, and there is a prompt on the
linux system. I want it to happen with a default password and not by
prompting. something like pairing to a JYMCU from a phone.
please help.
Regards,
cj
^ permalink raw reply
* Re: [PATCH] android-tester: Add HIDHost initial interface setup test
From: Szymon Janc @ 2014-01-08 8:09 UTC (permalink / raw)
To: Ravi kumar Veeramally; +Cc: linux-bluetooth
In-Reply-To: <1389104291-27210-1-git-send-email-ravikumar.veeramally@linux.intel.com>
Hi Ravi,
> ---
> android/android-tester.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 46 insertions(+)
This patch makes android-tester segfaults when running "HIDHost Init" test.
>
> diff --git a/android/android-tester.c b/android/android-tester.c
> index 9a161ad..e4837c6 100644
> --- a/android/android-tester.c
> +++ b/android/android-tester.c
> @@ -39,6 +39,7 @@
> #include <hardware/hardware.h>
> #include <hardware/bluetooth.h>
> #include <hardware/bt_sock.h>
> +#include <hardware/bt_hh.h>
>
> #include "utils.h"
>
> @@ -79,6 +80,7 @@ struct test_data {
> struct hw_device_t *device;
> const bt_interface_t *if_bluetooth;
> const btsock_interface_t *if_sock;
> + const bthh_interface_t *if_hid;
>
> bool mgmt_settings_set;
> bool cb_count_checked;
> @@ -958,6 +960,16 @@ static bt_callbacks_t bt_callbacks = {
> .le_test_mode_cb = NULL
> };
>
> +static bthh_callbacks_t bthh_callbacks = {
> + .size = sizeof(bthh_callbacks),
> + .connection_state_cb = NULL,
> + .hid_info_cb = NULL,
> + .protocol_mode_cb = NULL,
> + .idle_time_cb = NULL,
> + .get_report_cb = NULL,
> + .virtual_unplug_cb = NULL
> +};
> +
> static void setup(struct test_data *data)
> {
> const hw_module_t *module;
> @@ -1069,6 +1081,11 @@ static void teardown(const void *test_data)
> data->if_bluetooth = NULL;
> }
>
> + if (data->if_hid) {
> + data->if_hid->cleanup();
> + data->if_hid = NULL;
> + }
> +
> data->device->close(data->device);
>
> if (data->bluetoothd_pid)
> @@ -1860,6 +1877,32 @@ clean:
> close(sock_fd);
> }
>
> +static void setup_hidhost_interface(const void *test_data)
> +{
> + struct test_data *data = tester_get_data();
> + bt_status_t status;
> + const void *hid;
> +
> + setup(data);
> +
> + status = data->if_hid->init(&bthh_callbacks);
> + if (status != BT_STATUS_SUCCESS) {
> + data->if_hid = NULL;
> + tester_setup_failed();
> + return;
> + }
> +
> + hid = data->if_bluetooth->get_profile_interface(BT_PROFILE_HIDHOST_ID);
> + if (!hid) {
> + tester_setup_failed();
> + return;
> + }
> +
> + data->if_hid = hid;
> +
> + tester_setup_complete();
> +}
> +
> #define test_bredrle(name, data, test_setup, test, test_teardown) \
> do { \
> struct test_data *user; \
> @@ -2071,5 +2114,8 @@ int main(int argc, char *argv[])
> setup_socket_interface_enabled,
> test_socket_real_connect, teardown);
>
> + test_bredrle("HIDHost Init", NULL, setup_hidhost_interface,
> + test_dummy, teardown);
> +
> return tester_run();
> }
>
--
BR
Szymon Janc
^ permalink raw reply
* Re: [PATCH] android-tester: Add HIDHost initial interface setup test
From: Ravi kumar Veeramally @ 2014-01-08 8:17 UTC (permalink / raw)
To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <1816544.qZJOrILi6u@uw000953>
Hi Szymon,
On 01/08/2014 10:09 AM, Szymon Janc wrote:
> Hi Ravi,
>
>> ---
>> android/android-tester.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 46 insertions(+)
> This patch makes android-tester segfaults when running "HIDHost Init" test.
When I run output is:
HIDHost Init - init
Read Index List callback
Status: 0x00
New hciemu instance created
Index Added callback
Index: 0x0001
Read Info callback
Status: 0x00
Address: 00:AA:01:00:00:00
Version: 0x06
Manufacturer: 0x003f
Supported settings: 0x000002ff
Current settings: 0x00000080
Class: 0x000000
Name:
Short name:
HIDHost Init - setup
Nothing happened. Let me know what commands and in which sequence it
occurred ?
Regards,
Ravi.
>
>> diff --git a/android/android-tester.c b/android/android-tester.c
>> index 9a161ad..e4837c6 100644
>> --- a/android/android-tester.c
>> +++ b/android/android-tester.c
>> @@ -39,6 +39,7 @@
>> #include <hardware/hardware.h>
>> #include <hardware/bluetooth.h>
>> #include <hardware/bt_sock.h>
>> +#include <hardware/bt_hh.h>
>>
>> #include "utils.h"
>>
>> @@ -79,6 +80,7 @@ struct test_data {
>> struct hw_device_t *device;
>> const bt_interface_t *if_bluetooth;
>> const btsock_interface_t *if_sock;
>> + const bthh_interface_t *if_hid;
>>
>> bool mgmt_settings_set;
>> bool cb_count_checked;
>> @@ -958,6 +960,16 @@ static bt_callbacks_t bt_callbacks = {
>> .le_test_mode_cb = NULL
>> };
>>
>> +static bthh_callbacks_t bthh_callbacks = {
>> + .size = sizeof(bthh_callbacks),
>> + .connection_state_cb = NULL,
>> + .hid_info_cb = NULL,
>> + .protocol_mode_cb = NULL,
>> + .idle_time_cb = NULL,
>> + .get_report_cb = NULL,
>> + .virtual_unplug_cb = NULL
>> +};
>> +
>> static void setup(struct test_data *data)
>> {
>> const hw_module_t *module;
>> @@ -1069,6 +1081,11 @@ static void teardown(const void *test_data)
>> data->if_bluetooth = NULL;
>> }
>>
>> + if (data->if_hid) {
>> + data->if_hid->cleanup();
>> + data->if_hid = NULL;
>> + }
>> +
>> data->device->close(data->device);
>>
>> if (data->bluetoothd_pid)
>> @@ -1860,6 +1877,32 @@ clean:
>> close(sock_fd);
>> }
>>
>> +static void setup_hidhost_interface(const void *test_data)
>> +{
>> + struct test_data *data = tester_get_data();
>> + bt_status_t status;
>> + const void *hid;
>> +
>> + setup(data);
>> +
>> + status = data->if_hid->init(&bthh_callbacks);
>> + if (status != BT_STATUS_SUCCESS) {
>> + data->if_hid = NULL;
>> + tester_setup_failed();
>> + return;
>> + }
>> +
>> + hid = data->if_bluetooth->get_profile_interface(BT_PROFILE_HIDHOST_ID);
>> + if (!hid) {
>> + tester_setup_failed();
>> + return;
>> + }
>> +
>> + data->if_hid = hid;
>> +
>> + tester_setup_complete();
>> +}
>> +
>> #define test_bredrle(name, data, test_setup, test, test_teardown) \
>> do { \
>> struct test_data *user; \
>> @@ -2071,5 +2114,8 @@ int main(int argc, char *argv[])
>> setup_socket_interface_enabled,
>> test_socket_real_connect, teardown);
>>
>> + test_bredrle("HIDHost Init", NULL, setup_hidhost_interface,
>> + test_dummy, teardown);
>> +
>> return tester_run();
>> }
>>
^ permalink raw reply
* Re: [PATCH] android-tester: Add HIDHost initial interface setup test
From: Szymon Janc @ 2014-01-08 8:26 UTC (permalink / raw)
To: Ravi kumar Veeramally; +Cc: linux-bluetooth
In-Reply-To: <52CD098D.2090308@linux.intel.com>
Hi Ravi,
> Hi Szymon,
>
> On 01/08/2014 10:09 AM, Szymon Janc wrote:
> > Hi Ravi,
> >
> >> ---
> >> android/android-tester.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
> >> 1 file changed, 46 insertions(+)
> > This patch makes android-tester segfaults when running "HIDHost Init" test.
> When I run output is:
> HIDHost Init - init
> Read Index List callback
> Status: 0x00
> New hciemu instance created
> Index Added callback
> Index: 0x0001
> Read Info callback
> Status: 0x00
> Address: 00:AA:01:00:00:00
> Version: 0x06
> Manufacturer: 0x003f
> Supported settings: 0x000002ff
> Current settings: 0x00000080
> Class: 0x000000
> Name:
> Short name:
> HIDHost Init - setup
>
> Nothing happened. Let me know what commands and in which sequence it
> occurred ?
This is due to running tester via sudo. Run it from root shell or gdb/valgrind.
>
> Regards,
> Ravi.
> >
> >> diff --git a/android/android-tester.c b/android/android-tester.c
> >> index 9a161ad..e4837c6 100644
> >> --- a/android/android-tester.c
> >> +++ b/android/android-tester.c
> >> @@ -39,6 +39,7 @@
> >> #include <hardware/hardware.h>
> >> #include <hardware/bluetooth.h>
> >> #include <hardware/bt_sock.h>
> >> +#include <hardware/bt_hh.h>
> >>
> >> #include "utils.h"
> >>
> >> @@ -79,6 +80,7 @@ struct test_data {
> >> struct hw_device_t *device;
> >> const bt_interface_t *if_bluetooth;
> >> const btsock_interface_t *if_sock;
> >> + const bthh_interface_t *if_hid;
> >>
> >> bool mgmt_settings_set;
> >> bool cb_count_checked;
> >> @@ -958,6 +960,16 @@ static bt_callbacks_t bt_callbacks = {
> >> .le_test_mode_cb = NULL
> >> };
> >>
> >> +static bthh_callbacks_t bthh_callbacks = {
> >> + .size = sizeof(bthh_callbacks),
> >> + .connection_state_cb = NULL,
> >> + .hid_info_cb = NULL,
> >> + .protocol_mode_cb = NULL,
> >> + .idle_time_cb = NULL,
> >> + .get_report_cb = NULL,
> >> + .virtual_unplug_cb = NULL
> >> +};
> >> +
> >> static void setup(struct test_data *data)
> >> {
> >> const hw_module_t *module;
> >> @@ -1069,6 +1081,11 @@ static void teardown(const void *test_data)
> >> data->if_bluetooth = NULL;
> >> }
> >>
> >> + if (data->if_hid) {
> >> + data->if_hid->cleanup();
> >> + data->if_hid = NULL;
> >> + }
> >> +
> >> data->device->close(data->device);
> >>
> >> if (data->bluetoothd_pid)
> >> @@ -1860,6 +1877,32 @@ clean:
> >> close(sock_fd);
> >> }
> >>
> >> +static void setup_hidhost_interface(const void *test_data)
> >> +{
> >> + struct test_data *data = tester_get_data();
> >> + bt_status_t status;
> >> + const void *hid;
> >> +
> >> + setup(data);
> >> +
> >> + status = data->if_hid->init(&bthh_callbacks);
> >> + if (status != BT_STATUS_SUCCESS) {
> >> + data->if_hid = NULL;
> >> + tester_setup_failed();
> >> + return;
> >> + }
> >> +
> >> + hid = data->if_bluetooth->get_profile_interface(BT_PROFILE_HIDHOST_ID);
> >> + if (!hid) {
> >> + tester_setup_failed();
> >> + return;
> >> + }
> >> +
> >> + data->if_hid = hid;
> >> +
> >> + tester_setup_complete();
> >> +}
> >> +
> >> #define test_bredrle(name, data, test_setup, test, test_teardown) \
> >> do { \
> >> struct test_data *user; \
> >> @@ -2071,5 +2114,8 @@ int main(int argc, char *argv[])
> >> setup_socket_interface_enabled,
> >> test_socket_real_connect, teardown);
> >>
> >> + test_bredrle("HIDHost Init", NULL, setup_hidhost_interface,
> >> + test_dummy, teardown);
> >> +
> >> return tester_run();
> >> }
> >>
>
--
BR
Szymon Janc
^ permalink raw reply
* Re: [PATCH] android-tester: Add HIDHost initial interface setup test
From: Ravi kumar Veeramally @ 2014-01-08 8:43 UTC (permalink / raw)
To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <3983437.QCzj2PTKjz@uw000953>
Hi
On 01/08/2014 10:26 AM, Szymon Janc wrote:
> Hi Ravi,
>
>> Hi Szymon,
>>
>> On 01/08/2014 10:09 AM, Szymon Janc wrote:
>>> Hi Ravi,
>>>
>>>> ---
>>>> android/android-tester.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
>>>> 1 file changed, 46 insertions(+)
>>> This patch makes android-tester segfaults when running "HIDHost Init" test.
>> When I run output is:
>> HIDHost Init - init
>> Read Index List callback
>> Status: 0x00
>> New hciemu instance created
>> Index Added callback
>> Index: 0x0001
>> Read Info callback
>> Status: 0x00
>> Address: 00:AA:01:00:00:00
>> Version: 0x06
>> Manufacturer: 0x003f
>> Supported settings: 0x000002ff
>> Current settings: 0x00000080
>> Class: 0x000000
>> Name:
>> Short name:
>> HIDHost Init - setup
>>
>> Nothing happened. Let me know what commands and in which sequence it
>> occurred ?
> This is due to running tester via sudo. Run it from root shell or gdb/valgrind.
Yes, got it. I'll send v2.
Thanks,
Ravi.
>
>> Regards,
>> Ravi.
>>>> diff --git a/android/android-tester.c b/android/android-tester.c
>>>> index 9a161ad..e4837c6 100644
>>>> --- a/android/android-tester.c
>>>> +++ b/android/android-tester.c
>>>> @@ -39,6 +39,7 @@
>>>> #include <hardware/hardware.h>
>>>> #include <hardware/bluetooth.h>
>>>> #include <hardware/bt_sock.h>
>>>> +#include <hardware/bt_hh.h>
>>>>
>>>> #include "utils.h"
>>>>
>>>> @@ -79,6 +80,7 @@ struct test_data {
>>>> struct hw_device_t *device;
>>>> const bt_interface_t *if_bluetooth;
>>>> const btsock_interface_t *if_sock;
>>>> + const bthh_interface_t *if_hid;
>>>>
>>>> bool mgmt_settings_set;
>>>> bool cb_count_checked;
>>>> @@ -958,6 +960,16 @@ static bt_callbacks_t bt_callbacks = {
>>>> .le_test_mode_cb = NULL
>>>> };
>>>>
>>>> +static bthh_callbacks_t bthh_callbacks = {
>>>> + .size = sizeof(bthh_callbacks),
>>>> + .connection_state_cb = NULL,
>>>> + .hid_info_cb = NULL,
>>>> + .protocol_mode_cb = NULL,
>>>> + .idle_time_cb = NULL,
>>>> + .get_report_cb = NULL,
>>>> + .virtual_unplug_cb = NULL
>>>> +};
>>>> +
>>>> static void setup(struct test_data *data)
>>>> {
>>>> const hw_module_t *module;
>>>> @@ -1069,6 +1081,11 @@ static void teardown(const void *test_data)
>>>> data->if_bluetooth = NULL;
>>>> }
>>>>
>>>> + if (data->if_hid) {
>>>> + data->if_hid->cleanup();
>>>> + data->if_hid = NULL;
>>>> + }
>>>> +
>>>> data->device->close(data->device);
>>>>
>>>> if (data->bluetoothd_pid)
>>>> @@ -1860,6 +1877,32 @@ clean:
>>>> close(sock_fd);
>>>> }
>>>>
>>>> +static void setup_hidhost_interface(const void *test_data)
>>>> +{
>>>> + struct test_data *data = tester_get_data();
>>>> + bt_status_t status;
>>>> + const void *hid;
>>>> +
>>>> + setup(data);
>>>> +
>>>> + status = data->if_hid->init(&bthh_callbacks);
>>>> + if (status != BT_STATUS_SUCCESS) {
>>>> + data->if_hid = NULL;
>>>> + tester_setup_failed();
>>>> + return;
>>>> + }
>>>> +
>>>> + hid = data->if_bluetooth->get_profile_interface(BT_PROFILE_HIDHOST_ID);
>>>> + if (!hid) {
>>>> + tester_setup_failed();
>>>> + return;
>>>> + }
>>>> +
>>>> + data->if_hid = hid;
>>>> +
>>>> + tester_setup_complete();
>>>> +}
>>>> +
>>>> #define test_bredrle(name, data, test_setup, test, test_teardown) \
>>>> do { \
>>>> struct test_data *user; \
>>>> @@ -2071,5 +2114,8 @@ int main(int argc, char *argv[])
>>>> setup_socket_interface_enabled,
>>>> test_socket_real_connect, teardown);
>>>>
>>>> + test_bredrle("HIDHost Init", NULL, setup_hidhost_interface,
>>>> + test_dummy, teardown);
>>>> +
>>>> return tester_run();
>>>> }
>>>>
^ permalink raw reply
* [PATCH] android/pts: Update PTS results for MAP
From: Jakub Tyszkowski @ 2014-01-08 8:52 UTC (permalink / raw)
To: linux-bluetooth
Update MAP PTS results for BlueZ stack on Nexus4 (Android 4.4.2).
---
android/pts-map.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/android/pts-map.txt b/android/pts-map.txt
index 26702af..9850fd4 100644
--- a/android/pts-map.txt
+++ b/android/pts-map.txt
@@ -1,7 +1,7 @@
PTS test results for MAP
PTS version: 5.0
-Tested: 17.12.2013
+Tested: 07.01.2014
Results:
PASS test passed
@@ -70,7 +70,7 @@ TC_MSE_MMB_BV_14_I PASS
TC_MSE_MMB_BV_15_I PASS
TC_MSE_MMB_BV_16_I INC Mailbox MAS instance not available on IUT.
TC_MSE_MMD_BV_02_I PASS
-TC_MSE_MMU_BV_02_I PASS
+TC_MSE_MMU_BV_02_I INC Passing randomly. (Reported PTS Issue ID: 11689)
TC_MSE_MMU_BV_03_I PASS
TC_MSE_MMN_BV_02_I PASS
TC_MSE_MMN_BV_04_I N/A
--
1.8.5
^ permalink raw reply related
* bluez Low Energy to RFCOMM data streaming and RFCOMM Server Just Works Pairing
From: code jug @ 2014-01-08 8:54 UTC (permalink / raw)
To: linux-bluetooth
Hi Everyone,
I have a requirement where I have to
1.get data from bluetooth low energy peripheral.
2.send data to bluetooth classic Device. ( by setting up rfcomm server )
3.Use a single dongle to do both ( if possible ) I have IOgear GBU521
The whole setup needs to run on a raspberry pi "without any user
intervention" for pairing etc.
I have the means to get data from the peripheral..
I want to set a default password (like "1234") so that any device can just
connect to it and receive the data via rfcomm.
Pairing always generates a key on my phone, and there is a prompt on the
linux system. I want it to happen with a default password and not by
prompting. something like pairing to a JYMCU from a phone.
please help.
Regards,
cj
^ permalink raw reply
* Re: [PATCH_v3 2/4] android/pan: Listen for incoming connections and accept in NAP role
From: Luiz Augusto von Dentz @ 2014-01-08 9:07 UTC (permalink / raw)
To: Ravi kumar Veeramally; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1389097880-14783-3-git-send-email-ravikumar.veeramally@linux.intel.com>
Hi Ravi,
On Tue, Jan 7, 2014 at 2:31 PM, Ravi kumar Veeramally
<ravikumar.veeramally@linux.intel.com> wrote:
> Listen for incoming connections and accept it. Create bnep interface
> add it to bridge and notify control and connection state information
> through HAL. Remove the device on disconnect request. If android
> settings UI does not have bluetooth tethering enabled it immediately
> sends disconnect signal.
> ---
> android/pan.c | 192 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 190 insertions(+), 2 deletions(-)
>
> diff --git a/android/pan.c b/android/pan.c
> index 93078ba..0eef284 100644
> --- a/android/pan.c
> +++ b/android/pan.c
> @@ -63,12 +63,17 @@ struct pan_device {
> uint8_t role;
> GIOChannel *io;
> struct bnep *session;
> + guint watch;
> };
>
> static struct {
> uint32_t record_id;
> + guint watch;
> + GIOChannel *io;
> } nap_dev = {
> .record_id = 0,
> + .watch = 0,
> + .io = NULL,
> };
>
> static int device_cmp(gconstpointer s, gconstpointer user_data)
> @@ -81,13 +86,21 @@ static int device_cmp(gconstpointer s, gconstpointer user_data)
>
> static void pan_device_free(struct pan_device *dev)
> {
> + if (dev->watch > 0) {
> + bnep_server_delete(BNEP_BRIDGE, dev->iface, &dev->dst);
> + g_source_remove(dev->watch);
> + dev->watch = 0;
Usually it is not necessary to assign anything to struct members when
you are freeing the whole struct since its memory gonna be freed
anyway.
^ permalink raw reply
* Re: [PATCH_v3 1/4] android/pan: Register Network Access Point
From: Szymon Janc @ 2014-01-08 9:18 UTC (permalink / raw)
To: Ravi kumar Veeramally; +Cc: linux-bluetooth
In-Reply-To: <1389097880-14783-2-git-send-email-ravikumar.veeramally@linux.intel.com>
Hi Ravi,
> Register NAP server and adds bnep bridge. Removes bridge
> on destroy call. Bridge mechanism is needed when device acting
> as a server and listen for incoming connections.
> ---
> android/pan.c | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 108 insertions(+), 4 deletions(-)
>
> diff --git a/android/pan.c b/android/pan.c
> index 38e353d..93078ba 100644
> --- a/android/pan.c
> +++ b/android/pan.c
> @@ -28,6 +28,11 @@
> #include <unistd.h>
> #include <fcntl.h>
> #include <glib.h>
> +#include <sys/ioctl.h>
> +#include <sys/socket.h>
> +#include <sys/wait.h>
> +#include <net/if.h>
> +#include <linux/sockios.h>
>
> #include "btio/btio.h"
> #include "lib/bluetooth.h"
> @@ -45,11 +50,11 @@
> #include "bluetooth.h"
>
> #define SVC_HINT_NETWORKING 0x02
> +#define BNEP_BRIDGE "bnep"
>
> static bdaddr_t adapter_addr;
> GSList *devices = NULL;
> uint8_t local_role = HAL_PAN_ROLE_NONE;
> -static uint32_t record_id = 0;
>
> struct pan_device {
> char iface[16];
> @@ -60,6 +65,12 @@ struct pan_device {
> struct bnep *session;
> };
>
> +static struct {
> + uint32_t record_id;
> +} nap_dev = {
> + .record_id = 0,
> +};
> +
> static int device_cmp(gconstpointer s, gconstpointer user_data)
> {
> const struct pan_device *dev = s;
> @@ -297,6 +308,91 @@ failed:
> ipc_send_rsp(HAL_SERVICE_ID_PAN, HAL_OP_PAN_DISCONNECT, status);
> }
>
> +static int set_forward_delay(void)
> +{
> + int fd, ret;
> + char path[41];
> +
> + sprintf(path, "/sys/class/net/%s/bridge/forward_delay", BNEP_BRIDGE);
> +
> + fd = open(path, O_RDWR);
> + if (fd < 0)
> + return -errno;
> +
> + ret = write(fd, "0", sizeof("0"));
> + close(fd);
> +
> + return ret;
> +}
> +
> +static int nap_create_bridge(void)
> +{
> + int sk, err;
> +
> + DBG("%s", BNEP_BRIDGE);
> +
> + sk = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0);
> + if (sk < 0)
> + return -EOPNOTSUPP;
> +
> + if (ioctl(sk, SIOCBRADDBR, BNEP_BRIDGE) < 0) {
> + err = -errno;
> + if (err != -EEXIST) {
> + close(sk);
> + return -EOPNOTSUPP;
> + }
> + }
> +
> + err = set_forward_delay();
> + if (err < 0)
> + ioctl(sk, SIOCBRDELBR, BNEP_BRIDGE);
> +
> + close(sk);
> +
> + return err;
> +}
> +
> +static int nap_remove_bridge(void)
> +{
> + int sk, err;
> +
> + DBG("%s", BNEP_BRIDGE);
> +
> + sk = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0);
> + if (sk < 0)
> + return -EOPNOTSUPP;
> +
> + err = ioctl(sk, SIOCBRDELBR, BNEP_BRIDGE);
> + close(sk);
> +
> + if (err < 0)
> + return -EOPNOTSUPP;
> +
> + return 0;
> +}
> +
> +static void destroy_nap_device(void)
> +{
> + DBG("");
> +
> + nap_remove_bridge();
> +
> + nap_dev.record_id = 0;
> +}
> +
> +static int register_nap_server(void)
> +{
> + int err;
> +
> + DBG("");
> +
> + err = nap_create_bridge();
> + if (err < 0)
> + return err;
> +
> + return 0;
> +}
> +
> static void bt_pan_enable(const void *buf, uint16_t len)
> {
> const struct hal_cmd_pan_enable *cmd = buf;
> @@ -441,7 +537,15 @@ bool bt_pan_register(const bdaddr_t *addr)
> return false;
> }
>
> - record_id = rec->handle;
> + err = register_nap_server();
> + if (err < 0) {
> + bt_adapter_remove_record(rec->handle);
> + sdp_record_free(rec);
> + bnep_cleanup();
> + return false;
> + }
> +
> + nap_dev.record_id = rec->handle;
> ipc_register(HAL_SERVICE_ID_PAN, cmd_handlers,
> G_N_ELEMENTS(cmd_handlers));
>
> @@ -455,6 +559,6 @@ void bt_pan_unregister(void)
> bnep_cleanup();
>
> ipc_unregister(HAL_SERVICE_ID_PAN);
> - bt_adapter_remove_record(record_id);
> - record_id = 0;
> + bt_adapter_remove_record(nap_dev.record_id);
> + destroy_nap_device();
I would either zero nap_dev.record_id right after removing record or move
removing record to destroy_nap_device().
--
BR
Szymon Janc
^ permalink raw reply
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