patch-2.2.14 linux/Documentation/joystick-api.txt

Next file: linux/Documentation/joystick-parport.txt
Previous file: linux/Documentation/isdn/README.pcbit
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.13/linux/Documentation/joystick-api.txt linux/Documentation/joystick-api.txt
@@ -1,7 +1,7 @@
 		      Joystick API Documentation                -*-Text-*-
 
 		       Ragnar Hojland Espinosa
-		     <ragnar@lightside.ddns.org>
+		     <ragnar@lightside.dhis.org>
 
 			      7 Aug 1998
 
@@ -75,7 +75,7 @@
 	...and so on
 
 Hats vary from one joystick type to another. Some can be moved in 8
-directions, some only in 4, however, the driver always reports a hat as two
+directions, some only in 4, The driver, however, always reports a hat as two
 independent axis, even if the hardware doesn't allow independent movement.
 
 
@@ -85,7 +85,7 @@
 For an axis, ``value'' is a signed integer between -32767 and +32767
 representing the position of the joystick along that axis. If you
 don't read a 0 when the joystick is `dead', or if it doesn't span the
-full range, you should recalibrate (with, for example, jscal).
+full range, you should recalibrate it (with, for example, jscal).
 
 For a button, ``value'' for a press button event is 1 and for a release
 button event is 0.
@@ -93,16 +93,16 @@
 Though this
 
 	if (js_event.type == JS_EVENT_BUTTON) {
-	   buttons_state ^= (1 << js_event.number);
+		buttons_state ^= (1 << js_event.number);
 	}
 
 may work well if you handle JS_EVENT_INIT events separately,
 
 	if ((js_event.type & ~JS_EVENT_INIT) == JS_EVENT_BUTTON) {
-	   if (js_event.value)
-	      buttons_state |= (1 << js_event.number);
-	   else
-	      buttons_state &= ~(1 << js_event.number);
+		if (js_event.value)
+	        	buttons_state |= (1 << js_event.number);
+	   	else
+	      		buttons_state &= ~(1 << js_event.number);
 	}
 
 is much safer since it can't lose sync with the driver. As you would
@@ -112,6 +112,7 @@
 
 2.4 js_event.time
 ~~~~~~~~~~~~~~~~~
+
 The time an event was generated is stored in ``js_event.time''. It's a time
 in miliseconds since ... well, since sometime in the past.  This eases the
 task of detecting double clicks, figuring out if movement of axis and button
@@ -144,14 +145,14 @@
 For example,
 
 	while (1) {
-	   while (read (fd, &e, sizeof(struct js_event)) > 0) {
-	      process_event (e);
-	   }
-	   /* EAGAIN is returned when the queue is empty */
-	   if (errno != EAGAIN) {
-	      /* error */
-	   }
-	   /* do something interesting with processed events */
+		while (read (fd, &e, sizeof(struct js_event)) > 0) {
+	        	process_event (e);
+	   	}
+	   	/* EAGAIN is returned when the queue is empty */
+	   	if (errno != EAGAIN) {
+	      		/* error */
+	   	}
+	   	/* do something interesting with processed events */
 	}
 
 One reason for emptying the queue is that if it gets full you'll start
@@ -219,6 +220,7 @@
 	#ifdef JS_VERSION
 	#if JS_VERSION > 0xsomething
 
+
 4.2 JSIOCGNAME
 ~~~~~~~~~~~~~~
 
@@ -232,6 +234,7 @@
 		strncpy(name, "Unknown", sizeof(name));
 	printf("Name: %s\n", name);
 
+
 4.3 JSIOC[SG]CORR
 ~~~~~~~~~~~~~~~~~
 
@@ -266,10 +269,10 @@
 
 	struct JS_DATA_TYPE js;
 	while (1) {
-	   if (read (fd, &js, JS_RETURN) != JS_RETURN) {
-	      /* error */
-	   }
-	   usleep (1000);
+		if (read (fd, &js, JS_RETURN) != JS_RETURN) {
+	      		/* error */
+	   	}
+	   	usleep (1000);
 	}
 
 As you can figure out from the example, the read returns immediately,
@@ -296,8 +299,9 @@
 center, and 255 maximum value.
 
 The v0.8.0.2 driver also had an interface for 'digital joysticks', (now
-called Multisystem joystick in this driver), under /dev/djsX. This driver
+called Multisystem joysticks in this driver), under /dev/djsX. This driver
 doesn't try to be compatible with that interface.
+
 
 6. Final Notes
 ~~~~~~~~~~~~~~

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)