Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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).
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.
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.
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
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.)
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.
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.
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).
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.
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.
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
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:
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?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.