LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 10-23-2008, 07:42 AM   #1
BilalMehdi
LQ Newbie
 
Registered: Oct 2008
Posts: 7

Rep: Reputation: 0
Unhappy My parallel port driver not working


Hi....

I am a newbie .. and learning basics of device driver development
I found a tutorial at freesoftware magazine and followed it
www,freesoftwaremagazine,com/articles/drivers_linux
but it does not seem to work!!!!!!!!

whatever i do .. nothing happens to the leds ... ie whatever i write does not affect the state of the parallel port

AND i cannot read the parallel port either... all i get to read is 255

another thing that i noticed (using DMM) is that the voltage at the parallel port pin remains at about 3.5V when parport_pc module is loaded ... as soon as i remove parport_pc module.. the output voltage changes to 4.95V. (i presume it means that the port is not in use anmore). When using windows ...disabling the port also changes voltage from 3.5 to 4.95.

Loading my driver in linux.. does not do anything

My code is same as in another post (i cannot write the URL as it is my first post in the forum)and i have copied it here as well

int parlelport_init(void)
{
int result;

port = check_region(0x378, 1);
if (port)
{
printk("<1>parlelport: cannot reserve 0x378\n");
result = port;
}
request_region(0x378, 1, "parlelport");

/* Registering device */
result = register_chrdev(parlelport_major, "parlelport",&parlelport_fops);
if (result < 0)
{
printk("<1>parlelport: cannot obtain major number %d\n", parlelport_major);
return result;
}
return 0;

}

this is the code for read
parlelport_buffer = inb(0x378);

copy_to_user(buf,&parlelport_buffer,1);
/* We change the reading position as best suits */
if (*f_pos == 0)
{
*f_pos+=1;
return 1;
}
else
{
return 0;
}

this is the code for write

char *tmp;
/* Buffer writing to the device */
char parlelport_buffer;
tmp=buf+count-1;
copy_from_user(&parlelport_buffer,tmp,1);
printk("\n Inside Write\n");
printk(parlelport_buffer);
/* Writing to the port */
outb(parlelport_buffer,0x378);

return 1;

if someone has any idea why this is happening plz tell

Thanx in advance..
 
Old 10-27-2008, 12:16 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,336

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
I suggest that you check whether you are getting the correct parlelport_major back. Print the parlelport_major and make sure that it is 6.

-------------------------
Steve Stites
 
Old 10-30-2008, 03:56 AM   #3
BilalMehdi
LQ Newbie
 
Registered: Oct 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Thank you for your reply
i have checked ... parallel port major is 6.. no problem there

maybe i should explain the problems a little bit more

memory does get reserverd successfully (0x378)
my write and read function are called normally
but read function does not read anything other than 255
and voltage of the parellel port does not change... suggesting that there is some problem during initialization
 
Old 10-09-2009, 10:32 AM   #4
steegie
LQ Newbie
 
Registered: Oct 2009
Posts: 7

Rep: Reputation: 0
parlel issues

Hi,


I was wondering if you found a solution to this problem. I tried this parlel driver as of today and I was faced with exactly the same problem. My reads and writes seem to go well, but the write doesn't set the output pins properly (they are always high, independent of the value that is written)... (see simple parallel port driver thread posted on 08/10/2009).
 
Old 10-11-2009, 03:01 AM   #5
BilalMehdi
LQ Newbie
 
Registered: Oct 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Umm... Sorry !!!!!..I dont have any answer...

Basically i was busy with some other stuff so left this thing in the middle..... but i would suggest that maybe you should try changing the pc you are using...this was the last step i was thinking about before leaving it all....
 
Old 10-13-2009, 04:57 AM   #6
steegie
LQ Newbie
 
Registered: Oct 2009
Posts: 7

Rep: Reputation: 0
Hi, just to let you know that I found a solution for this :

The parport_pc driver is loaded by acpi at boot time.The unloading of this driver turns off the according parallel port hardware.

You need to configure the kernel in such a way that acpi is disabled (I believe it can be done by disabling CONFIG_PNP and CONFIG_PNPACPI...).

As a workaround I passed the acpi=off option in grub.conf for my kernel and after doing this, I could drive the outputs of my parallel port and read them back.

I was using kernel version 2.6.27.25. I don't know if newer versions have the same behaviour when unloading the parport_pc driver.
 
Old 10-14-2009, 12:06 AM   #7
BilalMehdi
LQ Newbie
 
Registered: Oct 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks Steegie
 
Old 05-02-2012, 08:36 AM   #8
roopali
LQ Newbie
 
Registered: May 2012
Posts: 3

Rep: Reputation: Disabled
parallelport driver

hi,
i m trying to glow LED in the parllel portdriver but the led is not glow
i have done all steps:
mknod /dev/parlelport c 250 0
chmod 666 /dev/parlelport
echo -n A >/dev/parlelport
cat /dev/parlelport
./light

but when i reboot my system only D2 pin led is on.but after remove ppdev,lp,parport_pc
light goes off.then after that when i execute my driver led does not glow.
what the reason behind this plz tell me.major_number is 250


code is same as http://www.freesoftwaremagazine.com/.../drivers_linux

Last edited by roopali; 05-02-2012 at 08:38 AM. Reason: nothing
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing own parallel port driver mathimca05 Linux - Kernel 1 10-08-2008 06:03 AM
Parallel port and SNES v.Not Working MarshyTheKid Linux - Software 2 07-26-2007 02:19 AM
How can I remove my existing parallel port driver? asprakash Linux - Kernel 1 06-26-2006 04:22 AM
Parallel Port Device Driver rajtendulkar Linux - Hardware 4 03-16-2006 11:34 PM
parallel port not working in suse 9.3 greenthing Linux - Hardware 1 05-06-2005 08:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 11:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration