LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 03-08-2004, 08:18 AM   #1
DiBosco
Member
 
Registered: Nov 2001
Location: Manchester, UK
Distribution: Mageia 4
Posts: 748

Rep: Reputation: 35
What's using my parallel port?!


Hi Folks,

I'm trying to get a compiler and debugger going that uses the parallel port to communicate with the on chip debugger on a microprocessor. When I run the program it tells me:

"Cannot open target interface. Parallel port is already in use."

Is it possible to find out what Linux thinks is using the parallel port and then freeing it up?

I'm not using the parallel port for printing (in fact I'm doing all my printing over the network) and before I ran this program I didn't have a parallel port setup and had to run mknod for parport0...

I'm using Mandrake 9, btw...

Many thanks,

Rob.
 
Old 03-08-2004, 05:35 PM   #2
ac1980
Member
 
Registered: Aug 2003
Location: Trento, Italy
Distribution: Debian testing
Posts: 394

Rep: Reputation: 30
Not sure it will work, but worth trying: as root
Code:
lsof /dev/par0
or whatever your parallel port is called
 
Old 03-08-2004, 05:46 PM   #3
DiBosco
Member
 
Registered: Nov 2001
Location: Manchester, UK
Distribution: Mageia 4
Posts: 748

Original Poster
Rep: Reputation: 35
Sadly, no. That doesn't list anything using it. Looked like the right command though did lsof!

Of course, there may well be nothing using it, but the software might be flaky!
 
Old 03-08-2004, 05:59 PM   #4
ac1980
Member
 
Registered: Aug 2003
Location: Trento, Italy
Distribution: Debian testing
Posts: 394

Rep: Reputation: 30
Try making "ln -s /dev/parport0 /dev/par0" maybe the error description is misleading, and it can't just open the interface.
 
Old 03-08-2004, 06:13 PM   #5
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
It happens to me in VMware if I have CUPS or a printer service setup. You can remove that module (I think lp) and try it again. You may want to set the parport to mode 666. Do not forget to load up lp module after you are done.
 
Old 03-08-2004, 07:34 PM   #6
Thymox
Senior Member
 
Registered: Apr 2001
Location: Plymouth, England.
Distribution: Debian + Ubuntu
Posts: 4,358

Rep: Reputation: 57
If you're using VMWare, then you may want to disable parallel port support the the client OS and use a share your printer as a network printer, and then use network printing (even though it's on the same machine). The problem, as I see it, is that both the host and the client OS are trying to access the parallel port and only one is allowed to do so. The answer: eliminate the problem.
 
Old 03-09-2004, 06:47 AM   #7
Aussie
Senior Member
 
Registered: Sep 2001
Location: Brisvegas, Antipodes
Distribution: Slackware
Posts: 4,590

Rep: Reputation: 56
Check to see if the 'lp' module is loaded with "lsmod" (as root), if it is then unload it with "rmmod lp".
'lp' is the pp printer module.
 
Old 03-09-2004, 09:47 AM   #8
DiBosco
Member
 
Registered: Nov 2001
Location: Manchester, UK
Distribution: Mageia 4
Posts: 748

Original Poster
Rep: Reputation: 35
Aussie, you beaut, that's it! Thanks!

At the risk of sounding ignorant (not so far from the truth) - what am I doing there by entering rmmod lp? I guess I'm removing a "module" - whatever that is - for lp (line printer?). Is a module a piece of code that allows the kernel to interface with hardware?

Bear in mind that I'm a programmer, and I'm not stupid, but all my experience is low level code - assembler and C for microcontrollers...

Oh, btw thanks to the other suggestions I'm running Mandrake 9.1, not VMware.

Many thanks!

Rob.
 
Old 03-09-2004, 05:45 PM   #9
Aussie
Senior Member
 
Registered: Sep 2001
Location: Brisvegas, Antipodes
Distribution: Slackware
Posts: 4,590

Rep: Reputation: 56
Quote:
Originally posted by DiBosco
Aussie, you beaut, that's it! Thanks!
Your welcome :-)

Quote:
Originally posted by DiBosco
At the risk of sounding ignorant (not so far from the truth) - what am I doing there by entering rmmod lp? I guess I'm removing a "module" - whatever that is - for lp (line printer?).
Yes, if Mandrake uses hotplug you can stop it loading the lp module at boot by adding it to /etc/hotplug/blacklist.

Quote:
Originally posted by DiBosco
Is a module a piece of code that allows the kernel to interface with hardware?
Yes, but thats not all a module can do, you can have filesystem support compiled as modules (but it's not a good idea to have your primary filesystem as a module) and iptables support is usually compiled as modules.

Quote:
Originally posted by DiBosco
Bear in mind that I'm a programmer, and I'm not stupid, but all my experience is low level code - assembler and C for microcontrollers...

Oh, btw thanks to the other suggestions I'm running Mandrake 9.1, not VMware.

Many thanks!

Rob.
Have a look at file:/usr/src/linux/Documentation/modules.txt for more info on dynamically loadable kernel modules.
 
Old 06-19-2004, 08:33 AM   #10
DiBosco
Member
 
Registered: Nov 2001
Location: Manchester, UK
Distribution: Mageia 4
Posts: 748

Original Poster
Rep: Reputation: 35
This problem has raised its ugly head again now I've installed Mandrake 10.

Initially I didn't have a parallel port listed at all, (and the application was telling me /dev/parport0 didn't exist) so I did:

modprobe parport_pc

which I saw recommended somewhere else here, but it seemed to do nothing, so I did:

modprobe parport

as well. This didn't quite work properly, it was still saying /dev/parport0 didn't exist, though the directory /dev/lp0 had suddenly appeared.

I did:

ln -s /dev/lp0 /dev/parport0

Which eventually stopped the message telling me /dev/partport0 didn't exist, but then told me:

"Can't open target interface, parallel port already in use"

So, I thought, no problem, I'll do:

rmmod lp

as I did last time. However, whenever I run the application, lp reappears in the lsmod listing.

I now have parport_pc, parport and lp0 in my lsmod. If I remove parport_pc, parport and lp an do lsmod, they all go. As soon as I try connecting to the parallel port with my application they all appear as below in lsmod

parport_pc 32832 1
lp 12200 0
parport 38952 2 parport_pc,lp


I seem to have got myself in a real tangle! Anyone have any ideas what I've done wrong?!

Many thanks.

Rob.

Last edited by DiBosco; 06-19-2004 at 08:44 AM.
 
Old 06-20-2004, 11:18 AM   #11
DiBosco
Member
 
Registered: Nov 2001
Location: Manchester, UK
Distribution: Mageia 4
Posts: 748

Original Poster
Rep: Reputation: 35
Sussed it, I needed to do mknod, not just make a symbolic link to parport0.

Sorreeeee!
 
  


Reply


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
Where is the parallel port? kwyjibo99 Linux - Hardware 5 07-20-2005 06:47 PM
Cannot use parallel port under 2.6.4 jimbob1234 Slackware 2 03-14-2004 09:34 PM
Parallel Port CD-RW dbrook42 Linux - Hardware 3 09-30-2003 08:54 PM
Parallel Port Crashed_Again Linux - Hardware 1 01-20-2003 09:52 PM
Parallel port scanner edenyard Linux - Hardware 0 06-01-2002 02:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 01:24 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration