Author Topic: Thinkoutside Bluetooth Keyboard Working With 3100  (Read 7915 times)

icruise

  • Sr. Member
  • ****
  • Posts: 292
    • View Profile
Thinkoutside Bluetooth Keyboard Working With 3100
« on: September 21, 2005, 10:20:02 pm »
I had asked a while ago about using a bluetooth keyboard and mouse on the Zaurus, but the response I got was a little discouraging. However, on the strength of this Japanese web site I ordered the ThinkOutside Bluetooth Keyboard from Amazon, thinking that I could always return or sell it if it turned out to be a total bust.

It wasn't too hard to get it to work (easier than I had thought anyway). All together it probably took about an hour to figure everything out (not including fine-tuning). I ended up using a combination of the Bluez_zaurus package and some of the packages on the website above. I can give details if anyone is interested. I don't have time right this moment. The most important thing is to install the bluez-hidp_mh18_arm.ipk.C1000 package that will correct the keymapping. I didn't try it, but I imagine that without this package, the keyboard would just input garbage like guylhem mentioned in the first thread I posted about this.

Once you install the proper software and determine the MAC address of the keyboard, it's just a matter of pressing ctrl + left Fn + right Fn on the keyboard and running:

Code: [Select]
# hidd --connect XX:XX:XX:XX:XX:XX
to connect (the Xs are the address of the keyboard, obviously). I have made a script that does this and linked it to a key combination with Keyhelper, so I just need to press Address + K to connect to the keyboard.

The guy on the Japanese web site said that he was able to get the keyboard to connect just by opening it, but because my install procedure was a bit different than his, the contents of my /etc/rc.d/init.d/bluetooth file don't match his, and I couldn't figure out how to do it. Still, it's not that big of a deal to press a couple of buttons.

The ThinkOutside keyboard is quite nice, and is definitely a better solution than a USB keyboard (smaller, no cables). Plus, I can use the bluetooth keyboard and be connected to the Internet via my bluetooth cellphone at the same time. I've even figured out which key combinations on the keyboard correspond to the shortcut keys on the Z (like "Mail" and "Home") so I can launch programs and so forth right from the keyboard. I think I may try using a bluetooth mouse next.
« Last Edit: September 21, 2005, 10:22:34 pm by icruise »

polito

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
    • http://thether.com
Thinkoutside Bluetooth Keyboard Working With 3100
« Reply #1 on: September 25, 2005, 03:38:06 am »
I was wondering if you might be able to tell me which bluez-zaurus package you used? And as far as tweaking went, did you have to make any changes to the startup scripts or the suspend/resume scripts?

Oh and I found that you can easily use:

Code: [Select]
# hidd --searchand hidd will hook up to whatever keyboard it can find... hmm... which I suppose might be bad if you had another bluetooth keyboard somewhere

icruise

  • Sr. Member
  • ****
  • Posts: 292
    • View Profile
Thinkoutside Bluetooth Keyboard Working With 3100
« Reply #2 on: September 25, 2005, 04:50:14 am »
I'm using the 2.3-2.4.18d-preempt package.

In order to get everything to work properly, I had to install the bluez-libs_2.21_arm.ipk and bluez-utils_2.21_arm.ipk packages first and then install the bluez-zaurus package afterward. If I installed bluez first, some things didn't work (I don't recall precisely what).

I didn't have to do any tweaking of the suspend resume scripts especially for this, but back when I was still struggling to get my rev H Socket card to work after suspending, I did have to edit the susp-resume script as shown in this post.

guylhem

  • Hero Member
  • *****
  • Posts: 577
    • View Profile
Thinkoutside Bluetooth Keyboard Working With 3100
« Reply #3 on: September 25, 2005, 04:48:23 pm »
Got the same keyboard working fine on my simpad... after I changed the kernel keyb input and hidp input tables so that every key now has its dedicated keycode.

The only problem is with opie who can't use the keyboard after a suspend cycle, while it's still working in console. I guess it has to do with the way opie open /dev/input/input1 and doesn't try to reopen it.

polito

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
    • http://thether.com
Thinkoutside Bluetooth Keyboard Working With 3100
« Reply #4 on: September 25, 2005, 07:28:47 pm »
Hey I got the keyboard to automatically connect with the Z  These instructions should also enable your mouse to work if you execute the same commands with it's bluetooth address.  

You want to ensure that in your bluetooth startup scripts somewhere you start hidd with the --server argument. It will then go into the background and listen for connections.

In the stop portion of my bluetooth script I added a bit to disconnect all the hidd connections (just in case) and then killall the hidd daemon like so:
Code: [Select]
hidd --killall
killall hidd
Please note that using --killall with hidd is likely to cut out your bluetooth mouse if you have that configured. Of course the commands above go in your bluetooth start/stop script (/etc/rc.d/init.d/bluetooth or perhaps /etc/pcmcia/bluetooth if you're using Cacko [I think, just saw that on another post by maslovsky]) and not the suspend/resume script that Tumnus made which is located in /etc/apm.d/bluetooth and so if you're stopping bluetooth it shouldn't really matter that your mouse cuts out.

Basically you want to make sure that you do a:
Code: [Select]
# hidd --connect AB:CD:EF:12:34:56first or you could do a '--search' and let it find the keyboard/mouse but if you already know the bluetooth address from a previous,
Code: [Select]
# hcitool scanthen you might as well just do --connect <BD Address> so you can test your keyboard or mouse first and then do the other. I don't know whether doing the --search will connect other devices at the same time or not, ymmv.

After the --connect (and hitting the CTRL + Blue FN + Green FN, or connect button on a mouse) you should be able to start using the keyboard. If it starts to work you're almost there. Just go ahead and CLOSE the keyboard WITHOUT telling hidd anything about unplugging it or disconnecting.

I waited about 20 seconds or long enough so that a,
Code: [Select]
# hidd --showreturned nothing. Normally it'll show your connections to input devices. You want to wait until your keyboard disappears before you open it again.

If you open now open the keyboard and tap a key you'll find the LED starts to blink indicating it's trying to reach out to someone. AND most importantly you should see that the Z starts to show characters typed in

Of course if it's a bluetooth mouse you'll probably just have to either make sure it's on or wiggle it around. Whatever it takes to wake it up and seeing as I don't own one [yet] I can't say for sure. You'd want to make sure you have the mouse package which you can find from Meanie's site over at:

http://www.users.on.net/~hluc/myZaurus/

You'll find it if you search for 'enable mouse'.

Did these instructions work for anybody else? One thing I like is that I was able to use the keyboard and internet over bluetooth at the same time with no problems.   I tried to include everything I could think of really, let's hope I didn't forget anything

icruise

  • Sr. Member
  • ****
  • Posts: 292
    • View Profile
Thinkoutside Bluetooth Keyboard Working With 3100
« Reply #5 on: September 28, 2005, 09:57:19 am »
Quote
You want to ensure that in your bluetooth startup scripts somewhere you start hidd with the --server argument. It will then go into the background and listen for connections.

Can you post the contents of your startup script? I haven't quite figured out how to do this.

icruise

  • Sr. Member
  • ****
  • Posts: 292
    • View Profile
Thinkoutside Bluetooth Keyboard Working With 3100
« Reply #6 on: September 28, 2005, 08:49:20 pm »
My bluetooth mouse arrived today, and It was easy to get it working in tandem with my keyboard (and while surfing the net via bluetooth through my PowerBook as well). However, it seems to turn off after a couple of minutes whether I'm using the mouse or not. The mouse is the macally BTmicro that I linked to in the first thread I made about this (linked above). I need to do something about this. THe problem makes the mouse pretty much unusuable if I have to push the "pairing" button and rediscover it every few minutes. Any ideas about this?

edit: I guess I spoke too soon about the mouse cutting out. It seems to be working OK now, but it does turn off if I don't use it for a couple of minutes. You're supposed to be able to wake it up by pressing the mouse buttons, but the only way to get it to work again is to press the "Pairing" button. I wonder if setting up the Zaurus as you indicated above would fix this problem.
« Last Edit: September 28, 2005, 09:40:16 pm by icruise »

icruise

  • Sr. Member
  • ****
  • Posts: 292
    • View Profile
Thinkoutside Bluetooth Keyboard Working With 3100
« Reply #7 on: September 30, 2005, 06:49:37 am »
So can someone help me out with this issue? The keyboard and mouse seem to go to sleep at quasi-random times. Never while I'm using them, but sometimes I can leave them for quite a while and come back and still use them OK, and sometimes I will take my hand off of the keyboard for about a minute or two and it won't respond anymore. If I press a key, the LED on the keyboard will blink, but it won't work again unless I press the "pairing" key combination and reconnect to it with hidd.

polito

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
    • http://thether.com
Thinkoutside Bluetooth Keyboard Working With 3100
« Reply #8 on: September 30, 2005, 09:50:55 pm »
Sorry I've been rather busy with work. You should be able to test out whether or not the keyboard/mouse will work correctly by getting them started with hidd --server.  If you've already connected them with hidd --connect.   Just killall hidd  and then start it again but using the --server argument and don't give it any bluetooth address. It should be that you can verify that your keyboard/mouse work just by typing on it the keyboard or moving the mouse around.

Sorry I can't post my config right now as I fiddled with it the other day and I have to leave in a few minutes so I can't unfiddle it and post it again.

Actually if you post your startup script I can show you where it should go. Now I better leave before I'm late    Again, very sorry for my delay in getting back to you.

icruise

  • Sr. Member
  • ****
  • Posts: 292
    • View Profile
Thinkoutside Bluetooth Keyboard Working With 3100
« Reply #9 on: October 01, 2005, 12:54:26 am »
Well, it doesn't seem to be quite that simple. I did a lot of experimenting with "hidd --server" and I did seem to get to the point where the keyboard would work after it had been turned off or went to sleep, and even after turning off both the keyboard and the Zaurus. But once I connected the keyboard, I couldn't use bluetooth for anything else. I couldn't scan for other devices, connect to my cell phone or mouse, or anything.

The contents of my script are below, with the parts I've added in red. The HIDD_ENABLE=TRUE thing doesn't seem to be necessary, but I put it in anyway.

Using this script, I can't get the keyboard to work after it has been turned off unless I enable encryption first with "hciconfig hci0 auth encrypt".

I may be way off on how this is supposed to be, but this was the only way I had any success at all.
« Last Edit: October 01, 2005, 12:55:58 am by icruise »

icruise

  • Sr. Member
  • ****
  • Posts: 292
    • View Profile
Thinkoutside Bluetooth Keyboard Working With 3100
« Reply #10 on: October 01, 2005, 12:54:51 am »

#!/bin/bash
#
# bluetooth    Bluetooth subsystem starting and stopping
#
# chkconfig: 345 25 90
# description: Bluetooth subsystem
#

# Source function library.
. /etc/rc.d/init.d/functions

# Source Bluetooth configuration.
#. /etc/sysconfig/bluetooth

prog="Bluetooth"

UART_CONF="/etc/bluetooth/uart"
HCID_ENABLE=TRUE
HIDD_ENABLE=TRUE

start_uarts()
{
   [ -f /usr/sbin/hciattach -a -f $UART_CONF ] || return
        ID=`/sbin/cardctl ident | grep info: | sed 's/^ *product info: *//' | sed 's/"/\\"/g'`
        UART_SET=`grep "$ID" $UART_CONF | cut -f2 -d":"`
        if [ "$UART_SET" != "" ]; then
      /usr/sbin/hciattach $UART_SET
   fi
}

stop_uarts()
{
   killproc hciattach > /dev/null 2>&1
}

start()
{
        echo -n $"Starting $prog... "

   modprobe rfcomm
   modprobe l2cap

        /usr/bin/make_dev.bluez.sh
       daemon /usr/bin/hidd --server
        daemon /usr/sbin/hcid

   if [ -x /usr/sbin/sdpd ]; then
      daemon /usr/sbin/sdpd
   fi
   start_uarts
        /usr/bin/rfcomm bind all
   touch /var/lock/subsys/bluetooth
        echo "Done."
}

stop()
{
        echo -n $"Shutting down $prog... "
   /usr/bin/rfcomm release all
        killproc hcid
usr/bin/hidd --killall
killall hidd


   if [ -x /usr/sbin/sdpd ]; then
      killproc sdpd
   fi

   stop_uarts
   rmmod rfcomm > /dev/null 2>&1
        rmmod l2cap > /dev/null 2>&1
        rmmod bluez > /dev/null 2>&1

        rm -f  /var/lock/subsys/bluetooth
        echo "Done."
}

[ -f /usr/sbin/hcid ] || exit 0

# See how we were called.
case "$1" in
  start)
   start
        ;;
  stop)
   stop
        ;;
  restart|reload)
   stop
   start
   ;;
  condrestart)
   [ -e /var/lock/subsys/bluetooth ] && (stop; start)
   ;;
  *)
        echo $"Usage: $0 {start|stop|restart|reload|condrestart}"
        exit 1
esac

exit 0

polito

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
    • http://thether.com
Thinkoutside Bluetooth Keyboard Working With 3100
« Reply #11 on: October 01, 2005, 02:47:19 am »
Below you'll see my changes in blue. I had to add some lines to remove the modules for bluetooth functionality.  Also you'll notice I took the daemon out from in front of the hidd executable as it automatically goes to the background when run with --server and so it isn't needed. I notice that you're not using Maikichi's script for startup. I had about the same as it seemed Maikichi's script was broken.

I had originally removed all the bluez-zaurus scripts from my system. (They had worked for the older kernel and no keyboard) Then I installed Maikichi's updated bluetooth modules. Fumbled around with that as it wasn't working quite right and then I grabbed the old bluez-zaurus start up scripts from /etc/init.d/bluetooth and /etc/pcmcia/bluetooth and /etc/bluetooth/uart and jammed them in and just added a few things to fix them. Yes the HCID_ENABLE and HIDD_ENABLE variables are from the other Maikichi scripts and so they aren't needed in this case.

Quote

start()
{
        echo -n $"Starting $prog... "

        modprobe rfcomm
        modprobe l2cap

#       /usr/bin/make_dev.bluez.sh
        /usr/bin/hidd --server

        daemon /usr/sbin/hcid

        if [ -x /usr/sbin/sdpd ]; then
              daemon /usr/sbin/sdpd
        fi
        start_uarts
        /usr/bin/rfcomm bind all
        touch /var/lock/subsys/bluetooth
        echo "Done."
}

stop()
{
        echo -n $"Shutting down $prog... "
        /usr/bin/rfcomm release all
        /usr/bin/hidd --killall
        killall hidd
        killproc hcid


        if [ -x /usr/sbin/sdpd ]; then
               killproc sdpd
        fi

        stop_uarts
        rmmod rfcomm > /dev/null 2>&1
        rmmod hidp   > /dev/null 2>&1
        rmmod l2cap > /dev/null 2>&1
        rmmod hci_uart > /dev/null 2>&1
        rmmod bluez > /dev/null 2>&1

        rm -f  /var/lock/subsys/bluetooth
        echo "Done."
}

[div align=\"right\"][a href=\"index.php?act=findpost&pid=97750\"][{POST_SNAPBACK}][/a][/div]

icruise

  • Sr. Member
  • ****
  • Posts: 292
    • View Profile
Thinkoutside Bluetooth Keyboard Working With 3100
« Reply #12 on: October 01, 2005, 09:08:18 am »
Thanks for the response. I tried using the version you gave above, but it cause me to no longer be able to connect to my Mac via bluetooth. It also didn't seem to make the keyboard work much better than before, but maybe that has something to do with my install of the bluetooth libraries and such.

It's strange. I can sometimes get the keyboard to wake up and reconnect to the Zaurus and sometimes I can't, and I don't know why. Sometimes I have to press on a key for like 30 seconds before it will reconnect and sometimes it won't reconnect at all. Sometimes when I'm trying to wait it up it gets stuck typing the same letter over and over.

Right now the best option seems to be just manually connecting each time I want to use it. At least it always works that way, although I still have the issue of it falling asleep. I've tried using hidd -t 30 --server to set the idle timeout to 30minutes, but I don't think it's working. At least not consistently.
« Last Edit: October 01, 2005, 09:10:15 am by icruise »

polito

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
    • http://thether.com
Thinkoutside Bluetooth Keyboard Working With 3100
« Reply #13 on: October 01, 2005, 09:08:52 pm »
I'm wondering if something might be wrong with the keyboard you have? Have you tried using the keyboard for extended periods with your mac? That might be one way to check it. See if it has the same quirks and if it does then you know it isn't the zaurus.

Which kernel are you running? v18a or v18b? I've got v18b on my system. Hmm... I've been frustrated over the fact that the pcmcia subsystem of the c3100 keeps treating the socket cf card as a serial only device. The bluetooth.conf file is supposed to tell the pcmcia subsystem that yes the Socket CF is accessed as a serial port but that it should have class bluetooth meaning that pcmcia should then run the bluetooth helper script after successfully setting up the serial portion.

I've put debug statements in the serial portion and the bluetooth portion inside of /etc/pcmcia to append the entire arguments list they were given to a file and have only seen the serial portion getting run. Never the bluetooth portion which of course makes me have to resume the card manually (as the serial script suspends it) and then run hciattach myself which is annoying or having to jam in extra lines into /etc/apm.d/bluetooth which really shouldn't be necessary. I've read the PCMCIA howto and it just doesn't make sense why the additional /etc/pcmcia/bluetooth script isn't running. *shrugs*

icruise

  • Sr. Member
  • ****
  • Posts: 292
    • View Profile
Thinkoutside Bluetooth Keyboard Working With 3100
« Reply #14 on: October 02, 2005, 03:08:49 am »
Quote
I'm wondering if something might be wrong with the keyboard you have? Have you tried using the keyboard for extended periods with your mac? That might be one way to check it. See if it has the same quirks and if it does then you know it isn't the zaurus.
That did occur to me. I've used the keyboard with my Mac, but not long enough to be able to tell if it's working properly. However, the bluetooth mouse works file with my Mac and won't wake up when connected to my Zaurus, so I'm betting the problem is the Zaurus. I'll try using the keyboard on the Mac a bit more.

I'm running kernel 18b. As for the problem you mention regarding resuming, did you try using the suspend /resume commands I'm using (given in the thread I linked above)? I have no problems with resuming now, which is one thing that I'm thankful for.