Re: parallel port problem

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

 



On Thu, 2006-03-16 at 06:25 +0100, Jan Hudec wrote:
> On Wed, Mar 15, 2006 at 18:54:08 +0500, Fawad Lateef wrote:
> > On 3/15/06, taha siddiqi <tawushafeez@xxxxxxxxx> wrote:
> > > Hi....
> > > I am trying to read data from my laptop's (thinkpad R51) parallel port
> > > (similar to the example in Linux Device Drivers 3rd Edition).
> > > But, everytime i am reading the data it always comes to be 0xFF(255) ....
> > > I even tried the following loop in my write function (struct file_operations)
> > > while(count--){
> > >    printk("writing %x\n", *ptr);
> > >    out(*(ptr++), port);
> > >    wmb();
> > >    printk("reading data : %x\n", inb(port));
> > > }
> > > but the debug message in log shows something like
> > > writing 116
> > > reading 255
> > > writing 78
> > > reading 255
> > > ...
> > > ...
> > 
> > There are different modes for Parallel Port (AFAIR like
> > bi-directional, EPP or so, just google for it) which you have to
> > configure to bi-directional in your board bios setup (its by-default
> > not configured as bi-directional). So you are only able to read the
> > data not able to write and all your write operations does nothing.
> > CMIIW
> 
> The other way round, no? You can only write, but it gives nothing sensible
> when reading.
> 

I got the answer...


The parallel port has to be initialized in control register. To
initialize the port for output 0x02 has to be send to the control
register and to initialize the port for input 0x08 is to be sent. I did
that and it worked fine....

Yes, the port has to be bidirectional for data port to be readable.

taha



--
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