comparison dmx_usb_module/dmx_usb_test.c @ 355:4e60444605f6

add dmx_usb_module
author drewp@bigasterisk.com
date Wed, 13 Jun 2007 06:01:22 +0000
parents
children 2b2ad8e7cb9f
comparison
equal deleted inserted replaced
354:f3909c2df943 355:4e60444605f6
1 /*
2 * $Id: dmx_usb_test.c 40 2004-09-11 11:16:39Z erwin $
3 */
4
5 #include <stdio.h>
6 #include <sys/types.h>
7 #include <sys/stat.h>
8 #include <fcntl.h>
9 #include <unistd.h>
10 #include <stdlib.h>
11
12 int main(int argc, char* argv[])
13 {
14 unsigned char buffer[513];
15 int fd;
16 int res;
17 int i;
18
19 fd = open("/dev/dmx0",O_WRONLY);
20 if (fd < 0) {
21 perror("open");
22 exit(-1);
23 }
24
25 for (i = 0; i < 513;i++) {
26 buffer[i] = 0x00;
27 }
28
29 buffer[512] = 0x55;
30
31 while(1) {
32 res = write(fd, buffer, 513);
33
34 if (res < 0){
35 perror("write");
36 exit(-1);
37 }
38 }
39
40 close(fd);
41
42 return 0;
43 }
44