linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ioctl fails....
@ 2004-05-16  5:13 joy
  2004-05-16  9:18 ` Jan-Benedict Glaw
  0 siblings, 1 reply; 2+ messages in thread
From: joy @ 2004-05-16  5:13 UTC (permalink / raw)
  To: linux-c-programming

[-- Attachment #1: Type: text/plain, Size: 423 bytes --]

     Hi,

I'm trying to do some low level data transmission using the parallel
port .in Debian, it is /dev/par0
my source is attached .perror gives me "invalid argument". if I change
the file being
opened to say, lp0, it gives me "bad file descriptor".
should I use ioperm() even in this case?
and also,is it guaranteed that the parallel port is assigend par0(I have
only one P port)?

Thanx in advance,
Joy.M.Monteiro.




[-- Attachment #2: test.c --]
[-- Type: text/plain, Size: 490 bytes --]

#include<linux/ppdev.h>
#include<stdlib.h>
#include<unistd.h>
#include<linux/parport.h>
#include<time.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<linux/ioctl.h>

main()
{
	int filedes;
	char data=0xff;
	struct timespec time;
	filedes=open("/dev/par0",O_RDWR);
	if(ioctl(filedes,PPCLAIM)==-1)
		perror("OPEN");
	
	if(ioctl(filedes, PPWDATA, &data)==-1)
		perror("Hi");
	time.tv_sec=1;
	time.tv_nsec=1000;
	nanosleep(&time,NULL);
	close(filedes);
	return;
}
	
	


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-05-16  9:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-16  5:13 ioctl fails joy
2004-05-16  9:18 ` Jan-Benedict Glaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).