Linux bluetooth development
 help / color / mirror / Atom feed
* Patches  for kernel bluetooth
From: Waldemar.Rymarkiewicz @ 2010-07-19 11:33 UTC (permalink / raw)
  To: marcel; +Cc: linux-bluetooth
In-Reply-To: <1279519823.4572.17.camel@localhost.localdomain>

Hi,

Wondering if preparing patches for kernel bt (net/bluetooth and include/net=
/bluetooth) I should  base on linux-next git  or  git://git.kernel.org/pub/=
scm/linux/kernel/git/holtmann/bluetooth-2.6.git?=20

Thanks,
/Waldek

^ permalink raw reply

* Any update on software caused connection abort issue??
From: john michelle @ 2010-07-19 11:23 UTC (permalink / raw)
  To: linux-bluetooth

Any update on software caused connection abort issue



>On Wed, Jun 23, 2010 at 12:48 AM, john michelle <jhnmichelle@gmail.com> wrote:
> Dear Bluetooth community,
>
> You are committing version after version and have time to add new
> Features and the core stack have a major bug (software Caused
> connection abort) that i
> Have reported on the 7th of may the problem seems to be either in the
> usb part of the
> Kernel or the bluez stack, i am no kernel engineer so i came directly
> to you for reporting
> This problem and my requests to look into this problem are just
> ignored. this is a blocker
> Issue that would prevent and discourage any one from developing
> application that rely on
> Bluez sco capabilities, since during transmission the above mentioned
> error just occurs.
> I hope that my voice is heared and i would get a reply from the bluez community.
>
> John
>
>
>
> On Wed, Jun 16, 2010 at 3:11 PM, john michelle <jhnmichelle@gmail.com> wrote:
>> On Sun, May 30, 2010 at 1:12 PM, john michelle <jhnmichelle@gmail.com> wrote:
>>> Hi Gustavo,
>>>
>>>>> Please post the output of hcidump when the connection abort happens.
>>>>>
>>>
>>> Below is the output of hcidump the moments the software caused connection abort
>>>
>>> Dongle 1:
>>>> HCI Event: Number of Completed Packets (0x13) plen 5
>>>  . * . . .
>>> < HCI Command: Reset (0x03|0x0003) plen 0
>>> device: disconnected
>>>
>>> Dongle 2:
>>>> HCI Event: Number of Completed Packets (0x13) plen 5
>>>  . * . . .
>>> < HCI Command: Reset (0x03|0x0003) plen 0
>>> device: disconnected
>>>
>>>
>>> I think something triggers hci reset which causes this problem, but what exactly
>>> Triggers it i don't know.
>>>
>>>
>>> John
>>>
>>>
>>
>>
>> Hi all,
>>
>> Is anyone going to give this problem a try, it has been like a month now
>> This is a real problem in the bluez stack and someone have to look in this
>> Issue.
>>
>> John
>>
>>> On Mon, May 17, 2010 at 5:21 PM, john michelle <jhnmichelle@gmail.com> wrote:
>>>>> Hi Jonh,
>>>>>
>>>>> First of all, don't do top posting in this mailing list. ;)
>>>>>
>>>>
>>>> Thanks for the advise , will keep that in mind for future posts.
>>>>
>>>>> In which bluez/kernel version the problem started? Any hardware update
>>>>> during this time? The problem happens when you are already tranfering
>>>>> SCO data?
>>>>>
>>>>
>>>> I tried bluez versions 3.XX  and kernel 2.6.26(I think) the problem
>>>> occurs and the kernel panics with no core dumps.then i tried with
>>>> bluez 4.53-4.62 with
>>>> Kernel 2.6.31 and 2.6.32. the connection abort problem occurs but the
>>>> kernel doesn't
>>>> Panic. regarding the hardware update you mean the dongle or the box.Anyway
>>>> i changed both and tried different box's, this even happens on a box
>>>> with 2 giga ram
>>>> And core2 processor . as for the dongles i am using trust
>>>>
>>>> http://www.twenga.co.uk/prices-Bluetooth-2-USB-Adapter-10m-BT-2250p-TRUST-Wireless-network-card-adapter-176178-0
>>>>
>>>>  and also using no name dongles all the same problem.
>>>>
>>>>> Please post the output of hcidump when the connection abort happens.
>>>>>
>>>>
>>>> well that is going to be a hard one since i have more than one dongle in place
>>>> And very hard to predict which one will crash.i will work on this and update
>>>> You as soon as i have the hcidump log.
>>>>
>>>>
>>>>
>>>>> I tried reproduce this issue in L2CAP but it is a bit hard, lets
>>>>> say it happen once in a thousand, so it's not easy to track it. I have
>>>>> to try reproduce that using the SCO, but I'm not used to that layer yet.
>>>>> ;)
>>>>
>>>> I hoped that it happens 1 in 1000 in SCO , but it actually happens 1 in 15
>>>>
>>>>
>>>> John
>>>>
>>>>
>>>>
>>>>>
>>>>> Regards,
>>>>>
>>>>>>
>>>>>> John
>>>>>>
>>>>>> On Fri, May 7, 2010 at 3:53 PM, Gustavo F. Padovan <gustavo@padovan.org> wrote:
>>>>>> > * john michelle <jhnmichelle@gmail.com> [2010-05-07 15:49:05 -0400]:
>>>>>> >
>>>>>> >> Hi Bluetooth hackers,
>>>>>> >>
>>>>>> >> i am having this consistent problem with bluez , from time to time i
>>>>>> >> get the error Software caused connection abort (103 )
>>>>>> >> And the bluetooth stick seems to disconnect and reconnects. this
>>>>>> >> happens during an sco connection and it occurs even
>>>>>> >> More when i am having the voice stream comming through the internet
>>>>>> >> rather than the lan.i don't know what exact
>>>>>> >> Details you need to solve this problem please tell me and i will give
>>>>>> >> you an immediate reply . i have linux kernel 2.6.33 and bluez 4.62
>>>>>> >
>>>>>> > I get the same problem sometimes when testing ERTM with l2test. So the
>>>>>> > problem is on l2cap too. I didn't have time to debug this yet. Now that
>>>>>> > someone else have confirmed it too, I'll to take a look at the problem.
>>>>>> >
>>>>>> >>
>>>>>
>>>>> --
>>>>> Gustavo F. Padovan
>>>>> http://padovan.org
>>>>>
>>>>
>>>
>>
>

^ permalink raw reply

* [PATCH] add variable target size support in obex_mime_type_driver_find()
From: Marcel Mol @ 2010-07-19  7:44 UTC (permalink / raw)
  To: linux-bluetooth

targets for mime type drivers are not always fixed to TARGET_SIZE.
(ifix started by Pierre Ossman)

Signed-off-by: Marcel Mol <marcel@mesa.nl>
---
 plugins/filesystem.c    |    3 +++
 plugins/nokia-backup.c  |    1 +
 plugins/pbap.c          |    3 +++
 plugins/syncevolution.c |    1 +
 src/mimetype.c          |   14 ++++++++------
 src/mimetype.h          |    2 ++
 src/obex.c              |   10 ++++++++--
 7 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/plugins/filesystem.c b/plugins/filesystem.c
index 9fe4f00..f0e5bbe 100644
--- a/plugins/filesystem.c
+++ b/plugins/filesystem.c
@@ -550,6 +550,7 @@ static struct obex_mime_type_driver file = {
 
 static struct obex_mime_type_driver capability = {
 	.target = FTP_TARGET,
+	.target_size = TARGET_SIZE,
 	.mimetype = "x-obex/capability",
 	.open = capability_open,
 	.close = capability_close,
@@ -558,6 +559,7 @@ static struct obex_mime_type_driver capability = {
 
 static struct obex_mime_type_driver folder = {
 	.target = FTP_TARGET,
+	.target_size = TARGET_SIZE,
 	.mimetype = "x-obex/folder-listing",
 	.open = folder_open,
 	.close = string_free,
@@ -566,6 +568,7 @@ static struct obex_mime_type_driver folder = {
 
 static struct obex_mime_type_driver pcsuite = {
 	.target = FTP_TARGET,
+	.target_size = TARGET_SIZE,
 	.who = PCSUITE_WHO,
 	.who_size = PCSUITE_WHO_SIZE,
 	.mimetype = "x-obex/folder-listing",
diff --git a/plugins/nokia-backup.c b/plugins/nokia-backup.c
index dffc5cd..1fe3fc5 100644
--- a/plugins/nokia-backup.c
+++ b/plugins/nokia-backup.c
@@ -276,6 +276,7 @@ static ssize_t backup_write(void *object, const void *buf, size_t count)
 
 static struct obex_mime_type_driver backup = {
 	.target = FTP_TARGET,
+	.target_size = TARGET_SIZE
 	.mimetype = "application/vnd.nokia-backup",
 	.open = backup_open,
 	.close = backup_close,
diff --git a/plugins/pbap.c b/plugins/pbap.c
index 3c8e33e..af4b452 100644
--- a/plugins/pbap.c
+++ b/plugins/pbap.c
@@ -861,6 +861,7 @@ static int vobject_close(void *object)
 
 static struct obex_mime_type_driver mime_pull = {
 	.target = PBAP_TARGET,
+	.target_size = TARGET_SIZE,
 	.mimetype = "x-bt/phonebook",
 	.open = vobject_pull_open,
 	.close = vobject_close,
@@ -869,6 +870,7 @@ static struct obex_mime_type_driver mime_pull = {
 
 static struct obex_mime_type_driver mime_list = {
 	.target = PBAP_TARGET,
+	.target_size = TARGET_SIZE,
 	.mimetype = "x-bt/vcard-listing",
 	.open = vobject_list_open,
 	.close = vobject_close,
@@ -877,6 +879,7 @@ static struct obex_mime_type_driver mime_list = {
 
 static struct obex_mime_type_driver mime_vcard = {
 	.target = PBAP_TARGET,
+	.target_size = TARGET_SIZE,
 	.mimetype = "x-bt/vcard",
 	.open = vobject_vcard_open,
 	.close = vobject_close,
diff --git a/plugins/syncevolution.c b/plugins/syncevolution.c
index 55709df..970ce29 100644
--- a/plugins/syncevolution.c
+++ b/plugins/syncevolution.c
@@ -443,6 +443,7 @@ static ssize_t synce_write(void *object, const void *buf, size_t count)
 
 static struct obex_mime_type_driver synce_driver = {
 	.target = SYNCML_TARGET,
+	.target_size = SYNCML_TARGET_SIZE,
 	.open = synce_open,
 	.close = synce_close,
 	.read = synce_read,
diff --git a/src/mimetype.c b/src/mimetype.c
index 7b96ec2..7df1308 100644
--- a/src/mimetype.c
+++ b/src/mimetype.c
@@ -118,6 +118,7 @@ static int set_io_watch(void *object, obex_object_io_func func,
 }
 
 static struct obex_mime_type_driver *find_driver(const uint8_t *target,
+				unsigned int target_size,
 				const char *mimetype, const uint8_t *who,
 				unsigned int who_size)
 {
@@ -126,7 +127,7 @@ static struct obex_mime_type_driver *find_driver(const uint8_t *target,
 	for (l = drivers; l; l = l->next) {
 		struct obex_mime_type_driver *driver = l->data;
 
-		if (memcmp0(target, driver->target, TARGET_SIZE))
+		if (memcmp0(target, driver->target, target_size))
 			continue;
 
 		if (memcmp0(who, driver->who, who_size))
@@ -140,27 +141,28 @@ static struct obex_mime_type_driver *find_driver(const uint8_t *target,
 }
 
 struct obex_mime_type_driver *obex_mime_type_driver_find(const uint8_t *target,
+				unsigned int target_size,
 				const char *mimetype, const uint8_t *who,
 				unsigned int who_size)
 {
 	struct obex_mime_type_driver *driver;
 
-	driver = find_driver(target, mimetype, who, who_size);
+	driver = find_driver(target, target_size, mimetype, who, who_size);
 	if (driver == NULL) {
 		if (who != NULL) {
 			/* Fallback to non-who specific */
-			driver = find_driver(target, mimetype, NULL, 0);
+			driver = find_driver(target, target_size, mimetype, NULL, 0);
 			if (driver != NULL)
 				return driver;
 		}
 
 		if (mimetype != NULL)
 			/* Fallback to target default */
-			driver = find_driver(target, NULL, NULL, 0);
+			driver = find_driver(target, target_size, NULL, NULL, 0);
 
 		if (driver == NULL)
 			/* Fallback to general default */
-			driver = find_driver(NULL, NULL, NULL, 0);
+			driver = find_driver(NULL, 0, NULL, NULL, 0);
 	}
 
 	return driver;
@@ -173,7 +175,7 @@ int obex_mime_type_driver_register(struct obex_mime_type_driver *driver)
 		return -EINVAL;
 	}
 
-	if (find_driver(driver->target, driver->mimetype,
+	if (find_driver(driver->target, driver->target_size, driver->mimetype,
 					driver->who, driver->who_size)) {
 		error("Permission denied: %s could not be registered",
 				driver->mimetype);
diff --git a/src/mimetype.h b/src/mimetype.h
index 4cb3156..200b950 100644
--- a/src/mimetype.h
+++ b/src/mimetype.h
@@ -26,6 +26,7 @@ typedef gboolean (*obex_object_io_func) (void *object, int flags, int err,
 
 struct obex_mime_type_driver {
 	const uint8_t *target;
+	unsigned int target_size;
 	const char *mimetype;
 	const uint8_t *who;
 	unsigned int who_size;
@@ -42,6 +43,7 @@ struct obex_mime_type_driver {
 int obex_mime_type_driver_register(struct obex_mime_type_driver *driver);
 void obex_mime_type_driver_unregister(struct obex_mime_type_driver *driver);
 struct obex_mime_type_driver *obex_mime_type_driver_find(const uint8_t *target,
+				unsigned int target_size,
 				const char *mimetype, const uint8_t *who,
 				unsigned int who_size);
 
diff --git a/src/obex.c b/src/obex.c
index db04bfd..21788ba 100644
--- a/src/obex.c
+++ b/src/obex.c
@@ -763,7 +763,9 @@ static void cmd_get(struct obex_session *os, obex_t *obex, obex_object_t *obj)
 			os->type = g_strndup((const char *) hd.bs, hlen);
 			DBG("OBEX_HDR_TYPE: %s", os->type);
 			os->driver = obex_mime_type_driver_find(
-						os->service->target, os->type,
+						os->service->target,
+						os->service->target_size,
+						os->type,
 						os->service->who,
 						os->service->who_size);
 			break;
@@ -772,6 +774,7 @@ static void cmd_get(struct obex_session *os, obex_t *obex, obex_object_t *obj)
 
 	if (os->type == NULL)
 		os->driver = obex_mime_type_driver_find(os->service->target,
+							os->service->target_size,
 							NULL,
 							os->service->who,
 							os->service->who_size);
@@ -977,7 +980,9 @@ static gboolean check_put(obex_t *obex, obex_object_t *obj)
 			os->type = g_strndup((const char *) hd.bs, hlen);
 			DBG("OBEX_HDR_TYPE: %s", os->type);
 			os->driver = obex_mime_type_driver_find(
-						os->service->target, os->type,
+						os->service->target,
+						os->service->target_size,
+						os->type,
 						os->service->who,
 						os->service->who_size);
 			break;
@@ -1001,6 +1006,7 @@ static gboolean check_put(obex_t *obex, obex_object_t *obj)
 
 	if (os->type == NULL)
 		os->driver = obex_mime_type_driver_find(os->service->target,
+							os->service->target_size,
 							NULL,
 							os->service->who,
 							os->service->who_size);
-- 
1.7.1.1


^ permalink raw reply related

* [PATCH v2] Bluetooth: Support for Atheros AR300x serial Bluetooth Chip
From: Suraj Sumangala @ 2010-07-19  7:04 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jothikumar.Mothilal, Suraj Sumangala

Implements Atheros AR300x Serial HCI protocol.
This protocol extends H4 serial protocol to implement enhanced power management
features supported by Atheros AR300x serial Bluetooth chipsets.

Signed-off-by: Suraj Sumangala <suraj@atheros.com>
---
 drivers/bluetooth/Kconfig     |   12 ++
 drivers/bluetooth/Makefile    |    1 +
 drivers/bluetooth/hci_ath.c   |  235 +++++++++++++++++++++++++++++++++++++++++
 drivers/bluetooth/hci_ldisc.c |    6 +
 drivers/bluetooth/hci_uart.h  |    8 ++-
 5 files changed, 261 insertions(+), 1 deletions(-)
 create mode 100755 drivers/bluetooth/hci_ath.c

diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
index 058fbcc..c35047f 100644
--- a/drivers/bluetooth/Kconfig
+++ b/drivers/bluetooth/Kconfig
@@ -58,6 +58,18 @@ config BT_HCIUART_BCSP
 
 	  Say Y here to compile support for HCI BCSP protocol.
 
+config BT_HCIUART_ATH3K
+	bool "Atheros AR300x serial Bluetooth support"
+	depends on BT_HCIUART
+	help
+	  HCIATH3K (HCI Atheros AR300x Protocol) is a serial protocol
+	  for communication between host and Atheros AR300x Bluetooth devices.
+	  This protocol enables AR300x Chips to be enabled with
+	  power management support.
+	  Enable this if you have Atheros AR300x serial Bluetooth device.
+
+	  Say Y here to compile support for HCI UART ATH3K protocol.
+
 config BT_HCIUART_LL
 	bool "HCILL protocol support"
 	depends on BT_HCIUART
diff --git a/drivers/bluetooth/Makefile b/drivers/bluetooth/Makefile
index 7e5aed5..71bdf13 100644
--- a/drivers/bluetooth/Makefile
+++ b/drivers/bluetooth/Makefile
@@ -26,4 +26,5 @@ hci_uart-y				:= hci_ldisc.o
 hci_uart-$(CONFIG_BT_HCIUART_H4)	+= hci_h4.o
 hci_uart-$(CONFIG_BT_HCIUART_BCSP)	+= hci_bcsp.o
 hci_uart-$(CONFIG_BT_HCIUART_LL)	+= hci_ll.o
+hci_uart-$(CONFIG_BT_HCIUART_ATH3K)	+= hci_ath.o
 hci_uart-objs				:= $(hci_uart-y)
diff --git a/drivers/bluetooth/hci_ath.c b/drivers/bluetooth/hci_ath.c
new file mode 100755
index 0000000..5ab258b
--- /dev/null
+++ b/drivers/bluetooth/hci_ath.c
@@ -0,0 +1,235 @@
+/*
+ *  Atheros Communication Bluetooth HCIATH3K UART protocol
+ *
+ *  HCIATH3K (HCI Atheros AR300x Protocol) is a Atheros Communication's
+ *  power management protocol extension to H4 to support AR300x Bluetooth Chip.
+ *
+ *  Copyright (c) 2009-2010 Atheros Communications Inc.
+ *
+ *  Acknowledgements:
+ *  This file is based on hci_h4.c, which was written
+ *  by Maxim Krasnyansky and Marcel Holtmann.
+ *
+ *  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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/tty.h>
+#include <linux/errno.h>
+#include <linux/ioctl.h>
+#include <linux/skbuff.h>
+
+#include <net/bluetooth/bluetooth.h>
+#include <net/bluetooth/hci_core.h>
+
+#include "hci_uart.h"
+
+struct ath_struct {
+	struct hci_uart *hu;
+	unsigned int cur_sleep;
+
+	struct sk_buff_head txq;
+	struct work_struct ctxtsw;
+};
+
+static int ath_wakeup_ar3k(struct tty_struct *tty)
+{
+	struct termios settings;
+	int status = tty->driver->ops->tiocmget(tty, NULL);
+
+	if (status & TIOCM_CTS)
+		return status;
+
+	/* Disable Automatic RTSCTS */
+	n_tty_ioctl_helper(tty, NULL, TCGETS, (unsigned long)&settings);
+	settings.c_cflag &= ~CRTSCTS;
+	n_tty_ioctl_helper(tty, NULL, TCSETS, (unsigned long)&settings);
+
+	/* Clear RTS first */
+	status = tty->driver->ops->tiocmget(tty, NULL);
+	tty->driver->ops->tiocmset(tty, NULL, 0x00, TIOCM_RTS);
+	mdelay(20);
+
+	/* Set RTS, wake up board */
+	status = tty->driver->ops->tiocmget(tty, NULL);
+	tty->driver->ops->tiocmset(tty, NULL, TIOCM_RTS, 0x00);
+	mdelay(20);
+
+	status = tty->driver->ops->tiocmget(tty, NULL);
+
+	n_tty_ioctl_helper(tty, NULL, TCGETS, (unsigned long)&settings);
+	settings.c_cflag |= CRTSCTS;
+	n_tty_ioctl_helper(tty, NULL, TCSETS, (unsigned long)&settings);
+
+	return status;
+}
+
+static void ath_hci_uart_work(struct work_struct *work)
+{
+	int status;
+	struct ath_struct *ath;
+	struct hci_uart *hu;
+	struct tty_struct *tty;
+
+	ath = container_of(work, struct ath_struct, ctxtsw);
+
+	hu = ath->hu;
+	tty = hu->tty;
+
+	/* verify and wake up controller */
+	if (ath->cur_sleep) {
+		status = ath_wakeup_ar3k(tty);
+		if (!(status & TIOCM_CTS))
+			return;
+	}
+
+	/* Ready to send Data */
+	clear_bit(HCI_UART_SENDING, &hu->tx_state);
+	hci_uart_tx_wakeup(hu);
+}
+
+/* Initialize protocol */
+static int ath_open(struct hci_uart *hu)
+{
+	struct ath_struct *ath;
+
+	BT_DBG("hu %p", hu);
+
+	ath = kzalloc(sizeof(*ath), GFP_ATOMIC);
+	if (!ath)
+		return -ENOMEM;
+
+	skb_queue_head_init(&ath->txq);
+
+	hu->priv = ath;
+	ath->hu = hu;
+
+	INIT_WORK(&ath->ctxtsw, ath_hci_uart_work);
+
+	return 0;
+}
+
+/* Flush protocol data */
+static int ath_flush(struct hci_uart *hu)
+{
+	struct ath_struct *ath = hu->priv;
+
+	BT_DBG("hu %p", hu);
+
+	skb_queue_purge(&ath->txq);
+
+	return 0;
+}
+
+/* Close protocol */
+static int ath_close(struct hci_uart *hu)
+{
+	struct ath_struct *ath = hu->priv;
+
+	BT_DBG("hu %p", hu);
+
+	skb_queue_purge(&ath->txq);
+
+	cancel_work_sync(&ath->ctxtsw);
+
+	hu->priv = NULL;
+	kfree(ath);
+
+	return 0;
+}
+
+#define HCI_OP_ATH_SLEEP 0xFC04
+
+/* Enqueue frame for transmittion */
+static int ath_enqueue(struct hci_uart *hu, struct sk_buff *skb)
+{
+	struct ath_struct *ath = hu->priv;
+
+	if (bt_cb(skb)->pkt_type == HCI_SCODATA_PKT) {
+		kfree(skb);
+		return 0;
+	}
+
+	/*
+	 * Update power management enable flag with parameters of
+	 * HCI sleep enable vendor specific HCI command.
+	 */
+	if (bt_cb(skb)->pkt_type == HCI_COMMAND_PKT) {
+		struct hci_command_hdr *hdr = (void *)skb->data;
+
+		if (__le16_to_cpu(hdr->opcode) == HCI_OP_ATH_SLEEP)
+			ath->cur_sleep = skb->data[HCI_COMMAND_HDR_SIZE];
+	}
+
+	BT_DBG("hu %p skb %p", hu, skb);
+
+	/* Prepend skb with frame type */
+	memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
+
+	skb_queue_tail(&ath->txq, skb);
+	set_bit(HCI_UART_SENDING, &hu->tx_state);
+
+	schedule_work(&ath->ctxtsw);
+
+	return 0;
+}
+
+static struct sk_buff *ath_dequeue(struct hci_uart *hu)
+{
+	struct ath_struct *ath = hu->priv;
+
+	return skb_dequeue(&ath->txq);
+}
+
+/* Recv data */
+static int ath_recv(struct hci_uart *hu, void *data, int count)
+{
+	if (hci_recv_stream_fragment(hu->hdev, data, count) < 0)
+		BT_ERR("Frame Reassembly Failed");
+
+	return count;
+}
+
+static struct hci_uart_proto athp = {
+	.id = HCI_UART_ATH3K,
+	.open = ath_open,
+	.close = ath_close,
+	.recv = ath_recv,
+	.enqueue = ath_enqueue,
+	.dequeue = ath_dequeue,
+	.flush = ath_flush,
+};
+
+int ath_init(void)
+{
+	int err = hci_uart_register_proto(&athp);
+
+	if (!err)
+		BT_INFO("HCIATH3K protocol initialized");
+	else
+		BT_ERR("HCIATH3K protocol registration failed");
+
+	return err;
+}
+
+int ath_deinit(void)
+{
+	return hci_uart_unregister_proto(&athp);
+}
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index a57dbfc..998833d 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -552,6 +552,9 @@ static int __init hci_uart_init(void)
 #ifdef CONFIG_BT_HCIUART_LL
 	ll_init();
 #endif
+#ifdef CONFIG_BT_HCIUART_ATH3K
+	ath_init();
+#endif
 
 	return 0;
 }
@@ -569,6 +572,9 @@ static void __exit hci_uart_exit(void)
 #ifdef CONFIG_BT_HCIUART_LL
 	ll_deinit();
 #endif
+#ifdef CONFIG_BT_HCIUART_ATH3K
+	ath_deinit();
+#endif
 
 	/* Release tty registration of line discipline */
 	if ((err = tty_unregister_ldisc(N_HCI)))
diff --git a/drivers/bluetooth/hci_uart.h b/drivers/bluetooth/hci_uart.h
index 9694d9d..99fb352 100644
--- a/drivers/bluetooth/hci_uart.h
+++ b/drivers/bluetooth/hci_uart.h
@@ -35,13 +35,14 @@
 #define HCIUARTGETFLAGS		_IOR('U', 204, int)
 
 /* UART protocols */
-#define HCI_UART_MAX_PROTO	5
+#define HCI_UART_MAX_PROTO	6
 
 #define HCI_UART_H4	0
 #define HCI_UART_BCSP	1
 #define HCI_UART_3WIRE	2
 #define HCI_UART_H4DS	3
 #define HCI_UART_LL	4
+#define HCI_UART_ATH3K	5
 
 #define HCI_UART_RAW_DEVICE	0
 
@@ -96,3 +97,8 @@ int bcsp_deinit(void);
 int ll_init(void);
 int ll_deinit(void);
 #endif
+
+#ifdef CONFIG_BT_HCIUART_ATH3K
+int ath_init(void);
+int ath_deinit(void);
+#endif
-- 
1.7.0.4


^ permalink raw reply related

* Re: [PATCH] Bluetooth: Use __packed annotation
From: Marcel Holtmann @ 2010-07-19  6:10 UTC (permalink / raw)
  To: Gustavo F. Padovan; +Cc: linux-bluetooth, Gustavo F. Padovan
In-Reply-To: <1279515613-710-1-git-send-email-gustavo@padovan.org>

Hi Gustavo,

> To make net/ and include/net/ code consistent use __packed instead of
> __attribute__ ((packed)). Bluetooth subsystem was one of the last net
> subsys still using __attribute__ ((packed)).
> 
> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
> ---
>  include/net/bluetooth/bluetooth.h |    2 +-
>  include/net/bluetooth/hci.h       |  184 ++++++++++++++++++------------------
>  include/net/bluetooth/l2cap.h     |   26 +++---
>  include/net/bluetooth/rfcomm.h    |   14 ++--
>  4 files changed, 113 insertions(+), 113 deletions(-)

patch has been applied. Thanks.

Regards

Marcel



^ permalink raw reply

* [PATCH] Bluetooth: Use __packed annotation
From: Gustavo F. Padovan @ 2010-07-19  5:00 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: marcel, Gustavo F. Padovan

From: Gustavo F. Padovan <padovan@profusion.mobi>

To make net/ and include/net/ code consistent use __packed instead of
__attribute__ ((packed)). Bluetooth subsystem was one of the last net
subsys still using __attribute__ ((packed)).

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
---
 include/net/bluetooth/bluetooth.h |    2 +-
 include/net/bluetooth/hci.h       |  184 ++++++++++++++++++------------------
 include/net/bluetooth/l2cap.h     |   26 +++---
 include/net/bluetooth/rfcomm.h    |   14 ++--
 4 files changed, 113 insertions(+), 113 deletions(-)

diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index d6b150c..27a902d 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -84,7 +84,7 @@ enum {
 /* BD Address */
 typedef struct {
 	__u8 b[6];
-} __attribute__((packed)) bdaddr_t;
+} __packed bdaddr_t;
 
 #define BDADDR_ANY   (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}})
 #define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}})
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index ca2518e..bcbdd6d 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -230,7 +230,7 @@ struct hci_cp_inquiry {
 	__u8     lap[3];
 	__u8     length;
 	__u8     num_rsp;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_INQUIRY_CANCEL		0x0402
 
@@ -244,81 +244,81 @@ struct hci_cp_create_conn {
 	__u8     pscan_mode;
 	__le16   clock_offset;
 	__u8     role_switch;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_DISCONNECT		0x0406
 struct hci_cp_disconnect {
 	__le16   handle;
 	__u8     reason;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_ADD_SCO			0x0407
 struct hci_cp_add_sco {
 	__le16   handle;
 	__le16   pkt_type;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_CREATE_CONN_CANCEL	0x0408
 struct hci_cp_create_conn_cancel {
 	bdaddr_t bdaddr;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_ACCEPT_CONN_REQ		0x0409
 struct hci_cp_accept_conn_req {
 	bdaddr_t bdaddr;
 	__u8     role;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_REJECT_CONN_REQ		0x040a
 struct hci_cp_reject_conn_req {
 	bdaddr_t bdaddr;
 	__u8     reason;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_LINK_KEY_REPLY		0x040b
 struct hci_cp_link_key_reply {
 	bdaddr_t bdaddr;
 	__u8     link_key[16];
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_LINK_KEY_NEG_REPLY	0x040c
 struct hci_cp_link_key_neg_reply {
 	bdaddr_t bdaddr;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_PIN_CODE_REPLY		0x040d
 struct hci_cp_pin_code_reply {
 	bdaddr_t bdaddr;
 	__u8     pin_len;
 	__u8     pin_code[16];
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_PIN_CODE_NEG_REPLY	0x040e
 struct hci_cp_pin_code_neg_reply {
 	bdaddr_t bdaddr;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_CHANGE_CONN_PTYPE	0x040f
 struct hci_cp_change_conn_ptype {
 	__le16   handle;
 	__le16   pkt_type;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_AUTH_REQUESTED		0x0411
 struct hci_cp_auth_requested {
 	__le16   handle;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_SET_CONN_ENCRYPT		0x0413
 struct hci_cp_set_conn_encrypt {
 	__le16   handle;
 	__u8     encrypt;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_CHANGE_CONN_LINK_KEY	0x0415
 struct hci_cp_change_conn_link_key {
 	__le16   handle;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_REMOTE_NAME_REQ		0x0419
 struct hci_cp_remote_name_req {
@@ -326,28 +326,28 @@ struct hci_cp_remote_name_req {
 	__u8     pscan_rep_mode;
 	__u8     pscan_mode;
 	__le16   clock_offset;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_REMOTE_NAME_REQ_CANCEL	0x041a
 struct hci_cp_remote_name_req_cancel {
 	bdaddr_t bdaddr;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_READ_REMOTE_FEATURES	0x041b
 struct hci_cp_read_remote_features {
 	__le16   handle;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_READ_REMOTE_EXT_FEATURES	0x041c
 struct hci_cp_read_remote_ext_features {
 	__le16   handle;
 	__u8     page;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_READ_REMOTE_VERSION	0x041d
 struct hci_cp_read_remote_version {
 	__le16   handle;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_SETUP_SYNC_CONN		0x0428
 struct hci_cp_setup_sync_conn {
@@ -358,7 +358,7 @@ struct hci_cp_setup_sync_conn {
 	__le16   voice_setting;
 	__u8     retrans_effort;
 	__le16   pkt_type;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_ACCEPT_SYNC_CONN_REQ	0x0429
 struct hci_cp_accept_sync_conn_req {
@@ -369,13 +369,13 @@ struct hci_cp_accept_sync_conn_req {
 	__le16   content_format;
 	__u8     retrans_effort;
 	__le16   pkt_type;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_REJECT_SYNC_CONN_REQ	0x042a
 struct hci_cp_reject_sync_conn_req {
 	bdaddr_t bdaddr;
 	__u8     reason;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_SNIFF_MODE		0x0803
 struct hci_cp_sniff_mode {
@@ -384,59 +384,59 @@ struct hci_cp_sniff_mode {
 	__le16   min_interval;
 	__le16   attempt;
 	__le16   timeout;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_EXIT_SNIFF_MODE		0x0804
 struct hci_cp_exit_sniff_mode {
 	__le16   handle;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_ROLE_DISCOVERY		0x0809
 struct hci_cp_role_discovery {
 	__le16   handle;
-} __attribute__ ((packed));
+} __packed;
 struct hci_rp_role_discovery {
 	__u8     status;
 	__le16   handle;
 	__u8     role;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_SWITCH_ROLE		0x080b
 struct hci_cp_switch_role {
 	bdaddr_t bdaddr;
 	__u8     role;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_READ_LINK_POLICY		0x080c
 struct hci_cp_read_link_policy {
 	__le16   handle;
-} __attribute__ ((packed));
+} __packed;
 struct hci_rp_read_link_policy {
 	__u8     status;
 	__le16   handle;
 	__le16   policy;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_WRITE_LINK_POLICY	0x080d
 struct hci_cp_write_link_policy {
 	__le16   handle;
 	__le16   policy;
-} __attribute__ ((packed));
+} __packed;
 struct hci_rp_write_link_policy {
 	__u8     status;
 	__le16   handle;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_READ_DEF_LINK_POLICY	0x080e
 struct hci_rp_read_def_link_policy {
 	__u8     status;
 	__le16   policy;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_WRITE_DEF_LINK_POLICY	0x080f
 struct hci_cp_write_def_link_policy {
 	__le16   policy;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_SNIFF_SUBRATE		0x0811
 struct hci_cp_sniff_subrate {
@@ -444,12 +444,12 @@ struct hci_cp_sniff_subrate {
 	__le16   max_latency;
 	__le16   min_remote_timeout;
 	__le16   min_local_timeout;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_SET_EVENT_MASK		0x0c01
 struct hci_cp_set_event_mask {
 	__u8     mask[8];
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_RESET			0x0c03
 
@@ -458,7 +458,7 @@ struct hci_cp_set_event_flt {
 	__u8     flt_type;
 	__u8     cond_type;
 	__u8     condition[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* Filter types */
 #define HCI_FLT_CLEAR_ALL	0x00
@@ -477,13 +477,13 @@ struct hci_cp_set_event_flt {
 #define HCI_OP_WRITE_LOCAL_NAME		0x0c13
 struct hci_cp_write_local_name {
 	__u8     name[248];
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_READ_LOCAL_NAME		0x0c14
 struct hci_rp_read_local_name {
 	__u8     status;
 	__u8     name[248];
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_WRITE_CA_TIMEOUT		0x0c16
 
@@ -511,23 +511,23 @@ struct hci_rp_read_local_name {
 struct hci_rp_read_class_of_dev {
 	__u8     status;
 	__u8     dev_class[3];
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_WRITE_CLASS_OF_DEV	0x0c24
 struct hci_cp_write_class_of_dev {
 	__u8     dev_class[3];
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_READ_VOICE_SETTING	0x0c25
 struct hci_rp_read_voice_setting {
 	__u8     status;
 	__le16   voice_setting;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_WRITE_VOICE_SETTING	0x0c26
 struct hci_cp_write_voice_setting {
 	__le16   voice_setting;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_HOST_BUFFER_SIZE		0x0c33
 struct hci_cp_host_buffer_size {
@@ -535,18 +535,18 @@ struct hci_cp_host_buffer_size {
 	__u8     sco_mtu;
 	__le16   acl_max_pkt;
 	__le16   sco_max_pkt;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_READ_SSP_MODE		0x0c55
 struct hci_rp_read_ssp_mode {
 	__u8     status;
 	__u8     mode;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_WRITE_SSP_MODE		0x0c56
 struct hci_cp_write_ssp_mode {
 	__u8     mode;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_READ_LOCAL_VERSION	0x1001
 struct hci_rp_read_local_version {
@@ -556,19 +556,19 @@ struct hci_rp_read_local_version {
 	__u8     lmp_ver;
 	__le16   manufacturer;
 	__le16   lmp_subver;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_READ_LOCAL_COMMANDS	0x1002
 struct hci_rp_read_local_commands {
 	__u8     status;
 	__u8     commands[64];
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_READ_LOCAL_FEATURES	0x1003
 struct hci_rp_read_local_features {
 	__u8     status;
 	__u8     features[8];
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_READ_LOCAL_EXT_FEATURES	0x1004
 struct hci_rp_read_local_ext_features {
@@ -576,7 +576,7 @@ struct hci_rp_read_local_ext_features {
 	__u8     page;
 	__u8     max_page;
 	__u8     features[8];
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_READ_BUFFER_SIZE		0x1005
 struct hci_rp_read_buffer_size {
@@ -585,13 +585,13 @@ struct hci_rp_read_buffer_size {
 	__u8     sco_mtu;
 	__le16   acl_max_pkt;
 	__le16   sco_max_pkt;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_OP_READ_BD_ADDR		0x1009
 struct hci_rp_read_bd_addr {
 	__u8     status;
 	bdaddr_t bdaddr;
-} __attribute__ ((packed));
+} __packed;
 
 /* ---- HCI Events ---- */
 #define HCI_EV_INQUIRY_COMPLETE		0x01
@@ -604,7 +604,7 @@ struct inquiry_info {
 	__u8     pscan_mode;
 	__u8     dev_class[3];
 	__le16   clock_offset;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_CONN_COMPLETE		0x03
 struct hci_ev_conn_complete {
@@ -613,54 +613,54 @@ struct hci_ev_conn_complete {
 	bdaddr_t bdaddr;
 	__u8     link_type;
 	__u8     encr_mode;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_CONN_REQUEST		0x04
 struct hci_ev_conn_request {
 	bdaddr_t bdaddr;
 	__u8     dev_class[3];
 	__u8     link_type;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_DISCONN_COMPLETE		0x05
 struct hci_ev_disconn_complete {
 	__u8     status;
 	__le16   handle;
 	__u8     reason;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_AUTH_COMPLETE		0x06
 struct hci_ev_auth_complete {
 	__u8     status;
 	__le16   handle;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_REMOTE_NAME		0x07
 struct hci_ev_remote_name {
 	__u8     status;
 	bdaddr_t bdaddr;
 	__u8     name[248];
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_ENCRYPT_CHANGE		0x08
 struct hci_ev_encrypt_change {
 	__u8     status;
 	__le16   handle;
 	__u8     encrypt;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_CHANGE_LINK_KEY_COMPLETE	0x09
 struct hci_ev_change_link_key_complete {
 	__u8     status;
 	__le16   handle;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_REMOTE_FEATURES		0x0b
 struct hci_ev_remote_features {
 	__u8     status;
 	__le16   handle;
 	__u8     features[8];
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_REMOTE_VERSION		0x0c
 struct hci_ev_remote_version {
@@ -669,7 +669,7 @@ struct hci_ev_remote_version {
 	__u8     lmp_ver;
 	__le16   manufacturer;
 	__le16   lmp_subver;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_QOS_SETUP_COMPLETE	0x0d
 struct hci_qos {
@@ -678,38 +678,38 @@ struct hci_qos {
 	__u32    peak_bandwidth;
 	__u32    latency;
 	__u32    delay_variation;
-} __attribute__ ((packed));
+} __packed;
 struct hci_ev_qos_setup_complete {
 	__u8     status;
 	__le16   handle;
 	struct   hci_qos qos;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_CMD_COMPLETE		0x0e
 struct hci_ev_cmd_complete {
 	__u8     ncmd;
 	__le16   opcode;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_CMD_STATUS		0x0f
 struct hci_ev_cmd_status {
 	__u8     status;
 	__u8     ncmd;
 	__le16   opcode;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_ROLE_CHANGE		0x12
 struct hci_ev_role_change {
 	__u8     status;
 	bdaddr_t bdaddr;
 	__u8     role;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_NUM_COMP_PKTS		0x13
 struct hci_ev_num_comp_pkts {
 	__u8     num_hndl;
 	/* variable length part */
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_MODE_CHANGE		0x14
 struct hci_ev_mode_change {
@@ -717,44 +717,44 @@ struct hci_ev_mode_change {
 	__le16   handle;
 	__u8     mode;
 	__le16   interval;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_PIN_CODE_REQ		0x16
 struct hci_ev_pin_code_req {
 	bdaddr_t bdaddr;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_LINK_KEY_REQ		0x17
 struct hci_ev_link_key_req {
 	bdaddr_t bdaddr;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_LINK_KEY_NOTIFY		0x18
 struct hci_ev_link_key_notify {
 	bdaddr_t bdaddr;
 	__u8     link_key[16];
 	__u8     key_type;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_CLOCK_OFFSET		0x1c
 struct hci_ev_clock_offset {
 	__u8     status;
 	__le16   handle;
 	__le16   clock_offset;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_PKT_TYPE_CHANGE		0x1d
 struct hci_ev_pkt_type_change {
 	__u8     status;
 	__le16   handle;
 	__le16   pkt_type;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_PSCAN_REP_MODE		0x20
 struct hci_ev_pscan_rep_mode {
 	bdaddr_t bdaddr;
 	__u8     pscan_rep_mode;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_INQUIRY_RESULT_WITH_RSSI	0x22
 struct inquiry_info_with_rssi {
@@ -764,7 +764,7 @@ struct inquiry_info_with_rssi {
 	__u8     dev_class[3];
 	__le16   clock_offset;
 	__s8     rssi;
-} __attribute__ ((packed));
+} __packed;
 struct inquiry_info_with_rssi_and_pscan_mode {
 	bdaddr_t bdaddr;
 	__u8     pscan_rep_mode;
@@ -773,7 +773,7 @@ struct inquiry_info_with_rssi_and_pscan_mode {
 	__u8     dev_class[3];
 	__le16   clock_offset;
 	__s8     rssi;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_REMOTE_EXT_FEATURES	0x23
 struct hci_ev_remote_ext_features {
@@ -782,7 +782,7 @@ struct hci_ev_remote_ext_features {
 	__u8     page;
 	__u8     max_page;
 	__u8     features[8];
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_SYNC_CONN_COMPLETE	0x2c
 struct hci_ev_sync_conn_complete {
@@ -795,7 +795,7 @@ struct hci_ev_sync_conn_complete {
 	__le16   rx_pkt_len;
 	__le16   tx_pkt_len;
 	__u8     air_mode;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_SYNC_CONN_CHANGED	0x2d
 struct hci_ev_sync_conn_changed {
@@ -805,7 +805,7 @@ struct hci_ev_sync_conn_changed {
 	__u8     retrans_window;
 	__le16   rx_pkt_len;
 	__le16   tx_pkt_len;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_SNIFF_SUBRATE		0x2e
 struct hci_ev_sniff_subrate {
@@ -815,7 +815,7 @@ struct hci_ev_sniff_subrate {
 	__le16   max_rx_latency;
 	__le16   max_remote_timeout;
 	__le16   max_local_timeout;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_EXTENDED_INQUIRY_RESULT	0x2f
 struct extended_inquiry_info {
@@ -826,37 +826,37 @@ struct extended_inquiry_info {
 	__le16   clock_offset;
 	__s8     rssi;
 	__u8     data[240];
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_IO_CAPA_REQUEST		0x31
 struct hci_ev_io_capa_request {
 	bdaddr_t bdaddr;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_SIMPLE_PAIR_COMPLETE	0x36
 struct hci_ev_simple_pair_complete {
 	__u8     status;
 	bdaddr_t bdaddr;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_REMOTE_HOST_FEATURES	0x3d
 struct hci_ev_remote_host_features {
 	bdaddr_t bdaddr;
 	__u8     features[8];
-} __attribute__ ((packed));
+} __packed;
 
 /* Internal events generated by Bluetooth stack */
 #define HCI_EV_STACK_INTERNAL	0xfd
 struct hci_ev_stack_internal {
 	__u16    type;
 	__u8     data[0];
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_SI_DEVICE	0x01
 struct hci_ev_si_device {
 	__u16    event;
 	__u16    dev_id;
-} __attribute__ ((packed));
+} __packed;
 
 #define HCI_EV_SI_SECURITY	0x02
 struct hci_ev_si_security {
@@ -864,7 +864,7 @@ struct hci_ev_si_security {
 	__u16    proto;
 	__u16    subproto;
 	__u8     incoming;
-} __attribute__ ((packed));
+} __packed;
 
 /* ---- HCI Packet structures ---- */
 #define HCI_COMMAND_HDR_SIZE 3
@@ -875,22 +875,22 @@ struct hci_ev_si_security {
 struct hci_command_hdr {
 	__le16	opcode;		/* OCF & OGF */
 	__u8 	plen;
-} __attribute__ ((packed));
+} __packed;
 
 struct hci_event_hdr {
 	__u8	evt;
 	__u8	plen;
-} __attribute__ ((packed));
+} __packed;
 
 struct hci_acl_hdr {
 	__le16	handle;		/* Handle & Flags(PB, BC) */
 	__le16	dlen;
-} __attribute__ ((packed));
+} __packed;
 
 struct hci_sco_hdr {
 	__le16	handle;
 	__u8	dlen;
-} __attribute__ ((packed));
+} __packed;
 
 #ifdef __KERNEL__
 #include <linux/skbuff.h>
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 4b86c78..636724b 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -131,31 +131,31 @@ struct l2cap_conninfo {
 struct l2cap_hdr {
 	__le16     len;
 	__le16     cid;
-} __attribute__ ((packed));
+} __packed;
 #define L2CAP_HDR_SIZE		4
 
 struct l2cap_cmd_hdr {
 	__u8       code;
 	__u8       ident;
 	__le16     len;
-} __attribute__ ((packed));
+} __packed;
 #define L2CAP_CMD_HDR_SIZE	4
 
 struct l2cap_cmd_rej {
 	__le16     reason;
-} __attribute__ ((packed));
+} __packed;
 
 struct l2cap_conn_req {
 	__le16     psm;
 	__le16     scid;
-} __attribute__ ((packed));
+} __packed;
 
 struct l2cap_conn_rsp {
 	__le16     dcid;
 	__le16     scid;
 	__le16     result;
 	__le16     status;
-} __attribute__ ((packed));
+} __packed;
 
 /* channel indentifier */
 #define L2CAP_CID_SIGNALING	0x0001
@@ -179,14 +179,14 @@ struct l2cap_conf_req {
 	__le16     dcid;
 	__le16     flags;
 	__u8       data[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct l2cap_conf_rsp {
 	__le16     scid;
 	__le16     flags;
 	__le16     result;
 	__u8       data[0];
-} __attribute__ ((packed));
+} __packed;
 
 #define L2CAP_CONF_SUCCESS	0x0000
 #define L2CAP_CONF_UNACCEPT	0x0001
@@ -197,7 +197,7 @@ struct l2cap_conf_opt {
 	__u8       type;
 	__u8       len;
 	__u8       val[0];
-} __attribute__ ((packed));
+} __packed;
 #define L2CAP_CONF_OPT_SIZE	2
 
 #define L2CAP_CONF_HINT		0x80
@@ -218,7 +218,7 @@ struct l2cap_conf_rfc {
 	__le16     retrans_timeout;
 	__le16     monitor_timeout;
 	__le16     max_pdu_size;
-} __attribute__ ((packed));
+} __packed;
 
 #define L2CAP_MODE_BASIC	0x00
 #define L2CAP_MODE_RETRANS	0x01
@@ -229,22 +229,22 @@ struct l2cap_conf_rfc {
 struct l2cap_disconn_req {
 	__le16     dcid;
 	__le16     scid;
-} __attribute__ ((packed));
+} __packed;
 
 struct l2cap_disconn_rsp {
 	__le16     dcid;
 	__le16     scid;
-} __attribute__ ((packed));
+} __packed;
 
 struct l2cap_info_req {
 	__le16      type;
-} __attribute__ ((packed));
+} __packed;
 
 struct l2cap_info_rsp {
 	__le16      type;
 	__le16      result;
 	__u8        data[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* info type */
 #define L2CAP_IT_CL_MTU     0x0001
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index 921d7b3..a140847 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -106,19 +106,19 @@ struct rfcomm_hdr {
 	u8 addr;
 	u8 ctrl;
 	u8 len;    // Actual size can be 2 bytes
-} __attribute__ ((packed));
+} __packed;
 
 struct rfcomm_cmd {
 	u8 addr;
 	u8 ctrl;
 	u8 len;
 	u8 fcs;
-} __attribute__ ((packed));
+} __packed;
 
 struct rfcomm_mcc {
 	u8 type;
 	u8 len;
-} __attribute__ ((packed));
+} __packed;
 
 struct rfcomm_pn {
 	u8  dlci;
@@ -128,7 +128,7 @@ struct rfcomm_pn {
 	__le16 mtu;
 	u8  max_retrans;
 	u8  credits;
-} __attribute__ ((packed));
+} __packed;
 
 struct rfcomm_rpn {
 	u8  dlci;
@@ -138,17 +138,17 @@ struct rfcomm_rpn {
 	u8  xon_char;
 	u8  xoff_char;
 	__le16 param_mask;
-} __attribute__ ((packed));
+} __packed;
 
 struct rfcomm_rls {
 	u8  dlci;
 	u8  status;
-} __attribute__ ((packed));
+} __packed;
 
 struct rfcomm_msc {
 	u8  dlci;
 	u8  v24_sig;
-} __attribute__ ((packed));
+} __packed;
 
 /* ---- Core structures, flags etc ---- */
 
-- 
1.7.1.1

^ permalink raw reply related

* Re: obexd TARGET_SIZE question
From: Luiz Augusto von Dentz @ 2010-07-18 21:29 UTC (permalink / raw)
  To: Marcel J.E. Mol; +Cc: linux-bluetooth
In-Reply-To: <20100718200429.GB17706@joshua.mesa.nl>

Hi,

On Sun, Jul 18, 2010 at 11:04 PM, Marcel J.E. Mol <marcel@mesa.nl> wrote:
> Hi,
>
> I'm trying to understand a part of the obexd code, to see if somehow a
> IrMC server can be implemented. Pierre Ossman already started a bit on this.
>
> I am a bit confused about the obex_mime_type driver structure.
> The find_driver() function does a memcmp0(target, driver->target, TARGET_SIZE),
> but it seems not all drivers have target of size TARGET_SIZE.
>
> The syncevolution plugin has a target of size 11 (whereas TARGET_SIZE=16).
> So the find_driver() probably fails the memcmp0 for this driver as
> the extra 5 bytes to compare my be undefined...
> A IrMC Sync target will have a target_size of 9.
>
> I also noticed the obex_service_driver, which is handled in a similar
> way as the rbex_mime_type_driver. Forrest added a target_size element
> in for this struct (commit b38537e5f12decc4b2444112f4363ff1aa5326c6):
>
>        Forrest Zhao [Mon, 16 Nov 2009 07:17:47 +0000]
>        Introduce target_size to struct obex_service_driver{}
>        Because the OBEX target header length for each OBEX service layer
>        may not be the same.
>
> Shouldn't the same happen for the obex_mime_type_driver() ?
>
> (actually Pierre Ossman did this in his local obexd tree to test IrMC
>  which also has a different target size, I copied these changes in
>  a clone of obexd 0.29)

Yep, that should be fixed, if you guys have patch for it please submit
so we can review/apply.


-- 
Luiz Augusto von Dentz
Computer Engineer

^ permalink raw reply

* obexd TARGET_SIZE question
From: Marcel J.E. Mol @ 2010-07-18 20:04 UTC (permalink / raw)
  To: linux-bluetooth

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset*=utf-8''%E2%80%9Cus-ascii, Size: 1699 bytes --]

Hi, 

I'm trying to understand a part of the obexd code, to see if somehow a
IrMC server can be implemented. Pierre Ossman already started a bit on this.

I am a bit confused about the obex_mime_type driver structure.
The find_driver() function does a memcmp0(target, driver->target, TARGET_SIZE),
but it seems not all drivers have target of size TARGET_SIZE.

The syncevolution plugin has a target of size 11 (whereas TARGET_SIZE=16).
So the find_driver() probably fails the memcmp0 for this driver as
the extra 5 bytes to compare my be undefined...
A IrMC Sync target will have a target_size of 9.

I also noticed the obex_service_driver, which is handled in a similar
way as the rbex_mime_type_driver. Forrest added a target_size element
in for this struct (commit b38537e5f12decc4b2444112f4363ff1aa5326c6):

	Forrest Zhao [Mon, 16 Nov 2009 07:17:47 +0000]
	Introduce target_size to struct obex_service_driver{}
	Because the OBEX target header length for each OBEX service layer
	may not be the same.

Shouldn't the same happen for the obex_mime_type_driver() ?

(actually Pierre Ossman did this in his local obexd tree to test IrMC
 which also has a different target size, I copied these changes in 
 a clone of obexd 0.29)


-Marcel
-- 
     ======--------         Marcel J.E. Mol                MESA Consulting B.V.
    =======---------        ph. +31-(0)6-54724868          P.O. Box 112
    =======---------        marcel@mesa.nl                 2630 AC  Nootdorp
__==== www.mesa.nl ---____U_n_i_x______I_n_t_e_r_n_e_t____ The Netherlands ____
 They couldn't think of a number,           Linux user 1148  --  counter.li.org
    so they gave me a name!  -- Rupert Hine  --  www.ruperthine.com

^ permalink raw reply

* Re: [PATCH] Bluetooth: Enable L2CAP Extended features by default
From: Marcel Holtmann @ 2010-07-18 19:48 UTC (permalink / raw)
  To: Gustavo F. Padovan; +Cc: linux-bluetooth, Gustavo F. Padovan
In-Reply-To: <1279481154-4354-1-git-send-email-gustavo@padovan.org>

Hi Gustavo,

> Change the enable_ertm param to disable_ertm and default value to 0. That
> means that L2CAP Extended features are enabled by default now.
> 
> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
> ---
>  net/bluetooth/l2cap.c |   18 +++++++++---------
>  1 files changed, 9 insertions(+), 9 deletions(-)

patch has been applied. Thanks.

> -module_param(enable_ertm, bool, 0644);
> -MODULE_PARM_DESC(enable_ertm, "Enable enhanced retransmission mode");
> +module_param(disable_ertm, bool, 0644);
> +MODULE_PARM_DESC(disable_ertm, "Enable enhanced retransmission mode");

And I fixed this to say "Disable enhanced ..." ;)

Regards

Marcel



^ permalink raw reply

* [PATCH] Bluetooth: Enable L2CAP Extended features by default
From: Gustavo F. Padovan @ 2010-07-18 19:25 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: marcel, Gustavo F. Padovan

From: Gustavo F. Padovan <padovan@profusion.mobi>

Change the enable_ertm param to disable_ertm and default value to 0. That
means that L2CAP Extended features are enabled by default now.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
---
 net/bluetooth/l2cap.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index d175cc2..ddd2e5b 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -57,7 +57,7 @@
 
 #define VERSION "2.15"
 
-static int enable_ertm = 0;
+static int disable_ertm = 0;
 
 static u32 l2cap_feat_mask = L2CAP_FEAT_FIXED_CHAN;
 static u8 l2cap_fixed_chan[8] = { 0x02, };
@@ -464,7 +464,7 @@ static void l2cap_do_start(struct sock *sk)
 static inline int l2cap_mode_supported(__u8 mode, __u32 feat_mask)
 {
 	u32 local_feat_mask = l2cap_feat_mask;
-	if (enable_ertm)
+	if (!disable_ertm)
 		local_feat_mask |= L2CAP_FEAT_ERTM | L2CAP_FEAT_STREAMING;
 
 	switch (mode) {
@@ -903,7 +903,7 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent)
 	} else {
 		pi->imtu = L2CAP_DEFAULT_MTU;
 		pi->omtu = 0;
-		if (enable_ertm && sk->sk_type == SOCK_STREAM) {
+		if (!disable_ertm && sk->sk_type == SOCK_STREAM) {
 			pi->mode = L2CAP_MODE_ERTM;
 			pi->conf_state |= L2CAP_CONF_STATE2_DEVICE;
 		} else {
@@ -1160,7 +1160,7 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int al
 		break;
 	case L2CAP_MODE_ERTM:
 	case L2CAP_MODE_STREAMING:
-		if (enable_ertm)
+		if (!disable_ertm)
 			break;
 		/* fall through */
 	default:
@@ -1226,7 +1226,7 @@ static int l2cap_sock_listen(struct socket *sock, int backlog)
 		break;
 	case L2CAP_MODE_ERTM:
 	case L2CAP_MODE_STREAMING:
-		if (enable_ertm)
+		if (!disable_ertm)
 			break;
 		/* fall through */
 	default:
@@ -1986,7 +1986,7 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us
 			break;
 		case L2CAP_MODE_ERTM:
 		case L2CAP_MODE_STREAMING:
-			if (enable_ertm)
+			if (!disable_ertm)
 				break;
 			/* fall through */
 		default:
@@ -3302,7 +3302,7 @@ static inline int l2cap_information_req(struct l2cap_conn *conn, struct l2cap_cm
 		struct l2cap_info_rsp *rsp = (struct l2cap_info_rsp *) buf;
 		rsp->type   = cpu_to_le16(L2CAP_IT_FEAT_MASK);
 		rsp->result = cpu_to_le16(L2CAP_IR_SUCCESS);
-		if (enable_ertm)
+		if (!disable_ertm)
 			feat_mask |= L2CAP_FEAT_ERTM | L2CAP_FEAT_STREAMING
 							 | L2CAP_FEAT_FCS;
 		put_unaligned_le32(feat_mask, rsp->data);
@@ -4850,8 +4850,8 @@ EXPORT_SYMBOL(l2cap_load);
 module_init(l2cap_init);
 module_exit(l2cap_exit);
 
-module_param(enable_ertm, bool, 0644);
-MODULE_PARM_DESC(enable_ertm, "Enable enhanced retransmission mode");
+module_param(disable_ertm, bool, 0644);
+MODULE_PARM_DESC(disable_ertm, "Enable enhanced retransmission mode");
 
 MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
 MODULE_DESCRIPTION("Bluetooth L2CAP ver " VERSION);
-- 
1.7.1.1

^ permalink raw reply related

* Re: [PATCH] Bluetooth: Fix typo on hci_event.c
From: Marcel Holtmann @ 2010-07-18 18:44 UTC (permalink / raw)
  To: Gustavo F. Padovan; +Cc: linux-bluetooth, Gustavo F. Padovan
In-Reply-To: <1279476817-15721-1-git-send-email-gustavo@padovan.org>

Hi Gustavo,

> memmory -> memory
> 
> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
> ---
>  net/bluetooth/hci_event.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

patch has been applied. Thanks.

Regards

Marcel



^ permalink raw reply

* [PATCH] Bluetooth: Fix typo on hci_event.c
From: Gustavo F. Padovan @ 2010-07-18 18:13 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: marcel, Gustavo F. Padovan

From: Gustavo F. Padovan <padovan@profusion.mobi>

memmory -> memory

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
---
 net/bluetooth/hci_event.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index a969800..2069c3b 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -584,7 +584,7 @@ static inline void hci_cs_create_conn(struct hci_dev *hdev, __u8 status)
 				conn->out = 1;
 				conn->link_mode |= HCI_LM_MASTER;
 			} else
-				BT_ERR("No memmory for new connection");
+				BT_ERR("No memory for new connection");
 		}
 	}
 
@@ -965,7 +965,7 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk
 		conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr);
 		if (!conn) {
 			if (!(conn = hci_conn_add(hdev, ev->link_type, &ev->bdaddr))) {
-				BT_ERR("No memmory for new connection");
+				BT_ERR("No memory for new connection");
 				hci_dev_unlock(hdev);
 				return;
 			}
-- 
1.7.1.1

^ permalink raw reply related

* Re: [HCI Events] Connection Event  Processing
From: Johan Hedberg @ 2010-07-18  8:02 UTC (permalink / raw)
  To: Shreesh Holla; +Cc: linux-bluetooth
In-Reply-To: <4947.70805.qm@web56502.mail.re3.yahoo.com>

Hi Shreesh,

On Fri, Jul 16, 2010, Shreesh Holla wrote:
> I'm trying to build a  handler for a project and needed to  process the 
> Connection Request Event.
> I'm able to get that  properly. But I tried adding a "reject Connection" - 
> command in the  handler and invariably an "Accept Connection" command is 
> issued.This  is what I can see from hcidump and my event handling code.
> 
> I  need to override that. So where is this done? In the Bluez library,  
> bluetoothd 
> 
> or btusb? Or somewhere else? Or is there some other kind  of setup/hooks that 
> needs to be modified to insert my own event  handler?
> 
> Any help would be great here.

The response to the connect request is more or less hardcoded into the
hci_conn_request_evt function in net/bluetooth/hci_event.c. There's a
patch[1] in the bluetooth-next-2.6 tree which adds blacklist support,
but afaik it's only headed for 2.6.36. It's also only a static list of
addresses to be rejected, so if you want something more dynamic it wont
be of much help.

Another way to avoid the kernel response to the connect request is to
set the HCI device into RAW mode but then you also loose all other
Bluetooth functionality provided by the kernel and userspace (i.e. you'd
essentially need to implement a full host stack yourself).

Johan

[1] http://git.kernel.org/?p=linux/kernel/git/holtmann/bluetooth-next-2.6.git;a=commitdiff;h=a1e716eedbed0bac3e9b84b7f53de182e12345cb

^ permalink raw reply

* Re: [PATCH 1/3] Add BT3 AMP device support, by Atheros Linux BT3 team.
From: Marcel Holtmann @ 2010-07-18  2:00 UTC (permalink / raw)
  To: Bastien Nocera; +Cc: Dan Tian, linux-bluetooth, Haijun Liu, Luis Rodriguez
In-Reply-To: <1279411461.2424.9.camel@localhost.localdomain>

Hi Bastien,

> I'll take this opportunity to ask whether this chip is actually being
> used in currently sold devices, because I'd quite like to add a BT3
> device (or 2) to my collection.

so in theory you can use a Bluetooth 2.1 controller and an AMP driven in
software by mac80211 and you get a Bluetooth 3.0 + HS system.

There are Bluetooth 3.0 controller (note the missing HS), but the
difference to 2.1 is only an extra HCI command and some unicast support.
Otherwise they are the same. For a 3.0 + HS system you need a WiFi
controller that can act as a AMP as well. So essentially you see two HCI
devices. One will be the BR/EDR the other the AMP.

Regards

Marcel



^ permalink raw reply

* Re: [PATCH 1/3] Add BT3 AMP device support, by Atheros Linux BT3 team.
From: Bastien Nocera @ 2010-07-18  0:04 UTC (permalink / raw)
  To: Dan Tian; +Cc: linux-bluetooth, Haijun Liu, Luis Rodriguez
In-Reply-To: <CDAFEDABF718A54BABD0DA5476695307CE881EC1@SHEXMB-01.global.atheros.com>

On Thu, 2010-07-15 at 15:37 +0800, Dan Tian wrote:
> From 40cbfbf5c1bc9109364970956d9b6f74f5846c70 Mon Sep 17 00:00:00 2001
> From: Haijun.Liu <Haijun.Liu@Atheros.com>
> Date: Wed, 14 Jul 2010 22:50:56 +0800
> Subject: [PATCH 1/3] Add BT3 AMP device support, by Atheros Linux BT3 team.

I'll take this opportunity to ask whether this chip is actually being
used in currently sold devices, because I'd quite like to add a BT3
device (or 2) to my collection.

Cheers


^ permalink raw reply

* Re: [PATCH] Bluetooth: Support for Atheros AR300x serial Bluetooth Chip
From: Marcel Holtmann @ 2010-07-17 22:18 UTC (permalink / raw)
  To: Suraj Sumangala; +Cc: linux-bluetooth, Jothikumar.Mothilal, Luis R. Rodriguez
In-Reply-To: <1279191250-5923-1-git-send-email-suraj@atheros.com>

Hi Suraj,

> Implements Atheros AR300x Serial HCI protocol.
> This protocol extends H4 serial protocol to implement enhanced power management
> features supported by Atheros AR300x serial Bluetooth chipsets.

<snip>

> +struct ath_struct {
> +	struct hci_uart *hu;
> +	unsigned int cur_sleep;
> +
> +	spinlock_t hciath_lock;
> +	struct sk_buff *rx_skb;
> +	struct sk_buff_head txq;
> +	wait_queue_head_t wqevt;
> +	struct work_struct ctxtsw;
> +};

I was going to merge this as it is, but then I did a usage check on your
variables here and realized that you carry garbage around. I really
would prefer if you guys start cleaning up your patches before blindly
submitting them. I am not your janitor.

So hciath_lock, rx_skb and wqevt are unused in the whole driver. Please
remove them from the patch.

Regards

Marcel



^ permalink raw reply

* Re: [patch] l2cap: fix signedness bugs
From: Gustavo F. Padovan @ 2010-07-17 17:51 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Marcel Holtmann, David S. Miller, Gustavo F. Padovan,
	João Paulo Rechi Vita, linux-bluetooth, kernel-janitors
In-Reply-To: <20100717170548.GH17585@bicker>

Hi Dan,

* Dan Carpenter <error27@gmail.com> [2010-07-17 19:05:48 +0200]:

> These variables are only used for math.  They should be from -63 to +63.
> In the original code instead of being negative they would be largish
> positive numbers.  I changed them to ints.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
> index 1b682a5..4a13499 100644
> --- a/net/bluetooth/l2cap.c
> +++ b/net/bluetooth/l2cap.c
> @@ -3795,7 +3795,7 @@ static inline int l2cap_data_channel_iframe(struct sock *sk, u16 rx_control, str
>  	u8 tx_seq = __get_txseq(rx_control);
>  	u8 req_seq = __get_reqseq(rx_control);
>  	u8 sar = rx_control >> L2CAP_CTRL_SAR_SHIFT;
> -	u8 tx_seq_offset, expected_tx_seq_offset;
> +	int tx_seq_offset, expected_tx_seq_offset;
>  	int num_to_ack = (pi->tx_win/6) + 1;
>  	int err = 0;
>  
> @@ -4080,7 +4080,7 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk
>  	struct sock *sk;
>  	struct l2cap_pinfo *pi;
>  	u16 control, len;
> -	u8 tx_seq, req_seq, next_tx_seq_offset, req_seq_offset;
> +	int tx_seq, req_seq, next_tx_seq_offset, req_seq_offset;
>  
>  	sk = l2cap_get_chan_by_scid(&conn->chan_list, cid);
>  	if (!sk) {

I fixed this already. Thanks.

-- 
Gustavo F. Padovan
http://padovan.org

^ permalink raw reply

* [patch] l2cap: fix signedness bugs
From: Dan Carpenter @ 2010-07-17 17:05 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: David S. Miller, Gustavo F. Padovan, João Paulo Rechi Vita,
	linux-bluetooth, kernel-janitors

These variables are only used for math.  They should be from -63 to +63.
In the original code instead of being negative they would be largish
positive numbers.  I changed them to ints.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index 1b682a5..4a13499 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -3795,7 +3795,7 @@ static inline int l2cap_data_channel_iframe(struct sock *sk, u16 rx_control, str
 	u8 tx_seq = __get_txseq(rx_control);
 	u8 req_seq = __get_reqseq(rx_control);
 	u8 sar = rx_control >> L2CAP_CTRL_SAR_SHIFT;
-	u8 tx_seq_offset, expected_tx_seq_offset;
+	int tx_seq_offset, expected_tx_seq_offset;
 	int num_to_ack = (pi->tx_win/6) + 1;
 	int err = 0;
 
@@ -4080,7 +4080,7 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk
 	struct sock *sk;
 	struct l2cap_pinfo *pi;
 	u16 control, len;
-	u8 tx_seq, req_seq, next_tx_seq_offset, req_seq_offset;
+	int tx_seq, req_seq, next_tx_seq_offset, req_seq_offset;
 
 	sk = l2cap_get_chan_by_scid(&conn->chan_list, cid);
 	if (!sk) {

^ permalink raw reply related

* Re: bluez installs alsa related stuff under /etc/alsa instead of /usr/share/alsa
From: Pacho Ramos @ 2010-07-17 14:09 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <20100716234429.GA24529@jh-x301>

[-- Attachment #1: Type: text/plain, Size: 468 bytes --]

El vie, 16-07-2010 a las 20:44 -0300, Johan Hedberg escribió:
> Hi,
> 
> On Fri, Jul 16, 2010, Pacho Ramos wrote:
> > From: Pacho Ramos <pacho@condmat1.ciencias.uniovi.es>
> > Date: Fri, 16 Jul 2010 20:38:58 +0200
> > Subject: [PATCH] Install alsa stuff in correct place
> > 
> > ---
> >  Makefile.am |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> The patch is now upstream. Thanks.
> 
> Johan

Great, thanks for committing :-)

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply

* Re: [PATCH] Bluetooth: Support for Atheros AR300x serial Bluetooth Chip
From: Suraj @ 2010-07-17  4:42 UTC (permalink / raw)
  To: Gustavo F. Padovan
  Cc: Suraj Sumangala, linux-bluetooth@vger.kernel.org,
	Jothikumar Mothilal
In-Reply-To: <20100715195214.GA5734@vigoh>

Hi,

*poke*

On 7/16/2010 1:22 AM, Gustavo F. Padovan wrote:
> Hi Suraj,
>
> * Suraj Sumangala<suraj@atheros.com>  [2010-07-15 16:24:10 +0530]:
>
>> Implements Atheros AR300x Serial HCI protocol.
>> This protocol extends H4 serial protocol to implement enhanced power management
>> features supported by Atheros AR300x serial Bluetooth chipsets.
>>
>> Signed-off-by: Suraj Sumangala<suraj@atheros.com>
>> ---
>>   drivers/bluetooth/Kconfig     |   12 ++
>>   drivers/bluetooth/Makefile    |    1 +
>>   drivers/bluetooth/hci_ath.c   |  241 +++++++++++++++++++++++++++++++++++++++++
>>   drivers/bluetooth/hci_ldisc.c |    6 +
>>   drivers/bluetooth/hci_uart.h  |    8 ++-
>>   5 files changed, 267 insertions(+), 1 deletions(-)
>>   create mode 100755 drivers/bluetooth/hci_ath.c
>>
> Patch looks fine, nevertheless I'm unable to test it since I don't have
> such hardware.
>

Can this patch be pushed upstream?

Regards
Suraj


^ permalink raw reply

* [HCI Events] Connection Event  Processing
From: Shreesh Holla @ 2010-07-17  4:09 UTC (permalink / raw)
  To: linux-bluetooth

Hi,

I'm trying to build a  handler for a project and needed to  process the 
Connection Request Event.
I'm able to get that  properly. But I tried adding a "reject Connection" - 
command in the  handler and invariably an "Accept Connection" command is 
issued.This  is what I can see from hcidump and my event handling code.

I  need to override that. So where is this done? In the Bluez library,  
bluetoothd 

or btusb? Or somewhere else? Or is there some other kind  of setup/hooks that 
needs to be modified to insert my own event  handler?

Any help would be great here.

Thanks

Shreesh


^ permalink raw reply

* Re: Secure Simple Pairing Mode - Setting NoInputNoOutput mode
From: Tim Bennett @ 2010-07-16 23:52 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <20100716233715.GA24138@jh-x301>

Hello Johan
On 16-Jul-10 7:37 PM, Johan Hedberg wrote:
> Hi Tim,
>
> On Fri, Jul 16, 2010, Tim Bennett wrote:
>    
>> Is there a method (programmatic or hciconfig - type) to change the Mode of a
>> BT v2.1 dongle to require NoInputNoOutput/JustWorks pairing?
>>
>> I want to make my box (running linux 2.6.30.2 kernel on an arm processor
>> with Bluez 4.67 and a Broadcom v2.1 dongle) pair with another device in the
>> "JustWorks" (NoInputNoOutput) mode.
>>
>> 1. The SSP mode seems to default to "Numeric Comparison" mode.  I am trying
>> to find out how to switch to "Just Works" (NoInputNoOutput mode)
>> Can someone point me to a command or code that would switch my adapter into
>> the NoInputNoOutput mode?
>> Is it something I can configure through hciconfig or through a dbus command?
>>
>>   2. The man page for hciconfig has the command hciconfig hciX sspmode
>> [mode].  Is [mode] only valid for 0 or 1?
>>
>> In looking in hciconfig.c, at the
>> hci_read_simple_pairing_mode/hci_write_simple_pairing_mode functions, there
>> is no clear indication as to what the accepted values are for [mode}
>>      
> You're looking a bit in the wrong place. What you want is an agent that
> registers "NoInputNoOutput" as its IO capability. You could e.g.
> experiment by using test/simple-agent. Find the two places in it that
> say "DisplayYesNo" and change them to "NoInputNoOutput". Then you can
> use that script as a "just works" pairing initator or acceptor.
>
> Johan
>    
Thank you for the kind and quick response and the helpful hint. I shall 
do as suggested!

Tim

^ permalink raw reply

* Re: bluez installs alsa related stuff under /etc/alsa instead of /usr/share/alsa
From: Johan Hedberg @ 2010-07-16 23:44 UTC (permalink / raw)
  To: Pacho Ramos; +Cc: Gustavo F. Padovan, Marcel Holtmann, linux-bluetooth
In-Reply-To: <1279306004.29479.3.camel@localhost.localdomain>

Hi,

On Fri, Jul 16, 2010, Pacho Ramos wrote:
> From: Pacho Ramos <pacho@condmat1.ciencias.uniovi.es>
> Date: Fri, 16 Jul 2010 20:38:58 +0200
> Subject: [PATCH] Install alsa stuff in correct place
> 
> ---
>  Makefile.am |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

The patch is now upstream. Thanks.

Johan

^ permalink raw reply

* Re: Secure Simple Pairing Mode - Setting NoInputNoOutput mode
From: Johan Hedberg @ 2010-07-16 23:37 UTC (permalink / raw)
  To: Tim Bennett; +Cc: linux-bluetooth
In-Reply-To: <4C40AF95.4080505@gmail.com>

Hi Tim,

On Fri, Jul 16, 2010, Tim Bennett wrote:
> Is there a method (programmatic or hciconfig - type) to change the Mode of a
> BT v2.1 dongle to require NoInputNoOutput/JustWorks pairing?
> 
> I want to make my box (running linux 2.6.30.2 kernel on an arm processor
> with Bluez 4.67 and a Broadcom v2.1 dongle) pair with another device in the
> "JustWorks" (NoInputNoOutput) mode.
> 
> 1. The SSP mode seems to default to "Numeric Comparison" mode.  I am trying
> to find out how to switch to "Just Works" (NoInputNoOutput mode)
> Can someone point me to a command or code that would switch my adapter into
> the NoInputNoOutput mode?
> Is it something I can configure through hciconfig or through a dbus command?
> 
>  2. The man page for hciconfig has the command hciconfig hciX sspmode
> [mode].  Is [mode] only valid for 0 or 1?
> 
> In looking in hciconfig.c, at the
> hci_read_simple_pairing_mode/hci_write_simple_pairing_mode functions, there
> is no clear indication as to what the accepted values are for [mode}

You're looking a bit in the wrong place. What you want is an agent that
registers "NoInputNoOutput" as its IO capability. You could e.g.
experiment by using test/simple-agent. Find the two places in it that
say "DisplayYesNo" and change them to "NoInputNoOutput". Then you can
use that script as a "just works" pairing initator or acceptor.

Johan

^ permalink raw reply

* Re: [PATCH] Bluetooth: Move bit-field var to data->flags
From: Marcel Holtmann @ 2010-07-16 20:54 UTC (permalink / raw)
  To: Gustavo F. Padovan; +Cc: linux-bluetooth, Gustavo F. Padovan
In-Reply-To: <1279311633-12131-1-git-send-email-gustavo@padovan.org>

Hi Gustavo,

> did_iso_resume keeps only a bit-field value, so moving that to a proper
> flags place.
> 
> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
> ---
>  drivers/bluetooth/btusb.c |   10 ++++------
>  1 files changed, 4 insertions(+), 6 deletions(-)

patch has been applied. Thanks.

Regards

Marcel



^ 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