On Wed, 11 Apr 2001, Philip Blundell wrote:
> >read_write_t scope_write(struct inode *inode, struct file *filp,
> > const char *buf, count_t count)
> >{
> What version of the kernel are you using? That kind of write() signature
> hasn't been appropriate since 2.0 or so. Also:
i am using kernel 2.2.14-12
> > copy_from_user(kbuf, buf, count);
>
> This function returns an error flag; you ought to check for success. Also:
i checked errno in the program that is using the driver, the code is
like...
main()
{
int fd;
char *buf;
int ret;
extern int errno;
fd=open("/dev/scope0",O_RDWR);
printf("enter data\n");
buf=(char *)malloc(10*sizeof(char));
scanf("%s",buf);
if (fd>0){
ret=write(fd,buf,strlen(buf));
printf("string is %s, length = %d\n",buf,strlen(buf));
if(ret <= 0)
printf("error!! %d %d\n",ret,errno);
}
else
printf("driver not loaded! \n");
close(fd);
}
the output is ...
enter data
adit
kmalloc: Size (3271436788) too large
string is adit, length = 4
error!! -1 12
^^^
an errno of 12 according to asm/errno.h is ENOMEM (out of memory)
but that seems unlikely...
> > outb(*(ptr++),port);
>
> It would probably be better to use the parport functions rather than
> attacking the bare metal directly, though that's a matter of choice.
can you please elaborate a bit as i am a total newbie to writing device
drivers :)
can you please point to some resource which explains how to use these
parport functions and how to build drivers out of these?
thanx,
-- aditya
-- To unsubscribe, send mail to: linux-parport-request@torque.net --
-- with the single word "unsubscribe" in the body of the message. --
This archive was generated by hypermail 2b29 : Wed Apr 11 2001 - 17:21:53 EDT