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.. |
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 |
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 |
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). |
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.... |
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. |
Thanks Steegie
|
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 |
All times are GMT -5. The time now is 09:25 AM. |