Linux bluetooth development
 help / color / mirror / Atom feed
* Re: Unable to Detect Bluetooth Device on Macbook Pro 9,2 (Mid-2012 13")
From: Shea Levy @ 2012-07-31 16:04 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth, linux-kernel@vger.kernel.org
In-Reply-To: <1343749923.1803.68.camel@aeonflux>

On 07/31/2012 11:52 AM, Marcel Holtmann wrote:
> Hi Shea,
>
>> Please CC me on response, I am not subscribed to the list.
>>
>> hcitool is unable to detect my laptop's bluetooth device:
>>
>> $ lsusb
>> Bus 004 Device 009: ID 05ac:821d Apple, Inc.
>> Bus 004 Device 008: ID 05ac:820b Apple, Inc.
>> Bus 004 Device 007: ID 05ac:820a Apple, Inc.
>> Bus 004 Device 006: ID 05ac:0252 Apple, Inc.
>> Bus 004 Device 005: ID 05ac:8242 Apple, Inc. IR Receiver [built-in]
>> Bus 004 Device 004: ID 0a5c:4500 Broadcom Corp. BCM2046B1 USB 2.0 Hub
>> (part of BCM2046 Bluetooth)
>> Bus 004 Device 003: ID 0424:2513 Standard Microsystems Corp.
>> Bus 004 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
>> Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
>> Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
>> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
>> Bus 003 Device 003: ID 05ac:8509 Apple, Inc.
>> Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
>> Bus 003 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
>>
>> $ dmesg
>> <snip>
>> [    4.744248] usb 4-1.8.1.3: new full-speed USB device number 9 using
>> ehci_hcd
>> [    4.822041] usb 4-1.8.1.3: New USB device found, idVendor=05ac,
>> idProduct=821d
>> [    4.822830] usb 4-1.8.1.3: New USB device strings: Mfr=1, Product=2,
>> SerialNumber=0
>> [    4.823582] usb 4-1.8.1.3: Product: Bluetooth USB Host Controller
>> [    4.824329] usb 4-1.8.1.3: Manufacturer: Apple Inc.
>> <snip>
>>
>> $ hciconfig -a
>>
>> $ hcitool dev
>> Devices:
>>
>> $ lsmod | grep bluetooth
>> bluetooth             187731  0
>> rfkill                 15546  2 bluetooth,cfg80211
>> crc16                   1311  2 bluetooth,ext4
>>
>> Any ideas?
> include /sys/kernel/debug/usb/devices details for this device.

Not sure, which device it is, so here's all of bus 4:

T:  Bus=04 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480  MxCh= 2
B:  Alloc=  7/800 us ( 1%), #Int=  8, #Iso=  0
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0002 Rev= 3.05
S:  Manufacturer=Linux 3.5.0 ehci_hcd
S:  Product=EHCI Host Controller
S:  SerialNumber=0000:00:1d.0
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480  MxCh= 8
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=8087 ProdID=0024 Rev= 0.00
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=256ms

T:  Bus=04 Lev=02 Prnt=02 Port=07 Cnt=01 Dev#=  3 Spd=480  MxCh= 3
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=02 MxPS=64 #Cfgs=  1
P:  Vendor=0424 ProdID=2513 Rev= b.b3
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  2mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=01 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   1 Ivl=256ms
I:* If#= 0 Alt= 1 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=02 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   1 Ivl=256ms

T:  Bus=04 Lev=03 Prnt=03 Port=00 Cnt=01 Dev#=  4 Spd=12   MxCh= 3
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0a5c ProdID=4500 Rev= 1.00
S:  Manufacturer=Apple Inc.
S:  Product=BRCM20702 Hub
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 94mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   1 Ivl=255ms

T:  Bus=04 Lev=04 Prnt=04 Port=00 Cnt=01 Dev#=  7 Spd=12   MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=05ac ProdID=820a Rev= 1.00
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=01 Prot=01 Driver=usbhid
E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=10ms

T:  Bus=04 Lev=04 Prnt=04 Port=01 Cnt=02 Dev#=  8 Spd=12   MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=05ac ProdID=820b Rev= 1.00
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=01 Prot=02 Driver=usbhid
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=10ms

T:  Bus=04 Lev=04 Prnt=04 Port=02 Cnt=03 Dev#=  9 Spd=12   MxCh= 0
D:  Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=05ac ProdID=821d Rev= 0.86
S:  Manufacturer=Apple Inc.
S:  Product=Bluetooth USB Host Controller
C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
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=e0(wlcon) Sub=01 Prot=01 Driver=(none)
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=e0(wlcon) Sub=01 Prot=01 Driver=(none)
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=e0(wlcon) Sub=01 Prot=01 Driver=(none)
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=e0(wlcon) Sub=01 Prot=01 Driver=(none)
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=e0(wlcon) Sub=01 Prot=01 Driver=(none)
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=e0(wlcon) Sub=01 Prot=01 Driver=(none)
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)

T:  Bus=04 Lev=03 Prnt=03 Port=01 Cnt=02 Dev#=  5 Spd=1.5  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=05ac ProdID=8242 Rev= 0.16
S:  Manufacturer=Apple Computer, Inc.
S:  Product=IR Receiver
C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=usbhid
E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=10ms

T:  Bus=04 Lev=03 Prnt=03 Port=02 Cnt=03 Dev#=  6 Spd=12   MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=05ac ProdID=0252 Rev= 2.19
S:  Manufacturer=Apple Inc.
S:  Product=Apple Internal Keyboard / Trackpad
C:* #Ifs= 3 Cfg#= 1 Atr=a0 MxPwr= 40mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=01 Prot=01 Driver=usbhid
E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=8ms
I:* If#= 1 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=usbhid
E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
I:* If#= 2 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=01 Prot=02 Driver=bcm5974
E:  Ad=84(I) Atr=03(Int.) MxPS=   8 Ivl=8ms



> Regards
>
> Marcel
>
>

Thanks,
Shea

^ permalink raw reply

* Re: [PATCH] please add VID/PID to ath3k (AR3012)
From: Marcel Holtmann @ 2012-07-31 15:56 UTC (permalink / raw)
  To: Yevgeniy Melnichuk; +Cc: linux-bluetooth, shafi.ath9k, gustavo
In-Reply-To: <CAJKEbdeVZA+WK8AMNCKCrVgpVchMHQ=XyAnZ7w7H0eX2y48evQ@mail.gmail.com>

Hi Yevgeniy,

> the VID/PID in the patch belong to a Sony Vaio T-Series.

read Documentation/SubmittingPatches first. And in addition
include /sys/kernel/debug/usb/devices.

Regards

Marcel



^ permalink raw reply

* [PATCH] please add VID/PID to ath3k (AR3012)
From: Yevgeniy Melnichuk @ 2012-07-31 15:53 UTC (permalink / raw)
  To: marcel; +Cc: linux-bluetooth, shafi.ath9k, gustavo

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

hi,

the VID/PID in the patch belong to a Sony Vaio T-Series.

thx

diff -c2 drivers/bluetooth/ath3k.c drivers/bluetooth-patched/ath3k.c
*** drivers/bluetooth/ath3k.c    2012-07-31 16:09:41.274043862 +0200
--- drivers/bluetooth-patched/ath3k.c    2012-07-31 16:23:59.390051062 +0200
***************
*** 80,83 ****
--- 80,84 ----
      { USB_DEVICE(0x0CF3, 0xE004) },
      { USB_DEVICE(0x0930, 0x0219) },
+     { USB_DEVICE(0x0489, 0xe036) },

      /* Atheros AR5BBU12 with sflash firmware */
***************
*** 109,112 ****
--- 110,115 ----
      { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 },

+     { USB_DEVICE(0x0489, 0xe036), .driver_info = BTUSB_ATH3012 },
+
      { }    /* Terminating entry */
  };
diff -c2 drivers/bluetooth/btusb.c drivers/bluetooth-patched/btusb.c
*** drivers/bluetooth/btusb.c    2012-07-31 16:09:41.274043862 +0200
--- drivers/bluetooth-patched/btusb.c    2012-07-31 16:23:59.390051062 +0200
***************
*** 142,145 ****
--- 142,146 ----
      { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 },
      { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 },
+     { USB_DEVICE(0x0489, 0xe036), .driver_info = BTUSB_ATH3012 },

      /* Atheros AR5BBU12 with sflash firmware */

[-- Attachment #2: Type: text/html, Size: 1375 bytes --]

^ permalink raw reply

* Re: Unable to Detect Bluetooth Device on Macbook Pro 9,2 (Mid-2012 13")
From: Marcel Holtmann @ 2012-07-31 15:52 UTC (permalink / raw)
  To: Shea Levy; +Cc: linux-bluetooth, linux-kernel@vger.kernel.org
In-Reply-To: <5017E234.2000207@shealevy.com>

Hi Shea,

> Please CC me on response, I am not subscribed to the list.
> 
> hcitool is unable to detect my laptop's bluetooth device:
> 
> $ lsusb
> Bus 004 Device 009: ID 05ac:821d Apple, Inc.
> Bus 004 Device 008: ID 05ac:820b Apple, Inc.
> Bus 004 Device 007: ID 05ac:820a Apple, Inc.
> Bus 004 Device 006: ID 05ac:0252 Apple, Inc.
> Bus 004 Device 005: ID 05ac:8242 Apple, Inc. IR Receiver [built-in]
> Bus 004 Device 004: ID 0a5c:4500 Broadcom Corp. BCM2046B1 USB 2.0 Hub 
> (part of BCM2046 Bluetooth)
> Bus 004 Device 003: ID 0424:2513 Standard Microsystems Corp.
> Bus 004 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
> Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> Bus 003 Device 003: ID 05ac:8509 Apple, Inc.
> Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> Bus 003 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
> 
> $ dmesg
> <snip>
> [    4.744248] usb 4-1.8.1.3: new full-speed USB device number 9 using 
> ehci_hcd
> [    4.822041] usb 4-1.8.1.3: New USB device found, idVendor=05ac, 
> idProduct=821d
> [    4.822830] usb 4-1.8.1.3: New USB device strings: Mfr=1, Product=2, 
> SerialNumber=0
> [    4.823582] usb 4-1.8.1.3: Product: Bluetooth USB Host Controller
> [    4.824329] usb 4-1.8.1.3: Manufacturer: Apple Inc.
> <snip>
> 
> $ hciconfig -a
> 
> $ hcitool dev
> Devices:
> 
> $ lsmod | grep bluetooth
> bluetooth             187731  0
> rfkill                 15546  2 bluetooth,cfg80211
> crc16                   1311  2 bluetooth,ext4
> 
> Any ideas?

include /sys/kernel/debug/usb/devices details for this device.

Regards

Marcel



^ permalink raw reply

* Re: [PATCH 0/2] Support for reserving bandwidth on L2CAP socket
From: Luiz Augusto von Dentz @ 2012-07-31 14:10 UTC (permalink / raw)
  To: Manoj Sharma; +Cc: Marcel Holtmann, linux-bluetooth, Anurag Gupta
In-Reply-To: <CAHH5__59tO=+hzz=4gQtx+Eq5Pz7dQ6j1ynO_7_3dQqCMkehWw@mail.gmail.com>

Hi Manoj,

On Tue, Jul 31, 2012 at 2:30 PM, Manoj Sharma <ursmanoj@gmail.com> wrote:
> Hi Luiz,
>
> On 7/30/12, Luiz Augusto von Dentz <luiz.dentz@gmail.com> wrote:
>> Hi Manoj,
>>
>> On Mon, Jul 30, 2012 at 9:30 AM, Manoj Sharma <ursmanoj@gmail.com> wrote:
>>> One problem which I have faced using SO_PRIORITY is explained below.
>>>
>>> Suppose we have 2 links A & B and link A has higher priority than link
>>> B. And outgoing data transfer is active on both links. Now if device
>>> on link A goes far, there would be lot of failures and number of
>>> re-transmissions would increase for link A. Consequently at any time
>>> host would have significant number of packets for link A, getting
>>> accumulated due to poor quality of link.But since link A packets have
>>> higher priority, link B packets would suffer infinitely as long as
>>> link A packet queue in host is non-empty. Thus link B protocols may
>>> fail due to timers expiring and finally disconnection at upper layers.
>>
>> There is a mechanism to avoid starvation, also apparently you didn't
>> study the code since the priority is per L2CAP channel not per link so
>> we are able to prioritize per profile.
>>
> I would check how starvation is avoided. But for your information I
> did observe starvation practically. And I know that priority is per
> L2CAP. I mentioned links based on assumption that AVDTP and OBEX are
> connected with different devices. Hence priority would result into
> priority of connections in such case ;).

There is no such thing of prioritize a connection, the algorithm used
always check every channel of each connection and prioritize the
channel. Maybe you are confusing what some controllers do, the
controller has no idea what L2CAP channel has been configured it only
knows about the ACL connections.

>>> Second problem:
>>> We have two links similar to above scenario. Say link A is being used
>>> by AVDTP and link B is being used by OBEX. Host can come across a
>>> situation where all controller buffers are used by OBEX and AVDTP is
>>> waiting for a free buffer. Now due to some reason (e.g. distance) OBEX
>>> link B goes weak. This results into delay in transmission of OBEX
>>> packets already held by controller and consequently AVDTP packets also
>>> get delayed which causes glitches in music streaming and user
>>> experience goes bad.
>>
>> That is exactly what SO_PRIORITY has fixed, by setting SO_PRIORITY you
>> prioritize AVDTP stream over OBEX which means AVDTP can use a bigger
>> part of the bandwidth while OBEX uses the remaining.
>>
> I disagree. Please try to understand the situation I explained again.
> There can be a scenario when host has only OBEX packets and no AVDTP,
> here irrespective of which channel has what priority OBEX may consume
> all ACL credits. At the same moment OBEX link goes weak (e.g.due to
> distance), this would delay the transmission of all OBEX packets held
> by controller. In the mean time, AVDTP packets reach Bluez but since
> there are no credits left, host would have to delay transmission of
> AVDTP until a OBEX packet is transferred and an NOCP is received. This
> would definitely cause a glitch on AVDTP streaming and end user
> experience would go bad. By reserving credits for AVDTP channel, we
> ensure that OBEX packets doesnt eat up all credits while AVDTP packets
> were absent.

Without the use of guaranteed channels you cannot really guarantee
anything, besides this would throttle OBEX transfer even when there is
nothing streaming on AVDTP which I don't thing is acceptable. Also Ive
never experience such a problem, you can start streaming while
transferring something and that never produced any artifacts in the
headsets I have, the only problem we have right now is paging another
device while AVDTP stream is active may cause some audio glitches and
even that could be avoided by tuning paging parameters while there is
a high priority channel active.

Btw, there is some lack of connection to the code, an OBEX packet
could be quite big but that is not transmitted as it is, it is
actually fragmented into L2CAP and then HCI frames, the HCI frames is
the one being sent to the controller, the moment the AVDTP socket
start producing another socket may be using some/all of the controller
buffers e.g. 8:1021 that is at most 8K bytes of latency to startup the
stream, in fact it is pretty common to audio to have some latency.

>> The credit based algorithmic actually complicates more than solves the
>> problems here because it should actually fail if there is no enough
>> bandwidth as requested, so we would actually need to query how much
>> credits are available, also any type of bandwidth reservation might be
>> overkill with things like variable bit rate where you actually need to
>> know what is maximum possible bandwidth you need to reserve before
>> hand and that credits cannot be reserved by anyone else.
>>
> I agree, but we can provide a mechanism to allow only one channel to
> reserve bandwidth. In most cases it would be AVDTP streaming channel.
> Reserving at least one credit would allow preventing cases where
> non-AVDTP channel eats all credits due to unavailability of AVDTP
> packets. Please mind that since OBEX packets would be reaching bluez
> much faster than AVDTP, such situation may arise very easily.

That raises my suspicious that you are not really testing against
PulseAudio and obexd, PA should be sending packets much faster than
obexd since its IO threads are realtime so it will most likely have
higher priority. Also the latency of OBEX packets are much greater as
each packet is normally 32k-64k compared to AVDTP stream which send
each packet individually (~700 bytes depending on the MTU).

>>> These are the basic problems which I have faced and hence felt
>>> necessity of a similar but different mechanism and came up with this
>>> solution. This solution fixes both of the problems explained above.
>>> Based on the explanation above your suggestion is required further.
>>
>> Could you please show us what system did you find this problem? We
>> could possible help you trying to figure out what is going wrong,
>> please note that SO_PRIORITY support was introduced in 3.0 and some
>> system don't actually use it, in fact so far I think only PulseAudio
>> make use of it.
>>
> Yes, but we forced Bluez AVDTP to use SO_PRIORITY on our system and
> faced the starvation problem explained above. Though I am going to
> study the priority patch again.

Im afraid the problem is not SO_PRIORITY but your audio subsystem
cannot keep up the socket buffer non-empty that would avoid OBEX
taking too much bandwidth, but again that is pretty strange as you
should be written much more frequently to the AVDTP socket to keep the
latency of the audio constant.

-- 
Luiz Augusto von Dentz

^ permalink raw reply

* Re: [PATCH] input: Fix crash when connecting HID keyboard
From: Vinicius Costa Gomes @ 2012-07-31 14:01 UTC (permalink / raw)
  To: Andrzej Kaczmarek; +Cc: linux-bluetooth
In-Reply-To: <1343738904-12556-1-git-send-email-andrzej.kaczmarek@tieto.com>

Hi Andrzej,

On 14:48 Tue 31 Jul, Andrzej Kaczmarek wrote:
> hidp_add_connection should return after setting up security watch when
> connecting HID keyboard, otherwise req will be freed and encrypt_notify
> callback will receive invalid pointer.
> ---

Patch looks good. Ack.

[snip]


Cheers,
-- 
Vinicius

^ permalink raw reply

* [PATCH BlueZ] btmgmt: Fix endianness conversion
From: Anderson Lizardo @ 2012-07-31 13:58 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

Flags field has 32-bit size. Same issue was fixed for mgmtops in
1801a4d45d74c29cebacaab79a07e9961300be41.
---
 tools/btmgmt.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index b2d6c3c..c6d48d3 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -461,7 +461,7 @@ static int mgmt_device_found(int mgmt_sk, uint16_t index,
 		return -EINVAL;
 	}
 
-	flags = btohs(ev->flags);
+	flags = btohl(ev->flags);
 
 	eir_len = bt_get_le16(&ev->eir_len);
 	if (len != sizeof(*ev) + eir_len) {
-- 
1.7.9.5


^ permalink raw reply related

* Unable to Detect Bluetooth Device on Macbook Pro 9,2 (Mid-2012 13")
From: Shea Levy @ 2012-07-31 13:48 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: linux-kernel@vger.kernel.org

Hello,

Please CC me on response, I am not subscribed to the list.

hcitool is unable to detect my laptop's bluetooth device:

$ lsusb
Bus 004 Device 009: ID 05ac:821d Apple, Inc.
Bus 004 Device 008: ID 05ac:820b Apple, Inc.
Bus 004 Device 007: ID 05ac:820a Apple, Inc.
Bus 004 Device 006: ID 05ac:0252 Apple, Inc.
Bus 004 Device 005: ID 05ac:8242 Apple, Inc. IR Receiver [built-in]
Bus 004 Device 004: ID 0a5c:4500 Broadcom Corp. BCM2046B1 USB 2.0 Hub 
(part of BCM2046 Bluetooth)
Bus 004 Device 003: ID 0424:2513 Standard Microsystems Corp.
Bus 004 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 003: ID 05ac:8509 Apple, Inc.
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

$ dmesg
<snip>
[    4.744248] usb 4-1.8.1.3: new full-speed USB device number 9 using 
ehci_hcd
[    4.822041] usb 4-1.8.1.3: New USB device found, idVendor=05ac, 
idProduct=821d
[    4.822830] usb 4-1.8.1.3: New USB device strings: Mfr=1, Product=2, 
SerialNumber=0
[    4.823582] usb 4-1.8.1.3: Product: Bluetooth USB Host Controller
[    4.824329] usb 4-1.8.1.3: Manufacturer: Apple Inc.
<snip>

$ hciconfig -a

$ hcitool dev
Devices:

$ lsmod | grep bluetooth
bluetooth             187731  0
rfkill                 15546  2 bluetooth,cfg80211
crc16                   1311  2 bluetooth,ext4

Any ideas?

Cheers,
Shea Levy

^ permalink raw reply

* [PATCH v2] Bluetooth: Another vendor specific ID for BCM20702A0 [0a5c:21f1]
From: Michal Marek @ 2012-07-31 13:47 UTC (permalink / raw)
  To: linux-bluetooth, marcel; +Cc: linux-kernel
In-Reply-To: <1343431747.1803.12.camel@aeonflux>

T:  Bus=02 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#=  3 Spd=12   MxCh= 0
D:  Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=0a5c ProdID=21f1 Rev= 1.12
S:  Manufacturer=Broadcom Corp
S:  Product=BCM20702A0
S:  SerialNumber=9CB70DCFF833
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: Michal Marek <mmarek@suse.cz>
---
 drivers/bluetooth/btusb.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index e272214..5748b15 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -97,6 +97,7 @@ static struct usb_device_id btusb_table[] = {
 	{ USB_DEVICE(0x0a5c, 0x21e3) },
 	{ USB_DEVICE(0x0a5c, 0x21e6) },
 	{ USB_DEVICE(0x0a5c, 0x21e8) },
+	{ USB_DEVICE(0x0a5c, 0x21f1) },
 	{ USB_DEVICE(0x0a5c, 0x21f3) },
 	{ USB_DEVICE(0x413c, 0x8197) },
 
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH v3 BlueZ] monitor: Fix endianness conversion
From: Anderson Lizardo @ 2012-07-31 13:21 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo
In-Reply-To: <1343672142-18834-1-git-send-email-anderson.lizardo@openbossa.org>

Flags field has 32-bit size. Same issue was fixed for mgmtops in
1801a4d45d74c29cebacaab79a07e9961300be41.
---

v2 -> v3: Fix another occurrence of same bug.

 monitor/control.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/monitor/control.c b/monitor/control.c
index 159ba9d..3f5b990 100644
--- a/monitor/control.c
+++ b/monitor/control.c
@@ -210,7 +210,7 @@ static void mgmt_device_connected(uint16_t len, const void *buf)
 		return;
 	}
 
-	flags = btohs(ev->flags);
+	flags = btohl(ev->flags);
 	ba2str(&ev->addr.bdaddr, str);
 
 	printf("@ Device Connected: %s (%d) flags 0x%4.4x\n",
@@ -357,7 +357,7 @@ static void mgmt_device_found(uint16_t len, const void *buf)
 		return;
 	}
 
-	flags = btohs(ev->flags);
+	flags = btohl(ev->flags);
 	ba2str(&ev->addr.bdaddr, str);
 
 	printf("@ Device Found: %s (%d) rssi %d flags 0x%4.4x\n",
-- 
1.7.9.5


^ permalink raw reply related

* Re: [PATCH BlueZ] mgmtops: Fix endianness conversion
From: Anderson Lizardo @ 2012-07-31 13:18 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo
In-Reply-To: <1343672005-18528-1-git-send-email-anderson.lizardo@openbossa.org>

Hi,

On Mon, Jul 30, 2012 at 2:13 PM, Anderson Lizardo
<anderson.lizardo@openbossa.org> wrote:
> Flags field has 32-bit size. Same issue was fixed for mgmtops in
> 1801a4d45d74c29cebacaab79a07e9961300be41.
> ---

I make a mistake on the subject prefix, please apply v3 instead.

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

^ permalink raw reply

* [PATCH] bluetooth: Improve BNEP extension headers handling
From: Par-Gunnar Hjalmdahl @ 2012-07-31 13:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anurag Gupta, Par-Gunnar Hjalmdahl

Adds handling of extension headers to BNEP control packets.

Signed-off-by: Par-Gunnar Hjalmdahl <par-gunnar.hjalmdahl@stericsson.com>
---
 net/bluetooth/bnep/core.c | 44 +++++++++++++++++++++++++++++++++++---------
 1 file changed, 35 insertions(+), 9 deletions(-)

diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
index 4a6620b..939b6aa 100644
--- a/net/bluetooth/bnep/core.c
+++ b/net/bluetooth/bnep/core.c
@@ -100,7 +100,8 @@ static inline void bnep_set_default_proto_filter(struct bnep_session *s)
 }
 #endif
 
-static int bnep_ctrl_set_netfilter(struct bnep_session *s, __be16 *data, int len)
+static int bnep_ctrl_set_netfilter(struct bnep_session *s, __be16 *data,
+		int len, int *pkt_size)
 {
 	int n;
 
@@ -116,6 +117,8 @@ static int bnep_ctrl_set_netfilter(struct bnep_session *s, __be16 *data, int len
 
 	BT_DBG("filter len %d", n);
 
+	*pkt_size = 2 + n;
+
 #ifdef CONFIG_BT_BNEP_PROTO_FILTER
 	n /= 4;
 	if (n <= BNEP_MAX_PROTO_FILTERS) {
@@ -146,7 +149,8 @@ static int bnep_ctrl_set_netfilter(struct bnep_session *s, __be16 *data, int len
 	return 0;
 }
 
-static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len)
+static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len,
+		int *pkt_size)
 {
 	int n;
 
@@ -162,6 +166,8 @@ static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len)
 
 	BT_DBG("filter len %d", n);
 
+	*pkt_size = 2 + n;
+
 #ifdef CONFIG_BT_BNEP_MC_FILTER
 	n /= (ETH_ALEN * 2);
 
@@ -207,7 +213,8 @@ static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len)
 	return 0;
 }
 
-static int bnep_rx_control(struct bnep_session *s, void *data, int len)
+static int bnep_rx_control(struct bnep_session *s, void *data, int len,
+		int *pkt_size)
 {
 	u8  cmd = *(u8 *)data;
 	int err = 0;
@@ -215,6 +222,8 @@ static int bnep_rx_control(struct bnep_session *s, void *data, int len)
 	data++;
 	len--;
 
+	*pkt_size = 0;
+
 	switch (cmd) {
 	case BNEP_CMD_NOT_UNDERSTOOD:
 	case BNEP_SETUP_CONN_RSP:
@@ -224,15 +233,20 @@ static int bnep_rx_control(struct bnep_session *s, void *data, int len)
 		break;
 
 	case BNEP_FILTER_NET_TYPE_SET:
-		err = bnep_ctrl_set_netfilter(s, data, len);
+		err = bnep_ctrl_set_netfilter(s, data, len, pkt_size);
 		break;
 
 	case BNEP_FILTER_MULTI_ADDR_SET:
-		err = bnep_ctrl_set_mcfilter(s, data, len);
+		err = bnep_ctrl_set_mcfilter(s, data, len, pkt_size);
 		break;
 
-	case BNEP_SETUP_CONN_REQ:
-		err = bnep_send_rsp(s, BNEP_SETUP_CONN_RSP, BNEP_CONN_NOT_ALLOWED);
+	case BNEP_SETUP_CONN_REQ: {
+			u8 uuid_size = *(u8 *)data;
+
+			err = bnep_send_rsp(s, BNEP_SETUP_CONN_RSP,
+					BNEP_CONN_NOT_ALLOWED);
+			*pkt_size = 1 + 2 * uuid_size;
+		}
 		break;
 
 	default: {
@@ -245,6 +259,10 @@ static int bnep_rx_control(struct bnep_session *s, void *data, int len)
 		break;
 	}
 
+	if (*pkt_size > 0)
+		/* Add 1 byte for type field */
+		(*pkt_size)++;
+
 	return err;
 }
 
@@ -252,6 +270,7 @@ static int bnep_rx_extension(struct bnep_session *s, struct sk_buff *skb)
 {
 	struct bnep_ext_hdr *h;
 	int err = 0;
+	int pkt_size;
 
 	do {
 		h = (void *) skb->data;
@@ -264,7 +283,7 @@ static int bnep_rx_extension(struct bnep_session *s, struct sk_buff *skb)
 
 		switch (h->type & BNEP_TYPE_MASK) {
 		case BNEP_EXT_CONTROL:
-			bnep_rx_control(s, skb->data, skb->len);
+			bnep_rx_control(s, skb->data, skb->len, &pkt_size);
 			break;
 
 		default:
@@ -304,7 +323,14 @@ static int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb)
 		goto badframe;
 
 	if ((type & BNEP_TYPE_MASK) == BNEP_CONTROL) {
-		bnep_rx_control(s, skb->data, skb->len);
+		int pkt_size = 0;
+
+		bnep_rx_control(s, skb->data, skb->len, &pkt_size);
+		if (pkt_size > 0 && (type & BNEP_EXT_HEADER)) {
+			skb_pull(skb, pkt_size);
+			if (bnep_rx_extension(s, skb) < 0)
+				goto badframe;
+		}
 		kfree_skb(skb);
 		return 0;
 	}
-- 
1.7.11.1


^ permalink raw reply related

* [PATCH] input: Fix crash when connecting HID keyboard
From: Andrzej Kaczmarek @ 2012-07-31 12:48 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Andrzej Kaczmarek

hidp_add_connection should return after setting up security watch when
connecting HID keyboard, otherwise req will be freed and encrypt_notify
callback will receive invalid pointer.
---
 profiles/input/device.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/profiles/input/device.c b/profiles/input/device.c
index ed178b4..48d397a 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
@@ -663,6 +663,8 @@ static int hidp_add_connection(const struct input_device *idev,
 		iconn->req = req;
 		iconn->sec_watch = g_io_add_watch(iconn->intr_io, G_IO_OUT,
 							encrypt_notify, iconn);
+
+		return 0;
 	}
 
 	err = ioctl_connadd(req);
-- 
1.7.11.3


^ permalink raw reply related

* Re: [PATCH 0/2] Support for reserving bandwidth on L2CAP socket
From: Manoj Sharma @ 2012-07-31 11:30 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: Marcel Holtmann, linux-bluetooth, Anurag Gupta
In-Reply-To: <CABBYNZ+CEJby4JJRd_+A+OjAXO=n8ZZpFqehADSAk-Lgq9A0Eg@mail.gmail.com>

Hi Luiz,

On 7/30/12, Luiz Augusto von Dentz <luiz.dentz@gmail.com> wrote:
> Hi Manoj,
>
> On Mon, Jul 30, 2012 at 9:30 AM, Manoj Sharma <ursmanoj@gmail.com> wrote:
>> One problem which I have faced using SO_PRIORITY is explained below.
>>
>> Suppose we have 2 links A & B and link A has higher priority than link
>> B. And outgoing data transfer is active on both links. Now if device
>> on link A goes far, there would be lot of failures and number of
>> re-transmissions would increase for link A. Consequently at any time
>> host would have significant number of packets for link A, getting
>> accumulated due to poor quality of link.But since link A packets have
>> higher priority, link B packets would suffer infinitely as long as
>> link A packet queue in host is non-empty. Thus link B protocols may
>> fail due to timers expiring and finally disconnection at upper layers.
>
> There is a mechanism to avoid starvation, also apparently you didn't
> study the code since the priority is per L2CAP channel not per link so
> we are able to prioritize per profile.
>
I would check how starvation is avoided. But for your information I
did observe starvation practically. And I know that priority is per
L2CAP. I mentioned links based on assumption that AVDTP and OBEX are
connected with different devices. Hence priority would result into
priority of connections in such case ;).

>> Second problem:
>> We have two links similar to above scenario. Say link A is being used
>> by AVDTP and link B is being used by OBEX. Host can come across a
>> situation where all controller buffers are used by OBEX and AVDTP is
>> waiting for a free buffer. Now due to some reason (e.g. distance) OBEX
>> link B goes weak. This results into delay in transmission of OBEX
>> packets already held by controller and consequently AVDTP packets also
>> get delayed which causes glitches in music streaming and user
>> experience goes bad.
>
> That is exactly what SO_PRIORITY has fixed, by setting SO_PRIORITY you
> prioritize AVDTP stream over OBEX which means AVDTP can use a bigger
> part of the bandwidth while OBEX uses the remaining.
>
I disagree. Please try to understand the situation I explained again.
There can be a scenario when host has only OBEX packets and no AVDTP,
here irrespective of which channel has what priority OBEX may consume
all ACL credits. At the same moment OBEX link goes weak (e.g.due to
distance), this would delay the transmission of all OBEX packets held
by controller. In the mean time, AVDTP packets reach Bluez but since
there are no credits left, host would have to delay transmission of
AVDTP until a OBEX packet is transferred and an NOCP is received. This
would definitely cause a glitch on AVDTP streaming and end user
experience would go bad. By reserving credits for AVDTP channel, we
ensure that OBEX packets doesnt eat up all credits while AVDTP packets
were absent.

> The credit based algorithmic actually complicates more than solves the
> problems here because it should actually fail if there is no enough
> bandwidth as requested, so we would actually need to query how much
> credits are available, also any type of bandwidth reservation might be
> overkill with things like variable bit rate where you actually need to
> know what is maximum possible bandwidth you need to reserve before
> hand and that credits cannot be reserved by anyone else.
>
I agree, but we can provide a mechanism to allow only one channel to
reserve bandwidth. In most cases it would be AVDTP streaming channel.
Reserving at least one credit would allow preventing cases where
non-AVDTP channel eats all credits due to unavailability of AVDTP
packets. Please mind that since OBEX packets would be reaching bluez
much faster than AVDTP, such situation may arise very easily.

>> These are the basic problems which I have faced and hence felt
>> necessity of a similar but different mechanism and came up with this
>> solution. This solution fixes both of the problems explained above.
>> Based on the explanation above your suggestion is required further.
>
> Could you please show us what system did you find this problem? We
> could possible help you trying to figure out what is going wrong,
> please note that SO_PRIORITY support was introduced in 3.0 and some
> system don't actually use it, in fact so far I think only PulseAudio
> make use of it.
>
Yes, but we forced Bluez AVDTP to use SO_PRIORITY on our system and
faced the starvation problem explained above. Though I am going to
study the priority patch again.
>
> --
> Luiz Augusto von Dentz
>
Thanks & best regards,
Manoj

^ permalink raw reply

* Re: [PATCH] Re: A2DP quality (bluetooth-alsa)
From: Luiz Augusto von Dentz @ 2012-07-31 10:09 UTC (permalink / raw)
  To: Siarhei Siamashka; +Cc: linux-bluetooth
In-Reply-To: <CACY+gR3rjZ9_5zJ2yAf7Z+yfa7RsNWBRhNk5NJadpF5_V2TS7Q@mail.gmail.com>

Hi Siarhei,

On Wed, Apr 4, 2012 at 11:12 AM, Siarhei Siamashka
<siarhei.siamashka@gmail.com> wrote:
> On Tue, Apr 3, 2012 at 3:56 AM, qduaty <qduaty@gmail.com> wrote:
>> 2012/4/2 Siarhei Siamashka <siarhei.siamashka@gmail.com>:
>>> Could you provide a short summary for this whole discussion? The
>>> discussion has been changing from bitpool negotiation to SBC codec
>>> improvements back and forth. And now it's becoming hard to follow and
>>> see which problems are still relevant and need to be solved. Also do
>>> you want to work on some code yourself or mostly trying to escalate
>>> the problems?
>>>
>>> A2DP is in the list of ideas for BlueZ GSoC, so maybe that's a good
>>> chance to get some improvements implemented:
>>> http://www.bluez.org/development/gsoc/gsoc-ideas-list-2012/
>>
>> Ok. This is the summary.
>> 1. It was found that Bluez can occasionally limit available bitpool
>> because some devices report a narrow bitpool range that does not
>> reflect their real capabilities. A solution was proposed by means of
>> encoding at a higher bitpool than negotiated, and it was confirmed to
>> both work and not break compatibility, unless it is misused.
>> 2. It was found that Bluez audio sink has quality problems even on
>> high bitpools. An SBC encoder fix was proposed, which (re)enables
>> floating point processing. Tests are needed to confirm whether it
>> improves quality in all cases.
>> 3. It was (previously) found and now confirmed that reducing volume in
>> SBC encoder by a factor of 0.7-0.8 improves quality by eliminating
>> audible effects of clipping in the decoder.
>
> OK, thanks.
>
>> For myself, I'm likely to be done with it. I've already solved the
>> problems that prevented me from using A2DP on Linux. Further work
>> would require more time and I cannot benefit from it (but students
>> obviously can).
>
> Fair enough.
>
>> My proposals:
>> 1. Introduce a less restrictive input format for the audio sink, such
>> as float32. Currently it supports only S16LE, which is not suitable
>> for audio processing (ALSA softvol is a known example).
>> 2. Find out what quality problems the SBC decoder has and fix them.
>> Possibly introduce floating point output to eliminate clipping.
>> 3. Implement proper (adaptive?) clipping prevention in the SBC encoder.

Is there anyone working on this proposals? Specially the decoder seems
to need some optimization as it consumes quite a bit of CPU (6-8% on
my i7) and some people seems to notice some quality issues.


-- 
Luiz Augusto von Dentz

^ permalink raw reply

* Announcing standalone SBC library
From: Marcel Holtmann @ 2012-07-30 21:11 UTC (permalink / raw)
  To: linux-bluetooth

Hello everyone,

I like to announce the new standalone SBC library. It is an exact copy
of the previous internal SBC support within BlueZ.

	http://git.kernel.org/?p=bluetooth/sbc.git

In addition to this new tree, I also tagged and released version 1.0 of
the SBC library. It can be found at the usual location.

	http://www.kernel.org/pub/linux/bluetooth/

For BlueZ 5.0, the internal SBC support will be removed. And we are
making GStreamer integration and PulseAudio support depend on this new
library. So it is time to get this packaged and included into the
various distributions.

Regards

Marcel



^ permalink raw reply

* [PATCH BlueZ v2 3/3] rfcomm: Fix typo in man page
From: Lucas De Marchi @ 2012-07-30 20:06 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Lucas De Marchi
In-Reply-To: <1343678773-24050-1-git-send-email-lucas.demarchi@profusion.mobi>

---
 tools/rfcomm.1 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/rfcomm.1 b/tools/rfcomm.1
index f880f52..51df284 100644
--- a/tools/rfcomm.1
+++ b/tools/rfcomm.1
@@ -108,7 +108,7 @@ parameters.
 .TP
 .BI bind " <dev> [bdaddr] [channel]"
 This binds the RFCOMM device to a remote Bluetooth device. The
-command did not establish a connection to the remote device, it
+command does not establish a connection to the remote device, it
 only creates the binding. The connection will be established right
 after an application tries to open the RFCOMM device. If no channel
 number is specified, it uses the channel number 1.
-- 
1.7.11.3


^ permalink raw reply related

* [PATCH BlueZ v2 2/3] rfcomm: Remove support for configuration file
From: Lucas De Marchi @ 2012-07-30 20:06 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Lucas De Marchi
In-Reply-To: <1343678773-24050-1-git-send-email-lucas.demarchi@profusion.mobi>

---
 .gitignore        |   5 --
 Makefile.tools    |  15 +----
 configure.ac      |   2 -
 tools/kword.c     |  65 ---------------------
 tools/kword.h     |  46 ---------------
 tools/lexer.l     | 120 --------------------------------------
 tools/parser.y    | 171 ------------------------------------------------------
 tools/rfcomm.1    |  19 +-----
 tools/rfcomm.c    |  99 ++++++-------------------------
 tools/rfcomm.conf |  17 ------
 10 files changed, 23 insertions(+), 536 deletions(-)
 delete mode 100644 tools/kword.c
 delete mode 100644 tools/kword.h
 delete mode 100644 tools/lexer.l
 delete mode 100644 tools/parser.y
 delete mode 100644 tools/rfcomm.conf

diff --git a/.gitignore b/.gitignore
index 38318cd..c9f293a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,11 +26,6 @@ missing
 stamp-h1
 autom4te.cache
 
-ylwrap
-lexer.c
-parser.h
-parser.c
-
 bluez.pc
 lib/bluetooth
 src/builtin.h
diff --git a/Makefile.tools b/Makefile.tools
index 5579b86..d3b6f57 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -1,9 +1,5 @@
 
 if TOOLS
-if DATAFILES
-conf_DATA += tools/rfcomm.conf
-endif
-
 bin_PROGRAMS += tools/rfcomm tools/l2ping \
 				tools/hcitool tools/sdptool tools/ciptool
 
@@ -12,12 +8,7 @@ sbin_PROGRAMS += tools/hciattach tools/hciconfig
 noinst_PROGRAMS += tools/avinfo tools/ppporc \
 				tools/hcieventmask tools/hcisecfilter
 
-tools/kword.c: tools/parser.h
-
-tools_rfcomm_SOURCES = tools/rfcomm.c tools/parser.y tools/lexer.l \
-					tools/kword.h tools/kword.c
-EXTRA_tools_rfcomm_SOURCES = tools/parser.h tools/parser.c \
-							tools/lexer.c
+tools_rfcomm_SOURCES = tools/rfcomm.c
 tools_rfcomm_LDADD = lib/libbluetooth-private.la
 
 tools_l2ping_LDADD = lib/libbluetooth-private.la
@@ -88,10 +79,6 @@ EXTRA_DIST += tools/rfcomm.1 tools/l2ping.8 \
 			tools/hcitool.1 tools/sdptool.1 tools/ciptool.1
 endif
 
-CLEANFILES += tools/lexer.c tools/parser.c tools/parser.h
-
-EXTRA_DIST += tools/rfcomm.conf
-
 if BCCMD
 sbin_PROGRAMS += tools/bccmd
 
diff --git a/configure.ac b/configure.ac
index 7f331ae..7d9a34d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,8 +20,6 @@ AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_CC_PIE
 AC_PROG_INSTALL
-AC_PROG_YACC
-AM_PROG_LEX
 AM_PROG_MKDIR_P
 
 m4_define([_LT_AC_TAGCONFIG], [])
diff --git a/tools/kword.c b/tools/kword.c
deleted file mode 100644
index 62e24fe..0000000
--- a/tools/kword.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- *  BlueZ - Bluetooth protocol stack for Linux
- *
- *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
- *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <sys/socket.h>
-
-#include <bluetooth/bluetooth.h>
-#include <bluetooth/rfcomm.h>
-
-#include "kword.h"
-#include "parser.h"
-
-int lineno;
-
-struct keyword_t rfcomm_keyword[] = {
-	{ "bind",	K_BIND		},
-	{ "device",	K_DEVICE	},
-	{ "channel",	K_CHANNEL	},
-	{ "comment",	K_COMMENT	},
-
-	{ "yes",	K_YES		},
-	{ "no",		K_NO		},
-	{ "enable",	K_YES		},
-	{ "disable",	K_NO		},
-
-	{ NULL , 0 }
-};
-
-int rfcomm_find_keyword(struct keyword_t *keyword, char *string)
-{
-	while (keyword->string) {
-		if (!strcmp(string, keyword->string))
-			return keyword->type;
-		keyword++;
-	}
-
-	return -1;
-}
-
-struct rfcomm_opts rfcomm_opts[RFCOMM_MAX_DEV];
diff --git a/tools/kword.h b/tools/kword.h
deleted file mode 100644
index 81a2a88..0000000
--- a/tools/kword.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *
- *  BlueZ - Bluetooth protocol stack for Linux
- *
- *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
- *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- */
-
-extern int lineno;
-
-struct keyword_t {
-	char *string;
-	int type;
-};
-
-extern struct keyword_t rfcomm_keyword[];
-
-int rfcomm_find_keyword(struct keyword_t *keyword, char *string);
-
-#define MAXCOMMENTLEN  100
-
-struct rfcomm_opts {
-	int bind;
-	bdaddr_t bdaddr;
-	int channel;
-	char comment[MAXCOMMENTLEN + 1];
-};
-
-extern struct rfcomm_opts rfcomm_opts[RFCOMM_MAX_DEV];
-
-int rfcomm_read_config(char *filename);
diff --git a/tools/lexer.l b/tools/lexer.l
deleted file mode 100644
index ff9ce81..0000000
--- a/tools/lexer.l
+++ /dev/null
@@ -1,120 +0,0 @@
-%{
-/*
- *
- *  BlueZ - Bluetooth protocol stack for Linux
- *
- *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
- *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-/* Nasty workaround, but flex defines isatty() twice */
-#define _UNISTD_H
-
-#include <stdio.h>
-#include <errno.h>
-#include <sys/socket.h>
-
-#include <bluetooth/bluetooth.h>
-#include <bluetooth/rfcomm.h>
-
-#include "kword.h"
-#include "parser.h"
-
-int yylex(void);
-
-#define YY_NO_INPUT
-
-#define ECHO {;}
-#define YY_DECL int yylex(void)
-
-int yyerror(char *str);
-
-%}
-
-%option nounput
-
-space		[ \t]
-linebreak	\n
-comment		\#.*\n
-keyword		[A-Za-z0-9\_\-]+
-
-number		[0-9]+
-string		\".*\"
-bdaddr		[A-Za-z0-9]{2}:[A-Za-z0-9]{2}:[A-Za-z0-9]{2}:[A-Za-z0-9]{2}:[A-Za-z0-9]{2}:[A-Za-z0-9]{2}
-
-%%
-
-{space}		{
-			/* Skip spaces and tabs */
-			;
-		}
-
-{comment}	{
-			/* Skip comments */
-			lineno++; 
-		}
-
-{number}	{
-			yylval.number = atoi(yytext);
-			return NUMBER;
-		}
-
-{string}	{
-			yylval.string = yytext;
-			return STRING;
-		}
-
-{bdaddr}	{
-			bdaddr_t *ba = malloc(sizeof(bdaddr_t));
-			str2ba(yytext, ba);
-			yylval.bdaddr = ba;
-			return BDADDR;
-		}
-
-{keyword}	{
-			int keyword = rfcomm_find_keyword(rfcomm_keyword, yytext);
-			if (keyword != -1)
-				return keyword;
-
-			if (strncmp(yytext, "rfcomm", 6) == 0) {
-				yylval.number = atoi(yytext + 6);
-				return RFCOMM;
-			}
-
-			yylval.string = yytext;
-			return WORD;
-		}
-
-{linebreak}	{
-			lineno++;
-		}
-
-.		{
-			return *yytext;
-		}
-
-%%
-
-int yywrap(void) 
-{
-	return 1;
-}
diff --git a/tools/parser.y b/tools/parser.y
deleted file mode 100644
index 96e6a56..0000000
--- a/tools/parser.y
+++ /dev/null
@@ -1,171 +0,0 @@
-%{
-/*
- *
- *  BlueZ - Bluetooth protocol stack for Linux
- *
- *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
- *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/param.h>
-#include <sys/socket.h>
-
-#include <bluetooth/bluetooth.h>
-#include <bluetooth/rfcomm.h>
-
-#include "kword.h"
-
-int yylex(void);
-int yyerror(char *s); 
-
-struct rfcomm_opts *opts;
-
-%}
-
-%union {
-	int number;
-	char *string;
-	bdaddr_t *bdaddr;
-}
-
-%token K_BIND K_DEVICE K_CHANNEL K_COMMENT
-%token K_YES K_NO
-
-%token <number> NUMBER RFCOMM
-%token <string> STRING WORD
-%token <bdaddr> BDADDR
-
-%type <number> bool
-
-%%
-
-config		:
-		| statement
-		| config statement
-		;
-
-statement	: section '{' rfcomm_options '}'
-		| rfcomm  '{' rfcomm_options '}'
-		| WORD
-			{
-			}
-		| error
-			{
-				yyclearin;
-				yyerrok;
-			}
-		;
-
-section		: WORD
-			{
-				opts = NULL;
-			}
-		;
-
-rfcomm		: RFCOMM
-			{
-				if (($1 >= 0) && ($1 < RFCOMM_MAX_DEV))
-					opts = &rfcomm_opts[$1];
-				else
-					opts = NULL;
-			}
-		;
-
-rfcomm_options	: rfcomm_option ';'
-		| error ';'
-		| rfcomm_options rfcomm_option ';'
-		;
-
-rfcomm_option	: K_BIND bool
-			{
-				if (opts)
-					opts->bind = $2;
-			}
-		| K_DEVICE BDADDR
-			{
-				if (opts)
-					bacpy(&opts->bdaddr, $2);
-			}
-		| K_CHANNEL NUMBER
-			{
-				if (opts)
-					opts->channel = $2;
-			}
-		| K_COMMENT STRING
-			{
-				if (opts)
-					snprintf(opts->comment, MAXCOMMENTLEN, "%s", $2);
-			}
-		| WORD
-			{
-				// Unknown option
-			}
-		;
-
-bool		: K_YES	{ $$ = 1; }
-		| K_NO	{ $$ = 0; }
-		;
-
-%%
-
-int yyerror(char *s) 
-{
-	fprintf(stderr, "%s line %d\n", s, lineno);
-	return 0;
-}
-
-int rfcomm_read_config(char *filename)
-{
-	extern FILE *yyin;
-	char file[MAXPATHLEN + 1];
-	int i;
-
-	for (i = 0; i < RFCOMM_MAX_DEV; i++) {
-		rfcomm_opts[i].bind = 0;
-		bacpy(&rfcomm_opts[i].bdaddr, BDADDR_ANY);
-		rfcomm_opts[i].channel = 1;
-	}
-
-	if (filename) {
-		snprintf(file, MAXPATHLEN,  "%s", filename);
-	} else {
-		snprintf(file, MAXPATHLEN, "%s/.bluetooth/rfcomm.conf", getenv("HOME"));
-
-		if ((getuid() == 0) || (access(file, R_OK) < 0))
-			snprintf(file, MAXPATHLEN, "%s/rfcomm.conf", CONFIGDIR);
-	}
-
-	if (!(yyin = fopen(file, "r")))
-		return -1;
-
-	lineno = 1;
-	yyparse();
-
-	fclose(yyin);
-
-	return 0;
-}
diff --git a/tools/rfcomm.1 b/tools/rfcomm.1
index 06303cd..f880f52 100644
--- a/tools/rfcomm.1
+++ b/tools/rfcomm.1
@@ -48,9 +48,6 @@ Prints information about all configured RFCOMM devices.
 .BI -r
 Switch TTY into raw mode (doesn't work with "bind").
 .TP
-.BI -f " <file>"
-Specify alternate config file.
-.TP
 .BI -i " <hciX> | <bdaddr>"
 The command is applied to device
 .BI -A
@@ -89,9 +86,8 @@ Display the information about the specified device.
 .BI connect " <dev> [bdaddr] [channel]"
 Connect the RFCOMM device to the remote Bluetooth device on the
 specified channel. If no channel is specified, it will use the
-channel number 1. If also the Bluetooth address is left out, it
-tries to read the data from the config file. This command can
-be terminated with the key sequence CTRL-C.
+channel number 1. This command can be terminated with the key
+sequence CTRL-C.
 .TP
 .BI listen " <dev> [channel] [cmd]"
 Listen on a specified RFCOMM channel for incoming connections.
@@ -115,15 +111,7 @@ This binds the RFCOMM device to a remote Bluetooth device. The
 command did not establish a connection to the remote device, it
 only creates the binding. The connection will be established right
 after an application tries to open the RFCOMM device. If no channel
-number is specified, it uses the channel number 1. If the Bluetooth
-address is also left out, it tries to read the data from the config
-file.
-
-If
-.B all
-is specified for the RFCOMM device, then all devices that have
-.B "bind yes"
-set in the config will be bound.
+number is specified, it uses the channel number 1.
 .TP
 .BI release " <dev>"
 This command releases a defined RFCOMM binding.
@@ -131,7 +119,6 @@ This command releases a defined RFCOMM binding.
 If
 .B all
 is specified for the RFCOMM device, then all bindings will be removed.
-This command didn't care about the settings in the config file.
 .SH AUTHOR
 Written by Marcel Holtmann <marcel@holtmann.org>.
 .br
diff --git a/tools/rfcomm.c b/tools/rfcomm.c
index 0a80670..add9f3b 100644
--- a/tools/rfcomm.c
+++ b/tools/rfcomm.c
@@ -46,13 +46,10 @@
 #include <bluetooth/hci_lib.h>
 #include <bluetooth/rfcomm.h>
 
-#include "kword.h"
-
 #ifdef NEED_PPOLL
 #include "ppoll.h"
 #endif
 
-static char *rfcomm_config_file = NULL;
 static int rfcomm_raw_tty = 0;
 static int auth = 0;
 static int encryption = 0;
@@ -159,27 +156,16 @@ static int create_dev(int ctl, int dev, uint32_t flags, bdaddr_t *bdaddr, int ar
 	bacpy(&req.src, bdaddr);
 
 	if (argc < 2) {
-		err = rfcomm_read_config(rfcomm_config_file);
-		if (err < 0) {
-			perror("Can't open RFCOMM config file");
-			return err;
-		}
-
-		bacpy(&req.dst, &rfcomm_opts[dev].bdaddr);
-		req.channel = rfcomm_opts[dev].channel;
+		fprintf(stderr, "Missing dev parameter");
+		return -EINVAL;
+	}
 
-		if (bacmp(&req.dst, BDADDR_ANY) == 0) {
-			fprintf(stderr, "Can't find a config entry for rfcomm%d\n", dev);
-			return -EFAULT;
-		}
-	} else {
-		str2ba(argv[1], &req.dst);
+	str2ba(argv[1], &req.dst);
 
-		if (argc > 2)
-			req.channel = atoi(argv[2]);
-		else
-			req.channel = 1;
-	}
+	if (argc > 2)
+		req.channel = atoi(argv[2]);
+	else
+		req.channel = 1;
 
 	err = ioctl(ctl, RFCOMMCREATEDEV, &req);
 	if (err == -1) {
@@ -194,35 +180,6 @@ static int create_dev(int ctl, int dev, uint32_t flags, bdaddr_t *bdaddr, int ar
 	return err;
 }
 
-static int create_all(int ctl)
-{
-	struct rfcomm_dev_req req;
-	int i, err;
-
-	err = rfcomm_read_config(rfcomm_config_file);
-	if (err < 0) {
-		perror("Can't open RFCOMM config file");
-		return err;
-	}
-
-	for (i = 0; i < RFCOMM_MAX_DEV; i++) {
-		if (!rfcomm_opts[i].bind)
-			continue;
-
-		memset(&req, 0, sizeof(req));
-		req.dev_id = i;
-		req.flags = 0;
-		bacpy(&req.src, BDADDR_ANY);
-		bacpy(&req.dst, &rfcomm_opts[i].bdaddr);
-		req.channel = rfcomm_opts[i].channel;
-
-		if (bacmp(&req.dst, BDADDR_ANY) != 0)
-			ioctl(ctl, RFCOMMCREATEDEV, &req);
-	}
-
-	return 0;
-}
-
 static int release_dev(int ctl, int dev, uint32_t flags)
 {
 	struct rfcomm_dev_req req;
@@ -335,28 +292,17 @@ static void cmd_connect(int ctl, int dev, bdaddr_t *bdaddr, int argc, char **arg
 	laddr.rc_channel = 0;
 
 	if (argc < 2) {
-		if (rfcomm_read_config(rfcomm_config_file) < 0) {
-			perror("Can't open RFCOMM config file");
-			return;
-		}
+		fprintf(stderr, "Missing dev parameter");
+		return;
+	}
 
-		raddr.rc_family = AF_BLUETOOTH;
-		bacpy(&raddr.rc_bdaddr, &rfcomm_opts[dev].bdaddr);
-		raddr.rc_channel = rfcomm_opts[dev].channel;
+	raddr.rc_family = AF_BLUETOOTH;
+	str2ba(argv[1], &raddr.rc_bdaddr);
 
-		if (bacmp(&raddr.rc_bdaddr, BDADDR_ANY) == 0) {
-			fprintf(stderr, "Can't find a config entry for rfcomm%d\n", dev);
-			return;
-		}
-	} else {
-		raddr.rc_family = AF_BLUETOOTH;
-		str2ba(argv[1], &raddr.rc_bdaddr);
-
-		if (argc > 2)
-			raddr.rc_channel = atoi(argv[2]);
-		else
-			raddr.rc_channel = 1;
-	}
+	if (argc > 2)
+		raddr.rc_channel = atoi(argv[2]);
+	else
+		raddr.rc_channel = 1;
 
 	sk = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
 	if (sk < 0) {
@@ -658,10 +604,7 @@ static void cmd_watch(int ctl, int dev, bdaddr_t *bdaddr, int argc, char **argv)
 
 static void cmd_create(int ctl, int dev, bdaddr_t *bdaddr, int argc, char **argv)
 {
-	if (strcmp(argv[0], "all") == 0)
-		create_all(ctl);
-	else
-		create_dev(ctl, dev, 0, bdaddr, argc, argv);
+	create_dev(ctl, dev, 0, bdaddr, argc, argv);
 }
 
 static void cmd_release(int ctl, int dev, bdaddr_t *bdaddr, int argc, char **argv)
@@ -754,7 +697,7 @@ int main(int argc, char *argv[])
 
 	bacpy(&bdaddr, BDADDR_ANY);
 
-	while ((opt = getopt_long(argc, argv, "+i:f:rahAESML:", main_options, NULL)) != -1) {
+	while ((opt = getopt_long(argc, argv, "+i:rahAESML:", main_options, NULL)) != -1) {
 		switch(opt) {
 		case 'i':
 			if (strncmp(optarg, "hci", 3) == 0)
@@ -763,10 +706,6 @@ int main(int argc, char *argv[])
 				str2ba(optarg, &bdaddr);
 			break;
 
-		case 'f':
-			rfcomm_config_file = strdup(optarg);
-			break;
-
 		case 'r':
 			rfcomm_raw_tty = 1;
 			break;
diff --git a/tools/rfcomm.conf b/tools/rfcomm.conf
deleted file mode 100644
index 6179ef7..0000000
--- a/tools/rfcomm.conf
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# RFCOMM configuration file.
-#
-
-#rfcomm0 {
-#	# Automatically bind the device at startup
-#	bind no;
-#
-#	# Bluetooth address of the device
-#	device 11:22:33:44:55:66;
-#
-#	# RFCOMM channel for the connection
-#	channel	1;
-#
-#	# Description of the connection
-#	comment "Example Bluetooth device";
-#}
-- 
1.7.11.3


^ permalink raw reply related

* [PATCH BlueZ v2 1/3] rfcomm: Fix checking return value instead of errno
From: Lucas De Marchi @ 2012-07-30 20:06 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Lucas De Marchi

We were checking by a positive return value instead of checking by -1
and errno. However when there's no support for TTY kernel returns
EOPNOTSUPP as usual, which in the end will have a return value of -1
and errno will be set to EOPNOTSUPP.
---
 tools/rfcomm.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tools/rfcomm.c b/tools/rfcomm.c
index e73b0ba..0a80670 100644
--- a/tools/rfcomm.c
+++ b/tools/rfcomm.c
@@ -182,10 +182,14 @@ static int create_dev(int ctl, int dev, uint32_t flags, bdaddr_t *bdaddr, int ar
 	}
 
 	err = ioctl(ctl, RFCOMMCREATEDEV, &req);
-	if (err == EOPNOTSUPP)
-		fprintf(stderr, "RFCOMM TTY support not available\n");
-	else if (err < 0)
-		perror("Can't create device");
+	if (err == -1) {
+		err = -errno;
+
+		if (err == -EOPNOTSUPP)
+			fprintf(stderr, "RFCOMM TTY support not available\n");
+		else
+			perror("Can't create device");
+	}
 
 	return err;
 }
-- 
1.7.11.3


^ permalink raw reply related

* Re: [PATCH BlueZ 3/3] rfcomm: Fix typo in man page
From: Lucas De Marchi @ 2012-07-30 20:01 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <CAJdJm_Oony+DPWh7R9kbXvj3=bOc=LgAeCaPqpqi4AE_sCusZg@mail.gmail.com>

On Mon, Jul 30, 2012 at 1:59 PM, Anderson Lizardo
<anderson.lizardo@openbossa.org> wrote:
> Hi Lucas,
>
> On Mon, Jul 30, 2012 at 12:24 PM, Lucas De Marchi
> <lucas.demarchi@profusion.mobi> wrote:
>> ---
>>  .gitignore     | 5 -----
>>  tools/rfcomm.1 | 2 +-
>>  2 files changed, 1 insertion(+), 6 deletions(-)
>>
>> diff --git a/.gitignore b/.gitignore
>> index 38318cd..c9f293a 100644
>> --- a/.gitignore
>> +++ b/.gitignore
>> @@ -26,11 +26,6 @@ missing
>>  stamp-h1
>>  autom4te.cache
>>
>> -ylwrap
>> -lexer.c
>> -parser.h
>> -parser.c
>> -
>>  bluez.pc
>>  lib/bluetooth
>>  src/builtin.h
>
> The diff above is more appropriate for the previous patch.

Oops, wrong amend.

Thanks
Lucas De Marchi

^ permalink raw reply

* [PATCH BlueZ] lib: Add new company identifiers
From: Jefferson Delfes @ 2012-07-30 18:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jefferson Delfes

---
 lib/bluetooth.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/lib/bluetooth.c b/lib/bluetooth.c
index a0be884..d092d01 100644
--- a/lib/bluetooth.c
+++ b/lib/bluetooth.c
@@ -522,6 +522,46 @@ char *bt_compidtostr(int compid)
 		return "Autonet Mobile";
 	case 128:
 		return "DeLorme Publishing Company, Inc.";
+	case 129:
+		return "WuXi Vimicro";
+	case 130:
+		return "Sennheiser Communications A/S";
+	case 131:
+		return "TimeKeeping Systems, Inc.";
+	case 132:
+		return "Ludus Helsinki Ltd.";
+	case 133:
+		return "BlueRadios, Inc.";
+	case 134:
+		return "equinux AG";
+	case 135:
+		return "Garmin International, Inc.";
+	case 136:
+		return "Ecotest";
+	case 137:
+		return "GN ReSound A/S";
+	case 138:
+		return "Jawbone";
+	case 139:
+		return "Topcon Positioning Systems, LLC";
+	case 140:
+		return "Qualcomm Labs, Inc.";
+	case 141:
+		return "Zscan Software";
+	case 142:
+		return "Quintic Corp.";
+	case 143:
+		return "Stollmann E+V GmbH";
+	case 144:
+		return "Funai Electric Co., Ltd.";
+	case 145:
+		return "Advanced PANMOBIL systems GmbH & Co. KG";
+	case 146:
+		return "ThinkOptics, Inc.";
+	case 147:
+		return "Universal Electronics, Inc.";
+	case 148:
+		return "Airoha Technology Corp.";
 	case 65535:
 		return "internal use";
 	default:
-- 
1.7.11.3


^ permalink raw reply related

* [PATCH v2 BlueZ] monitor: Fix endianness conversion
From: Anderson Lizardo @ 2012-07-30 18:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo
In-Reply-To: <1343672005-18528-1-git-send-email-anderson.lizardo@openbossa.org>

Flags field has 32-bit size. Same issue was fixed for mgmtops in
1801a4d45d74c29cebacaab79a07e9961300be41.
---

Fix subject: mgmtops -> monitor

 monitor/control.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/monitor/control.c b/monitor/control.c
index 159ba9d..54b249d 100644
--- a/monitor/control.c
+++ b/monitor/control.c
@@ -210,7 +210,7 @@ static void mgmt_device_connected(uint16_t len, const void *buf)
 		return;
 	}
 
-	flags = btohs(ev->flags);
+	flags = btohl(ev->flags);
 	ba2str(&ev->addr.bdaddr, str);
 
 	printf("@ Device Connected: %s (%d) flags 0x%4.4x\n",
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH BlueZ] mgmtops: Fix endianness conversion
From: Anderson Lizardo @ 2012-07-30 18:13 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

Flags field has 32-bit size. Same issue was fixed for mgmtops in
1801a4d45d74c29cebacaab79a07e9961300be41.
---
 monitor/control.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/monitor/control.c b/monitor/control.c
index 159ba9d..54b249d 100644
--- a/monitor/control.c
+++ b/monitor/control.c
@@ -210,7 +210,7 @@ static void mgmt_device_connected(uint16_t len, const void *buf)
 		return;
 	}
 
-	flags = btohs(ev->flags);
+	flags = btohl(ev->flags);
 	ba2str(&ev->addr.bdaddr, str);
 
 	printf("@ Device Connected: %s (%d) flags 0x%4.4x\n",
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH BlueZ v2 3/3] gatt: Add support to GATT Write Long Characteristic
From: Eder Ruiz Maria @ 2012-07-30 17:38 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Eder Ruiz Maria
In-Reply-To: <1343420976-19921-1-git-send-email-eder.ruiz@openbossa.org>

Extending the function gatt_write_char for support GATT Write Long
Characteristics. MTU is checked and if the payload does not fit,
the prepare and execute write are used to do the transaction.
---
 attrib/att.h         |    4 ++
 attrib/gatt.c        |  109 +++++++++++++++++++++++++++++++++++++++++++++++---
 attrib/gatttool.c    |    2 +-
 attrib/interactive.c |    2 +-
 4 files changed, 110 insertions(+), 7 deletions(-)

diff --git a/attrib/att.h b/attrib/att.h
index 64d22ca..e7a29cb 100644
--- a/attrib/att.h
+++ b/attrib/att.h
@@ -92,6 +92,10 @@
 #define ATT_CID					4
 #define ATT_PSM					31
 
+/* Flags for Execute Write Request Operation */
+#define ATT_CANCEL_ALL_PREP_WRITES              0x00
+#define ATT_WRITE_ALL_PREP_WRITES               0x01
+
 struct att_data_list {
 	uint16_t num;
 	uint16_t len;
diff --git a/attrib/gatt.c b/attrib/gatt.c
index 6f9a11d..b7eb736 100644
--- a/attrib/gatt.c
+++ b/attrib/gatt.c
@@ -520,21 +520,120 @@ guint gatt_read_char(GAttrib *attrib, uint16_t handle, uint16_t offset,
 	return id;
 }
 
+struct write_long_data {
+	GAttrib *attrib;
+	GAttribResultFunc func;
+	gpointer user_data;
+	guint16 handle;
+	uint16_t offset;
+	uint8_t *value;
+	int vlen;
+};
+
+static guint execute_write(GAttrib *attrib, uint8_t flags,
+				GAttribResultFunc func, gpointer user_data)
+{
+	uint8_t *buf;
+	int buflen;
+	guint16 plen;
+
+	buf = g_attrib_get_buffer(attrib, &buflen);
+	plen = enc_exec_write_req(flags, buf, buflen);
+	if (plen == 0)
+		return 0;
+
+	return g_attrib_send(attrib, 0, buf[0], buf, plen, func, user_data,
+									NULL);
+}
+
+static guint prepare_write(GAttrib *attrib, uint16_t handle, uint16_t offset,
+			uint8_t *value, int vlen, GAttribResultFunc func,
+			gpointer user_data);
+
+static void prepare_write_cb(guint8 status, const guint8 *rpdu,
+					guint16 rlen, gpointer user_data)
+{
+	struct write_long_data *long_write = user_data;
+
+	if (status != 0) {
+		long_write->func(status, rpdu, rlen, long_write->user_data);
+		return;
+	}
+
+	/* Skip Prepare Write Response PDU header (5 bytes) */
+	long_write->offset += rlen - 5;
+
+	if (long_write->offset == long_write->vlen){
+		execute_write(long_write->attrib, ATT_WRITE_ALL_PREP_WRITES,
+				long_write->func, long_write->user_data);
+		g_free(long_write->value);
+		g_free(long_write);
+
+		return;
+	}
+
+	prepare_write(long_write->attrib, long_write->handle,
+		long_write->offset, long_write->value, long_write->vlen,
+		long_write->func, long_write);
+}
+
+static guint prepare_write(GAttrib *attrib, uint16_t handle, uint16_t offset,
+			uint8_t *value, int vlen, GAttribResultFunc func,
+			gpointer user_data)
+{
+	guint16 plen;
+	int buflen;
+	uint8_t *buf;
+
+	buf = g_attrib_get_buffer(attrib, &buflen);
+
+	plen = enc_prep_write_req(handle, offset, &value[offset], vlen - offset,
+								buf, buflen);
+	if (plen == 0)
+		return 0;
+
+	return g_attrib_send(attrib, 0, buf[0], buf, plen, prepare_write_cb,
+							user_data, NULL);
+}
+
 guint gatt_write_char(GAttrib *attrib, uint16_t handle, uint8_t *value,
 			int vlen, GAttribResultFunc func, gpointer user_data)
 {
 	uint8_t *buf;
 	int buflen;
 	guint16 plen;
+	struct write_long_data *long_write;
 
 	buf = g_attrib_get_buffer(attrib, &buflen);
-	if (func)
-		plen = enc_write_req(handle, value, vlen, buf, buflen);
-	else
-		plen = enc_write_cmd(handle, value, vlen, buf, buflen);
 
-	return g_attrib_send(attrib, 0, buf[0], buf, plen, func,
+	/* Only use Write Request/Command if payload fits on a single transfer,
+	 * including 3 bytes for the header. */
+	if (vlen <= buflen - 3) {
+		if (func)
+			plen = enc_write_req(handle, value, vlen, buf,
+								buflen);
+		else
+			plen = enc_write_cmd(handle, value, vlen, buf,
+								buflen);
+
+		return g_attrib_send(attrib, 0, buf[0], buf, plen, func,
 							user_data, NULL);
+	}
+
+	/* Write Long Characteristic Values */
+	long_write = g_try_new0(struct write_long_data, 1);
+	if (long_write == NULL)
+		return 0;
+
+	long_write->attrib = attrib;
+	long_write->func = func;
+	long_write->user_data = user_data;
+	long_write->handle = handle;
+	long_write->value = g_memdup(value,vlen);
+	long_write->vlen = vlen;
+
+	return prepare_write(attrib, handle, long_write->offset, value, vlen,
+							func, long_write);
 }
 
 guint gatt_exchange_mtu(GAttrib *attrib, uint16_t mtu, GAttribResultFunc func,
diff --git a/attrib/gatttool.c b/attrib/gatttool.c
index 1f23522..a11ca9f 100644
--- a/attrib/gatttool.c
+++ b/attrib/gatttool.c
@@ -371,7 +371,7 @@ static void char_write_req_cb(guint8 status, const guint8 *pdu, guint16 plen,
 		goto done;
 	}
 
-	if (!dec_write_resp(pdu, plen)) {
+	if (!dec_write_resp(pdu, plen) && !dec_exec_write_resp(pdu, plen)) {
 		g_printerr("Protocol error\n");
 		goto done;
 	}
diff --git a/attrib/interactive.c b/attrib/interactive.c
index 3657798..6cd8bd5 100644
--- a/attrib/interactive.c
+++ b/attrib/interactive.c
@@ -588,7 +588,7 @@ static void char_write_req_cb(guint8 status, const guint8 *pdu, guint16 plen,
 		return;
 	}
 
-	if (!dec_write_resp(pdu, plen)) {
+	if (!dec_write_resp(pdu, plen) && !dec_exec_write_resp(pdu, plen)) {
 		printf("Protocol error\n");
 		return;
 	}
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH BlueZ v2 2/3] att: Add encode/decode execute write support
From: Eder Ruiz Maria @ 2012-07-30 17:38 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Eder Ruiz Maria
In-Reply-To: <1343420976-19921-1-git-send-email-eder.ruiz@openbossa.org>

Add functions for encoding/decoding Execute Write Request and
Response PDUs.
---
 attrib/att.c |   35 +++++++++++++++++++++++++++++++++++
 attrib/att.h |    2 ++
 2 files changed, 37 insertions(+)

diff --git a/attrib/att.c b/attrib/att.c
index 790ec3a..20a8efa 100644
--- a/attrib/att.c
+++ b/attrib/att.c
@@ -1028,3 +1028,38 @@ uint16_t dec_prep_write_resp(const uint8_t *pdu, int len, uint16_t *handle,
 
 	return len;
 }
+
+uint16_t enc_exec_write_req(uint8_t flags, uint8_t *pdu, int len)
+{
+	const uint16_t min_len = sizeof(pdu[0]) + sizeof(flags);
+
+	if (pdu == NULL)
+		return 0;
+
+	if (len < min_len)
+		return 0;
+
+	if (flags > 1)
+		return 0;
+
+	pdu[0] = ATT_OP_EXEC_WRITE_REQ;
+	pdu[1] = flags;
+
+	return min_len;
+}
+
+uint16_t dec_exec_write_resp(const uint8_t *pdu, int len)
+{
+	const uint16_t min_len = sizeof(pdu[0]);
+
+	if (pdu == NULL)
+		return 0;
+
+	if (len < min_len)
+		return 0;
+
+	if (pdu[0] != ATT_OP_EXEC_WRITE_RESP)
+		return 0;
+
+	return len;
+}
diff --git a/attrib/att.h b/attrib/att.h
index ec03be9..64d22ca 100644
--- a/attrib/att.h
+++ b/attrib/att.h
@@ -261,3 +261,5 @@ uint16_t enc_prep_write_req(uint16_t handle, uint16_t offset,
 			const uint8_t *value, int vlen, uint8_t *pdu, int len);
 uint16_t dec_prep_write_resp(const uint8_t *pdu, int len, uint16_t *handle,
 				uint16_t *offset, uint8_t *value, int *vlen);
+uint16_t enc_exec_write_req(uint8_t flags, uint8_t *pdu, int len);
+uint16_t dec_exec_write_resp(const uint8_t *pdu, int len);
-- 
1.7.9.5


^ permalink raw reply related


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