From 376ecd917eba449840e476eaeb21c78b3af0ec13 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 14 Dec 2014 11:11:04 -0600 Subject: SIM: Several fixes to the simulated joystick driver. Still buggy --- apps/graphics/traveler/src/trv_input.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'apps/graphics') 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 */ -- cgit v1.2.3