RE: user space - printer driver ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The code in parallel port driver, your program is invoking can be seen
at following link:
http://lxr.linux.no/source/drivers/char/ppdev.c?v=2.4.21#L342

The error string ("ppdev0: no associated port") is printed in
register_device() function. This function can be seen at:
http://lxr.linux.no/source/drivers/char/ppdev.c?v=2.4.21#L286

In this function when we call parport_find_number() function, it returns
NULL value, due to which the error string is printed. Try to find out
the problem in parport_find_number() function, which you can find at
following link:
http://lxr.linux.no/source/drivers/parport/share.c?v=2.4.21#L826

Hope it helps.

Regards,
Gaurav


-----Original Message-----
From: kernelnewbies-bounce@xxxxxxxxxxxx
[mailto:kernelnewbies-bounce@xxxxxxxxxxxx] On Behalf Of amith
Sent: Tuesday, July 27, 2004 11:28 AM
To: kernel
Subject: user space - printer driver ?

hi all,
             i tried the following code on my computer. i tried it from 
a tutorial on the net. It explains the Linux-2.4 parallel port
subsystem.

#include<linux/ppdev.h>
#include<sys/types.h>
#include<sys/ioctl.h>
.....

#define DEVICE_FILE "/dev/parport0"

main()
{

      int p_fd;
      p_fd =   open(DEVICE_FILE,O_RDWR);
           if(p_fd < 0)
        {
                perror(" in open ");
                exit(0);
        }


       if( ioctl(p_fd, PPCLAIM))
       {
              perror("in ioctl");
              exit(0);
        }

}


i'am planning to write a driver for it, so i decided to first understand

the Parport subsystem on Linux-2.4. Now, ioctl() fails and perror
reports :

in ioctl : no such device or address.

i get a message in /var/log/messages saying :

ppdev0: no associated port.

could someone explain why this could happen and how i could get out of 
this ?

cheers,
Amith

PS: i tried with parport0, parport1,parport2 - device files , without 
any change in errors :-( !
tried to print documents on my printer from Windows applications like 
MS-Word,  just to check whether the parallel port is working and iam 
able to print .






       

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux