* Re: [PATCH 1/4] android: Add CAP_NET_RAW capability
From: Ravi kumar Veeramally @ 2013-11-26 13:14 UTC (permalink / raw)
To: linux-bluetooth, johan.hedberg
In-Reply-To: <20131125142532.GA26309@x220.p-661hnu-f1>
Hi Johan,
On 25.11.2013 16:25, Johan Hedberg wrote:
> Hi Ravi,
>
> On Mon, Nov 25, 2013, Ravi kumar Veeramally wrote:
>> On 25.11.2013 16:01, Johan Hedberg wrote:
>>> Hi Ravi,
>>>
>>> On Mon, Nov 25, 2013, Ravi kumar Veeramally wrote:
>>>> CAP_NET_RAW capability is required to up the bnep interfaces
>>>> in android environment.
>>>> ---
>>>> android/main.c | 1 +
>>>> 1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/android/main.c b/android/main.c
>>>> index c9733f3..bfd2a87 100644
>>>> --- a/android/main.c
>>>> +++ b/android/main.c
>>>> @@ -506,6 +506,7 @@ static bool set_capabilities(void)
>>>> header.pid = 0;
>>>> cap.effective = cap.permitted =
>>>> + CAP_TO_MASK(CAP_NET_RAW) |
>>>> CAP_TO_MASK(CAP_NET_ADMIN) |
>>>> CAP_TO_MASK(CAP_NET_BIND_SERVICE);
>>>> cap.inheritable = 0;
>>> Would you then say that commit 9bda7e8c2130de9a3340ebd0e6cc1dedc2eae338
>>> is incorrect? A quick grep doesn't show any instances of checking this
>>> capability in the BNEP code of the kernel. Exactly which system call is
>>> it that needs it?
>> bnep_if_up from profiles/network/common.c
>> ---
>> ifr.ifr_flags |= IFF_UP;
>> ifr.ifr_flags |= IFF_MULTICAST;
>>
>> err = ioctl(sk, SIOCSIFFLAGS, (caddr_t) &ifr);
>> ---
>> requires this capability in android environment only.
>> this code is under android macro.
> So you've verified that under "normal" Linux this ioctl does not require
> the NET_RAW capability?
>
>>> If you answered positively to my first question, please send a patch for
>>> that as well.
>> I didn't understand this, sorry.
> My first question was: "Would you then say that
> commit 9bda7e8c2130de9a3340ebd0e6cc1dedc2eae338 is incorrect?". Do you
> not understand that question or what I asked you to do in case the
> answer is "yes"?
I tried on host with systemd configure options and limiting
capabilities to
only CAP_NET_ADMIN and CAP_NET_BIND_SERVICE. ioctl call for
interface(bnepX)
up works well. Android throws an error("Permission denied").
CAP_NET_RAW is required
for android.
Thanks,
Ravi.
^ permalink raw reply
* [PATCH] android/bluetooth: Change discoverable mode only if connectable
From: Szymon Janc @ 2013-11-26 12:00 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
There is no need to sending set_discoverable command if new settings
are not connectable as clearing connectable also clear discoverable.
Sending set_discoverable when not connectable result in 'rejected'
mgmt response.
---
android/bluetooth.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/android/bluetooth.c b/android/bluetooth.c
index aa684bd..ffca084 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -1907,7 +1907,7 @@ static uint8_t set_scan_mode(void *buf, uint16_t len)
return HAL_STATUS_FAILED;
}
- if (cur_disc != disc) {
+ if (cur_disc != disc && conn) {
if (!set_discoverable(disc ? 0x01 : 0x00, 0))
return HAL_STATUS_FAILED;
}
--
1.8.3.2
^ permalink raw reply related
* Re: Intel 7260 bluetooth malfunction when it is connected to EHCI bus
From: Michal Labedzki @ 2013-11-26 9:11 UTC (permalink / raw)
To: Hui Wang
Cc: Stevie Trujillo, Marcel Holtmann, tedd.an,
linux-bluetooth@vger.kernel.org development
In-Reply-To: <CALkxMhEzw+mL5UtF=gZ8MQrWRM_2WEQQeq6jR1hvYiSZ=Mfi3g@mail.gmail.com>
Bug is now fixed in "svn path=3D/trunk/; revision=3D53525". You can wait
for next development (1.11.3) or stable (1.12), however you can build
Wireshark from sources (should be easy - like BlueZ: git clone
http://code.wireshark.org/git/wireshark; ./autogen; ./configure; make;
./wireshark) or via "private" sources like:
$ sudo add-apt-repository ppa:dreibh/ppa
$ sudo apt-get update
$ sudo apt-get install wireshark
On 8 November 2013 12:17, Michal Labedzki <michal.labedzki@tieto.com> wrote=
:
> Hello,
>
> Could you create a bug for Wireshark? (capture log are welcome)
> https://bugs.wireshark.org/bugzilla/buglist.cgi?resolution=3D---&query_fo=
rmat=3Dadvanced&list_id=3D11313
>
> I check and that is right. There are two commands shares the same
> code. "Setup Synchronous Connection" and "Accept Synchronous
> Connection Request". But second one should be different. I can fix
> that.
> Also I recommend to try latest development Wireshark - it is generally st=
able.
>
> On 8 November 2013 02:43, Hui Wang <hui.wang@canonical.com> wrote:
>> On 11/07/2013 06:07 PM, Stevie Trujillo wrote:
>>>
>>> On Thu, 07 Nov 2013 11:45:53 +0800
>>> Hui Wang <hui.wang@canonical.com> wrote:
>>>
>>>> Do you know any tools can decode the log generated by usbmon?
>>>
>>> Hmm, I never actually used the usbmon program. I did "modprobe usbmon",
>>> then Wireshark shows usbmon{1..4} (one for each bus) as an interface
>>> like eth0 for ethernet. http://wiki.wireshark.org/CaptureSetup/USB
>>>
>>> If it's difficult to compare two captures in Wireshark (I don't know an=
y
>>> other method than visual inspection), tshark (Wireshark's "command-line
>>> counter-part") is able to decode to stdout. Maybe one can run the diff
>>> program on that. The output seems a bit terse however.
>>>
>>> Please be aware: in my Wireshark (1.10.2) one of the of the SCO setup
>>> packets are decoded slightly wrong. It looks like Wireshark is missing
>>> a BDADDR in the beginning, so all the other fields get shifted.
>>>
>>>
>> Thanks for sharing this knowledge, i will have a try according to your
>> instructions.
>>
>> Regards,
>> Hui.
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-bluetoot=
h"
>> in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
>
> --
>
> Pozdrawiam / Best regards
> -------------------------------------------------------------------------=
------------------------------------
> Micha=C5=82 =C5=81ab=C4=99dzki, Software Engineer
> Tieto Corporation
>
> Product Development Services
>
> http://www.tieto.com / http://www.tieto.pl
> ---
> ASCII: Michal Labedzki
> location: Swobodna 1 Street, 50-088 Wroc=C5=82aw, Poland
> room: 5.01 (desk next to 5.08)
> ---
> Please note: The information contained in this message may be legally
> privileged and confidential and protected from disclosure. If the
> reader of this message is not the intended recipient, you are hereby
> notified that any unauthorised use, distribution or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, please notify us immediately by replying to
> the message and deleting it from your computer. Thank You.
> ---
> Please consider the environment before printing this e-mail.
> ---
> Tieto Poland sp=C3=B3=C5=82ka z ograniczon=C4=85 odpowiedzialno=C5=9Bci=
=C4=85 z siedzib=C4=85 w
> Szczecinie, ul. Malczewskiego 26. Zarejestrowana w S=C4=85dzie Rejonowym
> Szczecin-Centrum w Szczecinie, XIII Wydzia=C5=82 Gospodarczy Krajowego
> Rejestru S=C4=85dowego pod numerem 0000124858. NIP: 8542085557. REGON:
> 812023656. Kapita=C5=82 zak=C5=82adowy: 4 271500 PLN
--=20
Pozdrawiam / Best regards
---------------------------------------------------------------------------=
----------------------------------
Micha=C5=82 =C5=81ab=C4=99dzki, Software Engineer
Tieto Corporation
Product Development Services
http://www.tieto.com / http://www.tieto.pl
---
ASCII: Michal Labedzki
location: Swobodna 1 Street, 50-088 Wroc=C5=82aw, Poland
room: 5.01 (desk next to 5.08)
---
Please note: The information contained in this message may be legally
privileged and confidential and protected from disclosure. If the
reader of this message is not the intended recipient, you are hereby
notified that any unauthorised use, distribution or copying of this
communication is strictly prohibited. If you have received this
communication in error, please notify us immediately by replying to
the message and deleting it from your computer. Thank You.
---
Please consider the environment before printing this e-mail.
---
Tieto Poland sp=C3=B3=C5=82ka z ograniczon=C4=85 odpowiedzialno=C5=9Bci=C4=
=85 z siedzib=C4=85 w
Szczecinie, ul. Malczewskiego 26. Zarejestrowana w S=C4=85dzie Rejonowym
Szczecin-Centrum w Szczecinie, XIII Wydzia=C5=82 Gospodarczy Krajowego
Rejestru S=C4=85dowego pod numerem 0000124858. NIP: 8542085557. REGON:
812023656. Kapita=C5=82 zak=C5=82adowy: 4 271500 PLN
^ permalink raw reply
* [PATCH 13/13] input: Add support for handling sixaxis devices
From: Szymon Janc @ 2013-11-25 22:15 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1385417752-25664-1-git-send-email-szymon.janc@gmail.com>
This allows to handle incoming connection from unknown devices.
If device happens to be sixaxis input device is created after
SDP was queried and then connection is authorized.
---
profiles/input/server.c | 104 +++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 103 insertions(+), 1 deletion(-)
diff --git a/profiles/input/server.c b/profiles/input/server.c
index 21d4562..8a50d23 100644
--- a/profiles/input/server.c
+++ b/profiles/input/server.c
@@ -63,6 +63,100 @@ static int server_cmp(gconstpointer s, gconstpointer user_data)
return bacmp(&server->src, src);
}
+struct sixaxis_data {
+ GIOChannel *chan;
+ 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));
+
+ if (err < 0)
+ goto fail;
+
+ 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)
+ 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);
+
+ return;
+
+fail:
+ g_io_channel_shutdown(data->chan, TRUE, NULL);
+ g_io_channel_unref(data->chan);
+ g_free(data);
+}
+
+static void sixaxis_browse_sdp(const bdaddr_t *src, const bdaddr_t *dst,
+ GIOChannel *chan, uint16_t psm)
+{
+ 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;
+
+ data = g_new0(struct sixaxis_data, 1);
+ data->chan = g_io_channel_ref(chan);
+ data->psm = psm;
+
+ device_discover_services(device);
+ device_wait_for_svc_complete(device, sixaxis_sdp_cb, data);
+}
+
+static bool check_sixaxis(const bdaddr_t *src, const bdaddr_t *dst)
+{
+ struct btd_device *device;
+
+ device = btd_adapter_find_device(adapter_find(src), dst);
+ if (!device)
+ return false;
+
+ if (btd_device_get_vendor(device) != 0x054c)
+ return false;
+
+ if (btd_device_get_product(device) != 0x0268)
+ return false;
+
+ return true;
+}
+
static void connect_event_cb(GIOChannel *chan, GError *err, gpointer data)
{
uint16_t psm;
@@ -95,6 +189,11 @@ static void connect_event_cb(GIOChannel *chan, GError *err, gpointer data)
if (ret == 0)
return;
+ if (ret == -ENOENT && check_sixaxis(&src, &dst)) {
+ sixaxis_browse_sdp(&src, &dst, chan, psm);
+ return;
+ }
+
error("Refusing input device connect: %s (%d)", strerror(-ret), -ret);
/* Send unplug virtual cable to unknown devices */
@@ -129,6 +228,9 @@ static void auth_callback(DBusError *derr, void *user_data)
goto reject;
}
+ if (!input_device_exists(&src, &dst) && check_sixaxis(&src, &dst))
+ return;
+
if (!bt_io_accept(server->confirm, connect_event_cb, server,
NULL, &err)) {
error("bt_io_accept: %s", err->message);
@@ -175,7 +277,7 @@ static void confirm_event_cb(GIOChannel *chan, gpointer user_data)
goto drop;
}
- if (!input_device_exists(&src, &dst)) {
+ if (!input_device_exists(&src, &dst) && !check_sixaxis(&src, &dst)) {
error("Refusing connection from %s: unknown device", addr);
goto drop;
}
--
1.8.4.4
^ permalink raw reply related
* [PATCH 12/13] device: Add device_discover_services function
From: Szymon Janc @ 2013-11-25 22:15 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1385417752-25664-1-git-send-email-szymon.janc@gmail.com>
This will allow to query remote services from plugins for not yet
discovered devices.
---
src/device.c | 17 +++++++++++++++++
src/device.h | 2 ++
2 files changed, 19 insertions(+)
diff --git a/src/device.c b/src/device.c
index 4e952c5..847ffad 100644
--- a/src/device.c
+++ b/src/device.c
@@ -3524,6 +3524,23 @@ static int device_browse_sdp(struct btd_device *device, DBusMessage *msg)
return err;
}
+int device_discover_services(struct btd_device *device)
+{
+ int err;
+
+ if (device_is_bredr(device))
+ err = device_browse_sdp(device, NULL);
+ else
+ err = device_browse_primary(device, NULL);
+
+ if (err == 0 && device->discov_timer) {
+ g_source_remove(device->discov_timer);
+ device->discov_timer = 0;
+ }
+
+ return err;
+}
+
struct btd_adapter *device_get_adapter(struct btd_device *device)
{
if (!device)
diff --git a/src/device.h b/src/device.h
index a0d25fe..c3fea4a 100644
--- a/src/device.h
+++ b/src/device.h
@@ -131,5 +131,7 @@ bool device_remove_svc_complete_callback(struct btd_device *dev,
struct btd_service *btd_device_get_service(struct btd_device *dev,
const char *remote_uuid);
+int device_discover_services(struct btd_device *device);
+
void btd_device_init(void);
void btd_device_cleanup(void);
--
1.8.4.4
^ permalink raw reply related
* [PATCH 11/13] plugins/sixaxis: Add support for configuring new controllers
From: Szymon Janc @ 2013-11-25 22:15 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1385417752-25664-1-git-send-email-szymon.janc@gmail.com>
When new PS3 controller is detected provide it with default adapter
address. Also create new btd_device with proper PNP info if it wasn't
existing yet.
---
plugins/sixaxis.c | 179 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 178 insertions(+), 1 deletion(-)
diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c
index 7a5c6c2..86cfe82 100644
--- a/plugins/sixaxis.c
+++ b/plugins/sixaxis.c
@@ -29,19 +29,196 @@
#include <stddef.h>
#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <linux/hidraw.h>
+#include <linux/input.h>
#include <glib.h>
#include <libudev.h>
+#include "lib/bluetooth.h"
+#include "uuid.h"
+#include "adapter.h"
+#include "device.h"
#include "plugin.h"
#include "log.h"
+static const struct {
+ const char *name;
+ uint16_t source;
+ uint16_t vid;
+ uint16_t pid;
+ uint16_t version;
+} devices[] = {
+ {
+ .name = "PLAYSTATION(R)3 Controller",
+ .source = 0x0002,
+ .vid = 0x054c,
+ .pid = 0x0268,
+ .version = 0x0000,
+ },
+};
+
static struct udev *ctx = NULL;
static struct udev_monitor *monitor = NULL;
static guint watch_id = 0;
+static int get_device_bdaddr(int fd, bdaddr_t *bdaddr)
+{
+ uint8_t buf[18];
+ int ret;
+
+ memset(buf, 0, sizeof(buf));
+
+ buf[0] = 0xf2;
+
+ ret = ioctl(fd, HIDIOCGFEATURE(sizeof(buf)), buf);
+ if (ret < 0) {
+ error("sixaxis: failed to read device address (%s)",
+ strerror(errno));
+ return ret;
+ }
+
+ baswap(bdaddr, (bdaddr_t *) (buf + 4));
+
+ return 0;
+}
+
+static int get_master_bdaddr(int fd, bdaddr_t *bdaddr)
+{
+ uint8_t buf[8];
+ int ret;
+
+ memset(buf, 0, sizeof(buf));
+
+ buf[0] = 0xf5;
+
+ ret = ioctl(fd, HIDIOCGFEATURE(sizeof(buf)), buf);
+ if (ret < 0) {
+ error("sixaxis: failed to read master address (%s)",
+ strerror(errno));
+ return ret;
+ }
+
+ baswap(bdaddr, (bdaddr_t *) (buf + 2));
+
+ return 0;
+}
+
+static int set_master_bdaddr(int fd, const bdaddr_t *bdaddr)
+{
+ uint8_t buf[8];
+ int ret;
+
+ buf[0] = 0xf5;
+ buf[1] = 0x01;
+
+ baswap((bdaddr_t *) (buf + 2), bdaddr);
+
+ ret = ioctl(fd, HIDIOCSFEATURE(sizeof(buf)), buf);
+ if (ret < 0)
+ error("sixaxis: failed to write master address (%s)",
+ strerror(errno));
+
+ return ret;
+}
+
+static void setup_device(int fd, int index, struct btd_adapter *adapter)
+{
+ char device_addr[18], master_addr[18], adapter_addr[18];
+ bdaddr_t device_bdaddr, master_bdaddr;
+ const bdaddr_t *adapter_bdaddr;
+ struct btd_device *device;
+
+ if (get_device_bdaddr(fd, &device_bdaddr) < 0)
+ return;
+
+ if (get_master_bdaddr(fd, &master_bdaddr) < 0)
+ return;
+
+ adapter_bdaddr = btd_adapter_get_address(adapter);
+
+ if (bacmp(adapter_bdaddr, &master_bdaddr)) {
+ if (set_master_bdaddr(fd, adapter_bdaddr) < 0)
+ return;
+ }
+
+ ba2str(&device_bdaddr, device_addr);
+ ba2str(&master_bdaddr, master_addr);
+ ba2str(adapter_bdaddr, adapter_addr);
+ DBG("remote %s old_master %s new_master %s",
+ device_addr, master_addr, adapter_addr);
+
+ device = btd_adapter_get_device(adapter, &device_bdaddr, BDADDR_BREDR);
+
+ if (g_slist_find_custom(btd_device_get_uuids(device), HID_UUID,
+ (GCompareFunc)strcasecmp)) {
+ DBG("device %s already known, skipping", device_addr);
+ return;
+ }
+
+ info("sixaxis: setting up new device");
+
+ btd_device_device_set_name(device, devices[index].name);
+ 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);
+}
+
+static int get_supported_device(struct udev_device *udevice, uint16_t *bus)
+{
+ struct udev_device *hid_parent;
+ uint16_t vid, pid;
+ const char *hid_id;
+ int i;
+
+ hid_parent = udev_device_get_parent_with_subsystem_devtype(udevice,
+ "hid", NULL);
+ if (!hid_parent)
+ return -1;
+
+ hid_id = udev_device_get_property_value(hid_parent, "HID_ID");
+
+ if (sscanf(hid_id, "%hx:%hx:%hx", bus, &vid, &pid) != 3)
+ return -1;
+
+ for (i = 0; G_N_ELEMENTS(devices); i++) {
+ if (devices[i].vid == vid && devices[i].pid == pid)
+ return i;
+ }
+
+ return -1;
+}
+
static void device_added(struct udev_device *udevice)
{
- DBG("");
+ struct btd_adapter *adapter;
+ uint16_t bus;
+ int index;
+ int fd;
+
+ adapter = btd_adapter_get_default();
+ if (!adapter)
+ return;
+
+ index = get_supported_device(udevice, &bus);
+ if (index < 0)
+ return;
+
+ info("sixaxis: compatible device connected: %s (%04X:%04X)",
+ devices[index].name, devices[index].vid,
+ devices[index].pid);
+
+ fd = open(udev_device_get_devnode(udevice), O_RDWR);
+ if (fd < 0)
+ return;
+
+ if (bus == BUS_USB)
+ setup_device(fd, index, adapter);
+
+ close(fd);
}
static gboolean monitor_watch(GIOChannel *source, GIOCondition condition,
--
1.8.4.4
^ permalink raw reply related
* [PATCH 10/13] plugins/sixaxis: Add initial code for udev handling
From: Szymon Janc @ 2013-11-25 22:15 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1385417752-25664-1-git-send-email-szymon.janc@gmail.com>
When new device is added plugin will be notified about it.
---
plugins/sixaxis.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 63 insertions(+)
diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c
index bf66bef..7a5c6c2 100644
--- a/plugins/sixaxis.c
+++ b/plugins/sixaxis.c
@@ -27,19 +27,82 @@
#include <config.h>
#endif
+#include <stddef.h>
+#include <errno.h>
+#include <glib.h>
+#include <libudev.h>
+
#include "plugin.h"
#include "log.h"
+static struct udev *ctx = NULL;
+static struct udev_monitor *monitor = NULL;
+static guint watch_id = 0;
+
+static void device_added(struct udev_device *udevice)
+{
+ DBG("");
+}
+
+static gboolean monitor_watch(GIOChannel *source, GIOCondition condition,
+ gpointer data)
+{
+ struct udev_device *udevice;
+
+ udevice = udev_monitor_receive_device(monitor);
+ if (!udevice)
+ return TRUE;
+
+ if (!g_strcmp0(udev_device_get_action(udevice), "add"))
+ device_added(udevice);
+
+ udev_device_unref(udevice);
+
+ return TRUE;
+}
+
static int sixaxis_init(void)
{
+ GIOChannel *channel;
+
DBG("");
+ ctx = udev_new();
+ if (!ctx)
+ return -EIO;
+
+ monitor = udev_monitor_new_from_netlink(ctx, "udev");
+ if (!monitor) {
+ udev_unref(ctx);
+ ctx = NULL;
+
+ return -EIO;
+ }
+
+ /* Listen for newly connected hidraw interfaces */
+ udev_monitor_filter_add_match_subsystem_devtype(monitor, "hidraw",
+ NULL);
+ udev_monitor_enable_receiving(monitor);
+
+ channel = g_io_channel_unix_new(udev_monitor_get_fd(monitor));
+ watch_id = g_io_add_watch(channel, G_IO_IN, monitor_watch, NULL);
+ g_io_channel_unref(channel);
+
return 0;
}
static void sixaxis_exit(void)
{
DBG("");
+
+ g_source_remove(watch_id);
+ watch_id = 0;
+
+ udev_monitor_unref(monitor);
+ monitor = NULL;
+
+ udev_unref(ctx);
+ ctx = NULL;
}
BLUETOOTH_PLUGIN_DEFINE(sixaxis, VERSION, BLUETOOTH_PLUGIN_PRIORITY_LOW,
--
1.8.4.4
^ permalink raw reply related
* [PATCH 09/13] plugins: Add initial code for sixaxis plugin
From: Szymon Janc @ 2013-11-25 22:15 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1385417752-25664-1-git-send-email-szymon.janc@gmail.com>
This plugin will be used to associate PS3 controllers.
---
Makefile.plugins | 8 ++++++++
bootstrap-configure | 1 +
configure.ac | 5 +++++
plugins/sixaxis.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 60 insertions(+)
create mode 100644 plugins/sixaxis.c
diff --git a/Makefile.plugins b/Makefile.plugins
index 7c5f71d..f5025e9 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -110,3 +110,11 @@ builtin_sources += profiles/heartrate/heartrate.c
builtin_modules += cyclingspeed
builtin_sources += profiles/cyclingspeed/cyclingspeed.c
endif
+
+if SIXAXIS
+plugin_LTLIBRARIES += plugins/sixaxis.la
+plugins_sixaxis_la_SOURCES = plugins/sixaxis.c
+plugins_sixaxis_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
+ -no-undefined @UDEV_LIBS@
+plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden @UDEV_CFLAGS@
+endif
diff --git a/bootstrap-configure b/bootstrap-configure
index dc36311..c7f08ed 100755
--- a/bootstrap-configure
+++ b/bootstrap-configure
@@ -13,4 +13,5 @@ fi
--localstatedir=/var \
--enable-experimental \
--enable-android \
+ --enable-sixaxis \
--disable-datafiles $*
diff --git a/configure.ac b/configure.ac
index 949846e..ca226bb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -216,6 +216,11 @@ AC_ARG_ENABLE(experimental, AC_HELP_STRING([--enable-experimental],
[enable_experimental=${enableval}])
AM_CONDITIONAL(EXPERIMENTAL, test "${enable_experimental}" = "yes")
+AC_ARG_ENABLE(sixaxis, AC_HELP_STRING([--enable-sixaxis],
+ [enable sixaxis plugin]), [enable_sixaxis=${enableval}])
+AM_CONDITIONAL(SIXAXIS, test "${enable_sixaxis}" = "yes" &&
+ test "${enable_udev}" != "no")
+
if (test "${prefix}" = "NONE"); then
dnl no prefix and no localstatedir, so default to /var
if (test "$localstatedir" = '${prefix}/var'); then
diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c
new file mode 100644
index 0000000..bf66bef
--- /dev/null
+++ b/plugins/sixaxis.c
@@ -0,0 +1,46 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2009 Bastien Nocera <hadess@hadess.net>
+ * Copyright (C) 2011 Antonio Ospite <ospite@studenti.unina.it>
+ * Copyright (C) 2013 Szymon Janc <szymon.janc@gmail.com>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "plugin.h"
+#include "log.h"
+
+static int sixaxis_init(void)
+{
+ DBG("");
+
+ return 0;
+}
+
+static void sixaxis_exit(void)
+{
+ DBG("");
+}
+
+BLUETOOTH_PLUGIN_DEFINE(sixaxis, VERSION, BLUETOOTH_PLUGIN_PRIORITY_LOW,
+ sixaxis_init, sixaxis_exit)
--
1.8.4.4
^ permalink raw reply related
* [PATCH 08/13] Rename adapter_find_device to btd_adapter_find_device
From: Szymon Janc @ 2013-11-25 22:15 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1385417752-25664-1-git-send-email-szymon.janc@gmail.com>
Allow this symbol to be exported and usable from external plugins.
---
profiles/audio/avctp.c | 2 +-
profiles/audio/avdtp.c | 2 +-
profiles/input/device.c | 2 +-
src/adapter.c | 22 +++++++++++-----------
src/adapter.h | 2 +-
src/attrib-server.c | 2 +-
src/profile.c | 2 +-
7 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c
index 29fe763..4de981c 100644
--- a/profiles/audio/avctp.c
+++ b/profiles/audio/avctp.c
@@ -1371,7 +1371,7 @@ static void avctp_confirm_cb(GIOChannel *chan, gpointer data)
DBG("AVCTP: incoming connect from %s", address);
- device = adapter_find_device(adapter_find(&src), &dst);
+ device = btd_adapter_find_device(adapter_find(&src), &dst);
if (!device)
return;
diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index 9386c44..f866b39 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
@@ -2467,7 +2467,7 @@ static void avdtp_confirm_cb(GIOChannel *chan, gpointer data)
DBG("AVDTP: incoming connect from %s", address);
- device = adapter_find_device(adapter_find(&src), &dst);
+ device = btd_adapter_find_device(adapter_find(&src), &dst);
if (!device)
goto drop;
diff --git a/profiles/input/device.c b/profiles/input/device.c
index 71fe04a..0c2089b 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
@@ -880,7 +880,7 @@ static struct input_device *find_device(const bdaddr_t *src,
struct btd_device *device;
struct btd_service *service;
- device = adapter_find_device(adapter_find(src), dst);
+ device = btd_adapter_find_device(adapter_find(src), dst);
if (device == NULL)
return NULL;
diff --git a/src/adapter.c b/src/adapter.c
index a5a9ada..ea94753 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -690,7 +690,7 @@ int adapter_set_name(struct btd_adapter *adapter, const char *name)
return set_name(adapter, name);
}
-struct btd_device *adapter_find_device(struct btd_adapter *adapter,
+struct btd_device *btd_adapter_find_device(struct btd_adapter *adapter,
const bdaddr_t *dst)
{
struct btd_device *device;
@@ -1081,7 +1081,7 @@ struct btd_device *btd_adapter_get_device(struct btd_adapter *adapter,
if (!adapter)
return NULL;
- device = adapter_find_device(adapter, addr);
+ device = btd_adapter_find_device(adapter, addr);
if (device)
return device;
@@ -4424,7 +4424,7 @@ static int adapter_authorize(struct btd_adapter *adapter, const bdaddr_t *dst,
struct btd_device *device;
static guint id = 0;
- device = adapter_find_device(adapter, dst);
+ device = btd_adapter_find_device(adapter, dst);
if (!device)
return 0;
@@ -4630,7 +4630,7 @@ int btd_adapter_pincode_reply(struct btd_adapter *adapter,
/* Since a pincode was requested, update the starting time to
* the point where the pincode is provided. */
- device = adapter_find_device(adapter, bdaddr);
+ device = btd_adapter_find_device(adapter, bdaddr);
device_bonding_restart_timer(device);
id = mgmt_reply(adapter->mgmt, MGMT_OP_PIN_CODE_REPLY,
@@ -4964,7 +4964,7 @@ static void bonding_complete(struct btd_adapter *adapter,
if (status == 0)
device = btd_adapter_get_device(adapter, bdaddr, addr_type);
else
- device = adapter_find_device(adapter, bdaddr);
+ device = btd_adapter_find_device(adapter, bdaddr);
if (device != NULL)
device_bonding_complete(device, status);
@@ -4991,7 +4991,7 @@ static void bonding_attempt_complete(struct btd_adapter *adapter,
if (status == 0)
device = btd_adapter_get_device(adapter, bdaddr, addr_type);
else
- device = adapter_find_device(adapter, bdaddr);
+ device = btd_adapter_find_device(adapter, bdaddr);
if (status == MGMT_STATUS_AUTH_FAILED && adapter->pincode_requested) {
/* On faliure, issue a bonding_retry if possible. */
@@ -5150,7 +5150,7 @@ static void dev_disconnected(struct btd_adapter *adapter,
DBG("Device %s disconnected, reason %u", dst, reason);
- device = adapter_find_device(adapter, &addr->bdaddr);
+ device = btd_adapter_find_device(adapter, &addr->bdaddr);
if (device)
adapter_remove_connection(adapter, device);
@@ -5765,7 +5765,7 @@ static void device_blocked_callback(uint16_t index, uint16_t length,
ba2str(&ev->addr.bdaddr, addr);
DBG("hci%u %s blocked", index, addr);
- device = adapter_find_device(adapter, &ev->addr.bdaddr);
+ device = btd_adapter_find_device(adapter, &ev->addr.bdaddr);
if (device)
device_block(device, TRUE);
}
@@ -5786,7 +5786,7 @@ static void device_unblocked_callback(uint16_t index, uint16_t length,
ba2str(&ev->addr.bdaddr, addr);
DBG("hci%u %s unblocked", index, addr);
- device = adapter_find_device(adapter, &ev->addr.bdaddr);
+ device = btd_adapter_find_device(adapter, &ev->addr.bdaddr);
if (device)
device_unblock(device, FALSE, TRUE);
}
@@ -5808,7 +5808,7 @@ static void connect_failed_callback(uint16_t index, uint16_t length,
DBG("hci%u %s status %u", index, addr, ev->status);
- device = adapter_find_device(adapter, &ev->addr.bdaddr);
+ device = btd_adapter_find_device(adapter, &ev->addr.bdaddr);
if (device) {
/* If the device is in a bonding process cancel any auth request
* sent to the agent before proceeding, but keep the bonding
@@ -5854,7 +5854,7 @@ static void unpaired_callback(uint16_t index, uint16_t length,
DBG("hci%u addr %s", index, addr);
- device = adapter_find_device(adapter, &ev->addr.bdaddr);
+ device = btd_adapter_find_device(adapter, &ev->addr.bdaddr);
if (!device) {
warn("No device object for unpaired device %s", addr);
return;
diff --git a/src/adapter.h b/src/adapter.h
index e982243..de5b07d 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -95,7 +95,7 @@ struct btd_device *btd_adapter_get_device(struct btd_adapter *adapter,
uint8_t addr_type);
sdp_list_t *btd_adapter_get_services(struct btd_adapter *adapter);
-struct btd_device *adapter_find_device(struct btd_adapter *adapter,
+struct btd_device *btd_adapter_find_device(struct btd_adapter *adapter,
const bdaddr_t *dst);
const char *adapter_get_path(struct btd_adapter *adapter);
diff --git a/src/attrib-server.c b/src/attrib-server.c
index 9231b5b..a6f1066 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -1137,7 +1137,7 @@ guint attrib_channel_attach(GAttrib *attrib)
channel->server = server;
- device = adapter_find_device(server->adapter, &channel->dst);
+ device = btd_adapter_find_device(server->adapter, &channel->dst);
if (device == NULL) {
error("Device object not found for attrib server");
g_free(channel);
diff --git a/src/profile.c b/src/profile.c
index 97cb1bc..3c0d27c 100644
--- a/src/profile.c
+++ b/src/profile.c
@@ -1047,7 +1047,7 @@ static struct ext_io *create_conn(struct ext_io *server, GIOChannel *io,
GIOCondition cond;
char addr[18];
- device = adapter_find_device(server->adapter, dst);
+ device = btd_adapter_find_device(server->adapter, dst);
if (device == NULL) {
ba2str(dst, addr);
error("%s device %s not found", server->ext->name, addr);
--
1.8.4.4
^ permalink raw reply related
* [PATCH 07/13] Rename adapter_get_address to btd_adapter_get_address
From: Szymon Janc @ 2013-11-25 22:15 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1385417752-25664-1-git-send-email-szymon.janc@gmail.com>
Allow this symbol to be exported and usable from external plugins.
---
plugins/neard.c | 2 +-
plugins/wiimote.c | 2 +-
profiles/audio/avctp.c | 16 ++++++++++------
profiles/audio/avdtp.c | 9 ++++++---
profiles/health/hdp.c | 6 ++++--
profiles/health/hdp_util.c | 6 +++---
profiles/input/device.c | 2 +-
profiles/input/manager.c | 4 ++--
profiles/network/connection.c | 2 +-
profiles/network/server.c | 4 ++--
profiles/sap/server.c | 3 ++-
src/adapter.c | 6 +++---
src/adapter.h | 2 +-
src/attrib-server.c | 4 ++--
src/device.c | 31 ++++++++++++++++---------------
src/profile.c | 12 ++++++------
16 files changed, 61 insertions(+), 50 deletions(-)
diff --git a/plugins/neard.c b/plugins/neard.c
index 58689e6..35fdaeb 100644
--- a/plugins/neard.c
+++ b/plugins/neard.c
@@ -227,7 +227,7 @@ static DBusMessage *create_request_oob_reply(struct btd_adapter *adapter,
uint8_t *peir = eir;
int len;
- len = eir_create_oob(adapter_get_address(adapter),
+ len = eir_create_oob(btd_adapter_get_address(adapter),
btd_adapter_get_name(adapter),
btd_adapter_get_class(adapter), hash,
randomizer, main_opts.did_vendor,
diff --git a/plugins/wiimote.c b/plugins/wiimote.c
index 6cc21ee..96a6569 100644
--- a/plugins/wiimote.c
+++ b/plugins/wiimote.c
@@ -106,7 +106,7 @@ static ssize_t wii_pincb(struct btd_adapter *adapter, struct btd_device *device,
found:
DBG("Forcing fixed pin on detected wiimote %s", addr);
- memcpy(pinbuf, adapter_get_address(adapter), 6);
+ memcpy(pinbuf, btd_adapter_get_address(adapter), 6);
return 6;
}
diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c
index 476f61a..29fe763 100644
--- a/profiles/audio/avctp.c
+++ b/profiles/audio/avctp.c
@@ -1307,7 +1307,7 @@ static void avctp_control_confirm(struct avctp *session, GIOChannel *chan,
avctp_set_state(session, AVCTP_STATE_CONNECTING);
session->control = avctp_channel_create(session, chan, NULL);
- src = adapter_get_address(device_get_adapter(dev));
+ src = btd_adapter_get_address(device_get_adapter(dev));
dst = device_get_address(dev);
session->auth_id = btd_request_authorization(src, dst,
@@ -1422,7 +1422,7 @@ static GIOChannel *avctp_server_socket(const bdaddr_t *src, gboolean master,
int avctp_register(struct btd_adapter *adapter, gboolean master)
{
struct avctp_server *server;
- const bdaddr_t *src = adapter_get_address(adapter);
+ const bdaddr_t *src = btd_adapter_get_address(adapter);
server = g_new0(struct avctp_server, 1);
@@ -1937,6 +1937,7 @@ struct avctp *avctp_connect(struct btd_device *device)
struct avctp *session;
GError *err = NULL;
GIOChannel *io;
+ const bdaddr_t *src;
session = avctp_get_internal(device);
if (!session)
@@ -1947,9 +1948,10 @@ struct avctp *avctp_connect(struct btd_device *device)
avctp_set_state(session, AVCTP_STATE_CONNECTING);
+ src = btd_adapter_get_address(session->server->adapter);
+
io = bt_io_connect(avctp_connect_cb, session, NULL, &err,
- BT_IO_OPT_SOURCE_BDADDR,
- adapter_get_address(session->server->adapter),
+ BT_IO_OPT_SOURCE_BDADDR, src,
BT_IO_OPT_DEST_BDADDR,
device_get_address(session->device),
BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM,
@@ -1971,6 +1973,7 @@ struct avctp *avctp_connect(struct btd_device *device)
int avctp_connect_browsing(struct avctp *session)
{
+ const bdaddr_t *src;
GError *err = NULL;
GIOChannel *io;
@@ -1982,9 +1985,10 @@ int avctp_connect_browsing(struct avctp *session)
avctp_set_state(session, AVCTP_STATE_BROWSING_CONNECTING);
+ src = btd_adapter_get_address(session->server->adapter);
+
io = bt_io_connect(avctp_connect_browsing_cb, session, NULL, &err,
- BT_IO_OPT_SOURCE_BDADDR,
- adapter_get_address(session->server->adapter),
+ BT_IO_OPT_SOURCE_BDADDR, src,
BT_IO_OPT_DEST_BDADDR,
device_get_address(session->device),
BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM,
diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index b7a7d9c..9386c44 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
@@ -2523,11 +2523,13 @@ static GIOChannel *l2cap_connect(struct avdtp *session)
{
GError *err = NULL;
GIOChannel *io;
+ const bdaddr_t *src;
+
+ src = btd_adapter_get_address(session->server->adapter);
io = bt_io_connect(avdtp_connect_cb, session,
NULL, &err,
- BT_IO_OPT_SOURCE_BDADDR,
- adapter_get_address(session->server->adapter),
+ BT_IO_OPT_SOURCE_BDADDR, src,
BT_IO_OPT_DEST_BDADDR,
device_get_address(session->device),
BT_IO_OPT_PSM, AVDTP_PSM,
@@ -3675,7 +3677,8 @@ static struct avdtp_server *avdtp_server_init(struct btd_adapter *adapter)
server = g_new0(struct avdtp_server, 1);
- server->io = avdtp_server_socket(adapter_get_address(adapter), TRUE);
+ server->io = avdtp_server_socket(btd_adapter_get_address(adapter),
+ TRUE);
if (!server->io) {
g_free(server);
return NULL;
diff --git a/profiles/health/hdp.c b/profiles/health/hdp.c
index 86cebe6..6203fa8 100644
--- a/profiles/health/hdp.c
+++ b/profiles/health/hdp.c
@@ -1322,6 +1322,7 @@ static void release_adapter_instance(struct hdp_adapter *hdp_adapter)
static gboolean update_adapter(struct hdp_adapter *hdp_adapter)
{
GError *err = NULL;
+ const bdaddr_t *src;
if (applications == NULL) {
release_adapter_instance(hdp_adapter);
@@ -1331,8 +1332,9 @@ static gboolean update_adapter(struct hdp_adapter *hdp_adapter)
if (hdp_adapter->mi != NULL)
goto update;
- hdp_adapter->mi = mcap_create_instance(
- adapter_get_address(hdp_adapter->btd_adapter),
+ src = btd_adapter_get_address(hdp_adapter->btd_adapter);
+
+ hdp_adapter->mi = mcap_create_instance(src,
BT_IO_SEC_MEDIUM, 0, 0,
mcl_connected, mcl_reconnected,
mcl_disconnected, mcl_uncached,
diff --git a/profiles/health/hdp_util.c b/profiles/health/hdp_util.c
index 34e4671..7de87a8 100644
--- a/profiles/health/hdp_util.c
+++ b/profiles/health/hdp_util.c
@@ -853,7 +853,7 @@ gboolean hdp_get_mdep(struct hdp_device *device, struct hdp_application *app,
const bdaddr_t *dst;
uuid_t uuid;
- src = adapter_get_address(device_get_adapter(device->dev));
+ src = btd_adapter_get_address(device_get_adapter(device->dev));
dst = device_get_address(device->dev);
mdep_data = g_new0(struct get_mdep_data, 1);
@@ -1080,7 +1080,7 @@ gboolean hdp_establish_mcl(struct hdp_device *device,
const bdaddr_t *dst;
uuid_t uuid;
- src = adapter_get_address(device_get_adapter(device->dev));
+ src = btd_adapter_get_address(device_get_adapter(device->dev));
dst = device_get_address(device->dev);
conn_data = g_new0(struct conn_mcl_data, 1);
@@ -1151,7 +1151,7 @@ gboolean hdp_get_dcpsm(struct hdp_device *device, hdp_continue_dcpsm_f func,
const bdaddr_t *dst;
uuid_t uuid;
- src = adapter_get_address(device_get_adapter(device->dev));
+ src = btd_adapter_get_address(device_get_adapter(device->dev));
dst = device_get_address(device->dev);
dcpsm_data = g_new0(struct get_dcpsm_data, 1);
diff --git a/profiles/input/device.c b/profiles/input/device.c
index 6523161..71fe04a 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
@@ -812,7 +812,7 @@ static struct input_device *input_device_new(struct btd_service *service)
char name[HCI_MAX_NAME_LENGTH + 1];
idev = g_new0(struct input_device, 1);
- bacpy(&idev->src, adapter_get_address(adapter));
+ bacpy(&idev->src, btd_adapter_get_address(adapter));
bacpy(&idev->dst, device_get_address(device));
idev->service = btd_service_ref(service);
idev->device = btd_device_ref(device);
diff --git a/profiles/input/manager.c b/profiles/input/manager.c
index 689ccdd..660043e 100644
--- a/profiles/input/manager.c
+++ b/profiles/input/manager.c
@@ -46,13 +46,13 @@
static int hid_server_probe(struct btd_profile *p, struct btd_adapter *adapter)
{
- return server_start(adapter_get_address(adapter));
+ return server_start(btd_adapter_get_address(adapter));
}
static void hid_server_remove(struct btd_profile *p,
struct btd_adapter *adapter)
{
- server_stop(adapter_get_address(adapter));
+ server_stop(btd_adapter_get_address(adapter));
}
static struct btd_profile input_profile = {
diff --git a/profiles/network/connection.c b/profiles/network/connection.c
index 960a1fe..5966268 100644
--- a/profiles/network/connection.c
+++ b/profiles/network/connection.c
@@ -452,7 +452,7 @@ int connection_connect(struct btd_service *service)
if (nc->state != DISCONNECTED)
return -EALREADY;
- src = adapter_get_address(device_get_adapter(peer->device));
+ src = btd_adapter_get_address(device_get_adapter(peer->device));
dst = device_get_address(peer->device);
nc->io = bt_io_connect(connect_cb, nc,
diff --git a/profiles/network/server.c b/profiles/network/server.c
index 7b784e5..0050b30 100644
--- a/profiles/network/server.c
+++ b/profiles/network/server.c
@@ -765,7 +765,7 @@ static struct network_adapter *create_adapter(struct btd_adapter *adapter)
na->io = bt_io_listen(NULL, confirm_event, na,
NULL, &err,
BT_IO_OPT_SOURCE_BDADDR,
- adapter_get_address(adapter),
+ btd_adapter_get_address(adapter),
BT_IO_OPT_PSM, BNEP_PSM,
BT_IO_OPT_OMTU, BNEP_MTU,
BT_IO_OPT_IMTU, BNEP_MTU,
@@ -823,7 +823,7 @@ int server_register(struct btd_adapter *adapter, uint16_t id)
path);
done:
- bacpy(&ns->src, adapter_get_address(adapter));
+ bacpy(&ns->src, btd_adapter_get_address(adapter));
ns->id = id;
ns->na = na;
ns->record_id = 0;
diff --git a/profiles/sap/server.c b/profiles/sap/server.c
index 63314a7..119862d 100644
--- a/profiles/sap/server.c
+++ b/profiles/sap/server.c
@@ -1372,7 +1372,8 @@ int sap_server_register(struct btd_adapter *adapter)
io = bt_io_listen(NULL, connect_confirm_cb, server,
NULL, &gerr,
- BT_IO_OPT_SOURCE_BDADDR, adapter_get_address(adapter),
+ BT_IO_OPT_SOURCE_BDADDR,
+ btd_adapter_get_address(adapter),
BT_IO_OPT_CHANNEL, SAP_SERVER_CHANNEL,
BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_HIGH,
BT_IO_OPT_MASTER, TRUE,
diff --git a/src/adapter.c b/src/adapter.c
index ec15715..a5a9ada 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3991,7 +3991,7 @@ const char *adapter_get_path(struct btd_adapter *adapter)
return adapter->path;
}
-const bdaddr_t *adapter_get_address(struct btd_adapter *adapter)
+const bdaddr_t *btd_adapter_get_address(struct btd_adapter *adapter)
{
return &adapter->bdaddr;
}
@@ -5225,7 +5225,7 @@ static void store_link_key(struct btd_adapter *adapter,
char *str;
int i;
- ba2str(adapter_get_address(adapter), adapter_addr);
+ ba2str(btd_adapter_get_address(adapter), adapter_addr);
ba2str(device_get_address(device), device_addr);
snprintf(filename, PATH_MAX, STORAGEDIR "/%s/%s/info", adapter_addr,
@@ -5382,7 +5382,7 @@ static void new_long_term_key_callback(uint16_t index, uint16_t length,
if (ev->store_hint) {
const struct mgmt_ltk_info *key = &ev->key;
- const bdaddr_t *bdaddr = adapter_get_address(adapter);
+ const bdaddr_t *bdaddr = btd_adapter_get_address(adapter);
store_longtermkey(bdaddr, &key->addr.bdaddr,
key->addr.type, key->val, key->master,
diff --git a/src/adapter.h b/src/adapter.h
index 8a2ddae..e982243 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -99,7 +99,7 @@ struct btd_device *adapter_find_device(struct btd_adapter *adapter,
const bdaddr_t *dst);
const char *adapter_get_path(struct btd_adapter *adapter);
-const bdaddr_t *adapter_get_address(struct btd_adapter *adapter);
+const bdaddr_t *btd_adapter_get_address(struct btd_adapter *adapter);
int adapter_set_name(struct btd_adapter *adapter, const char *name);
int adapter_service_add(struct btd_adapter *adapter, sdp_record_t *rec);
diff --git a/src/attrib-server.c b/src/attrib-server.c
index 2861a00..9231b5b 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -156,7 +156,7 @@ static int adapter_cmp_addr(gconstpointer a, gconstpointer b)
const struct gatt_server *server = a;
const bdaddr_t *bdaddr = b;
- return bacmp(adapter_get_address(server->adapter), bdaddr);
+ return bacmp(btd_adapter_get_address(server->adapter), bdaddr);
}
static int adapter_cmp(gconstpointer a, gconstpointer b)
@@ -1310,7 +1310,7 @@ int btd_adapter_gatt_server_start(struct btd_adapter *adapter)
server = g_new0(struct gatt_server, 1);
server->adapter = btd_adapter_ref(adapter);
- addr = adapter_get_address(server->adapter);
+ addr = btd_adapter_get_address(server->adapter);
/* BR/EDR socket */
server->l2cap_io = bt_io_listen(connect_event, NULL, NULL, NULL, &gerr,
diff --git a/src/device.c b/src/device.c
index 4ff8a14..4e952c5 100644
--- a/src/device.c
+++ b/src/device.c
@@ -263,7 +263,7 @@ static gboolean store_device_info_cb(gpointer user_data)
device->store_id = 0;
- ba2str(adapter_get_address(device->adapter), adapter_addr);
+ ba2str(btd_adapter_get_address(device->adapter), adapter_addr);
ba2str(&device->bdaddr, device_addr);
snprintf(filename, PATH_MAX, STORAGEDIR "/%s/%s/info", adapter_addr,
device_addr);
@@ -409,7 +409,7 @@ void device_store_cached_name(struct btd_device *dev, const char *name)
return;
}
- ba2str(adapter_get_address(dev->adapter), s_addr);
+ ba2str(btd_adapter_get_address(dev->adapter), s_addr);
ba2str(&dev->bdaddr, d_addr);
snprintf(filename, PATH_MAX, STORAGEDIR "/%s/cache/%s", s_addr, d_addr);
filename[PATH_MAX] = '\0';
@@ -470,7 +470,7 @@ static void browse_request_cancel(struct browse_req *req)
struct btd_device *device = req->device;
struct btd_adapter *adapter = device->adapter;
- bt_cancel_discovery(adapter_get_address(adapter), &device->bdaddr);
+ bt_cancel_discovery(btd_adapter_get_address(adapter), &device->bdaddr);
attio_cleanup(device);
@@ -2183,7 +2183,7 @@ struct btd_device *device_create_from_storage(struct btd_adapter *adapter,
if (device == NULL)
return NULL;
- src = adapter_get_address(adapter);
+ src = btd_adapter_get_address(adapter);
ba2str(src, srcaddr);
load_info(device, srcaddr, address, key_file);
@@ -2208,7 +2208,7 @@ struct btd_device *device_create(struct btd_adapter *adapter,
return NULL;
device->bdaddr_type = bdaddr_type;
- sba = adapter_get_address(adapter);
+ sba = btd_adapter_get_address(adapter);
ba2str(sba, src);
str = load_cached_name(device, src, dst);
@@ -2231,7 +2231,7 @@ char *btd_device_get_storage_path(struct btd_device *device,
return NULL;
}
- ba2str(adapter_get_address(device->adapter), srcaddr);
+ ba2str(btd_adapter_get_address(device->adapter), srcaddr);
ba2str(&device->bdaddr, dstaddr);
if (!filename)
@@ -2342,7 +2342,7 @@ static void delete_folder_tree(const char *dirname)
static void device_remove_stored(struct btd_device *device)
{
- const bdaddr_t *src = adapter_get_address(device->adapter);
+ const bdaddr_t *src = btd_adapter_get_address(device->adapter);
uint8_t dst_type = device->bdaddr_type;
char adapter_addr[18];
char device_addr[18];
@@ -2717,7 +2717,7 @@ static void update_bredr_services(struct browse_req *req, sdp_list_t *recs)
char *data;
gsize length = 0;
- ba2str(adapter_get_address(device->adapter), srcaddr);
+ ba2str(btd_adapter_get_address(device->adapter), srcaddr);
ba2str(&device->bdaddr, dstaddr);
if (!device->temporary) {
@@ -2961,7 +2961,7 @@ static void browse_cb(sdp_list_t *recs, int err, gpointer user_data)
/* Search for mandatory uuids */
if (uuid_list[req->search_uuid]) {
sdp_uuid16_create(&uuid, uuid_list[req->search_uuid++]);
- bt_search_service(adapter_get_address(adapter),
+ bt_search_service(btd_adapter_get_address(adapter),
&device->bdaddr, &uuid,
browse_cb, user_data, NULL);
return;
@@ -2994,7 +2994,7 @@ static void store_services(struct btd_device *device)
if (prim_uuid == NULL)
return;
- ba2str(adapter_get_address(adapter), src_addr);
+ ba2str(btd_adapter_get_address(adapter), src_addr);
ba2str(&device->bdaddr, dst_addr);
snprintf(filename, PATH_MAX, STORAGEDIR "/%s/%s/attributes", src_addr,
@@ -3370,7 +3370,8 @@ int device_connect_le(struct btd_device *dev)
* pairing finishes
*/
io = bt_io_connect(att_connect_cb, attcb, NULL, &gerr,
- BT_IO_OPT_SOURCE_BDADDR, adapter_get_address(adapter),
+ BT_IO_OPT_SOURCE_BDADDR,
+ btd_adapter_get_address(adapter),
BT_IO_OPT_SOURCE_TYPE, BDADDR_LE_PUBLIC,
BT_IO_OPT_DEST_BDADDR, &dev->bdaddr,
BT_IO_OPT_DEST_TYPE, dev->bdaddr_type,
@@ -3453,7 +3454,7 @@ static int device_browse_primary(struct btd_device *device, DBusMessage *msg)
device->att_io = bt_io_connect(att_connect_cb,
attcb, NULL, NULL,
BT_IO_OPT_SOURCE_BDADDR,
- adapter_get_address(adapter),
+ btd_adapter_get_address(adapter),
BT_IO_OPT_SOURCE_TYPE, BDADDR_LE_PUBLIC,
BT_IO_OPT_DEST_BDADDR, &device->bdaddr,
BT_IO_OPT_DEST_TYPE, device->bdaddr_type,
@@ -3499,8 +3500,8 @@ static int device_browse_sdp(struct btd_device *device, DBusMessage *msg)
req->device = device;
sdp_uuid16_create(&uuid, uuid_list[req->search_uuid++]);
- err = bt_search_service(adapter_get_address(adapter), &device->bdaddr,
- &uuid, browse_cb, req, NULL);
+ err = bt_search_service(btd_adapter_get_address(adapter),
+ &device->bdaddr, &uuid, browse_cb, req, NULL);
if (err < 0) {
browse_request_free(req);
return err;
@@ -4280,7 +4281,7 @@ static sdp_list_t *read_device_records(struct btd_device *device)
sdp_list_t *recs = NULL;
sdp_record_t *rec;
- ba2str(adapter_get_address(device->adapter), local);
+ ba2str(btd_adapter_get_address(device->adapter), local);
ba2str(&device->bdaddr, peer);
snprintf(filename, PATH_MAX, STORAGEDIR "/%s/cache/%s", local, peer);
diff --git a/src/profile.c b/src/profile.c
index baadd99..97cb1bc 100644
--- a/src/profile.c
+++ b/src/profile.c
@@ -718,7 +718,7 @@ static void ext_io_destroy(gpointer p)
}
if (ext_io->resolving)
- bt_cancel_discovery(adapter_get_address(ext_io->adapter),
+ bt_cancel_discovery(btd_adapter_get_address(ext_io->adapter),
device_get_address(ext_io->device));
if (ext_io->adapter)
@@ -1257,7 +1257,7 @@ static uint32_t ext_start_servers(struct ext_profile *ext,
io = bt_io_listen(connect, confirm, l2cap, NULL, &err,
BT_IO_OPT_SOURCE_BDADDR,
- adapter_get_address(adapter),
+ btd_adapter_get_address(adapter),
BT_IO_OPT_MODE, ext->mode,
BT_IO_OPT_PSM, psm,
BT_IO_OPT_SEC_LEVEL, ext->sec_level,
@@ -1295,7 +1295,7 @@ static uint32_t ext_start_servers(struct ext_profile *ext,
io = bt_io_listen(connect, confirm, rfcomm, NULL, &err,
BT_IO_OPT_SOURCE_BDADDR,
- adapter_get_address(adapter),
+ btd_adapter_get_address(adapter),
BT_IO_OPT_CHANNEL, chan,
BT_IO_OPT_SEC_LEVEL, ext->sec_level,
BT_IO_OPT_INVALID);
@@ -1580,7 +1580,7 @@ static void record_cb(sdp_list_t *recs, int err, gpointer user_data)
goto failed;
}
- err = connect_io(conn, adapter_get_address(conn->adapter),
+ err = connect_io(conn, btd_adapter_get_address(conn->adapter),
device_get_address(conn->device));
if (err < 0) {
error("Connecting %s failed: %s", ext->name, strerror(-err));
@@ -1637,10 +1637,10 @@ static int ext_connect_dev(struct btd_service *service)
if (ext->remote_psm || ext->remote_chan) {
conn->psm = ext->remote_psm;
conn->chan = ext->remote_chan;
- err = connect_io(conn, adapter_get_address(adapter),
+ err = connect_io(conn, btd_adapter_get_address(adapter),
device_get_address(dev));
} else {
- err = resolve_service(conn, adapter_get_address(adapter),
+ err = resolve_service(conn, btd_adapter_get_address(adapter),
device_get_address(dev));
}
--
1.8.4.4
^ permalink raw reply related
* [PATCH 06/13] Rename device_get_uuids to btd_device_get_uuids
From: Szymon Janc @ 2013-11-25 22:15 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1385417752-25664-1-git-send-email-szymon.janc@gmail.com>
Allow this symbol to be exported and usable from external plugins.
---
src/adapter.c | 2 +-
src/device.c | 2 +-
src/device.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index 9600803..ec15715 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2537,7 +2537,7 @@ static void load_devices(struct btd_adapter *adapter)
/* TODO: register services from pre-loaded list of primaries */
- list = device_get_uuids(device);
+ list = btd_device_get_uuids(device);
if (list)
device_probe_profiles(device, list);
diff --git a/src/device.c b/src/device.c
index 58f24bf..4ff8a14 100644
--- a/src/device.c
+++ b/src/device.c
@@ -2474,7 +2474,7 @@ static gboolean record_has_uuid(const sdp_record_t *rec,
return FALSE;
}
-GSList *device_get_uuids(struct btd_device *device)
+GSList *btd_device_get_uuids(struct btd_device *device)
{
return device->uuids;
}
diff --git a/src/device.h b/src/device.h
index 44bee3e..a0d25fe 100644
--- a/src/device.h
+++ b/src/device.h
@@ -46,7 +46,7 @@ uint16_t btd_device_get_version(struct btd_device *device);
void device_remove(struct btd_device *device, gboolean remove_stored);
int device_address_cmp(gconstpointer a, gconstpointer b);
int device_bdaddr_cmp(gconstpointer a, gconstpointer b);
-GSList *device_get_uuids(struct btd_device *device);
+GSList *btd_device_get_uuids(struct btd_device *device);
void device_probe_profiles(struct btd_device *device, GSList *profiles);
const sdp_record_t *btd_device_get_record(struct btd_device *device,
const char *uuid);
--
1.8.4.4
^ permalink raw reply related
* [PATCH 05/13] Rename device_device_set_name to btd_device_device_set_name
From: Szymon Janc @ 2013-11-25 22:15 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1385417752-25664-1-git-send-email-szymon.janc@gmail.com>
Allow this symbol to be exported and usable from external plugins.
---
plugins/neard.c | 2 +-
src/adapter.c | 4 ++--
src/device.c | 2 +-
src/device.h | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/plugins/neard.c b/plugins/neard.c
index 073abec..58689e6 100644
--- a/plugins/neard.c
+++ b/plugins/neard.c
@@ -640,7 +640,7 @@ static void store_params(struct btd_adapter *adapter, struct btd_device *device,
if (params->name) {
device_store_cached_name(device, params->name);
- device_set_name(device, params->name);
+ btd_device_device_set_name(device, params->name);
}
/* TODO handle UUIDs? */
diff --git a/src/adapter.c b/src/adapter.c
index ccd3c43..9600803 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -4152,7 +4152,7 @@ static void update_found_devices(struct btd_adapter *adapter,
name_known = device_name_known(dev);
if (eir_data.name && (eir_data.name_complete || !name_known))
- device_set_name(dev, eir_data.name);
+ btd_device_device_set_name(dev, eir_data.name);
if (eir_data.class != 0)
device_set_class(dev, eir_data.class);
@@ -5743,7 +5743,7 @@ static void connected_callback(uint16_t index, uint16_t length,
if (eir_data.name != NULL) {
device_store_cached_name(device, eir_data.name);
- device_set_name(device, eir_data.name);
+ btd_device_device_set_name(device, eir_data.name);
}
eir_data_free(&eir_data);
diff --git a/src/device.c b/src/device.c
index e652329..58f24bf 100644
--- a/src/device.c
+++ b/src/device.c
@@ -2241,7 +2241,7 @@ char *btd_device_get_storage_path(struct btd_device *device,
filename);
}
-void device_set_name(struct btd_device *device, const char *name)
+void btd_device_device_set_name(struct btd_device *device, const char *name)
{
if (strncmp(name, device->name, MAX_NAME_LENGTH) == 0)
return;
diff --git a/src/device.h b/src/device.h
index f7e7bdc..44bee3e 100644
--- a/src/device.h
+++ b/src/device.h
@@ -33,7 +33,7 @@ struct btd_device *device_create_from_storage(struct btd_adapter *adapter,
char *btd_device_get_storage_path(struct btd_device *device,
const char *filename);
-void device_set_name(struct btd_device *device, const char *name);
+void btd_device_device_set_name(struct btd_device *device, const char *name);
void device_store_cached_name(struct btd_device *dev, const char *name);
void device_get_name(struct btd_device *device, char *name, size_t len);
bool device_name_known(struct btd_device *device);
--
1.8.4.4
^ permalink raw reply related
* [PATCH 04/13] Rename device_set_trusted to btd_device_set_trusted
From: Szymon Janc @ 2013-11-25 22:15 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1385417752-25664-1-git-send-email-szymon.janc@gmail.com>
Allow this symbol to be exported and usable from external plugins.
---
src/device.c | 4 ++--
src/device.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/device.c b/src/device.c
index 59e65b9..e652329 100644
--- a/src/device.c
+++ b/src/device.c
@@ -809,7 +809,7 @@ static void set_trust(GDBusPendingPropertySet id, gboolean value, void *data)
{
struct btd_device *device = data;
- device_set_trusted(device, value);
+ btd_device_set_trusted(device, value);
g_dbus_pending_property_success(id);
}
@@ -3565,7 +3565,7 @@ void btd_device_set_temporary(struct btd_device *device, gboolean temporary)
device->temporary = temporary;
}
-void device_set_trusted(struct btd_device *device, gboolean trusted)
+void btd_device_set_trusted(struct btd_device *device, gboolean trusted)
{
if (!device)
return;
diff --git a/src/device.h b/src/device.h
index 35d2a75..f7e7bdc 100644
--- a/src/device.h
+++ b/src/device.h
@@ -70,7 +70,7 @@ gboolean device_is_bonded(struct btd_device *device);
gboolean device_is_trusted(struct btd_device *device);
void device_set_paired(struct btd_device *device, gboolean paired);
void btd_device_set_temporary(struct btd_device *device, gboolean temporary);
-void device_set_trusted(struct btd_device *device, gboolean trusted);
+void btd_device_set_trusted(struct btd_device *device, gboolean trusted);
void device_set_bonded(struct btd_device *device, gboolean bonded);
void device_set_legacy(struct btd_device *device, bool legacy);
void device_set_rssi(struct btd_device *device, int8_t rssi);
--
1.8.4.4
^ permalink raw reply related
* [PATCH 03/13] Rename device_set_temporary to btd_device_set_temporary
From: Szymon Janc @ 2013-11-25 22:15 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1385417752-25664-1-git-send-email-szymon.janc@gmail.com>
Allow this symbol to be exported and usable from external plugins.
---
src/adapter.c | 12 ++++++------
src/device.c | 14 +++++++-------
src/device.h | 2 +-
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index 8a6dadf..ccd3c43 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1012,7 +1012,7 @@ static struct btd_device *adapter_create_device(struct btd_adapter *adapter,
if (!device)
return NULL;
- device_set_temporary(device, TRUE);
+ btd_device_set_temporary(device, TRUE);
adapter->devices = g_slist_append(adapter->devices, device);
@@ -2156,7 +2156,7 @@ static DBusMessage *remove_device(DBusConnection *conn,
device = list->data;
- device_set_temporary(device, TRUE);
+ btd_device_set_temporary(device, TRUE);
if (!device_is_connected(device)) {
adapter_remove_device(adapter, device);
@@ -2532,7 +2532,7 @@ static void load_devices(struct btd_adapter *adapter)
if (!device)
goto free;
- device_set_temporary(device, FALSE);
+ btd_device_set_temporary(device, FALSE);
adapter->devices = g_slist_append(adapter->devices, device);
/* TODO: register services from pre-loaded list of primaries */
@@ -5294,7 +5294,7 @@ static void new_link_key_callback(uint16_t index, uint16_t length,
device_set_bonded(device, TRUE);
if (device_is_temporary(device))
- device_set_temporary(device, FALSE);
+ btd_device_set_temporary(device, FALSE);
}
bonding_complete(adapter, &addr->bdaddr, addr->type, 0);
@@ -5392,7 +5392,7 @@ static void new_long_term_key_callback(uint16_t index, uint16_t length,
device_set_bonded(device, TRUE);
if (device_is_temporary(device))
- device_set_temporary(device, FALSE);
+ btd_device_set_temporary(device, FALSE);
}
if (ev->key.master)
@@ -5860,7 +5860,7 @@ static void unpaired_callback(uint16_t index, uint16_t length,
return;
}
- device_set_temporary(device, TRUE);
+ btd_device_set_temporary(device, TRUE);
if (device_is_connected(device))
device_request_disconnect(device, NULL);
diff --git a/src/device.c b/src/device.c
index c0e317d..59e65b9 100644
--- a/src/device.c
+++ b/src/device.c
@@ -997,7 +997,7 @@ int device_block(struct btd_device *device, gboolean update_only)
store_device_info(device);
- device_set_temporary(device, FALSE);
+ btd_device_set_temporary(device, FALSE);
g_dbus_emit_property_changed(dbus_conn, device->path,
DEVICE_INTERFACE, "Blocked");
@@ -1152,7 +1152,7 @@ static void device_profile_connected(struct btd_device *dev,
DBG("%s %s (%d)", profile->name, strerror(-err), -err);
if (!err)
- device_set_temporary(dev, FALSE);
+ btd_device_set_temporary(dev, FALSE);
if (dev->pending == NULL)
return;
@@ -1308,7 +1308,7 @@ static DBusMessage *connect_profiles(struct btd_device *dev, DBusMessage *msg,
if (!btd_adapter_get_powered(dev->adapter))
return btd_error_not_ready(msg);
- device_set_temporary(dev, FALSE);
+ btd_device_set_temporary(dev, FALSE);
if (!dev->svc_resolved)
goto resolve_services;
@@ -1358,7 +1358,7 @@ static DBusMessage *dev_connect(DBusConnection *conn, DBusMessage *msg,
if (device_is_connected(dev))
return dbus_message_new_method_return(msg);
- device_set_temporary(dev, FALSE);
+ btd_device_set_temporary(dev, FALSE);
dev->disable_auto_connect = FALSE;
@@ -1609,7 +1609,7 @@ static DBusMessage *pair_device(DBusConnection *conn, DBusMessage *msg,
uint8_t io_cap;
int err;
- device_set_temporary(device, FALSE);
+ btd_device_set_temporary(device, FALSE);
if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_INVALID))
return btd_error_invalid_args(msg);
@@ -3112,7 +3112,7 @@ static void register_all_services(struct browse_req *req, GSList *services)
{
struct btd_device *device = req->device;
- device_set_temporary(device, FALSE);
+ btd_device_set_temporary(device, FALSE);
update_gatt_services(req, device->primaries, services);
g_slist_free_full(device->primaries, g_free);
@@ -3549,7 +3549,7 @@ gboolean device_is_temporary(struct btd_device *device)
return device->temporary;
}
-void device_set_temporary(struct btd_device *device, gboolean temporary)
+void btd_device_set_temporary(struct btd_device *device, gboolean temporary)
{
if (!device)
return;
diff --git a/src/device.h b/src/device.h
index deec8d0..35d2a75 100644
--- a/src/device.h
+++ b/src/device.h
@@ -69,7 +69,7 @@ gboolean device_is_paired(struct btd_device *device);
gboolean device_is_bonded(struct btd_device *device);
gboolean device_is_trusted(struct btd_device *device);
void device_set_paired(struct btd_device *device, gboolean paired);
-void device_set_temporary(struct btd_device *device, gboolean temporary);
+void btd_device_set_temporary(struct btd_device *device, gboolean temporary);
void device_set_trusted(struct btd_device *device, gboolean trusted);
void device_set_bonded(struct btd_device *device, gboolean bonded);
void device_set_legacy(struct btd_device *device, bool legacy);
--
1.8.4.4
^ permalink raw reply related
* [PATCH 02/13] Rename adapter_get_device to btd_adapter_get_device
From: Szymon Janc @ 2013-11-25 22:15 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1385417752-25664-1-git-send-email-szymon.janc@gmail.com>
Allow this symbol to be exported and usable from external plugins.
---
plugins/neard.c | 6 ++++--
profiles/health/hdp.c | 4 ++--
src/adapter.c | 28 +++++++++++++++++-----------
src/adapter.h | 2 +-
4 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/plugins/neard.c b/plugins/neard.c
index ea91c4d..073abec 100644
--- a/plugins/neard.c
+++ b/plugins/neard.c
@@ -701,7 +701,8 @@ static DBusMessage *push_oob(DBusConnection *conn, DBusMessage *msg, void *data)
return error_reply(msg, EINVAL);
}
- device = adapter_get_device(adapter, &remote.address, BDADDR_BREDR);
+ device = btd_adapter_get_device(adapter, &remote.address,
+ BDADDR_BREDR);
err = check_device(device);
if (err < 0) {
@@ -769,7 +770,8 @@ static DBusMessage *request_oob(DBusConnection *conn, DBusMessage *msg,
if (bacmp(&remote.address, BDADDR_ANY) == 0)
goto read_local;
- device = adapter_get_device(adapter, &remote.address, BDADDR_BREDR);
+ device = btd_adapter_get_device(adapter, &remote.address,
+ BDADDR_BREDR);
err = check_device(device);
if (err < 0) {
diff --git a/profiles/health/hdp.c b/profiles/health/hdp.c
index 7b4e799..86cebe6 100644
--- a/profiles/health/hdp.c
+++ b/profiles/health/hdp.c
@@ -1205,8 +1205,8 @@ static void mcl_connected(struct mcap_mcl *mcl, gpointer data)
struct hdp_adapter *hdp_adapter = data;
struct btd_device *device;
- device = adapter_get_device(hdp_adapter->btd_adapter, &addr,
- BDADDR_BREDR);
+ device = btd_adapter_get_device(hdp_adapter->btd_adapter,
+ &addr, BDADDR_BREDR);
if (!device)
return;
hdp_device = create_health_device(device);
diff --git a/src/adapter.c b/src/adapter.c
index d904a56..8a6dadf 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1072,7 +1072,7 @@ static void adapter_remove_device(struct btd_adapter *adapter,
device_remove(dev, TRUE);
}
-struct btd_device *adapter_get_device(struct btd_adapter *adapter,
+struct btd_device *btd_adapter_get_device(struct btd_adapter *adapter,
const bdaddr_t *addr,
uint8_t addr_type)
{
@@ -2726,7 +2726,8 @@ static void get_connections_complete(uint8_t status, uint16_t length,
ba2str(&addr->bdaddr, address);
DBG("Adding existing connection to %s", address);
- device = adapter_get_device(adapter, &addr->bdaddr, addr->type);
+ device = btd_adapter_get_device(adapter, &addr->bdaddr,
+ addr->type);
if (device)
adapter_add_connection(adapter, device);
}
@@ -4687,7 +4688,8 @@ static void user_confirm_request_callback(uint16_t index, uint16_t length,
ba2str(&ev->addr.bdaddr, addr);
DBG("hci%u %s confirm_hint %u", adapter->dev_id, addr,
ev->confirm_hint);
- device = adapter_get_device(adapter, &ev->addr.bdaddr, ev->addr.type);
+ device = btd_adapter_get_device(adapter, &ev->addr.bdaddr,
+ ev->addr.type);
if (!device) {
error("Unable to get device object for %s", addr);
return;
@@ -4758,7 +4760,8 @@ static void user_passkey_request_callback(uint16_t index, uint16_t length,
ba2str(&ev->addr.bdaddr, addr);
DBG("hci%u %s", index, addr);
- device = adapter_get_device(adapter, &ev->addr.bdaddr, ev->addr.type);
+ device = btd_adapter_get_device(adapter, &ev->addr.bdaddr,
+ ev->addr.type);
if (!device) {
error("Unable to get device object for %s", addr);
return;
@@ -4790,7 +4793,8 @@ static void user_passkey_notify_callback(uint16_t index, uint16_t length,
ba2str(&ev->addr.bdaddr, addr);
DBG("hci%u %s", index, addr);
- device = adapter_get_device(adapter, &ev->addr.bdaddr, ev->addr.type);
+ device = btd_adapter_get_device(adapter, &ev->addr.bdaddr,
+ ev->addr.type);
if (!device) {
error("Unable to get device object for %s", addr);
return;
@@ -4872,7 +4876,8 @@ static void pin_code_request_callback(uint16_t index, uint16_t length,
DBG("hci%u %s", adapter->dev_id, addr);
- device = adapter_get_device(adapter, &ev->addr.bdaddr, ev->addr.type);
+ device = btd_adapter_get_device(adapter, &ev->addr.bdaddr,
+ ev->addr.type);
if (!device) {
error("Unable to get device object for %s", addr);
return;
@@ -4957,7 +4962,7 @@ static void bonding_complete(struct btd_adapter *adapter,
struct btd_device *device;
if (status == 0)
- device = adapter_get_device(adapter, bdaddr, addr_type);
+ device = btd_adapter_get_device(adapter, bdaddr, addr_type);
else
device = adapter_find_device(adapter, bdaddr);
@@ -4984,7 +4989,7 @@ static void bonding_attempt_complete(struct btd_adapter *adapter,
addr_type, status);
if (status == 0)
- device = adapter_get_device(adapter, bdaddr, addr_type);
+ device = btd_adapter_get_device(adapter, bdaddr, addr_type);
else
device = adapter_find_device(adapter, bdaddr);
@@ -5274,7 +5279,7 @@ static void new_link_key_callback(uint16_t index, uint16_t length,
return;
}
- device = adapter_get_device(adapter, &addr->bdaddr, addr->type);
+ device = btd_adapter_get_device(adapter, &addr->bdaddr, addr->type);
if (!device) {
error("Unable to get device object for %s", dst);
return;
@@ -5369,7 +5374,7 @@ static void new_long_term_key_callback(uint16_t index, uint16_t length,
DBG("hci%u new LTK for %s authenticated %u enc_size %u",
adapter->dev_id, dst, ev->key.authenticated, ev->key.enc_size);
- device = adapter_get_device(adapter, &addr->bdaddr, addr->type);
+ device = btd_adapter_get_device(adapter, &addr->bdaddr, addr->type);
if (!device) {
error("Unable to get device object for %s", dst);
return;
@@ -5720,7 +5725,8 @@ static void connected_callback(uint16_t index, uint16_t length,
DBG("hci%u device %s connected eir_len %u", index, addr, eir_len);
- device = adapter_get_device(adapter, &ev->addr.bdaddr, ev->addr.type);
+ device = btd_adapter_get_device(adapter, &ev->addr.bdaddr,
+ ev->addr.type);
if (!device) {
error("Unable to get device object for %s", addr);
return;
diff --git a/src/adapter.h b/src/adapter.h
index 80c5f77..8a2ddae 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -90,7 +90,7 @@ bool btd_adapter_get_connectable(struct btd_adapter *adapter);
uint32_t btd_adapter_get_class(struct btd_adapter *adapter);
const char *btd_adapter_get_name(struct btd_adapter *adapter);
-struct btd_device *adapter_get_device(struct btd_adapter *adapter,
+struct btd_device *btd_adapter_get_device(struct btd_adapter *adapter,
const bdaddr_t *addr,
uint8_t addr_type);
sdp_list_t *btd_adapter_get_services(struct btd_adapter *adapter);
--
1.8.4.4
^ permalink raw reply related
* [PATCH 01/13] core: Export some symbols from libbluetooth
From: Szymon Janc @ 2013-11-25 22:15 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1385417752-25664-1-git-send-email-szymon.janc@gmail.com>
Those are commonly used and should be available for external plugins.
---
src/bluetooth.ver | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/bluetooth.ver b/src/bluetooth.ver
index b71c70d..214fa8a 100644
--- a/src/bluetooth.ver
+++ b/src/bluetooth.ver
@@ -5,6 +5,8 @@
info;
error;
debug;
+ baswap;
+ ba2str;
local:
*;
};
--
1.8.4.4
^ permalink raw reply related
* [PATCH 00/13] sixaxis support
From: Szymon Janc @ 2013-11-25 22:15 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
Hi All,
This is yet another attempt to get PS3 controller support into BlueZ upstream.
I based my work on Fedora out-of-tree patch (hence copyright info) and tried
to take into consideration comments from previous upstreaming attempt.
I find sixaxis name short and neat so I sticked with it.
I didn't really like the idea of hardcoding SDP records so I took different
approach of doing reverse SDP search while cable associated device first
connects. This is done before authorizing incoming HID connection.
Some functions unavailable to exteral plugins were renamed with btd_ prefix
(or explicitly marked in bletooth.ver) to export them (patch 1-8).
Patch 9-10 add sixaxis external plugin that depends on udev. This plugin is
responsible for preparing newly USB connected PS3 sixaxis device and creating
btd_device with proper PNP information.
Patch 12 adds support for handling first connection of sixaxis device in input
plugin itself. This is something I would like to get comments and suggestions.
Currently this is rather sixaxis oriented, but could be made more generic (some
hooks registration) if desired.
This serie is not implemententing any LED (or other features) setting support.
I have an impression that those should not be handled by BlueZ but some other
entity (util tools or driver itself perhabs?) as this is not related to
transport itself and should be set/used on USB connection as well.
This was tested with Dualshock3 and seems to be working nicely here.
Comments are welcome.
--
BR
Szymon Janc
Szymon Janc (13):
core: Export some symbols from libbluetooth
Rename adapter_get_device to btd_adapter_get_device
Rename device_set_temporary to btd_device_set_temporary
Rename device_set_trusted to btd_device_set_trusted
Rename device_device_set_name to btd_device_device_set_name
Rename device_get_uuids to btd_device_get_uuids
Rename adapter_get_address to btd_adapter_get_address
Rename adapter_find_device to btd_adapter_find_device
plugins: Add initial code for sixaxis plugin
plugins/sixaxis: Add initial code for udev handling
plugins/sixaxis: Add support for configuring new controllers
device: Add device_discover_services function
input: Add support for handling sixaxis devices
Makefile.plugins | 8 ++
bootstrap-configure | 1 +
configure.ac | 5 +
plugins/neard.c | 10 +-
plugins/sixaxis.c | 286 ++++++++++++++++++++++++++++++++++++++++++
plugins/wiimote.c | 2 +-
profiles/audio/avctp.c | 18 +--
profiles/audio/avdtp.c | 11 +-
profiles/health/hdp.c | 10 +-
profiles/health/hdp_util.c | 6 +-
profiles/input/device.c | 4 +-
profiles/input/manager.c | 4 +-
profiles/input/server.c | 104 ++++++++++++++-
profiles/network/connection.c | 2 +-
profiles/network/server.c | 4 +-
profiles/sap/server.c | 3 +-
src/adapter.c | 74 ++++++-----
src/adapter.h | 6 +-
src/attrib-server.c | 6 +-
src/bluetooth.ver | 2 +
src/device.c | 70 +++++++----
src/device.h | 10 +-
src/profile.c | 14 +--
23 files changed, 551 insertions(+), 109 deletions(-)
create mode 100644 plugins/sixaxis.c
--
1.8.4.4
^ permalink raw reply
* Re: [PATCH 00/13] sixaxis support
From: Antonio Ospite @ 2013-11-25 22:12 UTC (permalink / raw)
To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <1385417752-25664-1-git-send-email-szymon.janc@gmail.com>
On Mon, 25 Nov 2013 22:15:39 +0000
Szymon Janc <szymon.janc@gmail.com> wrote:
> Hi All,
>
> This is yet another attempt to get PS3 controller support into BlueZ upstream.
>
> I based my work on Fedora out-of-tree patch (hence copyright info) and tried
> to take into consideration comments from previous upstreaming attempt.
>
Hi Szymon, JFYI the latest patch for my playstation-peripheral plugin
is here:
http://ao2.it/tmp/playstation-peripheral-pugin-v5.x-2013-11-13.patch
Only two patches to BlueZ should be needed with this code.
Basically the only show-stopper was a way to add a device to the
database before it ever connects, I went for this
"btd_create_stored_device(everything_we_know)" but BlueZ devs didn't
like this "kitchen sink" function.
>From my POV the problem here was:
"Add a known device to the device database before it ever connects"
However it looks like I didn't get to solve it in an acceptable way.
> I find sixaxis name short and neat so I sticked with it.
>
I was using playstation-peripheral thinking to the PS Move and
possibly other devices which may work slightly different.
> I didn't really like the idea of hardcoding SDP records so I took different
> approach of doing reverse SDP search while cable associated device first
> connects. This is done before authorizing incoming HID connection.
>
I think ideally we should avoid making BlueZ aware of sixaxis in
input.c.
> Some functions unavailable to exteral plugins were renamed with btd_ prefix
> (or explicitly marked in bletooth.ver) to export them (patch 1-8).
>
> Patch 9-10 add sixaxis external plugin that depends on udev. This plugin is
> responsible for preparing newly USB connected PS3 sixaxis device and creating
> btd_device with proper PNP information.
>
> Patch 12 adds support for handling first connection of sixaxis device in input
> plugin itself. This is something I would like to get comments and suggestions.
> Currently this is rather sixaxis oriented, but could be made more generic (some
> hooks registration) if desired.
>
> This serie is not implemententing any LED (or other features) setting support.
> I have an impression that those should not be handled by BlueZ but some other
> entity (util tools or driver itself perhabs?) as this is not related to
> transport itself and should be set/used on USB connection as well.
>
Setting LEDs will need to be done by some code using udev anyway, as we
want the LED to match the X in the created /dev/input/jsX, so I thought
it may just go in the bluez plugin which is using udev already.
The kernel driver is at HID/input level in linux which is not aware of
the joystick layer, so it cannot know the joystick number, and
besides kernel driver should not be too smart anyway.
We cannot just count devices in the sixaxis kernel driver either,
consider this scenario:
- Connect a PS3 controller (js0, LED1)
- Connect some other joystick (js1)
- Connect another PS3 controller (js2, LED3)
> This was tested with Dualshock3 and seems to be working nicely here.
>
> Comments are welcome.
>
See above, but I don't think I am qualified to comment on your patches
12 and 13.
BTW considering that up to now I failed to have this merged I am not
going be picky, if BlueZ devs are happy with your approach, let's go
for it :)
Thanks,
Antonio
--
Antonio Ospite
http://ao2.it
A: Because it messes up the order in which people normally read text.
See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
^ permalink raw reply
* Re: autopair corner cases
From: Scott James Remnant @ 2013-11-25 21:41 UTC (permalink / raw)
To: Bastien Nocera
Cc: linux-bluetooth@vger.kernel.org, Alex Deymo, Scott James Remnant
In-Reply-To: <1384867785.2027.36.camel@nuvo>
On Tue, Nov 19, 2013 at 5:29 AM, Bastien Nocera <hadess@hadess.net> wrote:
> 6) I have a "TomTom Remote" that shows up as a keyboard and uses "0000"
> as its PIN. The problem is that, as per the code in autopair.c we'll
> first show a random pincode then quickly fall back to using "0000":
>> /* For keyboards rejecting the first random code
>> * in less than 500ms, try a fixed code. */
>
> How does ChromeOS present this? Does it wait half a second before
> showing the pincode to enter? Because flashing an unusable pincode on
> the screen before succeeding pairing is pretty rubbish in my opinion...
>
This is at least slightly better than OS X, which would display the
random PIN, and then fail pairing - require you to try again, find the
"Advanced" button, set it to one of three or four user-nonsensical
options, and then enter 0000
I'm not saying we can't do better, of course, I'm just saying that we
can do worse :p
A half-second flash of a 6-digit PIN before falling back to a
four-digit one at least works in all of the corner cases - including
this one.
We actually collect logs via metrics of the devices this happens for,
right now we only know of one keyboard that this gets triggered for (a
Motorola Android Keyboard that's no longer on sale) - the TomTom
Remote makes two - I guess nobody's paired a Chromebook with one yet.
I'm way open to ideas for improving the experience here, just as long
as we keep the "works in the common and corner cases" part ;-)
Scott
--
Scott James Remnant | Chrome OS Systems | keybuk@google.com | Google
^ permalink raw reply
* Re: autopair corner cases
From: Scott James Remnant @ 2013-11-25 21:37 UTC (permalink / raw)
To: Bastien Nocera; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1384864264.2027.22.camel@nuvo>
On Tue, Nov 19, 2013 at 4:31 AM, Bastien Nocera <hadess@hadess.net> wrote:
> 1) First is the case of the PS3 BD Remote that will reject
> authentication when you try to pair to it. gnome-bluetooth knows not to
> pair with it.
>
>> <!-- Sony PlayStation 3 Remote Control -->
>> <device oui="00:19:C1:" name="BD Remote Control" pin="NULL"/>
>> <device oui="00:1E:3D:" name="BD Remote Control" pin="NULL"/>
>> <device oui="00:06:F5:" name="BD Remote Control" pin="NULL"/>
>
> Is there a way to say "we can't actually pair" when the client requested
> pairing already? Or is that considered a security problem?
>
It's perfectly valid for Bluetooth devices to not support pairing, and
return a "Pairing Not Supported" or "Authentication Not Supported"
error when attempted. When I tested a PS3 controller here, it seemed
to do that according to spec.
This is especially true for LE devices, the majority I have don't
support pairing.
While it's a "nice to have" for a UI to know in advance, maintaining
that list of devices would be quite an undertaking, it didn't seem
worth special casing the PS3 Controller. Also that should take the
form of a device property the UI can examine to decide whether or not
to offer pairing. Having the plugin fail pairing with the same error
the device would give anyway didn't seem like a "fix".
> 2) The second case is pairing this "funny" keyboard that's the iCade
> controller. In gnome-bluetooth, we had special code to generate only
> joystick movements for the pairing, rather than hard to determine
> buttons, so we'd end up with a 6-digit pin using only 1 through 4.
>
>> <!-- ION iCade Game Controller -->
>> <device name="iCade" type="keyboard" pin="ICADE"/>
>
Having a BlueZ-UI API just for this one device seems like overkill?
This can be just blacklisted in the autopair plugin, or handled by a
higher priority plugin, so the UI can use its special code, no?
> 3) We have a whole list of GPS that don't use present themselves as
> anything special apart from the name. Most use "0000", but some use
> things like "NAVMAN" or "12345678"
>
>> <!-- http://bugzilla.gnome.org/show_bug.cgi?id=560315#c20 -->
>> <device oui="00:02:5B:" name="Pharos iGPS-BT" pin="12345678"/>
>>
>> <!-- https://bugzilla.gnome.org/show_bug.cgi?id=613698 -->
>> <device oui="00:0C:A5:" name="NAVMAN GPS ONE" pin="NAVMAN"/>
>
These could be handled by extending the plugin, or a higher priority
plugin, - right now I don't think the plugin would deal with them at
all?
> 4) Audio devices will mostly already be supported by the autopair code
> (yay!), though we have a few stragglers, most notably this speaker that
> can use random pincode, as long as they're only 4 digits in length:
>
>> <!-- http://bugzilla.gnome.org/show_bug.cgi?id=583651 -->
>> <device type="audio" oui="00:1A:80:" name="CMT-DH5BT" pin="max:4"/>
>
I'm confused by this one - the device accepts any four-digit PIN?
wouldn't 0000 work? :)
> 5) Printers are missing from the list, that should be an easy fix.
>
Unsurprising, since Chromium OS doesn't support printers ;-)
Scott
--
Scott James Remnant | Chrome OS Systems | keybuk@google.com | Google
^ permalink raw reply
* SM: is BlueZ the Master/Initiator or Slave/Responder?
From: Scott James Remnant @ 2013-11-25 21:17 UTC (permalink / raw)
To: linux-bluetooth@vger.kernel.org, Holtmann, Marcel, Johan Hedberg,
Brian Gix
We are able to pass all qualification tests with BlueZ as the Master except one:
TP/KDU/BV-06-C - Master Key Distribution - Encryption Key bit
This test requires that BlueZ initiates pairing with the
SMP_DIST_ENC_KEY bit set in the init_key_dist member of struct
smp_cmd_pairing - however this member is always initialized to zero
and never changed.
This seems to have changed at some point in the past, 2b64d153 added
MITM mechanism and changed the init_key_dist member initialization
from dist_keys to 0
So two questions:
1) should BlueZ be able to behave as Master? It passes the majority
of the tests except this one.
2) given the above, is this a bug that init_key_dist is 0 or is it a
test plan error that it requires this?
Scott
--
Scott James Remnant | Chrome OS Systems | keybuk@google.com | Google
^ permalink raw reply
* Crasher during remote initiated pairing
From: Bastien Nocera @ 2013-11-25 16:53 UTC (permalink / raw)
To: linux-bluetooth
Heya,
I have a particularly stubborn device, the TomTom Go Remote that tries
to connect to my computer as soon as it's turned on, even when I've
removed the pairing on the computer side.
With GNOME's Bluetooth wizard open, I receive an out of the blue request
for pairing, I pass it the expected PIN code (0000), I then find that
the wizard doesn't work as I expected and turn it off. bluetoothd
promptly crashes:
Program received signal SIGSEGV, Segmentation fault.
0x00007f0cf9ffde24 in agent_auth_cb (agent=<optimized out>, derr=0x7fffab655920, user_data=0x7f0cfb2e0020) at src/adapter.c:4370
4370 struct service_auth *auth = adapter->auths->head->data;
(gdb) p adapter
$1 = (struct btd_adapter *) 0x7f0cfb2e0020
(gdb) p adapter->auths
$2 = (GQueue *) 0x7f0cfb2d1240
(gdb) p adapter->auths->head
$3 = 0x0
Some missing NULL checks?
I imagine that this should be reproduceable using simple-agent and
making it exit after replying to RequestPinCode.
This happens with 5.10 and 5.11:
https://retrace.fedoraproject.org/faf/problems/1353319/
Cheers
^ permalink raw reply
* [PATCH v2 20/20] unit/AVDTP: Add /TP/SIG/SMG/BV-24-C test
From: Luiz Augusto von Dentz @ 2013-11-25 14:54 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1385391283-10962-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Verify that the IUT (ACP) is able to accept a command to abort a stream.
---
unit/test-avdtp.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/unit/test-avdtp.c b/unit/test-avdtp.c
index 949d998..065dc07 100644
--- a/unit/test-avdtp.c
+++ b/unit/test-avdtp.c
@@ -596,6 +596,17 @@ int main(int argc, char *argv[])
0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
raw_pdu(0x12, 0x03),
raw_pdu(0x20, 0x0a, 0x04));
+ define_test("/TP/SIG/SMG/BV-24-C", test_server,
+ raw_pdu(0x00, 0x01),
+ raw_pdu(0x02, 0x01, 0x04, 0x00),
+ raw_pdu(0x10, 0x02, 0x04),
+ raw_pdu(0x12, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+ 0xff, 0xff, 0x02, 0x40),
+ raw_pdu(0x20, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+ 0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
+ raw_pdu(0x22, 0x03),
+ raw_pdu(0x30, 0x0a, 0x04),
+ raw_pdu(0x32, 0x0a));
return g_test_run();
}
--
1.8.3.1
^ permalink raw reply related
* [PATCH v2 19/20] unit/AVDTP: Add /TP/SIG/SMG/BV-23-C test
From: Luiz Augusto von Dentz @ 2013-11-25 14:54 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1385391283-10962-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Verify that the IUT (INT) is able to abort a stream by issuing the
AVDTP_ABORT and reporting the replied confirmation.
---
unit/test-avdtp.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/unit/test-avdtp.c b/unit/test-avdtp.c
index 88c2b01..949d998 100644
--- a/unit/test-avdtp.c
+++ b/unit/test-avdtp.c
@@ -293,6 +293,8 @@ static void sep_setconf_cfm(struct avdtp *session, struct avdtp_local_sep *sep,
if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BV-11-C"))
ret = avdtp_get_configuration(session, stream);
+ if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BV-23-C"))
+ ret = avdtp_abort(session, stream);
else
ret = avdtp_open(session, stream);
@@ -584,6 +586,16 @@ int main(int argc, char *argv[])
raw_pdu(0x42, 0x07),
raw_pdu(0x50, 0x09, 0x04),
raw_pdu(0x52, 0x09));
+ define_test("/TP/SIG/SMG/BV-23-C", test_client,
+ raw_pdu(0xf0, 0x01),
+ raw_pdu(0xf2, 0x01, 0x04, 0x00),
+ raw_pdu(0x00, 0x02, 0x04),
+ raw_pdu(0x02, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+ 0xff, 0xff, 0x02, 0x40),
+ raw_pdu(0x10, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+ 0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
+ raw_pdu(0x12, 0x03),
+ raw_pdu(0x20, 0x0a, 0x04));
return g_test_run();
}
--
1.8.3.1
^ permalink raw reply related
* [PATCH v2 18/20] unit/AVDTP: Add /TP/SIG/SMG/BV-22-C test
From: Luiz Augusto von Dentz @ 2013-11-25 14:54 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1385391283-10962-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Verify that the IUT (ACP) is able to accept an AVDTP_SUSPEND_CMD, after
the streaming procedure has been started, by reporting the suspension
and replying the returned confirmation.
---
unit/test-avdtp.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/unit/test-avdtp.c b/unit/test-avdtp.c
index 804fdf5..88c2b01 100644
--- a/unit/test-avdtp.c
+++ b/unit/test-avdtp.c
@@ -569,6 +569,21 @@ int main(int argc, char *argv[])
raw_pdu(0xd0, 0x07, 0x04),
raw_pdu(0xd2, 0x07),
raw_pdu(0xe0, 0x09, 0x04));
+ define_test("/TP/SIG/SMG/BV-22-C", test_server,
+ raw_pdu(0x00, 0x01),
+ raw_pdu(0x02, 0x01, 0x04, 0x00),
+ raw_pdu(0x10, 0x02, 0x04),
+ raw_pdu(0x12, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+ 0xff, 0xff, 0x02, 0x40),
+ raw_pdu(0x20, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+ 0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
+ raw_pdu(0x22, 0x03),
+ raw_pdu(0x30, 0x06, 0x04),
+ raw_pdu(0x32, 0x06),
+ raw_pdu(0x40, 0x07, 0x04),
+ raw_pdu(0x42, 0x07),
+ raw_pdu(0x50, 0x09, 0x04),
+ raw_pdu(0x52, 0x09));
return g_test_run();
}
--
1.8.3.1
^ 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