Thursday, April 28, 2011

Controlling mouse in linux

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.

From stackoverflow
  • 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.

    greyfade : 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.
    unwind : @greyfade: So X11 owns /dev/input/mice? I thought that merged stream was created by the kernel's input subsystem.
  • 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

    PCBEEF : 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.
    greg : Lirc (infrared remotes) under linux also uses uinput. Take look at sources (ex. daemons/lircmd.c write_uinput(), setup_uinputfd() )
    PCBEEF : @greg cheers, will do so.
  • 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.

0 comments:

Post a Comment