Linux bluetooth development
 help / color / mirror / Atom feed
* Re: mouse not found with bluez5 but was fine with bluez4
From: Johan Hedberg @ 2013-12-11 19:25 UTC (permalink / raw)
  To: Brian J. Murrell; +Cc: linux-bluetooth
In-Reply-To: <1386776083.31076.60.camel@bmurrell-mobl.amr.corp.intel.com>

Hi Brian,

On Wed, Dec 11, 2013, Brian J. Murrell wrote:
> [ 1472.102375] usb 2-1: USB disconnect, device number 2
> [ 1472.102386] usb 2-1.1: USB disconnect, device number 9
> [ 1472.127401] usb 2-1.2: USB disconnect, device number 10
> [ 1472.141932] usb 2-1.3: USB disconnect, device number 11
> [ 1479.644058] usb 2-1: new full-speed USB device number 12 using ohci-pci
> [ 1479.844081] usb 2-1: New USB device found, idVendor=0a5c, idProduct=4500
> [ 1479.844093] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> [ 1479.844099] usb 2-1: Product: BCM2046B1
> [ 1479.844104] usb 2-1: Manufacturer: Broadcom
> [ 1479.847670] hub 2-1:1.0: USB hub found
> [ 1479.850082] hub 2-1:1.0: 3 ports detected
> [ 1480.151074] usb 2-1.1: new full-speed USB device number 13 using ohci-pci
> [ 1480.250070] usb 2-1.1: New USB device found, idVendor=0a5c, idProduct=4502
> [ 1480.250077] usb 2-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber
> [ 1480.260236] input: HID 0a5c:4502 as /devices/pci0000:00/0000:00:02.0/usb2/2-1
> [ 1480.261860] hid-generic 0003:0A5C:4502.0004: input,hidraw1: USB HID v1.11 Key
> [ 1480.330068] usb 2-1.2: new full-speed USB device number 14 using ohci-pci
> [ 1480.430070] usb 2-1.2: New USB device found, idVendor=0a5c, idProduct=4503
> [ 1480.430079] usb 2-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber
> [ 1480.441241] input: HID 0a5c:4503 as /devices/pci0000:00/0000:00:02.0/usb2/2-1
> [ 1480.442349] hid-generic 0003:0A5C:4503.0005: input,hidraw2: USB HID v1.11 Mou
> [ 1480.513076] usb 2-1.3: new full-speed USB device number 15 using ohci-pci
> [ 1480.626069] usb 2-1.3: New USB device found, idVendor=0a5c, idProduct=2148
> [ 1480.626081] usb 2-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber
> [ 1480.626088] usb 2-1.3: Product: BCM92046DG-CL1ROM
> [ 1480.626093] usb 2-1.3: Manufacturer: Broadcom Corp
> [ 1480.626098] usb 2-1.3: SerialNumber: XXXXXXXXXXXXXXX

I'm not sure if I'm interpreting this right, but it seems the device is
in HID mode and not HCI (normal Bluetooth) mode? Have you tried running
the hid2hci tool (part of BlueZ)? Maybe that was somehow auto-run with
your previous installation?

Johan

^ permalink raw reply

* Re: mouse not found with bluez5 but was fine with bluez4
From: Brian J. Murrell @ 2013-12-11 20:13 UTC (permalink / raw)
  To: Johan Hedberg; +Cc: linux-bluetooth
In-Reply-To: <20131211192523.GA17953@x220.p-661hnu-f1>

On Wed, 2013-12-11 at 21:25 +0200, Johan Hedberg wrote:
> Hi Brian,

Hi Johan,

> I'm not sure if I'm interpreting this right, but it seems the device is
> in HID mode and not HCI (normal Bluetooth) mode?

I dunno.  I'm just the user.  :-)

> Have you tried running
> the hid2hci tool (part of BlueZ)?

Not yet.  It wasn't installed by default on F20.  When I did though,
things went much better:

$ bluetoothctl 
[NEW] Controller 00:02:72:1E:E0:12 pc.interlinx.bc.ca-0 [default]
[NEW] Device 00:0D:E6:68:B4:6F Samsung WEP850
[NEW] Device 70:F3:95:3E:92:34 brian-laptop
[NEW] Device 7C:1E:52:6E:59:D2 Microsoft Sculpt Touch Mouse
[bluetooth]# agent on
Agent registered
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# scan on
Discovery started
[CHG] Controller 00:02:72:1E:E0:12 Discovering: yes
[CHG] Device 7C:1E:52:6E:59:D2 RSSI: -59
[bluetooth]# scan off
[CHG] Device 7C:1E:52:6E:59:D2 RSSI is nil
Discovery stopped
[CHG] Controller 00:02:72:1E:E0:12 Discovering: no
[bluetooth]# pair 7C:1E:52:6E:59:D2
Attempting to pair with 7C:1E:52:6E:59:D2
[CHG] Device 7C:1E:52:6E:59:D2 Connected: yes
[CHG] Device 7C:1E:52:6E:59:D2 Paired: yes
Pairing successful
[CHG] Device 7C:1E:52:6E:59:D2 Connected: no
[bluetooth]# connect 7C:1E:52:6E:59:D2
Attempting to connect to 7C:1E:52:6E:59:D2
[CHG] Device 7C:1E:52:6E:59:D2 Connected: yes
Connection successful
[CHG] Device 7C:1E:52:6E:59:D2 Modalias: usb:v045Ep077Cd011E
[CHG] Device 7C:1E:52:6E:59:D2 Modalias: usb:v045Ep077Cd011E
[bluetooth]# trust 7C:1E:52:6E:59:D2
Changing 7C:1E:52:6E:59:D2 trust succeeded
[bluetooth]# quit
[DEL] Controller 00:02:72:1E:E0:12 pc.interlinx.bc.ca-0 [default]

So it looks like it's a gnome bluetooth-wizard problem.  I will raise
some tickets.

> Maybe that was somehow auto-run with
> your previous installation?

I don't really know.  It was F19.  And that means bluez4.  So I guess
this is going to be a transition issue/bug I need to raise on F20.

Cheers and thanks so much!

b.



^ permalink raw reply

* Doc for Qualcomm AR3001 HCI
From: Frank Zhao @ 2013-12-11 20:36 UTC (permalink / raw)
  To: linux-bluetooth

I am doing some hacking on a PlayStation 4's DualShock 4 controller,
inside is a Qualcomm Atheros AR3002 connected to a microcontroller
using UART HCI. I have a logic analyzer connected to the UART signals
and I have captured a lot of data. But a lot of the HCI commands have
OGF of 0xFC which means that the commands are "vendor defined", and
thus they are not in the HCI functional specifications documentation.

I can't find any helpful technical documentation at all from
Qualcomm's website and they probably won't help some hobbyist anyways.
I've searched Google and found your website. You guys have written a
driver for this chip already, so you must have some documentation on
Qualcomm's own HCI commands. Can you please share this documentation
with me?

Thank you

Frank Zhao

PS: I originally wrote this email to linux-wireless but they told me
to try linux-bluetooth instead

^ permalink raw reply

* Re: [PATCH v10 0/5] Bluetooth LE 6LoWPAN
From: Marcel Holtmann @ 2013-12-11 20:59 UTC (permalink / raw)
  To: Jukka Rissanen; +Cc: linux-bluetooth@vger.kernel.org development
In-Reply-To: <1386774338-2093-1-git-send-email-jukka.rissanen@linux.intel.com>

Hi Jukka,

> this is 6LoWPAN code for BT LE as described in
> http://tools.ietf.org/html/draft-ietf-6lo-btle-00

all 5 patches have been applied to bluetooth-next tree.

Regards

Marcel


^ permalink raw reply

* Re: mouse not found with bluez5 but was fine with bluez4
From: Bastien Nocera @ 2013-12-11 21:49 UTC (permalink / raw)
  To: Brian J. Murrell; +Cc: Johan Hedberg, linux-bluetooth
In-Reply-To: <1386792806.3586.6.camel@bmurrell-mobl.amr.corp.intel.com>

On Wed, 2013-12-11 at 15:13 -0500, Brian J. Murrell wrote:
> On Wed, 2013-12-11 at 21:25 +0200, Johan Hedberg wrote:
> > Hi Brian,
> 
> Hi Johan,
> 
> > I'm not sure if I'm interpreting this right, but it seems the device is
> > in HID mode and not HCI (normal Bluetooth) mode?
> 
> I dunno.  I'm just the user.  :-)
> 
> > Have you tried running
> > the hid2hci tool (part of BlueZ)?
> 
> Not yet.  It wasn't installed by default on F20.  When I did though,
> things went much better:
> 
> $ bluetoothctl 
> [NEW] Controller 00:02:72:1E:E0:12 pc.interlinx.bc.ca-0 [default]
> [NEW] Device 00:0D:E6:68:B4:6F Samsung WEP850
> [NEW] Device 70:F3:95:3E:92:34 brian-laptop
> [NEW] Device 7C:1E:52:6E:59:D2 Microsoft Sculpt Touch Mouse
<snip>
> So it looks like it's a gnome bluetooth-wizard problem.  I will raise
> some tickets.

I don't see why it would be a problem in the wizard. You basically
didn't have a Bluetooth adapter before you installed bluez-hid2hci.

> > Maybe that was somehow auto-run with
> > your previous installation?
> 
> I don't really know.  It was F19.  And that means bluez4.  So I guess
> this is going to be a transition issue/bug I need to raise on F20.

bluez-hid2hci was already an optional package in F19.


^ permalink raw reply

* Re: [PATCH BlueZ] build: Add coverage support
From: Anderson Lizardo @ 2013-12-11 22:31 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: BlueZ development
In-Reply-To: <1386759341-14346-1-git-send-email-luiz.dentz@gmail.com>

Hi Luiz,

On Wed, Dec 11, 2013 at 7:55 AM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> --- a/acinclude.m4
> +++ b/acinclude.m4
> @@ -51,6 +51,15 @@ AC_DEFUN([MISC_FLAGS], [
>                         misc_ldflags="$misc_ldflags -pie"
>                 fi
>         ])
> +       AC_ARG_ENABLE(coverage, AC_HELP_STRING([--enable-coverage],
> +                       [enable coverage flags]), [
> +               AC_PATH_PROG([LCOV], [lcov])
> +               if (test "$LCOV" && test "${enableval}" = "yes"); then
> +                       misc_cflags="$misc_cflags -ftest-coverage"
> +                       misc_cflags="$misc_cflags -fprofile-arcs"
> +                       misc_ldflags="$misc_ldflags -gcov"
> +               fi
> +       ])

I believe the current recommended (or at least simpler) way to enable
coverage is to use "--coverage" option (both as CFLAGS and LDFLAGS),
instead of separate -ftest-coverage/-fprofile-arcs/-gcov options.
Check "man gcc" for details.

>         AC_SUBST([MISC_CFLAGS], $misc_cflags)
>         AC_SUBST([MISC_LDFLAGS], $misc_ldflags)
>  ])

Best Regards,
-- 
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

^ permalink raw reply

* Re: [PATCH 6/9] android/bluetooth: Add support for remote device RSSI
From: Anderson Lizardo @ 2013-12-12  0:04 UTC (permalink / raw)
  To: Szymon Janc; +Cc: BlueZ development
In-Reply-To: <1386757887-29018-6-git-send-email-szymon.janc@tieto.com>

Hi Szymon,

On Wed, Dec 11, 2013 at 7:31 AM, Szymon Janc <szymon.janc@tieto.com> wrote:
\> @@ -2306,11 +2309,13 @@ static uint8_t
get_device_friendly_name(struct device *dev)
>
>  static uint8_t get_device_rssi(struct device *dev)
>  {
> -       DBG("Not implemented");
> +       if (!dev->rssi)
> +               return HAL_STATUS_FAILED;

0 dBm is a valid RSSI value, so I suppose this code needs some other
way to identify an uninitialized value (e.g. a second boolean field.)

>
> -       /* TODO */
> +       send_device_property(&dev->bdaddr, HAL_PROP_DEVICE_RSSI,
> +                                               sizeof(dev->rssi), &dev->rssi);
>
> -       return HAL_STATUS_FAILED;
> +       return HAL_STATUS_SUCCESS;
>  }

Best Regards,
-- 
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

^ permalink raw reply

* Re: openSUSE 13.1:  bt headsets lose connection
From: Bastien Nocera @ 2013-12-12  0:31 UTC (permalink / raw)
  To: colbec; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1385236029.2236.7.camel@linux-3kti>

On Sat, 2013-11-23 at 14:47 -0500, Colin Beckingham wrote:
> In openSUSE 12.3 bluetooth operations were mostly ok. In the last few
> days I have upgraded from 12.3 to 13.1 and now none of my bt headsets
> can remain connected. Pairing is not a problem, but then they
> immediately disconnect.
> 
> I have posted a bug at gnome-bluetooth, but it seems that a previous
> similar bug has been tested and found that gnome-bluetooth may be
> excluded. Here is the bug report:
> 
> https://bugzilla.gnome.org/show_bug.cgi?id=712379
> 
> I have run a test connection using bluetoothd (5.11) in debug mode, and
> have attached the output in file bluedump.txt.
> 
> Also I have tried running bluetoothd with the -E option and no change.
> 
> I understand that it is possible this may already be known, and that
> pulseaudio may be involved. But since I have the debug output I thought
> I would check with the linux-bluetooth community first.

If your headset only has support for HFP/Hansfree, it likely won't work
with PulseAudio yet/anymore. PulseAudio is currently adding support for
this.

Cheers


^ permalink raw reply

* [PATCH] l2cap-tester: Close sk in error path
From: Andrei Emeltchenko @ 2013-12-12  7:48 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

This fixes resource leak warnings.
---
 tools/l2cap-tester.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/l2cap-tester.c b/tools/l2cap-tester.c
index 505ac79..e4dade2 100644
--- a/tools/l2cap-tester.c
+++ b/tools/l2cap-tester.c
@@ -503,6 +503,7 @@ static int create_l2cap_sock(struct test_data *data, uint16_t psm)
 	master_bdaddr = hciemu_get_master_bdaddr(data->hciemu);
 	if (!master_bdaddr) {
 		tester_warn("No master bdaddr");
+		close(sk);
 		return -ENODEV;
 	}
 
@@ -701,6 +702,7 @@ static void test_server(const void *test_data)
 			tester_warn("listening on socket failed: %s (%u)",
 					strerror(errno), errno);
 			tester_test_failed();
+			close(sk);
 			return;
 		}
 
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 1/2] Bluetooth: Add missing 6lowpan.h include
From: johan.hedberg @ 2013-12-12  7:53 UTC (permalink / raw)
  To: linux-bluetooth

From: Johan Hedberg <johan.hedberg@intel.com>

The 6lowpan.c file was missing an #include statement for 6lowpan.h.
Without it we get the following type of warnings:

net/bluetooth/6lowpan.c:320:5: warning: symbol 'bt_6lowpan_recv' was not declared. Should it be static?
net/bluetooth/6lowpan.c:737:5: warning: symbol 'bt_6lowpan_add_conn' was not declared. Should it be static?
net/bluetooth/6lowpan.c:805:5: warning: symbol 'bt_6lowpan_del_conn' was not declared. Should it be static?
net/bluetooth/6lowpan.c:878:5: warning: symbol 'bt_6lowpan_init' was not declared. Should it be static?
net/bluetooth/6lowpan.c:883:6: warning: symbol 'bt_6lowpan_cleanup' was not declared. Should it be static?

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
 net/bluetooth/6lowpan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index ba840fe2c555..3cbb1d14c304 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -26,6 +26,8 @@
 #include <net/bluetooth/hci_core.h>
 #include <net/bluetooth/l2cap.h>
 
+#include "6lowpan.h"
+
 #include "../ieee802154/6lowpan.h" /* for the compression support */
 
 #define IFACE_NAME_TEMPLATE "bt%d"
-- 
1.8.4.2


^ permalink raw reply related

* [PATCH 2/2] Bluetooth: Fix test for lookup_dev return value
From: johan.hedberg @ 2013-12-12  7:53 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1386834801-1635-1-git-send-email-johan.hedberg@gmail.com>

From: Johan Hedberg <johan.hedberg@intel.com>

The condition wouldn't have previously caused -ENOENT to be returned if
dev was NULL. The proper condition should be if (!dev || !dev->netdev).

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
 net/bluetooth/6lowpan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index 3cbb1d14c304..5ad8b483efa3 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -330,7 +330,7 @@ int bt_6lowpan_recv(struct l2cap_conn *conn, struct sk_buff *skb)
 		return -ENOENT;
 
 	dev = lookup_dev(conn);
-	if (dev && !dev->netdev)
+	if (!dev || !dev->netdev)
 		return -ENOENT;
 
 	err = recv_pkt(skb, dev->netdev, conn);
-- 
1.8.4.2


^ permalink raw reply related

* Re: [PATCH] l2cap-tester: Close sk in error path
From: Johan Hedberg @ 2013-12-12  7:57 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1386834508-9929-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

Hi Andrei,

On Thu, Dec 12, 2013, Andrei Emeltchenko wrote:
> This fixes resource leak warnings.
> ---
>  tools/l2cap-tester.c | 2 ++
>  1 file changed, 2 insertions(+)

Applied. Thanks.

Johan

^ permalink raw reply

* Re: [PATCH 1/2] Bluetooth: Add missing 6lowpan.h include
From: Marcel Holtmann @ 2013-12-12  8:00 UTC (permalink / raw)
  To: Johan Hedberg; +Cc: linux-bluetooth@vger.kernel.org development
In-Reply-To: <1386834801-1635-1-git-send-email-johan.hedberg@gmail.com>

Hi Johan,

> The 6lowpan.c file was missing an #include statement for 6lowpan.h.
> Without it we get the following type of warnings:
> 
> net/bluetooth/6lowpan.c:320:5: warning: symbol 'bt_6lowpan_recv' was not declared. Should it be static?
> net/bluetooth/6lowpan.c:737:5: warning: symbol 'bt_6lowpan_add_conn' was not declared. Should it be static?
> net/bluetooth/6lowpan.c:805:5: warning: symbol 'bt_6lowpan_del_conn' was not declared. Should it be static?
> net/bluetooth/6lowpan.c:878:5: warning: symbol 'bt_6lowpan_init' was not declared. Should it be static?
> net/bluetooth/6lowpan.c:883:6: warning: symbol 'bt_6lowpan_cleanup' was not declared. Should it be static?
> 
> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
> ---
> net/bluetooth/6lowpan.c | 2 ++
> 1 file changed, 2 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel


^ permalink raw reply

* Re: [PATCH 2/2] Bluetooth: Fix test for lookup_dev return value
From: Marcel Holtmann @ 2013-12-12  8:01 UTC (permalink / raw)
  To: Johan Hedberg; +Cc: linux-bluetooth@vger.kernel.org development
In-Reply-To: <1386834801-1635-2-git-send-email-johan.hedberg@gmail.com>

Hi Johan,

> The condition wouldn't have previously caused -ENOENT to be returned if
> dev was NULL. The proper condition should be if (!dev || !dev->netdev).
> 
> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
> ---
> net/bluetooth/6lowpan.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


^ permalink raw reply

* Re: [PATCH v2 1/8] android/pts: Remove PIXIT info from PICS files
From: Johan Hedberg @ 2013-12-12  8:29 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <1386775638-24941-1-git-send-email-szymon.janc@tieto.com>

Hi Szymon,

On Wed, Dec 11, 2013, Szymon Janc wrote:
> Full PIXIT configuration will be provided in separate files.
> ---
>  android/pics-did.txt  | 11 -----------
>  android/pics-gap.txt  |  5 -----
>  android/pics-hid.txt  |  5 -----
>  android/pics-opp.txt  |  5 -----
>  android/pics-pan.txt  |  5 -----
>  android/pics-pbap.txt |  5 -----
>  6 files changed, 36 deletions(-)

All patches have been applied. Thanks.

Johan

^ permalink raw reply

* Re: [PATCH 6/9] android/bluetooth: Add support for remote device RSSI
From: Szymon Janc @ 2013-12-12  8:58 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: BlueZ development
In-Reply-To: <CAJdJm_N2aABBteKtWyRXh_-a8Oy722BMbZSrH_koNYbY8F5hpA@mail.gmail.com>

Hi Anderson,

> Hi Szymon,
> 
> On Wed, Dec 11, 2013 at 7:31 AM, Szymon Janc <szymon.janc@tieto.com> wrote:
> \> @@ -2306,11 +2309,13 @@ static uint8_t
> get_device_friendly_name(struct device *dev)
> >
> >  static uint8_t get_device_rssi(struct device *dev)
> >  {
> > -       DBG("Not implemented");
> > +       if (!dev->rssi)
> > +               return HAL_STATUS_FAILED;
> 
> 0 dBm is a valid RSSI value, so I suppose this code needs some other
> way to identify an uninitialized value (e.g. a second boolean field.)

Kernel sends rssi==0 if rssi info was not present on inquiry so I used this
value, but maybe it should use 127 for that.. ? (yet, this might cause trouble
as linux bluetoothd is checking 0 as well)

-- 
BR
Szymon Janc



^ permalink raw reply

* [PATCH] android/tester: Test Socket Init
From: Andrei Emeltchenko @ 2013-12-12  9:00 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

The first test for testing socket init (get socket interface)
---
 android/android-tester.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/android/android-tester.c b/android/android-tester.c
index a36c10a..b864483 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -34,6 +34,7 @@
 
 #include <hardware/hardware.h>
 #include <hardware/bluetooth.h>
+#include <hardware/bt_sock.h>
 
 #define adapter_props adapter_prop_bdaddr, adapter_prop_bdname, \
 			adapter_prop_uuids, adapter_prop_cod, \
@@ -76,7 +77,9 @@ struct test_data {
 	enum hciemu_type hciemu_type;
 	const struct generic_data *test_data;
 	pid_t bluetoothd_pid;
+
 	const bt_interface_t *if_bluetooth;
+	const btsock_interface_t *if_sock;
 
 	bool mgmt_settings_set;
 	bool hal_cb_called;
@@ -625,6 +628,22 @@ static void setup_enabled_adapter(const void *test_data)
 	data->if_bluetooth->enable();
 }
 
+static void setup_socket_interface(const void *test_data)
+{
+	struct test_data *data = tester_get_data();
+	const void *sock;
+
+	setup(data);
+
+	sock = data->if_bluetooth->get_profile_interface(BT_PROFILE_SOCKETS_ID);
+	if (!sock)
+		tester_setup_failed();
+
+	data->if_sock = sock;
+
+	tester_setup_complete();
+}
+
 static void teardown(const void *test_data)
 {
 	struct test_data *data = tester_get_data();
@@ -707,5 +726,8 @@ int main(int argc, char *argv[])
 	test_bredrle("Test Disable - Success", &bluetooth_disable_success_test,
 			setup_enabled_adapter, test_disable, teardown);
 
+	test_bredrle("Test Socket Init", NULL, setup_socket_interface,
+						controller_setup, teardown);
+
 	return tester_run();
 }
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 1/4] android/tester: Rename controller_setup to test_dummy
From: Andrei Emeltchenko @ 2013-12-12 10:49 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

test_dummy is a better name for dummy function test.
---
 android/android-tester.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/android/android-tester.c b/android/android-tester.c
index a36c10a..7ecc80d 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -672,7 +672,7 @@ static void test_disable(const void *test_data)
 	data->if_bluetooth->disable();
 }
 
-static void controller_setup(const void *test_data)
+static void test_dummy(const void *test_data)
 {
 	tester_test_passed();
 }
@@ -696,7 +696,7 @@ int main(int argc, char *argv[])
 
 	tester_init(&argc, &argv);
 
-	test_bredrle("Test Init", NULL, setup_base, controller_setup, teardown);
+	test_bredrle("Test Init", NULL, setup_base, test_dummy, teardown);
 
 	test_bredrle("Test Enable - Success", &bluetooth_enable_success_test,
 					setup_base, test_enable, teardown);
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 2/4] android/tester: Add basic Socket Init test
From: Andrei Emeltchenko @ 2013-12-12 10:49 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1386845350-13982-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Test get_socket_interface() and basic setup
---
 android/android-tester.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/android/android-tester.c b/android/android-tester.c
index 7ecc80d..185f57b 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -34,6 +34,7 @@
 
 #include <hardware/hardware.h>
 #include <hardware/bluetooth.h>
+#include <hardware/bt_sock.h>
 
 #define adapter_props adapter_prop_bdaddr, adapter_prop_bdname, \
 			adapter_prop_uuids, adapter_prop_cod, \
@@ -76,7 +77,9 @@ struct test_data {
 	enum hciemu_type hciemu_type;
 	const struct generic_data *test_data;
 	pid_t bluetoothd_pid;
+
 	const bt_interface_t *if_bluetooth;
+	const btsock_interface_t *if_sock;
 
 	bool mgmt_settings_set;
 	bool hal_cb_called;
@@ -677,6 +680,24 @@ static void test_dummy(const void *test_data)
 	tester_test_passed();
 }
 
+/* Test Socket HAL */
+
+static void setup_socket_interface(const void *test_data)
+{
+	struct test_data *data = tester_get_data();
+	const void *sock;
+
+	setup(data);
+
+	sock = data->if_bluetooth->get_profile_interface(BT_PROFILE_SOCKETS_ID);
+	if (!sock)
+		tester_setup_failed();
+
+	data->if_sock = sock;
+
+	tester_setup_complete();
+}
+
 #define test_bredrle(name, data, test_setup, test, test_teardown) \
 	do { \
 		struct test_data *user; \
@@ -707,5 +728,8 @@ int main(int argc, char *argv[])
 	test_bredrle("Test Disable - Success", &bluetooth_disable_success_test,
 			setup_enabled_adapter, test_disable, teardown);
 
+	test_bredrle("Test Socket Init", NULL, setup_socket_interface,
+						test_dummy, teardown);
+
 	return tester_run();
 }
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 3/4] android/tester: Add Socket data to generic test data struct
From: Andrei Emeltchenko @ 2013-12-12 10:49 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1386845350-13982-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Socket data will be used in generic Socket HAL tests
---
 android/android-tester.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/android/android-tester.c b/android/android-tester.c
index 185f57b..15fd29e 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -61,6 +61,14 @@ enum hal_bluetooth_callbacks_id {
 };
 
 struct generic_data {
+	/* Socket data */
+	btsock_type_t sock_type;
+	const char *service_name;
+	const uint8_t *service_uuid;
+	int channel;
+	int flags;
+	bt_status_t expected_status;
+
 	uint8_t expected_adapter_status;
 	uint32_t expect_settings_set;
 	uint8_t expected_hal_callbacks[];
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 4/4] android/tester: Add Socket listen() invalid sock type
From: Andrei Emeltchenko @ 2013-12-12 10:49 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1386845350-13982-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Test invalid socket type during listen()
---
 android/android-tester.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/android/android-tester.c b/android/android-tester.c
index 15fd29e..e2554a3 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -690,6 +690,15 @@ static void test_dummy(const void *test_data)
 
 /* Test Socket HAL */
 
+static const struct generic_data btsock_inv_param_socktype = {
+	.sock_type = 0,
+	.channel = 1,
+	.service_uuid = NULL,
+	.service_name = "Test service",
+	.flags = 0,
+	.expected_status = BT_STATUS_PARM_INVALID,
+};
+
 static void setup_socket_interface(const void *test_data)
 {
 	struct test_data *data = tester_get_data();
@@ -706,6 +715,28 @@ static void setup_socket_interface(const void *test_data)
 	tester_setup_complete();
 }
 
+static void test_generic_listen(const void *test_data)
+{
+	struct test_data *data = tester_get_data();
+	const struct generic_data *test = data->test_data;
+	bt_status_t status;
+	int sock_fd = -1;
+
+	status = data->if_sock->listen(test->sock_type,
+					test->service_name, test->service_uuid,
+					test->channel, &sock_fd, test->flags);
+	if (status != test->expected_status) {
+		tester_test_failed();
+		goto clean;
+	}
+
+	tester_test_passed();
+
+clean:
+	if (sock_fd >= 0)
+		close(sock_fd);
+}
+
 #define test_bredrle(name, data, test_setup, test, test_teardown) \
 	do { \
 		struct test_data *user; \
@@ -739,5 +770,9 @@ int main(int argc, char *argv[])
 	test_bredrle("Test Socket Init", NULL, setup_socket_interface,
 						test_dummy, teardown);
 
+	test_bredrle("Test Socket Listen - Invalid sock type",
+			&btsock_inv_param_socktype, setup_socket_interface,
+			test_generic_listen, teardown);
+
 	return tester_run();
 }
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH] android/hal-sock: Fix returning unsupported instead of invalid
From: Andrei Emeltchenko @ 2013-12-12 10:58 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

For socket type 0 we shall return BT_STATUS_PARM_INVALID,
BT_STATUS_UNSUPPORTED shall be returned for unsupported socket types
like L2CAP.
---
 android/hal-sock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/android/hal-sock.c b/android/hal-sock.c
index f45be30..301c77f 100644
--- a/android/hal-sock.c
+++ b/android/hal-sock.c
@@ -54,7 +54,7 @@ static bt_status_t sock_listen(btsock_type_t type, const char *service_name,
 					const uint8_t *uuid, int chan,
 					int *sock, int flags)
 {
-	if ((!uuid && chan <= 0) || !sock) {
+	if ((!uuid && chan <= 0) || !sock || !type) {
 		error("Invalid params: uuid %s, chan %d, sock %p",
 						btuuid2str(uuid), chan, sock);
 		return BT_STATUS_PARM_INVALID;
-- 
1.8.3.2


^ permalink raw reply related

* Re: [PATCH 6/9] android/bluetooth: Add support for remote device RSSI
From: Anderson Lizardo @ 2013-12-12 11:03 UTC (permalink / raw)
  To: Szymon Janc; +Cc: BlueZ development
In-Reply-To: <3353914.oihVPgriBc@uw000953>

Hi Szymon,

On Thu, Dec 12, 2013 at 5:58 AM, Szymon Janc <szymon.janc@tieto.com> wrote:
>> On Wed, Dec 11, 2013 at 7:31 AM, Szymon Janc <szymon.janc@tieto.com> wrote:
>> \> @@ -2306,11 +2309,13 @@ static uint8_t
>> get_device_friendly_name(struct device *dev)
>> >
>> >  static uint8_t get_device_rssi(struct device *dev)
>> >  {
>> > -       DBG("Not implemented");
>> > +       if (!dev->rssi)
>> > +               return HAL_STATUS_FAILED;
>>
>> 0 dBm is a valid RSSI value, so I suppose this code needs some other
>> way to identify an uninitialized value (e.g. a second boolean field.)
>
> Kernel sends rssi==0 if rssi info was not present on inquiry so I used this
> value, but maybe it should use 127 for that.. ? (yet, this might cause trouble
> as linux bluetoothd is checking 0 as well)

I remember commenting on this when mgmt API (it was for TX Power,
which is more common to be 0 dBm, but I can't remember what was the
result of the discussion). In any case, I think handling this way will
make devices that use TX Power higher than 0 dBm (and thus can make a
0dBm RSSI possible) not report their RSSI. It is not common IMHO, but
it is possible.

Best Regards,
-- 
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

^ permalink raw reply

* Re: mouse not found with bluez5 but was fine with bluez4
From: Brian J. Murrell @ 2013-12-12 12:15 UTC (permalink / raw)
  To: Bastien Nocera; +Cc: Johan Hedberg, linux-bluetooth
In-Reply-To: <1386798596.1982.32.camel@nuvo>

On Wed, 2013-12-11 at 22:49 +0100, Bastien Nocera wrote:
> 
> I don't see why it would be a problem in the wizard. You basically
> didn't have a Bluetooth adapter before you installed bluez-hid2hci.

But of course I also tried the wizard after correcting that.  I most
certainly could understand that the wizard would not have worked before
running hid2hci and would only assert that the wizard is not working by
trying it after installing bluez-hid2hci.

So just to be clear, I have a mouse working, so the adapter is
definitely in a state where bluetooth-wizard should work (right?), yet
it is not finding the headset I have sitting here in pairing mode right
this minute.

bluetoothctl certainly sees it:

$ bluetoothctl 
[NEW] Controller 00:02:72:1E:E0:12 pc.interlinx.bc.ca-0 [default]
[NEW] Device 00:0D:E6:68:B4:6F Samsung WEP850
[NEW] Device 70:F3:95:3E:92:34 brian-laptop
[NEW] Device 7C:1E:52:6E:59:D2 Microsoft Sculpt Touch Mouse

> > > Maybe that was somehow auto-run with
> > > your previous installation?
> > 
> > I don't really know.  It was F19.  And that means bluez4.  So I guess
> > this is going to be a transition issue/bug I need to raise on F20.
> 
> bluez-hid2hci was already an optional package in F19.

But since I didn't have it installed on F19, apparently needing it on
F20 is a new requirement of Bluez5.

But really, I don't want to argue about it.  I have my machine working
and have gained a bit of operational knowledge about Bluez5 that will
serve me well as I migrate machines to F20.  I have filed a ticket with
the Fedora project alerting them to the new requirement.  It's now up to
them to decide how important it is that their F20 users don't have the
same problem that I had.

Cheers and thanks much for the help!

b.




^ permalink raw reply

* [PATCHv2 0/7] Add basic socket tests
From: Andrei Emeltchenko @ 2013-12-12 12:48 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Initial socket test cases

Andrei Emeltchenko (7):
  android/tester: Rename controller_setup to test_dummy
  android/tester: Make generic_data structure const void pointer
  android/tester: Add basic Socket Init test
  android/tester: Add Socket data to generic test data struct
  android/tester: Add Socket listen() invalid sock type
  android/hal-sock: Fix returning unsupported instead of invalid
  android/tester: Add Socket listen() invalid L2CAP socket type

 android/android-tester.c | 114 +++++++++++++++++++++++++++++++++++++++++------
 android/hal-sock.c       |   2 +-
 2 files changed, 102 insertions(+), 14 deletions(-)

-- 
1.8.3.2


^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox