#include #include #include #include #include #include #include #include #include #include #include #include "ctl.h" int main(int argc, char *argv[]) { CTLArg data; int fd; int result; memset (&data, 0, sizeof(CTLArg)); if ( argc < 3 ) { printf ("Usage: test <0 = emulation off, 1 = emulation on , 2 = test>"); return EXIT_SUCCESS; } if ( (fd = open(argv[1], O_RDWR) < 0 ) ) { printf ("Unable to open device %s\n", argv[1]); return EXIT_SUCCESS; } switch(atoi(argv[2]) ) { case 0: data.b[0] = false; if ( (result = devctl(fd, DEVCTL_SET_EMULATION_MODE, &data, sizeof(CTLArg), 0)) != EOK ) printf ("devctl error: %d\n", result); break; case 1: data.b[0] = true; data.f[0] = 37.0; if ( (result = devctl(fd, DEVCTL_SET_EMULATION_MODE, &data, sizeof(CTLArg), 0)) != EOK ) printf ("devctl error: %d\n", result); break; case 2: if ( (result = devctl(fd, DEVCTL_TEST, 0, 0, 0)) != EOK ) printf ("devctl error: %d\n", result); } close(fd); return EXIT_SUCCESS; }