Sunday, December 30, 2012

Wiimote+nunchuk web surfing in linux

At this point, messing around with the wiimote probably seems dated, but hey, I have one lying around with a motionplus and nunchuk. The final outcome of this post if you follow it- you'll be able to control your mouse cursor with the nunchuk analog stick, scroll up/down/left/right with the wiimote d-pad and left/right click with either the wiimote or the nunchuk. Let's get started.

Prerequisites:
  • A wiimote
  • A wiimote nunchuk
  • A linux system with the uinput kernel module
Procedure:
  1. Clone my fork of cwiid into a directory of your choice(wiimouse for example here)
    git clone https://github.com/trtg/cwiid.git wiimouse
  2. cd wiimouse
  3. aclocal
  4. autoconf
  5. ./configure --with-cwiid-config-dir=/etc/cwiid/
  6. make
  7. sudo make install

    Note that by default this will install everything using a prefix of /usr/local unless you pass --prefix=some_other_directory to configure so make sure whatever prefix you use is in your path.
  8. sudo modprobe uinput
  9. Create a new config file for the plugin I wrote by creating the file /etc/cwiid/nunchuk_stick_ptr and adding the text below to it
    include buttons
    Plugin.nunchuk_stick_ptr.X = REL_X
    Plugin.nunchuk_stick_ptr.Y = REL_Y
  10. sudo wminput -c nunchuk_stick_ptr You will see this message appear: Put Wiimote in discoverable mode now (press 1+2)... Do as it says and press buttons 1 and 2 on the wiimote then release them, the LEDs on the wiimote will blink for a while then the terminal where you entered the previous command will say: Ready.
  11. Now try moving the nunchuk analog stick and it should move your cursor around. Adjust /etc/cwiid/wminput/buttons if you want to change button mappings
Note: if you do not want to have to run wminput as root, you can configure things so that uinput may be accessed by users in the wheel users group. To make this happen, create a udev rules file in /etc/udev/rules.d/ with a name of your choosing, for example /etc/udev/rules.d/uinput.rules which contains the following line of text:

KERNEL=="uinput",GROUP="wheel",MODE="0660"

If you've already loaded the uinput kernel module prior to creating this file, you'll have to unload the module:
sudo rmmod uinput
and then reload it:
sudo modprobe uinput
Now you should be able to run wminput without sudo (assuming your user is in the wheel group)

23 comments:

  1. Replies
    1. Great Article Cyber Security Projects projects for cse Networking Security Projects JavaScript Training in Chennai JavaScript Training in Chennai The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  2. The history of surfboard fins traces back to Hawaii, where the locals started riding waves for fun using boards made of wood a century ago. In the past, the board was controlled using ones feet and hands in the water. Thanks to Tom Blake, who used his ingenuity to resolve board control problems and give rise to a modern sport loved and enjoyed by many. used surfboards san francisco

    ReplyDelete
  3. By reading this article I get a lot of lessons and this is very useful . cara menggugurkan kandungan

    ReplyDelete
  4. Isabel Wilkerson won the Pulitzer Prize in 1994 for her coverage as the Chicago bureau chief of The New York Times. She is a professor in the College of Communications at Boston University and has received the George S. Polk Award, a Guggenheim Fellowship and the Journalist of the Year Award from the National Association of Black Journalists..

    Cambridge United head coach Joe Dunne. Picture: Simon LankesterGet daily updates directly to your inbox+ SubscribeSee our privacy noticeThank you for subscribing!The U's returned to training on Monday, carrying out initial fitness tests and getting in some early ball work ahead of their first pre season game against Bolsos Michael Kors Baratos St Neots on July 7.And the majority of the squad is, of course, the same as last season, with Louis John the only new addition, while Uche Ikpeazu, Cheap Oakley Sunglasses Leon Legge, Medy Elito and Piero Mingoia all departed over the summer.And the relaxed atmosphere that Dunne and his assistant Mark Bonner bought to the club during their stint at the end of last season was evident again at a scorching Clare College s Ground, and the head coach said that fostering such an environment was the best way to improve players."I've just said to the staff it feels like we've walked off a training session from the end of last season," Dunne said."There's no dramas. You know your routine, they know the staff, the players are the same we won't dramatically change anything and that's what we want."I want a tranquil, relaxed environment that allows us to improve."And while pre season is primarily about getting Ray Ban Sale UK physically fit, it will also be used to drill Dunne's coaching and playing philosophy into the players: one of improvement and going after every game."We will find out as we go along that we can't stop everything, we can only Longchamp Soldes Destockage ask for improvements, big or small."As long as we see improvements, it's something that we've spoke about from the end of last season and just before they left."The no fear factor, [we want a] winning mentality, irrespective of the situation.

    ReplyDelete


  5. SportsHeadlinesLessard spices up race for Minnesota AGQuest for Longchamp Soldes Destockage a lighter canoe launches boatbuilding ventureAngelo Rodriguez debut for Minnesota United nearly comes with a goalFormer Viking Moss inducted to Pro Football Hall of FameNorthwoods League: Errors leave Huskies just short Ray Ban Sale UK in lossmilestonesHeadlinesJean Dick HansonSteve Bolsos Michael Kors Baratos and Shari WhiteWilla Mae WilsonRussell W. Berntson Beverly M. ChristiansonRobert Marilyn MurphyopinionHeadlinesCartoonist viewCartoonist viewCartoonist viewReader View: GOP wouldn call on Nolan to resignNational View: Even some players don understand what black protest Cheap Oakley Sunglasses is aboutoutdoorsHeadlinesLessard spices up race for Minnesota AGQuest for a lighter canoe launches boatbuilding ventureHouston column: Try inland lakes after dark for big fishOutdoors calendarStarry stonewort confirmed in Twin Cities lakecommunityHeadlinesMentor DuluthRecSports Make a Difference Grandma Brag BookYour Sports: Duluth East Greys take league championshipJune 14.

    ReplyDelete
  6. Both things are possible if you carry Michael Kors Handbags Wholesale. If you are a woman who goes for innovative designs, a designer Michael Kors Bags On Sale is perfect for you. Offering a huge selection of chic purses, handbags, shoes and accessories, Michael Kors Outlet Online Store celebrates womanhood in an entirely unique way. Michael Kors Factory Outlet Online Store At Wholesale Price are one of the most sought-after handbags worldwide. We all agree that diamonds are a woman's best friend; however Official Coach Factory Outlet Online are absolutely next in line. To Coach Outlet Sale aficionados, don't fret because we have great news: a discount Official Coach Outlet Online isn't hard to find. If you are a smart shopper looking for a good buy and great deals on your next handbag purchase, you can go to Official Coach Outlet Online.

    Friendly Links: Toms Shoes Womens | Toms Clearance

    ReplyDelete
  7. Great work.. Thanks for this post. Foreign travelers who wish to apply for Azerbaijan visa must check the visa requirement for azerbaijan before filling the application.

    ReplyDelete