File: js.4

package info (click to toggle)
joystick 0.8.0-4
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 80 kB
  • ctags: 68
  • sloc: ansic: 436; makefile: 83; sh: 18
file content (74 lines) | stat: -rw-r--r-- 2,205 bytes parent folder | download | duplicates (2)
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
.TH JS 4
.SH NAME
js - joystick device
.SH DESCRIPTION
These are character devices to access one or two analog joysticks.

They are typically created by:

    mknod -m 640 /dev/js0 c 15 0
    mknod -m 640 /dev/js1 c 15 1

The device is accessed via read() and ioctl() calls. These are
described in the file <linux/joystick.h>.

Opening the device will return a file descriptor or -1 with errno
ENODEV (if the device couldn't be opened) or EBUSY (if it is in use).

Reading the device will return a struct JS_DATA_TYPE. Several ioctl()
calls are also provided to further control the joystick driver:

JS_SET_CAL  - set joystick correction factor

JS_GET_CAL  - get joystick correction factor

JS_SET_TIMEOUT - set timeout for reading joystick. Last arg is int*.

JS_GET_TIMEOUT - set timeout for reading joystick. Last arg is int*.

JS_SET_TIMELIMIT - set data retention time. Last arg is int*.

JS_GET_TIMELIMIT - get data retention time. Last arg is int*.

JS_GET_ALL - get all of the joystick data. Last arg is
	JS_DATA_SAVE_TYPE*.

JS_SET_ALL  - set all of the joystick data (except JS_BUSY). Last arg
	is JS_DATA_SAVE_TYPE*.

An explanation of the timeout and timelimit values:

The timeout value represents a time delta. If the joystick cannot be
read in this time, then an error is returned (ENODEV).

The timelimit value also represents a time delta. Once the joystick is
successfully read, the state of the stick is stored away inside the
device driver. It is considered valid for the length of the
timelimit. Any reads of the joystick before the timelimit is up will
receive the cached value. When the next read occurs after the
timelimit, the driver actually looks at the joystick.

See also the "js" and "jscal" programs provided with the joystick
driver package.

.SH FILES

/dev/js0 - first joystick

/dev/js1 - second joystick

.SH BUGS/LIMITATIONS

A maximum of 2 joysticks are supported.

The granularity of acquiring/releasing axes is two axes at a time (one
joystick at a time).

.SH AUTHOR

Art Smith (asmith@cbnewsd.att.com)

Version 0.6 changes by Jeff Tranter (tranter@software.mitel.com)

Version 0.7-8 changes by Matt Rhoten (mrhoten@oz.net) and many
contributors (see joystick.c)