diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-12-14 11:11:04 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-12-14 11:11:04 -0600 |
commit | 376ecd917eba449840e476eaeb21c78b3af0ec13 (patch) | |
tree | 16ac19827084fc92d5d0058d36ef49b35c5854d9 /apps/graphics/traveler | |
parent | 7dd014763ab79f0e906990b53640d2f2dbda1385 (diff) | |
download | px4-nuttx-376ecd917eba449840e476eaeb21c78b3af0ec13.tar.gz px4-nuttx-376ecd917eba449840e476eaeb21c78b3af0ec13.tar.bz2 px4-nuttx-376ecd917eba449840e476eaeb21c78b3af0ec13.zip |
SIM: Several fixes to the simulated joystick driver. Still buggy
Diffstat (limited to 'apps/graphics/traveler')
-rw-r--r-- | apps/graphics/traveler/src/trv_input.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/apps/graphics/traveler/src/trv_input.c b/apps/graphics/traveler/src/trv_input.c index a2275e131..5a7b7dbba 100644 --- a/apps/graphics/traveler/src/trv_input.c +++ b/apps/graphics/traveler/src/trv_input.c @@ -149,7 +149,7 @@ static int trv_joystick_wait(void) { int errcode = errno; - fprintf(stderr, "ERROR: sigwaitinfo() failed: %d\n", errcode); + fprintf(stderr, "ERROR: sigwaitinfo() failed: %d\n", errcode); return -errcode; } @@ -158,7 +158,7 @@ static int trv_joystick_wait(void) #endif /**************************************************************************** - * Name: trv_joystick_sample + * Name: trv_joystick_read * * Description: * Read one sample from the analog joystick @@ -524,18 +524,14 @@ void trv_input_read(void) #if defined(CONFIG_GRAPHICS_TRAVELER_JOYSTICK) #if defined(CONFIG_GRAPHICS_TRAVELER_AJOYSTICK) struct ajoy_sample_s sample; - ssize_t nread; + int ret; /* Read data from the analog joystick */ - nread = trv_joystick_read(&sample); - if (nread < 0) - { - trv_abort("ERROR: Joystick read error: %d\n", errno); - } - else if (nread != sizeof(struct ajoy_sample_s)) + ret = trv_joystick_read(&sample); + if (ret < 0) { - trv_abort("ERROR: Unexpected joystick read size: %ld\n", (long)nread); + trv_abort("ERROR: trv_joystick_read() failed: %d\n", ret); } /* Determine the input data to return to the POV logic */ |