Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Jun 2021 01:13:37 GMT
From:      Kevin Bowling <kbowling@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 3103c302f541 - main - graphics/freeglut: update to 3.2.1
Message-ID:  <202106290113.15T1DbIm074710@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kbowling:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3103c302f541276ffc05e4aee6ec3d867e4c0e08

commit 3103c302f541276ffc05e4aee6ec3d867e4c0e08
Author:     Zsolt Udvari <uzsolt@uzsolt.hu>
AuthorDate: 2021-06-28 23:53:19 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2021-06-29 01:13:03 +0000

    graphics/freeglut: update to 3.2.1
    
    The x11 team is unaware of issues relating to joystick support with this
    update or the previous version.  Please file a PR with x11@ if you
    experience a problem or if we can remove the pkg-message.
    
    PR:             254454
    Approved by:    x11
---
 graphics/freeglut/Makefile                         |   3 +-
 graphics/freeglut/distinfo                         |   5 +-
 graphics/freeglut/files/patch-src_fg__joystick.c   | 304 ------------------
 .../files/patch-src_x11_fg__joystick__x11.c        | 357 ++++++++++++++++-----
 graphics/freeglut/pkg-plist                        |  13 +-
 5 files changed, 291 insertions(+), 391 deletions(-)

diff --git a/graphics/freeglut/Makefile b/graphics/freeglut/Makefile
index 019f5eeaf54f..22c2bddd9eb7 100644
--- a/graphics/freeglut/Makefile
+++ b/graphics/freeglut/Makefile
@@ -1,8 +1,7 @@
 # Created by: thierry@pompo.net
 
 PORTNAME=	freeglut
-PORTVERSION=	3.0.0
-PORTREVISION=	3
+PORTVERSION=	3.2.1
 CATEGORIES=	graphics
 MASTER_SITES=	SF
 
diff --git a/graphics/freeglut/distinfo b/graphics/freeglut/distinfo
index 4397410fd619..3e2f66098b02 100644
--- a/graphics/freeglut/distinfo
+++ b/graphics/freeglut/distinfo
@@ -1,2 +1,3 @@
-SHA256 (freeglut-3.0.0.tar.gz) = 2a43be8515b01ea82bcfa17d29ae0d40bd128342f0930cd1f375f1ff999f76a2
-SIZE (freeglut-3.0.0.tar.gz) = 419095
+TIMESTAMP = 1616308723
+SHA256 (freeglut-3.2.1.tar.gz) = d4000e02102acaf259998c870e25214739d1f16f67f99cb35e4f46841399da68
+SIZE (freeglut-3.2.1.tar.gz) = 440228
diff --git a/graphics/freeglut/files/patch-src_fg__joystick.c b/graphics/freeglut/files/patch-src_fg__joystick.c
deleted file mode 100644
index 3618d8db200d..000000000000
--- a/graphics/freeglut/files/patch-src_fg__joystick.c
+++ /dev/null
@@ -1,304 +0,0 @@
---- src/fg_joystick.c.orig	2014-10-20 15:27:04 UTC
-+++ src/fg_joystick.c
-@@ -40,238 +40,6 @@
- #define JS_TRUE  1
- #define JS_FALSE 0
- 
--/* BSD defines from "jsBSD.cxx" around lines 42-270 */
--
--#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
--
--#    ifdef HAVE_USB_JS
--#        if defined(__NetBSD__)
--/* XXX The below hack is done until freeglut's autoconf is updated. */
--#            define HAVE_USBHID_H 1
--#            ifdef HAVE_USBHID_H
--#                include <usbhid.h>
--#            else
--#                include <usb.h>
--#            endif
--#        elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
--#            ifdef HAVE_USBHID_H
--#                include <usbhid.h>
--#            else
--#                include <libusbhid.h>
--#            endif
--#        endif
--#        include <legacy/dev/usb/usb.h>
--#        include <dev/usb/usbhid.h>
--
--/* Compatibility with older usb.h revisions */
--#        if !defined(USB_MAX_DEVNAMES) && defined(MAXDEVNAMES)
--#            define USB_MAX_DEVNAMES MAXDEVNAMES
--#        endif
--#    endif
--
--static int hatmap_x[9] = { 0, 0, 1, 1, 1, 0, -1, -1, -1 };
--static int hatmap_y[9] = { 0, 1, 1, 0, -1, -1, -1, 0, 1 };
--struct os_specific_s {
--  char             fname [128 ];
--  int              fd;
--  int              is_analog;
--  /* The following structure members are specific to analog joysticks */
--  struct joystick  ajs;
--#    ifdef HAVE_USB_JS
--  /* The following structure members are specific to USB joysticks */
--  struct hid_item *hids;
--  int              hid_dlen;
--  int              hid_offset;
--  char            *hid_data_buf;
--  int              axes_usage [ _JS_MAX_AXES ];
--#    endif
--  /* We keep button and axes state ourselves, as they might not be updated
--   * on every read of a USB device
--   */
--  int              cache_buttons;
--  float            cache_axes [ _JS_MAX_AXES ];
--};
--
--/* Idents lower than USB_IDENT_OFFSET are for analog joysticks. */
--#    define USB_IDENT_OFFSET    2
--
--#    define USBDEV "/dev/usb"
--#    define UHIDDEV "/dev/uhid"
--#    define AJSDEV "/dev/joy"
--
--#    ifdef HAVE_USB_JS
--/*
-- * fghJoystickFindUSBdev (and its helper, fghJoystickWalkUSBdev) try to locate
-- * the full name of a USB device. If /dev/usbN isn't readable, we punt and
-- * return the uhidN device name. We warn the user of this situation once.
-- */
--static char *fghJoystickWalkUSBdev(int f, char *dev, char *out, int outlen)
--{
--  struct usb_device_info di;
--  int i, a;
--  char *cp;
--
--  for (a = 1; a < USB_MAX_DEVICES; a++) {
--    di.udi_addr = a;
--    if (ioctl(f, USB_DEVICEINFO, &di) != 0)
--      return NULL;
--    for (i = 0; i < USB_MAX_DEVNAMES; i++)
--      if (di.udi_devnames[i][0] &&
--          strcmp(di.udi_devnames[i], dev) == 0) {
--        cp =  calloc( 1, strlen(di.udi_vendor) + strlen(di.udi_product) + 2);
--        strcpy(cp, di.udi_vendor);
--        strcat(cp, " ");
--        strcat(cp, di.udi_product);
--        strncpy(out, cp, outlen - 1);
--        out[outlen - 1] = 0;
--        free( cp );
--        return out;
--      }
--  }
--  return NULL;
--}
--
--static int fghJoystickFindUSBdev(char *name, char *out, int outlen)
--{
--  int i, f;
--  char buf[50];
--  char *cp;
--  static int protection_warned = 0;
--
--  for (i = 0; i < 16; i++) {
--    snprintf(buf, sizeof(buf), "%s%d", USBDEV, i);
--    f = open(buf, O_RDONLY);
--    if (f >= 0) {
--      cp = fghJoystickWalkUSBdev(f, name, out, outlen);
--      close(f);
--      if (cp)
--        return 1;
--    }
--    else if (errno == EACCES) {
--      if (!protection_warned) {
--        fgWarning ( "Can't open %s for read!", buf );
--        protection_warned = 1;
--      }
--    }
--  }
--  return 0;
--}
--
--static int fghJoystickInitializeHID(struct os_specific_s *os,
--       int *num_axes, int *num_buttons)
--{
--    int size, is_joystick;
--#   ifdef HAVE_USBHID_H
--        int report_id = 0;
--#   endif
--    struct hid_data *d;
--    struct hid_item h;
--    report_desc_t rd;
--
--    if ( ( rd = hid_get_report_desc( os->fd ) ) == 0 )
--    {
--        fgWarning ( "error: %s: %s", os->fname, strerror( errno ) );
--        return FALSE;
--    }
--
--    os->hids = NULL;
--
--#   ifdef HAVE_USBHID_H
--        if( ioctl( os->fd, USB_GET_REPORT_ID, &report_id ) < 0)
--        {
--            /*** XXX {report_id} may not be the right variable? ***/
--            fgWarning ( "error: %s%d: %s", UHIDDEV, report_id, strerror( errno ) );
--            return FALSE;
--        }
--
--        size = hid_report_size( rd, hid_input, report_id );
--#   else
--        size = hid_report_size( rd, 0, hid_input );
--#   endif
--    os->hid_data_buf = calloc( 1, size );
--    os->hid_dlen = size;
--
--    is_joystick = 0;
--#   ifdef HAVE_USBHID_H
--        d = hid_start_parse( rd, 1 << hid_input, report_id );
--#   else
--        d = hid_start_parse( rd, 1 << hid_input );
--#   endif
--        while( hid_get_item( d, &h ) )
--        {
--            int usage, page, interesting_hid;
--
--            page = HID_PAGE( h.usage );
--            usage = HID_USAGE( h.usage );
--
--            /* This test is somewhat too simplistic, but this is how MicroSoft
--             * does, so I guess it works for all joysticks/game pads. */
--            is_joystick = is_joystick ||
--                ( h.kind == hid_collection &&
--                  page == HUP_GENERIC_DESKTOP &&
--                  ( usage == HUG_JOYSTICK || usage == HUG_GAME_PAD ) );
--
--            if( h.kind != hid_input )
--                continue;
--
--            if( !is_joystick )
--                continue;
--
--            interesting_hid = TRUE;
--            if( page == HUP_GENERIC_DESKTOP )
--            {
--                switch( usage )
--                {
--                case HUG_X:
--                case HUG_RX:
--                case HUG_Y:
--                case HUG_RY:
--                case HUG_Z:
--                case HUG_RZ:
--                case HUG_SLIDER:
--                    if( *num_axes < _JS_MAX_AXES )
--                    {
--                        os->axes_usage[ *num_axes ] = usage;
--                        ( *num_axes )++;
--                    }
--                    break;
--                case HUG_HAT_SWITCH:
--                    /* Allocate two axes for a hat */
--                    if( *num_axes + 1 < _JS_MAX_AXES )
--                    {
--                        os->axes_usage[ *num_axes ] = usage;
--                        (*num_axes)++;
--                        os->axes_usage[ *num_axes ] = usage;
--                        (*num_axes)++;
--                    }
--                    break;
--                default:
--                    interesting_hid = FALSE;
--                    break;
--                }
--            }
--            else if( page == HUP_BUTTON )
--            {
--                interesting_hid = ( usage > 0 ) &&
--                    ( usage <= _JS_MAX_BUTTONS );
--
--                if( interesting_hid && usage - 1 > *num_buttons )
--                    *num_buttons = usage - 1;
--            }
--
--            if( interesting_hid )
--            {
--                h.next = os->hids;
--                os->hids = calloc( 1, sizeof ( struct hid_item ) );
--                *os->hids = h;
--            }
--        }
--        hid_end_parse( d );
--
--        return os->hids != NULL;
--}
--#    endif
--#endif
- 
- /*
-  * Functions associated with the "jsJoystick" class in PLIB
-@@ -306,26 +74,6 @@ extern void fgPlatformJoystickClose ( in
- #define MAX_NUM_JOYSTICKS  2
- SFG_Joystick *fgJoystick [ MAX_NUM_JOYSTICKS ];
- 
--/*
-- * Read the raw joystick data
-- */
--static void fghJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
--{
--    int i;
--
--    /* Defaults */
--    if( buttons )
--        *buttons = 0;
--
--    if( axes )
--        for( i = 0; i < joy->num_axes; i++ )
--            axes[ i ] = 1500.0f;
--
--    if( joy->error )
--        return;
--
--	fgPlatformJoystickRawRead ( joy, buttons, axes );
--}
- 
- /*
-  * Correct the joystick axis data
-@@ -384,7 +132,7 @@ static void fghJoystickRead( SFG_Joystic
-                 axes[ i ] = 0.0f;
-     }
- 
--    fghJoystickRawRead( joy, buttons, raw_axes );
-+    fgJoystickRawRead( joy, buttons, raw_axes );
- 
-     if( axes )
-         for( i=0; i<joy->num_axes; i++ )
-@@ -966,6 +714,26 @@ int fgJoystickDetect( void )
- }
- 
- /*
-+ * Read the raw joystick data
-+ */
-+void fgJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
-+{
-+    int i;
-+
-+    /* Defaults */
-+    if( buttons )
-+        *buttons = 0;
-+
-+    if( axes )
-+        for( i = 0; i < joy->num_axes; i++ )
-+            axes[ i ] = 1500.0f;
-+
-+    if( joy->error )
-+        return;
-+
-+	fgPlatformJoystickRawRead ( joy, buttons, axes );
-+}
-+/*
-  * Joystick information, setup and execution functions
-  */
- 
diff --git a/graphics/freeglut/files/patch-src_x11_fg__joystick__x11.c b/graphics/freeglut/files/patch-src_x11_fg__joystick__x11.c
index e2cd05f3593e..4479c1675715 100644
--- a/graphics/freeglut/files/patch-src_x11_fg__joystick__x11.c
+++ b/graphics/freeglut/files/patch-src_x11_fg__joystick__x11.c
@@ -1,23 +1,116 @@
---- src/x11/fg_joystick_x11.c.orig	2014-12-02 05:22:12 UTC
+--- src/x11/fg_joystick_x11.c.orig	2021-03-21 08:11:11 UTC
 +++ src/x11/fg_joystick_x11.c
-@@ -46,6 +46,183 @@
- #define MAX_NUM_JOYSTICKS  2   
- extern SFG_Joystick *fgJoystick [ MAX_NUM_JOYSTICKS ];
+@@ -41,196 +41,135 @@
+ 
+ #include <fcntl.h>
+ 
++/*this should be defined in a header file */
++#define MAX_NUM_JOYSTICKS  2
  
-+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+-/* BSD defines from "jsBSD.cxx" around lines 42-270 */
+-
+ #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+-
+-#    ifdef HAVE_USB_JS
+-#        if defined(__NetBSD__)
+-#            ifdef HAVE_USBHID_H
+-#                include <usbhid.h>
+-#            else
+-#                include <usb.h>
+-#            endif
+-#            include <dev/usb/usb.h>
+-#        elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+-#            ifdef HAVE_USBHID_H
+-#                include <usbhid.h>
+-#            else
+-#                include <libusbhid.h>
+-#            endif
+-#            include <legacy/dev/usb/usb.h>
+-#        endif
+-#        include <dev/usb/usbhid.h>
+-
+-/* Compatibility with older usb.h revisions */
+-#        if !defined(USB_MAX_DEVNAMES) && defined(MAXDEVNAMES)
+-#            define USB_MAX_DEVNAMES MAXDEVNAMES
+-#        endif
+-#    endif
+-
+-struct os_specific_s {
+-  char             fname [128 ];
+-  int              fd;
+-  int              is_analog;
+-  /* The following structure members are specific to analog joysticks */
+-  struct joystick  ajs;
+-#    ifdef HAVE_USB_JS
+-  /* The following structure members are specific to USB joysticks */
+-  struct hid_item *hids;
+-  int              hid_dlen;
+-  int              hid_offset;
+-  char            *hid_data_buf;
+-  int              axes_usage [ _JS_MAX_AXES ];
+-#    endif
+-  /* We keep button and axes state ourselves, as they might not be updated
+-   * on every read of a USB device
+-   */
+-  int              cache_buttons;
+-  float            cache_axes [ _JS_MAX_AXES ];
+-};
+-
+-/* Idents lower than USB_IDENT_OFFSET are for analog joysticks. */
+-#    define USB_IDENT_OFFSET    2
+-
+-#    define USBDEV "/dev/usb"
+-#    define UHIDDEV "/dev/uhid"
+-#    define AJSDEV "/dev/joy"
+-
+-
+-#endif
+-
+-#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+-
+-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+-static int hatmap_x[9] = {0, 0, 1, 1, 1, 0, -1, -1, -1};
+-static int hatmap_y[9] = {0, 1, 1, 0, -1, -1, -1, 0, 1};
+-
+-#    ifdef HAVE_USB_JS
 +#  ifdef HAVE_USB_JS
-+/*
+ /*
+-* fghJoystickFindUSBdev (and its helper, fghJoystickWalkUSBdev) try to locate
+-* the full name of a USB device. If /dev/usbN isn't readable, we punt and
+-* return the uhidN device name. We warn the user of this situation once.
+-*/
 + * fghJoystickFindUSBdev (and its helper, fghJoystickWalkUSBdev) try to locate
 + * the full name of a USB device. If /dev/usbN isn't readable, we punt and
 + * return the uhidN device name. We warn the user of this situation once.
 + */
-+static char *fghJoystickWalkUSBdev(int f, char *dev, char *out, int outlen)
-+{
+ static char *fghJoystickWalkUSBdev(int f, char *dev, char *out, int outlen)
+ {
+-    struct usb_device_info di;
+-    int i, a;
+-    char *cp;
 +#if __FreeBSD_version < 800061
 +  struct usb_device_info di;
 +  int i, a;
 +  char *cp;
-+
+ 
+-    for (a = 1; a < USB_MAX_DEVICES; a++) {
+-        di.udi_addr = a;
+-        if (ioctl(f, USB_DEVICEINFO, &di) != 0)
+-            return NULL;
+-        for (i = 0; i < USB_MAX_DEVNAMES; i++)
+-            if (di.udi_devnames[i][0] &&
+-                strcmp(di.udi_devnames[i], dev) == 0) {
+-                cp = calloc(1, strlen(di.udi_vendor) + strlen(di.udi_product) + 2);
+-                strcpy(cp, di.udi_vendor);
+-                strcat(cp, " ");
+-                strcat(cp, di.udi_product);
+-                strncpy(out, cp, outlen - 1);
+-                out[outlen - 1] = 0;
+-                free(cp);
+-                return out;
+-            }
+-    }
+-    return NULL;
 +  for (a = 1; a < USB_MAX_DEVICES; a++) {
 +    di.udi_addr = a;
 +    if (ioctl(f, USB_DEVICEINFO, &di) != 0)
@@ -37,15 +130,34 @@
 +  }
 +#endif
 +  return NULL;
-+}
-+
-+static int fghJoystickFindUSBdev(char *name, char *out, int outlen)
-+{
+ }
+ 
+ static int fghJoystickFindUSBdev(char *name, char *out, int outlen)
+ {
+-    int i, f;
+-    char buf[50];
+-    char *cp;
+-    static int protection_warned = 0;
 +  int i, f;
 +  char buf[50];
 +  char *cp;
 +  static int protection_warned = 0;
-+
+ 
+-    for (i = 0; i < 16; i++) {
+-        snprintf(buf, sizeof(buf), "%s%d", USBDEV, i);
+-        f = open(buf, O_RDONLY);
+-        if (f >= 0) {
+-            cp = fghJoystickWalkUSBdev(f, name, out, outlen);
+-            close(f);
+-            if (cp)
+-                return 1;
+-        }
+-        else if (errno == EACCES) {
+-            if (!protection_warned) {
+-                fgWarning("Can't open %s for read!", buf);
+-                protection_warned = 1;
+-            }
+-        }
 +  for (i = 0; i < 16; i++) {
 +    snprintf(buf, sizeof(buf), "%s%d", USBDEV, i);
 +    f = open(buf, O_RDONLY);
@@ -54,7 +166,8 @@
 +      close(f);
 +      if (cp)
 +        return 1;
-+    }
+     }
+-    return 0;
 +    else if (errno == EACCES) {
 +      if (!protection_warned) {
 +        fgWarning ( "Can't open %s for read!", buf );
@@ -63,128 +176,190 @@
 +    }
 +  }
 +  return 0;
-+}
-+
-+static int fghJoystickInitializeHID(struct os_specific_s *os,
+ }
+-#endif
+ 
+ static int fghJoystickInitializeHID(struct os_specific_s *os,
+-                                    int *num_axes, int *num_buttons)
 +       int *num_axes, int *num_buttons)
-+{
-+    int size, is_joystick;
-+#   ifdef HAVE_USBHID_H
+ {
+     int size, is_joystick;
+ #   ifdef HAVE_USBHID_H
+-    int report_id = 0;
 +        int report_id = 0;
-+#   endif
-+    struct hid_data *d;
-+    struct hid_item h;
-+    report_desc_t rd;
-+
+ #   endif
+     struct hid_data *d;
+     struct hid_item h;
+     report_desc_t rd;
+ 
+-    if ((rd = hid_get_report_desc(os->fd)) == 0)
 +    if ( ( rd = hid_get_report_desc( os->fd ) ) == 0 )
-+    {
+     {
+-        fgWarning("error: %s: %s", os->fname, strerror(errno));
 +        fgWarning ( "error: %s: %s", os->fname, strerror( errno ) );
-+        return FALSE;
-+    }
-+
-+    os->hids = NULL;
-+
-+#   ifdef HAVE_USBHID_H
+         return FALSE;
+     }
+ 
+     os->hids = NULL;
+ 
+ #   ifdef HAVE_USBHID_H
+-    if (ioctl(os->fd, USB_GET_REPORT_ID, &report_id) < 0)
+-    {
+-        /*** XXX {report_id} may not be the right variable? ***/
+-        fgWarning("error: %s%d: %s", UHIDDEV, report_id, strerror(errno));
+-        return FALSE;
+-    }
 +        if( ioctl( os->fd, USB_GET_REPORT_ID, &report_id ) < 0)
 +        {
 +            /*** XXX {report_id} may not be the right variable? ***/
 +            fgWarning ( "error: %s%d: %s", UHIDDEV, report_id, strerror( errno ) );
 +            return FALSE;
 +        }
-+
+ 
+-    size = hid_report_size(rd, hid_input, report_id);
 +        size = hid_report_size( rd, hid_input, report_id );
-+#   else
+ #   else
+-    size = hid_report_size(rd, 0, hid_input);
 +        size = hid_report_size( rd, 0, hid_input );
-+#   endif
+ #   endif
+-    os->hid_data_buf = calloc(1, size);
 +    os->hid_data_buf = calloc( 1, size );
-+    os->hid_dlen = size;
-+
-+    is_joystick = 0;
-+#   ifdef HAVE_USBHID_H
+     os->hid_dlen = size;
+ 
+     is_joystick = 0;
+ #   ifdef HAVE_USBHID_H
+-    d = hid_start_parse(rd, 1 << hid_input, report_id);
 +        d = hid_start_parse( rd, 1 << hid_input, report_id );
-+#   else
+ #   else
+-    d = hid_start_parse(rd, 1 << hid_input);
 +        d = hid_start_parse( rd, 1 << hid_input );
-+#   endif
+ #   endif
+-    while (hid_get_item(d, &h))
+-    {
+-        int usage, page, interesting_hid;
 +        while( hid_get_item( d, &h ) )
 +        {
 +            int usage, page, interesting_hid;
-+
+ 
+-        page = HID_PAGE(h.usage);
+-        usage = HID_USAGE(h.usage);
 +            page = HID_PAGE( h.usage );
 +            usage = HID_USAGE( h.usage );
-+
+ 
+-        /* This test is somewhat too simplistic, but this is how MicroSoft
+-        * does, so I guess it works for all joysticks/game pads. */
+-        is_joystick = is_joystick ||
+-            (h.kind == hid_collection &&
+-             page == HUP_GENERIC_DESKTOP &&
+-             (usage == HUG_JOYSTICK || usage == HUG_GAME_PAD));
 +            /* This test is somewhat too simplistic, but this is how MicroSoft
 +             * does, so I guess it works for all joysticks/game pads. */
 +            is_joystick = is_joystick ||
 +                ( h.kind == hid_collection &&
 +                  page == HUP_GENERIC_DESKTOP &&
 +                  ( usage == HUG_JOYSTICK || usage == HUG_GAME_PAD ) );
-+
+ 
+-        if (h.kind != hid_input)
+-            continue;
 +            if( h.kind != hid_input )
 +                continue;
-+
+ 
+-        if (!is_joystick)
+-            continue;
 +            if( !is_joystick )
 +                continue;
-+
+ 
+-        interesting_hid = TRUE;
+-        if (page == HUP_GENERIC_DESKTOP)
+-        {
+-            switch (usage)
 +            interesting_hid = TRUE;
 +            if( page == HUP_GENERIC_DESKTOP )
-+            {
+             {
 +                switch( usage )
 +                {
-+                case HUG_X:
-+                case HUG_RX:
-+                case HUG_Y:
-+                case HUG_RY:
-+                case HUG_Z:
-+                case HUG_RZ:
-+                case HUG_SLIDER:
+                 case HUG_X:
+                 case HUG_RX:
+                 case HUG_Y:
+@@ -238,53 +177,51 @@ static int fghJoystickInitializeHID(struct os_specific
+                 case HUG_Z:
+                 case HUG_RZ:
+                 case HUG_SLIDER:
+-                    if (*num_axes < _JS_MAX_AXES)
 +                    if( *num_axes < _JS_MAX_AXES )
-+                    {
+                     {
+-                        os->axes_usage[*num_axes] = usage;
+-                        (*num_axes)++;
 +                        os->axes_usage[ *num_axes ] = usage;
 +                        ( *num_axes )++;
-+                    }
-+                    break;
-+                case HUG_HAT_SWITCH:
-+                    /* Allocate two axes for a hat */
+                     }
+                     break;
+                 case HUG_HAT_SWITCH:
+                     /* Allocate two axes for a hat */
+-                    if (*num_axes + 1 < _JS_MAX_AXES)
 +                    if( *num_axes + 1 < _JS_MAX_AXES )
-+                    {
+                     {
+-                        os->axes_usage[*num_axes] = usage;
 +                        os->axes_usage[ *num_axes ] = usage;
-+                        (*num_axes)++;
+                         (*num_axes)++;
+-                        os->axes_usage[*num_axes] = usage;
 +                        os->axes_usage[ *num_axes ] = usage;
-+                        (*num_axes)++;
-+                    }
-+                    break;
-+                default:
-+                    interesting_hid = FALSE;
-+                    break;
+                         (*num_axes)++;
+                     }
+                     break;
+                 default:
+                     interesting_hid = FALSE;
+                     break;
 +                }
-+            }
+             }
+-        }
+-        else if (page == HUP_BUTTON)
+-        {
+-            interesting_hid = (usage > 0) &&
+-                (usage <= _JS_MAX_BUTTONS);
 +            else if( page == HUP_BUTTON )
 +            {
 +                interesting_hid = ( usage > 0 ) &&
 +                    ( usage <= _JS_MAX_BUTTONS );
-+
+ 
+-            if (interesting_hid && usage - 1 > *num_buttons)
+-                *num_buttons = usage - 1;
+-        }
 +                if( interesting_hid && usage - 1 > *num_buttons )
 +                    *num_buttons = usage - 1;
 +            }
-+
+ 
+-        if (interesting_hid)
+-        {
+-            h.next = os->hids;
+-            os->hids = calloc(1, sizeof(struct hid_item));
+-            *os->hids = h;
 +            if( interesting_hid )
 +            {
 +                h.next = os->hids;
 +                os->hids = calloc( 1, sizeof ( struct hid_item ) );
 +                *os->hids = h;
 +            }
-+        }
+         }
+-    }
+-    hid_end_parse(d);
 +        hid_end_parse( d );
-+
+ 
+-    return os->hids != NULL;
 +        return os->hids != NULL;
-+}
+ }
+-#    endif
+-#endif
 +#  endif /* HAVE_USB_JS */
 +#endif /* FreeBSD or NetBSD */
-+
+ 
+ 
+-/*this should be defined in a header file */
+-#define MAX_NUM_JOYSTICKS  2
+ extern SFG_Joystick *fgJoystick [ MAX_NUM_JOYSTICKS ];
+ 
  void fgPlatformJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
- {
-     int status;
-@@ -259,7 +436,7 @@ void fgPlatformJoystickOpen( SFG_Joystic
+@@ -500,7 +437,7 @@ void fgPlatformJoystickOpen( SFG_Joystick* joy )
          joy->num_axes    =  2;
          joy->num_buttons = 32;
  
@@ -193,7 +368,7 @@
          joy->error = axes[ 0 ] < -1000000000.0f;
          if( joy->error )
              return;
-@@ -379,7 +556,7 @@ void fgPlatformJoystickOpen( SFG_Joystic
+@@ -620,7 +557,7 @@ void fgPlatformJoystickOpen( SFG_Joystick* joy )
  
      do
      {
@@ -202,3 +377,27 @@
          counter++;
      } while( !joy->error &&
               counter < 100 &&
+@@ -647,6 +584,23 @@ void fgPlatformJoystickOpen( SFG_Joystick* joy )
+ #endif
+ }
+ 
++void fgJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
++{
++    int i;
++
++    /* Defaults */
++    if( buttons )
++        *buttons = 0;
++
++    if( axes )
++        for( i = 0; i < joy->num_axes; i++ )
++            axes[ i ] = 1500.0f;
++
++    if( joy->error )
++        return;
++
++	fgPlatformJoystickRawRead ( joy, buttons, axes );
++}
+ 
+ void fgPlatformJoystickInit( SFG_Joystick *fgJoystick[], int ident )
+ {
diff --git a/graphics/freeglut/pkg-plist b/graphics/freeglut/pkg-plist
index 9d4865b46687..0ff52f8015d2 100644
--- a/graphics/freeglut/pkg-plist
+++ b/graphics/freeglut/pkg-plist
@@ -1,24 +1,29 @@
 include/GL/freeglut.h
 include/GL/freeglut_ext.h
 include/GL/freeglut_std.h
+include/GL/freeglut_ucall.h
 include/GL/glut.h
+lib/cmake/FreeGLUT/FreeGLUTConfig.cmake
+lib/cmake/FreeGLUT/FreeGLUTConfigVersion.cmake
+lib/cmake/FreeGLUT/FreeGLUTTargets-%%CMAKE_BUILD_TYPE%%.cmake
+lib/cmake/FreeGLUT/FreeGLUTTargets.cmake
 lib/libglut.a
 lib/libglut.so
 lib/libglut.so.3
-lib/libglut.so.3.10.0
-libdata/pkgconfig/freeglut.pc
+lib/libglut.so.3.11.0
+libdata/pkgconfig/glut.pc
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/CallbackMaker
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/Fractals
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/Fractals_random
-%%PORTEXAMPLES%%%%EXAMPLESDIR%%/fractals.dat
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/Lorenz
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/One
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/Resizer
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/fractals.dat
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/multi-touch
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/shapes
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/smooth_opengl3
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/spaceball
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/subwin
-%%PORTEXAMPLES%%%%EXAMPLESDIR%%/shapes
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/timer
 %%PORTDOCS%%%%DOCSDIR%%/download.html
 %%PORTDOCS%%%%DOCSDIR%%/freeglut.html



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106290113.15T1DbIm074710>