On 02/15/2014 06:09 PM, Scott Talbert wrote:
> On Sat, 15 Feb 2014, Phil Dibowitz wrote:
> 
>>> This fixes building on OSX as well as config-updates for 89x on OSX.
>>
>> Scott,
>>
>> Does this seem reasonable to you? Even though some things still don't work on
>> OSX, this fixes a TON of them. The only potentially scary part here is the
>> removal of the hid_exit() call...
> 
> Does what seem reasonable?  Did you intend to send another version of the 
> patch?  :-)  Because the one you sent back in Dec didn't have hid_exit 
> removed.

Oh, sorry, I thought the last one I sent was the most recent... but here.


-- 
Phil Dibowitz                             p...@ipom.com
Open Source software and tech docs        Insanity Palace of Metallica
http://www.phildev.net/                   http://www.ipom.com/

"Be who you are and say what you feel, because those who mind don't matter
 and those who matter don't mind."
 - Dr. Seuss

commit 2d9ee2fb8d49bed6e3406cf463a9887c6681a767
Author: Phil Dibowitz <p...@ipom.com>
Date:   Sun Dec 1 23:10:48 2013 -0800

    Various MacOSX fixes
    
    libconcord/configure.ac
    libconcord/Makefile.am
    libconcord/INSTALL
    * Start using pkg-config to find zlib - on OSX, some header files
      are in strange places
    
    libconcord/remote_z.cpp
    * For some reason the double-ack-read doesn't work in one instance
      on OSX. This is remote behavior, not host behavior, so I don't
      see how this is possible, but this is the only way I can make
      config updates on 890s work on OSX.
    
    libconcord/libhidapi.cpp
    * Do not call hid_exit() in ShutdownUSB() or we can never re-grab
      the remote after a reset.
    
    libconcord/hid.h
    * Update the default read timeout to 1s - required for Mac, and probably
      anything on USB1.
    
    Signed-off-by: Phil Dibowitz <p...@ipom.com>

diff --git a/libconcord/INSTALL.mac b/libconcord/INSTALL.mac
index 10d215a..d94e159 100644
--- a/libconcord/INSTALL.mac
+++ b/libconcord/INSTALL.mac
@@ -47,7 +47,13 @@ Finally, you will need to install libzip, which again is straight forward:
 1. BUILD THE LIBRARY
 
    As a normal user...
-     A. ***IF**** You are building from CVS, run "autoreconf --install"
+     A. ****IF**** You are building from git, run "autoreconf --install"
+        Note that if you're doing this on OSX, depending on your setup,
+        you may instead have to run:
+          aclocal -I /opt/pkgconfig/share/aclocal
+          autoheader
+          automake
+          autoconf
      B. Run "./configure"
      C. Run "make"
 
diff --git a/libconcord/Makefile.am b/libconcord/Makefile.am
index de6ae23..eda90d9 100644
--- a/libconcord/Makefile.am
+++ b/libconcord/Makefile.am
@@ -7,6 +7,7 @@ libconcord_la_SOURCES = remote.cpp remote_z.cpp libconcord.cpp binaryfile.cpp \
 	operationfile.cpp remote_mh.cpp libusbhid.cpp libhidapi.cpp
 include_HEADERS = libconcord.h
 libconcord_la_LDFLAGS = -version-info 3:0:0 $(LIBCONCORD_LDFLAGS) -lzip
+libconcord_la_CXXFLAGS = $(ZIP_CFLAGS)
 UDEVROOT ?= /
 UDEVLIBDIR ?= $(UDEVROOT)/lib
 
diff --git a/libconcord/configure.ac b/libconcord/configure.ac
index 48a453f..cc5898b 100644
--- a/libconcord/configure.ac
+++ b/libconcord/configure.ac
@@ -74,12 +74,7 @@ then
   fi
   AC_MSG_ERROR([$errorstr])
 fi
-AC_CHECK_HEADER(zip.h, [], [a=0])
-AC_CHECK_LIB(zip, zip_open, [], [a=0])
-if test $a == 0
-then
-    AC_MSG_ERROR([Error, libzip is missing!])
-fi
+PKG_CHECK_MODULES([ZIP], [libzip])
 AC_CONFIG_FILES([
     Makefile
 ])
diff --git a/libconcord/hid.h b/libconcord/hid.h
index 62bb369..a499d94 100644
--- a/libconcord/hid.h
+++ b/libconcord/hid.h
@@ -38,6 +38,6 @@ void ShutdownUSB();
 int FindRemote(THIDINFO &hid_info);
 
 int HID_WriteReport(const uint8_t *data);
-int HID_ReadReport(uint8_t *data, unsigned int timeout = 500);
+int HID_ReadReport(uint8_t *data, unsigned int timeout = 1000);
 
 #endif
diff --git a/libconcord/libhidapi.cpp b/libconcord/libhidapi.cpp
index 9acdbc7..f80bbf1 100644
--- a/libconcord/libhidapi.cpp
+++ b/libconcord/libhidapi.cpp
@@ -59,7 +59,11 @@ void ShutdownUSB()
     if (h_dev) {
         hid_close(h_dev);
     }
-    hid_exit();
+    /*
+     * Note we do NOT call hid_exit() here, because you can
+     * never reinitialize libhidapi - and on a reset, we need
+     * to come back and do more stuff.
+     */
 }
 
 bool is_harmony(struct hid_device_info *dev)
diff --git a/libconcord/remote_z.cpp b/libconcord/remote_z.cpp
index 2c4ddc2..4e1fa45 100644
--- a/libconcord/remote_z.cpp
+++ b/libconcord/remote_z.cpp
@@ -1437,6 +1437,13 @@ int CRemoteZ_HID::UpdateConfig(const uint32_t len, const uint8_t *wr,
         return LC_ERROR;
     }
 
+/*
+ * For some strange reason on OSX, the second ACK read fails, but
+ * the second one is the only one that actually claims to be
+ * from COMMAND_FINISH_UPDATE, so we just don't do that read
+ * or that verify, and move on, and things seem to work.
+ */
+#ifndef __APPLE__
     /* And then we should have the response we want. */
     if ((err = TCP_Read(status, rlen, rsp))) {
         debug("Failed to read from remote");
@@ -1449,6 +1456,7 @@ int CRemoteZ_HID::UpdateConfig(const uint32_t len, const uint8_t *wr,
         debug("Failed to read finish-update ack");
         return LC_ERROR;
     }
+#endif
     cb(LC_CB_STAGE_FINALIZE_UPDATE, cb_count++, 5, 6, LC_CB_COUNTER_TYPE_STEPS,
        cb_arg, NULL);
 

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel

Reply via email to