Setting up basic device connectivity
This file documents the procedure to set up basic device connectivity
(low-level I/O) with the HP OfficeJet Linux driver (hpoj) package,
whether setting up the hpoj software for the first time, upgrading
from an older version, or adding a new peripheral later.
The particular procedure you use depends on whether your peripheral is
connected locally to your PC via a parallel port or USB (Universal
Serial Bus), or connected to a LAN (Local Area Network)
via an HP JetDirect print server. In all cases, there will be
a "PTAL device name" which you will need to use when setting up printing,
scanning, or using any of the other applications provided with the hpoj
software.
Setting up local (parallel or USB) connections
When connecting a supported HP all-in-one peripheral locally to your PC,
whether to a parallel port or USB, there are two daemons that need to be
started in order to provide the necessary low-level I/O support:
- At the lowest level, ptal-mlcd
implements the HP MLC (Multiple Logical Channels) and IEEE 1284.4
transport protocols that are needed
to access the different services on the peripheral (print, scan, etc.).
- Above that is ptal-printd, which
simplifies printing setup by simulating a dedicated printer character
device, but routes the print data through libptal, which then
routes it through ptal-mlcd.
The ptal-init script is used for
starting and stopping the daemons, by invoking the
"ptal-init start" and
"ptal-init stop" commands, either
on the command line or when called as part of system startup/shutdown.
It in turn invokes the scripts ptal-start.conf for the actual
commands to start the daemons, and ptal-stop.conf for any
additional commands needed to stop the daemons. ptal-start.conf
and ptal-stop.conf are by default installed in
/usr/local/etc (or the etc directory under the
installation directory you specified to the configure script).
However, if you'd like, you can copy or move them to /etc,
where they will take precedence over files of the same name in their original
default location.
The PTAL device name for locally connected peripherals is of the form
mlc:par:XXXX for parallel-port connections or
mlc:usb:XXXX for USB connections. XXXX
is a unique number or string you specify to identify the device.
Note that when invoking ptal-mlcd,
you omit the mlc: prefix when specifying the device name, which is
the first parameter.
Read on for details specific to parallel-port or USB connections...
Setting up local parallel-port connections
It is not currently possible to reliably detect parallel ports (or the
peripherals connected to them) in user mode. Therefore, you will need
to edit ptal-start.conf and manually add command lines to start
ptal-mlcd and
ptal-printd. There is already a
pair of sample commands commented out in ptal-start.conf, which
you may be able to use verbatim or with small changes, by simply
un-commenting them (removing the leading "#" character for both
the ptal-mlcd and
ptal-printd lines).
You need to know the I/O-port base addresses of the parallel port. Most
motherboard ports are at 0x378, but 0x278 and 0x3BC are also possibilities.
For built-in parallel ports you may be able to consult your BIOS setup to
find out this information. If you have an ISA add-in card, the base address
may be set via jumpers. If you have a PCI add-in card, you can find this
out by running "lspci -v".
If you have an ECP (Extended Capabilities Port), then you also need to
know the "high" base address. For built-in or ISA ports, it's normally
hard-wired to 0x400 above the "low" base address (i.e. 0x778, 0x678, or
0x7BC). For PCI ECPs, you can again find this out by running "lspci -v".
Under Linux, you may be able to determine base addresses by invoking
the command "modprobe lp" and examining syslog messages
(/var/log/messages), and/or by looking at parport-related
files under /proc, although Linux kernels prior to 2.4 don't
provide the ECP high base address in /proc.
Important: Your parallel port should be set to preferably "ECP"
mode, or "bidirectional" (also known as "BPP" or "PS/2") at a minimum.
"Unidirectional" (also known as "SPP") and "EPP" may work, albeit more
slowly. Also, you may experience communication problems with certain models,
such as the OfficeJet Pro 1150C, R, and PSC 500 series, unless the parallel
port mode is set to either bidirectional or ECP.
The general form for invoking the daemons for parallel-port connections
in ptal-start.conf is as follows:
ptal-mlcd par:0 [-base 0xADDR] [-basehigh 0xADDR] \
-device /dev/lp0 $PTAL_MLCD_CMDLINE_APPEND
ptal-printd mlc:par:0 $PTAL_PRINTD_CMDLINE_APPEND
(The ptal-mlcd command line above is
split into two lines for clarity.)
Notes:
- For both ptal-mlcd and
ptal-printd, the device name is
always the first parameter. You may replace the "0" suffix on the device
name parameters above (par:0 for
ptal-mlcd and mlc:par:0 for
ptal-printd) with a different number
or string name if you'd like, but make sure that the device names you use are
unique if you have multiple parallel-connected devices.
- The -base switch specifies the low I/O port base address of the
parallel port. The default value is 0x378, which is typical for motherboards
with a single integrated parallel port. Make sure you specify this value in
hexadecimal, with the leading "0x".
- The -basehigh switch specifies the ECP high I/O port base
address of the parallel port. The default value is 0x400 above the low
base address. Make sure you specify this value in hexadecimal, with the
leading "0x".
- Important: Be very careful to specify the correct base addresses.
Incorrect base addresses at best will not work and at worst may cause
other hardware devices to malfunction or the entire system to crash!
- The optional but recommended "-device /dev/lp0" switch
specifies which printer character device maps to this parallel port. It is
not actually used for communication, but rather as a locking mechanism to
prevent other processes from opening the device and interfering with
ptal-mlcd's use of the port.
- $PTAL_MLCD_CMDLINE_APPEND is a placeholder that allows you to
specify earlier in ptal-start.conf additional options that you want
passed to every instance of ptal-mlcd.
Normally additional options won't be necessary, unless you are debugging
ptal-mlcd, in which case you'll want
to pass the -remconsole switch to each instance.
- $PTAL_PRINTD_CMDLINE_APPEND is a placeholder for additional
options to be passed to every instance of
ptal-printd. Normally, this shell
variable is set to "-like /dev/lp0", but there's no need to change
this even if your parallel port maps to a different device node, because
it is only used by ptal-printd for
copying file permissions.
- ptal-mlcd issues a warning error
message at startup if the parallel port isn't configured properly. If it's
not possible to set your parallel port to the right mode, then you can
add the "-porttype spp" switch to the
ptal-mlcd command line to get rid of
this error message, but as explained above, you may experience communication
problems with certain models.
Important: Be careful not to load kernel modules that conflict with
ptal-mlcd's use of the parallel port.
Typical examples of conflicting kernel modules include the following:
- ieee12844 and ieee12844pp from previous versions
of the hpoj software.
- vmppuser, which is part of VMWare and serves as a gateway
to the physical parallel port for the software (probably MS-Windows)
running under VMWare. If you must use vmppuser from time to time,
then at least be sure to run
"ptal-init stop" before loading it.
- The parport_probe module provided with Linux 2.2.x kernels
also conflicts with ptal-mlcd when it
gets loaded. However, you can largely prevent problems by specifying the
correct -device switch to
ptal-mlcd, which causes this module
to get loaded and get its parallel-port access over with before it causes
a problem for ptal-mlcd.
- Drivers for other parallel-port devices, such as Zip drives, may
also conflict with ptal-mlcd.
Do not share the parallel port with other devices, not even pass-through
devices such as switchboxes.
Other than the above caveats, it doesn't matter if kernel parallel-port
support is compiled/loaded as modules, compiled into the kernel, or
disabled entirely, since ptal-mlcd
bypasses the kernel to access the parallel port. As described earlier
in this section, the kernel parallel-port support can be useful for
determining the physical base address(es) of the port, but it is completely
unnecessary for ptal-mlcd's normal
operation. Of course, if it's disabled, then don't pass the -device
switch to ptal-mlcd.
Preparing Linux for USB support
For proper USB operation, the earliest supported Linux kernel versions are
2.2.19 and 2.4.2. In addition, 2.4.7 fixes some bugs related to USB unplug.
If you are using an earlier kernel, such as is the case with RedHat 7.0,
then you should upgrade your kernel to a supported version (preferably
the latest 2.2 or 2.4 as appropriate). Alternatively, you may be able
to just update /usr/src/linux/drivers/usb/printer.c to a newer
version and recompile your kernel and/or modules. For your convenience,
updated versions of printer.c are available on the
hpoj Download page.
The following kernel configuration options must be enabled:
- Support for USB (recommended as modules)
- Preliminary USB device filesystem
- Support for hot-pluggable USB devices
- USB controllers as appropriate for your system (UHCI, UHCI-alternate, OHCI)
- USB Printer support
- Any other device options you will need
The following kernel modules must be loaded (via modprobe or
insmod):
- usbcore
- One of usb-ohci, usb-uhci, or uhci, as appropriate for your system
- printer
- hub (if you will be using USB hub(s))
- Any modules you will need for other devices
As an alternative to loading all needed drivers at startup, you can set up
a "hot-plug" script to do this dynamically. This procedure will not be
explained here, but you can get more information on the
Linux USB home page.
Note: It is not recommended to load the hpoj daemons
(ptal-mlcd or
ptal-printd) from a USB hotplug
script.
Be sure to mount /proc/bus/usb (type usbdevfs), either
manually or at startup from /etc/fstab.
/proc/bus/usb/devices provides useful (albeit somewhat cryptic)
information about the devices attached to the bus. The usbview
utility displays the same information in a more readable fashion.
If necessary, create the directory /dev/usb. In that directory,
issue the following commands to create nodes for USB printer-class devices:
mknod lp0 c 180 0
mknod lp1 c 180 1
etc., as many as you need, but don't go past 15. Set the permission and
ownership as desired (for example, 0660 and root:daemon).
Note: For troubleshooting purposes, it may be useful to look at the
file /var/log/messages and/or run the graphical usbview
utility. For example, if the printer kernel module isn't loaded,
then no printer devices will be found. In this case, you may see messages
in /var/log/messages to the effect that a USB device "is not
claimed by any active driver," and usbview may display the
device in red instead of black.
Setting up local USB connections
Setting up for USB is much easier than for parallel, because devices can
be auto-detected much more easily. Run
"ptal-init setup" to start the
detection process, and follow the instructions from that point. For each
printer device it finds that isn't listed in ptal-start.conf, it
notifies you, suggests a default PTAL device suffix, and gives you an
opportunity to enter a different name (or press Control-D to skip the device).
Be sure to specify different device suffixes for each USB-connected device.
The default PTAL device suffix is based on the device's model name as
reported in the device ID string, with spaces replaced with underscores.
For example:
- "OfficeJet G85" defaults to "mlc:usb:OfficeJet_G85".
- "HP LaserJet 3200M" defaults to "mlc:usb:HP_LaserJet_3200M".
- "PSC 750" defaults to "mlc:usb:PSC_750".
If you subsequently want to change the PTAL device suffix or remove a
device's daemons altogether, then you must manually edit
ptal-start.conf and edit or remove BOTH the
ptal-mlcd and
ptal-printd commands for the
device in question.
Important: ptal-mlcd will
currently only work with USB peripherals that have an interface that
specifies a "class/subclass/protocol" value of "7/1/3", which can be
inspected using usbview.
Once ptal-start.conf is set up correctly,
ptal-mlcd should automatically
handle the problem where devices show up on different /dev/usb/lp*
nodes, depending on the order they were powered up or plugged in. However,
if you have other USB printers that are not controlled by
ptal-mlcd, then you will still have to
deal with this problem for those devices. Make sure you always use the right
device nodes to refer to the non-ptal-mlcd
devices, or you could interfere with
ptal-mlcd's access to its device.
Note: See the ptal-init
documentation for important information if you happen to have more than
one instance of the same USB-connected device.
Setting up JetDirect-connected peripherals
It is generally not necessary to use
ptal-init,
ptal-mlcd, or
ptal-printd if you only have peripherals
connected to a LAN via an HP JetDirect print server. However, for scanning
or using any of the other applications provided with the hpoj software, you
will still need to specify the correct PTAL device name, which takes one of
the following two forms:
hpjd:name
hpjd:name:port
where name is the hostname or IP address of the JetDirect,
and port is the port number (1, 2, or 3) for a multi-port
JetDirect, such as the 500X. The default port number is 1.
For full JetDirect support (specifically, using PML or retrieving the device
ID string), then you must have an SNMP development package, such as
ucd-snmp-devel, installed on your system, and the hpoj software must
have been configured to use it when you compiled/installed it.
Note: It is assumed that the JetDirect's SNMP community name is set
to public. Currently there is no way to override this assumption
other than hacking ptal-hpjd.c.
Note: Parallel-port JetDirects are limited to connecting to print,
scan, and PML services when in MLC mode. Connecting to other services,
such as echo, is only supported in 1284.4 mode, which was added in firmware
version x.08.xx. USB JetDirects, such as the 175X, support connecting to
any service on the peripheral in both MLC and 1284.4 modes.
Verifying basic connectivity
Here are some simple tests you can run to be sure you have basic connectivity
to the device, before you proceed to more complicated tasks such as setting
up printing or
scanning. In all of the following examples,
replace devname with the appropriate PTAL device name, as
explained above.
Note: If you get a "command not found" error, then refer
to the Post-installation steps for setting
the PATH environment variable.
- ptal-devid devname
Displays the device ID string. For example, here is the device ID string
from an OfficeJet K80, with line breaks added between fields for clarity:
MFG:Hewlett-Packard;
MDL:OfficeJet K80;
CMD:MLC,PCL,PML;
CLASS:PRINTER;
DESCRIPTION:Hewlett-Packard OfficeJet K Series;
1284.3M:f7f,f7f;
1284.4DL:4d,4e,1;
SERN:000000000010;
VSTATUS:$HB0$NC0,ff,DN,IDLE,CUT,K0,C0,SM,NR,KP085,CP080;
AiO:0;
DW-PCL;
- ptal-hp devname device
Displays information about the device from PML, as opposed to from the
device ID string. Note that some or all of the fields may be unsupported
on your model, in which case "(unavailable)" is displayed.
- ptal-hp devname clock
Displays the device clock, if your model is so equipped. In addition,
you may specify the -set switch to synchronize the device clock
with the PC clock. The -mmddyy, -ddmmyy, -yymmdd,
-12hour, and -24hour switches may be used to change the
device's date/time display format.
- ptal-hp devname display
xojpanel devname &
Displays the contents of the device's LCD (liquid crystal display), either
once on the command line (in the case of
"ptal-hp display") or in
more-or-less real time in a separate window (in the case of
xojpanel,
which requires the QT GUI toolkit library).
Note that some models do not support this feature; see the xojpanel
column on the
Supported devices page for more information.
- ptal-connect devname -service ECHO
Attempts to connect to the peripheral's echo service. Each line you enter
should be echoed back to you. Press Control-C or Control-D to exit.
Note: ptal-mlcd currently doesn't
always detect when the peripheral is disconnected or power cycled when it's
idle. Therefore, when the peripheral is connected and powered on again,
you may experience a failure when you run an application that tries to
access the peripheral. In most cases, if you retry the operation it will
succeed. However, in certain circumstances you may need to log in as
root and issue the command
"ptal-init start" to get
things going again. This problem will be worked on in a future version
of the hpoj software.
Next steps
Now you're ready to set up printing and
scanning, or return to the
index.