X-Git-Url: https://git.realraum.at/?p=svn42.git;a=blobdiff_plain;f=rf433rcv%2Fpc%2Frawhid_test.c;fp=rf433rcv%2Fpc%2Frawhid_test.c;h=0000000000000000000000000000000000000000;hp=cd94bdbbce830de1d478d3cbc460eee22fa232c2;hb=fff7d88ae580a68519a3b9f590a2cf9cce21ef8b;hpb=5b00dab1a7d2ac2d8a593f0bd6e85a7194e2c9bd diff --git a/rf433rcv/pc/rawhid_test.c b/rf433rcv/pc/rawhid_test.c deleted file mode 100644 index cd94bdb..0000000 --- a/rf433rcv/pc/rawhid_test.c +++ /dev/null @@ -1,104 +0,0 @@ -#include -#include -#include -#include -#include -#if defined(OS_LINUX) || defined(OS_MACOSX) -#include -#include -#elif defined(OS_WINDOWS) -#include -#endif - -#include "hid.h" - - -void sendstr(char * tosend) -{ - rawhid_send(0, tosend, strlen(tosend),1000); -} - -int mtime_diff(struct timeval high,struct timeval low) -{ - int result=1000*(high.tv_sec-low.tv_sec); - result+=high.tv_usec/1000-low.tv_usec/1000; - return result; -} - -int main (int argc, char *argv[]) -{ - int i, r, num; - char buf[64]; - // C-based example is 16C0:0480:FFAB:0200 - r = rawhid_open(1, 0x16C0, 0x0480, 0xFFAB, 0x0200); - if (r <= 0) { - // Arduino-based example is 16C0:0486:FFAB:0200 - r = rawhid_open(1, 0x16C0, 0x0486, 0xFFAB, 0x0200); - if (r <= 0) { - printf("no rawhid device found\n"); - return -1; - } - } -// printf("found rawhid device\n"); - if (argc>1) - { - FILE * f = fopen (argv[1], "r"); - if (strcmp("-",argv[1]) == 0) - f = stdin; - if (!f) - return -3; - printf("Clearing Buffer\n"); - sendstr("c"); // clear the buffer - buf[0]='f'; - size_t len; - while ( ( len = fread(buf+1, 1, 63, f) ) ) - { - - rawhid_send(0, buf, 64, 1000); //fill the buffer - printf("Sending Buffer %d bytes\n",len); - for(i=0;i