MikeL's Perl howto - Device::Parallel
Installing this thing shouldn't be this hard, but it took me quite a
while to get it going, so here's my notes. P.S. I was only trying to
make this work on Windows XP on an older 32 bit Dell. Just to make
clear, these are all steps I took in the process of getting it
working, spread across many reboots etc. Hopefully this is a simple
direct path to success.
- Now's the time to upgrade your Perl install if you haven't done so
recently. Go to your "add/remove" programs, and uninstall your
old Perl.
- Clobber anything remaining in your old perl directory. (I have
some custom stuff of my own in the site/lib directory that I left,
but nothing else.)
- Install current production Perl. I
use ActiveState (click "languages" tab, choose "ActivePerl", then "download free community edition").
- From command line:
ppm install Device-ParallelPort-drv-win32
If you don't have ppm, use:
cpan install Device::ParallelPort::drv::win32
- Do a web search and download "inpout32". I found this here
(you've gotta click on the "x64" even though you're x32):
logix4u.net inpout64 page find "click here for full description ... 32 bit version" [local copy InpOutBinaries.zip].
From the Win32 directory in the zip file, copy:
hwinterface.sys
into windows/System32/Drivers
directory.
- unzip the 32 bit folder version of
inpout32.dll
and move it
into \windows\system32\
directory.
Here's my sample test program, cribbed from the package itself in the
synopsis of the Device::ParallelPort package:
#!/usr/local/bin/perl
use strict;
use Device::ParallelPort;
my $port = Device::ParallelPort->new();
$port->set_bit(3,1);
print $port->get_bit(3)."\n";
print ord($port->get_byte(0))."\n";
$port->set_byte(0, chr(255));
(I don't even know yet if this is what it's supposed to do, I'm just
documenting what I did to get it this far!) Running this prints:
1
255
When I was having problems, I would get a message something like the following [note "unabel" sic]:
Device::ParallelPort unabel to create driver auto (see Device::ParallelPort::drv
::auto for further information) - Device::ParallelPort::drv::auto (auto detect)
error
failed to load win32 - Can't locate Device/ParallelPort/drv/win32.pm in @INC (@I
NC contains: F:/Progs/System/Perl/lib F:/Progs/System/Perl/site/lib .) at (eval
2) line 2.
BEGIN failed--compilation aborted at (eval 2) line 2.
. Make sure you have loaded and installed Device::ParallelPort::drv::win32 from
CPAN. Install Device::ParallelPort::drv::(linux|parport|win32) and try again at
(eval 1) line 3
at L:\Page\cgi-bin\lpt.pl line 2
Side notes, questions I asked myself when I was having trouble:
- When I was getting the above message, I did have
win32
loaded
- I lost track of when this message stopped happening and I started getting a message about not finding
inpout32.dll
, there may have been a reboot
- I do have a physical DB25 on the computer
- Yes, parallel is enabled in BIOS, x378 "AT mode"
- It may work in other modes, this is simply the mode it was in when I got it working
- There is nothing physically plugged into the DB25 at this time
- There is a USB printer on the machine
- On a laptop that I did not get working, the parellel port is apparently in the external dock which I don't have - don't know if this is the problem as I was just testing on that machine -- got it working on desk box and quit trying on the laptop
- That laptop that I did not get working was a 64 bit machine
Later addition - got it to work on Windows 7 x64 bit laptop. You must
rename inpoutx64.dll
to inpout32.dll
, then copy this file into the
/windows/system32
directory. This computer is printing
"1" and "120". I have not looked into the docs yet to see if it's
expected that this returns a different number than my other box. Note
that this is working without the dock.
Another later addition - now that I got it working on the laptop, I
tried all 4 parallel port settings in the BIOS, and there was no
difference, even disabled. Options are "Disabled", "AT", "PS2", and
"ECP".
Copyright © 1995-2024
Mike Lempriere
(running on host bayanus)