parallel port on HP laptop

Asked by Dirk

I would need some help getting the parallel port working on
my HP Compaq NC6000 laptop running Edgy.

My company's software running under Windows in VMWare
requires a dongle on the parallel port. This is an absolute
show stopper for me, and I have to switch back to native
Windows if I can't solve this one.

I looked into
https://launchpad.net/distros/ubuntu/+ticket/2464
but, that didn't help. I don't get any error message
when I try to connect the port from VMWare to the host,
but the port seems to be dead.

Then I tried whether the parallel port would work just in
Ubuntu Edgy without all this virtual stuff (I already know
that the serial port doesn't). So, I connected a relay board
and tried the code found at
http://www.epanorama.net/circuits/lptout.c
Nothing. Not with base 0x378, not with base 0x3bc. No error
messages and no relays clicking. As if it's unplugged.

I'm not much of a programmer, so I'd need some help here.

thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Dirk
Solved:
Last query:
Last reply:
Revision history for this message
Alan Pope 🍺🐧🐱 🦄 (popey) said :
#1

Unfortunately I don't use VMWare, but you might want to take a look at QEMU which is an open source system emulator. I believe that since version 0.8.0 it is able to access the host parallel port. I use QEMU to emulate a number of systems and it works pretty well. It doesn't look as nice as VMWare but it is free. It can also read VMWare disk images, so you don't need to reinstall the guest OS if you choose to switch.

QEMU is in the repository so you can get it via Synaptic Package Manager.

Also worth noting that the non-free kqemu kernel accelerator can make a dramatic difference on the performance of QEMU. It can be obtained from:-

http://fabrice.bellard.free.fr/qemu/qemu-accel.html

Feel free to ask further questions about QEMU.

Revision history for this message
Dirk (rptq) said :
#2

Thanks for the tip with QEMU. Sounds like worth a try.

The manual of QEMU says that is can "redirect the virtual parallel port to host device". I suppose this means that when the host OS cannot access the port, the guest OS won't be able to do that either.

To me it seems that I first need to get the port working in Ubuntu on the real machine. After that, we can try the virtual machines.

Revision history for this message
Alan Pope 🍺🐧🐱 🦄 (popey) said :
#3

Ah, ok, I misunderstood, sorry.

It's definitely enabled in the BIOS?
Do you have options in the BIOS for EPP / ECP?
Can you try the other option, to whichever one you have set?

What does this command result in:-

dmesg| grep parp

Here is what I get:-

alan@wopr:~$ dmesg | grep parp
[ 15.461523] parport: PnPBIOS parport detected.
[ 15.461563] parport0: PC-style at 0x378, irq 7 [PCSPP,TRISTATE]
[ 16.210421] lp0: using parport0 (interrupt-driven).

Revision history for this message
Dirk (rptq) said :
#4

Yep. the port is absolutely enabled in the BIOS.
As usual, things work fine in Windows. (Sorry to say that! Ubuntu is really nice, the closest I ever got to using Linux on the desktop (my Debians are just firewalls, DSL routers, webservers, fetchmailers and procmailers), but it drives me nuts when things like these ports that I take for granted, don't work anymore.)

In my BIOS, I have four options: ECP, EPP, Standard and Bidirectional. I tried the first three with the Edgy and Drapper live CDs still using my relay board (confirmed in Windows that the board works) and that lptout program I grabbed from the web (see first posting). Result: nothing. No error messages, no relays clicking. Could it be that this is another bug, or that this test program is bogus?

Do you have any other suggestions how to test the port? The target is really the VMWare, but that introduces too many variables. For serial ports I used two machines connected with a null modem cable and terminal programs. Can't get any simpler. Anything like that for parports?

Before I forget, the dmesg output is similar to yours depending on the BIOS setting. With ECP, I get:
[17179587.216000] parport: PnPBIOS parport detected.
[17179587.216000] parport0: PC-style at 0x378 (0x778), irq 7, dma 3 [PCSPP,TRISTATE,COMPAT,ECP,DMA]
[17179590.560000] lp0: using parport0 (interrupt-driven).

Revision history for this message
Alan Pope 🍺🐧🐱 🦄 (popey) said :
#5

I appreciate that it working under windows and not under linux can be a frustration, I really do.

The usual test for a parallel port would be to plug a centronics printer into it and try to print something.

Revision history for this message
Dirk (rptq) said :
#6

Hello, back from some trips, back to this problem. I borrowed a Centronics printer that has been sitting unused for about 13 years. Connected it to the laptop running Windows and it works. All 9 pins and the ribbon are still functional.

Swapped the hard disk to get back to Ubuntu. After "sudo chmod 666 /dev/lp0" I can do "echo blah > /dev/lp0" and I get "blah" in black on white paper. So, the port works.

VMWare then tells me that /dev/lp0 is depreciated and they will use /dev/parport0 instead. Before I did anything further, I tried "echo blah > /dev/parport0" but this has no effect. No errors, no printing.

Question 1: What is this parport and how am I supposed to use it?

VMWare then insists that it gets exclusive access, and on some posts I read that you have to "rmmod lp" before VMWare can use the port. Did that, started VMWare and got no more complaints. But still no printing. The virtual Windows complains that there is no device connected to LPT1. Maybe an answer to my first question can solve this as well.

Next try: USB - Parallel cable. When I plug that in, I get a new device /dev/usblp0. Printing via redirected echo works ok. But again, VMWare complains "Unable to setup the device '/dev/usblp0' for exclusive use."

Question 2: How can I find out who or what is using a given device and how can I give an application the exclusivity that it asks for?

P.S. QEMU is still on my list of things to be tried.

Revision history for this message
Dirk (rptq) said :
#7

Qemu is now installed. Old printer connected to the built-in parallel port. echo blah > /dev/lp0 works.
Started qemu w2kprof.img -parallel /dev/parport0
Installed a printer in W2k on LPT1, no errors.
When I try to print, I see the number of documents in the queue
changing to 1. After some time, it goes back to 0, but no print. When
I switch the printer off-line, then the number of documents increases.
Switch the printer on-line again, the number decreases one by one,
but no print. I tried all sorts of on-line/off-line, power-on/power-off,
plugged-in/plugged-out combinations, and twice I was able to print.
But this isn't repeatable at all. Most of the time, I can't print.

Second experiment: the USB - Parallel cable. Seems to work fine, the
qemued W2k can print. Unfortunately, this is not a solution because
the goal is not printing, but using a dongle that needs to be plugged
into the parallel port. That dongle doesn't seem to work with USB
cable. Tried this once in native Windows. The printing is only a simple
way to test the port and its availability in a virtual W2k environment.

Any help would be appreciated.

Revision history for this message
Best Dirk (rptq) said :
#8

Some more updates:

I tried qemu with -parallel /dev/parport0 as suggested in the documentation, but then the guest Windows cannot print as described in my previous post. Then I tried qemu with -parallel /dev/lp0. In this case, printing works fine. The dongle that I need to use is still not recognized, and I'm afraid it never will. As far as I understand, the dongle requires an enhanced or expanded (ECP or EPP (or other way round)) parallel port, whereas qemu provides only a standard or uni-directional parallel port (SPP). This is a pity because I like qemu quite a bit.

Next test: downloaded Parallels, another commercial VM solution. The result is exactly the same as with qemu although I could not find any documentation that mentions what kind of parallel port is provided by Parallels. (I don't feel sad about ditching Parallels since the windows refreshed really slowly compared to qemu and VMWare.)

Lastly, I tried VMWare again. I made sure that I did:
  rmmod lp
  chmod 666 /dev/parport0
before I started VMWare. Of course, the virtual machine configuration needs to contain a parallel port pointing to /dev/parport0 and the device needs to be enabled in VMWare Tools (running inside the guest OS). Today, everything worked fine. Printing works. Dongle is recognized. :-))

Problem is that I don't know why it didn't work in the first place. I think I did the same steps as described here. One difference is that since then I downloaded a few packages, compiled and installed qemu & kqemu. No idea what kind of side effects this could have had.

Ok, problem is solved, but don't know how and why...

Any enlightenment would still be appreciated.

Revision history for this message
TechFan (o-launchpad-net-ourholm-net) said :
#9

I too was having issues with this. I think I discovered the problem. What I did was I ran vmware-configure again after doing rmmod lp (or maybe it was modprobe -r lp). It also could have had something to do with manually running modprobe ppdev (I haven't had a chance to verify if that was involved at all).

There is also a page that has a section on "Enabling Parallel Port Access" that I found to be a good reference in fixing this:
https://help.ubuntu.com/community/VMware/Workstation