43 #include <visp/vpConfig.h>
45 #ifdef VISP_HAVE_PARPORT
47 # include <sys/types.h>
48 # include <sys/stat.h>
50 # include <sys/ioctl.h>
53 # include <visp/vpParallelPort.h>
62 static unsigned char vpParallelPortData;
79 sprintf(device,
"/dev/parport0");
83 unsigned char data = 0;
107 void vpParallelPort::open()
109 fd = ::open(
"/dev/parport0", O_WRONLY);
111 printf(
"Can't open /dev/parport0\n");
112 printf(
"Check if you have write access to /dev/parport0\n");
113 perror(
"Open parallel port");
115 "Can't open /dev/parport0")) ;
121 i = PARPORT_MODE_COMPAT;
122 ioctl(fd, PPSETMODE, & i);
123 i = IEEE1284_MODE_COMPAT;
124 ioctl(fd, PPNEGOT, & i);
146 ioctl(fd, PPWDATA, & data);
149 vpParallelPortData = data;
159 return vpParallelPortData;
169 void vpParallelPort::close()
171 ioctl(fd, PPRELEASE);
177 printf(
"Can't close the parallel port\n");
179 "Can't close the parallel port")) ;
void sendData(unsigned char &data)
Error that can be emited by the vpParallelPort class and its derivates.