This patch fixes the issue where some remotes do not get a successful
return from reset().
Scott
Certain remotes (e.g., the 785) do not get a successful return from a reset
command even though the reset succeeds. This patch causes this specific error
to be ignored and the reset function returns successfully. This fixes Debian
bug #584896.
Signed-off-by: Scott Talbert <s...@techie.net>
Index: libconcord/remote.cpp
===================================================================
RCS file: /cvsroot/concordance/concordance/libconcord/remote.cpp,v
retrieving revision 1.40
diff -u -p -r1.40 remote.cpp
--- libconcord/remote.cpp 27 Jul 2010 19:33:52 -0000 1.40
+++ libconcord/remote.cpp 14 Jan 2013 00:30:41 -0000
@@ -22,6 +22,7 @@
*/
#include <string.h>
+#include <errno.h>
#include "libconcord.h"
#include "lc_internal.h"
#include "hid.h"
@@ -69,8 +70,18 @@ void make_serial(uint8_t *ser, TRemoteIn
int CRemote::Reset(uint8_t kind)
{
uint8_t reset_cmd[64] = { COMMAND_RESET, kind };
+ int err;
- return HID_WriteReport(reset_cmd);
+ err = HID_WriteReport(reset_cmd);
+ /*
+ * Certain remotes (e.g., the 785) do not get a successful return from
+ * HID_WriteReport even though the reset succeeds. Ignore this.
+ */
+ if (err == -ENODEV) {
+ debug("Ignoring error from reset command");
+ err = 0;
+ }
+ return err;
}
/*
Index: libconcord/libusb/libusbhid.cpp
===================================================================
RCS file: /cvsroot/concordance/concordance/libconcord/libusb/libusbhid.cpp,v
retrieving revision 1.19
diff -u -p -r1.19 libusbhid.cpp
--- libconcord/libusb/libusbhid.cpp 17 Jul 2010 22:17:37 -0000 1.19
+++ libconcord/libusb/libusbhid.cpp 14 Jan 2013 00:30:41 -0000
@@ -33,6 +33,7 @@
#include <usb.h>
#endif
#include <errno.h>
+#include <string.h>
/*
* Harmonies either fall under logitech's VendorID (0x046d), and logitech's
@@ -214,7 +215,7 @@ int HID_WriteReport(const uint8_t *data)
if (err < 0) {
debug("Failed to write to device: %d (%s)", err,
- usb_strerror());
+ strerror(-err));
return err;
}
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel