summaryrefslogtreecommitdiff
path: root/xf86-input-joystick.tex
blob: 7595fa47e0ec4b457007c180298f9106ccfaf0f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
\documentclass{beamer}

\usepackage[utf8x]{inputenc}
% \usetheme[secheader]{Boadilla}
% \usetheme[secheader]{Goettingen}
\usetheme{Malmoe}
\definecolor{myblue}{RGB}{55,69,104}
\usecolortheme[named=myblue]{structure}
\useinnertheme{circles}

\usepackage{hyperref}
% \usepackage{ngerman}
\usepackage{color}
\usepackage{listings}
\usepackage{pgfpages}
\definecolor{mylightgray}{rgb}{0.91,0.91,0.91}
\lstset{
        basicstyle=\ttfamily\tiny,
        language=,
        showstringspaces=false,
        numbers=none,
        numberstyle=\tiny,
        stepnumber=2,
        emptylines=*1,
        breaklines=false,
        frame=none,
        columns=fixed,
%         escapechar={},
%         extendedchars=true,
        commentstyle=\it\color{gray},
        directivestyle=\color{green},
        stringstyle=\color{red},
        backgroundcolor=\color{mylightgray},
        keywordstyle=\bf\color{black}
}


\title{xf86-input-joystick}
\author{\textbf{Sascha Hlusiak}}
\logo{\includegraphics[width=1cm,height=1cm]{pics/X_Org_Logo.png}}
\titlegraphic{\includegraphics[width=3.6cm,height=3.6cm]{pics/logitech_1.png}}
%\institute{}
\date{XDC2012, Nürnberg}


%% ABSTRACT

%The joystick input module was part of the old XFree86 distribution, but the 
%driver was in a bad state until 2007, when development was pushed forward. It 
%first supported the Linux joystick kernel device only, later on support for 
%evdev devices was added, which added support for the driver to be hotplugged 
%by hal enabled server. A FreeBSD kernel backend is available as well, but 
%like Solaris, this is not a prominent system on workstations. Today the 
%joystick driver is well hotpluggable using udev and supports many features 
%and configuration possibilities, like generating mouse button events, pointer 
%movement or key strokes. Enabling the driver to act as both, a pointer and a 
%keyboard device, was particularly challenging. Having a second keyboard 
%device with a different keyboard layout was a problem too, but situation 
%improved with recent servers and XI2/MPX. Support for properties enable 3rd 
%party programs to be written that change the configuration of the device on 
%demand. Prominent target platforms are Linux on the PS3 or the XBox.




\begin{document}
\maketitle

\section*{Overview}
\subsection*{abstract}

\begin{frame}{abstract}
  \structure{xf86-input-joystick?}
  \begin{itemize}
    \item \textbf{not} meant for playing games under X
    \item input module for the X.Org server to handle classical joysticks
    \item can emit pointer movement and key events
    \item \textbf{control the cursor with a joystick}
  \end{itemize}
\end{frame}

\subsection*{overview}
\begin{frame}{overview}
  \tableofcontents
\end{frame}


\section{Basics}
\subsection{why joysticks}
\begin{frame}{why joysticks?}
  \begin{itemize}
    \item cheap remote control
    \begin{itemize}
      \item being lazy
      \item watching movies from couch
      \item control music
    \end{itemize}

    \item interactive kiosk systems
    \begin{itemize}
      \item replace fragile mouse/touchpad
    \end{itemize}

    \item console and media center systems
    \begin{itemize}
      \item Linux on XBox, PS2, ...
      \item \textit{Steam Big Picture} going there
    \end{itemize}
  \end{itemize}
\end{frame}


\subsection{physical joysticks}
\begin{frame}{classical joysticks}
  \begin{itemize}
    \item a lot of different hardware configurations
    \item easily 6 or more axes, different types
    \begin{itemize}
      \item directional pad
      \item hat switch
      \item analog sticks
    \end{itemize}
    \item bunch of buttons, easily 10 and more
    \item force feedback
  \end{itemize}
  \begin{center}
    \includegraphics[width=3.5cm,height=3.5cm]{pics/logitech_1.png}
  \end{center}
\end{frame}


\begin{frame}{why a joystick input module?}
  \begin{itemize}
    \item xorg-server knows pointers and keyboards
    \item \textbf{xf86-input-evdev} maps directly
    \item evdev only in Linux
    \item joysticks usually send absolute axis data \\
      $ \Rightarrow $ direct mapping useless \\
      $ \Rightarrow $ joystick specific event transformation needed
  \end{itemize}
  \scriptsize \vspace{1cm}
$$
  \underbrace{
  \left (
    \begin{matrix}
      \text{absolute axes} \\
      \text{buttons} \\
    \end{matrix}
  \right )
  }_{\text{joystick data}}
  \Rightarrow
  \underbrace{
    px(a_i) = \int_{t} f(a_i) \frac{\mathrm{px}}{\mathrm{s}}
  }_{\text{transformation}}
  \Rightarrow 
  \underbrace{
  \left (
    \begin{matrix}
      \text{pointer} \\
      \text{buttons} \\
      \text{keys} \\
    \end{matrix}
  \right )
  }_{\text{X events}}
$$
\end{frame}

\subsection{kernel level}
\begin{frame}{joysticks on kernel level}
  \structure{kernel device}
  \begin{itemize}
    \item usually Plug \& Play (USB)
    \item event driven $ \Rightarrow $ no polling
  \end{itemize}

  \structure{Linux}
  \begin{itemize}
    \item \texttt{/dev/input/js0} (joydev)
    \item \texttt{/dev/input/event0} (evdev)
  \end{itemize}

  \structure{(Free)BSD}
  \begin{itemize}
    \item \texttt{/dev/input/js0} (linux-js)
    \item \texttt{/dev/uhid0} (usbhid)
  \end{itemize}

  $ \Rightarrow $ lightweight abstraction layer
\end{frame}


\section{Details}
\subsection{mappings}
\begin{frame}{axis mappings}
  \structure{mapping mode}
  \begin{itemize}
   \item relative (analog)
   \item accelerated (D-Pad)
   \item absolute (analog)
  \end{itemize}

  \structure{mapping type}
  \begin{itemize}
    \item pointer movement
    \item scroll event
    \item key event sequence (e.g. cursor keys)
    \item none + raw valuator events (XI2)
  \end{itemize}
\end{frame}


\begin{frame}{button mappings}
  \begin{itemize}
    \item pointer click
    \item pointer movement (accelerated)
    \item scroll events (accelerated)
    \item key sequences (e.g. Alt+Tab)
    \begin{itemize}
     \item auto repeat applies
     \item keyboard layout applies
    \end{itemize}
    \item disable all events temporarily
    \begin{itemize}
      \item still allows playing games
    \end{itemize}
  \end{itemize}
\end{frame}


\subsection{configuration}
\begin{frame}{hotplugging and configuration}
  \begin{itemize}
    \item can be hotplugged through udev and \textit{xorg.conf.d}
    \begin{itemize}
      \item allows specific configuration
      \item easy pre-configuration through distributors
    \end{itemize}
    \item no EVIOCGRAB
    \begin{itemize}
      \item allows concurrent reads (e.g. for games)
      \item watch out when hotplugging \textbf{js0} \textit{and} \textbf{event0}
    \end{itemize}
    \item supports input device properties
    \begin{itemize}
      \item most configuration items can be changed at runtime
      \item TODO: frontend
    \end{itemize}
  \end{itemize}
\end{frame}


\begin{frame}{distribution default}
  \begin{itemize}
    \item mostly installed unintentionally \\
    $ \Rightarrow $ yields unexpected behaviour
    \begin{itemize}
     \item default should be disabled/floating
     \item make user aware to enable it during installation
	 \item popup from DE on hotplug event
     \item way to activate/deactivate it on the fly
    \end{itemize}

    \item no reasonable default configuration
    \begin{itemize}
      \item example configuration
      \item configuration wizard (\textit{xorg.conf.d})
      \item frontend for runtime configuration (properties, dynamic hotplugging)
    \end{itemize}
  \end{itemize}
\end{frame}


\subsection{pointer vs. keyboard}
\begin{frame}{pointer vs. keyboard}
  \begin{itemize}
    \item X.Org server strictly separates pointers and keyboards
    \item no hybrid input devices \\
    $ \Rightarrow $ xf86-input-joystick has to create two input devices
    \begin{itemize}
     \item properties only on pointer
     \item keyboard layout and autorepeat on keyboard
    \end{itemize}
  \end{itemize}
\end{frame}


\begin{frame}{keyboard configuration}
  \begin{itemize}
    \item user wants KeySyms (space, Return, XF86AudioPlay, ...)
    \item driver emits scancodes
    \begin{itemize}
      \item keyboard layout $ \Rightarrow $ unwanted indirection layer
      \item current layout unknown to driver
      \item no custom keyboard layout from within driver
    \end{itemize}
    \item different auto repeat rate possible \\
    $ \Rightarrow $ difficult to configure
  \end{itemize}
\end{frame}


\subsection{raw valuators}
\begin{frame}{raw valuator events}
  \begin{itemize}
    \item valuators 0 and 1 reserved for pointer movement
    \item optional raw valuators per axis
    \begin{itemize}
      \item useful for XI2 applications (e.g. gimp)
      \item less useful for games
    \end{itemize}
  \end{itemize}
\end{frame}


\section{Future}
\subsection{platforms}
\begin{frame}{platforms}
  \begin{itemize}
    \item focus on Linux
    \begin{itemize}
      \item end user desktop systems
      \item interactive kiosk systems
      \item console systems (XBox, PS2/3, ...)
      \item Wii remote? Kinect? \\
      $ \Rightarrow $ not classical joysticks \\
      $ \Rightarrow $ different module
    \end{itemize}
    \item support for Solaris, etc. possible \\
    $ \Rightarrow $ not attractive enough
  \end{itemize}
\end{frame}


\subsection{features}
\begin{frame}{force feedback}
  \begin{itemize}
    \item events from toolkit
    \item event infrastructure from client to server
  \end{itemize}
\end{frame}


\begin{frame}{possible features}
  \begin{itemize}
    \item most properties implemented
    \begin{itemize}
      \item still some work left
    \end{itemize}
    \item \textbf{xinput} only ``frontend'' for properties
    \begin{itemize}
      \item driver can deactivate/activate itself
      \item GTK/Qt frontend with support for ``profiles'' would be nice
    \end{itemize}
  \end{itemize}
\end{frame}



\section*{}
\subsection*{}
\begin{frame}
  \begin{center}
    \huge Thank you!
  \end{center}
\end{frame}


\end{document}