updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / mpcs / ntv_module-newcamd.c.patch
blob7b09a2e2cd1ca22b9156a908c2d86ae693779f37
1 --- module-newcamd.c.orig 2008-12-12 20:17:14.000000000 +0200
2 +++ module-newcamd.c 2009-02-03 14:30:31.000000000 +0200
3 @@ -1,6 +1,6 @@
4 #include "globals.h"
6 -#define CWS_NETMSGSIZE 256
7 +#define CWS_NETMSGSIZE 256+3
9 typedef unsigned char uint8;
10 typedef unsigned short uint16;
11 @@ -83,7 +83,9 @@
12 return -1;
13 netbuf[0] = (len - 2) >> 8;
14 netbuf[1] = (len - 2) & 0xff;
15 - return send(handle, netbuf, len, 0);
16 + len=send(handle, netbuf, len, 0);
17 + cs_debug("nms: send len=%d", len);
18 + return len;
21 static int network_message_receive(int handle, uint16 *netMsgId, uint8 *buffer,
22 @@ -96,7 +98,9 @@
23 if (!buffer || handle < 0)
24 return -1;
25 len = recv(handle, netbuf, 2, 0);
26 - cs_debug("nmr(): len=%d, errno=%d", len, (len==-1)?errno:0);
27 + cs_debug("nmr(): len=%d, errno=%d, netbuf=(%X|%X)->(%X), %d > %d",
28 + len, (len==-1)?errno:0,netbuf[0],netbuf[1],(netbuf[0] << 8),
29 + ((netbuf[0] << 8) | netbuf[1]),(CWS_NETMSGSIZE - 2));
30 if (!len) {
31 cs_debug("nmr: 1 return 0");
32 network_tcp_connection_close(handle);
33 @@ -107,8 +111,9 @@
34 network_tcp_connection_close(handle);
35 return -1;
37 - if (((netbuf[0] << 8) | netbuf[1]) > CWS_NETMSGSIZE - 2) {
38 - cs_debug("nmr: 1 return -1");
39 + if (((netbuf[0] << 8) | netbuf[1]) > CWS_NETMSGSIZE - 2
40 + /*&& (netbuf[0] << 8)<=256*/ ) {
41 + cs_debug("nmr: 1 return -1, (%X | %X)",(netbuf[0] << 8) ,netbuf[1]);
42 return -1;
45 @@ -117,8 +122,9 @@
46 cs_debug("nmr: 2 return 0");
47 return 0;
49 + cs_debug("nmr(): 2 len=%d", len);
50 if (len != ((netbuf[0] << 8) | netbuf[1])) {
51 - cs_debug("nmr: 2 return -1");
52 + cs_debug("nmr: 2 return -1, (%X | %X)",(netbuf[0] << 8) ,netbuf[1]);
53 return -1;
55 len += 2;