Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


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

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


I am a newbie .. and learning basics of device driver development
I found a tutorial at freesoftware magazine and followed it
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);

/* We change the reading position as best suits */
if (*f_pos == 0)
return 1;
return 0;

this is the code for write

char *tmp;
/* Buffer writing to the device */
char parlelport_buffer;
printk("\n Inside Write\n");
/* Writing to the port */

return 1;

if someone has any idea why this is happening plz tell

Thanx in advance..
Old 10-27-2008, 12:16 PM   #2
LQ Guru
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Linux Mint 17, Debian 8
Posts: 7,863

Rep: Reputation: 311Reputation: 311Reputation: 311Reputation: 311
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
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
LQ Newbie
Registered: Oct 2009
Posts: 7

Rep: Reputation: 0
parlel issues


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
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
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 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
LQ Newbie
Registered: Oct 2008
Posts: 7

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

Rep: Reputation: Disabled
parallelport driver

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

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

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 05:55 PM.

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