[svn] r6767 - in trunk/tools/wiipresent: . docs

packagers at lists.rpmforge.net packagers at lists.rpmforge.net
Sat Apr 18 03:06:28 CEST 2009


Author: dag
Date: 2009-04-18 02:06:27 +0100 (Sat, 18 Apr 2009)
New Revision: 6767

Added:
   trunk/tools/wiipresent/INSTALL
   trunk/tools/wiipresent/docs/wiipresent.1.html
Modified:
   trunk/tools/wiipresent/ChangeLog
   trunk/tools/wiipresent/README
   trunk/tools/wiipresent/TODO
   trunk/tools/wiipresent/docs/wiipresent.1
   trunk/tools/wiipresent/docs/wiipresent.1.txt
   trunk/tools/wiipresent/wiipresent.c
   trunk/tools/wiipresent/wiipresent.spec
Log:
Preparing the 0.7.2 release.

Modified: trunk/tools/wiipresent/ChangeLog
===================================================================
--- trunk/tools/wiipresent/ChangeLog	2009-04-15 16:31:54 UTC (rev 6766)
+++ trunk/tools/wiipresent/ChangeLog	2009-04-18 01:06:27 UTC (rev 6767)
@@ -1,9 +1,10 @@
-* 0.7.1svn - release ../04/2009
+* 0.7.2 - release 17/04/2009
 - Added -r/--reconnect option to wait for reconnect on disconnect
 - Check bluetooth address length
 - Handle BadWindow errors by ignoring them :-)
 - Improved the logic for getting a window name
 - Added support for kpresenter, pan and xmms
+- Fixed a strlen segfault when no bluetooth address was provided (Joost Damad)
 
 * 0.7.1 - release 16/03/2009
 - Added support for totem

Added: trunk/tools/wiipresent/INSTALL
===================================================================
--- trunk/tools/wiipresent/INSTALL	                        (rev 0)
+++ trunk/tools/wiipresent/INSTALL	2009-04-18 01:06:27 UTC (rev 6767)
@@ -0,0 +1,28 @@
+= wiipresent - Installaiton instructions
+
+== Build requirements
+You need the following libraries in order to build and use wiipresent:
+
+ - Xorg libX11 and libXtst libraries and headers
+ - BlueZ libraries and headers
+ - libwiimote libraries and headers (built with -D_DISABLE_NONBLOCK_UPDATES)
+
+We tried to minimize the dependencies for wiipresent so there is no excuse to
+ship it with every Linux distribution or appliance.
+
+== Building wiipresent
+To build wiipresent, it is sufficient to do:
+
+  $ make
+
+== Installing wiipresent
+Installing wiipresent requires root privilegese, you can simply do:
+
+  $ sudo make install prefix="/usr/local"
+
+== Feedback
+Please provide feedback regarding wiipresent to the following mailinglist:
+
+  tools at lists.rpmforge.net
+
+// vim: set syntax=asciidoc:

Modified: trunk/tools/wiipresent/README
===================================================================
--- trunk/tools/wiipresent/README	2009-04-15 16:31:54 UTC (rev 6766)
+++ trunk/tools/wiipresent/README	2009-04-18 01:06:27 UTC (rev 6767)
@@ -1,45 +1,48 @@
 = WiiPresent - Presentations using the Wiimote
 
-WiiPresent is a small program that enables you to use a Nintendo WiiMote
+WiiPresent is a small program that enables you to use a Nintendo Wiimote
 for giving presentations using Open Office, xpdf, evince or Acrobat Reader.
 It was designed as an off-the-shelf tool with no need to customize it.
 
 But WiiPresent can also control multimedia applications or firefox.
 It does this by translating WiiMote events into keypresses for applications.
 
+== Reasons for using a Wiimote for presentations
+There were quite a few compelling reasons for using a Wiimote for giving
+presentations:
 
-== Build requirements
-You need the following libraries in order to build and use WiiPresent:
+ - the same features as most of the advanced presentation devices
 
- - libX11 libraries and headers
- - libXtst libraries and headers
- - bluez libraries and headers
- - libcwiimote libraries and headers (build with -D_NO_BLOCKING_UPDATE)
+ - is much cheaper (40 EUR) than those advanced presentation devices (>80 EUR)
 
-We tried to minimize the dependencies for WiiPresent.
+ - has an open and documented interface where some advanced devices do not
+   work in Linux
 
+ - uses bluetooth which is common on laptops nowadays, but small USB bluetooth
+   receivers are quite cheap (10 EUR)
 
-== Key mappings
-=== Keys in NORMAL mode
-- left/right: change slide/channel/tab
-- up/down: change volume/change link
-- -/+: change volume/zoom
-- 1: fullscreen
-- A: Play/Pause
-- home: back/home
-- exit: unavailable
+ - works very reliably even in a big exhibition hall (LinuxTag 2008) with
+   thousands of people and booths with as many bluetooth devices. We even left
+   the exhbition room and we were still able to control our laptop at the
+   CentOS booth (witness references on request :-))
 
-=== Keymaps in WINDOW mode (B)
-- B+A: Enable/disable mouse-mode
-- B+up/down: scroll up and down
-- B+left/right: switch between applications
-- B+minus/plus: change workspace
-- B+2: blank screen/mute audio
+ - fancy silicon covers exist in various colors matching your outfit are
+   available from Ebay
 
-=== Keymaps in MOUSE mode
-- left/right: switch between applications
-- up/down: scroll up/down
-- -/+: left and right mouse-buttons
-- A: left mouse-button
+ - at least one person attributes finding a girlfriend by using the wiimote in
+   a public area (name witheld because of privacy concerns)
 
+ - they come with a wrist-cord (and anti-slip coating) for vivid, animated
+   presenters using lots of gestures
+
+
+== Build requirements
+You need the following libraries in order to build and use WiiPresent:
+
+ - Xorg libX11 and libXtst libraries and headers
+ - BlueZ libraries and headers
+ - libwiimote libraries and headers (built with -D_DISABLE_NONBLOCK_UPDATES)
+
+We tried to minimize the dependencies that WiiPresent needs.
+
 // vim: set syntax=asciidoc:

Modified: trunk/tools/wiipresent/TODO
===================================================================
--- trunk/tools/wiipresent/TODO	2009-04-15 16:31:54 UTC (rev 6766)
+++ trunk/tools/wiipresent/TODO	2009-04-18 01:06:27 UTC (rev 6767)
@@ -1,10 +1,12 @@
 = WiiPresent
+The below list is an overview of missing functionality, ideas and known
+shortcomings for both wiipresent as well as libwiimote.
 
 == Priorities
 - Make the mouse pointer move based on IR data (use WMD implementation)
-  (should probably go into libwiimote)
+  (should probably go into libwiimote, not wiipresent)
 - Scan for wiimotes and pick the closest (< rssi) nearby if more than one
-  (should probably go into libwiimote)
+  (should probably go into libwiimote, not wiipresent)
 - Check if bluetooth device is in fact a wiimote
   (bluetooth name should be 'Nintendo RVL-CNT-01')
 - Put keycode configuration in seperate config-files that are activated
@@ -24,6 +26,7 @@
   (needs IR working for making this practical)
 - Auto-disconnect option to safe batteries (eg. when used as remote)
   (and fast auto-reconnect)
+- Make keys repeat like a keyboard (first press, wait 200ms than repeat)
 
 == Bugs
 - Known bug where for the root window (0x01) we find no application name
@@ -38,3 +41,6 @@
 - Functionality to verify or get the Wiimote name
 - Functionality to scan for wiimotes is missing
 - Absolute positions for infrared handling is missing
+- Sound support
+
+// vim: set syntax=asciidoc:

Modified: trunk/tools/wiipresent/docs/wiipresent.1
===================================================================
--- trunk/tools/wiipresent/docs/wiipresent.1	2009-04-15 16:31:54 UTC (rev 6766)
+++ trunk/tools/wiipresent/docs/wiipresent.1	2009-04-18 01:06:27 UTC (rev 6767)
@@ -2,15 +2,15 @@
 .\" It was generated using the DocBook XSL Stylesheets (version 1.69.1).
 .\" Instead of manually editing it, you probably should edit the DocBook XML
 .\" source for it and then use the DocBook XSL Stylesheets to regenerate it.
-.TH "WIIPRESENT" "1" "04/10/2009" "" ""
+.TH "WIIPRESENT" "1" "04/17/2009" "" ""
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
 .SH "NAME"
-wiipresent \- tool to control applications using the wiimote
+wiipresent \- tool to control applications using a Nintendo wiimote
 .SH "SYNOPSIS"
-wiipresent [\-v] [\-l length] \-b bluetooth\-address
+wiipresent [\-v] [\-i] [\-l length] [\-t] \-b bluetooth\-address
 .sp
 .SH "DESCRIPTION"
 wiipresent is a tool to control applications using the wiimote. It was originally developed for using the wiimote to give presentations using openoffice or xpdf, but is now turned into a tool to control your mouse and/or other applications.
@@ -67,6 +67,75 @@
 Please press 1+2 on the wiimote with address 00:1B:7A:F8:B5:64...
 Battery level now is 81%.
 .fi
+.SH "KEY MAPPINGS"
+When you press a button on your Nintendo Wiimote, WiiPresent sends a Key event to the application that has the focus. Depending on the application, the buttons have a different meaning even though there is some consistency to what happens.
+.sp
+Currently the key mappings for each application is hard\-coded in the wiipresent tool, but in the future we plan to make this dynamically configurable so you have more control over the behaviour of your wiimote for your favorite applications.
+.sp
+Since we have a limited number of buttons on a Ninendo Wiimote we are limited in functionality we can map to the application, however to overcome this limitation combinations of keys have a special meaning.
+.sp
+When you press any button, you are using NORMAL mode. If you keep the B button pressed together with other buttons, you are in WINDOW mode. If you press button B and button A together you toggle between MOUSE mode and NORMAL mode.
+.sp
+.SH "NORMAL MODE"
+The following keys are mapped in NORMAL mode, depending on the application that has the focus this may vary.
+.sp
+.TP
+Left/Right buttons
+change slide, change channel, change tab
+.TP
+Up/Down buttons
+change volume, change links
+.TP
+\fI\-\fR/\fI+\fR buttons
+change volume, zoom out/in
+.TP
+\fIA\fR button
+toggle play/pause, change source
+.TP
+\fI1\fR button
+toggle fullscreen
+.TP
+\fI2\fR button
+change aspect ratio
+.TP
+\fIhome\fR button
+go back, home key
+.TP
+\fIexit\fR button
+exit wiipresent (not implemented yet due to libwiimote bug)
+.SH "WINDOW MODE"
+The following keys are mapped in WINDOW mode, depending on the application that has the focus this may vary. \fBThe B button is pressed together with the buttons below.\fR
+.sp
+.TP
+Up/Down buttons
+scroll up/down
+.TP
+Left/Right buttons
+switch between applications (window manager)
+.TP
+\fI\-\fR/\fI+\fR buttons
+change workspace
+.TP
+\fIA\fR button
+toggle MOUSE mode
+.TP
+\fI2\fR button
+blank screen, mute audio (censor info)
+.SH "MOUSE MODE"
+The following keys are mapped in MOUSE mode, depending on the application that has the focus this may vary. \fBMOUSE mode is toggled by pressing the \fR\fB\fIA\fR\fR\fB button and \fR\fB\fIB\fR\fR\fB button at the same time.\fR
+.sp
+.TP
+Up/Down buttons
+scroll up/down
+.TP
+Left/Right buttons
+switch between applications
+.TP
+\fI\-\fR/\fI+\fR buttons
+left/right mouse buttons
+.TP
+\fIA\fR button
+left mouse button
 .SH "BUGS"
 This program is free of bugs. Yeah right.
 .sp
@@ -85,6 +154,13 @@
 .nf
 hcitool(1)
 .fi
+.SH "HISTORY"
+The idea of using the wiimote for giving presentations was devised at LinuxTag 2008 in Berlin and a basic hack (based on WMD) was showcased at LinuxTag the second day at the CentOS booth. It included infrared mouse support and was written by Dag Wieers.
+.sp
+Because we need deadlines for getting anything done, we instantly submitted a paper for FrOSCon 2008 that was selected. And a second hack written in C (using cwiid) implemented tilt mouse support and timely rumbles was showcased at FrOSCon and was written by Geerd\-Dietger Hoffman.
+.sp
+At FOSDEM 2009 the current version was written from scratch at the CentOS booth (in C using libwiimote) and demonstrated before a live audience. Nobody (that we know of) was injured during this demonstration.
+.sp
 .SH "AUTHOR"
 Written by Dag Wieers [1]\&\fIdag at wieers.com\fR
 .sp

Added: trunk/tools/wiipresent/docs/wiipresent.1.html
===================================================================
--- trunk/tools/wiipresent/docs/wiipresent.1.html	                        (rev 0)
+++ trunk/tools/wiipresent/docs/wiipresent.1.html	2009-04-18 01:06:27 UTC (rev 6767)
@@ -0,0 +1,361 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<meta name="generator" content="AsciiDoc 8.4.1" />
+<title>wiipresent(1)</title>
+<style type="text/css">
+</style>
+</head>
+<body>
+<div id="header">
+<h1>
+wiipresent(1) Manual Page
+</h1>
+<h2>NAME</h2>
+<div class="sectionbody">
+<p>wiipresent -
+   tool to control applications using a Nintendo wiimote
+</p>
+</div>
+</div>
+<h2>SYNOPSIS</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>wiipresent [-v] [-i] [-l length] [-t] -b bluetooth-address</p></div>
+</div>
+<h2 id="_description">DESCRIPTION</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>wiipresent is a tool to control applications using the wiimote. It was
+originally developed for using the wiimote to give presentations using
+openoffice or xpdf, but is now turned into a tool to control your mouse
+and/or other applications.</p></div>
+</div>
+<h2 id="_options">OPTIONS</h2>
+<div class="sectionbody">
+<div class="dlist"><dl>
+<dt class="hdlist1">
+-b bt-address, --bluetooth=bt-address
+</dt>
+<dd>
+<p>
+    Wiimote bluetooth address (use hcitool scan)
+</p>
+</dd>
+<dt class="hdlist1">
+-d name, --display=name
+</dt>
+<dd>
+<p>
+    X display to use
+</p>
+</dd>
+<dt class="hdlist1">
+-i, --infrared
+</dt>
+<dd>
+<p>
+    use infrared sensor to move mouse pointer
+</p>
+</dd>
+<dt class="hdlist1">
+-l length, --length=minutes
+</dt>
+<dd>
+<p>
+    presentation length in minutes
+</p>
+</dd>
+<dt class="hdlist1">
+-r, --reconnect
+</dt>
+<dd>
+<p>
+    on disconnect, wait for reconnect
+</p>
+</dd>
+<dt class="hdlist1">
+-t, --tilt
+</dt>
+<dd>
+<p>
+    use tilt sensors to move mouse pointer
+</p>
+</dd>
+<dt class="hdlist1">
+-h, --help
+</dt>
+<dd>
+<p>
+    display this help and exit
+</p>
+</dd>
+<dt class="hdlist1">
+-v, --verbose
+</dt>
+<dd>
+<p>
+    increase verbosity
+</p>
+</dd>
+<dt class="hdlist1">
+--version
+</dt>
+<dd>
+<p>
+    output version information and exit
+</p>
+</dd>
+</dl></div>
+</div>
+<h2 id="_usage">USAGE</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>Before you can start using wiipresent you need to know the bluetooth address
+of the wiimote you want to use. You can scan your bluetooth viscinity by using
+hcitool like:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>hcitool scan</tt></pre>
+</div></div>
+<div class="paragraph"><p>after having pressed the 1 and 2 keys on your wiimote once. You will then see
+something like:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>[root at moria ~]# hcitool scan
+Scanning ...
+00:21:64:EF:62:F5       Nokia E71
+00:1B:7A:F8:B5:64       Nintendo RVL-CNT-01</tt></pre>
+</div></div>
+<div class="paragraph"><p>Then start wiipresent using the following syntax:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>[dag at moria ~]# wiipresent -b 00:1B:7A:F8:B5:64
+Please press 1+2 on the wiimote with address 00:1B:7A:F8:B5:64...
+Battery level now is 81%.</tt></pre>
+</div></div>
+</div>
+<h2 id="_key_mappings">KEY MAPPINGS</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>When you press a button on your Nintendo Wiimote, WiiPresent sends a Key event
+to the application that has the focus. Depending on the application, the
+buttons have a different meaning even though there is some consistency to what
+happens.</p></div>
+<div class="paragraph"><p>Currently the key mappings for each application is hard-coded in the
+wiipresent tool, but in the future we plan to make this dynamically
+configurable so you have more control over the behaviour of your wiimote
+for your favorite applications.</p></div>
+<div class="paragraph"><p>Since we have a limited number of buttons on a Ninendo Wiimote we are limited
+in functionality we can map to the application, however to overcome this
+limitation combinations of keys have a special meaning.</p></div>
+<div class="paragraph"><p>When you press any button, you are using NORMAL mode. If you keep the B
+button pressed together with other buttons, you are in WINDOW mode. If you
+press button B and button A together you toggle between MOUSE mode and
+NORMAL mode.</p></div>
+</div>
+<h2 id="_normal_mode">NORMAL MODE</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>The following keys are mapped in NORMAL mode, depending on the application
+that has the focus this may vary.</p></div>
+<div class="dlist"><dl>
+<dt class="hdlist1">
+Left/Right buttons
+</dt>
+<dd>
+<p>
+    change slide, change channel, change tab
+</p>
+</dd>
+<dt class="hdlist1">
+Up/Down buttons
+</dt>
+<dd>
+<p>
+    change volume, change links
+</p>
+</dd>
+<dt class="hdlist1">
+<em>-</em>/<em>+</em> buttons
+</dt>
+<dd>
+<p>
+    change volume, zoom out/in
+</p>
+</dd>
+<dt class="hdlist1">
+<em>A</em> button
+</dt>
+<dd>
+<p>
+    toggle play/pause, change source
+</p>
+</dd>
+<dt class="hdlist1">
+<em>1</em> button
+</dt>
+<dd>
+<p>
+    toggle fullscreen
+</p>
+</dd>
+<dt class="hdlist1">
+<em>2</em> button
+</dt>
+<dd>
+<p>
+    change aspect ratio
+</p>
+</dd>
+<dt class="hdlist1">
+<em>home</em> button
+</dt>
+<dd>
+<p>
+    go back, home key
+</p>
+</dd>
+<dt class="hdlist1">
+<em>exit</em> button
+</dt>
+<dd>
+<p>
+    exit wiipresent (not implemented yet due to libwiimote bug)
+</p>
+</dd>
+</dl></div>
+</div>
+<h2 id="_window_mode">WINDOW MODE</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>The following keys are mapped in WINDOW mode, depending on the application
+that has the focus this may vary. <strong>The B button is pressed together with the
+buttons below.</strong></p></div>
+<div class="dlist"><dl>
+<dt class="hdlist1">
+Up/Down buttons
+</dt>
+<dd>
+<p>
+    scroll up/down
+</p>
+</dd>
+<dt class="hdlist1">
+Left/Right buttons
+</dt>
+<dd>
+<p>
+    switch between applications (window manager)
+</p>
+</dd>
+<dt class="hdlist1">
+<em>-</em>/<em>+</em> buttons
+</dt>
+<dd>
+<p>
+    change workspace
+</p>
+</dd>
+<dt class="hdlist1">
+<em>A</em> button
+</dt>
+<dd>
+<p>
+    toggle MOUSE mode
+</p>
+</dd>
+<dt class="hdlist1">
+<em>2</em> button
+</dt>
+<dd>
+<p>
+    blank screen, mute audio (censor info)
+</p>
+</dd>
+</dl></div>
+</div>
+<h2 id="_mouse_mode">MOUSE MODE</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>The following keys are mapped in MOUSE mode, depending on the application
+that has the focus this may vary. <strong>MOUSE mode is toggled by pressing the <em>A</em>
+button and <em>B</em> button at the same time.</strong></p></div>
+<div class="dlist"><dl>
+<dt class="hdlist1">
+Up/Down buttons
+</dt>
+<dd>
+<p>
+    scroll up/down
+</p>
+</dd>
+<dt class="hdlist1">
+Left/Right buttons
+</dt>
+<dd>
+<p>
+    switch between applications
+</p>
+</dd>
+<dt class="hdlist1">
+<em>-</em>/<em>+</em> buttons
+</dt>
+<dd>
+<p>
+    left/right mouse buttons
+</p>
+</dd>
+<dt class="hdlist1">
+<em>A</em> button
+</dt>
+<dd>
+<p>
+    left mouse button
+</p>
+</dd>
+</dl></div>
+</div>
+<h2 id="_bugs">BUGS</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>This program is free of bugs. Yeah right.</p></div>
+<div class="paragraph"><p>If you have improvements or bugreports, please send them to:
+<a href="mailto:dag at wieers.com">dag at wieers.com</a></p></div>
+<div class="admonitionblock">
+<table><tr>
+<td class="icon">
+<div class="title">Note</div>
+</td>
+<td class="content">Please see the TODO file for known bugs and future plans.</td>
+</tr></table>
+</div>
+</div>
+<h2 id="_see_also">SEE ALSO</h2>
+<div class="sectionbody">
+<div class="literalblock">
+<div class="content">
+<pre><tt>hcitool(1)</tt></pre>
+</div></div>
+</div>
+<h2 id="_history">HISTORY</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>The idea of using the wiimote for giving presentations was devised at LinuxTag
+2008 in Berlin and a basic hack (based on WMD) was showcased at LinuxTag the
+second day at the CentOS booth. It included infrared mouse support and was
+written by Dag Wieers.</p></div>
+<div class="paragraph"><p>Because we need deadlines for getting anything done, we instantly submitted a
+paper for FrOSCon 2008 that was selected. And a second hack written in C
+(using cwiid) implemented tilt mouse support and timely rumbles was showcased
+at FrOSCon and was written by Geerd-Dietger Hoffman.</p></div>
+<div class="paragraph"><p>At FOSDEM 2009 the current version was written from scratch at the CentOS
+booth (in C using libwiimote) and demonstrated before a live audience. Nobody
+(that we know of) was injured during this demonstration.</p></div>
+</div>
+<h2 id="_author">AUTHOR</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>Written by Dag Wieers <a href="mailto:dag at wieers.com">dag at wieers.com</a></p></div>
+<div class="paragraph"><p>Homepage at <a href="http://dag.wieers.com/home-made/wiipresent/">http://dag.wieers.com/home-made/wiipresent/</a></p></div>
+</div>
+<div id="footer">
+<div id="footer-text">
+Version 0.6<br />
+Last updated 2009-04-17 21:34:26 CEST
+</div>
+</div>
+</body>
+</html>

Modified: trunk/tools/wiipresent/docs/wiipresent.1.txt
===================================================================
--- trunk/tools/wiipresent/docs/wiipresent.1.txt	2009-04-15 16:31:54 UTC (rev 6766)
+++ trunk/tools/wiipresent/docs/wiipresent.1.txt	2009-04-18 01:06:27 UTC (rev 6767)
@@ -4,11 +4,11 @@
 
 
 == NAME
-wiipresent - tool to control applications using the wiimote
+wiipresent - tool to control applications using a Nintendo wiimote
 
 
 == SYNOPSIS
-wiipresent [-v] [-l length] -b bluetooth-address
+wiipresent [-v] [-i] [-l length] [-t] -b bluetooth-address
 
 
 == DESCRIPTION
@@ -72,6 +72,95 @@
 ----
 
 
+== KEY MAPPINGS
+When you press a button on your Nintendo Wiimote, WiiPresent sends a Key event
+to the application that has the focus. Depending on the application, the
+buttons have a different meaning even though there is some consistency to what
+happens.
+
+Currently the key mappings for each application is hard-coded in the
+wiipresent tool, but in the future we plan to make this dynamically
+configurable so you have more control over the behaviour of your wiimote
+for your favorite applications.
+
+Since we have a limited number of buttons on a Ninendo Wiimote we are limited
+in functionality we can map to the application, however to overcome this
+limitation combinations of keys have a special meaning.
+
+When you press any button, you are using NORMAL mode. If you keep the B
+button pressed together with other buttons, you are in WINDOW mode. If you
+press button B and button A together you toggle between MOUSE mode and
+NORMAL mode.
+
+
+== NORMAL MODE
+The following keys are mapped in NORMAL mode, depending on the application
+that has the focus this may vary.
+
+Left/Right buttons::
+    change slide, change channel, change tab
+
+Up/Down buttons::
+    change volume, change links
+
+'-'/'+' buttons::
+    change volume, zoom out/in
+
+'A' button::
+    toggle play/pause, change source
+
+'1' button::
+    toggle fullscreen
+
+'2' button::
+    change aspect ratio
+
+'home' button::
+    go back, home key
+
+'exit' button::
+    exit wiipresent (not implemented yet due to libwiimote bug)
+
+
+== WINDOW MODE
+The following keys are mapped in WINDOW mode, depending on the application
+that has the focus this may vary. *The B button is pressed together with the
+buttons below.*
+
+Up/Down buttons::
+    scroll up/down
+
+Left/Right buttons::
+    switch between applications (window manager)
+
+'-'/'+' buttons::
+    change workspace
+
+'A' button::
+    toggle MOUSE mode
+
+'2' button::
+    blank screen, mute audio (censor info)
+
+
+== MOUSE MODE
+The following keys are mapped in MOUSE mode, depending on the application
+that has the focus this may vary. *MOUSE mode is toggled by pressing the 'A'
+button and 'B' button at the same time.*
+
+Up/Down buttons::
+    scroll up/down
+
+Left/Right buttons::
+    switch between applications
+
+'-'/'+' buttons::
+    left/right mouse buttons
+
+'A' button::
+    left mouse button
+
+
 == BUGS
 This program is free of bugs. Yeah right.
 
@@ -86,6 +175,22 @@
     hcitool(1)
 
 
+== HISTORY
+The idea of using the wiimote for giving presentations was devised at LinuxTag
+2008 in Berlin and a basic hack (based on WMD) was showcased at LinuxTag the
+second day at the CentOS booth. It included infrared mouse support and was
+written by Dag Wieers.
+
+Because we need deadlines for getting anything done, we instantly submitted a
+paper for FrOSCon 2008 that was selected. And a second hack written in C
+(using cwiid) implemented tilt mouse support and timely rumbles was showcased
+at FrOSCon and was written by Geerd-Dietger Hoffman.
+
+At FOSDEM 2009 the current version was written from scratch at the CentOS
+booth (in C using libwiimote) and demonstrated before a live audience. Nobody
+(that we know of) was injured during this demonstration.
+
+
 == AUTHOR
 Written by Dag Wieers mailto:dag at wieers.com[]
 

Modified: trunk/tools/wiipresent/wiipresent.c
===================================================================
--- trunk/tools/wiipresent/wiipresent.c	2009-04-15 16:31:54 UTC (rev 6766)
+++ trunk/tools/wiipresent/wiipresent.c	2009-04-18 01:06:27 UTC (rev 6767)
@@ -37,7 +37,7 @@
 Status XQueryCommand(Display *display, Window window, char **name);
 
 static char NAME[] = "wiipresent";
-static char VERSION[] = "0.7.1svn";
+static char VERSION[] = "0.7.2";
 
 static char *displayname = NULL;
 static Display *display = NULL;
@@ -155,7 +155,7 @@
     return 0;
 }
 
-// Implemented for some apps that return a 'weird' parent window id
+// Implemented for some apps that return a 'weird' parent window id (eg. qiv)
 int try_guessed(Display *display, Window window, char **name) {
     Window guessed = window - window % 0x100000 + 1;
     if (window == guessed)
@@ -169,7 +169,7 @@
     return 0;
 }
 
-int try_family(Display *display, Window window, char **name) {
+int try_parent(Display *display, Window window, char **name) {
     Window root_window;
     Window parent_window;
     Window *children_window;
@@ -179,21 +179,31 @@
         if (parent_window) {
             if (XQueryCommand(display, parent_window, name) != 0) {
                 if (verbose >= 3) fprintf(stderr, "Found application %s using parent window. (0x%08x)\n", *name, (unsigned int) parent_window);
-            } else if (try_family(display, parent_window, name)) {
                 return 1;
             }
         }
-    // FIXME: Try children too without looping !
-/*
+    }
+    return 0;
+}
+
+int try_children(Display *display, Window window, char **name) {
+    Window root_window;
+    Window parent_window;
+    Window *children_window;
+    unsigned int nchildrens;
+
+    if (XQueryTree(display, window, &root_window, &parent_window, &children_window, &nchildrens) != 0) {
         if (nchildrens > 0) {
             int i;
             for (i = 0; i < nchildrens; i++) {
+                fprintf(stderr, "Found child %d as window 0x%08x.\n", i, (unsigned int) children_window[i]);
                 if (XQueryCommand(display, children_window[i], name) != 0) {
                     if (verbose >= 3) fprintf(stderr, "Found application %s using child window (0x%08x).\n", *name, (unsigned int) parent_window);
+                    return 1;
                 }
             }
         }
-*/
+
     }
     return 0;
 }
@@ -222,10 +232,14 @@
         if (verbose >= 3) fprintf(stderr, "Found application %s (0x%08x) using XA_WM_COMMAND.\n", *name, (unsigned int) window);
     } else if (try_property(display, window, XA_WM_ICON_NAME, name)) {
         if (verbose >= 3) fprintf(stderr, "Found application %s (0x%08x) using XA_WM_ICON_NAME.\n", *name, (unsigned int) window);
+    } else if (try_property(display, window, XA_WM_CLASS, name)) {
+        if (verbose >= 3) fprintf(stderr, "Found application %s (0x%08x) using XA_WM_CLASS.\n", *name, (unsigned int) window);
     } else if (try_guessed(display, window, name)) {
         if (verbose >= 2) fprintf(stderr, "Found application %s using guessed parent window (0x%08x).\n", *name, (unsigned int) (window - window % 0x100000 + 1));
-    } else if (try_family(display, window, name)) {
+    } else if (try_parent(display, window, name)) {
         ;
+//    } else if (try_children(display, window, name)) {
+//        ;
     } else {
         return 0;
     }
@@ -349,6 +363,16 @@
         }
     }
 
+    // Check bluetooth address
+    // FIXME: Allow for wiimote scanning
+    if (btaddress == NULL) {
+        fprintf(stderr, "%s: Bluetooth address (-b/--bluetooth) is mandatory.\n", NAME);
+        return 1;
+    } else if (strlen(btaddress) != 17) {
+        fprintf(stderr, "%s: Bluetooth address %s has incorrect length.\n", NAME, btaddress);
+        return 1;
+    }
+
     // Obtain the X11 display.
     if (displayname == NULL)
         displayname = getenv("DISPLAY");
@@ -356,12 +380,6 @@
     if (displayname == NULL)
         displayname = ":0.0";
 
-    // Check bluetooth address
-    if (strlen(btaddress) != 17) {
-        fprintf(stderr, "Bluetooth address %s has incorrect length.\n", btaddress);
-        return 1;
-    }
-
     // Reconnect loop
     do {
         display = XOpenDisplay(displayname);
@@ -374,8 +392,7 @@
         // Wait for 1+2
         if (btaddress == NULL) {
     //        printf("Please press 1+2 on a wiimote in the viscinity...");
-    //        wiimote_connect(&wmote, btaddress);
-            printf("Sorry, you need to provide a bluetooth address using -b/--bluetooth.\n");
+            fprintf(stderr, "%s: Sorry, you need to provide a bluetooth address using -b/--bluetooth.\n", NAME);
             exit(1);
         } else {
             printf("Please press 1+2 on the wiimote with address %s...", btaddress);
@@ -390,7 +407,7 @@
         if (tilt)
             fprintf(stderr, "Mouse movement controlled by tilting wiimote.\n");
         else if (infrared)
-            fprintf(stderr, "Mouse movement controlled by infrared using sensor bar. (EXPERIMNTAL)\n");
+            fprintf(stderr, "Mouse movement controlled by infrared using sensor bar. (EXPERIMENTAL)\n");
         else
             fprintf(stderr, "Mouse movement disabled.\n");
 
@@ -438,21 +455,21 @@
                     if (verbose >= 2) fprintf(stderr, "Focus on application %s (0x%08x)\n", name, (unsigned int) window);
                 } else {
                     name = strdup("(unknown)");
-                    fprintf(stderr, "ERROR: Unable to find application name for window 0x%08x\n", (unsigned int) window);
+                    fprintf(stderr, "%s: Unable to find application name for window 0x%08x\n", NAME, (unsigned int) window);
                 }
                 oldwindow = window;
             }
 
-            if (wiimote_pending(&wmote) == 0) {
-                usleep(10000);
-            }
-
             // FIXME: We should reconnect at our own convenience
             if (wiimote_update(&wmote) < 0) {
                 printf("Lost connection.");
                 exit_clean(0);
             }
 
+            if (wiimote_pending(&wmote) == 0) {
+                usleep(10000);
+            }
+
             // Check battery change
             // FIXME: Battery level does not seem to get updated ??
             if (wmote.battery < oldbattery) {
@@ -492,7 +509,6 @@
 
             // Inside the mouse functionality
             if (mousemode) {
-
                 // Tilt method
                 if (tilt) {
                     XMovePointer(display, wmote.tilt.x / 4, wmote.tilt.y / 4, 1);
@@ -519,7 +535,7 @@
                         if (tilt) {
                             if (verbose >= 1) fprintf(stderr, "Tilt sensors enabled.\n");
                         } else if (infrared) {
-                            if (verbose >= 1) fprintf(stderr, "Infrared camera enabled.\n");
+                            if (verbose >= 1) fprintf(stderr, "Infrared camera enabled. (NOT IMPLEMENTED YET)\n");
                             wmote.mode.ir = 1;
                         }
                         // Infrared only works if acceleration sensors are enabled.

Modified: trunk/tools/wiipresent/wiipresent.spec
===================================================================
--- trunk/tools/wiipresent/wiipresent.spec	2009-04-15 16:31:54 UTC (rev 6766)
+++ trunk/tools/wiipresent/wiipresent.spec	2009-04-18 01:06:27 UTC (rev 6767)
@@ -6,7 +6,7 @@
 
 Summary: Giving presentations with your Wiimote (or control applications with the Wiimote)
 Name: wiipresent
-Version: 0.7.1svn
+Version: 0.7.2
 Release: 1
 License: GPL
 Group: Applications/Productivity
@@ -37,13 +37,13 @@
 
 %files
 %defattr(-, root, root, 0755)
-%doc AUTHORS ChangeLog COPYING README TODO docs/*.html docs/*.txt
+%doc AUTHORS ChangeLog COPYING INSTALL README TODO docs/*.html docs/*.txt
 %doc %{_mandir}/man1/wiipresent.1*
 %{_bindir}/wiipresent
 
 %changelog
-* Fri Apr 10 2009 Dag Wieers <dag at wieers.com> - 0.7.1svn-1
-- Updated to release 0.7.1svn.
+* Fri Apr 17 2009 Dag Wieers <dag at wieers.com> - 0.7.2-1
+- Updated to release 0.7.2.
 
 * Mon Mar 16 2009 Dag Wieers <dag at wieers.com> - 0.7.1-1
 - Updated to release 0.7.1.




More information about the commits mailing list