# Problem on pairing Apple bluetooth keyboard

## VanFanel

Hello there

Bluetooth on Gentoo is giving me a HARD time. I'm suffering every moment with it's setup like I had never suffered with Gentoo!  :Sad: 

And all I want is using my bluetooth keyboard, but after reading TONS of documents, I'm about to give up, once and for all.

I emerged bluez-tools with the "old-daemons" USE flag, so I could get hidd, to follow the bluetooth HOWTO's in the gentoo wiki.

Let's see:

```

commodore~ # hidd --connect 00:22:41:DC:06:49

Can't create HID control channel: connection refused

```

Relevant files are as follow:

/etc/conf.d/bluetooth

```
# Bluetooth configuraton file

# Run hid2hci (allowed values are "true" and "false")

HID2HCI_ENABLE=false

# Bind rfcomm devices (allowed values are "true" and "false")

RFCOMM_ENABLE=true

# Config file for rfcomm

RFCOMM_CONFIG="/etc/bluetooth/rfcomm.conf"

HCID_ENABLE=true

HIDD_ENABLE=true

HIDD_OPTIONS="--connect 00:22:41:DC:06:49"

```

/etc/bluetooth/hcid.conf

```

#

# HCI daemon configuration file.

#

# 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;

   # Default PIN code for incoming connections

   #passkey "1234";

}

# Default settings for HCI devices

device {

   # Local device name

   #   %d - device id

   #   %h - host name

   name "BlueZ (%d)";

   # Local device class

   class 0x000100;

   # 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;

   # 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;

}

device 00:22:41:DC:06:49 {

   name "applekeys";

   auth enable;

   encrypt enable;

}

```

/etc/bluetooth/pin

```
1234
```

Of course, 1234 is the code I enter (on the Apple bt keyboard) when I try to pair the kayboard...

When I push ENTER, I get that error: Can't create HID control channel: connection refused.

Any help would be appreciated...

thanks!

----------

## Logicien

Hi,

I resolved bluetooth authentification issues with PIN by creating in /var/lib/bluetooth/xx:xx:xx:xx:xx:xx (for MAC bluetooth host address of hcix) a text file named pincodes where I write, one by line, the MAC address of the bluetooth devices I want to pair with, separated by a space and the pincode to use. For you it will be

```
00:22:41:DC:06:49 1234
```

With that, every bluetooth host communication using hcix to pair with this remote device it correctly authentificated. This is the only way I am sure to succeed for pincodes exchanges between remote and host for bluetooth. If your authentification with your bluetooth keyboard failed, I understand that the host "Can't create HID control channel: connection refused".

----------

## drtebi

Thank you, this just made my day. Amazing how much easier it is to create a little text file as opposed to clicking through three or four menus 20 times...

----------

## 666threesixes666

i had problems until i got bluez....  sudo emerge bluez

i still cant pair a headset though.

----------

