Revisiting an old unsolved problem with Parallel Port
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
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.
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 242
Rep:
Revisiting an old unsolved problem with Parallel Port
Shortly after Ubuntu 12.04 was released, I added it as a dual-boot to my existing Windows XP installation.
I spent an inordinate amount of time attempting to get a dumb daisy wheel printer to function in some fashion under Ubuntu, but with no success whatsoever. All I require is that I be able to send raw files to the device, even if it is from the command line. In spite of a flood of responses with various suggestions, none of these got me any closer. Eventually, I gave up. For the record, it's not that I'm particularly enamoured of my daisy wheel device - I much prefer the latest of my dual-sided, amazingly fast ink-jet printers (and I even had the old Laser-Jet II for many years). BUT, there is a place for IMPACT printers. Since I have a perfectly good one, it seems to me that it shouldn't take a miracle to get it printing again with an OS that claims to be ready to replace Windows.
Recently, I added Ubuntu 14.04 to the machine, and decided to give the old printer another go. I went through all of my earlier notes - including all of the many discussions of this issue on various web forums. The problem with these, of course, is that many give conflicting advice, outdated information, and so forth.
I have a PCI card installed in the chassis with a parallel port and, during the earlier attempt, I purchased a USB-Parallel converter to see if that might work. Both, I should add, function just fine under Windows, so it appears there is nothing amiss with the hardware.
So I thought I would once more see if anyone has any suggestions. I've added the results from the commands suggested in the past as relevant. In summary, these are:
dmesg | grep par
dmesg | grep ppdev
ls -l /dev/lp* /dev/parport*
lpinfo -v
lspci -vv
lsusb
cat /etc/modules
ls -l /proc/sys/dev/parport/parport*/autoprobe*
ls -l /proc/sys/dev/parport/parport*/autoprobe*
modprobe -c | grep parport
The outputs from each of these commands is in the attachment, as the LQ BBS seems to think they are images for some reason:
=====================================================================================
COMMENT REGARDING I/O Ports for Parallel Adaptor:
I suspect (based on comments I've seen on the internet) that the port locations on this adaptor may be non-standard, specifically the location of cc00 for Region 3. See the entry in dmesg | grep par above, which says:
[ 20.402778] parport0: PC-style at 0xcf00 (0xce00), irq 21, using FIFO [PCSPP,TRISTATE,COMPAT,ECP]
To correct this, per a web posting I can no longer locate, I created a file '/etc/modprobe.d/options' with the single line:
options parport_pc io=0xcc00 irq=none
Once I did this, the command:
echo "Hello" > /dev/usb/lp3
actually "worked" ... (i.e. 'Hello' was printed)
At this point I had:
Results of: ls -l /dev (abbreviated)
crw-rw---- 1 root lp 6, 0 Jul 21 08:54 lp0
crw-rw-r-- 1 root lp 99, 0 Jul 21 08:54 parport0
Then, knowing that CUPS can't handle subdirectories, I created a symbolic link using the command:
ln -s /dev/usb/lp3 /dev/lp3
I was then able to enter:
echo "Hello" > /dev/lp3
... and this "worked" as well. At this point the results of ls -l /dev (abbreviated) were:
crw-rw---- 1 root lp 6, 0 Jul 21 08:54 lp0
lrwxrwxrwx 1 root root 12 Jul 21 11:00 lp3 -> /dev/usb/lp3
crw-rw-r-- 1 root lp 99, 0 Jul 21 08:54 parport0
I then attempted to add the printer to CUPS, which seemed to go ok, but it refused to do a test print; the printer showed up in my apps, but when I attempted to print, it told me that my printer wasn't configured properly. And this effort managed to kill the ability to echo something from the command line tellimg me I didn't have permission (even with sudo).
I rebooted, and the echo ability returned but, again, when I made any attempt to use the thing in any fashion at all, it went AWOL. This obviously suggests that something is clobbering something else but I got lost in the descent into the abyss.
So --- I'm further along than I was two years ago with Ubuntu 12.04, but sadly not up to the point I was in 1985 when I first moved from Xenix and AT&T Unix to these new-fangled personal computers. Trying to track down what is going on in Ubuntu is mystifying, as half the stuff I look at doesn't match what's shown on line, and everything seems to be redirected somewhere else - often several times. I'm beginning to believe that all these redirections are just meant to hide the fact the Ubuntu's underlying kernel is really MS-DOS 3.1. I rejected that, of course, as I don't recall it being this hard to get a printer working back then (although there were moments of course.)
The device I'm attempting to use (on either parallel port; I don't care) is not "smart" nor is it bi-directional; I have no idea how to tell if that is something that needs to be configured or how to do that. In any case, the output of lsusb -v for the USB-Parallel adaptor (Bus 006 Device 002) would seem to indicate that the USB port at least knows it's unidirectional.
It would be nice, although not mandatory, to be able to use the printer from CUPS or at least as a printer within Ubuntu. What I need as a minimum, though, is a way to use some command to send a raw file from the command line to the printer. (Is there a way to just direct a file to the USB port directly?)
Ultimately, I would like to use the printer with an old accounting application that runs in DOS (under DOSEMU and in a Virtual Machine with Windows), both of which are dependent on the printer working in the Ubuntu host so far as I know.
lp is still cups so I would suspect it isn't going to work either.
If echo worked then cat should also i.e.
cat filename > /dev/lp3
I'm not aware that cups can not subdirectories but it has been a while since I've played with a parallel port printer. Check your /etc/cups/printers.conf. The device URI should be something like:
DeviceURI = parallel:/dev/lp3
If you get it working in cups then it should be doable in both dosemu and windows. With windows you can set up a samba share or direct via ipp.
In some of those it is possible to get a new style cable and set the card or usb to a bidirectional transfer and that sometimes helps. Also we assume pci you shouldn't have to fool with irq's and such.
Depending on bios this add on card may or may not be what you think. The onboard uart chip may hold a 0 lp port and you'd have to add so it would be either lp1 or lp2 or even higher.
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 242
Original Poster
Rep:
Thanks to all of you for your responses.
For jailbait: Ubuntu 14.04 tells me that "The printer or class does not exist" when I give the lp command you provided. I thought perhaps you meant lpr instead, but there is no -d format modifier for that (at least on my OS).
For michaelk: You are right, and I should have mentioned that "echo Hello > /dev/lp3" and "cp Test.txt /dev/lp3" work as well as the "cat Test.txt > /dev/lp3" you suggested and the "echo Hello > /dev/lp3" command I mentioned (less typing). The entry in /etc/cups/printers.conf is actually "DeviceURI parallel:/dev/lp3" (i.e. there is no equals sign in the entry), but that seems consistent with the entries for my inkjet printers, so I assume that's correct.
For jefro: I'll have to read through the links you provided, but since they're not ones I had stumbled upon before, thanks much more pointing them out. Your comment about yanking the PCI parallel card our also seems like something I'll try when I get a little time, as I guess there may be some possibility that my system is getting confused by having two supposed parallel ports hanging around.
But, something is still amiss somewhere, as even though CUPS seems to have everything it needs, it won't print to the device. michaelk mentioned not being aware of the subdirectory name limitation of CUPS. I haven't located anything that confirms that, but if I don't issue the command "sudo ln -s /dev/usb/lp3 /dev/lp3" CUPS doesn't see it at all. With the link, CUPS sort of sees it, but doesn't use it.
A further quirk that seems like some sort of clue to me is that the link is not permanent. I need to recreate it for each session.
But, again, thanks for the suggestions and thoughts. I'll try to report back if I get a chance to yank out the PCI parallel port card.
Basically /dev is a virtual file system i.e. it exists in memory only and recreated at boot time. If you want a permanent link you would need to create a udev rule. Oops don't know how the = sign got there but you are correct.
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 242
Original Poster
Rep:
Thanks Michael.
As near as I can tell, the permissions seem to be ok (at least they match permissions on the devices that work).
I don't recall ever hearing of udev rules back in the past, but after poking around, and finding many, many sets of instructions on the web, I didn't spot one that permitted just an execution of a command, but that's undoubtedly because I wouldn't recognize it if I did.
Could I ask what the syntax would be for just having a rule that just executed the "ln -s /dev/usb/lp3 /dev/lp3" command on startup? I would like this to be executed regardless of whether I remembered to turn on the device or not. Then at least I'll be able to copy things from the command line to the device even if CUPS doesn't like it. I presume I would add a new file to the /etc/udev/rules.d directory, as the only file there now is "70-persistent-net.rules." Or, do I create the rule file in my own user directory?
It also seems from what I read that the file would have to be named beginning with a number less than 70 and have the extension ".rules" but I'm sort of inferring this from the examples, so would appreciate confirmation.
Thanks again for your patience; I was thinking of dropping Mark Shuttleworth a line suggesting that this might be an example of why Linux isn't likely to replace Windows for the masses quite yet. What was also interesting to me was that, in poking through the CUPS documentation on line, their recommended method for determining if there was a hardware problem when encountering issues with printing in CUPS was to - hold your breath - try using the device under Windows. Uh-Oh...
You might try a few older live cd's to double check this setup. Some of the Knoppix 3.x to 5.x might work directly. For the most part, no one uses parallel printers anymore. I'd also try a number of other live cd's to see what is possible. If you get one to work then look at how it works and try to re-create it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.