From: joy <gracecott@sancharnet.in>
To: linux-c-programming@vger.kernel.org
Subject: ioctl fails....
Date: Sun, 16 May 2004 10:43:26 +0530 [thread overview]
Message-ID: <40A6F876.50405@sancharnet.in> (raw)
[-- 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;
}
next reply other threads:[~2004-05-16 5:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-16 5:13 joy [this message]
2004-05-16 9:18 ` ioctl fails Jan-Benedict Glaw
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=40A6F876.50405@sancharnet.in \
--to=gracecott@sancharnet.in \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).