Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HELP - m$ "wedge" b/t kb will not pair - SOLVED (sort of)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2365
Location: Kentucky

PostPosted: Sat Jul 26, 2014 7:17 pm    Post subject: HELP - m$ "wedge" b/t kb will not pair - SOLVED (s Reply with quote

I bought a Microsoft "wedge" bluetooth keyboard, and it works great under w7, but refuses to pair under gentoo.

Code:

onesimus ~ # hcitool scan
Scanning ...
        7C:1E:52:1B:44:71       Microsoft Wedge Mobile Keyboard
onesimus ~ # simple-agent hci0 7C:1E:52:1B:44:71
Creating device failed: org.bluez.Error.AuthenticationFailed: Authentication Failed

/var/log/messages:
Code:

Jul 26 11:10:41 onesimus bluetoothd[2005]: Unknown Management opcode 23 (index 0)
Jul 26 11:11:11 onesimus bluetoothd[2005]: hci0: Cancel Pair Device (0x001a) failed: Invalid Parameters (0x0d)

Googling reveals many people have much grief with this problem, although mostly ubunto using some goofy gui tool to pair, so not really the same exact problem.

Anybody got a fix/workaround for this?
_________________
The MyWord KJV Bible tool is at http://www.elilabs.com/~myword

Foghorn Leghorn is a Warner Bros. cartoon character.


Last edited by Moriah on Thu Aug 28, 2014 4:47 am; edited 1 time in total
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Mon Jul 28, 2014 9:58 pm    Post subject: Reply with quote

Try the "bluetoothctl" command provided by bluez, it seems to be a replacement for all those ad-hoc programs but slightly more reliable. It gives you a command prompt sort of like wpa_cli, with a help command and tab completion.

I've managed to get a BT keyboard of my own to connect using it, though like all things BlueZ-related, it stopped working after a few minutes...

Good luck.
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2365
Location: Kentucky

PostPosted: Wed Aug 06, 2014 1:54 am    Post subject: Reply with quote

Can't find bluetoothctl
Code:

onesimus ~ # hcitool scan
Scanning ...
        7C:1E:52:1B:44:71       Microsoft Wedge Mobile Keyboard
onesimus ~ # bluetoothctl
-su: bluetoothctl: command not found
onesimus ~ # emerge -s bluetoothctl
Searching...   
[ Results for search key : bluetoothctl ]
[ Applications found : 0 ]

onesimus ~ #

Now what?

PS Sorry I was so slow to respond. Been very busy with work and business travel. :(
_________________
The MyWord KJV Bible tool is at http://www.elilabs.com/~myword

Foghorn Leghorn is a Warner Bros. cartoon character.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Thu Aug 07, 2014 9:38 pm    Post subject: Reply with quote

Well it's definitely there for me, maybe it depends on USE=readline and you have it disabled?
Code:
~ # cave owner /usr/bin/bluetoothctl
net-wireless/bluez-5.21-r1::installed
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2365
Location: Kentucky

PostPosted: Fri Aug 08, 2014 12:44 am    Post subject: Reply with quote

That shouldn't keep it from showing up on emerge -s; are you sure you didn't fetch thetarball from somewhere and install it manually?

Besides, I do have readline in USE="... in makefile.conf, so what could the difference be?
_________________
The MyWord KJV Bible tool is at http://www.elilabs.com/~myword

Foghorn Leghorn is a Warner Bros. cartoon character.
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2365
Location: Kentucky

PostPosted: Fri Aug 08, 2014 12:53 am    Post subject: Reply with quote

DUH! Dumb me! I had it masked in packages.mask! :oops:

I am installing net-wireless/bluez-5.21-r1:0/3 now. I will report back later.
_________________
The MyWord KJV Bible tool is at http://www.elilabs.com/~myword

Foghorn Leghorn is a Warner Bros. cartoon character.
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2365
Location: Kentucky

PostPosted: Fri Aug 08, 2014 11:05 pm    Post subject: Reply with quote

OK, when I install the latest bluez, I get bluetoothctl, and I can use that to get both my microsoft bluetooth mouse and my microsoft bluetooth wedge keyboard to work.

The bluetoothctl tool is pretty awkward. First, it is interactive, so I can't script it, and second, I can't figure out how to make the pairing persistent, how to make it turn on the bluetooth chip in the laptop at boot, and how to make it auto-connect to a previously paired device that has been declared trusted. All that used to work with my microsoft bluetooth mouse before the upgrade to bluez5, but of course, I couldn't connect to my new microsoft bluetooth wedge keyboard under bluez4 either.

What is the technique to establish a persistent pairing, and to auto-connect, including to force the bluetooth chip to power up on boot.

I would actually be pretty happy if I had to manually power up the bluetooth chip, and power it down, as that would be a security enhancement, but I want to do it from a script, not interactively.

I realize I could always write an expect script to drive bluetoothclt, but there is surely a better way.

And even the expect script would not keep paired device information on disk. i would still have to re-pair every time I rebooted. it was veryconvenient before. rembering paired devices, and auot-power up and autoconnect.

Furthermore, I can't even connect a device unless it is in pairing mode. The way things ought to be is that once paired and trusted, the device should auto-connect whenever it is on and in range. That's how it used to be under bluez4.

Is there a whole new set of tools for bluez5 that I just don't know about, or is bluetoothctl it?

And why does a device have to be in pairing mode to connect to it if it is already paired?
_________________
The MyWord KJV Bible tool is at http://www.elilabs.com/~myword

Foghorn Leghorn is a Warner Bros. cartoon character.
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2365
Location: Kentucky

PostPosted: Sun Aug 10, 2014 12:09 am    Post subject: Reply with quote

On a side note, I determined that I can script bluetoothctl as follows:
Code:

echo '<some string>' | bluetoothctl

and it works fine that way, processing <some string> as a command.

So I can put this in a script to turn bluetooth on and off (2 scripts).

I still need to solve the problem of pairing and connecting persistently.

Apparently some paring information is saved somewhere, because I no longer have to enter a pin to pair the keyboard, whereas I did have to enter one at first. Now it just pairs on command, but it won't connect unless I do a pair first, and the mouse or keyboard must be in pairing mode to pair and to connect. This is not how it used to work under bluez4; it just saw a device that had been paired before the last power cycle, and it connected to it implicitly.

There are also timing issues involved with pairign and connecting. The sequence that I must go thru to connect my mouse is: power up; scan on; pair; connect; quit;

There are delays after the pair and the connect operations, and if you issue the connect too soon, before it says it is paird, then it won't connect. All this could be handled by a snazzy expect script, but that is messy. Maybe that is what I will have to do, unless someone knows a beterr way.
_________________
The MyWord KJV Bible tool is at http://www.elilabs.com/~myword

Foghorn Leghorn is a Warner Bros. cartoon character.
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3131

PostPosted: Sun Aug 10, 2014 10:11 am    Post subject: Reply with quote

Quote:
There are delays after the pair and the connect operations, and if you issue the connect too soon, before it says it is paird, then it won't connect. All this could be handled by a snazzy expect script, but that is messy. Maybe that is what I will have to do, unless someone knows a beterr way.

While it i a bit ugly, it is a quick solution you can easily apply. I'd go for it as temporary hack.
Does it report success/failure with exit codes? If yes, you could use that code as a condition for a loop running e.g 'sleep 3; connect' sequence
(last exit code is in variable $? )
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2365
Location: Kentucky

PostPosted: Sun Aug 10, 2014 1:34 pm    Post subject: Reply with quote

There is no man page, so I don't know if it supports exit codes or not; I should test for that. But the expect script idea would work in any case.

Nonetheless, it still requires the user to manually put the peripheral in pairing mode every time you need to connect. :evil:

Yes, it can be made to work, but its like saying you have to push start your car because the starter was broken by an upgrade.
_________________
The MyWord KJV Bible tool is at http://www.elilabs.com/~myword

Foghorn Leghorn is a Warner Bros. cartoon character.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Sun Aug 10, 2014 7:09 pm    Post subject: Reply with quote

You might be able to skip the pairing using the "trust <BDaddr>" command. Just a guess.
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2365
Location: Kentucky

PostPosted: Sun Aug 10, 2014 10:08 pm    Post subject: Reply with quote

A reasonable guess, but it doesn't work. Already been there, done that, no T-shirt available. :evil:
_________________
The MyWord KJV Bible tool is at http://www.elilabs.com/~myword

Foghorn Leghorn is a Warner Bros. cartoon character.
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2365
Location: Kentucky

PostPosted: Fri Aug 22, 2014 5:18 am    Post subject: Reply with quote

I have determined that once I have paired a device, it knows that device, so it only needs to connect to it. The problem is that the device needs to be in pairing mode for it to connect to it, so I still have to put the keyboard or mouse into pairing mode just to connect to it, even thought I do not have to re-pair to it. The old bluetooth support used to make me do that too, but they fixed it. Now the new bluez stuff has un-fixed it. :evil:
_________________
The MyWord KJV Bible tool is at http://www.elilabs.com/~myword

Foghorn Leghorn is a Warner Bros. cartoon character.
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2365
Location: Kentucky

PostPosted: Sun Aug 24, 2014 4:11 am    Post subject: Reply with quote

I have found another misbehaviour, but it seems to only happen with the Microsoft wedge keyboard, not the Microsoft bluetooth mouse.

After working flawlessly for an hour of so, then keyboard suddenly drops the connection, or maybe the laptop drops the connection to the keyboard; in either case, the connection ceases to exist. I can go to the laptop keyboard and run echo 'connect xx:xx:xx:xx:xx:xx' | bluetoothctl after first putting the wedge keyboard in pairing mode, and it reconnects and works again.

Anybody else seen this behaviour, with any bluetooth device?
_________________
The MyWord KJV Bible tool is at http://www.elilabs.com/~myword

Foghorn Leghorn is a Warner Bros. cartoon character.
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2365
Location: Kentucky

PostPosted: Thu Aug 28, 2014 4:47 am    Post subject: Reply with quote

Seems the mouse has the same connection dropping problem, but just not as often.

Anyway, I am marking this thread SOLVED, because it is titled about pairing the keyboard. That part is solved. I will start a new thread regarding bluetooth HID devices dropping out, and requiring the device to be in pairing mode just to reconnect.
_________________
The MyWord KJV Bible tool is at http://www.elilabs.com/~myword

Foghorn Leghorn is a Warner Bros. cartoon character.
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2365
Location: Kentucky

PostPosted: Tue Sep 09, 2014 12:38 pm    Post subject: Reply with quote

After a recent weekly update last weekend, the mouse and keyboard stay connected -- no more dropouts. I wonder what was changed that made the difference. 8O
_________________
The MyWord KJV Bible tool is at http://www.elilabs.com/~myword

Foghorn Leghorn is a Warner Bros. cartoon character.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum