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).
Tuesday, 5 June 2007
Going home... well... sort of
Returning to where you grew up brings you a certain feeling. A feeling of things that have been lost forever. You feel old, happy and sad. And for some reason, you want to return home, to where you currently live. Meeting friends and family is nice, but it stirs up a lot of emotions. It's exhausting.
I had the chance to take a lot of photos, wandering around Örebro and Lindesberg. Here are some of them. I will process a few panorama photos that needs to be stitched in the days to come (or tonight if I'll take a cup of tea in order to stay awake).
Let's begin with some flowers.





Then some flowers and bees.


Then some animals.
A "Skäggdopping" or Great crested grebe in English.
I am not sure which bird this was, I guess I should ask my mother to remind me on what was told about it.
A "Gräsand" or a Mallard I believe it's called in English.
In my hometown Lindesberg this relic has been left standing near the railway station. It's a pump for filling up the water tank of steam engines.
It seems that the railway company has taken actions against birds deciding to rest too close to the electric lines.

In Örebro I found this old sign on a door to a house from the early 20th century. Roughly translated into English it reads "Begging and the sale of merchandise within this property is strictly forbidden".
I had the chance to take a lot of photos, wandering around Örebro and Lindesberg. Here are some of them. I will process a few panorama photos that needs to be stitched in the days to come (or tonight if I'll take a cup of tea in order to stay awake).
Let's begin with some flowers.





Then some flowers and bees.


Then some animals.
A "Skäggdopping" or Great crested grebe in English.
I am not sure which bird this was, I guess I should ask my mother to remind me on what was told about it.
A "Gräsand" or a Mallard I believe it's called in English.
In my hometown Lindesberg this relic has been left standing near the railway station. It's a pump for filling up the water tank of steam engines.
It seems that the railway company has taken actions against birds deciding to rest too close to the electric lines.
In Örebro I found this old sign on a door to a house from the early 20th century. Roughly translated into English it reads "Begging and the sale of merchandise within this property is strictly forbidden".
Saturday, 2 June 2007
In health... and a panorama
Today I felt better, I managed to get some work done and ship a patch to a customer. I also remembered that cjg and I tried to make a 360 degree panorama photo from the KTH clock tower last summer. Eager to try it myself this time with my rather new camera I set off to the tower. It was closed, so I wandered around campus for roughly 2h and the sun was setting. Finally when I walked through one of the computer halls I found a view. The result can be seen below, it's a rather huge picture so I recommend opening it in a separate window. The only editing done, apart from making it a panorama from several smaller pictures, is removing some flaws made by my camera.
(singe Google don't want to host the whole image, here is a link to the real thing)
What you see is, starting from the lower left corner is the Engelbrekt church, the flag of the KTH student union beneath the flag is the one of KTH;s administrative buildings, the tall distant building is "Nyponet" a 21 story building with student apartments, next with a rather tall chimney is what I believe to be an on-campus heating plant and finally the tower of the KTH library (KTHB).
A tutorial on how to make panorama pictures.
(singe Google don't want to host the whole image, here is a link to the real thing)What you see is, starting from the lower left corner is the Engelbrekt church, the flag of the KTH student union beneath the flag is the one of KTH;s administrative buildings, the tall distant building is "Nyponet" a 21 story building with student apartments, next with a rather tall chimney is what I believe to be an on-campus heating plant and finally the tower of the KTH library (KTHB).
A tutorial on how to make panorama pictures.
Thursday, 31 May 2007
In sickness... and strawberries
Last Monday I wrote my final exam for this semester. As it usually happens, I got sick the same day. I have caught a rather bad cold and has been more or less down and out since then.
Yesterday I bought some Swedish strawberries to cheer me up (and get some vitamins, minerals and all other things I know are good for me). They were not cheap. For those of you who doesn't know, strawberries is the most exotic thing that grows in Sweden. Most fruits are imported and thus not tasting as good as they would in more southern countries. So, strawberries is a special thing for many of us Swedes. I serve them in a bowl, with milk, some cream and sugar. For a moment it actually felt like summer, but the weather says otherwise. I also took some photos, since I think strawberries are rather beautiful.



This summer I will study three courses in physics. I trust most of them to be very interesting, but I will provide further comments on this as the courses begin next week.
Lastly, in the news. DN writes about the right-wing Swedish government looking over routines for state television and radio. In Sweden we have two television channels run by the state and four radio channels. They mostly provide music and programs which they commercial channels are not interested in. Debates, classical music and so on. They also has to provide it for a large majority of the Swedish citizens. Where I used to live we didn't have any commercial radio channels since the population was only about 10'000, lately one or two commercial channels have become available (and only playing horrible popular music anyway). To finance all this, the state claims ~4 SEK a day from everyone who owns a television. We even have people employed to check in on you if you are paying. Sadly, our government seems to like this solution. I think it's an old (and bad) idea, that was a good idea back in the middle of the 20th century. Back then some people didn't own a TV and would probably not like paying for channels they couldn't watch. Now, things are different. Most people own a television and it takes money to check whether or not someone owns a television and to administrate it all. Why not let it be a part of the tax instead? Thus making the system more efficient and making it impossible to avoid paying for your TV. The increase in tax will be unnoticeable and people will not complain about such a marginal increase. I just can't stand bad solutions to simple problems...
Link to the article (in Swedish).
Link to more comments made by the Swedish minister of culture (in Swedish).
Link to the first statement made by the Swedish minister of culture in SvD (in Swedish).
Yesterday I bought some Swedish strawberries to cheer me up (and get some vitamins, minerals and all other things I know are good for me). They were not cheap. For those of you who doesn't know, strawberries is the most exotic thing that grows in Sweden. Most fruits are imported and thus not tasting as good as they would in more southern countries. So, strawberries is a special thing for many of us Swedes. I serve them in a bowl, with milk, some cream and sugar. For a moment it actually felt like summer, but the weather says otherwise. I also took some photos, since I think strawberries are rather beautiful.



This summer I will study three courses in physics. I trust most of them to be very interesting, but I will provide further comments on this as the courses begin next week.
Lastly, in the news. DN writes about the right-wing Swedish government looking over routines for state television and radio. In Sweden we have two television channels run by the state and four radio channels. They mostly provide music and programs which they commercial channels are not interested in. Debates, classical music and so on. They also has to provide it for a large majority of the Swedish citizens. Where I used to live we didn't have any commercial radio channels since the population was only about 10'000, lately one or two commercial channels have become available (and only playing horrible popular music anyway). To finance all this, the state claims ~4 SEK a day from everyone who owns a television. We even have people employed to check in on you if you are paying. Sadly, our government seems to like this solution. I think it's an old (and bad) idea, that was a good idea back in the middle of the 20th century. Back then some people didn't own a TV and would probably not like paying for channels they couldn't watch. Now, things are different. Most people own a television and it takes money to check whether or not someone owns a television and to administrate it all. Why not let it be a part of the tax instead? Thus making the system more efficient and making it impossible to avoid paying for your TV. The increase in tax will be unnoticeable and people will not complain about such a marginal increase. I just can't stand bad solutions to simple problems...
Link to the article (in Swedish).
Link to more comments made by the Swedish minister of culture (in Swedish).
Link to the first statement made by the Swedish minister of culture in SvD (in Swedish).
Thursday, 17 May 2007
Thoughts and photos of a salt crystal
I have taken three out of five exams for this semester now. The next one up is discrete mathematics, it scares me a bit but I guess I'll do fine as usual. I will just get a cup of tea and read through the chapters once again this afternoon and then focus on getting it all to work in practice. After the math exam it's just a silly course in economics that is more or less a walk in the park.
I have applied for three courses at KTH for this summer and two courses at another university. I have received letters of acceptance from the second university but I'd rather study at KTH. I hope to take courses mainly in physics with some connection to computer science or a field related to computer science so that I can apply my knowledge in courses to come.
Instead of going on about bad things I thought that today I would just mention some news that made me happy. S. Korea and N. Korea seems to be getting along better. SvD (in Swedish) writes that regular communications between the countries might be resumed, hopefully this will result in Koreans being able to see their relatives and exchange knowledge, goods and so on. Thus leading to less tension in the area.
DN (in Swedish) says that Amazon is apparently going to sell non-DRM-damaged music. Finally! A company that realises that damaging a product makes it useless. Now I don't have to buy CD;s and rip them in order to play them on my computer.
Lastly, a couple of months ago I visited my mother and she had bought some kind of sea salt. The package also contained larger crystals which I sought out and brought one of them home. The photos didn't end up that well, but I really like the shapes.


I have applied for three courses at KTH for this summer and two courses at another university. I have received letters of acceptance from the second university but I'd rather study at KTH. I hope to take courses mainly in physics with some connection to computer science or a field related to computer science so that I can apply my knowledge in courses to come.
Instead of going on about bad things I thought that today I would just mention some news that made me happy. S. Korea and N. Korea seems to be getting along better. SvD (in Swedish) writes that regular communications between the countries might be resumed, hopefully this will result in Koreans being able to see their relatives and exchange knowledge, goods and so on. Thus leading to less tension in the area.
DN (in Swedish) says that Amazon is apparently going to sell non-DRM-damaged music. Finally! A company that realises that damaging a product makes it useless. Now I don't have to buy CD;s and rip them in order to play them on my computer.
Lastly, a couple of months ago I visited my mother and she had bought some kind of sea salt. The package also contained larger crystals which I sought out and brought one of them home. The photos didn't end up that well, but I really like the shapes.


Sunday, 6 May 2007
Photos of a deep pink flower
There is a tree just outside my window. Last year it bloomed beautifully and since I bought a camera after Christmas I have waited for it to bloom. Then when it burst into bloom I waited for the sun to reach it. The building next to mine cast a huge shadow over the tree. But today, when writing one of my home-exams I finally got the chance.
I took the first two using a chair and raising the camera over my head. That tree is pretty tall. For the other two I just used a chair.



I took the first two using a chair and raising the camera over my head. That tree is pretty tall. For the other two I just used a chair.



Teaching mathematics
The following text is a translated version of a post at tjuvlyssnat.se which publish overheard conversations which are considered funny. Pay them a visit if you can read Swedish, some are quite amusing.
\begin{translation}
One might wonder whether or not it sounded worse this time...
On a train from Linköping to Norrköping.
Two girls about 23 years old and probably teacher students are discussing teaching.
Girl 1: It was so embarrassing, last week when I went with Lisa...
Girl 2: Umm?
Girl 1: Yes, we were discussing whether or not we could "fill in" during a math lesson. And there was a guy opposite of us, he was clearly listening to our conversation.
Girl 2: Mmm...
Girl 1: Well, we came to talk about how to divide by zero. Three divided by zero has to be three, five divided by zero must be five.
Girl 2: Mmm...
Girl 1: Then we notice that the guy barely can keep himself from laughing. Oh, we must have seemed so stupid... Three divided by zero must of course be zero.
Girl 2: Yes, it has to be, haha!
Girl 1: We felt so embarrassed!
\end
I really hope that all teacher students who are to teach mathematics are not like this. I have had math teachers that barely can cope with math at a middle school level. The class was at a virtual stand-still for a week when he filled in. Math, like any other subject needs motivated and well educated teachers... otherwise we end up with people in their twenties who still don't know the basic rules of division *shivers*.
Link to the Swedish version.
\begin{translation}
One might wonder whether or not it sounded worse this time...
On a train from Linköping to Norrköping.
Two girls about 23 years old and probably teacher students are discussing teaching.
Girl 1: It was so embarrassing, last week when I went with Lisa...
Girl 2: Umm?
Girl 1: Yes, we were discussing whether or not we could "fill in" during a math lesson. And there was a guy opposite of us, he was clearly listening to our conversation.
Girl 2: Mmm...
Girl 1: Well, we came to talk about how to divide by zero. Three divided by zero has to be three, five divided by zero must be five.
Girl 2: Mmm...
Girl 1: Then we notice that the guy barely can keep himself from laughing. Oh, we must have seemed so stupid... Three divided by zero must of course be zero.
Girl 2: Yes, it has to be, haha!
Girl 1: We felt so embarrassed!
\end
I really hope that all teacher students who are to teach mathematics are not like this. I have had math teachers that barely can cope with math at a middle school level. The class was at a virtual stand-still for a week when he filled in. Math, like any other subject needs motivated and well educated teachers... otherwise we end up with people in their twenties who still don't know the basic rules of division *shivers*.
Link to the Swedish version.
Subscribe to:
Comments (Atom)
