39 #include <visp3/core/vpConfig.h>
41 #ifdef VISP_HAVE_PARPORT
43 # include <sys/types.h>
44 # include <sys/stat.h>
46 # include <sys/ioctl.h>
49 # include <visp3/io/vpParallelPort.h>
58 static unsigned char vpParallelPortData;
75 sprintf(device,
"/dev/parport0");
79 unsigned char data = 0;
103 void vpParallelPort::open()
105 fd = ::open(
"/dev/parport0", O_WRONLY);
107 printf(
"Can't open /dev/parport0\n");
108 printf(
"Check if you have write access to /dev/parport0\n");
109 perror(
"Open parallel port");
111 "Can't open /dev/parport0")) ;
117 i = PARPORT_MODE_COMPAT;
118 ioctl(fd, PPSETMODE, & i);
119 i = IEEE1284_MODE_COMPAT;
120 ioctl(fd, PPNEGOT, & i);
142 ioctl(fd, PPWDATA, & data);
145 vpParallelPortData = data;
155 return vpParallelPortData;
165 void vpParallelPort::close()
167 ioctl(fd, PPRELEASE);
173 printf(
"Can't close the parallel port\n");
175 "Can't close the parallel port")) ;
181 #elif !defined(VISP_BUILD_SHARED_LIBS)
183 void dummy_vpParallelPort() {};
void sendData(unsigned char &data)
Error that can be emited by the vpParallelPort class and its derivates.