Showing posts with label hardware. Show all posts
Showing posts with label hardware. Show all posts

Tuesday, 5 June 2007

Wiimote under FreeBSD using bsdmoted

I have recently acquired a Wii and the Wiimote is an interesting creation indeed. Some attempts to reverse engineer it has been made and I found that FreeBSD has a driver. Sadly though, it lacks good documentation so I thought that I would walk through what I made in order to make it work.

First of all, we need to enable Bluetooth device support by loading the ng_ubt Bluetooth module into the kernel.

If you want it to load upon boot add the following line to /etc/loader.conf

/etc/loader.conf
ng_ubt_load="YES"

And load the module immediately in order to detect any Bluetooth devices. Afterwards check dmesg in order to check if any device was detected. In my case I had to remove the BT USB stick and then insert it again for it to work properly. Somehow it seems that the O/S won't detect it properly if ng_ubg wasn't loaded when the device was first detected.

# kldload ng_ubt

Then we need to make config for the Bluetooth daemon, the default conf will do just fine.

# cp /usr/share/examples/netgraph/bluetooth/rc.bluetooth /etc/rc.bluetooth
# chmod +x /etc/rc.bluetooth
# /etc/rc.bluetooth start ubt0

Now we are on to starting the bthid daemon. First let's use the default conf. If you are unable to start bthid due to some load command (yes, I admit that I have forgot which command it was AND lost the link to the solution). Then you need to upgrade to the latest STABLE RELENG_6, where the problem has been solved.

# cp /usr/src/usr.sbin/bluetooth/bthidd/bthidd.conf.sample /etc/bluetooth/bthidd.conf
# /etc/rc.d/bthid start

Now on to getting your Wiimote's BD_ADDR. You will probably have a bundle of BT devices nearby if you live in an apartment. I detected "Willy's mobile" for example. Press 1 and 2 simultaneously on the Wiimote and it will enter a detectable mode. Then execute a following command and note down all BD_ADDR of the devices that responds.

# hccontrol -n ubt0hci inquiry
[a list of devices]

When you request the name of the device (the Wiimote should still be blinking on happily in 1 + 2 detectable mode) it should respond accordingly. It will of course use another BD_ADDR.

# hccontrol -n ubt0hci remote_name_request 12:34:56:78:9A:BC
BD_ADDR: 12:34:56:78:9A:BC
Name: Nintendo RVL-CNT-01

Now you need to fetch the bsdmoted source. Get the latest version from. http://sourceforge.net/projects/bsdmoted/
Extract it somewhere and cd into the directory. Then clean, compile, install clean.

# make clean
# make
# make install
# make clean

You now need to configure bsdmoted with some info from the Wiimote. Execute the following command to do this.

# bthidcontrol -a 12:34:56:78:9A:BC query >> /usr/local/etc/bsdmoted.conf


Now you only need to start the bsdmoted daemon.

# bsdmoted

The binds are the following:
A is the left mouse button.
B is the right mouse button.
+ and - are used to calibrate the sensitivity .
Use 1 and 2 to switch between IR-mode and tilting mode.

I did not get the IR-mode working, but perhaps you do. Enjoy!

Recommended reading:
The FreeBSD handbook on Bluetooth.

bsdmoted links:
The bsdmoted Sourceforge page.
Chuan-Heng Hsiao's bsdmoted page (videos showing that it actually works).

Friday, 27 April 2007

More computer woes and spring

Two days ago my workstation died, I won't even get a signal upon boot. If only I had the time to look into it, but exams and all. I simply have to use my laptop for now.

I am planning on starting my own company, in order to make it easier for my clients (currently only one) to pay me for the work I do for them. Now, I only need a good name. I will also get paid for some work and I do think that I will get through the summer, work is scarce when you lack business contacts and don't like doing web pages.

It's spring in Sweden and when walking across campus I have noted that we have some lovely trees blooming. I promised myself to take photos a week ago and now I finally took myself a 30 minute break and did it. I like the outcome, the flowers sure are pretty.

The tree is right outside my dormitory (on campus) and the weather was just right. Clear blue sky and a warming sun.




Tuesday, 10 April 2007

HDD issues

During the last three weeks I have had several HDD;s failing. What it might be that makes HDD;s cause DMA errors, I do not know. R/W on specific sectors on one of my workstation disks caused a core dump. The same thing happened to my old reliable Pentium 3 last Wednesday. I have lost some minor data, but recovering it is tedious. And now a pretty old 8.1Gb drive in another computer has begun to cause DMA errors. Nothing serious yet but taking last weeks errors into account I am worried. I am running dangerously low on HDD;s and I have promised to set up a CVS server for a bunch of students. *sigh* I might have to purchase a new one, less food, more hardware.

And this is what happens to HDD;s that don't behave...

Friday, 6 April 2007

Highpoint RocketRaid 2210 under FreeBSD 6.2-RELEASE

Today I have fiddled with raid, it has been a pleasant ride. Highpoint has supplied good documentation and most problems has been related to my old hardware. When you get hardware for free, there is bound to be trouble. Only one minor flaw from Highpoint's side, you have to change the configuration file for the raid management tools in order for it to even detect the raid controller. This is mentioned once in the FreeBSD specific installation guide for the driver but not in the CLI-tool guide. The configuration file should look like this.

/etc/hptcfg
rr2210
hptmv.status

rr2210 should be replaced with your driver name. I named my driver rr2210.ko as you can see. After doing this, simply start or restart the daemon using.

/usr/local/etc/rc.d/hptdaemon.sh

And you should now detect your controller.

One last thing, why did Highpoint comment out

echo "The daemon is running. Please stop it first."

In the rc-script? I enabled it again anyhow, things like that can lead to headaches just being given exit 1.

Now, back to using that lovely raid card.

Friday, 29 December 2006

Gateway mayhem

At approximately 3:30 AM when I decided to reboot my gateway for some testing the HDD decided to go evil on me. For unknown reasons reading from the HDD would cause the whole system to get stuck in a ide-not-ready loop >.<> /etc/fstab.new

I'll be damned ;P I saved myself from using ed. Now I just might need to get a new HDD *sigh*, but at least I have my net back up.