LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 09-25-2019, 05:59 PM   #1
WayCon
Member
 
Registered: Sep 2019
Posts: 77

Rep: Reputation: Disabled
Linux to LPT1:


Hello,

I have been working with Ubuntu Mint and feeling I'm getting somewhere. For my bookstore I have a special POS application which I wrote myself on dBase and has served me well for 30 years. My problem is printing to LPT1: on Linux. I feel I'm getting close to success because, after I have given myself permissions, I can print from terminal:

waycon@waycon-Opti960:~$ echo "hi" > /dev/lp0

and it works. I'm talking directly to the metal. No drivers. (The printer, here, is a simple Epson TM-U325 receipt printer.) The trouble is that when I get into dBase via Dosemu and try to print something, it doesn't. I don't know how welcome this question will be because it may well be, at least partially, an application question. But does anyone have experience interfacing Linux, dBase and lpt1 printers?

In any case, I thank you for your time.
 
Old 09-25-2019, 07:50 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,340

Rep: Reputation: Disabled
You need to tell dosemu what to do with the data the application sends to LPT1.

You control this by altering/adding a global setting to either doesmu.conf (which probably resides in your /etc directory), or by editing the .dosemurc file in your home directory if you want the setting to apply to your user account only.

The settings you need, are probably something like:
Code:
$_lpt1 = "lpr -l"
$_printer_timeout = (10)
The first setting specifies that the lpr command should be used for sending print jobs to the printer. Important: This assumes that you already have a working printer setup in Linux.

The latter setting controls how long dosemu should wait before assuming that a DOS application is done printing, and the complete print job can be sent to the printer. This makes sure older DOS applications that assume you have a line printer (or even a character printer) will work with modern page printers such as laser printers.

See the dosemu documentation for more details.

Last edited by Ser Olmy; 09-25-2019 at 09:16 PM. Reason: typos
 
Old 09-25-2019, 07:57 PM   #3
WayCon
Member
 
Registered: Sep 2019
Posts: 77

Original Poster
Rep: Reputation: Disabled
Thank you, Ser Olmy,
For getting right back to me. I'll cut and paste your text into dosemu.conf, and let you know how it goes.
Again, thank you.
 
Old 09-25-2019, 08:47 PM   #4
WayCon
Member
 
Registered: Sep 2019
Posts: 77

Original Poster
Rep: Reputation: Disabled
Hello Ser Olmy,

I tried your suggestion without success, I'm afraid.

I cut and pasted your lines into dosemu.conf:

_lpt1 = "lpr -l"
_printer_timeout = 10

with the results:

waycon@waycon-Opti960:~$ dosemu
In file included from built-in global.conf:117
from :117
Error in /etc/dosemu/dosemu.conf: (line 407) unrecognized command 'lpt1'
Error in /etc/dosemu/dosemu.conf: (line 407) syntax error
Error in /etc/dosemu/dosemu.conf: (line 407) unrecognized command '"lpr -l"'
Error in /etc/dosemu/dosemu.conf: (line 408) unrecognized command 'printer_timeout'
4 error(s) detected while parsing the configuration-file

Then I saw dollar signs in the file and changed the two lines by adding dollar signs:

$_lpt1 = "lpr -l"
$_printer_timeout = 10

with the result:

root@waycon-Opti960:/etc/dosemu# dosemu
In file included from built-in global.conf:117
from :117
Error in /etc/dosemu/dosemu.conf: (line 408) syntax error
1 error(s) detected while parsing the configuration-file

I'm certainly beginner enough to know that I don't recognize the syntactical errors. Here is what that whole section of dosemu.conf looks like now:

#############################################################################
## Printer and parallel port settings

# Print commands to use for LPT1, LPT2 and LPT3.
# Default: "lpr -l", "lpr -l -P lpt2", and "" (disabled)
# Which means: use the default print queue for LPT1, "lpt2" queue for LPT2.
# "-l" means raw printing mode (no preprocessing).

# $_lpt1 = "lpr -l"
# $_lpt2 = "lpr -l -P lpt2"
# $_lpt3 = ""

$_lpt1 = "lpr -l"
$_printer_timeout = 10

# idle time in seconds before spooling out. Default: (20)

# $_printer_timeout = (20)

##############################################################################

I certainly appreciate your input. If you have any more for time for this, I would be thankful for any additional insights.

In any case, again, thank you.

Last edited by WayCon; 09-25-2019 at 08:53 PM. Reason: Neglected to mention file name: dosemu.conf
 
Old 09-25-2019, 09:16 PM   #5
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,340

Rep: Reputation: Disabled
Erm, yes, the variable names should indeed start with dollar signs. I've updated my post accordingly.

It also seems that for some reason, the idle timeout parameter should be inside parentheses.
 
Old 09-25-2019, 09:18 PM   #6
WayCon
Member
 
Registered: Sep 2019
Posts: 77

Original Poster
Rep: Reputation: Disabled
Thank you. I'll get on it.
 
Old 09-25-2019, 10:02 PM   #7
WayCon
Member
 
Registered: Sep 2019
Posts: 77

Original Poster
Rep: Reputation: Disabled
Hello again,

Here's what I get now:

waycon@waycon-Opti960:~$ dosemu
Using CPU emulation because vm.mmap_min_addr > 0.
For more information, see /home/waycon/.dosemu/boot.log.
ERROR: MFS: couldn't find root path /media/CDROM
lpr: Error - No default destination.

Any more ideas. I feel we're closing in on it.

Thank you, as always.
 
Old 09-25-2019, 10:13 PM   #8
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,340

Rep: Reputation: Disabled
Looks like you haven't configured your printer in Linux.

I assume CUPS (the printing subsystem) is installed and running since you get "no default destination" rather than "error - scheduler not responding". Try opening a web browser (on the Linux machine) and go to http://localhost:631/ ; it should display the CUPS page.

For detailed instructions on how to configure your printer, check one of the many CUPS tutorials on the Internet. For instance, here's one.

Once the printer is up and running you can try again. Well, you may also want to remove the reference to "/media/CDROM" that apparently exists somewhere in your configuration file.
 
Old 09-26-2019, 12:07 PM   #9
WayCon
Member
 
Registered: Sep 2019
Posts: 77

Original Poster
Rep: Reputation: Disabled
Hello, again,
And thank you again. I had to stop working last night as I was writing my last message as my wife was demanding I get off the computer and come to bed. I will work on what you have suggested. I do have one question, though: as I was able to communicate directly with the parallel port in terminal without a driver which, I believe, I'm always doing in Windows, do I need one here? or is CUPS other than a driver?

Last edited by WayCon; 09-26-2019 at 12:08 PM. Reason: Misspelled CUPS
 
Old 09-26-2019, 12:40 PM   #10
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,340

Rep: Reputation: Disabled
LPT access in dosemu works very much like LPT ports inside a cmd window in Windows: The application sends a print job to the port, and the OS captures it and forwards it to a specified print queue when it thinks the application is done printing (hence the timeout parameter).

A print queue is associated with a physical printer by means of a driver. Doing it this way means terminal/DOS applications that only really know about printer ports can print even to networked printers. But yes, in order for this to work one has to get the printer working under the operating system itself, otherwise there'd be no print queue. In this case, you'll have to configure your printer in Linux.

I know that it used to be possible to access a printer port directly from dosemu, but I'm not sure this still works. One would have to comment out the lpt1 and timeout parameters, and instead use the "$_ports" parameter to associate an I/O port range in the DOS environment with a Linux printer port device like /dev/lp1:
Code:
# $_lpt1 = "lpr -l"
# $_printer_timeout = (10)

$_ports { device /dev/lp1 fast range 0x378 0x37f }
(BTW, notice how the [code] [/code] tags around the text above increases readability. This practice is highly encouraged on this forum.)
 
Old 09-26-2019, 12:52 PM   #11
WayCon
Member
 
Registered: Sep 2019
Posts: 77

Original Poster
Rep: Reputation: Disabled
Thank you. I'll try that. Interesting thing with CUPS though: When I click on say View Access Log or View Error Log, I'm asked for my username and password and I get in, but when I click on Add Printer and then give my username and password I'm not given access--I'm just asked for my username and password again. What would be the difference, I wonder.
 
Old 09-26-2019, 01:04 PM   #12
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,340

Rep: Reputation: Disabled
CUPS supports different types of authentication, and just to make things really interesting, the various distributions have wildly different settings in /etc/cups/cupsd.conf.

Try with "root" as the username and (of course) the root account password. If that doesn't work, it seems Mint provides an alternative mechanism for adding a printer, which will modify the CUPS configuration for you.
 
Old 09-26-2019, 01:14 PM   #13
WayCon
Member
 
Registered: Sep 2019
Posts: 77

Original Poster
Rep: Reputation: Disabled
Hello again.
I attempted what you suggested and the response was:

root@waycon-Opti960:/etc/dosemu# dosemu
In file included from built-in global.conf:117
from :117
Error in /etc/dosemu/dosemu.conf: (line 410) syntax error
Error in /etc/dosemu/dosemu.conf: (line 410) unrecognized command '/dev/lp1'
2 error(s) detected while parsing the configuration-file

Here is what /etc/dosemu/dosemu.conf looks like now:

##############################################################################
## Printer and parallel port settings

# Print commands to use for LPT1, LPT2 and LPT3.
# Default: "lpr -l", "lpr -l -P lpt2", and "" (disabled)
# Which means: use the default print queue for LPT1, "lpt2" queue for LPT2.
# "-l" means raw printing mode (no preprocessing).

# $_lpt1 = "lpr -l"
# $_lpt2 = "lpr -l -P lpt2"
# $_lpt3 = ""

# $_lpt1 = "lpr -l"
# $_printer_timeout = (10)

$_ports { device /dev/lp1 fast range 0x378 0x37f }

# idle time in seconds before spooling out. Default: (20)

# $_printer_timeout = (20)

##############################################################################

I wasn't sure what you meant by your comment about tags, so I guessed and tried the $_ports line without the brackets { and } and that didn't work either.

I'll look, now, at the link you sent me for an alternative Cups configuration.

Thank you, again.
 
Old 09-26-2019, 01:25 PM   #14
WayCon
Member
 
Registered: Sep 2019
Posts: 77

Original Poster
Rep: Reputation: Disabled
Hello,
Thank you for the suggestion of an alternative means of installing a printer. It saw that there was a printer connected, though not exactly the one I'm using. It also saw that it was attached to the parallel port. I accepted the installer's suggestion that the printer be "generic" and "text only," and it installed. When I tried to print something out, I got the following error: "CUPS server error. There was an error during the CUPS operation:'client-error-document-format-not-supported' . I had tried this before and got the same result and had uninstalled all printers.
Again, thank you.
 
Old 09-26-2019, 01:30 PM   #15
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,340

Rep: Reputation: Disabled
Quote:
Originally Posted by WayCon View Post
I attempted what you suggested and the response was:

root@waycon-Opti960:/etc/dosemu# dosemu
In file included from built-in global.conf:117
from :117
Error in /etc/dosemu/dosemu.conf: (line 410) syntax error
Error in /etc/dosemu/dosemu.conf: (line 410) unrecognized command '/dev/lp1'
I guess the LPT passthrough function is no longer supported. I suspected as much.

Back to the print queue setup it is, then.
Quote:
Originally Posted by WayCon View Post
I wasn't sure what you meant by your comment about tags, so I guessed and tried the $_ports line without the brackets { and } and that didn't work either.
That was just a tip regarding posting in this forum.

When you paste something from a config file or similar, simply type [code] right before the text, and [/code] immediately following it. That will turn something like this:

config_setting = 45
another_setting {
this_really_should_appear_indented = 1
}

into this:
Code:
config_setting = 45
another_setting {
      this_really_should_appear_indented = 1
}
As you can see, the text appears in a nice box with all whitespace/indentation preserved. And as a bonus, scroll bars appear if the text contains really long lines, instead of the excessive length of one line affecting the formatting of the entire post:
Code:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis at magna vel sem laoreet rutrum. Morbi ac lobortis diam. Sed a maximus justo. Nulla lacinia ex erat, sed commodo magna elementum in. Suspendisse varius leo molestie nunc vehicula, eget condimentum ex ullamcorper. Vivamus blandit ut nulla vitae feugiat. Praesent consectetur, erat sed dapibus fringilla, massa dui scelerisque elit, malesuada maximus libero ex id magna. Pellentesque imperdiet lectus ac tellus vulputate elementum and what on earth are you doing all the way over here?
 
  


Reply



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
Linux box won't print across LAN to XP box LPT1 whynotlinux Linux - Networking 1 08-28-2006 10:36 AM
URGENT call to old school guys: Transfer a file from linux to Win95 via com1 or lpt1? khermans Linux - Networking 12 04-17-2005 05:23 PM
connect to another linux via (LPT1) farshad1366 Linux - Newbie 6 09-18-2004 08:42 AM
Kernel doesn't support LPT1 esael Slackware 1 08-27-2002 06:27 PM
Lpt1 esael Slackware 3 08-26-2002 07:01 AM

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

All times are GMT -5. The time now is 05:26 AM.

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