Index: work/remote/animator/Makefile =================================================================== --- work/remote/animator/Makefile (nonexistent) +++ work/remote/animator/Makefile (revision 4706) @@ -0,0 +1,7 @@ +TRUNK=../../../trunk +P=/usr/lib +CFLAGS = -Wall -g -I$(TRUNK) +LDLIBS = $P/libporty_net_async.a $P/libporty_net.a $(TRUNK)/src_plugins/hid_remote/base64.o + +hid_anim: hid_anim.o + $(CC) $< $(LDLIBS) -o $@ Index: work/remote/animator/hid_anim.c =================================================================== --- work/remote/animator/hid_anim.c (nonexistent) +++ work/remote/animator/hid_anim.c (revision 4706) @@ -0,0 +1,49 @@ +#include +#include +#include +#include +#include "src_plugins/hid_remote/proto_lowcommon.h" +#include "src_plugins/hid_remote/proto_lowparse.h" + +static proto_ctx_t pctx; + +P_net_socket s_netin, s_netout; + +static void read_netin(void) +{ + P_size_t len, n; + char buff[1024], *s; + len = P_net_read(s_netin, buff, sizeof(buff)); + for(n = 0, s = buff; n < len; s++,n++) { + switch(parse_char(&pctx, *s)) { + case PRES_ERR: + fprintf(stderr, "Protocol error.\n"); + exit(1); + case PRES_PROCEED: + break; + case PRES_GOT_MSG: + printf("cmd\n"); + break; + } + } + +} + +int main() +{ + struct P_pollfd pfds[2]; + + if (P_net_async_stdio(&s_netin, &s_netout) != 0) { + fprintf(stderr, "Can't open stdio\n"); + return 1; + } + + pfds[0].fd = s_netin; + pfds[0].events = P_POLLIN; + + for(;;) { + P_poll(pfds, 1, 100); + if ((pfds[0].revents & P_POLLIN)) + read_netin(); + } +}