LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Apple Wireless Keyboard (bluetooth) (https://www.linuxquestions.org/questions/linux-hardware-18/apple-wireless-keyboard-bluetooth-251861/)

nakko 11-06-2004 02:09 PM

Apple Wireless Keyboard (bluetooth)
 
Noticing that many people have an Apple Wireless Keyboard, I decided to buy both the keyboard and the recommended D-Link USB dongle. I have not been able to use the device as a keyboard yet, despite having read much documentation! I feel I must be missing some basic, basic step that either has been glossed over or most people assume I'd know. It's also possible I just missed it!

At any rate, here is what I have:
Debian unstable (sarge)
dual PIII 700MHz / 500MB RAM / 20 GB hdd
Was using prepackaged kernel 2.6.8

Here is what I have done:
Downloaded 2.6.9 source code and dependencies, appropriate headers, Debian patches, etc.
Patched source with patch-2.6.9-mh3.gz from bluez.org, then linked /usr/src/linux to new appropriate dir.
+ACYAIw-36; make menuconfig
Made sure to specify I am running a PIII, and enabled SMP stuff. Disabled OSS entirely, and chose builtin ALSA instead.
Chose to build HIDP in rather than make as module. (Answered "y" to CONFIG+ACYAIw-95;BT+ACYAIw-95;HIDP rather than "m")
Build, reboot, and here I am.

When I do something like:
+ACYAIw-36; hcitool inq
I get the proper info, Apple Wireless Keyboard, its address and class, all that good jazz. So obviously my USB dongle can see the keyboard on some level, and perform basic communications with it.
However, if I try:
+ACYAIw-36; hidd --search
I get this in return:
Connecting to device [my device's address]
Can't create HID control channel: Invalid exchange

Now, that is as far as I have gotten. What, at this point, must I do to make it actually work? How do I get my bluetooth subsystem to recognize the keyboard as a regular HID device? All I want to do is use it as a fancy remote control for my livingroom MythTV box!

Any help is of course appreciated.

nakko 01-17-2005 02:44 AM

Apple Wireless Keyboard
 
Who has an Apple Wireless Keyboard running?

Who has one running under Debian?

Will you help me? It's driving me nuts.

tormentum 03-21-2005 06:02 PM

Hey dude, have a look at this page:

http://klausler.com/msbtkb-linux.html

Down the bottom there is a section on how to adapt the HOWTO to an apple wireless keyboard.

Have fun and let me know how you go. I'm wanting to get one of these babies, but I want to know if it works first :)

Torm

Learnincurve 11-07-2005 10:18 AM

problems with Apple wireless keyboard and D-Link DBT-120
 
Hi,

Sorry to revive this old thread, but I'm having big trouble even getting the dongle to be recognised, o no luck yet with the keyboard.

Here's what I have:

Debian unstable (sid) on 32 bit VMWare virtual machine and 64 bit (kanotix64 2005-03) directly installed to HD.
D-Link DBT-120 rev. B4

Most of the testing on the virtual machine, but AMD64 seems to give same results.

First off, with original D-Link firmware, both lsusb and hciconfig picked up the dongle, but I couldn't initialize it. Installing the D-Link B4 driver in Doze allowed me to use the dongle, but not pair with it.

I then followed the instructions on this page:

http://www.linuxquestions.org/hcl/sh...ort=1&cat=4250

and got the dongle flashed with the Apple firmware upgrade.

Have since tried # hid2hci --tohci
No devices in HCI mode found
hid2hci --tohid
No devices in HID mode found
# cat /proc/bus/usb/devices

T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
B: Alloc= 0/900 us ( 0%), #Int= 0, #Iso= 0
D: Ver= 1.10 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=0000 ProdID=0000 Rev= 2.06
S: Manufacturer=Linux 2.6.13-kanotix-17 uhci_hcd
S: Product=Intel Corporation 82371AB/EB/MB PIIX4 USB
S: SerialNumber=0000:00:07.2
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr= 0mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 2 Ivl=255ms

showing only the usb hub...
Doze picks up the hid devices as expected,
what am I doing wrong in Linux.

Cheers

Marius

Learnincurve 11-09-2005 04:12 AM

One step further
 
Okay, sorry about the premature winging in my previous post ..
it seems that the dongle problems had to do with vmware / doze on the virtual machinge, the linux box finds the dongle and it works fine in hci mode with my T610 phone and trust bluetooth mouse.

I'm still having touble getting the apple kyboard to work. It seems to have something to do with the pin.

I run hidd -c 00:0A:95:42:47:26 ( the apple bt address) and then type my pin (blindly) on the apple keyboard.

The moment I hit return, the prompt shows:

# hidd -c 00:0A:95:42:47:26
Can't get device information: Permission denied

and kbluetooth pops up a " Problem connecting with Apple Wireless Keyboard, pairing not allowed" info box.

I've tried changing the pin helper app in /etc/hcid.conf, the file currently looks like this:

#
# HCI daemon configuration file.
#
# $Id: hcid.conf,v 1.7 2004/12/13 14:16:03 holtmann Exp $
#

# HCId options
options {
# Automatically initialize new devices
autoinit yes;

# Security Manager mode
# none - Security manager disabled
# auto - Use local PIN for incoming connections
# user - Always ask user for a PIN
#
security auto;;

# Pairing mode
# none - Pairing disabled
# multi - Allow pairing with already paired devices
# once - Pair once and deny successive attempts
pairing multi;

# PIN helper
pin_helper /usr/bin/bluez-pin;
# pin_helper /usr/lib/kdebluetooth/kbluepin;
# D-Bus PIN helper
#dbus_pin_helper;
}

# Default settings for HCI devices
device {
# Local device name
# %d - device id
# %h - host name
# name "%h-%d"; original
name "Mythbox";

# Local device class
# class 0x3e0100; original
class 0x100100;

# Default packet type
#pkt_type DH1,DM1,HV1;

# Inquiry and Page scan
iscan enable; pscan enable;

# Default link mode
# none - no specific policy
# accept - always accept incoming connections
# master - become master on incoming connections,
# deny role switch on outgoing connections
lm accept;original
lm master;

# Default link policy
# none - no specific policy
# rswitch - allow role switch
# hold - allow hold mode
# sniff - allow sniff mode
# park - allow park mode
lp rswitch,hold,sniff,park;

# Authentication and Encryption (Security Mode 3)
#auth enable;
#encrypt enable;
#added by marius:
auth disable;
encrypt disable;


}

Cheers

Marius

Learnincurve 11-09-2005 04:36 AM

more info
 
tail -f /var/log/daemon.log
Nov 9 11:30:20 mythbox hcid[5346]: PIN helper exited abnormally with code 256
Nov 9 11:30:26 mythbox hcid[4624]: pin_code_request (sba=00:13:46:05:C1:D9, dba=00:0A:95:42:47:26

This is what is being logged when I send the pin request

Cheers

Marius

Learnincurve 11-09-2005 06:04 AM

Everything working! I'm writing this on my shiny, white Apple keyboard.

Here's what I had to do:

Changed my pin helper program to the simple one suggested here:
http://www.triptico.com/software/bluetooth.html
i.e.
create this shell script:
#!/bin/sh
PIN=`cat /etc/bluetooth/pin`
echo "PIN:$PIN"

I put mine in /usr/local/sbin/mybtpin

change the line in /etc/bluetooth/hcid.conf
to reflect this:
pin_helper /usr/local/sbin/mybtpin;

Make sure kbluetooth is NOT running ( I don't know whether this is strictly necessary, but did it to be safe).

Stop and restart bluez-utils (again I don't know if this was necessary).

# hidd -c 00:0A:95:42:47:26

Enter pincode and hit return from Apple keyboard after waiting a couple of seconds.

BINGO!

Afterwards kbluetooth can be started again as normal.


I hope this helps others who might want to use the very well built and cheap Apple keyboard.

I have yet to see if it works in HID proxy mode at boot... didn't last time I checked.

Cheers

Marius

wnor 12-06-2005 04:27 PM

Learnincurve's information above is great. I'm on a similar quest: connect an Apple wireless keyboard through a DBT-120 to Fedora Core 3. I've followed the above closely, but get:

[root@desk bluetooth]# service bluetooth restart
Stopping Bluetooth services: [ OK ]
Starting Bluetooth services: [ OK ]
[root@desk bluetooth]# hcitool scan
Scanning ...
00:0A:95:38:9F:EB Apple Wireless Keyboard
[root@desk bluetooth]# hidd -c 00:0A:95:38:9F:EB
Can't create HID control channel: Permission denied
[root@desk bluetooth]# hid2hci --tohid
Switching device 0a12:0001 to HID mode was successful
[root@desk bluetooth]# hidd -c 00:0A:95:38:9F:EB
Can't create HID control channel: No route to host
[root@desk bluetooth]#

Does the above post include all the changes that need to be accomplished, or are some included in prior posts necessary? I've tried adding:
auth disable;
encrypt disable;
per the above config file, but no luck. I feel soooooo close. So what's the key to the palace?

Learnincurve 12-07-2005 01:52 AM

-19Hi wnor,
It's a bummer I know! You feel the elation as you think it's going tgo work, then BANG! Up pops the error!
Keep going, you'll get there.

Your error doesn't look quite like mine, but I'm guessing that's just a distro thing (I don't know much about Fedora), I take it you're using the homememade pin helper script. Is it executable? Any help from dmesg or /var/log/messages or /var/log/daemon.log?? One thing that springs to mind is that I think I heard that the dongle MUST be flashed with Aplle firmware to support 128 bit encryption. As hid2hci is working I guess you already did this... just checking! Does the keyboard work in hid mode? As far as I understand it you don't need to pair the devices for hid mode to work (but then again I may be wrong). The bluetooth configuration must of course be run in hci mode.
Can you post your hcid.conf file so we can see what's in there?
The only other things that spring to mind are bluez-utils version (mine's 2.19-1) and kernel version and what's in there. I'm running 2.6.14 (although I got this working on ~13)
My kernel config:
...
# FIR device drivers
#
CONFIG_USB_IRDA=m
CONFIG_SIGMATEL_FIR=m
CONFIG_NSC_FIR=m
CONFIG_WINBOND_FIR=m
CONFIG_TOSHIBA_FIR=m
CONFIG_SMC_IRCC_FIR=m
CONFIG_ALI_FIR=m
CONFIG_VLSI_FIR=m
CONFIG_VIA_FIR=m
CONFIG_BT=m
CONFIG_BT_L2CAP=m
CONFIG_BT_SCO=m
CONFIG_BT_RFCOMM=m
CONFIG_BT_RFCOMM_TTY=y
CONFIG_BT_BNEP=m
CONFIG_BT_BNEP_MC_FILTER=y
CONFIG_BT_BNEP_PROTO_FILTER=y
CONFIG_BT_HIDP=m

#
# Bluetooth device drivers
#
CONFIG_BT_HCIUSB=m
CONFIG_BT_HCIUSB_SCO=y
# CONFIG_BT_HCIUART is not set
# CONFIG_BT_HCIBCM203X is not set
# CONFIG_BT_HCIBPA10X is not set
# CONFIG_BT_HCIBFUSB is not set
CONFIG_BT_HCIVHCI=m
# CONFIG_IEEE80211 is not set

you'll find the above under networking -> bluetooth in the menu driven configs, or just check your .config file for anyththing containing _BT_:
$ cat /usr/src/linux/.config | grep _BT_

Sorry, far more questions than answers here, but keep going and you'll get there.

Cheers

Marius

nakko 12-13-2005 07:42 PM

Well, it's been more than a year since I first posted, and this Apple keyboard is still not working.
I can still try:
hidd -c 00:0A:95:3A:92:27
And I still get:
Can't get device information: Permission denied

I have tried what Learnincurve suggested and created the pin helper script, to no avail. Same results. Who is a Bluetooth guru? Who is a Bluetooth guru who knows how to get this to work on Debian? I'm running Etch, I have an Apple Wireless Keyboard, and a D-Link DBT-120, can't see what pieces I'm missing here...

nakko 12-13-2005 08:12 PM

Well, a little bit later, frustrated, trying a few more things, it seems to work.
I can't believe it. The only problem is, I have no idea what I did is what worked.
I changed my pin helper back to bluez-pin, so that is apparently NOT the hangup!!
It's something else, but I'll be hogtied if I could narrow it down.
Which sucks, because I know this will stop working at some point, I can feel it, and then I will be right back at square one.

I typed this with my Apple Wireless Keyboard. Dadgummit.

Learnincurve 12-15-2005 03:23 AM

Hi again folks.

Now you got me worried again, because I was sure I'd fixed it.

If it's any consolation, mine's still working (apart from the volume and cd keys which are apparently sending signals differently).

wishing you all the best.

Cheers

Marius

nakko 02-08-2006 07:38 PM

My lovely Apple Wireless Keyboard! I finally got it to work, as I stated above.

However.

If it goes to sleep (in other words, if I stop typing on it for a minute or so), it won't wake up. Period. I have to use my wired keyboard to detect it, as if from scratch. It certainly won't work from bootup.

So essentially, I --CAN NOT-- use it to replace my main wired keyboard.
*sigh*

So unless someone has some tips for me in that regard... screw it, I am selling this piece of (sadly) CRAP!


All times are GMT -5. The time now is 09:54 PM.