Hi,

looking at the rest of the function - shouldn't the return value
of the ioctl() be checked, too?

Cheers,
Andre'

haithem rahmani wrote:
> Hi,
> 
> the current joystick input driver module is not working correctly.
> 
> running "dfbinfo" on a "Logitech RumblePad 2"  I'm getting:
> 
> Input (02) Joystick                        (primary joystick)
>    Type: JOYSTICK 
>    Caps: AXES BUTTONS 
>    Max. Axis: 8154629
>    Max. Button: 9715979
> 
> with the attached patch I'm getting the following result:
> 
> Input (02) Logitech Logitech RumblePad 2 USB  (primary joystick)
>    Type: JOYSTICK 
>    Caps: AXES BUTTONS 
>    Max. Axis: 5
>    Max. Button: 11
> 
> As you can notice in the patch I did two extra things:
> 
> - changed  "DFB_INPUT_DEVICE_DESC_NAME_LENGTH" from 32 to 40
> - changed the vendor string from "unkown" to ""
> 
> if the patch is correct can it be applied on the 1.4.x branch too?
> 
> regards
> Haithem.
> 
> -- 
> *
> /"If you ask a question - you will be a fool for 5 minutes, otherwise
> ignorant for rest of your life"/
> *
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> directfb-dev mailing list
> directfb-dev@directfb.org
> http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev
>From e6e5d00e9446356a03d1fdf151b749ff00cf1a12 Mon Sep 17 00:00:00 2001
From: Haithem Rahmani <haithem.rahm...@gmail.com>
Date: Tue, 20 Sep 2011 11:49:55 +0100
Subject: [PATCH] joystick: wrong number for buttons & axes read
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

When using the DirectFB joystick input module, a wrong number for
buttons and axes is read.

The API declares the variables used to get the number of buttons
and number of axes as 'char' (and not 'int').

Signed-off-by: André Draszik <andre.dras...@st.com>
---
 inputdrivers/joystick/joystick.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/inputdrivers/joystick/joystick.c b/inputdrivers/joystick/joystick.c
index 807c455..97c292c 100644
--- a/inputdrivers/joystick/joystick.c
+++ b/inputdrivers/joystick/joystick.c
@@ -191,7 +191,8 @@ driver_open_device( CoreInputDevice      *device,
                     InputDeviceInfo  *info,
                     void            **driver_data )
 {
-     int           fd, buttons, axes;
+     int           fd;
+     char          buttons, axes;
      JoystickData *data;
      char          devicename[20];
 
@@ -212,8 +213,10 @@ driver_open_device( CoreInputDevice      *device,
      }
 
      /* query number of buttons and axes */
-     ioctl( fd, JSIOCGBUTTONS, &buttons );
-     ioctl( fd, JSIOCGAXES, &axes );
+     if (ioctl( fd, JSIOCGBUTTONS, &buttons ) == -1)
+          buttons = 0;
+     if (ioctl( fd, JSIOCGAXES, &axes ) == -1)
+          axes = 0;
 
      /* fill device info structure */
      snprintf( info->desc.name,
-- 
1.7.1

_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to