Cha0s Site Admin
Joined: 17 Jan 2007 Posts: 468
Digg It |
Posted: Mon Sep 24, 2007 1:45 pm Post subject: WiiRemoteJ tips |
|
|
Hey guys. This is just a little post giving you guys some tips on fixing WiiRemoteJ/getting it to work. Here we go.
First, you can get WiiRemoteJ 1.5 here.
Standalone docs (also included with the release) are here. Note, these are both gzipped and zipped regularly. My host has problems with plain .zips for some reason.
1. Windows users should user either the BlueCove JSR82 library (with BlueSoleil or WIDCOMM stack) or the Avetana library (with WIDCOMM stack). Linux users should use Avetana (with BlueZ stack); if you have trouble see LINUX NOTE or the UBUNTU (GUTSY) NOTE below. Mac users should use Avetana or BlueCove (with the built-in stack).
2. Make sure to put the library in the extensions folder (as described in the readme). On Windows, you may also need to add the path of the library to the Windows system PATH variable.
3. To connect to the remote, use WiiRemoteJ's findRemote methods. DO NOT connect to the remote beforehand with the stack utilities. WiiRemoteJ handles the entire connection process and will not be able to connect if the remote is already connected.
4. If you're still having trouble, check the FAQ. If that fails, post a stack trace, your OS, Java version, bluetooth stack, and JSR82 implementation. We'll see what we can do to help.
LINUX NOTE
If you get errors that look like this:
| Code: | Exception in thread "Thread-2" java.lang.UnsatisfiedLinkError: de.avetana.bluetooth.stack.BlueZ.cancelInquiry()V
at de.avetana.bluetooth.stack.BlueZ.cancelInquiry(Native Method)
at javax.bluetooth.DiscoveryAgent.cancelInquiry(DiscoveryAgent.java:265)
at wiiremotej.WiiRemoteDiscoverer.deviceDiscovered(WiiRemoteDiscoverer.java:68)
at javax.bluetooth.DiscoveryAgent.deviceDiscovered(DiscoveryAgent.java:284)
at de.avetana.bluetooth.stack.BlueZ.hciInquiry(Native Method)
at javax.bluetooth.DiscoveryAgent$1.run(DiscoveryAgent.java:208)
at edu.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
at java.lang.Thread.run(Thread.java:619) |
Then try this (tip provided by realjab):
Open Bluez.cpp.
Add the following code:
| Code: | JNIEXPORT void JNICALL Java_de_avetana_bluetooth_stack_BlueZ_cancelInquiry (JNIEnv *env, jclass obj) {
/* Close the specified HCI device */
//printf("Function called: %s, %i\n"__FILE__, __LINE__);
//hci_close_dev(dd);
return;
} |
After completing the change don't forget to ./configure and ./install avetana to get the new .jar and the new .so file.
UBUNTU (GUTSY) AND MANDRIVA 2008 NOTE -- fix courtesy of Nemno
If you're using the Avetana stack and your programs are hanging on the following message: "FINER: Calibrating accelerometer..."
Do the following:
1. Download the latest Avetana source.
2. Go to your avetana source directory and open de/avetana/bluetooth/stack/BlueZ.java
3. Somewhere around line 317,
change line
int receiveMTU=672, transmitMTU=672;
to
int receiveMTU=-1, transmitMTU=-1;
4. Do a "make clean"
5. Make sure your envvariables are correct. Then do a "./install"
Copy the compiled files to your WiiRemotej directory.
And you're set!
Explanation of the problem (for those who are curious; not necessary to get it to work):
Verbatim from Nemno.
The problem with the avetana was that when you open a connection the LCAP protocol does some handshake things.
avetana : I request a config
wiimote : Ok set your MTU size on 185
avetana : I am ignorant so i'll use MTU size of 672
wiimote : See Yaa
after fix
avetana : I request a config
wiimote : Ok set your MTU size on 185
avetana : Ok setting MTU size on 185
wiimote : nice doing business
avetana : blabla
wiimote : blala
etc..etc... _________________ Cha0s
Last edited by Cha0s on Thu Dec 06, 2007 7:27 am; edited 1 time in total |
|