3

Basically I'm currently using the wiiuse library to get the wiimote working on linux. I want to now be able to control the mouse through the IR readings.

Can somebody point me in the right direction as to how to approach this? I know of uinput but there doesn't seem to be a lot of tutorials/guides on the web.

I'm working with c/c++ so a library in c/c++ would be helpful.

Cheers.

John Jiang
  • 11,069
  • 12
  • 51
  • 60

3 Answers3

5

I think you should look into "becoming" a new mouse device. This would require developing a device driver that knows how to read the Wii device, and present that data to the input system as if it came from a mouse. The Linux kernel supports multiple mice connected at the same time, and merges the inputs from all of them, so this will work fine.

This book might be a handy help along the way. Not sure if it's possible to do this totally in userland, but that is of course worth investigating too.

unwind
  • 391,730
  • 64
  • 469
  • 606
  • Slight nitpick. The kernel doesn't merge the inputs, X11 does. Multi-pointer support is coming to X.org in the near future. The kernel already exposes multiple inputs as separate devices. – greyfade Sep 24 '09 at 07:41
  • @greyfade: So X11 owns /dev/input/mice? I thought that merged stream was created by the kernel's input subsystem. – unwind Sep 24 '09 at 07:45
3

I`m not sure if I understood you question corectly. If looking for controling mouse pointer from userspace look at XTest Extension Usefull link

Edit: From kernel POV uinput looks like good starting point

greg
  • 665
  • 3
  • 5
  • Yes, I have taken a look at that site but it only details the basics for keyboard input. It'll be nice if theres a complete set of documentation as to how uinput works. – John Jiang Sep 24 '09 at 10:26
  • Lirc (infrared remotes) under linux also uses uinput. Take look at sources (ex. daemons/lircmd.c write_uinput(), setup_uinputfd() ) – greg Sep 24 '09 at 13:04
0

In the end I decided to just draw "cursor" objects on the screen and use setup each input device to control a separate "cursor" object. This seemed the best idea as we were short on time.

John Jiang
  • 11,069
  • 12
  • 51
  • 60