* [PATCH 0/2] Input: joystick - documentation fixes
@ 2013-12-16 8:57 Antonio Ospite
2013-12-16 8:57 ` [PATCH 1/2] Input: joystick - refer to /dev/input/js0 in documentation Antonio Ospite
2013-12-16 8:57 ` [PATCH 2/2] Input: joystick - use sizeof(VARIABLE) " Antonio Ospite
0 siblings, 2 replies; 5+ messages in thread
From: Antonio Ospite @ 2013-12-16 8:57 UTC (permalink / raw)
To: linux-input; +Cc: Antonio Ospite, Dmitry Torokhov
Hi,
here are a couple of fixes for the joystick API documentation.
Ciao,
Antonio
Antonio Ospite (2):
Input: joystick - refer to /dev/input/js0 in documentation
Input: joystick - use sizeof(VARIABLE) in documentation
Documentation/input/joystick-api.txt | 12 ++++++------
Documentation/input/joystick.txt | 8 ++++----
2 files changed, 10 insertions(+), 10 deletions(-)
--
Antonio Ospite
http://ao2.it
A: Because it messes up the order in which people normally read text.
See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] Input: joystick - refer to /dev/input/js0 in documentation
2013-12-16 8:57 [PATCH 0/2] Input: joystick - documentation fixes Antonio Ospite
@ 2013-12-16 8:57 ` Antonio Ospite
2013-12-16 8:57 ` [PATCH 2/2] Input: joystick - use sizeof(VARIABLE) " Antonio Ospite
1 sibling, 0 replies; 5+ messages in thread
From: Antonio Ospite @ 2013-12-16 8:57 UTC (permalink / raw)
To: linux-input; +Cc: Antonio Ospite, Dmitry Torokhov
Nowadays the joystick device nodes are created under /dev/input, reflect
this in the documentation in order to make copy and paste easier for
users.
Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
---
Documentation/input/joystick-api.txt | 2 +-
Documentation/input/joystick.txt | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Documentation/input/joystick-api.txt b/Documentation/input/joystick-api.txt
index c507330..f95f648 100644
--- a/Documentation/input/joystick-api.txt
+++ b/Documentation/input/joystick-api.txt
@@ -16,7 +16,7 @@ joystick.
By default, the device is opened in blocking mode.
- int fd = open ("/dev/js0", O_RDONLY);
+ int fd = open ("/dev/input/js0", O_RDONLY);
2. Event Reading
diff --git a/Documentation/input/joystick.txt b/Documentation/input/joystick.txt
index 304262b..8d027dc 100644
--- a/Documentation/input/joystick.txt
+++ b/Documentation/input/joystick.txt
@@ -116,7 +116,7 @@ your needs:
For testing the joystick driver functionality, there is the jstest
program in the utilities package. You run it by typing:
- jstest /dev/js0
+ jstest /dev/input/js0
And it should show a line with the joystick values, which update as you
move the stick, and press its buttons. The axes should all be zero when the
@@ -136,7 +136,7 @@ joystick should be autocalibrated by the driver automagically. However, with
some analog joysticks, that either do not use linear resistors, or if you
want better precision, you can use the jscal program
- jscal -c /dev/js0
+ jscal -c /dev/input/js0
included in the joystick package to set better correction coefficients than
what the driver would choose itself.
@@ -145,7 +145,7 @@ what the driver would choose itself.
calibration using the jstest command, and if you do, you then can save the
correction coefficients into a file
- jscal -p /dev/js0 > /etc/joystick.cal
+ jscal -p /dev/input/js0 > /etc/joystick.cal
And add a line to your rc script executing that file
@@ -556,7 +556,7 @@ interface, and "old" for the "0.x" interface. You run it by typing:
5. FAQ
~~~~~~
-Q: Running 'jstest /dev/js0' results in "File not found" error. What's the
+Q: Running 'jstest /dev/input/js0' results in "File not found" error. What's the
cause?
A: The device files don't exist. Create them (see section 2.2).
--
1.8.5.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] Input: joystick - use sizeof(VARIABLE) in documentation
2013-12-16 8:57 [PATCH 0/2] Input: joystick - documentation fixes Antonio Ospite
2013-12-16 8:57 ` [PATCH 1/2] Input: joystick - refer to /dev/input/js0 in documentation Antonio Ospite
@ 2013-12-16 8:57 ` Antonio Ospite
2013-12-16 9:51 ` Dmitry Torokhov
1 sibling, 1 reply; 5+ messages in thread
From: Antonio Ospite @ 2013-12-16 8:57 UTC (permalink / raw)
To: linux-input; +Cc: Antonio Ospite, Dmitry Torokhov
Use the preferred style sizeof(VARIABLE) instead of sizeof(TYPE) in the
joystick API documentation, Documentation/CodingStyle states that this
is the preferred style for allocations but using it elsewhere is good
too.
Also fix some errors like "sizeof(struct mybuffer)" which didn't mean
anything.
Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
---
Documentation/input/joystick-api.txt | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/Documentation/input/joystick-api.txt b/Documentation/input/joystick-api.txt
index f95f648..47e60a5 100644
--- a/Documentation/input/joystick-api.txt
+++ b/Documentation/input/joystick-api.txt
@@ -23,7 +23,7 @@ By default, the device is opened in blocking mode.
~~~~~~~~~~~~~~~~
struct js_event e;
- read (fd, &e, sizeof(struct js_event));
+ read (fd, &e, sizeof(e));
where js_event is defined as
@@ -34,8 +34,8 @@ where js_event is defined as
__u8 number; /* axis/button number */
};
-If the read is successful, it will return sizeof(struct js_event), unless
-you wanted to read more than one event per read as described in section 3.1.
+If the read is successful, it will return sizeof(e), unless you wanted to read
+more than one event per read as described in section 3.1.
2.1 js_event.type
@@ -144,7 +144,7 @@ all events on the queue (that is, until you get a -1).
For example,
while (1) {
- while (read (fd, &e, sizeof(struct js_event)) > 0) {
+ while (read (fd, &e, sizeof(e)) > 0) {
process_event (e);
}
/* EAGAIN is returned when the queue is empty */
@@ -181,7 +181,7 @@ at a time using the typical read(2) functionality. For that, you would
replace the read above with something like
struct js_event mybuffer[0xff];
- int i = read (fd, mybuffer, sizeof(struct mybuffer));
+ int i = read (fd, mybuffer, ARRAY_SIZE(mybuffer));
In this case, read would return -1 if the queue was empty, or some
other value in which the number of events read would be i /
--
1.8.5.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] Input: joystick - use sizeof(VARIABLE) in documentation
2013-12-16 8:57 ` [PATCH 2/2] Input: joystick - use sizeof(VARIABLE) " Antonio Ospite
@ 2013-12-16 9:51 ` Dmitry Torokhov
2013-12-16 10:06 ` Antonio Ospite
0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Torokhov @ 2013-12-16 9:51 UTC (permalink / raw)
To: Antonio Ospite; +Cc: linux-input
Hi Antonio,
On Mon, Dec 16, 2013 at 09:57:15AM +0100, Antonio Ospite wrote:
> @@ -181,7 +181,7 @@ at a time using the typical read(2) functionality. For that, you would
> replace the read above with something like
>
> struct js_event mybuffer[0xff];
> - int i = read (fd, mybuffer, sizeof(struct mybuffer));
> + int i = read (fd, mybuffer, ARRAY_SIZE(mybuffer));
>
This is wrong, as ARRAY_SIZE(mybuffer) would be 0xff and not the size of
buffer in bytes. I'll fix it up.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] Input: joystick - use sizeof(VARIABLE) in documentation
2013-12-16 9:51 ` Dmitry Torokhov
@ 2013-12-16 10:06 ` Antonio Ospite
0 siblings, 0 replies; 5+ messages in thread
From: Antonio Ospite @ 2013-12-16 10:06 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input
On Mon, 16 Dec 2013 01:51:41 -0800
Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
> Hi Antonio,
>
> On Mon, Dec 16, 2013 at 09:57:15AM +0100, Antonio Ospite wrote:
> > @@ -181,7 +181,7 @@ at a time using the typical read(2) functionality. For that, you would
> > replace the read above with something like
> >
> > struct js_event mybuffer[0xff];
> > - int i = read (fd, mybuffer, sizeof(struct mybuffer));
> > + int i = read (fd, mybuffer, ARRAY_SIZE(mybuffer));
> >
>
> This is wrong, as ARRAY_SIZE(mybuffer) would be 0xff and not the size of
> buffer in bytes. I'll fix it up.
>
> Thanks.
You're right of course, thank you.
Ciao,
Antonio
--
Antonio Ospite
http://ao2.it
A: Because it messes up the order in which people normally read text.
See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-12-16 10:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-16 8:57 [PATCH 0/2] Input: joystick - documentation fixes Antonio Ospite
2013-12-16 8:57 ` [PATCH 1/2] Input: joystick - refer to /dev/input/js0 in documentation Antonio Ospite
2013-12-16 8:57 ` [PATCH 2/2] Input: joystick - use sizeof(VARIABLE) " Antonio Ospite
2013-12-16 9:51 ` Dmitry Torokhov
2013-12-16 10:06 ` Antonio Ospite
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.