Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Vincent Wei
web-display-server
Commits
38ab750c
Commit
38ab750c
authored
Jul 30, 2018
by
Vincent Wei
Browse files
debug
parent
40419611
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/unixsocket.c
View file @
38ab750c
...
...
@@ -139,7 +139,7 @@ static struct _demo_info {
char
*
const
exe_file
;
char
*
const
def_mode
;
}
_demo_list
[]
=
{
{
"mguxdemo"
,
"/usr/local/bin/"
,
"/usr/local/bin/mguxdemo"
,
"
480x64
0-16bpp"
},
{
"mguxdemo"
,
"/usr/local/bin/"
,
"/usr/local/bin/mguxdemo"
,
"
360x48
0-16bpp"
},
{
"cbplusui"
,
"/usr/local/bin/"
,
"/usr/local/bin/cbplusui"
,
"240x240-16bpp"
},
};
...
...
@@ -199,7 +199,6 @@ int us_on_connected (USClient* us_client)
/* read info of virtual frame buffer */
n
=
read
(
us_client
->
fd
,
&
header
,
sizeof
(
struct
_frame_header
));
if
(
n
<
sizeof
(
struct
_frame_header
)
||
header
.
type
!=
FT_VFBINFO
)
{
printf
(
"us_on_connected: frame header info: %ld, %d.
\n
"
,
n
,
header
.
type
);
retval
=
1
;
goto
error
;
}
...
...
@@ -272,7 +271,6 @@ int us_on_client_data (USClient* us_client)
}
if
(
n
<
sizeof
(
struct
_frame_header
))
{
printf
(
"us_on_client_data: read bytes %ld
\n
"
,
n
);
return
1
;
}
...
...
src/wdserver.c
View file @
38ab750c
...
...
@@ -168,20 +168,6 @@ onmessage (WSClient * client)
WSMessage
**
msg
=
&
client
->
message
;
printf
(
"INFO: got a message from client (%d): %s
\n
"
,
client
->
listener
,
(
*
msg
)
->
payload
);
uint32_t
hsize
=
sizeof
(
uint32_t
)
*
3
;
char
*
hdr
=
NULL
,
*
ptr
=
NULL
;
hdr
=
calloc
(
hsize
,
sizeof
(
char
));
ptr
=
hdr
;
ptr
+=
pack_uint32
(
ptr
,
client
->
listener
);
ptr
+=
pack_uint32
(
ptr
,
(
*
msg
)
->
opcode
);
ptr
+=
pack_uint32
(
ptr
,
(
*
msg
)
->
payloadsz
);
//ws_write_fifo (pipeout, hdr, hsize);
//ws_write_fifo (pipeout, (*msg)->payload, (*msg)->payloadsz);
free
(
hdr
);
return
0
;
}
...
...
src/websocket.c
View file @
38ab750c
...
...
@@ -2204,9 +2204,14 @@ handle_ws_writes (int conn, WSServer * server)
*
* On success, the number size of uint32_t is returned. */
size_t
pack_uint32
(
void
*
buf
,
uint32_t
val
)
pack_uint32
(
void
*
buf
,
uint32_t
val
,
int
convert
)
{
uint32_t
v32
=
htonl
(
val
);
uint32_t
v32
;
if
(
convert
)
v32
=
htonl
(
val
);
else
v32
=
val
;
memcpy
(
buf
,
&
v32
,
sizeof
(
uint32_t
));
return
sizeof
(
uint32_t
);
...
...
@@ -2216,11 +2221,14 @@ pack_uint32 (void *buf, uint32_t val)
*
* On success, the number size of uint32_t is returned. */
size_t
unpack_uint32
(
const
void
*
buf
,
uint32_t
*
val
)
unpack_uint32
(
const
void
*
buf
,
uint32_t
*
val
,
int
convert
)
{
uint32_t
v32
=
0
;
memcpy
(
&
v32
,
buf
,
sizeof
(
uint32_t
));
*
val
=
ntohl
(
v32
);
if
(
convert
)
*
val
=
ntohl
(
v32
);
else
*
val
=
v32
;
return
sizeof
(
uint32_t
);
}
...
...
@@ -2401,14 +2409,19 @@ ws_send_dirty_pixels (WSClient* ws_client, const RECT* rc_dirty, const char* png
goto
error
;
}
LOG
((
"Trying send content of file %s (size: %u) to client
\n
"
,
png_path
,
my_stat
.
st_size
));
p
=
xmalloc
(
sizeof
(
RECT
)
+
my_stat
.
st_size
);
//
LOG (("Trying send content of file %s (size: %u) to client\n", png_path, my_stat.st_size));
p
=
xmalloc
(
sizeof
(
uint32_t
)
*
4
+
my_stat
.
st_size
);
if
(
p
==
NULL
)
{
retval
=
3
;
goto
error
;
}
memcpy
(
p
,
rc_dirty
,
sizeof
(
RECT
));
char
*
ptr
;
ptr
=
p
;
ptr
+=
pack_uint32
(
ptr
,
(
uint32_t
)
rc_dirty
->
left
,
0
);
ptr
+=
pack_uint32
(
ptr
,
(
uint32_t
)
rc_dirty
->
top
,
0
);
ptr
+=
pack_uint32
(
ptr
,
(
uint32_t
)
rc_dirty
->
right
,
0
);
ptr
+=
pack_uint32
(
ptr
,
(
uint32_t
)
rc_dirty
->
bottom
,
0
);
fp
=
fopen
(
png_path
,
"r"
);
if
(
fp
==
NULL
)
{
...
...
@@ -2416,13 +2429,13 @@ ws_send_dirty_pixels (WSClient* ws_client, const RECT* rc_dirty, const char* png
goto
error
;
}
size
=
fread
(
p
+
sizeof
(
RECT
)
,
sizeof
(
char
),
my_stat
.
st_size
,
fp
);
size
=
fread
(
p
tr
,
sizeof
(
char
),
my_stat
.
st_size
,
fp
);
if
(
size
<
my_stat
.
st_size
)
{
retval
=
5
;
goto
error
;
}
retval
=
ws_send_data
(
ws_client
,
WS_OPCODE_BIN
,
p
,
sizeof
(
RECT
)
+
my_stat
.
st_size
);
retval
=
ws_send_data
(
ws_client
,
WS_OPCODE_BIN
,
p
,
sizeof
(
uint32_t
)
*
4
+
my_stat
.
st_size
);
error:
if
(
p
)
...
...
@@ -2446,8 +2459,7 @@ check_dirty_pixels (WSServer* server)
int
retval
;
char
png_path
[
20
];
printf
(
"check_dirty_pixels: UnixSocket Client #%d has dirty pixels (%d, %d, %d, %d) to send.
\n
"
,
us_client
->
pid
,
us_client
->
rc_dirty
.
left
,
us_client
->
rc_dirty
.
top
,
us_client
->
rc_dirty
.
right
,
us_client
->
rc_dirty
.
bottom
);
//LOG (("check_dirty_pixels: UnixSocket Client #%d has dirty pixels (%d, %d, %d, %d) to send.\n", us_client->pid, us_client->rc_dirty.left, us_client->rc_dirty.top, us_client->rc_dirty.right, us_client->rc_dirty.bottom));
sprintf
(
png_path
,
"/tmp/wds-%d.png"
,
us_client
->
pid
);
if
((
retval
=
save_dirty_pixels_to_png
(
png_path
,
us_client
)))
{
...
...
src/websocket.h
View file @
38ab750c
...
...
@@ -292,11 +292,12 @@ typedef struct WSServer_
#endif
}
WSServer
;
size_t
pack_uint32
(
void
*
buf
,
uint32_t
val
,
int
convert
);
size_t
unpack_uint32
(
const
void
*
buf
,
uint32_t
*
val
,
int
convert
);
int
ws_send_data
(
WSClient
*
client
,
WSOpcode
opcode
,
const
char
*
p
,
int
sz
);
int
ws_setfifo
(
const
char
*
pipename
);
int
ws_validate_string
(
const
char
*
str
,
int
len
);
size_t
pack_uint32
(
void
*
buf
,
uint32_t
val
);
size_t
unpack_uint32
(
const
void
*
buf
,
uint32_t
*
val
);
void
set_nonblocking
(
int
listener
);
void
ws_set_config_accesslog
(
const
char
*
accesslog
);
void
ws_set_config_echomode
(
int
echomode
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment