* Re: [PATCH 4/6] Bluetooth: trivial: Remove empty line
From: Gustavo Padovan @ 2012-09-08 20:34 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1346933147-11789-4-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
* Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com> [2012-09-06 15:05:44 +0300]:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> net/bluetooth/hci_core.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 8dbbc01..f305e44 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -268,7 +268,6 @@ static void hci_init_req(struct hci_dev *hdev, unsigned long opt)
> BT_ERR("Unknown device type %d", hdev->dev_type);
> break;
> }
> -
> }
>
> static void hci_le_init_req(struct hci_dev *hdev, unsigned long opt)
Patch has been applied to bluetooth-next. Thanks.
Gustavo
^ permalink raw reply
* Re: [PATCH 3/6] Bluetooth: trivial: Make hci_chan_del return void
From: Gustavo Padovan @ 2012-09-08 20:33 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1346933147-11789-3-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
* Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com> [2012-09-06 15:05:43 +0300]:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> Return code is not needed in hci_chan_del
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> include/net/bluetooth/hci_core.h | 2 +-
> net/bluetooth/hci_conn.c | 4 +---
> 2 files changed, 2 insertions(+), 4 deletions(-)
patch has been applied to bluetooth-next.git. Thanks.
Gustavo
^ permalink raw reply
* Re: [PATCH 2/6] Bluetooth: Fix freeing uninitialized delayed works
From: Gustavo Padovan @ 2012-09-08 20:28 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1346933147-11789-2-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
* Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com> [2012-09-06 15:05:42 +0300]:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> When releasing L2CAP socket which is in BT_CONFIG state l2cap_chan_close
> invokes l2cap_send_disconn_req which cancel delayed works which are only
> set in BT_CONNECTED state with l2cap_ertm_init. Add state check before
> cancelling those works.
>
> ...
> [ 9668.574372] [21085] l2cap_sock_release: sock cd065200, sk f073e800
> [ 9668.574399] [21085] l2cap_sock_shutdown: sock cd065200, sk f073e800
> [ 9668.574411] [21085] l2cap_chan_close: chan f073ec00 state BT_CONFIG sk f073e800
> [ 9668.574421] [21085] l2cap_send_disconn_req: chan f073ec00 conn ecc16600
> [ 9668.574441] INFO: trying to register non-static key.
> [ 9668.574443] the code is fine but needs lockdep annotation.
> [ 9668.574446] turning off the locking correctness validator.
> [ 9668.574450] Pid: 21085, comm: obex-client Tainted: G O 3.5.0+ #57
> [ 9668.574452] Call Trace:
> [ 9668.574463] [<c10a64b3>] __lock_acquire+0x12e3/0x1700
> [ 9668.574468] [<c10a44fb>] ? trace_hardirqs_on+0xb/0x10
> [ 9668.574476] [<c15e4f60>] ? printk+0x4d/0x4f
> [ 9668.574479] [<c10a6e38>] lock_acquire+0x88/0x130
> [ 9668.574487] [<c1059740>] ? try_to_del_timer_sync+0x60/0x60
> [ 9668.574491] [<c1059790>] del_timer_sync+0x50/0xc0
> [ 9668.574495] [<c1059740>] ? try_to_del_timer_sync+0x60/0x60
> [ 9668.574515] [<f8aa1c23>] l2cap_send_disconn_req+0xe3/0x160 [bluetooth]
> ...
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> net/bluetooth/l2cap_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
patch has been applied to bluetooth.git. Thanks.
Gustavo
^ permalink raw reply
* Re: [PATCH] Bluetooth: Add support for BCM20702A0 [04ca, 2003]
From: Gustavo Padovan @ 2012-09-08 19:56 UTC (permalink / raw)
To: acho; +Cc: marcel, johan.hedberg, linux-bluetooth, oneukum, jlee, resler
In-Reply-To: <1346914639-11040-1-git-send-email-acho@suse.com>
Hi Acho,
* acho@suse.com <acho@suse.com> [2012-09-06 14:57:19 +0800]:
> From: "Cho, Yu-Chen" <acho@suse.com>
>
> Add another vendor specific ID for BCM20702A0.
>
> output of usb-devices:
> T: Bus=01 Lev=02 Prnt=02 Port=03 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
> D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
> P: Vendor=04ca ProdID=2003 Rev= 1.12
> S: Manufacturer=Broadcom Corp
> S: Product=BCM20702A0
> S: SerialNumber=446D57861623
> C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr= 0mA
> I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
> E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms
> E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
> E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
> I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
> E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms
> E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms
> I: If#= 1 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
> E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms
> E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms
> I: If#= 1 Alt= 2 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
> E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms
> E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms
> I: If#= 1 Alt= 3 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
> E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms
> E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms
> I: If#= 1 Alt= 4 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
> E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms
> E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms
> I: If#= 1 Alt= 5 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
> E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
> E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms
> I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
> E: Ad=84(I) Atr=02(Bulk) MxPS= 32 Ivl=0ms
> E: Ad=04(O) Atr=02(Bulk) MxPS= 32 Ivl=0ms
> I:* If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)
>
> Signed-off-by: Cho, Yu-Chen <acho@suse.com>
> ---
> drivers/bluetooth/btusb.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index f077f4d..75943c3 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -93,6 +93,7 @@ static struct usb_device_id btusb_table[] = {
> { USB_DEVICE(0x0c10, 0x0000) },
>
> /* Broadcom BCM20702A0 */
> + { USB_DEVICE(0x04ca, 0x2003) },
> { USB_DEVICE(0x0489, 0xe042) },
> { USB_DEVICE(0x0a5c, 0x21e3) },
> { USB_DEVICE(0x0a5c, 0x21e6) },
can you rebase this patch against latest bluetooth.git tree. Thanks.
Gustavo
^ permalink raw reply
* Re: [PATCH] Bluetooth: Fix freeing uninitialized delayed works
From: Gustavo Padovan @ 2012-09-08 19:49 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1346760038-3381-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
* Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com> [2012-09-04 15:00:38 +0300]:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> When releasing L2CAP socket which is in BT_CONFIG state l2cap_chan_close
> invokes l2cap_send_disconn_req which cancel delayed works which are only
> set in BT_CONNECTED state with l2cap_ertm_init. Add state check before
> cancelling those works.
>
> ...
> [ 9668.574372] [21085] l2cap_sock_release: sock cd065200, sk f073e800
> [ 9668.574399] [21085] l2cap_sock_shutdown: sock cd065200, sk f073e800
> [ 9668.574411] [21085] l2cap_chan_close: chan f073ec00 state BT_CONFIG sk f073e800
> [ 9668.574421] [21085] l2cap_send_disconn_req: chan f073ec00 conn ecc16600
> [ 9668.574441] INFO: trying to register non-static key.
> [ 9668.574443] the code is fine but needs lockdep annotation.
> [ 9668.574446] turning off the locking correctness validator.
> [ 9668.574450] Pid: 21085, comm: obex-client Tainted: G O 3.5.0+ #57
> [ 9668.574452] Call Trace:
> [ 9668.574463] [<c10a64b3>] __lock_acquire+0x12e3/0x1700
> [ 9668.574468] [<c10a44fb>] ? trace_hardirqs_on+0xb/0x10
> [ 9668.574476] [<c15e4f60>] ? printk+0x4d/0x4f
> [ 9668.574479] [<c10a6e38>] lock_acquire+0x88/0x130
> [ 9668.574487] [<c1059740>] ? try_to_del_timer_sync+0x60/0x60
> [ 9668.574491] [<c1059790>] del_timer_sync+0x50/0xc0
> [ 9668.574495] [<c1059740>] ? try_to_del_timer_sync+0x60/0x60
> [ 9668.574515] [<f8aa1c23>] l2cap_send_disconn_req+0xe3/0x160 [bluetooth]
> ...
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> net/bluetooth/l2cap_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Please rebase this patch on top of bluetooth.git. It is a important fix.
Thanks.
Gustavo
^ permalink raw reply
* Re: [PATCH v3 2/2] Bluetooth: mgmt: Fix enabling LE while powered off
From: Gustavo Padovan @ 2012-09-08 19:46 UTC (permalink / raw)
To: Andrzej Kaczmarek; +Cc: linux-bluetooth, stable
In-Reply-To: <1346227329-1686-2-git-send-email-andrzej.kaczmarek@tieto.com>
Hi Andrzej,
* Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com> [2012-08-29 10:02:09 +0200]:
> When new BT USB adapter is plugged in it's configured while still being powered
> off (HCI_AUTO_OFF flag is set), thus Set LE will only set dev_flags but won't
> write changes to controller. As a result it's not possible to start device
> discovery session on LE controller as it uses interleaved discovery which
> requires LE Supported Host flag in extended features.
>
> This patch ensures HCI Write LE Host Supported is sent when Set Powered is
> called to power on controller and clear HCI_AUTO_OFF flag.
>
> Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
> Cc: stable@vger.kernel.org
> ---
> net/bluetooth/mgmt.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
Both patches have been applied to bluetooth.git. Thanks
Gustavo
^ permalink raw reply
* Re: [PATCH] Bluetooth: Make hci_chan_del return void
From: Gustavo Padovan @ 2012-09-08 19:40 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1346224851-16625-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
* Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com> [2012-08-29 10:20:51 +0300]:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> Return code is not needed in hci_chan_del
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> include/net/bluetooth/hci_core.h | 2 +-
> net/bluetooth/hci_conn.c | 4 +---
> 2 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> index 0964954..36720f0 100644
> --- a/include/net/bluetooth/hci_core.h
> +++ b/include/net/bluetooth/hci_core.h
> @@ -573,7 +573,7 @@ void hci_conn_hash_flush(struct hci_dev *hdev);
> void hci_conn_check_pending(struct hci_dev *hdev);
>
> struct hci_chan *hci_chan_create(struct hci_conn *conn);
> -int hci_chan_del(struct hci_chan *chan);
> +void hci_chan_del(struct hci_chan *chan);
> void hci_chan_list_flush(struct hci_conn *conn);
> struct hci_chan *hci_chan_lookup_handle(struct hci_conn *hcon, __u16 handle);
> struct hci_chan *hci_chan_lookup_handle_all(struct hci_dev *hdev,
> diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
> index 1c79a76..4695880 100644
> --- a/net/bluetooth/hci_conn.c
> +++ b/net/bluetooth/hci_conn.c
> @@ -935,7 +935,7 @@ struct hci_chan *hci_chan_create(struct hci_conn *conn)
> return chan;
> }
>
> -int hci_chan_del(struct hci_chan *chan)
> +void hci_chan_del(struct hci_chan *chan)
> {
> struct hci_conn *conn = chan->conn;
> struct hci_dev *hdev = conn->hdev;
> @@ -948,8 +948,6 @@ int hci_chan_del(struct hci_chan *chan)
>
> skb_queue_purge(&chan->data_q);
> kfree(chan);
> -
> - return 0;
> }
>
> void hci_chan_list_flush(struct hci_conn *conn) > --
This patch doesn't apply on bluetooth-next anymore, please rebase.
Gustavo
^ permalink raw reply
* Re: [PATCH 2/2] Bluetooth: Update management interface revision
From: Gustavo Padovan @ 2012-09-08 3:41 UTC (permalink / raw)
To: Johan Hedberg; +Cc: linux-bluetooth
In-Reply-To: <1346945967-19424-2-git-send-email-johan.hedberg@gmail.com>
Hi Johan,
* Johan Hedberg <johan.hedberg@gmail.com> [2012-09-06 18:39:27 +0300]:
> From: Johan Hedberg <johan.hedberg@intel.com>
>
> For each kernel release where commands or events are added to the
> management interface, the revision field should be increment by one.
>
> The increment should only happen once per kernel release and not
> for every command/event that gets added. The revision value is for
> informational purposes only, but this simple policy would make any
> future debugging a lot simple.
>
> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
> ---
> net/bluetooth/mgmt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Both patches have been applied to bluetooth.git. Thanks.
Gustavo
^ permalink raw reply
* Re: [PATCH 1/2] Implement broadcom patchram firmware loader
From: Marcel Holtmann @ 2012-09-07 20:32 UTC (permalink / raw)
To: Jesse Sung; +Cc: linux-bluetooth
In-Reply-To: <CAH10aOj2VP2W1MPxLztWR4-enOmaLF=oyC2zg898-f9vyf0sJQ@mail.gmail.com>
Hi Jesse,
> >> static int btusb_probe(struct usb_interface *intf,
> >> const struct usb_device_id *id)
> >> {
> >> @@ -1078,15 +1162,26 @@ static int btusb_probe(struct usb_interface *intf,
> >> }
> >> }
> >>
> >> + usb_set_intfdata(intf, data);
> >> +
> >> + if (id->driver_info & BTUSB_BCM_PATCHRAM) {
> >> + const struct usb_device_id *match;
> >> + match = usb_match_id(intf, patchram_table);
> >> + if (match) {
> >> + btusb_open(hdev);
> >> + load_patchram_fw(interface_to_usbdev(intf), match);
> >> + btusb_close(hdev);
> >> + }
> >> + }
> >> +
> >
> > So we are now blocking every other USB devices on that bus here? I
> > actually do not like this idea very much.
>
> Do you mean the usleep() in load_patchram_fw()? These only affects people
> who have this kind of device, so the impact should be limited.
and what about the global USB lock that is hold when probing devices.
> > Also the call of btusb_open() before hdev is actually registered is
> > kinda fishy to me. I am not even sure that works how you think it would.
>
> Humm.. If there are concerns about calling btusb_open() and btusb_close(),
> I'll try to find another way to hook usb callbacks.
They are callbacks exposed from hci_dev and not for direct calling.
I have been telling this before multiple times. If you require a
firmware patching stage, then integrate that into hci_dev directly and
use the core for driving this properly.
> > And why can't Broadcom just change the PID once the patchram has been
> > loaded to something else. That way we can nicely iterate through this.
>
> Unfortunately that's how they do it now, and these modules are already in
> users' machines.
Some companies never ever learn. Most funny is that we had the bcm203x
driver that was doing this correctly. And 8 years later they have
forgotten all about it.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH 10/10] drivers/bluetooth/btuart_cs.c: removes unnecessary semicolon
From: Marcel Holtmann @ 2012-09-07 20:22 UTC (permalink / raw)
To: Peter Senna Tschudin
Cc: kernel-janitors, Julia.Lawall, Gustavo Padovan, Johan Hedberg,
linux-bluetooth, linux-kernel
In-Reply-To: <1347031488-26598-10-git-send-email-peter.senna@gmail.com>
Hi Peter,
> removes unnecessary semicolon
>
> Found by Coccinelle: http://coccinelle.lip6.fr/
>
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
>
> ---
> drivers/bluetooth/btuart_cs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply
* Re: [PATCH 5/10] drivers/bluetooth/hci_vhci.c: removes unnecessary semicolon
From: Marcel Holtmann @ 2012-09-07 20:21 UTC (permalink / raw)
To: Peter Senna Tschudin
Cc: kernel-janitors, Julia.Lawall, Gustavo Padovan, Johan Hedberg,
linux-bluetooth, linux-kernel
In-Reply-To: <1347031488-26598-9-git-send-email-peter.senna@gmail.com>
Hi Peter,
> removes unnecessary semicolon
>
> Found by Coccinelle: http://coccinelle.lip6.fr/
>
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
>
> ---
> drivers/bluetooth/hci_vhci.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply
* Re: [PATCH 4/10] drivers/bluetooth/hci_ll.c: removes unnecessary semicolon
From: Marcel Holtmann @ 2012-09-07 20:21 UTC (permalink / raw)
To: Peter Senna Tschudin
Cc: kernel-janitors, Julia.Lawall, Gustavo Padovan, Johan Hedberg,
linux-bluetooth, linux-kernel
In-Reply-To: <1347031488-26598-4-git-send-email-peter.senna@gmail.com>
Hi Peter,
> removes unnecessary semicolon
>
> Found by Coccinelle: http://coccinelle.lip6.fr/
>
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
>
> ---
> drivers/bluetooth/hci_ll.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply
* Re: [PATCH 3/10] drivers/bluetooth/hci_ldisc.c: removes unnecessary semicolon
From: Marcel Holtmann @ 2012-09-07 20:21 UTC (permalink / raw)
To: Peter Senna Tschudin
Cc: kernel-janitors, Julia.Lawall, Gustavo Padovan, Johan Hedberg,
linux-bluetooth, linux-kernel
In-Reply-To: <1347031488-26598-1-git-send-email-peter.senna@gmail.com>
Hi Peter,
> removes unnecessary semicolon
>
> Found by Coccinelle: http://coccinelle.lip6.fr/
>
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
>
> ---
> drivers/bluetooth/hci_ldisc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply
* Re: [PATCH 2/10] drivers/bluetooth/bluecard_cs.c: removes unnecessary semicolon
From: Marcel Holtmann @ 2012-09-07 20:20 UTC (permalink / raw)
To: Peter Senna Tschudin
Cc: kernel-janitors, Julia.Lawall, Gustavo Padovan, Johan Hedberg,
linux-bluetooth, linux-kernel
In-Reply-To: <1347031488-26598-2-git-send-email-peter.senna@gmail.com>
Hi Peter,
> removes unnecessary semicolon
>
> Found by Coccinelle: http://coccinelle.lip6.fr/
>
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
>
> ---
> drivers/bluetooth/bluecard_cs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply
* Re: [PATCH BlueZ v3 06/15] gdbus: Implement DBus.Properties.Set method
From: Marcel Holtmann @ 2012-09-07 20:19 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: Lucas De Marchi, linux-bluetooth
In-Reply-To: <CABBYNZJhaZkixESrBAjaczGpFgysB8CKv12FFw2fLhBG-h-1yg@mail.gmail.com>
Hi Luiz,
> >> >> Contrary to Get() and GetAll(), Set is asynchronous so we pass on the
> >> >> DBusMessage so user is able to create the response. It's the only use of
> >> >> this parameter.
> >> >> ---
> >> >> gdbus/gdbus.h | 7 +++++++
> >> >> gdbus/object.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
> >> >> 2 files changed, 64 insertions(+), 2 deletions(-)
> >> >>
> >> >> diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h
> >> >> index b2e78c4..3e4aa16 100644
> >> >> --- a/gdbus/gdbus.h
> >> >> +++ b/gdbus/gdbus.h
> >> >> @@ -31,6 +31,8 @@ extern "C" {
> >> >> #include <dbus/dbus.h>
> >> >> #include <glib.h>
> >> >>
> >> >> +typedef enum GDBusPropertySetReturn GDBusPropertySetReturn;
> >> >> +
> >> >> typedef enum GDBusMethodFlags GDBusMethodFlags;
> >> >> typedef enum GDBusSignalFlags GDBusSignalFlags;
> >> >> typedef enum GDBusPropertyFlags GDBusPropertyFlags;
> >> >> @@ -69,6 +71,10 @@ typedef DBusMessage * (* GDBusMethodFunction) (DBusConnection *connection,
> >> >> typedef gboolean (*GDBusPropertyGetter)(const GDBusPropertyTable *property,
> >> >> DBusMessageIter *iter, void *data);
> >> >>
> >> >> +typedef DBusMessage *(*GDBusPropertySetter)(const GDBusPropertyTable *property,
> >> >> + DBusMessageIter *value,
> >> >> + DBusMessage *msg, void *data);
> >> >> +
> >> >
> >> > I am not really happy with this. We just need a unique handle here since
> >> > the return value is either success or an error. I rather don't send
> >> > messages around for no other reason to create the error.
> >> >
> >> > Inside the authorization code I am using GDBusPendingReply as unique
> >> > token. What about using the same approach?
> >>
> >> It would be perfect, but Im afraid sometimes the properties can have
> >> restriction on which sender can set them, so perhaps we need to add
> >> the name of the sender as parameter in addiction to just the handle?
> >
> > that should be done through the same security handling we have for the
> > method calls. Don't try to invent something new.
>
> Im afraid you will have to go in detail what you want here, the
> security table seems to be meant for checking privileges in a method
> level while we can probably extend it for properties and have
> privileges also in the properties table, but the security table seems
> to be global not per interface.
you can specify unique integer identifiers as security label to each
method. We could extend that to each property. The security label is
used to pick which security callback to call.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH 1/6] Bluetooth: Fix deadlock when closing socket
From: Mat Martineau @ 2012-09-07 17:00 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: Marcel Holtmann, linux-bluetooth, gustavo
In-Reply-To: <20120907140813.GC22944@aemeltch-MOBL1>
Andrei -
On Fri, 7 Sep 2012, Andrei Emeltchenko wrote:
> Hi Marcel,
>
> On Thu, Sep 06, 2012 at 01:10:51PM -0700, Marcel Holtmann wrote:
>> Hi Mat,
>>
>>>> If we have unacked frames when closing bluetooth socket we deadlock
>>>> since conn->chan_lock, chan->lock and socket lock are taken. Remove
>>>> __l2cap_wait_ack completely.
>>>>
>>>> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>>>
>>> I don't think you want to remove this code completely, at least not
>>> without giving some thought to the problem it is solving.
>>>
>>> The problem is that programs may have an open socket which they send
>>> some data on, then immediately close. There is no feedback when data
>>> is actually sent over the air, so the socket may end up getting torn
>>> down while there is still data in the HCI tx buffer or some data was
>>> lost and needs to be retransmitted. Waiting for an acknowledgement
>>> confirms that the application's sent data made it to the remote
>>> device.
>>>
>>> Without this code, it's difficult to use l2test on a number of
>>> qualification tests. Profiles or applications using ERTM may depend
>>> on the "wait for ack before closing" behavior in order to have a clean
>>> disconnect.
>>
>> isn't that what we have SO_LINGER for?
>
> Looking at the code I suspect that SO_LINGER is not working. Maybe we need
> to merge linger code and wait_ack stuff.
It does look like a bug that the "wait_ack" behavior happens even
without SO_LINGER.
In order to do SO_LINGER right, it would be better to check chan->tx_q
instead of chan->unacked_frames to makes sure all data is sent and
acked. chan->unacked_frames only tells you how many sent frames are
unacked and does not take in to account queued data that hasn't been
sent yet.
--
Mat Martineau
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply
* [PATCH 10/10] drivers/bluetooth/btuart_cs.c: removes unnecessary semicolon
From: Peter Senna Tschudin @ 2012-09-07 15:24 UTC (permalink / raw)
To: Marcel Holtmann
Cc: kernel-janitors, Julia.Lawall, Gustavo Padovan, Johan Hedberg,
linux-bluetooth, linux-kernel
From: Peter Senna Tschudin <peter.senna@gmail.com>
removes unnecessary semicolon
Found by Coccinelle: http://coccinelle.lip6.fr/
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
---
drivers/bluetooth/btuart_cs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -u -p a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c
--- a/drivers/bluetooth/btuart_cs.c
+++ b/drivers/bluetooth/btuart_cs.c
@@ -446,7 +446,7 @@ static int btuart_hci_send_frame(struct
case HCI_SCODATA_PKT:
hdev->stat.sco_tx++;
break;
- };
+ }
/* Prepend skb with frame type */
memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
^ permalink raw reply
* [PATCH 5/10] drivers/bluetooth/hci_vhci.c: removes unnecessary semicolon
From: Peter Senna Tschudin @ 2012-09-07 15:24 UTC (permalink / raw)
To: Marcel Holtmann
Cc: kernel-janitors, Julia.Lawall, Gustavo Padovan, Johan Hedberg,
linux-bluetooth, linux-kernel
From: Peter Senna Tschudin <peter.senna@gmail.com>
removes unnecessary semicolon
Found by Coccinelle: http://coccinelle.lip6.fr/
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
---
drivers/bluetooth/hci_vhci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -u -p a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
--- a/drivers/bluetooth/hci_vhci.c
+++ b/drivers/bluetooth/hci_vhci.c
@@ -156,7 +156,7 @@ static inline ssize_t vhci_put_user(stru
case HCI_SCODATA_PKT:
data->hdev->stat.sco_tx++;
break;
- };
+ }
return total;
}
^ permalink raw reply
* [PATCH 4/10] drivers/bluetooth/hci_ll.c: removes unnecessary semicolon
From: Peter Senna Tschudin @ 2012-09-07 15:24 UTC (permalink / raw)
To: Marcel Holtmann
Cc: kernel-janitors, Julia.Lawall, Gustavo Padovan, Johan Hedberg,
linux-bluetooth, linux-kernel
From: Peter Senna Tschudin <peter.senna@gmail.com>
removes unnecessary semicolon
Found by Coccinelle: http://coccinelle.lip6.fr/
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
---
drivers/bluetooth/hci_ll.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -u -p a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c
--- a/drivers/bluetooth/hci_ll.c
+++ b/drivers/bluetooth/hci_ll.c
@@ -481,7 +481,7 @@ static int ll_recv(struct hci_uart *hu,
hu->hdev->stat.err_rx++;
ptr++; count--;
continue;
- };
+ }
ptr++; count--;
^ permalink raw reply
* [PATCH 2/10] drivers/bluetooth/bluecard_cs.c: removes unnecessary semicolon
From: Peter Senna Tschudin @ 2012-09-07 15:24 UTC (permalink / raw)
To: Marcel Holtmann
Cc: kernel-janitors, Julia.Lawall, Gustavo Padovan, Johan Hedberg,
linux-bluetooth, linux-kernel
From: Peter Senna Tschudin <peter.senna@gmail.com>
removes unnecessary semicolon
Found by Coccinelle: http://coccinelle.lip6.fr/
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
---
drivers/bluetooth/bluecard_cs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -u -p a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c
--- a/drivers/bluetooth/bluecard_cs.c
+++ b/drivers/bluetooth/bluecard_cs.c
@@ -681,7 +681,7 @@ static int bluecard_hci_send_frame(struc
case HCI_SCODATA_PKT:
hdev->stat.sco_tx++;
break;
- };
+ }
/* Prepend skb with frame type */
memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
^ permalink raw reply
* [PATCH 3/10] drivers/bluetooth/hci_ldisc.c: removes unnecessary semicolon
From: Peter Senna Tschudin @ 2012-09-07 15:24 UTC (permalink / raw)
To: Marcel Holtmann
Cc: kernel-janitors, Julia.Lawall, Gustavo Padovan, Johan Hedberg,
linux-bluetooth, linux-kernel
From: Peter Senna Tschudin <peter.senna@gmail.com>
removes unnecessary semicolon
Found by Coccinelle: http://coccinelle.lip6.fr/
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
---
drivers/bluetooth/hci_ldisc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -u -p a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -531,7 +531,7 @@ static int hci_uart_tty_ioctl(struct tty
default:
err = n_tty_ioctl_helper(tty, file, cmd, arg);
break;
- };
+ }
return err;
}
^ permalink raw reply
* [RFC v3 9/9] media: Extend media API with optional acquire
From: Mikel Astiz @ 2012-09-07 15:20 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Mikel Astiz
In-Reply-To: <1347031233-21621-1-git-send-email-mikel.astiz.oss@gmail.com>
From: Mikel Astiz <mikel.astiz@bmw-carit.de>
Acquiring a transport is needed in two different situations: either
we are initiating the audio stream locally, or the remote side initiated
it and thus we are just reacting. In the second case, we would expect
the stream is already available, and otherwise the operation should
fail. This means the media API needs to be extended in order to make
this difference.
This issue is specially relevant in the case of SCO, because the current
approach is racy. With HFP, for example (say BlueZ has the HS role), the
following race condition could be met:
1. Phone has an incoming call and thus starts in-band ringing.
2. SCO connection is accepted and stablished by BlueZ.
3. Gateway interface state is changed to Playing.
4. Exactly afterwards, the user routes the audio to the phone, to have
a private conversation. So the SCO link is closed.
5. In parallel, PulseAudio sees the transition to Playing, and acquires
the transport.
6. BlueZ receives an Acquire() request, but SCO is down. So it tries to
reconnect the SCO link.
The last step is an undesired behavior (the audio is routed back to the
car). BlueZ should be smart enough to know that the SCO connection
shouldn't be reestablished, but this is only possible if the endpoint
provides additional information in the media API.
Note that the API change introduced by this patch is backward
compatible, meaning that older versions of BlueZ will just ignore the
flag. So clients are encouraged to use it without necessarily adding a
dependency to newer versions of BlueZ.
---
audio/transport.c | 5 +++++
doc/media-api.txt | 11 +++++++++++
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/audio/transport.c b/audio/transport.c
index 05bb953..f759e86 100644
--- a/audio/transport.c
+++ b/audio/transport.c
@@ -807,10 +807,15 @@ static DBusMessage *acquire(DBusConnection *conn, DBusMessage *msg,
if (lock == 0)
return btd_error_invalid_args(msg);
+ if (transport->state != TRANSPORT_STATE_PENDING &&
+ g_strstr_len(accesstype, -1, "?") != NULL)
+ return btd_error_failed(msg, "Transport not playing");
+
if (media_transport_acquire(transport, lock) == FALSE)
return btd_error_not_authorized(msg);
owner = media_owner_create(conn, msg, lock);
+
id = transport->resume(transport, owner);
if (id == 0) {
media_transport_release(transport, lock);
diff --git a/doc/media-api.txt b/doc/media-api.txt
index dfbff2e..1934426 100644
--- a/doc/media-api.txt
+++ b/doc/media-api.txt
@@ -282,6 +282,17 @@ Methods dict GetProperties()
"rw": Read and write access
+ The accesstype string can also be combined with a "?"
+ suffix, which will make the request optional. This
+ typically means the transport will only be acquired if
+ it is already available (remote-initiated), but
+ otherwise no request will be sent to the remote side.
+ In this last case the function will fail. Note that,
+ due to compatibility issues with older versions of
+ BlueZ, clients are encouraged to use exactly the same
+ accesstype for Release(), matching the string provided
+ to Acquire().
+
void Release(string accesstype)
Releases file descriptor.
--
1.7.7.6
^ permalink raw reply related
* [RFC v3 8/9] media: Expose transport state in D-Bus
From: Mikel Astiz @ 2012-09-07 15:20 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Mikel Astiz
In-Reply-To: <1347031233-21621-1-git-send-email-mikel.astiz.oss@gmail.com>
From: Mikel Astiz <mikel.astiz@bmw-carit.de>
Extend the Media API to expose the transport state in D-Bus, as a
property of the transport. This way the clients do not have to find
out which is the corresponding profile-specific interface for the
transport.
Additionally, this state along with the automatic release of transports
will allow clients to avoid the "optional release" or "accept remote
release" race condition. For example, with HSP/HFP profiles, the problem
is the following:
1. User suspends SCO in the remote end.
2. BlueZ signals the Playing->Connected state change in D-Bus.
3. Exactly afterwards, the user resumes SCO in the remote end.
4. In parallel, PulseAudio sees the aforementioned transition to
Connected, and thus releases the transport.
5. BlueZ receives a Release() request while SCO is up. So the audio
stream will be suspended.
The last step is an undesired behavior since the user explicitly wanted
to route the audio stream through Bluetooth.
The issue is difficult to reproduce but it can easily be solved by
exposing the transport state in D-Bus.
---
audio/transport.c | 29 +++++++++++++++++++++++++++++
doc/media-api.txt | 8 ++++++++
2 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/audio/transport.c b/audio/transport.c
index 79fa38d..05bb953 100644
--- a/audio/transport.c
+++ b/audio/transport.c
@@ -155,6 +155,22 @@ static transport_lock_t str2lock(const char *str)
return lock;
}
+static const char *state2str(transport_state_t state)
+{
+ switch (state) {
+ case TRANSPORT_STATE_IDLE:
+ case TRANSPORT_STATE_REQUESTING:
+ return "idle";
+ case TRANSPORT_STATE_PENDING:
+ return "pending";
+ case TRANSPORT_STATE_ACQUIRED:
+ case TRANSPORT_STATE_SUSPENDING:
+ return "acquired";
+ }
+
+ return NULL;
+}
+
static gboolean state_in_use(transport_state_t state)
{
switch (state) {
@@ -174,6 +190,7 @@ static void transport_set_state(struct media_transport *transport,
transport_state_t state)
{
transport_state_t old_state = transport->state;
+ const char *str;
if (old_state == state)
return;
@@ -182,6 +199,13 @@ static void transport_set_state(struct media_transport *transport,
DBG("State changed %s: %s -> %s", transport->path, str_state[old_state],
str_state[state]);
+
+ str = state2str(state);
+
+ if (g_strcmp0(str, state2str(old_state)) != 0)
+ emit_property_changed(transport->conn, transport->path,
+ MEDIA_TRANSPORT_INTERFACE, "State",
+ DBUS_TYPE_STRING, &str);
}
void media_transport_destroy(struct media_transport *transport)
@@ -1017,6 +1041,7 @@ void transport_get_properties(struct media_transport *transport,
DBusMessageIter dict;
const char *uuid;
uint8_t codec;
+ const char *state;
dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
@@ -1036,6 +1061,10 @@ void transport_get_properties(struct media_transport *transport,
dict_append_array(&dict, "Configuration", DBUS_TYPE_BYTE,
&transport->configuration, transport->size);
+ /* State */
+ state = state2str(transport->state);
+ dict_append_entry(&dict, "State", DBUS_TYPE_STRING, &state);
+
if (transport->get_properties)
transport->get_properties(transport, &dict);
diff --git a/doc/media-api.txt b/doc/media-api.txt
index e5eeaa0..dfbff2e 100644
--- a/doc/media-api.txt
+++ b/doc/media-api.txt
@@ -317,6 +317,14 @@ Properties object Device [readonly]
Configuration blob, it is used as it is so the size and
byte order must match.
+ string State [readonly]
+
+ Indicates the state of the transport. Possible
+ values are:
+ "idle": not streaming
+ "pending": streaming but not acquired
+ "acquired": streaming and acquired
+
uint16 Delay [readwrite]
Optional. Transport delay in 1/10 of millisecond, this
--
1.7.7.6
^ permalink raw reply related
* [RFC v3 7/9] media: Automatically release transport when HUP
From: Mikel Astiz @ 2012-09-07 15:20 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Mikel Astiz
In-Reply-To: <1347031233-21621-1-git-send-email-mikel.astiz.oss@gmail.com>
From: Mikel Astiz <mikel.astiz@bmw-carit.de>
When the remote end suspends the audio stream, release the transport
automatically without waiting until the clients call Release().
This affects the D-Bus API since clients will get an error when trying
to release the transport afterwards.
However, this should have no real impact, since most clients (i.e.
PulseAudio) would just log some error trace but otherwise ignore the
issue.
---
audio/transport.c | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/audio/transport.c b/audio/transport.c
index 8055791..79fa38d 100644
--- a/audio/transport.c
+++ b/audio/transport.c
@@ -61,7 +61,6 @@ typedef enum {
TRANSPORT_STATE_PENDING, /* Playing but not acquired */
TRANSPORT_STATE_REQUESTING, /* Acquire in progress */
TRANSPORT_STATE_ACQUIRED, /* Acquired and playing */
- TRANSPORT_STATE_POST_ACQUIRE, /* Acquired but later suspended */
TRANSPORT_STATE_SUSPENDING, /* Release in progress */
} transport_state_t;
@@ -70,7 +69,6 @@ static char *str_state[] = {
"TRANSPORT_STATE_PENDING",
"TRANSPORT_STATE_REQUESTING",
"TRANSPORT_STATE_ACQUIRED",
- "TRANSPORT_STATE_POST_ACQUIRE",
"TRANSPORT_STATE_SUSPENDING",
};
@@ -165,7 +163,6 @@ static gboolean state_in_use(transport_state_t state)
return FALSE;
case TRANSPORT_STATE_REQUESTING:
case TRANSPORT_STATE_ACQUIRED:
- case TRANSPORT_STATE_POST_ACQUIRE:
case TRANSPORT_STATE_SUSPENDING:
return TRUE;
}
@@ -1150,10 +1147,18 @@ static void transport_update_playing(struct media_transport *transport,
str_state[transport->state], playing);
if (playing == FALSE) {
- if (transport->state == TRANSPORT_STATE_ACQUIRED)
- transport_set_state(transport,
- TRANSPORT_STATE_POST_ACQUIRE);
- else if (transport->state == TRANSPORT_STATE_PENDING)
+ if (transport->state == TRANSPORT_STATE_ACQUIRED) {
+ /* Remove all owners */
+ while (transport->owners != NULL) {
+ struct media_owner *owner;
+
+ owner = transport->owners->data;
+ media_transport_remove(transport, owner);
+ }
+
+ /* Suspend so that the locks get released */
+ transport->suspend(transport, NULL);
+ } else if (transport->state == TRANSPORT_STATE_PENDING)
transport_set_state(transport, TRANSPORT_STATE_IDLE);
} else if (transport->state == TRANSPORT_STATE_IDLE)
transport_set_state(transport, TRANSPORT_STATE_PENDING);
--
1.7.7.6
^ permalink raw reply related
* [RFC v3 6/9] media: Split transport state based on playing flag
From: Mikel Astiz @ 2012-09-07 15:20 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Mikel Astiz
In-Reply-To: <1347031233-21621-1-git-send-email-mikel.astiz.oss@gmail.com>
From: Mikel Astiz <mikel.astiz@bmw-carit.de>
Split the transport states (formerly in_use) into more specific states
where the stream state (playing or suspended) is explicitly represented,
along with the transitional states (locally initiated suspend and
resume).
---
audio/transport.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 61 insertions(+), 9 deletions(-)
diff --git a/audio/transport.c b/audio/transport.c
index 3026022..8055791 100644
--- a/audio/transport.c
+++ b/audio/transport.c
@@ -57,13 +57,21 @@ typedef enum {
} transport_lock_t;
typedef enum {
- TRANSPORT_STATE_IDLE, /* Not acquired */
- TRANSPORT_STATE_ACQUIRED, /* Acquired (not necessarily playing) */
+ TRANSPORT_STATE_IDLE, /* Not acquired and suspended */
+ TRANSPORT_STATE_PENDING, /* Playing but not acquired */
+ TRANSPORT_STATE_REQUESTING, /* Acquire in progress */
+ TRANSPORT_STATE_ACQUIRED, /* Acquired and playing */
+ TRANSPORT_STATE_POST_ACQUIRE, /* Acquired but later suspended */
+ TRANSPORT_STATE_SUSPENDING, /* Release in progress */
} transport_state_t;
static char *str_state[] = {
"TRANSPORT_STATE_IDLE",
+ "TRANSPORT_STATE_PENDING",
+ "TRANSPORT_STATE_REQUESTING",
"TRANSPORT_STATE_ACQUIRED",
+ "TRANSPORT_STATE_POST_ACQUIRE",
+ "TRANSPORT_STATE_SUSPENDING",
};
struct media_request {
@@ -153,8 +161,12 @@ static gboolean state_in_use(transport_state_t state)
{
switch (state) {
case TRANSPORT_STATE_IDLE:
+ case TRANSPORT_STATE_PENDING:
return FALSE;
+ case TRANSPORT_STATE_REQUESTING:
case TRANSPORT_STATE_ACQUIRED:
+ case TRANSPORT_STATE_POST_ACQUIRE:
+ case TRANSPORT_STATE_SUSPENDING:
return TRUE;
}
@@ -356,6 +368,8 @@ static void a2dp_resume_complete(struct avdtp *session,
media_owner_remove(owner);
+ transport_set_state(transport, TRANSPORT_STATE_ACQUIRED);
+
return;
fail:
@@ -382,7 +396,8 @@ static guint resume_a2dp(struct media_transport *transport,
if (a2dp_sep_lock(sep, a2dp->session) == FALSE)
return 0;
- transport_set_state(transport, TRANSPORT_STATE_ACQUIRED);
+ if (transport->state == TRANSPORT_STATE_IDLE)
+ transport_set_state(transport, TRANSPORT_STATE_REQUESTING);
done:
return a2dp_resume(a2dp->session, sep, a2dp_resume_complete, owner);
@@ -417,7 +432,12 @@ static guint suspend_a2dp(struct media_transport *transport,
if (!owner) {
a2dp_sep_unlock(sep, a2dp->session);
- transport_set_state(transport, TRANSPORT_STATE_IDLE);
+
+ if (a2dp_sep_is_playing(sep))
+ transport_set_state(transport, TRANSPORT_STATE_PENDING);
+ else
+ transport_set_state(transport, TRANSPORT_STATE_IDLE);
+
return 0;
}
@@ -468,6 +488,8 @@ static void headset_resume_complete(struct audio_device *dev, void *user_data)
media_owner_remove(owner);
+ transport_set_state(transport, TRANSPORT_STATE_ACQUIRED);
+
return;
fail:
@@ -486,7 +508,8 @@ static guint resume_headset(struct media_transport *transport,
HEADSET_LOCK_WRITE) == FALSE)
return 0;
- transport_set_state(transport, TRANSPORT_STATE_ACQUIRED);
+ if (transport->state == TRANSPORT_STATE_IDLE)
+ transport_set_state(transport, TRANSPORT_STATE_REQUESTING);
done:
return headset_request_stream(device, headset_resume_complete,
@@ -516,8 +539,15 @@ static guint suspend_headset(struct media_transport *transport,
struct audio_device *device = transport->device;
if (!owner) {
+ headset_state_t state = headset_get_state(device);
+
headset_unlock(device, HEADSET_LOCK_READ | HEADSET_LOCK_WRITE);
- transport_set_state(transport, TRANSPORT_STATE_IDLE);
+
+ if (state == HEADSET_STATE_PLAYING)
+ transport_set_state(transport, TRANSPORT_STATE_PENDING);
+ else
+ transport_set_state(transport, TRANSPORT_STATE_IDLE);
+
return 0;
}
@@ -574,6 +604,8 @@ static void gateway_resume_complete(struct audio_device *dev, GError *err,
media_owner_remove(owner);
+ transport_set_state(transport, TRANSPORT_STATE_ACQUIRED);
+
return;
fail:
@@ -592,7 +624,8 @@ static guint resume_gateway(struct media_transport *transport,
GATEWAY_LOCK_WRITE) == FALSE)
return 0;
- transport_set_state(transport, TRANSPORT_STATE_ACQUIRED);
+ if (transport->state == TRANSPORT_STATE_IDLE)
+ transport_set_state(transport, TRANSPORT_STATE_REQUESTING);
done:
return gateway_request_stream(device, gateway_resume_complete,
@@ -625,8 +658,15 @@ static guint suspend_gateway(struct media_transport *transport,
static int id = 1;
if (!owner) {
+ gateway_state_t state = gateway_get_state(device);
+
gateway_unlock(device, GATEWAY_LOCK_READ | GATEWAY_LOCK_WRITE);
- transport_set_state(transport, TRANSPORT_STATE_IDLE);
+
+ if (state == GATEWAY_STATE_PLAYING)
+ transport_set_state(transport, TRANSPORT_STATE_PENDING);
+ else
+ transport_set_state(transport, TRANSPORT_STATE_IDLE);
+
return 0;
}
@@ -806,6 +846,8 @@ static DBusMessage *release(DBusConnection *conn, DBusMessage *msg,
return btd_error_in_progress(msg);
}
+ transport_set_state(transport, TRANSPORT_STATE_SUSPENDING);
+
id = transport->suspend(transport, owner);
if (id == 0) {
media_transport_remove(transport, owner);
@@ -1104,7 +1146,17 @@ static void headset_nrec_changed(struct audio_device *dev, gboolean nrec,
static void transport_update_playing(struct media_transport *transport,
gboolean playing)
{
- DBG("%s Playing=%d", transport->path, playing);
+ DBG("%s State=%s Playing=%d", transport->path,
+ str_state[transport->state], playing);
+
+ if (playing == FALSE) {
+ if (transport->state == TRANSPORT_STATE_ACQUIRED)
+ transport_set_state(transport,
+ TRANSPORT_STATE_POST_ACQUIRE);
+ else if (transport->state == TRANSPORT_STATE_PENDING)
+ transport_set_state(transport, TRANSPORT_STATE_IDLE);
+ } else if (transport->state == TRANSPORT_STATE_IDLE)
+ transport_set_state(transport, TRANSPORT_STATE_PENDING);
}
static void headset_state_changed(struct audio_device *dev,
--
1.7.7.6
^ 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