* Re: [PATCH]Bluetooth:net/bluetooth/hci_core.c Fix system crash when creating a new device with bluetooth-applet
From: Suraj Sumangala @ 2010-09-01 8:57 UTC (permalink / raw)
To: Gustavo F. Padovan
Cc: Justin P. Mattock, linux-bluetooth@vger.kernel.org,
marcel@holtmann.org, Suraj Sumangala,
linux-kernel@vger.kernel.org
In-Reply-To: <20100901010821.GA28764@vigoh>
Hi Justin,
On 9/1/2010 1:30 PM, Gustavo F. Padovan wrote:
> Hi Justin,
>
> * Justin P. Mattock<justinmattock@gmail.com> [2010-08-31 10:13:47 -0700]:
>
>> When using bluetooth-applet adding my apple magic mouse I'm getting a total system freeze.
>> I used firescope to grab the crash data(below) The results of the bisect pointed to here:
>> Bluetooth: Implemented HCI frame reassembly from RX stream
>> commit:9981151086385eecc2febf4ba95a14593f834b3d
>>
>> after looking through, and at the crash log, I couldn't help but notice something in there
>> with IRQ, then after looking at hci_h4.c /* H4 receiver States */ #58 I noticed
>> #define H4_W4_PACKET_TYPE 0 is at zero as well as #define STREAM_REASSEMBLY 0
>> so changing STREAM_REASSEMBLY to a different number that isn't taken gets my machine to connect
>> perfectly to my magic mouse. Please have a look and let me know if this is a good
>> solution and/or send me something else to test out.
>
> Your patch seems very wrong, H4_W4_PACKET_TYPE and STREAM_REASSEMBLY
> have nothing to do with each other, your commit message doesn't make
> sense. Also the patch corrupts 'struct hci_dev'.
> If you pay attention on the code flow you can check that
> STREAM_REASSEMBLY is never used in the crash log you sent.
Gustavo is correct. This should not have any effect on the code flow for
you as you are using USB transport and STREAM_REASSEMBLY is relevant
only for UART transport.
So, I guess your problem is not 100% reproducible.
>
>>
>> crash:
>>
>>
>> <1>[ 1755.556472] BUG: unable to handle kernel paging request at ffff880224d0c548
>> <1>[ 1755.556485] IP: [<ffffffffa0042bec>] hci_reassembly.part.13.constprop.18+0x23/0x1b5 [bluetooth]
>> <4>[ 1755.556507] PGD 1609063 PUD 0
>> <0>[ 1755.556515] Oops: 0000 [#1] SMP
>> <0>[ 1755.556522] last sysfs file: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0/voltage_now
>> <4>[ 1755.556530] CPU 0
>> <4>[ 1755.556533] Modules linked in: usb_storage xfrm4_mode_transport xcbc rmd160 sha512_generic sco bnep xt_tcpudp ipt_LOG iptable_nat nf_nat xt_state nf_conntrack_ftp nf_conntrack_ipv4 nf_conntrack nf_defrag_ipv4 iptable_filter ip_tables x_tables ath9k firewire_ohci ath9k_common firewire_core ath9k_hw battery ac ohci1394 evdev thermal ath sky2 joydev button snd_hda_codec_idt snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_timer i2c_i801 snd soundcore snd_page_alloc video aes_x86_64 lzo lzo_compress tun kvm_intel ipcomp xfrm_ipcomp crypto_null sha256_generic cbc des_generic cast5 blowfish serpent camellia twofish_generic twofish_x86_64 twofish_common ctr ah4 esp4 authenc raw1394 ieee1394 uhci_hcd ehci_hcd hci_uart rfcomm btusb hidp l2cap bluetooth coretemp acpi_cpufreq processor mperf appletouch applesmc
>> <4>[ 1755.556676]
>> <4>[ 1755.556682] Pid: 0, comm: swapper Not tainted 2.6.36-rc3 #3 Mac-F42187C8/MacBookPro2,2
>> <4>[ 1755.556688] RIP: 0010:[<ffffffffa0042bec>] [<ffffffffa0042bec>] hci_reassembly.part.13.constprop.18+0x23/0x1b5 [bluetooth]
>> <4>[ 1755.556705] RSP: 0018:ffff880001803ca8 EFLAGS: 00010092
>> <4>[ 1755.556710] RAX: 000000003df64001 RBX: 0000000000000014 RCX: 0000000000000014
>> <4>[ 1755.556716] RDX: ffff8800372018d8 RSI: 0000000000000002 RDI: ffff8800351ec240
>> <4>[ 1755.556722] RBP: ffff880001803cf8 R08: ffff88003df64001 R09: ffff88000180f398
>> <4>[ 1755.556728] R10: dead000000100100 R11: dead000000200200 R12: ffff8800351ec240
>> <4>[ 1755.556733] R13: 0000000000000002 R14: 000000003df64001 R15: 0000000000000001
>> <4>[ 1755.556740] FS: 0000000000000000(0000) GS:ffff880001800000(0000) knlGS:0000000000000000
>> <4>[ 1755.556746] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
>> <4>[ 1755.556752] CR2: ffff880224d0c548 CR3: 0000000001608000 CR4: 00000000000006f0
>> <4>[ 1755.556758] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
>> <4>[ 1755.556763] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
>> <4>[ 1755.556770] Process swapper (pid: 0, threadinfo ffffffff815f0000, task ffffffff81610020)
>> <0>[ 1755.556774] Stack:
>> <4>[ 1755.556778] ffffea0000b9fdc8 ffff88003df64000 ffff8800372018d8 ffffffffa00a189f
>> <4>[ 1755.556787]<0> ffff880001803d08 0000000000000014 0000000000000002 ffff8800372018d8
>> <4>[ 1755.556797]<0> ffff8800351ec240 0000000000000001 ffff880001803d38 ffffffffa0042dc5
>> <0>[ 1755.556809] Call Trace:
>> <0>[ 1755.556813]<IRQ>
>> <4>[ 1755.556825] [<ffffffffa00a189f>] ? uhci_free_urb_priv+0xa6/0xb3 [uhci_hcd]
>> <4>[ 1755.556839] [<ffffffffa0042dc5>] hci_recv_fragment+0x47/0x65 [bluetooth]
>> <4>[ 1755.556851] [<ffffffffa00705ee>] btusb_bulk_complete+0x56/0xd6 [btusb]
>> <4>[ 1755.556862] [<ffffffff812c1df9>] usb_hcd_giveback_urb+0x5d/0x8d
>> <4>[ 1755.556873] [<ffffffffa00a217b>] uhci_giveback_urb+0x11a/0x1a9 [uhci_hcd]
>> <4>[ 1755.556884] [<ffffffffa00a2a1a>] uhci_scan_schedule+0x544/0x84e [uhci_hcd]
>> <4>[ 1755.556896] [<ffffffffa00a3343>] uhci_irq+0xee/0x104 [uhci_hcd]
>> <4>[ 1755.556903] [<ffffffff812c1a08>] usb_hcd_irq+0x43/0x79
>> <4>[ 1755.556913] [<ffffffff81098c0b>] handle_IRQ_event+0x6e/0x14b
>> <4>[ 1755.556922] [<ffffffff8109aa52>] handle_fasteoi_irq+0x92/0xd2
>> <4>[ 1755.556931] [<ffffffff81029ab6>] handle_irq+0x86/0x8c
>> <4>[ 1755.556938] [<ffffffff8102975c>] do_IRQ+0x57/0xbe
>> <4>[ 1755.556948] [<ffffffff813ecb93>] ret_from_intr+0x0/0x11
>> <0>[ 1755.556952]<EOI>
>> <4>[ 1755.556966] [<ffffffffa0022e7b>] ? acpi_idle_enter_bm+0x252/0x28a [processor]
>> <4>[ 1755.556979] [<ffffffffa0022e74>] ? acpi_idle_enter_bm+0x24b/0x28a [processor]
>> <4>[ 1755.556988] [<ffffffff8130a5d5>] ? menu_select+0x16f/0x296
>> <4>[ 1755.556996] [<ffffffff81309501>] cpuidle_idle_call+0x9f/0x119
>> <4>[ 1755.557004] [<ffffffff81025db4>] cpu_idle+0x62/0xc5
>> <4>[ 1755.557014] [<ffffffff813d1bd4>] rest_init+0x68/0x6a
>> <4>[ 1755.557024] [<ffffffff8168cb7b>] start_kernel+0x365/0x370
>> <4>[ 1755.557033] [<ffffffff8168c2a6>] x86_64_start_reservations+0xad/0xb1
>> <4>[ 1755.557042] [<ffffffff8168c140>] ? early_idt_handler+0x0/0x71
>> <4>[ 1755.557050] [<ffffffff8168c3a3>] x86_64_start_kernel+0xf9/0x108
>> <0>[ 1755.557055] Code: 41 5c 41 5d 41 5e c9 c3 55 49 63 c0 48 89 e5 41 57 41 56 45 89 c6 41 55 41 89 f5 41 54 49 89 fc 53 89 cb 48 83 ec 28 48 89 55 c0<48> 8b 94 c7 00 03 00 00 48 85 d2 0f 85 61 01 00 00 41 8d 45 fe
>> <1>[ 1755.557139] RIP [<ffffffffa0042bec>] hci_reassembly.part.13.constprop.18+0x23/0x1b5 [bluetooth]
>> <4>[ 1755.557154] RSP<ffff880001803ca8>
>> <0>[ 1755.557158] CR2: ffff880224d0c548
>> <4>[ 1755.557164] ---[ end trace 6c64514f0ad01ea5 ]---
>> <0>[ 1755.557169] Kernel panic - not syncing: Fatal exception in interrupt
>> <4>[ 1755.557176] Pid: 0, comm: swapper Tainted: G D 2.6.36-rc3 #3
>> <4>[ 1755.557180] Call Trace:
>> <4>[ 1755.557183]<IRQ> [<ffffffff813e47d2>] panic+0x8c/0x189
>> <4>[ 1755.557199] [<ffffffff813ed90c>] oops_end+0x87/0x94
>> <4>[ 1755.557206] [<ffffffff813e4737>] no_context+0x1f4/0x203
>> <4>[ 1755.557216] [<ffffffff8104487f>] __bad_area_nosemaphore+0x17f/0x1a2
>> <4>[ 1755.557224] [<ffffffff810448b0>] bad_area_nosemaphore+0xe/0x10
>> <4>[ 1755.557233] [<ffffffff813ef9fd>] do_page_fault+0x1ee/0x3c2
>> <4>[ 1755.557243] [<ffffffff810e4748>] ? check_object+0x151/0x202
>> <4>[ 1755.557254] [<ffffffffa00a336f>] ? uhci_alloc_td.isra.22+0x16/0x44 [uhci_hcd]
>> <4>[ 1755.557265] [<ffffffffa00a3b17>] ? uhci_submit_common.isra.24+0x233/0x2d3 [uhci_hcd]
>> <4>[ 1755.557273] [<ffffffff813ecde5>] page_fault+0x25/0x30
>> <4>[ 1755.557287] [<ffffffffa0042bec>] ? hci_reassembly.part.13.constprop.18+0x23/0x1b5 [bluetooth]
>> <4>[ 1755.557298] [<ffffffffa00a189f>] ? uhci_free_urb_priv+0xa6/0xb3 [uhci_hcd]
>> <4>[ 1755.557311] [<ffffffffa0042dc5>] hci_recv_fragment+0x47/0x65 [bluetooth]
>> <4>[ 1755.557322] [<ffffffffa00705ee>] btusb_bulk_complete+0x56/0xd6 [btusb]
>> <4>[ 1755.557330] [<ffffffff812c1df9>] usb_hcd_giveback_urb+0x5d/0x8d
>> <4>[ 1755.557340] [<ffffffffa00a217b>] uhci_giveback_urb+0x11a/0x1a9 [uhci_hcd]
>> <4>[ 1755.557351] [<ffffffffa00a2a1a>] uhci_scan_schedule+0x544/0x84e [uhci_hcd]
>> <4>[ 1755.557362] [<ffffffffa00a3343>] uhci_irq+0xee/0x104 [uhci_hcd]
>> <4>[ 1755.557369] [<ffffffff812c1a08>] usb_hcd_irq+0x43/0x79
>> <4>[ 1755.557377] [<ffffffff81098c0b>] handle_IRQ_event+0x6e/0x14b
>> <4>[ 1755.557386] [<ffffffff8109aa52>] handle_fasteoi_irq+0x92/0xd2
>> <4>[ 1755.557393] [<ffffffff81029ab6>] handle_irq+0x86/0x8c
>> <4>[ 1755.557401] [<ffffffff8102975c>] do_IRQ+0x57/0xbe
>> <4>[ 1755.557408] [<ffffffff813ecb93>] ret_from_intr+0x0/0x11
>> <4>[ 1755.557413]<EOI> [<ffffffffa0022e7b>] ? acpi_idle_enter_bm+0x252/0x28a [processor]
>> <4>[ 1755.557420] [<ffffffffa0022e74>] ? acpi_idle_enter_bm+0x24b/0x28a [processor]
>> <4>[ 1755.557420] [<ffffffff8130a5d5>] ? menu_select+0x16f/0x296
>> <4>[ 1755.557420] [<ffffffff81309501>] cpuidle_idle_call+0x9f/0x119> <4>[ 1755.557420] [<ffffffff81025db4>] cpu_idle+0x62/0xc5> <4>[ 1755.557420] [<ffffffff813d1bd4>] rest_init+0x68/0x6a> <4>[ 1755.557420] [<ffffffff8168cb7b>] start_kernel+0x365/0x370
>> <4>[ 1755.557420] [<ffffffff8168c2a6>] x86_64_start_reservations+0xad/0xb1
>> <4>[ 1755.557420] [<ffffffff8168c140>] ? early_idt_handler+0x0/0x71
>> <4>[ 1755.557420] [<ffffffff8168c3a3>] x86_64_start_kernel+0xf9/0x108
>
> Suraj, do you have any idea on that?
>
can you verify the return status of hci_reassembly()? I guess there
could be some mismatch in the packet received.
Regards
Suraj
^ permalink raw reply
* Re: [PATCH] Changes in Health API
From: Johan Hedberg @ 2010-09-01 8:26 UTC (permalink / raw)
To: Santiago Carot-Nemesio; +Cc: linux-bluetooth
In-Reply-To: <1283326953-2207-1-git-send-email-sancane@gmail.com>
Hi,
On Wed, Sep 01, 2010, Santiago Carot-Nemesio wrote:
> Connections are made directly to a device and bluetoothd daemon
> guess the PSM connection and the MDEPID based on the data get
> from the SDP record.
>
> Also a property that indicates the first realiable channel is
> added to the HealthDevice object.
> ---
> doc/health-api.txt | 119 +++++++++++++++++++++++-----------------------------
> 1 files changed, 53 insertions(+), 66 deletions(-)
Thanks. The patch is now upstream.
Johan
^ permalink raw reply
* Re: [PATCH]Bluetooth:net/bluetooth/hci_core.c Fix system crash when creating a new device with bluetooth-applet
From: Gustavo F. Padovan @ 2010-09-01 8:00 UTC (permalink / raw)
To: Justin P. Mattock; +Cc: linux-bluetooth, marcel, suraj, linux-kernel
In-Reply-To: <1283274827-2770-1-git-send-email-justinmattock@gmail.com>
Hi Justin,
* Justin P. Mattock <justinmattock@gmail.com> [2010-08-31 10:13:47 -0700]:
> When using bluetooth-applet adding my apple magic mouse I'm getting a total system freeze.
> I used firescope to grab the crash data(below) The results of the bisect pointed to here:
> Bluetooth: Implemented HCI frame reassembly from RX stream
> commit:9981151086385eecc2febf4ba95a14593f834b3d
>
> after looking through, and at the crash log, I couldn't help but notice something in there
> with IRQ, then after looking at hci_h4.c /* H4 receiver States */ #58 I noticed
> #define H4_W4_PACKET_TYPE 0 is at zero as well as #define STREAM_REASSEMBLY 0
> so changing STREAM_REASSEMBLY to a different number that isn't taken gets my machine to connect
> perfectly to my magic mouse. Please have a look and let me know if this is a good
> solution and/or send me something else to test out.
Your patch seems very wrong, H4_W4_PACKET_TYPE and STREAM_REASSEMBLY
have nothing to do with each other, your commit message doesn't make
sense. Also the patch corrupts 'struct hci_dev'.
If you pay attention on the code flow you can check that
STREAM_REASSEMBLY is never used in the crash log you sent.
>
> crash:
>
>
> <1>[ 1755.556472] BUG: unable to handle kernel paging request at ffff880224d0c548
> <1>[ 1755.556485] IP: [<ffffffffa0042bec>] hci_reassembly.part.13.constprop.18+0x23/0x1b5 [bluetooth]
> <4>[ 1755.556507] PGD 1609063 PUD 0
> <0>[ 1755.556515] Oops: 0000 [#1] SMP
> <0>[ 1755.556522] last sysfs file: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0/voltage_now
> <4>[ 1755.556530] CPU 0
> <4>[ 1755.556533] Modules linked in: usb_storage xfrm4_mode_transport xcbc rmd160 sha512_generic sco bnep xt_tcpudp ipt_LOG iptable_nat nf_nat xt_state nf_conntrack_ftp nf_conntrack_ipv4 nf_conntrack nf_defrag_ipv4 iptable_filter ip_tables x_tables ath9k firewire_ohci ath9k_common firewire_core ath9k_hw battery ac ohci1394 evdev thermal ath sky2 joydev button snd_hda_codec_idt snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_timer i2c_i801 snd soundcore snd_page_alloc video aes_x86_64 lzo lzo_compress tun kvm_intel ipcomp xfrm_ipcomp crypto_null sha256_generic cbc des_generic cast5 blowfish serpent camellia twofish_generic twofish_x86_64 twofish_common ctr ah4 esp4 authenc raw1394 ieee1394 uhci_hcd ehci_hcd hci_uart rfcomm btusb hidp l2cap bluetooth coretemp acpi_cpufreq processor mperf appletouch applesmc
> <4>[ 1755.556676]
> <4>[ 1755.556682] Pid: 0, comm: swapper Not tainted 2.6.36-rc3 #3 Mac-F42187C8/MacBookPro2,2
> <4>[ 1755.556688] RIP: 0010:[<ffffffffa0042bec>] [<ffffffffa0042bec>] hci_reassembly.part.13.constprop.18+0x23/0x1b5 [bluetooth]
> <4>[ 1755.556705] RSP: 0018:ffff880001803ca8 EFLAGS: 00010092
> <4>[ 1755.556710] RAX: 000000003df64001 RBX: 0000000000000014 RCX: 0000000000000014
> <4>[ 1755.556716] RDX: ffff8800372018d8 RSI: 0000000000000002 RDI: ffff8800351ec240
> <4>[ 1755.556722] RBP: ffff880001803cf8 R08: ffff88003df64001 R09: ffff88000180f398
> <4>[ 1755.556728] R10: dead000000100100 R11: dead000000200200 R12: ffff8800351ec240
> <4>[ 1755.556733] R13: 0000000000000002 R14: 000000003df64001 R15: 0000000000000001
> <4>[ 1755.556740] FS: 0000000000000000(0000) GS:ffff880001800000(0000) knlGS:0000000000000000
> <4>[ 1755.556746] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
> <4>[ 1755.556752] CR2: ffff880224d0c548 CR3: 0000000001608000 CR4: 00000000000006f0
> <4>[ 1755.556758] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> <4>[ 1755.556763] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
> <4>[ 1755.556770] Process swapper (pid: 0, threadinfo ffffffff815f0000, task ffffffff81610020)
> <0>[ 1755.556774] Stack:
> <4>[ 1755.556778] ffffea0000b9fdc8 ffff88003df64000 ffff8800372018d8 ffffffffa00a189f
> <4>[ 1755.556787] <0> ffff880001803d08 0000000000000014 0000000000000002 ffff8800372018d8
> <4>[ 1755.556797] <0> ffff8800351ec240 0000000000000001 ffff880001803d38 ffffffffa0042dc5
> <0>[ 1755.556809] Call Trace:
> <0>[ 1755.556813] <IRQ>
> <4>[ 1755.556825] [<ffffffffa00a189f>] ? uhci_free_urb_priv+0xa6/0xb3 [uhci_hcd]
> <4>[ 1755.556839] [<ffffffffa0042dc5>] hci_recv_fragment+0x47/0x65 [bluetooth]
> <4>[ 1755.556851] [<ffffffffa00705ee>] btusb_bulk_complete+0x56/0xd6 [btusb]
> <4>[ 1755.556862] [<ffffffff812c1df9>] usb_hcd_giveback_urb+0x5d/0x8d
> <4>[ 1755.556873] [<ffffffffa00a217b>] uhci_giveback_urb+0x11a/0x1a9 [uhci_hcd]
> <4>[ 1755.556884] [<ffffffffa00a2a1a>] uhci_scan_schedule+0x544/0x84e [uhci_hcd]
> <4>[ 1755.556896] [<ffffffffa00a3343>] uhci_irq+0xee/0x104 [uhci_hcd]
> <4>[ 1755.556903] [<ffffffff812c1a08>] usb_hcd_irq+0x43/0x79
> <4>[ 1755.556913] [<ffffffff81098c0b>] handle_IRQ_event+0x6e/0x14b
> <4>[ 1755.556922] [<ffffffff8109aa52>] handle_fasteoi_irq+0x92/0xd2
> <4>[ 1755.556931] [<ffffffff81029ab6>] handle_irq+0x86/0x8c
> <4>[ 1755.556938] [<ffffffff8102975c>] do_IRQ+0x57/0xbe
> <4>[ 1755.556948] [<ffffffff813ecb93>] ret_from_intr+0x0/0x11
> <0>[ 1755.556952] <EOI>
> <4>[ 1755.556966] [<ffffffffa0022e7b>] ? acpi_idle_enter_bm+0x252/0x28a [processor]
> <4>[ 1755.556979] [<ffffffffa0022e74>] ? acpi_idle_enter_bm+0x24b/0x28a [processor]
> <4>[ 1755.556988] [<ffffffff8130a5d5>] ? menu_select+0x16f/0x296
> <4>[ 1755.556996] [<ffffffff81309501>] cpuidle_idle_call+0x9f/0x119
> <4>[ 1755.557004] [<ffffffff81025db4>] cpu_idle+0x62/0xc5
> <4>[ 1755.557014] [<ffffffff813d1bd4>] rest_init+0x68/0x6a
> <4>[ 1755.557024] [<ffffffff8168cb7b>] start_kernel+0x365/0x370
> <4>[ 1755.557033] [<ffffffff8168c2a6>] x86_64_start_reservations+0xad/0xb1
> <4>[ 1755.557042] [<ffffffff8168c140>] ? early_idt_handler+0x0/0x71
> <4>[ 1755.557050] [<ffffffff8168c3a3>] x86_64_start_kernel+0xf9/0x108
> <0>[ 1755.557055] Code: 41 5c 41 5d 41 5e c9 c3 55 49 63 c0 48 89 e5 41 57 41 56 45 89 c6 41 55 41 89 f5 41 54 49 89 fc 53 89 cb 48 83 ec 28 48 89 55 c0 <48> 8b 94 c7 00 03 00 00 48 85 d2 0f 85 61 01 00 00 41 8d 45 fe
> <1>[ 1755.557139] RIP [<ffffffffa0042bec>] hci_reassembly.part.13.constprop.18+0x23/0x1b5 [bluetooth]
> <4>[ 1755.557154] RSP <ffff880001803ca8>
> <0>[ 1755.557158] CR2: ffff880224d0c548
> <4>[ 1755.557164] ---[ end trace 6c64514f0ad01ea5 ]---
> <0>[ 1755.557169] Kernel panic - not syncing: Fatal exception in interrupt
> <4>[ 1755.557176] Pid: 0, comm: swapper Tainted: G D 2.6.36-rc3 #3
> <4>[ 1755.557180] Call Trace:
> <4>[ 1755.557183] <IRQ> [<ffffffff813e47d2>] panic+0x8c/0x189
> <4>[ 1755.557199] [<ffffffff813ed90c>] oops_end+0x87/0x94
> <4>[ 1755.557206] [<ffffffff813e4737>] no_context+0x1f4/0x203
> <4>[ 1755.557216] [<ffffffff8104487f>] __bad_area_nosemaphore+0x17f/0x1a2
> <4>[ 1755.557224] [<ffffffff810448b0>] bad_area_nosemaphore+0xe/0x10
> <4>[ 1755.557233] [<ffffffff813ef9fd>] do_page_fault+0x1ee/0x3c2
> <4>[ 1755.557243] [<ffffffff810e4748>] ? check_object+0x151/0x202
> <4>[ 1755.557254] [<ffffffffa00a336f>] ? uhci_alloc_td.isra.22+0x16/0x44 [uhci_hcd]
> <4>[ 1755.557265] [<ffffffffa00a3b17>] ? uhci_submit_common.isra.24+0x233/0x2d3 [uhci_hcd]
> <4>[ 1755.557273] [<ffffffff813ecde5>] page_fault+0x25/0x30
> <4>[ 1755.557287] [<ffffffffa0042bec>] ? hci_reassembly.part.13.constprop.18+0x23/0x1b5 [bluetooth]
> <4>[ 1755.557298] [<ffffffffa00a189f>] ? uhci_free_urb_priv+0xa6/0xb3 [uhci_hcd]
> <4>[ 1755.557311] [<ffffffffa0042dc5>] hci_recv_fragment+0x47/0x65 [bluetooth]
> <4>[ 1755.557322] [<ffffffffa00705ee>] btusb_bulk_complete+0x56/0xd6 [btusb]
> <4>[ 1755.557330] [<ffffffff812c1df9>] usb_hcd_giveback_urb+0x5d/0x8d
> <4>[ 1755.557340] [<ffffffffa00a217b>] uhci_giveback_urb+0x11a/0x1a9 [uhci_hcd]
> <4>[ 1755.557351] [<ffffffffa00a2a1a>] uhci_scan_schedule+0x544/0x84e [uhci_hcd]
> <4>[ 1755.557362] [<ffffffffa00a3343>] uhci_irq+0xee/0x104 [uhci_hcd]
> <4>[ 1755.557369] [<ffffffff812c1a08>] usb_hcd_irq+0x43/0x79
> <4>[ 1755.557377] [<ffffffff81098c0b>] handle_IRQ_event+0x6e/0x14b
> <4>[ 1755.557386] [<ffffffff8109aa52>] handle_fasteoi_irq+0x92/0xd2
> <4>[ 1755.557393] [<ffffffff81029ab6>] handle_irq+0x86/0x8c
> <4>[ 1755.557401] [<ffffffff8102975c>] do_IRQ+0x57/0xbe
> <4>[ 1755.557408] [<ffffffff813ecb93>] ret_from_intr+0x0/0x11
> <4>[ 1755.557413] <EOI> [<ffffffffa0022e7b>] ? acpi_idle_enter_bm+0x252/0x28a [processor]
> <4>[ 1755.557420] [<ffffffffa0022e74>] ? acpi_idle_enter_bm+0x24b/0x28a [processor]
> <4>[ 1755.557420] [<ffffffff8130a5d5>] ? menu_select+0x16f/0x296
> <4>[ 1755.557420] [<ffffffff81309501>] cpuidle_idle_call+0x9f/0x119 > <4>[ 1755.557420] [<ffffffff81025db4>] cpu_idle+0x62/0xc5 > <4>[ 1755.557420] [<ffffffff813d1bd4>] rest_init+0x68/0x6a > <4>[ 1755.557420] [<ffffffff8168cb7b>] start_kernel+0x365/0x370
> <4>[ 1755.557420] [<ffffffff8168c2a6>] x86_64_start_reservations+0xad/0xb1
> <4>[ 1755.557420] [<ffffffff8168c140>] ? early_idt_handler+0x0/0x71
> <4>[ 1755.557420] [<ffffffff8168c3a3>] x86_64_start_kernel+0xf9/0x108
Suraj, do you have any idea on that?
--
Gustavo F. Padovan
ProFUSION embedded systems - http://profusion.mobi
^ permalink raw reply
* [PATCH] Changes in Health API
From: Santiago Carot-Nemesio @ 2010-09-01 7:42 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Santiago Carot-Nemesio
Connections are made directly to a device and bluetoothd daemon
guess the PSM connection and the MDEPID based on the data get
from the SDP record.
Also a property that indicates the first realiable channel is
added to the HealthDevice object.
---
doc/health-api.txt | 119 +++++++++++++++++++++++-----------------------------
1 files changed, 53 insertions(+), 66 deletions(-)
diff --git a/doc/health-api.txt b/doc/health-api.txt
index f469df3..0a7ae73 100644
--- a/doc/health-api.txt
+++ b/doc/health-api.txt
@@ -14,12 +14,9 @@ Object path /org/bluez/
Methods:
- object CreateApplication(dict config, object agent)
+ object CreateApplication(dict config)
- Returns the path of the new registered application. The agent
- parameter is the path of the object with the callbacks to
- notify events (see org.bluez.HealthAgent at the end
- of this document).
+ Returns the path of the new registered application.
Dict is defined as bellow:
{
@@ -39,32 +36,33 @@ Methods:
Closes the HDP application identified by the object path. Also
application will be closed if the process that started it leaves
- the bus.
+ the bus. Only the creator of the application will be able to
+ destroy it.
Possible errors: org.bluez.Error.InvalidArguments
org.bluez.Error.NotFound
+ org.bluez.Error.NotAllowed
--------------------------------------------------------------------------------
Service org.bluez
-Interface org.bluez.HealthApplication
-Object path [variable prefix]/health_app_ZZZZ
+Interface org.bluez.HealthDevice
+Object path [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX
Methods:
- void Echo(object service)
+ Boolean Echo()
Sends an echo petition to the remote service. Returns True if
response matches with the buffer sent. If some error is detected
- False value is returned and the associated MCL is closed.
+ False value is returned.
Possible errors: org.bluez.Error.InvalidArguments
org.bluez.Error.OutOfRange
- object CreateChannel(object service, string type)
+ object CreateChannel(object application, string configuration)
- Creates a new data channel with the indicated config to the
- remote Service.
+ Creates a new data channel.
The configuration should indicate the channel quality of
service using one of this values "Reliable", "Streaming", "Any".
@@ -76,16 +74,39 @@ Methods:
void DestroyChannel(object channel)
- Destroys the data channel object.
+ Destroys the data channel object. Only the creator of the
+ channel or the creator of the HealtApplication that received the
+ data channel will be able to destroy it
Possible errors: org.bluez.Error.InvalidArguments
- orb.bluez.Error.NotFound
+ org.bluez.Error.NotFound
+ org.bluez.Error.NotAllowed
---------------------------------------------------------------------------------
+Signals:
-Service org.bluez
-Interface org.bluez.HealthService
-Object path [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/hdp_YYYY
+ void ChannelConnected(object channel)
+
+ This signal is launched when a new data channel is created or
+ when a known data channel is reconnected.
+
+ void ChannelDeleted(object channel)
+
+ This signal is launched when a data channel is deleted.
+
+ After this signal the data channel path will not be valid and
+ its path can be reused for future data channels.
+
+ void PropertyChanged(string name, variant value)
+
+ This signal indicates a changed value of the given property.
+
+Properties:
+
+ object MainChannel [readonly]
+
+ The first reliable channel opened. It is needed by upper
+ applications in order to send specific protocol data units. The
+ first reliable can change after a reconnection.
--------------------------------------------------------------------------------
@@ -94,6 +115,9 @@ Interface org.bluez.HealthChannel
Object path [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/
hdp_YYYY/channel_ZZ
+Only the process that created the data channel or the creator of the
+HealthApplication that received it will be able to call this methods.
+
Methods:
dict GetProperties()
@@ -101,68 +125,31 @@ Methods:
Returns all properties for the interface. See the properties
section for available properties.
+ Posible errors: org.bluez.Error.NotAllowed
+
fd Acquire()
Returns the file descriptor for this data channel. If the data
channel is not connected it will also reconnect.
Possible errors: org.bluez.Error.NotConnected
+ org.bluez.Error.NotAllowed
void Release()
Releases the fd. Application should also need to close() it.
+ Possible errors: org.bluez.Error.NotAcquired
+ org.bluez.Error.NotAllowed
+
Properties:
- string Type (read only)
+ string Type [readonly]
The quality of service of the data channel. ("Reliable" or
"Streaming")
- object Service (read only)
-
- Identifies the Remote Service that is connected with. Maps with
- a HealthService object.
-
-HealthAgent hierarchy
-=====================
-
-(this object is implemented by the HDP user in order to receive notifications)
-
-Service unique name
-Interface org.bluez.HealthAgent
-Object path freely definable
-
-Methods:
-
- void Release()
-
- This method gets called when the service daemon unregisters the
- agent. An agent can use it to do cleanup tasks. There is no need
- to unregister the agent, because when this method gets called it
- has already been unregistered.
-
- void ServiceDiscovered(object service)
-
- This method is called when a device containing an HDP
- application is paired or when the method Update of the
- HealthManager is called and new HealthServices are discovered.
- The method will be called once for each HealthService.
-
- void ServiceRemoved(object service)
-
- This is called if during an Update some HealthServices
- have disappeared. The method is called once for each removed
- HealthService.
-
- void ChannelConnected(object channel)
-
- This method is called when a new data channel is created or when
- a known data channel is reconnected.
-
- void ChannelDeleted(object channel)
-
- This method is called when a data channel is deleted.
+ object Device [readonly]
- After this call the data channel path will not be valid and can
- be reused for future creation of data channels.
+ Identifies the Remote Device that is connected with. Maps with
+ a HealthDevice object.
--
1.6.3.3
^ permalink raw reply related
* Re: [PATCH] Solve compilation problem when SBC variable is not active
From: Johan Hedberg @ 2010-08-31 18:12 UTC (permalink / raw)
To: Jose Antonio Santos Cadenas; +Cc: linux-bluetooth
In-Reply-To: <1283266211-15798-1-git-send-email-santoscadenas@gmail.com>
Hi,
On Tue, Aug 31, 2010, Jose Antonio Santos Cadenas wrote:
> The inclusion of src/attrib-server.c file by default in the daemon
> source needs also to compile by default attrib_sources, not only
> when SBC is active.
> ---
> Makefile.am | 5 ++---
> 1 files changed, 2 insertions(+), 3 deletions(-)
Thanks. The patch has been pushed upstream.
Johan
^ permalink raw reply
* [PATCH]Bluetooth:net/bluetooth/hci_core.c Fix system crash when creating a new device with bluetooth-applet
From: Justin P. Mattock @ 2010-08-31 17:13 UTC (permalink / raw)
To: linux-bluetooth; +Cc: marcel, suraj, linux-kernel, Justin P. Mattock
When using bluetooth-applet adding my apple magic mouse I'm getting a total system freeze.
I used firescope to grab the crash data(below) The results of the bisect pointed to here:
Bluetooth: Implemented HCI frame reassembly from RX stream
commit:9981151086385eecc2febf4ba95a14593f834b3d
after looking through, and at the crash log, I couldn't help but notice something in there
with IRQ, then after looking at hci_h4.c /* H4 receiver States */ #58 I noticed
#define H4_W4_PACKET_TYPE 0 is at zero as well as #define STREAM_REASSEMBLY 0
so changing STREAM_REASSEMBLY to a different number that isn't taken gets my machine to connect
perfectly to my magic mouse. Please have a look and let me know if this is a good
solution and/or send me something else to test out.
crash:
<1>[ 1755.556472] BUG: unable to handle kernel paging request at ffff880224d0c548
<1>[ 1755.556485] IP: [<ffffffffa0042bec>] hci_reassembly.part.13.constprop.18+0x23/0x1b5 [bluetooth]
<4>[ 1755.556507] PGD 1609063 PUD 0
<0>[ 1755.556515] Oops: 0000 [#1] SMP
<0>[ 1755.556522] last sysfs file: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0/voltage_now
<4>[ 1755.556530] CPU 0
<4>[ 1755.556533] Modules linked in: usb_storage xfrm4_mode_transport xcbc rmd160 sha512_generic sco bnep xt_tcpudp ipt_LOG iptable_nat nf_nat xt_state nf_conntrack_ftp nf_conntrack_ipv4 nf_conntrack nf_defrag_ipv4 iptable_filter ip_tables x_tables ath9k firewire_ohci ath9k_common firewire_core ath9k_hw battery ac ohci1394 evdev thermal ath sky2 joydev button snd_hda_codec_idt snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_timer i2c_i801 snd soundcore snd_page_alloc video aes_x86_64 lzo lzo_compress tun kvm_intel ipcomp xfrm_ipcomp crypto_null sha256_generic cbc des_generic cast5 blowfish serpent camellia twofish_generic twofish_x86_64 twofish_common ctr ah4 esp4 authenc raw1394 ieee1394 uhci_hcd ehci_hcd hci_uart rfcomm btusb hidp l2cap bluetooth coretemp acpi_cpufreq processor mperf appletouch applesmc
<4>[ 1755.556676]
<4>[ 1755.556682] Pid: 0, comm: swapper Not tainted 2.6.36-rc3 #3 Mac-F42187C8/MacBookPro2,2
<4>[ 1755.556688] RIP: 0010:[<ffffffffa0042bec>] [<ffffffffa0042bec>] hci_reassembly.part.13.constprop.18+0x23/0x1b5 [bluetooth]
<4>[ 1755.556705] RSP: 0018:ffff880001803ca8 EFLAGS: 00010092
<4>[ 1755.556710] RAX: 000000003df64001 RBX: 0000000000000014 RCX: 0000000000000014
<4>[ 1755.556716] RDX: ffff8800372018d8 RSI: 0000000000000002 RDI: ffff8800351ec240
<4>[ 1755.556722] RBP: ffff880001803cf8 R08: ffff88003df64001 R09: ffff88000180f398
<4>[ 1755.556728] R10: dead000000100100 R11: dead000000200200 R12: ffff8800351ec240
<4>[ 1755.556733] R13: 0000000000000002 R14: 000000003df64001 R15: 0000000000000001
<4>[ 1755.556740] FS: 0000000000000000(0000) GS:ffff880001800000(0000) knlGS:0000000000000000
<4>[ 1755.556746] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
<4>[ 1755.556752] CR2: ffff880224d0c548 CR3: 0000000001608000 CR4: 00000000000006f0
<4>[ 1755.556758] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
<4>[ 1755.556763] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
<4>[ 1755.556770] Process swapper (pid: 0, threadinfo ffffffff815f0000, task ffffffff81610020)
<0>[ 1755.556774] Stack:
<4>[ 1755.556778] ffffea0000b9fdc8 ffff88003df64000 ffff8800372018d8 ffffffffa00a189f
<4>[ 1755.556787] <0> ffff880001803d08 0000000000000014 0000000000000002 ffff8800372018d8
<4>[ 1755.556797] <0> ffff8800351ec240 0000000000000001 ffff880001803d38 ffffffffa0042dc5
<0>[ 1755.556809] Call Trace:
<0>[ 1755.556813] <IRQ>
<4>[ 1755.556825] [<ffffffffa00a189f>] ? uhci_free_urb_priv+0xa6/0xb3 [uhci_hcd]
<4>[ 1755.556839] [<ffffffffa0042dc5>] hci_recv_fragment+0x47/0x65 [bluetooth]
<4>[ 1755.556851] [<ffffffffa00705ee>] btusb_bulk_complete+0x56/0xd6 [btusb]
<4>[ 1755.556862] [<ffffffff812c1df9>] usb_hcd_giveback_urb+0x5d/0x8d
<4>[ 1755.556873] [<ffffffffa00a217b>] uhci_giveback_urb+0x11a/0x1a9 [uhci_hcd]
<4>[ 1755.556884] [<ffffffffa00a2a1a>] uhci_scan_schedule+0x544/0x84e [uhci_hcd]
<4>[ 1755.556896] [<ffffffffa00a3343>] uhci_irq+0xee/0x104 [uhci_hcd]
<4>[ 1755.556903] [<ffffffff812c1a08>] usb_hcd_irq+0x43/0x79
<4>[ 1755.556913] [<ffffffff81098c0b>] handle_IRQ_event+0x6e/0x14b
<4>[ 1755.556922] [<ffffffff8109aa52>] handle_fasteoi_irq+0x92/0xd2
<4>[ 1755.556931] [<ffffffff81029ab6>] handle_irq+0x86/0x8c
<4>[ 1755.556938] [<ffffffff8102975c>] do_IRQ+0x57/0xbe
<4>[ 1755.556948] [<ffffffff813ecb93>] ret_from_intr+0x0/0x11
<0>[ 1755.556952] <EOI>
<4>[ 1755.556966] [<ffffffffa0022e7b>] ? acpi_idle_enter_bm+0x252/0x28a [processor]
<4>[ 1755.556979] [<ffffffffa0022e74>] ? acpi_idle_enter_bm+0x24b/0x28a [processor]
<4>[ 1755.556988] [<ffffffff8130a5d5>] ? menu_select+0x16f/0x296
<4>[ 1755.556996] [<ffffffff81309501>] cpuidle_idle_call+0x9f/0x119
<4>[ 1755.557004] [<ffffffff81025db4>] cpu_idle+0x62/0xc5
<4>[ 1755.557014] [<ffffffff813d1bd4>] rest_init+0x68/0x6a
<4>[ 1755.557024] [<ffffffff8168cb7b>] start_kernel+0x365/0x370
<4>[ 1755.557033] [<ffffffff8168c2a6>] x86_64_start_reservations+0xad/0xb1
<4>[ 1755.557042] [<ffffffff8168c140>] ? early_idt_handler+0x0/0x71
<4>[ 1755.557050] [<ffffffff8168c3a3>] x86_64_start_kernel+0xf9/0x108
<0>[ 1755.557055] Code: 41 5c 41 5d 41 5e c9 c3 55 49 63 c0 48 89 e5 41 57 41 56 45 89 c6 41 55 41 89 f5 41 54 49 89 fc 53 89 cb 48 83 ec 28 48 89 55 c0 <48> 8b 94 c7 00 03 00 00 48 85 d2 0f 85 61 01 00 00 41 8d 45 fe
<1>[ 1755.557139] RIP [<ffffffffa0042bec>] hci_reassembly.part.13.constprop.18+0x23/0x1b5 [bluetooth]
<4>[ 1755.557154] RSP <ffff880001803ca8>
<0>[ 1755.557158] CR2: ffff880224d0c548
<4>[ 1755.557164] ---[ end trace 6c64514f0ad01ea5 ]---
<0>[ 1755.557169] Kernel panic - not syncing: Fatal exception in interrupt
<4>[ 1755.557176] Pid: 0, comm: swapper Tainted: G D 2.6.36-rc3 #3
<4>[ 1755.557180] Call Trace:
<4>[ 1755.557183] <IRQ> [<ffffffff813e47d2>] panic+0x8c/0x189
<4>[ 1755.557199] [<ffffffff813ed90c>] oops_end+0x87/0x94
<4>[ 1755.557206] [<ffffffff813e4737>] no_context+0x1f4/0x203
<4>[ 1755.557216] [<ffffffff8104487f>] __bad_area_nosemaphore+0x17f/0x1a2
<4>[ 1755.557224] [<ffffffff810448b0>] bad_area_nosemaphore+0xe/0x10
<4>[ 1755.557233] [<ffffffff813ef9fd>] do_page_fault+0x1ee/0x3c2
<4>[ 1755.557243] [<ffffffff810e4748>] ? check_object+0x151/0x202
<4>[ 1755.557254] [<ffffffffa00a336f>] ? uhci_alloc_td.isra.22+0x16/0x44 [uhci_hcd]
<4>[ 1755.557265] [<ffffffffa00a3b17>] ? uhci_submit_common.isra.24+0x233/0x2d3 [uhci_hcd]
<4>[ 1755.557273] [<ffffffff813ecde5>] page_fault+0x25/0x30
<4>[ 1755.557287] [<ffffffffa0042bec>] ? hci_reassembly.part.13.constprop.18+0x23/0x1b5 [bluetooth]
<4>[ 1755.557298] [<ffffffffa00a189f>] ? uhci_free_urb_priv+0xa6/0xb3 [uhci_hcd]
<4>[ 1755.557311] [<ffffffffa0042dc5>] hci_recv_fragment+0x47/0x65 [bluetooth]
<4>[ 1755.557322] [<ffffffffa00705ee>] btusb_bulk_complete+0x56/0xd6 [btusb]
<4>[ 1755.557330] [<ffffffff812c1df9>] usb_hcd_giveback_urb+0x5d/0x8d
<4>[ 1755.557340] [<ffffffffa00a217b>] uhci_giveback_urb+0x11a/0x1a9 [uhci_hcd]
<4>[ 1755.557351] [<ffffffffa00a2a1a>] uhci_scan_schedule+0x544/0x84e [uhci_hcd]
<4>[ 1755.557362] [<ffffffffa00a3343>] uhci_irq+0xee/0x104 [uhci_hcd]
<4>[ 1755.557369] [<ffffffff812c1a08>] usb_hcd_irq+0x43/0x79
<4>[ 1755.557377] [<ffffffff81098c0b>] handle_IRQ_event+0x6e/0x14b
<4>[ 1755.557386] [<ffffffff8109aa52>] handle_fasteoi_irq+0x92/0xd2
<4>[ 1755.557393] [<ffffffff81029ab6>] handle_irq+0x86/0x8c
<4>[ 1755.557401] [<ffffffff8102975c>] do_IRQ+0x57/0xbe
<4>[ 1755.557408] [<ffffffff813ecb93>] ret_from_intr+0x0/0x11
<4>[ 1755.557413] <EOI> [<ffffffffa0022e7b>] ? acpi_idle_enter_bm+0x252/0x28a [processor]
<4>[ 1755.557420] [<ffffffffa0022e74>] ? acpi_idle_enter_bm+0x24b/0x28a [processor]
<4>[ 1755.557420] [<ffffffff8130a5d5>] ? menu_select+0x16f/0x296
<4>[ 1755.557420] [<ffffffff81309501>] cpuidle_idle_call+0x9f/0x119
<4>[ 1755.557420] [<ffffffff81025db4>] cpu_idle+0x62/0xc5
<4>[ 1755.557420] [<ffffffff813d1bd4>] rest_init+0x68/0x6a
<4>[ 1755.557420] [<ffffffff8168cb7b>] start_kernel+0x365/0x370
<4>[ 1755.557420] [<ffffffff8168c2a6>] x86_64_start_reservations+0xad/0xb1
<4>[ 1755.557420] [<ffffffff8168c140>] ? early_idt_handler+0x0/0x71
<4>[ 1755.557420] [<ffffffff8168c3a3>] x86_64_start_kernel+0xf9/0x108
Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
---
net/bluetooth/hci_core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index c52f091..fab9648 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1163,7 +1163,7 @@ int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count)
}
EXPORT_SYMBOL(hci_recv_fragment);
-#define STREAM_REASSEMBLY 0
+#define STREAM_REASSEMBLY 5
int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count)
{
--
1.7.2.1
^ permalink raw reply related
* Re: BlueZ's A2DP sink role
From: Pavan Savoy @ 2010-08-31 15:15 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <AANLkTi=qrkSSmDNcVNpFm=3=5mSzs9Se08h8JDryDcOu@mail.gmail.com>
On Thu, Aug 19, 2010 at 3:49 AM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> Hi Pavan,
>
> On Wed, Aug 18, 2010 at 11:22 PM, Pavan Savoy <pavan_savoy@sify.com> wrote:
>> As I understand, the A2DP sink role is @ audio/source.c and A2DP
>> source role is at sink.c ? (or what is called as the interfaces?..)
>> Also How do I test out a2dp sink role in BlueZ, any test audio-server
>> I can run ?
>
> You can use PA as explained in Joao Paulo's blog:
>
> http://jprvita.wordpress.com/2009/12/15/1-2-3-4-a2dp-stream/
>
Thanks....
Something regarding AVRCP target and controller role, So Just saying
Enable=Control,Source
gets me both AVRCP TG and AVRCP CT why? isn't there specific option for it?
Also is there a man page/wiki for audio.conf which gets updated now
and then? with all these new options...
> --
> Luiz Augusto von Dentz
> Computer Engineer
>
^ permalink raw reply
* [PATCH] Solve compilation problem when SBC variable is not active
From: Jose Antonio Santos Cadenas @ 2010-08-31 14:50 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jose Antonio Santos Cadenas
In-Reply-To: <AANLkTinHLGYkji4Eoxu_QReDQCHndB7r319jB-2butVT@mail.gmail.com>
The inclusion of src/attrib-server.c file by default in the daemon
source needs also to compile by default attrib_sources, not only
when SBC is active.
---
Makefile.am | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 47478c2..5684e99 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -79,9 +79,6 @@ sbc_sbcdec_LDADD = sbc/libsbc.la
sbc_sbcenc_SOURCES = sbc/sbcenc.c sbc/formats.h
sbc_sbcenc_LDADD = sbc/libsbc.la
-attrib_sources = attrib/att.h attrib/att.c attrib/gatt.h attrib/gatt.c \
- attrib/gattrib.h attrib/gattrib.c
-
if SNDFILE
noinst_PROGRAMS += sbc/sbctester
@@ -90,6 +87,8 @@ sbc_sbctest_CFLAGS = @SNDFILE_CFLAGS@
endif
endif
+attrib_sources = attrib/att.h attrib/att.c attrib/gatt.h attrib/gatt.c \
+ attrib/gattrib.h attrib/gattrib.c
if NETLINK
plugin_LTLIBRARIES += plugins/netlink.la
--
1.7.0.4
^ permalink raw reply related
* [PATCH] Add handling for more than one address with in vCard structure
From: Rafał Michalski @ 2010-08-31 7:36 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Rafał Michalski
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: 0001-Add-handling-for-more-than-one-address-with-in-vCard.patch --]
[-- Type: text/x-patch, Size: 16135 bytes --]
From 9a56973f11afbba0135a419de232303ff4cc262e Mon Sep 17 00:00:00 2001
From: Rafal Michalski <michalski.raf@gmail.com>
Date: Mon, 30 Aug 2010 16:03:12 +0200
Subject: [PATCH] Add handling for more than one address with in vCard structure
After pulling contacts only fields (pobox, extended, street, locality,
region, postal, country) of one address were present in downloaded vCard
structure (under ADR tag) in spite of that there can be more adresses
stored on phonebook. To solve this problem extending number of columns and
queries of database was needed especially. Distinguish between two types of
address (HOME and WORK) is supported.
---
plugins/phonebook-tracker.c | 139 +++++++++++++++++++++++++++++++++++++------
plugins/vcard.c | 92 +++++++++++++++++++++--------
plugins/vcard.h | 26 ++++++--
3 files changed, 208 insertions(+), 49 deletions(-)
diff --git a/plugins/phonebook-tracker.c b/plugins/phonebook-tracker.c
index 1f1f693..e17995d 100644
--- a/plugins/phonebook-tracker.c
+++ b/plugins/phonebook-tracker.c
@@ -43,16 +43,16 @@
#define TRACKER_RESOURCES_INTERFACE "org.freedesktop.Tracker1.Resources"
#define TRACKER_DEFAULT_CONTACT_ME "http://www.semanticdesktop.org/ontologies/2007/03/22/nco#default-contact-me"
-#define CONTACTS_ID_COL 28
-#define PULL_QUERY_COL_AMOUNT 29
+#define CONTACTS_ID_COL 35
+#define PULL_QUERY_COL_AMOUNT 36
#define COL_HOME_NUMBER 0
#define COL_HOME_EMAIL 7
#define COL_WORK_NUMBER 8
#define COL_FAX_NUMBER 16
#define COL_WORK_EMAIL 17
-#define COL_DATE 25
-#define COL_SENT 26
-#define COL_ANSWERED 27
+#define COL_DATE 32
+#define COL_SENT 33
+#define COL_ANSWERED 34
#define CONTACTS_QUERY_ALL \
"SELECT ?v nco:fullname(?c) " \
@@ -64,7 +64,9 @@
"nco:postalcode(?p) nco:country(?p) ?f nco:emailAddress(?ew) " \
"nco:birthDate(?c) nco:nickname(?c) nco:websiteUrl(?c) " \
"nco:photo(?c) nco:fullname(?o) nco:department(?a) " \
- "nco:role(?a) " \
+ "nco:role(?a) nco:pobox(?pw) nco:extendedAddress(?pw) " \
+ "nco:streetAddress(?pw) nco:locality(?pw) nco:region(?pw) " \
+ "nco:postalcode(?pw) nco:country(?pw) " \
"\"NOTACALL\" \"false\" \"false\" ?c " \
"WHERE { " \
"?c a nco:PersonContact . " \
@@ -84,6 +86,7 @@
"?c nco:hasAffiliation ?a . " \
"OPTIONAL { ?a nco:hasPhoneNumber ?w . } " \
"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \
+ "OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \
"OPTIONAL { ?a nco:org ?o . } " \
"} " \
"}"
@@ -112,7 +115,9 @@
"nco:postalcode(?p) nco:country(?p) ?f nco:emailAddress(?ew) " \
"nco:birthDate(?c) nco:nickname(?c) nco:websiteUrl(?c) " \
"nco:photo(?c) nco:fullname(?o) nco:department(?a) " \
- "nco:role(?a) " \
+ "nco:role(?a) nco:pobox(?pw) nco:extendedAddress(?pw) " \
+ "nco:streetAddress(?pw) nco:locality(?pw) nco:region(?pw) " \
+ "nco:postalcode(?pw) nco:country(?pw) " \
"nmo:receivedDate(?call) " \
"nmo:isSent(?call) nmo:isAnswered(?call) ?c " \
"WHERE { " \
@@ -133,6 +138,7 @@
"?c nco:hasAffiliation ?a . " \
"OPTIONAL { ?a nco:hasPhoneNumber ?w . } " \
"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \
+ "OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \
"OPTIONAL { ?a nco:org ?o . } " \
"} " \
"} ORDER BY DESC(nmo:receivedDate(?call))"
@@ -161,7 +167,9 @@
"nco:postalcode(?p) nco:country(?p) ?f nco:emailAddress(?ew) " \
"nco:birthDate(?c) nco:nickname(?c) nco:websiteUrl(?c) " \
"nco:photo(?c) nco:fullname(?o) nco:department(?a) " \
- "nco:role(?a) " \
+ "nco:role(?a) nco:pobox(?pw) nco:extendedAddress(?pw) " \
+ "nco:streetAddress(?pw) nco:locality(?pw) nco:region(?pw) " \
+ "nco:postalcode(?pw) nco:country(?pw) " \
"nmo:receivedDate(?call) " \
"nmo:isSent(?call) nmo:isAnswered(?call) ?c " \
"WHERE { " \
@@ -182,6 +190,7 @@
"?c nco:hasAffiliation ?a . " \
"OPTIONAL { ?a nco:hasPhoneNumber ?w . } " \
"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \
+ "OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \
"OPTIONAL { ?a nco:org ?o . } " \
"} " \
"} ORDER BY DESC(nmo:receivedDate(?call))"
@@ -210,7 +219,9 @@
"nco:postalcode(?p) nco:country(?p) ?f nco:emailAddress(?ew)" \
"nco:birthDate(?c) nco:nickname(?c) nco:websiteUrl(?c) " \
"nco:photo(?c) nco:fullname(?o) nco:department(?a) " \
- "nco:role(?a) " \
+ "nco:role(?a) nco:pobox(?pw) nco:extendedAddress(?pw) " \
+ "nco:streetAddress(?pw) nco:locality(?pw) nco:region(?pw) " \
+ "nco:postalcode(?pw) nco:country(?pw) " \
"nmo:receivedDate(?call) " \
"nmo:isSent(?call) nmo:isAnswered(?call) ?c " \
"WHERE { " \
@@ -230,6 +241,7 @@
"?c nco:hasAffiliation ?a . " \
"OPTIONAL { ?a nco:hasPhoneNumber ?w . } " \
"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \
+ "OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \
"OPTIONAL { ?a nco:org ?o . } " \
"} " \
"} ORDER BY DESC(nmo:sentDate(?call))"
@@ -257,7 +269,9 @@
"nco:postalcode(?p) nco:country(?p) ?f nco:emailAddress(?ew) " \
"nco:birthDate(?c) nco:nickname(?c) nco:websiteUrl(?c) " \
"nco:photo(?c) nco:fullname(?o) nco:department(?a) " \
- "nco:role(?a) " \
+ "nco:role(?a) nco:pobox(?pw) nco:extendedAddress(?pw) " \
+ "nco:streetAddress(?pw) nco:locality(?pw) nco:region(?pw) " \
+ "nco:postalcode(?pw) nco:country(?pw) " \
"nmo:receivedDate(?call) " \
"nmo:isSent(?call) nmo:isAnswered(?call) ?c " \
"WHERE { " \
@@ -277,6 +291,7 @@
"OPTIONAL { ?c nco:hasAffiliation ?a . " \
"OPTIONAL { ?a nco:hasPhoneNumber ?w . } " \
"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \
+ "OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \
"OPTIONAL { ?a nco:org ?o . } " \
"} " \
"} UNION { " \
@@ -295,6 +310,7 @@
"OPTIONAL { ?c nco:hasAffiliation ?a . " \
"OPTIONAL { ?a nco:hasPhoneNumber ?w . } " \
"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \
+ "OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \
"OPTIONAL { ?a nco:org ?o . } " \
"} " \
"} } ORDER BY DESC(nmo:receivedDate(?call))"
@@ -329,7 +345,9 @@
"nco:postalcode(?p) nco:country(?p) ?f nco:emailAddress(?ew)" \
"nco:birthDate(<%s>) nco:nickname(<%s>) nco:websiteUrl(<%s>) " \
"nco:photo(<%s>) nco:fullname(?o) nco:department(?a) " \
- "nco:role(?a) " \
+ "nco:role(?a) nco:pobox(?pw) nco:extendedAddress(?pw) " \
+ "nco:streetAddress(?pw) nco:locality(?pw) nco:region(?pw) " \
+ "nco:postalcode(?pw) nco:country(?pw) " \
"\"NOTACALL\" \"false\" \"false\" <%s> " \
"WHERE { " \
"<%s> a nco:Contact . " \
@@ -349,6 +367,7 @@
"<%s> nco:hasAffiliation ?a . " \
"OPTIONAL { ?a nco:hasPhoneNumber ?w . }" \
"OPTIONAL { ?a nco:hasEmailAddress ?ew . }" \
+ "OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \
"OPTIONAL { ?a nco:org ?o . } " \
"} " \
"}"
@@ -721,6 +740,73 @@ static void add_email(struct phonebook_contact *contact, const char *address,
contact->emails = g_slist_append(contact->emails, email);
}
+static struct phonebook_address *find_address(GSList *addresses,
+ struct phonebook_address *address)
+{
+ GSList *l;
+
+ for (l = addresses; l; l = l->next) {
+ struct phonebook_address *addr = l->data;
+ if (g_strcmp0(addr->pobox, address->pobox) == 0 &&
+ g_strcmp0(addr->extended, address->extended) == 0 &&
+ g_strcmp0(addr->street, address->street) == 0 &&
+ g_strcmp0(addr->locality, address->locality) == 0 &&
+ g_strcmp0(addr->region, address->region) == 0 &&
+ g_strcmp0(addr->postal, address->postal) == 0 &&
+ g_strcmp0(addr->country, address->country) == 0 &&
+ addr->type == address->type)
+ return addr;
+ }
+
+ return NULL;
+}
+
+static gboolean address_fields_present(struct phonebook_address *address)
+{
+ if (address->pobox && strlen(address->pobox))
+ return TRUE;
+ if (address->extended && strlen(address->extended))
+ return TRUE;
+ if (address->street && strlen(address->street))
+ return TRUE;
+ if (address->locality && strlen(address->locality))
+ return TRUE;
+ if (address->region && strlen(address->region))
+ return TRUE;
+ if (address->postal && strlen(address->postal))
+ return TRUE;
+ if (address->country && strlen(address->country))
+ return TRUE;
+
+ return FALSE;
+}
+
+static void add_address(struct phonebook_contact *contact,
+ struct phonebook_address *address)
+{
+ struct phonebook_address *addr;
+
+ if (address == NULL || address_fields_present(address) == FALSE)
+ return;
+
+ /* Not adding address if there is already added with the same value */
+ if (find_address(contact->addresses, address))
+ return;
+
+ addr = g_new0(struct phonebook_address, 1);
+
+ addr->pobox = g_strdup(address->pobox);
+ addr->extended = g_strdup(address->extended);
+ addr->street = g_strdup(address->street);
+ addr->locality = g_strdup(address->locality);
+ addr->region = g_strdup(address->region);
+ addr->postal = g_strdup(address->postal);
+ addr->country = g_strdup(address->country);
+ addr->type = address->type;
+
+ contact->addresses = g_slist_append(contact->addresses, addr);
+}
+
static GString *gen_vcards(GSList *contacts,
const struct apparam_field *params)
{
@@ -803,13 +889,6 @@ add_entry:
contact->additional = g_strdup(reply[4]);
contact->prefix = g_strdup(reply[5]);
contact->suffix = g_strdup(reply[6]);
- contact->pobox = g_strdup(reply[9]);
- contact->extended = g_strdup(reply[10]);
- contact->street = g_strdup(reply[11]);
- contact->locality = g_strdup(reply[12]);
- contact->region = g_strdup(reply[13]);
- contact->postal = g_strdup(reply[14]);
- contact->country = g_strdup(reply[15]);
contact->birthday = g_strdup(reply[18]);
contact->nickname = g_strdup(reply[19]);
contact->website = g_strdup(reply[20]);
@@ -831,6 +910,30 @@ add_numbers:
add_email(contact, reply[COL_HOME_EMAIL], EMAIL_TYPE_HOME);
add_email(contact, reply[COL_WORK_EMAIL], EMAIL_TYPE_WORK);
+ /* Adding addresses */
+ struct phonebook_address home_addr = { g_strdup(reply[9]),
+ g_strdup(reply[10]),
+ g_strdup(reply[11]),
+ g_strdup(reply[12]),
+ g_strdup(reply[13]),
+ g_strdup(reply[14]),
+ g_strdup(reply[15]),
+ ADDR_TYPE_HOME
+ };
+
+ struct phonebook_address work_addr = { g_strdup(reply[25]),
+ g_strdup(reply[26]),
+ g_strdup(reply[27]),
+ g_strdup(reply[28]),
+ g_strdup(reply[29]),
+ g_strdup(reply[30]),
+ g_strdup(reply[31]),
+ ADDR_TYPE_WORK
+ };
+
+ add_address(contact, &home_addr);
+ add_address(contact, &work_addr);
+
DBG("contact %p", contact);
/* Adding contacts data to wrapper struct - this data will be used to
diff --git a/plugins/vcard.c b/plugins/vcard.c
index 09f4f40..e7e4cc7 100644
--- a/plugins/vcard.c
+++ b/plugins/vcard.c
@@ -155,21 +155,21 @@ static gboolean contact_fields_present(struct phonebook_contact * contact)
return FALSE;
}
-static gboolean address_fields_present(struct phonebook_contact *contact)
+static gboolean address_fields_present(struct phonebook_address *address)
{
- if (contact->pobox && strlen(contact->pobox))
+ if (address->pobox && strlen(address->pobox))
return TRUE;
- if (contact->extended && strlen(contact->extended))
+ if (address->extended && strlen(address->extended))
return TRUE;
- if (contact->street && strlen(contact->street))
+ if (address->street && strlen(address->street))
return TRUE;
- if (contact->locality && strlen(contact->locality))
+ if (address->locality && strlen(address->locality))
return TRUE;
- if (contact->region && strlen(contact->region))
+ if (address->region && strlen(address->region))
return TRUE;
- if (contact->postal && strlen(contact->postal))
+ if (address->postal && strlen(address->postal))
return TRUE;
- if (contact->country && strlen(contact->country))
+ if (address->country && strlen(address->country))
return TRUE;
return FALSE;
@@ -376,18 +376,43 @@ static void vcard_printf_org(GString *vcards,
contact->department, contact->title);
}
-static void vcard_printf_adr(GString *vcards,
- struct phonebook_contact *contact)
+static void vcard_printf_address(GString *vcards, uint8_t format,
+ struct phonebook_address *addr)
{
- if (address_fields_present(contact) == FALSE) {
+ char buf[LEN_MAX];
+ const char *category_string = "";
+
+ if (!addr || address_fields_present(addr) == FALSE) {
vcard_printf(vcards, "ADR:");
return;
}
- vcard_printf(vcards, "ADR:%s;%s;%s;%s;%s;%s;%s", contact->pobox,
- contact->extended, contact->street,
- contact->locality, contact->region,
- contact->postal, contact->country);
+ switch (addr->type) {
+ case ADDR_TYPE_HOME:
+ if (format == FORMAT_VCARD21)
+ category_string = "HOME";
+ else if (format == FORMAT_VCARD30)
+ category_string = "TYPE=HOME";
+ break;
+ case ADDR_TYPE_WORK:
+ if (format == FORMAT_VCARD21)
+ category_string = "WORK";
+ else if (format == FORMAT_VCARD30)
+ category_string = "TYPE=WORK";
+ break;
+ default:
+ if (format == FORMAT_VCARD21)
+ category_string = "OTHER";
+ else if (format == FORMAT_VCARD30)
+ category_string = "TYPE=OTHER";
+ break;
+ }
+
+ snprintf(buf, LEN_MAX, "%s;%s;%s;%s;%s;%s;%s",
+ addr->pobox, addr->extended, addr->street,
+ addr->locality, addr->region, addr->postal, addr->country);
+
+ vcard_printf(vcards, "ADR;%s:%s", category_string, buf);
}
static void vcard_printf_datetime(GString *vcards,
@@ -468,8 +493,17 @@ void phonebook_add_contact(GString *vcards, struct phonebook_contact *contact,
}
}
- if (filter & FILTER_ADR)
- vcard_printf_adr(vcards, contact);
+ if (filter & FILTER_ADR) {
+ GSList *l = contact->addresses;
+
+ if (g_slist_length(l) == 0)
+ vcard_printf_address(vcards, format, NULL);
+
+ for (; l; l = l->next) {
+ struct phonebook_address *addr = l->data;
+ vcard_printf_address(vcards, format, addr);
+ }
+ }
if (filter & FILTER_BDAY)
vcard_printf_tag(vcards, format, "BDAY", NULL,
@@ -512,6 +546,20 @@ static void email_free(gpointer data, gpointer user_data)
g_free(email);
}
+static void address_free(gpointer data, gpointer user_data)
+{
+ struct phonebook_address *addr = data;
+
+ g_free(addr->pobox);
+ g_free(addr->extended);
+ g_free(addr->street);
+ g_free(addr->locality);
+ g_free(addr->region);
+ g_free(addr->postal);
+ g_free(addr->country);
+ g_free(addr);
+}
+
void phonebook_contact_free(struct phonebook_contact *contact)
{
if (contact == NULL)
@@ -523,19 +571,15 @@ void phonebook_contact_free(struct phonebook_contact *contact)
g_slist_foreach(contact->emails, email_free, NULL);
g_slist_free(contact->emails);
+ g_slist_foreach(contact->addresses, address_free, NULL);
+ g_slist_free(contact->addresses);
+
g_free(contact->fullname);
g_free(contact->given);
g_free(contact->family);
g_free(contact->additional);
g_free(contact->prefix);
g_free(contact->suffix);
- g_free(contact->pobox);
- g_free(contact->extended);
- g_free(contact->street);
- g_free(contact->locality);
- g_free(contact->region);
- g_free(contact->postal);
- g_free(contact->country);
g_free(contact->birthday);
g_free(contact->nickname);
g_free(contact->website);
diff --git a/plugins/vcard.h b/plugins/vcard.h
index a22dfc1..c8cac36 100644
--- a/plugins/vcard.h
+++ b/plugins/vcard.h
@@ -40,6 +40,12 @@ enum phonebook_call_type {
CALL_TYPE_OUTGOING,
};
+enum phonebook_address_type {
+ ADDR_TYPE_HOME,
+ ADDR_TYPE_WORK,
+ ADDR_TYPE_OTHER,
+};
+
struct phonebook_number {
char *tel;
int type;
@@ -50,6 +56,18 @@ struct phonebook_email {
int type;
};
+struct phonebook_address
+{
+ char *pobox;
+ char *extended;
+ char *street;
+ char *locality;
+ char *region;
+ char *postal;
+ char *country;
+ int type;
+};
+
struct phonebook_contact {
char *fullname;
char *given;
@@ -57,15 +75,9 @@ struct phonebook_contact {
char *additional;
GSList *numbers;
GSList *emails;
+ GSList *addresses;
char *prefix;
char *suffix;
- char *pobox;
- char *extended;
- char *street;
- char *locality;
- char *region;
- char *postal;
- char *country;
char *birthday;
char *nickname;
char *website;
--
1.6.3.3
^ permalink raw reply related
* Re: Check for connections and disable bluetooth in shell
From: Gustavo F. Padovan @ 2010-08-31 6:04 UTC (permalink / raw)
To: Jonathan Haug; +Cc: linux-bluetooth
In-Reply-To: <1283234299.1702.12.camel@josua>
Hi Jonathan,
* Jonathan Haug <jonathanhaug@wolke7.net> [2010-08-31 07:58:19 +0200]:
>
> Dear bluetooth-experts,
>
> I want to disable bluetooth on my system (via commandline), if there is
> no active bluetooth connection -- without being root.
>
> Therefor I need a way to
>
> 1. check if there is an active bluetooth connection
'hcitool conn' can show that to you.
--
Gustavo F. Padovan
ProFUSION embedded systems - http://profusion.mobi
^ permalink raw reply
* Check for connections and disable bluetooth in shell
From: Jonathan Haug @ 2010-08-31 5:58 UTC (permalink / raw)
To: linux-bluetooth
Dear bluetooth-experts,
I want to disable bluetooth on my system (via commandline), if there is
no active bluetooth connection -- without being root.
Therefor I need a way to
1. check if there is an active bluetooth connection
2. disable bluetooth without being root
For the second part I found
dbus-send --system --type=method_call --dest=org.bluez $(dbus-send
--system --print-reply --dest=org.bluez / org.bluez.Manager.ListAdapters
| awk -F'"' '/at/ {print $2}') org.bluez.Adapter.SetProperty
string:Powered variant:boolean:false
but this doesn't really disable bluetooth: I'm still able to deactivate
bluetooth in the panel.
For the first part I could not find a solution so far.
I'm running Ubuntu 10.04.
Thanks for your help!
Jonathan Haug
^ permalink raw reply
* [PATCH] Bluetooth: Simplify L2CAP Streaming mode sending
From: Gustavo F. Padovan @ 2010-08-30 23:10 UTC (permalink / raw)
To: linux-bluetooth; +Cc: netdev, linux-kernel, marcel
In-Reply-To: <1283209824-8795-1-git-send-email-padovan@profusion.mobi>
As we don't have any error control on the Streaming mode, i.e., we don't
need to keep a copy of the skb for later resending we don't need to
call skb_clone() on it.
Then we can go one further here, and dequeue the skb before sending it,
that also means we don't need to look to sk->sk_send_head anymore.
This patch fixes a bug in Streaming mode sending procedure, the call to
skb_clone() was making the system run into OOM condition. I never got
that before 2.6.36, so I'm think that we acctually have regression
there.
Anyway, the patch saves memory and time when sending Streaming mode
data, so it is good to mainline.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
---
net/bluetooth/l2cap.c | 24 +++++++-----------------
1 files changed, 7 insertions(+), 17 deletions(-)
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index fadf26b..80e98cd 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -1441,33 +1441,23 @@ static inline void l2cap_do_send(struct sock *sk, struct sk_buff *skb)
static void l2cap_streaming_send(struct sock *sk)
{
- struct sk_buff *skb, *tx_skb;
+ struct sk_buff *skb;
struct l2cap_pinfo *pi = l2cap_pi(sk);
u16 control, fcs;
- while ((skb = sk->sk_send_head)) {
- tx_skb = skb_clone(skb, GFP_ATOMIC);
-
- control = get_unaligned_le16(tx_skb->data + L2CAP_HDR_SIZE);
+ while ((skb = skb_dequeue(TX_QUEUE(sk)))) {
+ control = get_unaligned_le16(skb->data + L2CAP_HDR_SIZE);
control |= pi->next_tx_seq << L2CAP_CTRL_TXSEQ_SHIFT;
- put_unaligned_le16(control, tx_skb->data + L2CAP_HDR_SIZE);
+ put_unaligned_le16(control, skb->data + L2CAP_HDR_SIZE);
if (pi->fcs == L2CAP_FCS_CRC16) {
- fcs = crc16(0, (u8 *)tx_skb->data, tx_skb->len - 2);
- put_unaligned_le16(fcs, tx_skb->data + tx_skb->len - 2);
+ fcs = crc16(0, (u8 *)skb->data, skb->len - 2);
+ put_unaligned_le16(fcs, skb->data + skb->len - 2);
}
- l2cap_do_send(sk, tx_skb);
+ l2cap_do_send(sk, skb);
pi->next_tx_seq = (pi->next_tx_seq + 1) % 64;
-
- if (skb_queue_is_last(TX_QUEUE(sk), skb))
- sk->sk_send_head = NULL;
- else
- sk->sk_send_head = skb_queue_next(TX_QUEUE(sk), skb);
-
- skb = skb_dequeue(TX_QUEUE(sk));
- kfree_skb(skb);
}
}
--
1.7.2.2
^ permalink raw reply related
* Possible regression with skb_clone() in 2.6.36
From: Gustavo F. Padovan @ 2010-08-30 23:10 UTC (permalink / raw)
To: linux-bluetooth; +Cc: netdev, linux-kernel, marcel
I've been experiencing some problems when running the L2CAP Streaming mode in
2.6.36. The system quickly runs in an Out Of Memory condition and crash. That
wasn't happening before, so I think we may have a regression here (I didn't find
where yet). The crash log is below.
The following patch does not fix the regression, but shows that removing the
skb_clone() call from l2cap_streaming_send() makes the problem goes away. The
patch is good anyway since it saves memory and time when sending Streaming mode
packets.
[ 5066.137533] Bluetooth: L2CAP ver 2.15
[ 5066.137873] Bluetooth: L2CAP socket layer initialized
[ 5066.545179] Bluetooth: RFCOMM TTY layer initialized
[ 5066.545879] Bluetooth: RFCOMM socket layer initialized
[ 5066.546582] Bluetooth: RFCOMM ver 1.11
[ 5092.268021] l2test invoked oom-killer: gfp_mask=0x4d0, order=0, oom_adj=0, oom_score_adj=0
[ 5092.268872] Pid: 3897, comm: l2test Not tainted 2.6.36-rc3 #5
[ 5092.269863] Call Trace:
[ 5092.270265] [<ffffffff8138b6a6>] ? _raw_spin_unlock+0x26/0x30
[ 5092.270878] [<ffffffff810c0827>] T.427+0x77/0x1e0
[ 5092.271874] [<ffffffff811b85e7>] ? security_real_capable_noaudit+0x37/0x60
[ 5092.272956] [<ffffffff810c0e3a>] out_of_memory+0x2ca/0x2f0
[ 5092.273894] [<ffffffff810c3d43>] __alloc_pages_nodemask+0x693/0x6b0
[ 5092.274871] [<ffffffff810ea3e6>] cache_alloc_refill+0x2d6/0x5c0
[ 5092.275864] [<ffffffff810ea805>] __kmalloc+0x135/0x150
[ 5092.276876] [<ffffffff8130f2ae>] __alloc_skb+0x6e/0x150
[ 5092.277865] [<ffffffff810d3a00>] ? might_fault+0x40/0x90
[ 5092.278652] [<ffffffff8130ace2>] sock_alloc_send_pskb+0x1c2/0x320
[ 5092.278927] [<ffffffff810d3a00>] ? might_fault+0x40/0x90
[ 5092.279864] [<ffffffff81312add>] ? memcpy_fromiovec+0x6d/0x90
[ 5092.280864] [<ffffffff8130ae50>] sock_alloc_send_skb+0x10/0x20
[ 5092.281867] [<ffffffffa00e600f>] l2cap_create_iframe_pdu+0x9f/0x2c0 [l2cap]
[ 5092.282865] [<ffffffffa00e84b9>] l2cap_sock_sendmsg+0x5d9/0x910 [l2cap]
[ 5092.283932] [<ffffffff8138ba3c>] ? restore_args+0x0/0x30
[ 5092.284865] [<ffffffff8130725b>] sock_sendmsg+0xdb/0x100
[ 5092.285652] [<ffffffff8138ba3c>] ? restore_args+0x0/0x30
[ 5092.285864] [<ffffffff8138ba3c>] ? restore_args+0x0/0x30
[ 5092.286864] [<ffffffff813073c0>] sys_sendto+0xf0/0x130
[ 5092.287864] [<ffffffff8138b60b>] ? _raw_spin_unlock_irq+0x2b/0x40
[ 5092.288872] [<ffffffff81093cfd>] ? trace_hardirqs_on_caller+0x13d/0x180
[ 5092.289927] [<ffffffff81093d4d>] ? trace_hardirqs_on+0xd/0x10
[ 5092.290864] [<ffffffff810d3a00>] ? might_fault+0x40/0x90
[ 5092.291649] [<ffffffff810d3a00>] ? might_fault+0x40/0x90
[ 5092.291864] [<ffffffff810d3a00>] ? might_fault+0x40/0x90
[ 5092.292864] [<ffffffff8130740f>] sys_send+0xf/0x20
[ 5092.293870] [<ffffffff8132ccd6>] compat_sys_socketcall+0x146/0x1f0
[ 5092.294875] [<ffffffff81053ee4>] sysenter_dispatch+0x7/0x30
[ 5092.295673] Mem-Info:
[ 5092.295863] DMA per-cpu:
[ 5092.296214] CPU 0: hi: 0, btch: 1 usd: 0
[ 5092.296925] DMA32 per-cpu:
[ 5092.297298] CPU 0: hi: 90, btch: 15 usd: 85
[ 5092.297864] active_anon:504 inactive_anon:543 isolated_anon:0
[ 5092.297865] active_file:14 inactive_file:3 isolated_file:0
[ 5092.297866] unevictable:0 dirty:0 writeback:3 unstable:0
[ 5092.297866] free:728 slab_reclaimable:559 slab_unreclaimable:39895
[ 5092.297867] mapped:12 shmem:35 pagetables:84 bounce:0
[ 5092.299944] DMA free:1064kB min:124kB low:152kB high:184kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15768kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:0kB slab_unreclaimable:14916kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? yes
[ 5092.301862] lowmem_reserve[]: 0 236 236 236
[ 5092.303134] DMA32 free:1848kB min:1904kB low:2380kB high:2856kB active_anon:2016kB inactive_anon:2172kB active_file:56kB inactive_file:12kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:242380kB mlocked:0kB dirty:0kB writeback:12kB mapped:48kB shmem:140kB slab_reclaimable:2236kB slab_unreclaimable:144664kB kernel_stack:456kB pagetables:336kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:103 all_unreclaimable? yes
[ 5092.304962] lowmem_reserve[]: 0 0 0 0
[ 5092.306066] DMA: 0*4kB 1*8kB 0*16kB 1*32kB 0*64kB 0*128kB 0*256kB 0*512kB 1*1024kB 0*2048kB 0*4096kB = 1064kB
[ 5092.307862] DMA32: 10*4kB 2*8kB 0*16kB 0*32kB 0*64kB 0*128kB 1*256kB 1*512kB 1*1024kB 0*2048kB 0*4096kB = 1848kB
[ 5092.309467] 52 total pagecache pages
[ 5092.309862] 0 pages in swap cache
[ 5092.310317] Swap cache stats: add 0, delete 0, find 0/0
[ 5092.310862] Free swap = 0kB
[ 5092.311260] Total swap = 0kB
[ 5092.313796] 65530 pages RAM
[ 5092.313868] 22603 pages reserved
[ 5092.314324] 206 pages shared
[ 5092.314862] 39353 pages non-shared
[ 5092.315348] [ pid ] uid tgid total_vm rss cpu oom_adj oom_score_adj name
[ 5092.315867] [ 1] 0 1 438 19 0 0 0 init
[ 5092.316871] [ 1018] 0 1018 537 75 0 -17 -1000 udevd
[ 5092.318867] [ 2217] 101 2217 606 39 0 0 0 dbus-daemon
[ 5092.319865] [ 2825] 0 2825 481 29 0 0 0 dhcpcd
[ 5092.320865] [ 3497] 0 3497 1091 83 0 0 0 sshd
[ 5092.321969] [ 3535] 0 3535 477 31 0 0 0 agetty
[ 5092.322864] [ 3536] 0 3536 477 30 0 0 0 agetty
[ 5092.323864] [ 3537] 0 3537 477 29 0 0 0 agetty
[ 5092.325937] [ 3538] 0 3538 477 31 0 0 0 agetty
[ 5092.326865] [ 3539] 0 3539 477 31 0 0 0 agetty
[ 5092.327864] [ 3540] 0 3540 477 31 0 0 0 agetty
[ 5092.328864] [ 3541] 0 3541 1738 105 0 0 0 sshd
[ 5092.329865] [ 3545] 0 3545 745 72 0 0 0 bash
[ 5092.330864] [ 3550] 0 3550 706 43 0 0 0 screen
[ 5092.331866] [ 3551] 0 3551 772 124 0 0 0 screen
[ 5092.332965] [ 3552] 0 3552 745 77 0 0 0 bash
[ 5092.333865] [ 3557] 0 3557 745 77 0 0 0 bash
[ 5092.334867] [ 3562] 0 3562 536 75 0 -17 -1000 udevd
[ 5092.336865] [ 3567] 0 3567 536 75 0 -17 -1000 udevd
[ 5092.337865] [ 3887] 0 3887 935 54 0 0 0 bluetoothd
[ 5092.338864] [ 3896] 0 3896 458 24 0 0 0 l2test
[ 5092.339864] [ 3897] 0 3897 458 24 0 0 0 l2test
[ 5092.340933] [ 3942] 0 3942 458 29 0 0 0 l2test
[ 5092.341863] Kernel panic - not syncing: Out of memory and no killable processes...
[ 5092.341864]
[ 5092.342864] Pid: 3897, comm: l2test Not tainted 2.6.36-rc3 #5
[ 5092.343862] Call Trace:
[ 5092.344934] [<ffffffff813884d9>] panic+0x8c/0x199
[ 5092.345621] [<ffffffff810c0e54>] out_of_memory+0x2e4/0x2f0
[ 5092.345864] [<ffffffff810c3d43>] __alloc_pages_nodemask+0x693/0x6b0
[ 5092.346894] [<ffffffff810ea3e6>] cache_alloc_refill+0x2d6/0x5c0
[ 5092.347864] [<ffffffff810ea805>] __kmalloc+0x135/0x150
[ 5092.348871] [<ffffffff8130f2ae>] __alloc_skb+0x6e/0x150
[ 5092.349865] [<ffffffff810d3a00>] ? might_fault+0x40/0x90
[ 5092.350628] [<ffffffff8130ace2>] sock_alloc_send_pskb+0x1c2/0x320
[ 5092.350935] [<ffffffff810d3a00>] ? might_fault+0x40/0x90
[ 5092.351864] [<ffffffff81312add>] ? memcpy_fromiovec+0x6d/0x90
[ 5092.352864] [<ffffffff8130ae50>] sock_alloc_send_skb+0x10/0x20
[ 5092.353867] [<ffffffffa00e600f>] l2cap_create_iframe_pdu+0x9f/0x2c0 [l2cap]
[ 5092.354865] [<ffffffffa00e84b9>] l2cap_sock_sendmsg+0x5d9/0x910 [l2cap]
[ 5092.355864] [<ffffffff8138ba3c>] ? restore_args+0x0/0x30
[ 5092.356864] [<ffffffff8130725b>] sock_sendmsg+0xdb/0x100
[ 5092.357612] [<ffffffff8138ba3c>] ? restore_args+0x0/0x30
[ 5092.357931] [<ffffffff8138ba3c>] ? restore_args+0x0/0x30
[ 5092.358864] [<ffffffff813073c0>] sys_sendto+0xf0/0x130
[ 5092.359864] [<ffffffff8138b60b>] ? _raw_spin_unlock_irq+0x2b/0x40
[ 5092.360929] [<ffffffff81093cfd>] ? trace_hardirqs_on_caller+0x13d/0x180
[ 5092.361866] [<ffffffff81093d4d>] ? trace_hardirqs_on+0xd/0x10
[ 5092.362864] [<ffffffff810d3a00>] ? might_fault+0x40/0x90
[ 5092.363653] [<ffffffff810d3a00>] ? might_fault+0x40/0x90
[ 5092.364868] [<ffffffff810d3a00>] ? might_fault+0x40/0x90
[ 5092.365865] [<ffffffff8130740f>] sys_send+0xf/0x20
[ 5092.366945] [<ffffffff8132ccd6>] compat_sys_socketcall+0x146/0x1f0
[ 5092.367865] [<ffffffff81053ee4>] sysenter_dispatch+0x7/0x30
-------
Gustavo F. Padovan (1):
Bluetooth: Simplify L2CAP Streaming mode sending
^ permalink raw reply
* [PATCH] Bluetooth: Simplify L2CAP Streaming mode sending
From: Gustavo F. Padovan @ 2010-08-30 23:04 UTC (permalink / raw)
To: linux-bluetooth; +Cc: netdev, linux-kernel, marcel
As we don't have any error control on the Streaming mode, i.e., we don't
need to keep a copy of the skb for later resending we don't need to
call skb_clone() on it.
Then we can go one further here, and dequeue the skb before sending it,
that also means we don't need to look to sk->sk_send_head anymore.
This patch fixes a bug in Streaming mode sending procedure, the call to
skb_clone() was making the system run into OOM condition. I never got
that before 2.6.36, so I'm think that we acctually have regression
there.
Anyway, the patch saves memory and time when sending Streaming mode
data, so it is good to mainline.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
---
net/bluetooth/l2cap.c | 24 +++++++-----------------
1 files changed, 7 insertions(+), 17 deletions(-)
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index fadf26b..80e98cd 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -1441,33 +1441,23 @@ static inline void l2cap_do_send(struct sock *sk, struct sk_buff *skb)
static void l2cap_streaming_send(struct sock *sk)
{
- struct sk_buff *skb, *tx_skb;
+ struct sk_buff *skb;
struct l2cap_pinfo *pi = l2cap_pi(sk);
u16 control, fcs;
- while ((skb = sk->sk_send_head)) {
- tx_skb = skb_clone(skb, GFP_ATOMIC);
-
- control = get_unaligned_le16(tx_skb->data + L2CAP_HDR_SIZE);
+ while ((skb = skb_dequeue(TX_QUEUE(sk)))) {
+ control = get_unaligned_le16(skb->data + L2CAP_HDR_SIZE);
control |= pi->next_tx_seq << L2CAP_CTRL_TXSEQ_SHIFT;
- put_unaligned_le16(control, tx_skb->data + L2CAP_HDR_SIZE);
+ put_unaligned_le16(control, skb->data + L2CAP_HDR_SIZE);
if (pi->fcs == L2CAP_FCS_CRC16) {
- fcs = crc16(0, (u8 *)tx_skb->data, tx_skb->len - 2);
- put_unaligned_le16(fcs, tx_skb->data + tx_skb->len - 2);
+ fcs = crc16(0, (u8 *)skb->data, skb->len - 2);
+ put_unaligned_le16(fcs, skb->data + skb->len - 2);
}
- l2cap_do_send(sk, tx_skb);
+ l2cap_do_send(sk, skb);
pi->next_tx_seq = (pi->next_tx_seq + 1) % 64;
-
- if (skb_queue_is_last(TX_QUEUE(sk), skb))
- sk->sk_send_head = NULL;
- else
- sk->sk_send_head = skb_queue_next(TX_QUEUE(sk), skb);
-
- skb = skb_dequeue(TX_QUEUE(sk));
- kfree_skb(skb);
}
}
--
1.7.2.2
^ permalink raw reply related
* [PATCH] Store new local name before writing it to HCI
From: Daniel Örstadius @ 2010-08-30 14:35 UTC (permalink / raw)
To: linux-bluetooth
[-- Attachment #1: Type: text/plain, Size: 386 bytes --]
Store new local name to the filesystem and emit property changed
before actually writing the name to the chip. Avoids writing the
name twice by using a boolean variable in the btd_adapter struct.
The flag is needed since the name is read immediately after setting
it and since the name could be changed by using for example
hciconfig (in which case the flag would not be set).
/Daniel
[-- Attachment #2: 0001-Store-new-local-name-before-writing-it-to-HCI.patch --]
[-- Type: text/x-patch, Size: 2922 bytes --]
From 140d4d7f194c5da2fbf6584d8de3cdff68b70fec Mon Sep 17 00:00:00 2001
From: Daniel Orstadius <daniel.orstadius@nokia.com>
Date: Mon, 30 Aug 2010 16:54:09 +0300
Subject: [PATCH] Store new local name before writing it to HCI
Store new local name to the filesystem and emit property changed
before actually writing the name to the chip. Avoids writing the
name twice by using a boolean variable in the btd_adapter struct.
The flag is needed since the name is read immediately after setting
it and since the name could be changed by using for example
hciconfig (in which case the flag would not be set).
---
src/adapter.c | 35 ++++++++++++++++++++++-------------
1 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index 377bacc..0dbb295 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -137,6 +137,8 @@ struct btd_adapter {
gint ref;
GSList *powered_callbacks;
+
+ gboolean name_stored;
};
static void adapter_set_pairable_timeout(struct btd_adapter *adapter,
@@ -950,17 +952,21 @@ void adapter_update_local_name(bdaddr_t *bdaddr, uint8_t status, void *ptr)
strncpy((char *) dev->name, (char *) rp.name, MAX_NAME_LENGTH);
- write_local_name(bdaddr, (char *) dev->name);
+ if (!adapter->name_stored) {
+ write_local_name(bdaddr, (char *) dev->name);
- update_ext_inquiry_response(adapter);
+ name = g_strdup((char *) dev->name);
- name = g_strdup((char *) dev->name);
+ if (connection)
+ emit_property_changed(connection, adapter->path,
+ ADAPTER_INTERFACE, "Name",
+ DBUS_TYPE_STRING, &name);
+ g_free(name);
+ }
- if (connection)
- emit_property_changed(connection, adapter->path,
- ADAPTER_INTERFACE, "Name",
- DBUS_TYPE_STRING, &name);
- g_free(name);
+ adapter->name_stored = FALSE;
+
+ update_ext_inquiry_response(adapter);
}
void adapter_setname_complete(bdaddr_t *local, uint8_t status)
@@ -998,16 +1004,18 @@ static DBusMessage *set_name(DBusConnection *conn, DBusMessage *msg,
if (strncmp(name, (char *) dev->name, MAX_NAME_LENGTH) == 0)
goto done;
- if (!adapter->up) {
- strncpy((char *) adapter->dev.name, name, MAX_NAME_LENGTH);
- write_local_name(&adapter->bdaddr, name);
- emit_property_changed(connection, adapter->path,
+ strncpy((char *) adapter->dev.name, name, MAX_NAME_LENGTH);
+ write_local_name(&adapter->bdaddr, name);
+ emit_property_changed(connection, adapter->path,
ADAPTER_INTERFACE, "Name",
DBUS_TYPE_STRING, &name);
- } else {
+
+ if (adapter->up) {
int err = adapter_ops->set_name(adapter->dev_id, name);
if (err < 0)
return failed_strerror(msg, err);
+
+ adapter->name_stored = TRUE;
}
done:
@@ -2504,6 +2512,7 @@ int adapter_stop(struct btd_adapter *adapter)
adapter->cache_enable = TRUE;
adapter->pending_cod = 0;
adapter->off_requested = FALSE;
+ adapter->name_stored = FALSE;
call_adapter_powered_callbacks(adapter, FALSE);
--
1.6.0.4
^ permalink raw reply related
* RE: [PATCH] Bluetooth: BT_SECURITY_HIGH requires 16 digit pin code
From: Waldemar.Rymarkiewicz @ 2010-08-30 6:58 UTC (permalink / raw)
To: padovan; +Cc: linux-bluetooth
In-Reply-To: <20100827195550.GA11191@vigoh>
Oops, I missed that. It was done automatically somehow. It wasn't my intention of doing this.
Will fix it.
Thanks,
/Waldek
>-----Original Message-----
>From: Gustavo F. Padovan [mailto:pao@profusion.mobi] On Behalf
>Of Gustavo F. Padovan
>Sent: Friday, August 27, 2010 9:56 PM
>To: Rymarkiewicz Waldemar
>Cc: linux-bluetooth@vger.kernel.org;
>par-gunnar.p.hjalmdahl@stericsson.com;
>joakim.xj.ceder@stericsson.com; johan.hedberg@gmail.com
>Subject: Re: [PATCH] Bluetooth: BT_SECURITY_HIGH requires 16
>digit pin code
>
>Hi Waldemar,
>
>* Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
>[2010-08-27 13:44:20 +0200]:
>
>> The security level BT_SECURITY_HIGH expects secure connection and a
>> minimum 16 digit pin code used for bonding. It's requitred
>by the Sim
>> Access Profile.
>>
>> Patch on behalf of ST-Ericsson SA.
>>
>> Signed-off-by: Waldemar Rymarkiewicz
><waldemar.rymarkiewicz@tieto.com>
>> ---
>> include/net/bluetooth/hci.h | 17 +++++++
>> include/net/bluetooth/hci_core.h | 4 ++
>> net/bluetooth/hci_conn.c | 97
>+++++++++++++++++++++++++++++++-------
>> net/bluetooth/hci_event.c | 4 ++
>> net/bluetooth/hci_sock.c | 3 +
>> net/bluetooth/rfcomm/core.c | 10 ++++-
>> 6 files changed, 116 insertions(+), 19 deletions(-) mode change
>> 100644 => 100755 include/net/bluetooth/hci.h mode change 100644 =>
>> 100755 include/net/bluetooth/hci_core.h mode change 100644
>=> 100755
>> net/bluetooth/hci_conn.c mode change 100644 => 100755
>> net/bluetooth/hci_event.c mode change 100644 => 100755
>> net/bluetooth/rfcomm/core.c
>
>You are changing the files modes. Don't do that.
>
>--
>Gustavo F. Padovan
>ProFUSION embedded systems - http://profusion.mobi
>
^ permalink raw reply
* Re: [RFCOMM] Cannot complete connections into Ubuntu
From: Shreesh Holla @ 2010-08-30 6:53 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <AANLkTi=j6ch9_oQwb0xK9xPZ5btMUSqoHx4D8N8YM6nt@mail.gmail.com>
----- Original Message ----
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: Shreesh Holla <hshreesh@yahoo.com>
Cc: linux-bluetooth@vger.kernel.org
Sent: Tue, August 24, 2010 8:00:11 PM
Subject: Re: [RFCOMM] Cannot complete connections into Ubuntu
Hi,
On Mon, Aug 23, 2010 at 3:22 AM, Shreesh Holla <hshreesh@yahoo.com> wrote:
> Hi,
>
> I'm running Ubuntu with 2.6.32.24 kernel.
> I have a simple RFCOMM program running on Windows Mobile which would connect
> into the Ubuntu machine. Of course I have the corresponding service running on
> the Ubuntu machine. The RFCOMM port numbers do match up.
>
> This was working a few days back and now with no changes(i.e. the same
> executable), it refuses to work anymore.
>
> So is there some configuration needed now?
>
> I have the dongle running in Ubuntu as : hciconfig hci0 noauth noencrypt pscan
------ Luis says:
>>Had you tried the latest bluez, I did some changes to pair that solve
>>some problem with RFCOMM and ssp. If that doesn't help maybe you
>>should try to produce some logs of the so we can take a look.
>>Regards,
>>--
>>Luiz Augusto von Dentz
>>Computer Engineer
Luis,
It seems the problem is in aborting an open RFCOMM connection. And this seems to
be an issue even with the 2.6.29 kernel. If I do abort a connection i.e. not
gracefully i.e. by killing the applications then this is what I see:
- The connection is refused until reboot
- I tried to reset by doing a hciconfig hci0 reset AND also hciconfig hci0
up/down
- When I do a reset actually the VM hangs completely i.e. the only way is to
power off and restart the VM
- I do have two Bluetooth dongles - but I dont think that could be any issue.
So, fundamentally as long as I do a graceful shutdown of the RFCOMM connections
all seems to be fine. This issue happens sometimes on the first abort. But
definitely within three attempts. This is what I have been able to figure out
since my last e-mail.
Do let me know if this helps. If you would need more details such as the hcidump
logs or dmesg logs - I ca send that too.
Thanks,
Shreesh
^ permalink raw reply
* Re: Cannot build BlueZ Release 4.70...
From: alok barsode @ 2010-08-29 13:58 UTC (permalink / raw)
To: alok barsode, Ho, Albert O, linux-bluetooth@vger.kernel.org,
marcel@holtmann.org
In-Reply-To: <20100829101959.GA10891@jh-x301>
Hi Johan,
On Sun, Aug 29, 2010 at 3:49 PM, Johan Hedberg <johan.hedberg@gmail.com> wr=
ote:
> Hi,
>
> On Sun, Aug 29, 2010, alok barsode wrote:
>> > The configure line invocation is taken from README file. =A0Below are
>> > copy-paste exact errors.
>>
>> I tried building using bootstrap-configure and it built fine. =A0But
>> when I tried building with ./bootstrap and ./configure =A0it gave the
>> same errors as mentioned.
>> Maybe we missed some configure option ?
>
> I still can't seem to reproduce this. I just tried "./bootstrap &&
> ./configure && make" with a clean git tree and it compiles fine.
> Downloading the official tarball for 4.70 and doing "./configure &&
> make" works fine too. I wonder if the autotools or gcc version has
> something to do with this?
I dont think this is a autotools issue.(my autoconf ver is 2.64 and
automake ver is 1.11
gcc version is 4.4.1. which are fairly new).
If I give "--enable-alsa" option to configure it builds fine.
acinclude.m4 sets the SBC variable if either alsa or gstreamer or
test are enabled via configure.
In Makefile.am , the attrib_sources are put under SBC conditional.
I dont have much idea about attrib, maybe put the attrib_sources under
a ATTRIBPLUGIN conditional might solve this issue?
Cheers,
Alok.
>
> Johan
>
^ permalink raw reply
* new kmemleak in kernel 2.6.35.4
From: Toralf Förster @ 2010-08-29 11:20 UTC (permalink / raw)
To: linux-bluetooth
Hello
with this version I observed this kmemleak which seems to be new since 2.6.34
at my ThinkPad T400 at an almost stable Gentoo Linux (which however might be
rather related to suspend2ram) :
unreferenced object 0xf5333e00 (size 192):
comm "async/29", pid 2911, jiffies 43041559 (age 24568.685s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 02 c7 34 65 e4 26 ce 11 ..........4e.&..
00 00 00 00 00 58 f0 f5 01 00 00 00 00 00 00 00 .....X..........
backtrace:
[<c122f8d7>] kmemleak_alloc+0x27/0x50
[<c109c34f>] kmem_cache_alloc+0x9f/0xe0
[<c11d393f>] __alloc_skb+0x2f/0x100
[<f9b4ab0c>] hci_send_cmd+0x2c/0xf0 [bluetooth]
[<f9b4abe9>] hci_reset_req+0x19/0x20 [bluetooth]
[<f9b4b170>] __hci_request+0x70/0xe0 [bluetooth]
[<f9b4b338>] hci_dev_do_close+0x158/0x1b0 [bluetooth]
[<f9b4b3cb>] hci_unregister_dev+0x3b/0xa0 [bluetooth]
[<f9cc1a8c>] btusb_disconnect+0x4c/0xa0 [btusb]
[<f863839b>] usb_unbind_interface+0x3b/0x160 [usbcore]
[<c118902c>] __device_release_driver+0x4c/0xa0
[<c1189130>] device_release_driver+0x20/0x30
[<f86386ef>] usb_driver_release_interface+0x6f/0x80 [usbcore]
[<f8638722>] usb_rebind_intf+0x22/0x80 [usbcore]
[<f86387fd>] do_unbind_rebind+0x5d/0x90 [usbcore]
[<f86388e3>] usb_resume+0xb3/0xc0 [usbcore]
--
MfG/Kind regards
Toralf Förster
pgp finger print: 7B1A 07F4 EC82 0F90 D4C2 8936 872A E508 7DB6 9DA3
^ permalink raw reply
* [PATCH] Use simpler error callbacks for GDBus security hooks
From: Marcel Holtmann @ 2010-08-29 10:32 UTC (permalink / raw)
To: linux-bluetooth
---
gdbus/gdbus.h | 9 +++++++--
gdbus/object.c | 29 +++++++++++++++++++++++------
2 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h
index 42d4f73..553918c 100644
--- a/gdbus/gdbus.h
+++ b/gdbus/gdbus.h
@@ -58,7 +58,7 @@ typedef DBusMessage * (* GDBusMethodFunction) (DBusConnection *connection,
typedef guint32 GDBusPendingReply;
typedef void (* GDBusSecurityFunction) (DBusConnection *connection,
- DBusMessage *message, GDBusPendingReply pending);
+ GDBusPendingReply pending);
typedef enum {
G_DBUS_METHOD_FLAG_DEPRECATED = (1 << 0),
@@ -116,7 +116,12 @@ gboolean g_dbus_unregister_security(const GDBusSecurityTable *security);
void g_dbus_pending_success(DBusConnection *connection,
GDBusPendingReply pending);
void g_dbus_pending_error(DBusConnection *connection,
- GDBusPendingReply pending, DBusMessage *error);
+ GDBusPendingReply pending,
+ const char *name, const char *format, ...)
+ __attribute__((format(printf, 4, 5)));
+void g_dbus_pending_error_valist(DBusConnection *connection,
+ GDBusPendingReply pending, const char *name,
+ const char *format, va_list args);
DBusMessage *g_dbus_create_error(DBusMessage *message, const char *name,
const char *format, ...)
diff --git a/gdbus/object.c b/gdbus/object.c
index a367f93..48530f2 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -271,22 +271,26 @@ void g_dbus_pending_success(DBusConnection *connection,
}
}
-void g_dbus_pending_error(DBusConnection *connection,
- GDBusPendingReply pending, DBusMessage *error)
+void g_dbus_pending_error_valist(DBusConnection *connection,
+ GDBusPendingReply pending, const char *name,
+ const char *format, va_list args)
{
GSList *list;
for (list = pending_security; list; list = list->next) {
struct security_data *secdata = list->data;
+ DBusMessage *reply;
if (secdata->pending != pending)
continue;
pending_security = g_slist_remove(pending_security, secdata);
- if (error != NULL) {
- dbus_connection_send(connection, error, NULL);
- dbus_message_unref(error);
+ reply = g_dbus_create_error_valist(secdata->message,
+ name, format, args);
+ if (reply != NULL) {
+ dbus_connection_send(connection, reply, NULL);
+ dbus_message_unref(reply);
}
dbus_message_unref(secdata->message);
@@ -295,6 +299,19 @@ void g_dbus_pending_error(DBusConnection *connection,
}
}
+void g_dbus_pending_error(DBusConnection *connection,
+ GDBusPendingReply pending,
+ const char *name, const char *format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+
+ g_dbus_pending_error_valist(connection, pending, name, format, args);
+
+ va_end(args);
+}
+
static gboolean check_privilege(DBusConnection *conn, DBusMessage *msg,
const GDBusMethodTable *method, void *iface_user_data)
{
@@ -315,7 +332,7 @@ static gboolean check_privilege(DBusConnection *conn, DBusMessage *msg,
pending_security = g_slist_prepend(pending_security, secdata);
- security->function(conn, secdata->message, secdata->pending);
+ security->function(conn, secdata->pending);
return TRUE;
}
--
1.7.2.2
^ permalink raw reply related
* Re: Cannot build BlueZ Release 4.70...
From: Johan Hedberg @ 2010-08-29 10:19 UTC (permalink / raw)
To: alok barsode
Cc: Ho, Albert O, linux-bluetooth@vger.kernel.org,
marcel@holtmann.org
In-Reply-To: <AANLkTi=K6rdg+Pck7FjbDP-LTn=5sXrLVX9Nz8RPqi0v@mail.gmail.com>
Hi,
On Sun, Aug 29, 2010, alok barsode wrote:
> > The configure line invocation is taken from README file. Below are
> > copy-paste exact errors.
>
> I tried building using bootstrap-configure and it built fine. But
> when I tried building with ./bootstrap and ./configure it gave the
> same errors as mentioned.
> Maybe we missed some configure option ?
I still can't seem to reproduce this. I just tried "./bootstrap &&
./configure && make" with a clean git tree and it compiles fine.
Downloading the official tarball for 4.70 and doing "./configure &&
make" works fine too. I wonder if the autotools or gcc version has
something to do with this?
Johan
^ permalink raw reply
* Re: Cannot build BlueZ Release 4.70...
From: alok barsode @ 2010-08-29 8:45 UTC (permalink / raw)
To: Ho, Albert O
Cc: Johan Hedberg, linux-bluetooth@vger.kernel.org,
marcel@holtmann.org
In-Reply-To: <CF9C39F99A89134C9CF9C4CCB68B8DDF25AB2D28E0@orsmsx501.amr.corp.intel.com>
Hi Albert,
On Sun, Aug 29, 2010 at 10:48 AM, Ho, Albert O <albert.o.ho@intel.com> wrot=
e:
> Hi Johan,
>
> The configure line invocation is taken from README file. =A0Below are cop=
y-paste exact errors.
I tried building using bootstrap-configure and it built fine.
But when I tried building with ./bootstrap and ./configure it gave
the same errors as mentioned.
Maybe we missed some configure option ?
Cheers,
Alok.
>
> Regards,
> Albert
>
>
> src/attrib-server.o: In function `send_notification':
> attrib-server.c:(.text+0x1da): undefined reference to `enc_notification'
> attrib-server.c:(.text+0x211): undefined reference to `g_attrib_send'
> src/attrib-server.o: In function `connect_event':
> attrib-server.c:(.text+0x863): undefined reference to `g_attrib_new'
> attrib-server.c:(.text+0x885): undefined reference to `g_attrib_register'
> src/attrib-server.o: In function `channel_destroy':
> attrib-server.c:(.text+0x8b9): undefined reference to `g_attrib_unregiste=
r_all'
> attrib-server.c:(.text+0x8c2): undefined reference to `g_attrib_unref'
> src/attrib-server.o: In function `channel_handler':
> attrib-server.c:(.text+0x964): undefined reference to `dec_read_by_grp_re=
q'
> attrib-server.c:(.text+0x990): undefined reference to `enc_error_resp'
> attrib-server.c:(.text+0x9b2): undefined reference to `g_attrib_send'
> attrib-server.c:(.text+0x9e9): undefined reference to `dec_read_req'
> attrib-server.c:(.text+0xa39): undefined reference to `enc_read_resp'
> attrib-server.c:(.text+0xa64): undefined reference to `dec_read_by_type_r=
eq'
> attrib-server.c:(.text+0xbcc): undefined reference to `enc_read_by_type_r=
esp'
> attrib-server.c:(.text+0xbd8): undefined reference to `att_data_list_free=
'
> attrib-server.c:(.text+0xc01): undefined reference to `dec_find_info_req'
> attrib-server.c:(.text+0xd7b): undefined reference to `enc_find_info_resp=
'
> attrib-server.c:(.text+0xd86): undefined reference to `att_data_list_free=
'
> attrib-server.c:(.text+0xf52): undefined reference to `enc_error_resp'
> attrib-server.c:(.text+0xf7c): undefined reference to `enc_error_resp'
> attrib-server.c:(.text+0xfac): undefined reference to `enc_error_resp'
> attrib-server.c:(.text+0xfd3): undefined reference to `enc_error_resp'
> attrib-server.c:(.text+0xff7): undefined reference to `enc_error_resp'
> attrib-server.c:(.text+0x1011): undefined reference to `enc_read_by_grp_r=
esp'
> attrib-server.c:(.text+0x101d): undefined reference to `att_data_list_fre=
e'
> attrib-server.c:(.text+0x106d): undefined reference to `enc_error_resp'
> attrib-server.c:(.text+0x1092): undefined reference to `enc_error_resp'
> collect2: ld returned 1 exit status
> make[1]: *** [src/bluetoothd] Error 1
> make: *** [all] Error 2
>
>
> -----Original Message-----
> From: Johan Hedberg [mailto:johan.hedberg@gmail.com]
> Sent: Saturday, August 28, 2010 1:23 AM
> To: Ho, Albert O
> Cc: linux-bluetooth@vger.kernel.org; marcel@holtmann.org
> Subject: Re: Cannot build BlueZ Release 4.70...
>
> Hi Albert,
>
> On Sat, Aug 28, 2010, Ho, Albert O wrote:
>> Hi, I attempted to build Release 4.70 but it's not buildable. =A0Using
>> sources either from bluez-4.70.tar.gz (www.bluez.org) or from git
>> results to compile errors. =A0The offending lines are all in
>> attrib-server.c & all are 'undefined references to xxxxx'. =A0Same setup
>> can build 4.69. =A0Pls advise.
>
> It compiles fine for me. You'll need to copy-paste the exact errors you
> get as well as the configure script options that you used.
>
> Johan
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth=
" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at =A0http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* RE: Cannot build BlueZ Release 4.70...
From: Ho, Albert O @ 2010-08-29 5:18 UTC (permalink / raw)
To: Johan Hedberg; +Cc: linux-bluetooth@vger.kernel.org, marcel@holtmann.org
In-Reply-To: <20100828082256.GA23228@jh-x301>
Hi Johan,
The configure line invocation is taken from README file. Below are copy-pa=
ste exact errors.
Regards,
Albert
src/attrib-server.o: In function `send_notification':
attrib-server.c:(.text+0x1da): undefined reference to `enc_notification'
attrib-server.c:(.text+0x211): undefined reference to `g_attrib_send'
src/attrib-server.o: In function `connect_event':
attrib-server.c:(.text+0x863): undefined reference to `g_attrib_new'
attrib-server.c:(.text+0x885): undefined reference to `g_attrib_register'
src/attrib-server.o: In function `channel_destroy':
attrib-server.c:(.text+0x8b9): undefined reference to `g_attrib_unregister_=
all'
attrib-server.c:(.text+0x8c2): undefined reference to `g_attrib_unref'
src/attrib-server.o: In function `channel_handler':
attrib-server.c:(.text+0x964): undefined reference to `dec_read_by_grp_req'
attrib-server.c:(.text+0x990): undefined reference to `enc_error_resp'
attrib-server.c:(.text+0x9b2): undefined reference to `g_attrib_send'
attrib-server.c:(.text+0x9e9): undefined reference to `dec_read_req'
attrib-server.c:(.text+0xa39): undefined reference to `enc_read_resp'
attrib-server.c:(.text+0xa64): undefined reference to `dec_read_by_type_req=
'
attrib-server.c:(.text+0xbcc): undefined reference to `enc_read_by_type_res=
p'
attrib-server.c:(.text+0xbd8): undefined reference to `att_data_list_free'
attrib-server.c:(.text+0xc01): undefined reference to `dec_find_info_req'
attrib-server.c:(.text+0xd7b): undefined reference to `enc_find_info_resp'
attrib-server.c:(.text+0xd86): undefined reference to `att_data_list_free'
attrib-server.c:(.text+0xf52): undefined reference to `enc_error_resp'
attrib-server.c:(.text+0xf7c): undefined reference to `enc_error_resp'
attrib-server.c:(.text+0xfac): undefined reference to `enc_error_resp'
attrib-server.c:(.text+0xfd3): undefined reference to `enc_error_resp'
attrib-server.c:(.text+0xff7): undefined reference to `enc_error_resp'
attrib-server.c:(.text+0x1011): undefined reference to `enc_read_by_grp_res=
p'
attrib-server.c:(.text+0x101d): undefined reference to `att_data_list_free'
attrib-server.c:(.text+0x106d): undefined reference to `enc_error_resp'
attrib-server.c:(.text+0x1092): undefined reference to `enc_error_resp'
collect2: ld returned 1 exit status
make[1]: *** [src/bluetoothd] Error 1
make: *** [all] Error 2
-----Original Message-----
From: Johan Hedberg [mailto:johan.hedberg@gmail.com]=20
Sent: Saturday, August 28, 2010 1:23 AM
To: Ho, Albert O
Cc: linux-bluetooth@vger.kernel.org; marcel@holtmann.org
Subject: Re: Cannot build BlueZ Release 4.70...
Hi Albert,
On Sat, Aug 28, 2010, Ho, Albert O wrote:
> Hi, I attempted to build Release 4.70 but it's not buildable. Using
> sources either from bluez-4.70.tar.gz (www.bluez.org) or from git
> results to compile errors. The offending lines are all in
> attrib-server.c & all are 'undefined references to xxxxx'. Same setup
> can build 4.69. Pls advise.
It compiles fine for me. You'll need to copy-paste the exact errors you
get as well as the configure script options that you used.
Johan
^ permalink raw reply
* [PATCH] Add support for GDBus security handlers
From: Marcel Holtmann @ 2010-08-29 1:29 UTC (permalink / raw)
To: linux-bluetooth
---
gdbus/gdbus.h | 19 +++++++
gdbus/object.c | 159 ++++++++++++++++++++++++++++++++++++++++++++++++--------
2 files changed, 156 insertions(+), 22 deletions(-)
diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h
index c3e7252..42d4f73 100644
--- a/gdbus/gdbus.h
+++ b/gdbus/gdbus.h
@@ -55,6 +55,11 @@ typedef void (* GDBusDestroyFunction) (void *user_data);
typedef DBusMessage * (* GDBusMethodFunction) (DBusConnection *connection,
DBusMessage *message, void *user_data);
+typedef guint32 GDBusPendingReply;
+
+typedef void (* GDBusSecurityFunction) (DBusConnection *connection,
+ DBusMessage *message, GDBusPendingReply pending);
+
typedef enum {
G_DBUS_METHOD_FLAG_DEPRECATED = (1 << 0),
G_DBUS_METHOD_FLAG_NOREPLY = (1 << 1),
@@ -75,6 +80,7 @@ typedef struct {
const char *reply;
GDBusMethodFunction function;
GDBusMethodFlags flags;
+ unsigned int privilege;
} GDBusMethodTable;
typedef struct {
@@ -89,6 +95,11 @@ typedef struct {
GDBusPropertyFlags flags;
} GDBusPropertyTable;
+typedef struct {
+ unsigned int privilege;
+ GDBusSecurityFunction function;
+} GDBusSecurityTable;
+
gboolean g_dbus_register_interface(DBusConnection *connection,
const char *path, const char *name,
const GDBusMethodTable *methods,
@@ -99,6 +110,14 @@ gboolean g_dbus_register_interface(DBusConnection *connection,
gboolean g_dbus_unregister_interface(DBusConnection *connection,
const char *path, const char *name);
+gboolean g_dbus_register_security(const GDBusSecurityTable *security);
+gboolean g_dbus_unregister_security(const GDBusSecurityTable *security);
+
+void g_dbus_pending_success(DBusConnection *connection,
+ GDBusPendingReply pending);
+void g_dbus_pending_error(DBusConnection *connection,
+ GDBusPendingReply pending, DBusMessage *error);
+
DBusMessage *g_dbus_create_error(DBusMessage *message, const char *name,
const char *format, ...)
__attribute__((format(printf, 3, 4)));
diff --git a/gdbus/object.c b/gdbus/object.c
index ff69641..a367f93 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -52,6 +52,13 @@ struct interface_data {
GDBusDestroyFunction destroy;
};
+struct security_data {
+ GDBusPendingReply pending;
+ DBusMessage *message;
+ const GDBusMethodTable *method;
+ void *iface_user_data;
+};
+
static void print_arguments(GString *gstr, const char *sig,
const char *direction)
{
@@ -208,6 +215,114 @@ static DBusMessage *introspect(DBusConnection *connection,
return reply;
}
+static DBusHandlerResult process_message(DBusConnection *connection,
+ DBusMessage *message, const GDBusMethodTable *method,
+ void *iface_user_data)
+{
+ DBusMessage *reply;
+
+ reply = method->function(connection, message, iface_user_data);
+
+ if (method->flags & G_DBUS_METHOD_FLAG_NOREPLY) {
+ if (reply != NULL)
+ dbus_message_unref(reply);
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+ if (method->flags & G_DBUS_METHOD_FLAG_ASYNC) {
+ if (reply == NULL)
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+ if (reply == NULL)
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+ dbus_connection_send(connection, reply, NULL);
+ dbus_message_unref(reply);
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+static GDBusPendingReply next_pending = 1;
+static GSList *pending_security = NULL;
+
+static const GDBusSecurityTable *security_table = NULL;
+
+void g_dbus_pending_success(DBusConnection *connection,
+ GDBusPendingReply pending)
+{
+ GSList *list;
+
+ for (list = pending_security; list; list = list->next) {
+ struct security_data *secdata = list->data;
+ DBusHandlerResult result;
+
+ if (secdata->pending != pending)
+ continue;
+
+ pending_security = g_slist_remove(pending_security, secdata);
+
+ result = process_message(connection, secdata->message,
+ secdata->method, secdata->iface_user_data);
+
+ dbus_message_unref(secdata->message);
+ g_free(secdata);
+ return;
+ }
+}
+
+void g_dbus_pending_error(DBusConnection *connection,
+ GDBusPendingReply pending, DBusMessage *error)
+{
+ GSList *list;
+
+ for (list = pending_security; list; list = list->next) {
+ struct security_data *secdata = list->data;
+
+ if (secdata->pending != pending)
+ continue;
+
+ pending_security = g_slist_remove(pending_security, secdata);
+
+ if (error != NULL) {
+ dbus_connection_send(connection, error, NULL);
+ dbus_message_unref(error);
+ }
+
+ dbus_message_unref(secdata->message);
+ g_free(secdata);
+ return;
+ }
+}
+
+static gboolean check_privilege(DBusConnection *conn, DBusMessage *msg,
+ const GDBusMethodTable *method, void *iface_user_data)
+{
+ const GDBusSecurityTable *security;
+
+ for (security = security_table; security && security->function &&
+ security->privilege; security++) {
+ struct security_data *secdata;
+
+ if (security->privilege != method->privilege)
+ continue;
+
+ secdata = g_new(struct security_data, 1);
+ secdata->pending = next_pending++;
+ secdata->message = dbus_message_ref(msg);
+ secdata->method = method;
+ secdata->iface_user_data = iface_user_data;
+
+ pending_security = g_slist_prepend(pending_security, secdata);
+
+ security->function(conn, secdata->message, secdata->pending);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static void generic_unregister(DBusConnection *connection, void *user_data)
{
struct generic_data *data = user_data;
@@ -249,8 +364,6 @@ static DBusHandlerResult generic_message(DBusConnection *connection,
for (method = iface->methods; method &&
method->name && method->function; method++) {
- DBusMessage *reply;
-
if (dbus_message_is_method_call(message, iface->name,
method->name) == FALSE)
continue;
@@ -259,26 +372,12 @@ static DBusHandlerResult generic_message(DBusConnection *connection,
method->signature) == FALSE)
continue;
- reply = method->function(connection, message, iface->user_data);
-
- if (method->flags & G_DBUS_METHOD_FLAG_NOREPLY) {
- if (reply != NULL)
- dbus_message_unref(reply);
+ if (check_privilege(connection, message, method,
+ iface->user_data) == TRUE)
return DBUS_HANDLER_RESULT_HANDLED;
- }
-
- if (method->flags & G_DBUS_METHOD_FLAG_ASYNC) {
- if (reply == NULL)
- return DBUS_HANDLER_RESULT_HANDLED;
- }
- if (reply == NULL)
- return DBUS_HANDLER_RESULT_NEED_MEMORY;
-
- dbus_connection_send(connection, reply, NULL);
- dbus_message_unref(reply);
-
- return DBUS_HANDLER_RESULT_HANDLED;
+ return process_message(connection, message, method,
+ iface->user_data);
}
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
@@ -362,11 +461,10 @@ static struct generic_data *object_path_ref(DBusConnection *connection,
}
data = g_new0(struct generic_data, 1);
+ data->refcount = 1;
data->introspect = g_strdup(DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE "<node></node>");
- data->refcount = 1;
-
if (!dbus_connection_register_object_path(connection, path,
&generic_table, data)) {
g_free(data->introspect);
@@ -556,6 +654,23 @@ gboolean g_dbus_unregister_interface(DBusConnection *connection,
return TRUE;
}
+gboolean g_dbus_register_security(const GDBusSecurityTable *security)
+{
+ if (security_table != NULL)
+ return FALSE;
+
+ security_table = security;
+
+ return TRUE;
+}
+
+gboolean g_dbus_unregister_security(const GDBusSecurityTable *security)
+{
+ security_table = NULL;
+
+ return TRUE;
+}
+
DBusMessage *g_dbus_create_error_valist(DBusMessage *message, const char *name,
const char *format, va_list args)
{
--
1.7.2.2
^ permalink raw reply related
* Re: Cannot build BlueZ Release 4.70...
From: Johan Hedberg @ 2010-08-28 8:22 UTC (permalink / raw)
To: Ho, Albert O; +Cc: linux-bluetooth@vger.kernel.org, marcel@holtmann.org
In-Reply-To: <CF9C39F99A89134C9CF9C4CCB68B8DDF25AB2D2864@orsmsx501.amr.corp.intel.com>
Hi Albert,
On Sat, Aug 28, 2010, Ho, Albert O wrote:
> Hi, I attempted to build Release 4.70 but it's not buildable. Using
> sources either from bluez-4.70.tar.gz (www.bluez.org) or from git
> results to compile errors. The offending lines are all in
> attrib-server.c & all are 'undefined references to xxxxx'. Same setup
> can build 4.69. Pls advise.
It compiles fine for me. You'll need to copy-paste the exact errors you
get as well as the configure script options that you used.
Johan
^ permalink raw reply
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