# kernel 2.6.8.1, bluetooth, and logitech MX

## greml!n

I'm having trouble getting my new Bluetooth Logitech MX keyboard and mouse with kernel 2.6.8.1 to work.  To be completely accurate, the keyboard and mouse do work.  However, I believe this is in some sort of compatability mode because none of the bluetooth setup tools I've tried work correctly and I can't figure out how to connect to my bluetooth phone.

My kernel is configured as:

 *Quote:*   

> 
> 
> #
> 
> # Automatically generated make config: don't edit
> ...

 

I have no Bluetooth modules set to autoload.  When I boot up, I perform a modprobe hci_usb which results in the following:

 *Quote:*   

> 
> 
> lsmod
> 
> Module                  Size  Used by
> ...

 

And the output of dmesg | tail is:

 *Quote:*   

> 
> 
> dmesg | tail
> 
> input,hiddev96: USB HID v1.10 Mouse [Logitech USB Receiver] on usb-0000:00:02.1-2.1
> ...

 

However, when I /etc/init.d/bluetooth start, nothing seems to happen.  Furthermore, the hciconfig command doesn't output anything.  Lastly, there are no obvious bluetooth devices created in /dev.

I've scoured these forums, bluez forums, and USENET and can't find the answer...  Can anyone help me get connectivity to my phone?

Thanks!

----------

## r3pek

well, if your using kde you can use kdebluetooth to connect to your phone.

if you're using gnome, use gnome-bluetooth.

just emerge one of them and everything should work.

----------

## greml!n

I don't think that's right because none of the directions I've followed seem to work.  I can't see anything via hcitool or hciconfig.  

Help?!?

----------

## r3pek

can you see the pc from the phone?

BTW: 

# CONFIG_BT_HCIUART is not set 

# CONFIG_BT_HCIBCM203X is not set 

# CONFIG_BT_HCIBFUSB is not set 

# CONFIG_BT_HCIVHCI is not set 

put all this to "y"

----------

## scoon

Hey there, 

got to http://www.bluez.org and get the kernel patch -mh1.  I use 2.6.8.1 and have those kb's and mouse as well.  

scoon

----------

## greml!n

 *r3pek wrote:*   

> can you see the pc from the phone?
> 
> BTW: 
> 
> # CONFIG_BT_HCIUART is not set 
> ...

 

No, I can't see the PC from the phone.  I will try those build changes.

----------

## greml!n

 *greml!n wrote:*   

>  *r3pek wrote:*   can you see the pc from the phone?
> 
> BTW: 
> 
> # CONFIG_BT_HCIUART is not set 
> ...

 

Ok, I can only build some of those as modules (set to M).  What modules do I need to load, and in what order?

Thanks!

----------

## greml!n

 *scoon wrote:*   

> Hey there, 
> 
> got to http://www.bluez.org and get the kernel patch -mh1.  I use 2.6.8.1 and have those kb's and mouse as well.  
> 
> scoon

 

This also had no effect.  Can you tell which modules you are loading?

Thanks

----------

## scoon

 *greml!n wrote:*   

>  *scoon wrote:*   Hey there, 
> 
> got to http://www.bluez.org and get the kernel patch -mh1.  I use 2.6.8.1 and have those kb's and mouse as well.  
> 
> scoon 
> ...

 

Hey there, 

Here is a snip of my /usr/src/linux/.config

```

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

CONFIG_BT_HCIUSB=m

CONFIG_BT_HCIUSB_SCO=y

CONFIG_BT_HCIUART=m

CONFIG_BT_HCIUART_H4=y

CONFIG_BT_HCIUART_BCSP=y

CONFIG_BT_HCIUART_BCSP_TXCRC=y

CONFIG_BT_HCIBCM203X=m

CONFIG_BT_HCIBFUSB=m

CONFIG_BT_HCIVHCI=m

CONFIG_VIDEO_BT848=m

CONFIG_VIDEO_BTCX=m

```

And then I have just the bluetooth module autoload.

I have these things emerged: 

bluez-utils-2.10

bluez-libs-2.10

bluez-hcidump-1.9

The real kicker is the perl script that I wrote and execute from /etc/init.d/local.start

here it is: 

```

#!/usr/bin/perl

use strict;

our $DEBUG = 1;

our $BT_MOUSE = "00:07:61:18:21:DD";

our $BT_KEYBOARD = "00:07:61:15:0C:54";

eval {

   `hid2hci`;

   `hidd --server`;

   `hciconfig hci0 up`;

}; warn $@ if $@;

#-- may pass this into ARGV for other devices

my $brand_string = "Logitech Bluetooth";

my $hid_show = `hidd --show`;

print "Setting up connections to keyboard and mouse...\n";

my ($connected, $tries, $complete_failure) = 0;

while($connected == 0){

   eval {

      `hid2hci`;

      #--`hciconfig hci0 up`; #-- maybe it didn't connect.

      #-- is this better ?

      `hidd --search`; #-- try and connect to some devices.

      #-- is this faster ?

      #-- `hidd --connect $BT_KEYBOARD` 

   }; warn $@ if $@;

   

   $hid_show = `hidd --show`; #-- see what we are connected to.

   #if($hid_show =~ m/keyboard/i) {

   if($hid_show =~ m/$BT_KEYBOARD/i) {

      $connected = 1;

   } elsif($tries == 5 ){

      if($complete_failure == 0){

         `hciconfig hci0 reset`;

         print "We have tried to connect 5 times already....\n";

         print "You MUST UNPLUG/REPLUG the USB dongle to reset it and";

         print " we will try again.\n";

         

         print "You have 30 SECONDS to disconnect/reconnect the dongle!!!\n";

         $complete_failure++;

         $tries = 0;

         sleep(30);

      } else {

         print "Tried 5 times and could not connect.\n";

         print "We have tried to connect 5 times already....\n";

         print "You MUST UNPLUG/REPLUG the USB dongle to reset it and";

         print " you will be connected WITHOUT Bluetooth.\n";

         print "Make certain that you reset the the keyboard and mouse connections...\n";

         eval {

             `hciconfig hci0 reset`;

             `killall hidd`;

         }; warn $@ if $@;

         

         sleep(5); 

         exit(-1);

      }

   } else {

      print "tries: $tries\n" if $DEBUG;

      print "DEBUG MSG: '$hid_show'\n" if $DEBUG;

      print "Couldn't connect, will sleep for 8 seconds...\n";

      sleep(8);

   }

   $tries++;

} #-- end of while

print "Finished setting up connections to keyboard and mouse, ENJOY!!!\n";

```

This is the last thing to get executed when I boot.  The thing with this kb setup is the linux bluetooth tools do NOT reset the hub when it switched from cordless to bluetooth cordless.  So I never plugged in the ps2 port.  Just the usb.  But once this script gets run, then I am just dandy and have my bluetooth kbs and mouse up and running.

scoon

----------

## greml!n

 *scoon wrote:*   

>  *greml!n wrote:*    *scoon wrote:*   Hey there, 
> 
> got to http://www.bluez.org and get the kernel patch -mh1.  I use 2.6.8.1 and have those kb's and mouse as well.  
> 
> scoon 
> ...

 

I followed these directions to no avail.  When I try the commmand hidd --show there is no output, and hidd --search prints "searching..." and nothing else.  

Right now I have the PS2 port plugged in - could that be interfering?  What about other modules I have loaded?

----------

## scoon

Hey there, 

Yes the ps2 port IS interfereing.  unplug both usb and the ps2.  Get your old (ps2) kb's and plug them in.  And then plug in ONLY the usb on the mx's.  Then run my script using the ps2 kbs.  

scoon

----------

## greml!n

No, it didn't work.

I finally got a chance to try as you suggested and still no bluetooth.  When I try to run your scripts I get a no devices found error.  hciconfig -a still produces nothing, and nothing appears in /dev

HELP?!?!?

----------

## scoon

 *greml!n wrote:*   

> No, it didn't work.
> 
> I finally got a chance to try as you suggested and still no bluetooth.  When I try to run your scripts I get a no devices found error.  hciconfig -a still produces nothing, and nothing appears in /dev
> 
> HELP?!?!?

 

Hey there, 

First, if you want to use my script you need to change the bluetooth addys of my keyboards and mouse to yours. That should just about do it.

scoon

----------

## greml!n

 *scoon wrote:*   

>  *greml!n wrote:*   No, it didn't work.
> 
> I finally got a chance to try as you suggested and still no bluetooth.  When I try to run your scripts I get a no devices found error.  hciconfig -a still produces nothing, and nothing appears in /dev
> 
> HELP?!?!? 
> ...

 

Still no - even with fixing the addresses.

Isn't it a problem that hciconfig doesn't output anything?  It's as though no device is ever found or registered.  Should I have a device for the bluetooth hub registered in /dev?  

Thx.

----------

## scoon

 *greml!n wrote:*   

>  *scoon wrote:*    *greml!n wrote:*   No, it didn't work.
> 
> I finally got a chance to try as you suggested and still no bluetooth.  When I try to run your scripts I get a no devices found error.  hciconfig -a still produces nothing, and nothing appears in /dev
> 
> HELP?!?!? 
> ...

 

Hey there, 

Are you certain that you have all the bluetooth modules loaded.  Also, have you added bluetooth to start on boot ?

scoon

----------

## greml!n

No and no.

I don't have bluetooth added to boot runlevel (yet).  I will change that and test.

Which modules should I autoload?  Right now it's only bluetooth, which appears to load some others.  

Thx

----------

## scoon

 *greml!n wrote:*   

> No and no.
> 
> I don't have bluetooth added to boot runlevel (yet).  I will change that and test.
> 
> Which modules should I autoload?  Right now it's only bluetooth, which appears to load some others.  
> ...

 

Hey there, 

Why not try and rebuild your kernel with ALL of the bluetooth drivers built in ?  That is what I did until I knew I had bluetooth working.

scoon

----------

## dreadhead

hi!

@ greml!n:

where you able to switch the dongle int the hci-mode with 

```
hid2hci
```

?

@ scoon:

I copied your perl script. Its very nice! Thank you!

But I have 1 question: When my PC comes up and this script runs I have to move my mouse and press some keys on my kb. If I dont do that the dongle can't find my devices and my PC runs whitout keyboard and mouse. Is there any possibility to make the dongle find my devices whitout touching them, because I often switch on my PC and go away. When I come back I have to reboot it...[/code]

----------

## scoon

 *dreadhead wrote:*   

> hi!
> 
> @ greml!n:
> 
> where you able to switch the dongle int the hci-mode with 
> ...

 

Hey there, 

I just push the connect button on the mouse and keyboard during the script running, which only occurs during boot.  I think what the windows driver does is "reset" the dongle but the bluez libs do not.  That is just my guess as I do not run windows and this script was my "best guess" at getting my kb's and mouse to work.

scoon

scoon

----------

## greml!n

 *dreadhead wrote:*   

> hi!
> 
> @ greml!n:
> 
> where you able to switch the dongle int the hci-mode with 
> ...

 

No, still does nothing    :Crying or Very sad: 

Any more suggestions?  I'm thinking of emailing this thread to the bluez mailing list.  I can't figure out why nothing bluetooth related appears to be recognized, though dmesg shows some bluetooth messages.

Any other suggestions?

----------

## dreadhead

Do get any message when you rung hid2hci?

----------

