Control: tags 963201 + patch

Dear maintainer,

I'd love to see flightgear get back into bullseye!  I see that it's been 
blocked for a while because it doesn't build on the s390x.

The HID bitfield extraction code assumes a little-endian machine, but the s390x 
is big-endian.  Enclosed is a patch to fix that.  I've written it as an NMU, 
but don't plan to actually upload it.

I haven't looked for other places that make that assumption.  I also haven't 
tried to verify that the HID code actually works right on an s390x.  But at 
least it builds now.

Regards.

diff -Nru flightgear-2020.1.3+dfsg/debian/changelog flightgear-2020.1.3+dfsg/debian/changelog
--- flightgear-2020.1.3+dfsg/debian/changelog	2020-07-13 01:50:46.000000000 -0700
+++ flightgear-2020.1.3+dfsg/debian/changelog	2020-09-28 14:32:08.000000000 -0700
@@ -1,3 +1,10 @@
+flightgear (1:2020.1.3+dfsg-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix HID extractBits for big-endian systems (Closes: #963201)
+
+ -- Joel Ray Holveck <jo...@piquan.org>  Mon, 28 Sep 2020 14:32:08 -0700
+
 flightgear (1:2020.1.3+dfsg-1) unstable; urgency=medium
 
   * New upstream version 2020.1.3+dfsg
diff -Nru flightgear-2020.1.3+dfsg/debian/patches/hid-bigendian.patch flightgear-2020.1.3+dfsg/debian/patches/hid-bigendian.patch
--- flightgear-2020.1.3+dfsg/debian/patches/hid-bigendian.patch	1969-12-31 16:00:00.000000000 -0800
+++ flightgear-2020.1.3+dfsg/debian/patches/hid-bigendian.patch	2020-09-28 14:32:08.000000000 -0700
@@ -0,0 +1,22 @@
+Index: flightgear-2020.1.3+dfsg/src/Input/FGHIDEventInput.cxx
+===================================================================
+--- flightgear-2020.1.3+dfsg.orig/src/Input/FGHIDEventInput.cxx
++++ flightgear-2020.1.3+dfsg/src/Input/FGHIDEventInput.cxx
+@@ -27,6 +27,8 @@
+ #include <cassert>
+ #include <algorithm>
+ 
++#include <endian.h>
++
+ #include <hidapi/hidapi.h>
+ #include <hidapi/hidparse.h>
+ 
+@@ -865,6 +867,8 @@ int extractBits(uint8_t* bytes, size_t l
+     uint32_t v = 0;
+     // this goes from byte alignment to word alignment safely
+     memcpy((void*) &v, bytes + wholeBytesToSkip, bytesToCopy);
++    // the memcpy arranges v in little-endian order, so swap if needed
++    v = le32toh(v);
+ 
+     // shift down so lowest bit is aligned
+     v = v >> offsetInByte;
diff -Nru flightgear-2020.1.3+dfsg/debian/patches/series flightgear-2020.1.3+dfsg/debian/patches/series
--- flightgear-2020.1.3+dfsg/debian/patches/series	2020-07-13 01:41:42.000000000 -0700
+++ flightgear-2020.1.3+dfsg/debian/patches/series	2020-09-28 14:32:08.000000000 -0700
@@ -6,3 +6,4 @@
 disable_some_failing_tests.patch
 disable-check-for-windows.h.patch
 0008-Disable-some-newly-failing-tests.patch
+hid-bigendian.patch

Reply via email to