#!/bin/sh # ################################################################################ # # File name: /usr/local/bin/bmw # Created: February 25, 2009 # # This program is Copyright 2009 Jon LeBlanc and is free: you can redistribute it # and/or modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or (at our # option) any later version. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # For your complete copy of the GNU General Public License to go along with this # program, see www.gnu.org/licenses/gpl.txt. # ################################################################################ # # INSTRUCTIONS BEFORE RUNNING THIS SCRIPT # # Purpose: The Rocketfish Bluetooth mouse wheel does not work in GNU/Linux when # using the standard Rocketfish USB Bluetooth dongle. This script pairs the # Rocketfish Bluetooth mouse to a second non-Rocketfish USB dongle while # leaving the Rocketfish keyboard paired to the original dongle. # # ***** NOTE: The keyboard MUST ONLY be paired to the Rocketfish dongle and NOT # the second non-Rocketfish dongle or else the keyboard will become unavailable # at system bootup!!! ***** # # Directions: # # 1. Obtain a simple, inexpensive Bluetooth USB dongle (mine is a Syba) # # 2. Plug in *only* just the Rocketfish USB Bluetooth dongle # # 3. On the bottom of the Rocketfish mouse slide its power switch to "OFF" # # 4. Press the "Connect" button on the bottom of the keyboard (the keyboard's # Bluetooth connection lights will flash indefinitely) # # 5. On the Rocketfish USB Bluetooth dongle hold down the "pairing" button # for three seconds (the dongle's light will quickly flash and then the # keyboard will pair with it after a few seconds and stop flashing) # # 6. Use visudo to give users permission to run hciconfig and hdid like this: # %users ALL= NOPASSWD: /usr/sbin/hciconfig # %users ALL= NOPASSWD: /usr/bin/hidd # # 7. Run the command "sudo /usr/sbin/hciconfig -a 2>/dev/null" and make note # of the device name of the Rocketfish USB Bluetooth dongle (mine is hci1) # # 8. If your Rocketfish USB Bluetooth dongle is hci0 then remove it from its # USB port and plug it into another USB port, then run Step #7 again # because we need it to ***NOT*** be hci0 # # 9. Insert the second Bluetooth USB dongle into a USB port and do step 7 # again until you find the USB port that allows it to be called hci0 # # 10. Make this script executable with this command: # "sudo chmod 755 /usr/local/bin/bmw" # # 11. Set the mouse's power switch to ON # # 12. Run the command "sudo /usr/local/bin/bmw" from the command line or see # the comments in the script body on how to make it GUI friendly for KDE, # Gnome, or X Windows (you can make an icon and link it to this script) # ################################################################################ # # PROGRAM BEGINS HERE # # Stop the non-Rocketfish dongle in order to clear any existing connections on # it, then make sure both USB Bluetooth dongles are up and running (edit these # 3 lines to add the two dongles found after running Step 7 above). We never # want to stop the Rocketfish dongle or we'll lose the keyboard! # sudo /usr/sbin/hciconfig hci0 down sudo /usr/sbin/hciconfig hci0 up sudo /usr/sbin/hciconfig hci1 up ################################################################################ # # User Interface Options here (uncomment to suit your own preferences - I've # defaulted this to Gnome for typical Ubuntu users) # # uncomment for simple Command Line text message: clear echo " " echo "Set the power switch on the bottom of the mouse to "ON" now." sleep 2 echo " " echo "Press the Connect button on the bottom of the mouse now and" echo "hold it down for 3 seconds and release when the light on the" echo "top of the mouse turns from green to red." echo " " # OR # uncomment for Zenity (Gnome) message box: #/usr/bin/zenity --info --text="Press the Connect button on the bottom of the mouse for 3 seconds, then press the keyboard's Enter key." # OR # uncomment for KDE message box: # /usr/bin/kdialog --msgbox "Press the Connect button on the bottom of the mouse for 3 seconds, then press the keyboard's Enter key." # OR # uncomment for X Windows message box: # /usr/bin/Xdialog --msgbox "Press the Connect button on the bottom of the mouse for 3 seconds, then press the keyboard's Enter key." 0 0 # OR # uncomment for curses-based Command Line message box: # /usr/bin/dialog --msgbox "Press the Connect button on the bottom of the mouse for 3 seconds, then press the keyboard's Enter key." 0 0 ################################################################################ # # Sleep for 3 seconds to allow Bluetooth dongles to be fully activated, then start # Bluetooth device search, which will pair Rocketfish Bluetooth Mouse to second # non-Rocketfish USB Bluetooth dongle sleep 3 sudo /usr/bin/hidd --search sleep 1 echo " " sudo /usr/bin/hidd --show echo " " ################################################################################ # # PROGRAM ENDS # # If all has gone well, the Rocketfish Bluetooth Mouse's wheel now works. # # If the batteries in the mouse are getting low the Bluetooth search may time # out so you may have to run this script a couple of times. For extra battery # life always remember to switch the mouse's power switch off when not using it. # ################################################################################