Use the normal byte ordering for them. Additionally, we were off by one byte when copying the the serial number data in UDP_Read().
Signed-off-by: Scott Talbert <s...@techie.net> --- libconcord/remote.cpp | 4 ++-- libconcord/remote_z.cpp | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libconcord/remote.cpp b/libconcord/remote.cpp index 81735c7..9cc0dbb 100644 --- a/libconcord/remote.cpp +++ b/libconcord/remote.cpp @@ -55,8 +55,8 @@ void setup_ri_pointers(TRemoteInfo &ri) void make_guid(const uint8_t * const in, char*&out) { char x[48]; - // usbnet remotes seem to use a more normal byte ordering for serial #'s - if (is_usbnet_remote() || is_mh_remote()) { + // Non-HID remotes seem to use a more normal byte ordering for serial #'s + if (is_z_remote() || is_mh_remote()) { sprintf(x, GUID_STR, in[0], in[1], in[2], in[3], in[4], in[5], in[6], in[7], in[8], in[9], in[10], in[11], in[12], in[13], in[14], in[15]); diff --git a/libconcord/remote_z.cpp b/libconcord/remote_z.cpp index f7ffa1a..1dfb905 100644 --- a/libconcord/remote_z.cpp +++ b/libconcord/remote_z.cpp @@ -125,9 +125,12 @@ int CRemoteZ_HID::UDP_Read(uint8_t &status, uint32_t &len, uint8_t *data) status = pkt[4]; } len = pkt[0] - 4; - //if(!len) return 0; - //memcpy(data, pkt + 6, len); - memcpy(data, pkt + 1, len + 3); + /* + * pkt[0] is the index of the last byte, which means it is equal to the + * length of the packet minus one byte. We want to copy everything but the + * first byte, so we copy pkt[0] bytes. + */ + memcpy(data, pkt + 1, pkt[0]); return 0; } -- 1.8.1.4 ------------------------------------------------------------------------------ See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk _______________________________________________ concordance-devel mailing list concordance-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/concordance-devel