Mercurial > code > home > repos > light9
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dmx_usb_module/dmx_usb_test.c Wed Jun 13 06:01:22 2007 +0000 @@ -0,0 +1,44 @@ +/* + * $Id: dmx_usb_test.c 40 2004-09-11 11:16:39Z erwin $ + */ + +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> +#include <stdlib.h> + +int main(int argc, char* argv[]) +{ + unsigned char buffer[513]; + int fd; + int res; + int i; + + fd = open("/dev/dmx0",O_WRONLY); + if (fd < 0) { + perror("open"); + exit(-1); + } + + for (i = 0; i < 513;i++) { + buffer[i] = 0x00; + } + + buffer[512] = 0x55; + + while(1) { + res = write(fd, buffer, 513); + + if (res < 0){ + perror("write"); + exit(-1); + } + } + + close(fd); + + return 0; +} +