Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Forum Archive > Main Support Categories > Hardware & Laptops
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Hello, Unregistered You are browsing a READ only archive of the main support categories pre 4/21/2008. You will not be able to post or reply any threads in this section.

Hardware & Laptops
Problems with hardware & laptops not being detected or supported during or after install.

 
 
Thread Tools Display Modes
Old August 1st, 2006   #1
boneill
First Cup of Ubuntu
 
Join Date: Nov 2005
Beans: 1
HOWTO: Bluetooth Keyboard and Mouse

I have a Microsoft Optical Desktop Elite for Bluetooth and I use Ubuntu. This tutorial should help you getting your keyboard and mouse up and running (and automatically reconnecting after you reboot, idle, or whatever).

This tutorial is an adapted version of this forum thread by naag.

Getting Started

We need the MAC address (e.g. 00:00:00:00:00) of the mouse and keyboard. I shall use KEYBOARD_ADDR and MOUSE_ADDR where you should find the addresses for the keyboard and mouse respectively. Press the button on the mouse that makes it visible to be found by the computer. Do the same for the keyboard. Now open a terminal window and run the following command:

Code:
 user@computer:~$ hcitool scan
 Scanning ...
         KEYBOARD_ADDR       Microsoft Wireless Keyboard
         MOUSE_ADDR          Microsoft Mouse
 user@computer:~$
Adding the Keyboard and Mouse

Now we need to add the keyboard and mouse to the bluetooth configuration files. Run the following command to pop up GEdit:

Code:
 user@computer:~$ sudo gedit /etc/bluetooth/hcid.conf
You may be asked for your password, this is because we used sudo.

At the end of the file, add the following (replacing KEYBOARD_ADDR and MOUSE_ADDR for the keyboard and mouse MAC addresses as found earlier):

Code:
 device KEYBOARD_ADDR {
     name "Microsoft Wireless Keyboard";
     auth enable;
     encrypt enable;
 }
 
 device MOUSE_ADDR {
     name "Microsoft Mouse";
 }
Now you need to restart the bluetooth subsystem so that it refreshes it's configuration file.

Code:
 user@computer:~$ sudo /etc/init.d/bluez-utils restart
  * Restarting Bluetooth services... [ ok ]
Pairing the Devices

You now need to pair the devices with the computer. Do not press any buttons on the keyboard as we'll need to use it to enter a passcode so we can pair. Run the following command:

Code:
 user@computer:~$ sudo hidd --search
 Searching ...
         Connecting to device MOUSE_ADDR
         Connecting to device KEYBOARD_ADDR
 user@computer:~$
They could pair with the computer in any order, you will need to remember which one is the keyboard. As soon as Connecting to device KEYBOARD_ADDR appears you must enter a PIN code into the keyboard. It must consist of numbers not using the numpad, I can't remember how many you can use, but somewhere between 4 and 8 should be fine. Type this number in to the keyboard and press Return.

A window should pop up on your computer asking you for the number you just entered on the keyboard.

You should now be set up. The devices should automatically reconnect when they go to sleep and when your computer boots up.

Troubleshooting

If you have followed all the steps above and you find your mouse or keyboard don't automatically reconnect, we can fix it! I had to do this to get mine to work. Run the following command in a terminal:

Code:
 user@computer:~$ sudo gedit /etc/default/bluez-utils
Find the lines with the following:

Code:
 HIDD_ENABLED=0
 HIDD_OPTIONS="..."
Change them to:

Code:
 HIDD_ENABLED=1
 HIDD_OPTIONS="--master --connect KEYBOARD_ADDR --connect MOUSE_ADDR --server"
Now reboot and hopefully they'll automatically connect (give them a few seconds to connect after you move the mouse/press a key).

See Also

* HOWTO: Apple Wireless Keyboard (Ubuntu Forums)
* Bluetooth mouse (Ubuntu Forums)
boneill is offline  
Old August 1st, 2006   #2
naag
First Cup of Ubuntu
 
Join Date: Apr 2006
Beans: 4
Smile Re: HOWTO: Bluetooth Keyboard and Mouse

This is a nice summary of the other threads. Most people should get those bluetooth devices working now
naag is offline  
Old August 2nd, 2006   #3
laughterwym
First Cup of Ubuntu
 
Join Date: Jul 2006
Beans: 1
Smile Re: HOWTO: Bluetooth Keyboard and Mouse

i have my lovely mouse go now. thankx
laughterwym is offline  
Old August 5th, 2006   #4
lenticular
Just Give Me the Beans!
 
Join Date: Jul 2005
Beans: 48
Re: HOWTO: Bluetooth Keyboard and Mouse

Thanks,is a big help. I've got my Logitech BT Dinovo up and running.
lenticular is offline  
Old August 9th, 2006   #5
x64Jimbo
Fresh Brewed Ubuntu
 
x64Jimbo's Avatar
 
Join Date: Jun 2006
My beans are hidden!
Ubuntu 7.10 Gutsy Gibbon
Send a message via AIM to x64Jimbo
Re: HOWTO: Bluetooth Keyboard and Mouse

Whenever I try to get my keyboard to connect after following your instructions, all I get is an LMP Timeout error. What am I doing wrong?
__________________
Upgrade to 7.10 today!
Automatix: Automated, graphical installer for almost everything you need. Samba share problems? Fix them! Need to delete unwanted wireless networks? Check this out!
x64Jimbo is offline  
Old December 2nd, 2006   #6
AusIV4
Quad Shot of Ubuntu
 
Join Date: Jan 2006
Location: Tulsa, OK
Beans: 482
Ubuntu 8.04 Hardy Heron
Re: HOWTO: Bluetooth Keyboard and Mouse

I realize this thread is a bit old, but I've followed the instructions and I'm having problems.

I switched my laptop from Windows to Ubuntu today, and my mouse is the biggest problem I'm having (so far). I'm running Dapper for the LTS, if there have been any changes in edgy.

Here's the thing: when I turn my mouse on and back off, it takes a long time for my mouse to reconnect. It seems as though my mouse has to go to sleep (I believe 15 seconds of inactivity) then be moved, and it will reconnect. It could certainly be worse, but I try to do everything I can to extend the battery life of my mice, and I don't particularly want to have to wait 15 seconds every time I need to turn my mouse back on.

If there's no good solution, maybe I'll just invest in a battery recharger and some rechargeable batteries, so I don't have to worry about it.
AusIV4 is offline  
Old January 15th, 2007   #7
optimarcus_prime
Just Give Me the Beans!
 
optimarcus_prime's Avatar
 
Join Date: Nov 2006
Location: New London, CT / Framingh
Beans: 53
Ubuntu 8.10 Intrepid Ibex
Send a message via AIM to optimarcus_prime
Re: HOWTO: Bluetooth Keyboard and Mouse

Thank you for this guide, it has worked beautifully. However, I am still having an issue.

I can pair my mouse [Targus laser Bluetooth rechargable mouse], and it works properly, but I am still having the issue that you had where you can't get the mouse to reconnect after the computer/mouse sleeps. I've tried using your method of editing /etc/default/bluez-utils, but my problem is that I can't find this file anywhere. When I run this command, ubuntu attempts to create a new file, which I don't want. Can someone help me with this issue? I've installed and reinstalled bluez-utils several times, and still the file is non-existant.
optimarcus_prime is offline  
Old January 24th, 2007   #8
optimarcus_prime
Just Give Me the Beans!
 
optimarcus_prime's Avatar
 
Join Date: Nov 2006
Location: New London, CT / Framingh
Beans: 53
Ubuntu 8.10 Intrepid Ibex
Send a message via AIM to optimarcus_prime
Re: HOWTO: Bluetooth Keyboard and Mouse

i've got my mouse working on a manual connect, but I still can't get it to work automatically. This is my /etc/init.d/bluetooth file:
Code:
#! /bin/bash
### BEGIN INIT INFO
# Provides: bluetooth
# Required-Start:    $local_fs $syslog $remote_fs
# Required-Stop:     $local_fs $syslog $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start bluetooth daemons
### END INIT INFO
#
# bluez-utils    Bluetooth subsystem starting and stopping
#
# originally from bluez's scripts/bluetooth.init
#
# Edd Dumbill <ejad@debian.org>
# LSB 3.0 compilance and enhancements  by Filippo Giunchedi <filippo@debian.org>
#
# startup control over dund and pand can be changed by editing
# /etc/default/bluez-utils

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DESC="Bluetooth services"

HCID=/usr/sbin/hcid
HCIATTACH=/usr/sbin/hciattach
HCID_NAME=hcid
HCID_OPTIONS=-x

HID2HCI=/usr/sbin/hid2hci

UART_CONF=/etc/bluetooth/uart

RFCOMM=/usr/bin/rfcomm
RFCOMM_NAME=rfcomm
RFCOMM_CONF=/etc/bluetooth/rfcomm.conf

SDPD=/usr/sbin/sdpd
SDPD_NAME=sdpd

SDPTOOL=/usr/bin/sdptool

DUND_DAEMON=/usr/bin/dund
DUND_NAME=dund
PAND_DAEMON=/usr/bin/pand
PAND_NAME=pand
HIDD_DAEMON=/usr/bin/hidd
HIDD_NAME=hidd

DUND_ENABLED=0
PAND_ENABLED=0
#HIDD_ENABLED=0
HIDD_ENABLED=1
DUND_OPTIONS=""
PAND_OPTIONS=""
#HIDD_OPTIONS="--master --server"
HIDD_OPTIONS="--master --connect 00:12:A1:60:2D:9D --server"

test -f /etc/default/bluetooth && . /etc/default/bluetooth
test -f /etc/default/rcS && . /etc/default/rcS

. /lib/lsb/init-functions

# test for essential daemons
test -x $HCID || exit 0
test -x $HCIATTACH || exit 0
test -x $RFCOMM || exit 0
test -x $SDPD || exit 0

# disable nonessential daemons if not present
if test "$DUND_ENABLED" != "0"; then
	if ! test -f $DUND_DAEMON; then
		DUND_ENABLED=0
	fi
fi

if test "$PAND_ENABLED" != "0"; then
	if ! test -f $PAND_DAEMON; then
		PAND_ENABLED=0
	fi
fi

if test "$HIDD_ENABLED" != "0"; then
	if ! test -f $HIDD_DAEMON; then
		HIDD_ENABLED=0
	fi
fi

set -e

run_sdptool()
{
	test -x $SDPTOOL || return 1 

	if ! test -z "$SDPTOOL_OPTIONS" ; then
		oldifs="$IFS"
		IFS=";"
		for o in $SDPTOOL_OPTIONS ; do
			#echo "execing $SDPTOOL $o"
			IFS=" "
			$SDPTOOL $o &>/dev/null
		done
		IFS="$oldifs"
	fi

}

enable_hci_input()
{
       if [ "$VERBOSE" != no ]; then
               log_success_msg "Switching on Bluetooth input devices..."
               $HID2HCI --tohci
       else
               $HID2HCI --tohci >/dev/null 2>&1
       fi
}

disable_hci_input()
{
       if [ "$VERBOSE" != no ]; then
               log_success_msg "Switching Bluetooth input devices back to HID mode..."
               $HID2HCI --tohid
       else
               $HID2HCI --tohid >/dev/null 2>&1
       fi
}

start_pan()
{
	if test "$DUND_ENABLED" != "0"; then
		start-stop-daemon --start --quiet --exec $DUND_DAEMON -- $DUND_OPTIONS
		[ "$VERBOSE" != no ] && log_success_msg "Starting $DUND_NAME..."

	fi
	if test "$PAND_ENABLED" != "0"; then
		start-stop-daemon --start --quiet --exec $PAND_DAEMON -- $PAND_OPTIONS
		[ "$VERBOSE" != no ] && log_success_msg "Starting $PAND_NAME..."
	fi
}


stop_pan()
{
	if test "$DUND_ENABLED" != "0"; then
		start-stop-daemon --stop --quiet --exec $DUND_DAEMON || true
		[ "$VERBOSE" != no ] && log_success_msg "Stopping $DUND_NAME..."
	fi
	if test "$PAND_ENABLED" != "0"; then
		start-stop-daemon --stop --quiet --exec $PAND_DAEMON || true
		[ "$VERBOSE" != no ] && log_success_msg "Stopping $PAND_NAME..."
	fi
}

start_hid()
{
	if test "$HIDD_ENABLED" != "0"; then
		start-stop-daemon --start --quiet --exec $HIDD_DAEMON -- $HIDD_OPTIONS
		[ "$VERBOSE" != no ] && log_success_msg "Starting $HIDD_NAME..."
	fi
}

stop_hid()
{
	if test "$HIDD_ENABLED" != "0"; then
		$HIDD_DAEMON --killall
		start-stop-daemon --stop --quiet --exec $HIDD_DAEMON || true
		[ "$VERBOSE" != no ] && log_success_msg "Stopping $HIDD_NAME..."
	fi
}

start_uarts()
{
	[ -f $HCIATTACH ] && [ -f $UART_CONF ] || return
	grep -v '^#' $UART_CONF | while read i; do
               if [ "$VERBOSE" != no ]; then
                       $HCIATTACH $i
               else
                       $HCIATTACH $i >/dev/null 2>&1
               fi
	done
}

stop_uarts()
{
	killall hciattach > /dev/null 2>&1 || true
}

start_rfcomm()
{
	if [ -x $RFCOMM ] && [ -f $RFCOMM_CONF ] ; then
		# rfcomm must always succeed for now: users
		# may not yet have an rfcomm-enabled kernel
                if [ "$VERBOSE" != no ]; then
                       log_success_msg "Starting $RFCOMM_NAME..."
                       $RFCOMM -f $RFCOMM_CONF bind all || true
                else
                       $RFCOMM -f $RFCOMM_CONF bind all >/dev/null 2>&1 || true
                fi
	fi
}

stop_rfcomm()
{
	if [ -x $RFCOMM ] ; then
               if [ "$VERBOSE" != no ]; then
                       log_success_msg "Stopping $RFCOMM_NAME..."
                       $RFCOMM unbind all || true
               else
                       $RFCOMM unbind all >/dev/null 2>&1 || true
               fi
	fi
}

restart_rfcomm()
{
	if [ -x $RFCOMM ] && [ -f $RFCOMM_CONF ] ; then
               if [ "$VERBOSE" != no ]; then
                       log_success_msg  "Restarting $RFCOMM_NAME..."
                       $RFCOMM unbind all || true
                       $RFCOMM -f $RFCOMM_CONF bind all || true
               else
                       $RFCOMM unbind all >/dev/null 2>&1|| true
                       $RFCOMM -f $RFCOMM_CONF bind all >/dev/null 2>&1 || true
               fi
	fi
}

case "$1" in
  start)
	log_daemon_msg "Starting $DESC"
	
	if test "$BLUETOOTH_ENABLED" == "0"; then
		log_progress_msg "disabled. see /etc/default/bluetooth"
		log_end_msg 0
		exit 0
	fi

	start-stop-daemon --start --quiet --exec $HCID -- $HCID_OPTIONS || true
	log_progress_msg "hcid"
	start_uarts || true
	
	start-stop-daemon --start --quiet --exec $SDPD || true
	log_progress_msg "sdpd"
    
	run_sdptool || true
	log_progress_msg "sdp_options"

	start_hid || true
	enable_hci_input || true
	start_rfcomm || true
	start_pan || true
	log_end_msg 0
    ;;
  stop)
	log_daemon_msg "Stopping $DESC"
	stop_pan || true
	stop_rfcomm || true
	disable_hci_input || true
	stop_hid || true
	start-stop-daemon --stop --quiet --exec $SDPD || true
	log_progress_msg "$SDPD_NAME"
	start-stop-daemon --stop --quiet --exec $HCID || true
	log_progress_msg "$HCID_NAME"
	stop_uarts || true
	log_end_msg 0
    ;;
  restart|force-reload)
	log_daemon_msg "Restarting $DESC"
	stop_hid || true
	stop_pan || true
	start-stop-daemon --stop --quiet --exec $SDPD || true
	start-stop-daemon --stop --quiet --exec $HCID || true
	sleep 1
	if test "$BLUETOOTH_ENABLED" == "0"; then
		log_progress_msg "disabled. see /etc/default/bluetooth"
		log_end_msg 0
		exit 0
	fi
	start-stop-daemon --start --quiet --exec $HCID -- $HCID_OPTIONS || true
	start-stop-daemon --start --quiet --exec $SDPD || true
	log_progress_msg "$HCID_NAME"
	log_progress_msg "$SDPD_NAME"
	start_pan || true
	start_hid || true
	restart_rfcomm
	log_end_msg 0
    ;;
  *)
	N=/etc/init.d/bluetooth
	# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
	echo "Usage: $N {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0

# vim:noet
any suggestions?
optimarcus_prime is offline  
Old January 25th, 2007   #9
optimarcus_prime
Just Give Me the Beans!
 
optimarcus_prime's Avatar
 
Join Date: Nov 2006
Location: New London, CT / Framingh
Beans: 53
Ubuntu 8.10 Intrepid Ibex
Send a message via AIM to optimarcus_prime
Re: HOWTO: Bluetooth Keyboard and Mouse

Ah, nevermind. I got it to work. Thanks for the great howto.
optimarcus_prime is offline  
Old February 1st, 2007   #10
x64Jimbo
Fresh Brewed Ubuntu
 
x64Jimbo's Avatar
 
Join Date: Jun 2006
My beans are hidden!
Ubuntu 7.10 Gutsy Gibbon
Send a message via AIM to x64Jimbo
Re: HOWTO: Bluetooth Keyboard and Mouse

Ok so I recently upgraded to the Elite (Bluetooth 2.0) and I am impressed with the feel of the keyboard and mouse. However. I am getting some very strange behavior from the mouse. The pointer is very inaccurate on the screen. When going very slowly over the surface of my desk or any other surface, the pointer bounces around and doesn't maintain a straight line. These are the very same surfaces that have been working fine with two other Intellimouse models, including one from the first generation MS Bluetooth combo set. Is there something different about the Elite mouse's optical eye that I should know about? I love how it feels, but it's nearly unusable this way.

Edit: The twitchiness/jumpiness of the cursor only exists when there is an active window manager. (Kwin and Beryl both exhibit the problem) When only KDM is loaded, the mouse is precise and smooth. I tried playing around with the Option Resolution "#" in xorg.conf, but that hasn't seemed to change anything. What's different about how a mouse is read as an input between the time when I'm logging in with the KDM greeter and the time I reach my desktop?

As a side note, I would like to get the bonus buttons on the keyboard and mouse working... Especially the back/forward buttons. Any ideas about how to do that?
__________________
Upgrade to 7.10 today!
Automatix: Automated, graphical installer for almost everything you need. Samba share problems? Fix them! Need to delete unwanted wireless networks? Check this out!

Last edited by x64Jimbo; February 2nd, 2007 at 02:34 AM..
x64Jimbo is offline  
 

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:13 AM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. bilberry