Author
Topic: wiimote almost sorted! (Read 16950 times)

I have the wiimote working in LMCE now with full media button functionality using cwiid (follow this howto: http://ubuntuforums.org/showthread.php?t=535659) and altering the button config to incluse keys F3, F5, F6, F7, F8 and Esc as well as mouse left and right click (like the gyromouse, the power button doesn't work though). I installed this in KDE BEFORE installing LMCE, so anyone with LMCE already installed may have dependancy problems.

However I can't seem to find a way of making it start on boot, I have to manually start it by typing 'sudo wminput -c ir_ptr' in the terminal.BIG problem, as I need a mouse and keyboard to do this, and I don't want them!

Anyone have any suggestions as to how I could make this command run on boot??

As for starting on boot, the command 'wminput -w' should keep wminput in search mode untill a wiimote is found, but I had no luck putting this in as a cronjob.(I tried-sudo crontab -ethen entered@reboot sudo wminput -w -c ir_ptr)

I think wminput starts up before the bluetooth adapter, and so fails and exits.I'm going to keep working on this!

Ok, I think the problem with getting to load the wiimote driver (wminput) on boot is due to a reliance on kbluetoothd.

The -w in the command wminput -w -c ir_ptr tells wminput to wait until a wiimote is found. But it appears to only wait so long as a bluetooth port is open, and that doesn't appear to happen until kbluetoothd has discovered a bluetooth device and started up.

If wminput -w -c ir_ptr is run before kbluetoothd has started (as a blue icon in the KDE tray) then it fails with an error.

So, I think to get it running on boot, the LMCE bluetooth manager (is there one??) needs to be disabled, and kbluetoothd started and put in discover mode on boot before wminput is started.

kbluetoothd ?? i didn't think that was used. I've just installed following the instructions at https://help.ubuntu.com/community/CWiiD but then remembered my bro "borrowed" my remote for some 4 player action on his wii

I've just simply built and installed from the sources in that tarball, edited the buttons file like you said and it works like a charm after starting wminput.

I think we should make it into a device that gets started when the media director is spawned. I'm hoping that a simple script will suffice, just starting wminput in a loop, but maybe there has to be some sort of "locking" as well.

I think we should make it into a device that gets started when the media director is spawned. I'm hoping that a simple script will suffice, just starting wminput in a loop, but maybe there has to be some sort of "locking" as well.

I think that is probably the best idea actually. It only really needs the Startup/Shutdown events on the device to start/stop the appropriate wminput stuff.Advantage would be timing should be better aligned with bluetooth stack loaded and "Quick Reload Router" should allow you to reinitialise it if needed. Scripted device should be fine.

You are right, it's definately not kbluetoothd causing repeated failures in wminput! But possibly to do with pybluez. Further testing later....

Apparently, ubuntu users can get it started on boot by adding wminput -d (this just activated the gyro not the ir following, but i'm sure wminput -w -c ir_ptr works for them just the same) to the boot list under the sessions tab of the system settings.

I was basically short on time last night so didn't get very far at all.

Got started though, setup wiimote on a different Media Director - as that one is easier for me to test things on. No major problems there except I did have problems discovering after a reboot.

Still undecided as to where the device should live in the heirarchy. At first I thought it would be a child of the MD Device but thinking about it a bit more it might be better under the Bluetooth dongle.

Did a couple of checks on the bluetooth dongle and it is receiving events on discover mode (1+2 buttons pressed). Therefore I think the following should be possible;1. Walk into room with an existing MD running and Bluetooth dongle2. Press discover (1+2)3. Bluetooth dongle device recognises new device and matches MAC address range as wiimote presents option to winstall wiimote device (much like a new bluetooth phone does now)4. Device is installed, with all dependent packages and parameter set to MAC address of wiimote. Maybe button/key mappings can be parameters as well5. Device is started, starting wminput appropriately6. On restart or reload router shtdown of device is called and stops the wminput

If device goes out of range then device would be stopped.

On an existing setup that has already got the device installed the same process would work (without having to do the package/device installs). You would still need to press 1+2 to use the wiimote (and start the device) - that is why I am think that it should live under bluetooth dongle???

All this seems quite straightforward to implement. Once the device is working then we just need to ensure all the dependencies are packaged up appropriately.

Some questions I still need answers to;1. Can LMCE detect the wiimote and bind to it without 1+2 being pressed. This would enable the wiimote to be active on a restart without having to do anything.2. Can wminput work with multiple wiimotes? Not a big issue or anything - just thinking ahead to the concept of it being like an ID for each family member. If they are using their wiimote then LMCE would recognise which user is controlling the orbiter. This makes cheking voicemail etc easier and can give them different UI.

There is also potential for Follow-me functionality to be tied to the wiimote. Basically, any of the mobile orbiter functionality could be contenders due to the use of bluettooth.

Anyway, first things first - need to get the device running with the basic wminput start/stop functionaility first. Job for the weekend now as that is the first chance I will get.