All of lore.kernel.org
 help / color / mirror / Atom feed
* Apple Wireless Keyboard connection issue
@ 2010-11-16 21:27 "André Kühne"
  2010-11-17  1:30 ` Gustavo F. Padovan
  0 siblings, 1 reply; 8+ messages in thread
From: "André Kühne" @ 2010-11-16 21:27 UTC (permalink / raw)
  To: linux-bluetooth

Hi everyone

I noticed the following on my system: After upgrading to bluez-4.79 connecting my Apple Wireless Keyboard does not work anymore. With bluez-4.77 the connection works just fine.

Please let me know if I could be of any help e.g. providing more detailed information.

Best regards
Andre

-- 
Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Apple Wireless Keyboard connection issue
  2010-11-16 21:27 Apple Wireless Keyboard connection issue "André Kühne"
@ 2010-11-17  1:30 ` Gustavo F. Padovan
  2010-11-17  9:05   ` Johan Hedberg
  0 siblings, 1 reply; 8+ messages in thread
From: Gustavo F. Padovan @ 2010-11-17  1:30 UTC (permalink / raw)
  To: "André Kühne"; +Cc: linux-bluetooth

* "André Kühne" <andre.kuehne@gmx.net> [2010-11-16 22:27:01 +0100]:

> Hi everyone
> 
> I noticed the following on my system: After upgrading to bluez-4.79 connecting my Apple Wireless Keyboard does not work anymore. With bluez-4.77 the connection works just fine.
> 

My Microsoft keyboard is not working too. That is probably due to commit
abe7cd44124a from Johan. It should be fixed soon.

-- 
Gustavo F. Padovan
http://profusion.mobi

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Apple Wireless Keyboard connection issue
  2010-11-17  1:30 ` Gustavo F. Padovan
@ 2010-11-17  9:05   ` Johan Hedberg
  2010-11-17 23:04     ` Andre Kuehne
  0 siblings, 1 reply; 8+ messages in thread
From: Johan Hedberg @ 2010-11-17  9:05 UTC (permalink / raw)
  To: Gustavo F. Padovan; +Cc: André Kühne, linux-bluetooth

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

Hi Gustavo,

On Tue, Nov 16, 2010, Gustavo F. Padovan wrote:
> * "André Kühne" <andre.kuehne@gmx.net> [2010-11-16 22:27:01 +0100]:
> > I noticed the following on my system: After upgrading to bluez-4.79
> > connecting my Apple Wireless Keyboard does not work anymore. With
> > bluez-4.77 the connection works just fine.
> 
> My Microsoft keyboard is not working too. That is probably due to commit
> abe7cd44124a from Johan. It should be fixed soon.

The only real difference that patch makes is the reuse of the HCI socket
inside hciops.c. Maybe that screws up the event filters somehow or
something similar. I don't have a keyboard to verify a fix, but could
you try the attached patch and see if it helps?

Johan

[-- Attachment #2: hciops_encrypt.patch --]
[-- Type: text/x-diff, Size: 1783 bytes --]

diff --git a/plugins/hciops.c b/plugins/hciops.c
index 9d25558..4492983 100644
--- a/plugins/hciops.c
+++ b/plugins/hciops.c
@@ -338,31 +338,37 @@ static int hciops_encrypt_link(int index, bdaddr_t *dst, bt_hci_result_t cb,
 	uint32_t link_mode;
 	uint16_t handle;
 
+	dd = hci_open_dev(index);
+	if (dd < 0)
+		return -errno;
+
 	cr = g_malloc0(sizeof(*cr) + sizeof(struct hci_conn_info));
 	cr->type = ACL_LINK;
 	bacpy(&cr->bdaddr, dst);
 
-	err = ioctl(SK(index), HCIGETCONNINFO, cr);
+	err = ioctl(dd, HCIGETCONNINFO, cr);
 	link_mode = cr->conn_info->link_mode;
 	handle = cr->conn_info->handle;
 	g_free(cr);
 
-	if (err < 0)
-		return -errno;
+	if (err < 0) {
+		err = -errno;
+		goto fail;
+	}
 
-	if (link_mode & HCI_LM_ENCRYPT)
-		return -EALREADY;
+	if (link_mode & HCI_LM_ENCRYPT) {
+		err = -EALREADY;
+		goto fail;
+	}
 
 	memset(&cp, 0, sizeof(cp));
 	cp.handle = htobs(handle);
 
-	if (hci_send_cmd(SK(index), OGF_LINK_CTL, OCF_AUTH_REQUESTED,
-				AUTH_REQUESTED_CP_SIZE, &cp) < 0)
-		return -errno;
-
-	dd = dup(SK(index));
-	if (dd < 0)
-		return -errno;
+	if (hci_send_cmd(dd, OGF_LINK_CTL, OCF_AUTH_REQUESTED,
+				AUTH_REQUESTED_CP_SIZE, &cp) < 0) {
+		err = -errno;
+		goto fail;
+	}
 
 	cmd = g_new0(struct hci_cmd_data, 1);
 	cmd->handle = handle;
@@ -379,8 +385,7 @@ static int hciops_encrypt_link(int index, bdaddr_t *dst, bt_hci_result_t cb,
 	if (setsockopt(dd, SOL_HCI, HCI_FILTER, &nf, sizeof(nf)) < 0) {
 		err = -errno;
 		g_free(cmd);
-		close(dd);
-		return -err;
+		goto fail;
 	}
 
 	io = g_io_channel_unix_new(dup(SK(index)));
@@ -391,6 +396,10 @@ static int hciops_encrypt_link(int index, bdaddr_t *dst, bt_hci_result_t cb,
 	g_io_channel_unref(io);
 
 	return 0;
+
+fail:
+	close(dd);
+	return err;
 }
 
 /* End async HCI command handling */

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: Apple Wireless Keyboard connection issue
  2010-11-17 23:04     ` Andre Kuehne
@ 2010-11-17 22:27       ` Johan Hedberg
  2010-11-18  1:48         ` Andre Kuehne
  0 siblings, 1 reply; 8+ messages in thread
From: Johan Hedberg @ 2010-11-17 22:27 UTC (permalink / raw)
  To: Andre Kuehne; +Cc: Gustavo F. Padovan, linux-bluetooth

Hi,

On Thu, Nov 18, 2010, Andre Kuehne wrote:
> On 11/17/2010 10:05 AM, Johan Hedberg wrote:
> >On Tue, Nov 16, 2010, Gustavo F. Padovan wrote:
> >>* "André Kühne"<andre.kuehne@gmx.net>  [2010-11-16 22:27:01 +0100]:
> >>>I noticed the following on my system: After upgrading to bluez-4.79
> >>>connecting my Apple Wireless Keyboard does not work anymore. With
> >>>bluez-4.77 the connection works just fine.
> >>
> >>My Microsoft keyboard is not working too. That is probably due to commit
> >>abe7cd44124a from Johan. It should be fixed soon.
> >
> >The only real difference that patch makes is the reuse of the HCI socket
> >inside hciops.c. Maybe that screws up the event filters somehow or
> >something similar. I don't have a keyboard to verify a fix, but could
> >you try the attached patch and see if it helps?
> >
> I installed
> 
>   http://www.kernel.org/pub/linux/bluetooth/bluez-4.79.tar.gz + hciops_encrypt.patch
> 
> but the patch does not work for me. For verification I downloaded
> 
>   http://www.kernel.org/pub/linux/bluetooth/bluez-4.77.tar.gz
> 
> and compiled/installed it the same way (without the patch) and the connection works.
> 
> I did the same using bluez-4.78 with the result that both my keyboard and mouse failed to connect.

Ok, so then it seems like abe7cd44124a might not be to blame. Could you
do a proper git bisect so we can figure out exactly at which point this
broke. abe7cd44124a is really the only commit touching HID code since
4.77 so this is starting to get a bit strange.

Johan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Apple Wireless Keyboard connection issue
  2010-11-17  9:05   ` Johan Hedberg
@ 2010-11-17 23:04     ` Andre Kuehne
  2010-11-17 22:27       ` Johan Hedberg
  0 siblings, 1 reply; 8+ messages in thread
From: Andre Kuehne @ 2010-11-17 23:04 UTC (permalink / raw)
  To: Gustavo F. Padovan, linux-bluetooth

Hi Johan

On 11/17/2010 10:05 AM, Johan Hedberg wrote:
> Hi Gustavo,
>
> On Tue, Nov 16, 2010, Gustavo F. Padovan wrote:
>> * "André Kühne"<andre.kuehne@gmx.net>  [2010-11-16 22:27:01 +0100]:
>>> I noticed the following on my system: After upgrading to bluez-4.79
>>> connecting my Apple Wireless Keyboard does not work anymore. With
>>> bluez-4.77 the connection works just fine.
>>
>> My Microsoft keyboard is not working too. That is probably due to commit
>> abe7cd44124a from Johan. It should be fixed soon.
>
> The only real difference that patch makes is the reuse of the HCI socket
> inside hciops.c. Maybe that screws up the event filters somehow or
> something similar. I don't have a keyboard to verify a fix, but could
> you try the attached patch and see if it helps?
>
I installed

   http://www.kernel.org/pub/linux/bluetooth/bluez-4.79.tar.gz + hciops_encrypt.patch

but the patch does not work for me. For verification I downloaded

   http://www.kernel.org/pub/linux/bluetooth/bluez-4.77.tar.gz

and compiled/installed it the same way (without the patch) and the connection works.

I did the same using bluez-4.78 with the result that both my keyboard and mouse failed to connect.

Best regards
Andre

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Apple Wireless Keyboard connection issue
  2010-11-17 22:27       ` Johan Hedberg
@ 2010-11-18  1:48         ` Andre Kuehne
  2010-11-18  8:44           ` Johan Hedberg
  0 siblings, 1 reply; 8+ messages in thread
From: Andre Kuehne @ 2010-11-18  1:48 UTC (permalink / raw)
  To: Gustavo F. Padovan, linux-bluetooth

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

On 11/17/2010 11:27 PM, Johan Hedberg wrote:
> Hi,
>
> On Thu, Nov 18, 2010, Andre Kuehne wrote:
>> On 11/17/2010 10:05 AM, Johan Hedberg wrote:
>>> On Tue, Nov 16, 2010, Gustavo F. Padovan wrote:
>>>> * "André Kühne"<andre.kuehne@gmx.net>   [2010-11-16 22:27:01 +0100]:
>>>>> I noticed the following on my system: After upgrading to bluez-4.79
>>>>> connecting my Apple Wireless Keyboard does not work anymore. With
>>>>> bluez-4.77 the connection works just fine.
>>>>
>>>> My Microsoft keyboard is not working too. That is probably due to commit
>>>> abe7cd44124a from Johan. It should be fixed soon.
>>>
>>> The only real difference that patch makes is the reuse of the HCI socket
>>> inside hciops.c. Maybe that screws up the event filters somehow or
>>> something similar. I don't have a keyboard to verify a fix, but could
>>> you try the attached patch and see if it helps?
>>>
>> I installed
>>
>>    http://www.kernel.org/pub/linux/bluetooth/bluez-4.79.tar.gz + hciops_encrypt.patch
>>
>> but the patch does not work for me. For verification I downloaded
>>
>>    http://www.kernel.org/pub/linux/bluetooth/bluez-4.77.tar.gz
>>
>> and compiled/installed it the same way (without the patch) and the connection works.
>>
>> I did the same using bluez-4.78 with the result that both my keyboard and mouse failed to connect.
>
> Ok, so then it seems like abe7cd44124a might not be to blame. Could you
> do a proper git bisect so we can figure out exactly at which point this
> broke. abe7cd44124a is really the only commit touching HID code since
> 4.77 so this is starting to get a bit strange.
>
> Johan
>
Please find attached my bisect results.

Best regards
Andre

[-- Attachment #2: bluez-bisect.txt --]
[-- Type: text/plain, Size: 1540 bytes --]

> git bisect good
a352058752e541539b09e55124d411a534cc14af is the first bad commit
commit a352058752e541539b09e55124d411a534cc14af
Author: Johan Hedberg <johan.hedberg@nokia.com>
Date:   Thu Nov 4 04:38:35 2010 +0200

    Cache adapter address for quick lookup

:040000 040000 b7b14eb9f69c0b74ebda87b2fa40a4574f08be44 b96739e2d58fcc5a5c6654431ba49a36ee623932 M	plugins

> git bisect log
git bisect start
# good: [b079cca768419d11e011cc5a7d59bc802226e633] Release 4.77
git bisect good b079cca768419d11e011cc5a7d59bc802226e633
# bad: [018c5b71748c178dcd2ffb0164c1d975788a2acc] Release 4.78
git bisect bad 018c5b71748c178dcd2ffb0164c1d975788a2acc
# good: [d5d0fa3be8f7a20d128dcbaf8fc529c38bc52395] Optimize device disconnect callback processing
git bisect good d5d0fa3be8f7a20d128dcbaf8fc529c38bc52395
# good: [b67a8a42e6ea9c2d2b0877ac3832de75ec4e00e5] Fix bdaddr naming consistency
git bisect good b67a8a42e6ea9c2d2b0877ac3832de75ec4e00e5
# bad: [5295b6a0ab0ad67a27926273a3fbf61f02663219] Fix not ignoring case of uuid given to RegisterEndpoint
git bisect bad 5295b6a0ab0ad67a27926273a3fbf61f02663219
# good: [db5266f0afedc33e2fd6fc3601c16498865f746d] Remove redundant tracking of ignored adapters
git bisect good db5266f0afedc33e2fd6fc3601c16498865f746d
# bad: [a352058752e541539b09e55124d411a534cc14af] Cache adapter address for quick lookup
git bisect bad a352058752e541539b09e55124d411a534cc14af
# good: [b289e54d53c332a51be483c1660a42c267991dd3] Remove redundant hci_devinfo call
git bisect good b289e54d53c332a51be483c1660a42c267991dd3

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Apple Wireless Keyboard connection issue
  2010-11-18  1:48         ` Andre Kuehne
@ 2010-11-18  8:44           ` Johan Hedberg
  2010-11-18 18:56             ` Andre Kuehne
  0 siblings, 1 reply; 8+ messages in thread
From: Johan Hedberg @ 2010-11-18  8:44 UTC (permalink / raw)
  To: Andre Kuehne; +Cc: Gustavo F. Padovan, linux-bluetooth

Hi Andre,

On Thu, Nov 18, 2010, Andre Kuehne wrote:
> > git bisect good
> a352058752e541539b09e55124d411a534cc14af is the first bad commit
> commit a352058752e541539b09e55124d411a534cc14af
> Author: Johan Hedberg <johan.hedberg@nokia.com>
> Date:   Thu Nov 4 04:38:35 2010 +0200
> 
>     Cache adapter address for quick lookup

That's actually not related to the HID issue. There's a later commit
that fixed the general initialization issue that this commit caused.

I was now able to get hold of a Bluetooth keyboard and fixed the issue.
The problem was indeed in the commit that Gustavo originally pointed
out. It's just that my original patch for it was incomplete and so
didn't properly fix the issue. Anyway, a proper fix has now been pushed
to git. Please test with that.

Johan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Apple Wireless Keyboard connection issue
  2010-11-18  8:44           ` Johan Hedberg
@ 2010-11-18 18:56             ` Andre Kuehne
  0 siblings, 0 replies; 8+ messages in thread
From: Andre Kuehne @ 2010-11-18 18:56 UTC (permalink / raw)
  To: Gustavo F. Padovan, linux-bluetooth

On 11/18/2010 09:44 AM, Johan Hedberg wrote:
> I was now able to get hold of a Bluetooth keyboard and fixed the issue.
> The problem was indeed in the commit that Gustavo originally pointed
> out. It's just that my original patch for it was incomplete and so
> didn't properly fix the issue. Anyway, a proper fix has now been pushed
> to git. Please test with that.

Thank you Johan and Gustavo, current git works fine for me.

Andre

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-11-18 18:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-16 21:27 Apple Wireless Keyboard connection issue "André Kühne"
2010-11-17  1:30 ` Gustavo F. Padovan
2010-11-17  9:05   ` Johan Hedberg
2010-11-17 23:04     ` Andre Kuehne
2010-11-17 22:27       ` Johan Hedberg
2010-11-18  1:48         ` Andre Kuehne
2010-11-18  8:44           ` Johan Hedberg
2010-11-18 18:56             ` Andre Kuehne

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.