LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-01-2012, 08:48 AM   #1
CVAlkan
Member
 
Registered: Nov 2012
Location: Northwest suburbs of Chicago
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 242

Rep: Reputation: Disabled
Using Parallel Port in Ubuntu 12.04


I loaded Ubuntu 12.04 as a dual boot on a Windows desktop several months ago and, after much fiddling, was able to send a text file to a dumb printer on my parallel port using the “cat Test_File.txt > /dev/lp0” sort of commands, but haven’t been able to figure out how to define the port for use with the printer from within an application. My other printers, all on USB ports, seem to work just fine. All I need to set up a printer is a really plain-vanilla fixed pitch text-only generic driver.

I am still unable to assign this port in the Add Printers app. Although I can select parallel:/dev/lp0 as the device URI, the “Print Test Page” button is still grayed out, and I am unable to use this printer definition from any app (although it shows up as a choice).

I’ve attempted to follow the many pieces of often conflicting advice on the web with no success. Here’s a list of various commands and their results:

cat /etc/modules GIVES:
Code:
parport_pc
lp
rtc
(I manually added the first two lines per some instructions from the web.)

The command “lspci -vv” gives the following lines about the parallel port adapter card:
Code:
03:07.0 Communication controller: NetMos Technology PCI 1 port parallel adapter (rev 01) 
	Subsystem: LSI Logic / Symbios Logic Device 0010 
	Control: I/O+ Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- 
	Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- 
	Interrupt: pin A routed to IRQ 3 
	Region 0: I/O ports at ce00 [size=8] 
	Region 1: I/O ports at cd00 [size=8] 
	Region 2: I/O ports at cc00 [size=8] 
	Region 3: I/O ports at cb00 [size=8] 
	Region 4: I/O ports at ca00 [size=8] 
	Region 5: I/O ports at c900 [size=16] 
	Kernel modules: parport_pc
dmesg | grep parport GIVES
Code:
[   11.042481] parport 0xce00 (WARNING): CTR: wrote 0x0c, read 0x09
[   11.042502] parport0: PC-style at 0xce00 [PCSPP,TRISTATE,EPP]
[   11.478695] lp0: using parport0 (polling).
[19506.637541] parport0: ppdev0 forgot to release port
Me@MyMachine:/usr/lib/cups/backend$ ls -l GIVES
Code:
total 724 
-rwxr-xr-x 1 root root   7250 Jul  6 07:16 beh 
-rwxr-xr-x 1 root root 138024 Mar 21  2012 bluetooth 
-rwx------ 1 root root  27032 Apr  2 17:44 cups-pdf 
-rwxr--r-- 1 root root  18976 Aug 20 09:09 dnssd 
-rwxr-xr-x 1 root root  18864 Jul 10 03:37 hp 
-rwxr-xr-x 1 root root   9042 Jul 10 03:37 hpfax 
-rwxr--r-- 1 root root  64736 Aug 20 09:09 http 
-rwxr--r-- 1 root root  64736 Aug 20 09:09 https 
-rwxr--r-- 1 root root  64736 Aug 20 09:09 ipp 
-rwxr--r-- 1 root root  48096 Aug 20 09:09 ipp14 
-rwxr--r-- 1 root root  64736 Aug 20 09:09 ipps 
-rwxr--r-- 1 root root  43856 Aug 20 09:09 lpd 
-rwxr--r-- 1 root root  18976 Aug 20 09:09 mdns 
-rwxr-xr-x 1 root root  18824 May 18 03:05 parallel 
-rwxr-xr-x 1 root root  14664 May 18 03:05 serial 
lrwxrwxrwx 1 root root     21 Sep  8 10:37 smb -> ../../../bin/smbspool 
-r-xr-xr-x 1 root root  27296 Aug 20 09:09 snmp 
-r-xr-xr-x 1 root root  35536 Aug 20 09:09 socket 
-r-xr--r-- 1 root root  31408 Aug 20 09:09 usb
Me@MyMachine:/usr/lib/cups/backend$ lpinfo -v GIVES
Code:
network ipp 
network https 
network socket 
network http 
network lpd 
network ipp14 
network beh 
network ipps 
direct parallel:/dev/lp0 
file cups-pdf:/ 
network smb 
direct usb://HP/Officejet%20Pro%20K5400?serial=MY6CQ1806V
dmesg | grep par GIVES
Code:
[   11.042481] parport 0xce00 (WARNING): CTR: wrote 0x0c, read 0x09
[   11.042502] parport0: PC-style at 0xce00 [PCSPP,TRISTATE,EPP]
[   11.476990] ppdev: user-space parallel port driver
[   11.478695] lp0: using parport0 (polling).
[19506.637541] parport0: ppdev0 forgot to release port
dmesg | grep ppdev GIVES
Code:
[   16.603004] ppdev: user-space parallel port driver
The line “parport0: ppdev0 forgot to release port ” seems unusual.

The output of the command lpinfo -v includes the following line:
Code:
direct parallel:/dev/lp0
Running the command sudo /usr/lib/cups/backend/parallel gives the following:
Code:
direct parallel:/dev/lp0 "unknown" "LPT #1" "" ""
I was told by more than one individual that Linux hasn’t supported parallel port printing for quite a few years, but I found that a little difficult to believe given the mention of the port in all of the above outputs. Then finally, I discovered the following URL:
https://lkml.org/lkml/2012/9/1/94 - which states:

Code:
Error handling of parport_register_driver() in ppdev_init()
is broken because it deallocates all resources but still
returns zero.
Currently parport_register_driver() always succeeds.
Nevertheless it is worth to fix the issue.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
 drivers/char/ppdev.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
index 3fcf80f..d0d824e 100644
--- a/drivers/char/ppdev.c
+++ b/drivers/char/ppdev.c
@@ -783,7 +783,8 @@ static int __init ppdev_init (void)
                err = PTR_ERR(ppdev_class);
                goto out_chrdev;
        }
-       if (parport_register_driver(&pp_driver)) {
+       err = parport_register_driver(&pp_driver);
+       if (err < 0) {
                printk (KERN_WARNING CHRDEV ": unable to register with parport\n");
                goto out_class;
        }
-- 
1.7.9.5
So, ppdev “deallocates all resources but still returns” an error.
And my machine is reporting that ppdev “forgot to release port.”

Is this actually the problem I have? Is there any way to use a printer in Ubuntu without having to create a text file from an application and then redirecting it to a port?

Any help would be greatly appreciated.
 
Old 12-01-2012, 09:21 AM   #2
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Hello CVAlkan, welcome to LQ,

I think you make it too complicated.

If you want to load a module, this is done with modprobe, read the manpage.

As of printing, it is done with cups. cups has a very helpful webinterface. In a browser simply open the address
Code:
http://localhost:631
there you can see which printers are already configured for your system. If your parallel printer is not recognized, please try to do it in the webinterface.

And don't forget to tell us, which printer it is, make and model.

Markus
 
Old 12-01-2012, 10:21 AM   #3
CVAlkan
Member
 
Registered: Nov 2012
Location: Northwest suburbs of Chicago
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 242

Original Poster
Rep: Reputation: Disabled
Marcus -

Thanks so much. I tend to make things complicated I guess. You've gotten me across the next hurdle, which is to get an Ubuntu Printer set up that I can connect to.

However, I'll still need to either define or locate a "driver" (is that what it's called in Linux?) for my typewriter interface, which is a (long obsolete) Brother IF-50 that is connected to a Brother CE-50 daisy-wheel typewriter. There didn't appear to be anything similar at all in the Brother listing, and even the most basic in their list seemed to be sending binary information to the typewriter rather than straight text.

The Brother is pretty dumb, and uses escape codes for such things as bold, italic and so forth. Is there a way I can completely define such a thing myself? I couldn't find anything in the CUPS interface page that would clue me as to whether or not any particular device was DUMB enough (and text-based) to modify. I've only done a quick google for dumb printer driver for linux, but didn't see anything useful. The various Brother pages don't seem to have any 1980 vintage dumb printers either.

Again, thanks much for pointing me to the CUPS page.

Frank
 
Old 12-01-2012, 10:38 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,568

Rep: Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865
I would guess the typewriter interface falls under the generic ESC/P dot matrix printer driver. I would also say that that any 9 pin dot matrix like the Panasonic KX-P1124 would also work.
 
Old 12-01-2012, 02:35 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,921

Rep: Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618
Just a note. Be sure to start off at bios. It may be that you have to enable or adjust bios settings for that port. LP0 may be the motherboard even if there is no port there. Add on boards may be other issues.
 
Old 12-03-2012, 11:22 AM   #6
CVAlkan
Member
 
Registered: Nov 2012
Location: Northwest suburbs of Chicago
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 242

Original Poster
Rep: Reputation: Disabled
Thanks for help so far. Unfortunately, although everything seems like its connected, when I choose the printer and print a file, it seems to send binary (? - i.e. random characters) rather than straight ASCII characters.

I searched for printers containing "daisy wheel" and so forth, but I fear I'm barking up the wrong tree.

Does anyone have any other suggestions I might try?
 
Old 12-03-2012, 11:51 AM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,921

Rep: Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618
"it seems to send binary (? - i.e. random characters) rather than straight ASCII characters.
"

Then that is a good sign. It is something.

Ideas, change setting on printer to emulate a different model. Change OS to use different printer.

Might be that the port speed is too high for printer or the printer is really serial using the old connector.

There was some handshaking soft of setting for parallel too.

It has been decades since I have used a parallel printer.

Last edited by jefro; 12-03-2012 at 11:53 AM.
 
Old 12-03-2012, 03:16 PM   #8
CVAlkan
Member
 
Registered: Nov 2012
Location: Northwest suburbs of Chicago
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 242

Original Poster
Rep: Reputation: Disabled
Thanks again.

One thing I should have mentioned is that the printer works just fine as a dumb printer on the same port when I boot into Windows, so I've sort of ruled out BIOS settings, cable problems and that sort of thing.

One thing it would be nice to confirm is whether or not CUPS can actually handle straight text pass-through - another thing I was wondering is whether or not it is trying to send multi-byte characters to the printer. I wouldn't think so, but have been away from the nuts and bolts of this stuff for so long ...

Again, thanks.
 
Old 12-03-2012, 03:22 PM   #9
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Quote:
Originally Posted by CVAlkan View Post
...
One thing I should have mentioned is that the printer works just fine as a dumb printer on the same port when I boot into Windows, so I've sort of ruled out BIOS settings, cable problems and that sort of thing.
...
Which version of Windows would that be???

Probably not newer than Win XP?

Markus
 
Old 12-03-2012, 03:32 PM   #10
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,568

Rep: Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865
You can add a printer as a raw device i.e. no driver. Add a generic printer and choose a raw queue with the url pointing to the parallel port.
 
Old 12-03-2012, 03:36 PM   #11
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,921

Rep: Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618
From terminal I think it was a simple test like

ls > /dev/lp or prn or something like that. Maybe try stuff like that.
 
Old 12-03-2012, 03:45 PM   #12
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Quote:
Originally Posted by jefro View Post
From terminal I think it was a simple test like

ls > /dev/lp or prn or something like that. Maybe try stuff like that.
Yeah, I too try to remember which commands to use back then..... in the times when there was no cups. But it was about 18 years ago when I started with Linux. Problem was that one had to use a filter in order to put the carriage-return at the end of the lines.

Markus
 
Old 12-03-2012, 04:38 PM   #13
CVAlkan
Member
 
Registered: Nov 2012
Location: Northwest suburbs of Chicago
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 242

Original Poster
Rep: Reputation: Disabled
Thanks for the comments ...
In order - yes it is indeed XP; I had a laptop with Vista, but I already cleaned that off and replaced Vista with Ubuntu so I can't try the printer on that machine (it doesn't have a parallel port anyway).

Regarding the comment:
"You can add a printer as a raw device i.e. no driver. Add a generic printer and choose a raw queue with the url pointing to the parallel port."

I think I just did this. I then typed in a single line of text in gedit and selected the new printer. Nothing seemed to happen, and when I looked in the Document Print Status, it showed my document with a size of 13k (I've been accused of writing long sentences but that doesn't seem right), and the status just says "Processing." Then, finally, some output appeared that wasn't garbage, but had recognizable terms like "PDF-1.5" and "<< /Length" and "/Filter." Thinking I might have selected the wrong thing by fat-fingering, I deleted the printer and went through the whole process again - twice - and more slowly each time. Still the same output.

So I'm guessing that this might indicate some progress that is perhaps being thwarted by all of the various changes to my setup that I've made over the past month in an attempt to get the thing to work. Is there an easy way to eliminate and reinstall everything having to do with the parallel port? Otherwise I guess I'll try to go back through my notes and manually "undo" everything - something that seems dicey at best.

Sigh... Reminds me so much of the early 80s, but I was quite a bit younger then.
 
Old 12-03-2012, 04:48 PM   #14
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Maybe you should read the manpages for lp and lpr. It is not a bad idea to use lpr without cups involved. It would be useful if you find some very old documentation about printing with Linux dated back in the mid 90s.

Markus
 
Old 12-03-2012, 05:35 PM   #15
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,568

Rep: Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865
Makes sense since many/most applications actually produce PDF or Postscript output and then the printer driver converts it to the appropriate format. Since you can print directly i.e. cat Test_File.txt > /dev/lp0 the printer port is configured correctly. As stated by markush manually sending a text file via the lpr command should output the desired results.

I would try installing a printer driver like the following which is a plain ASCII escape code device if my memory recall is still accurate.

http://www.openprinting.org/printer/Epson/Epson-LQ-850
 
  


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
Parallel Port printer with Ubuntu 10.04 doofinator Linux - Hardware 2 06-01-2012 02:23 AM
Ubuntu 10.04 parallel port disappeared... kern68 Linux - Hardware 16 02-07-2011 06:16 PM
redirect printer output on computer 1(Win2000) to Computer 2(Ubuntu)via parallel port dmarkd Linux - Hardware 2 12-01-2008 03:51 AM
Parallel Port & Serial Port device identification helpmeforlinux Linux - Hardware 3 01-02-2007 01:15 AM
What's using my parallel port?! DiBosco Linux - Hardware 10 06-20-2004 10:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:00 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
Open Source Consulting | Domain Registration