NAME

hpoj reference: "ptal-init"

DESCRIPTION

The "ptal-init" script may be called on the command line or by your
system’s startup and shutdown sequences to automatically start and stop
the hpoj daemons ("ptal-mlcd", "ptal-printd", and "ptal-photod"). It
also serves as a convenient tool for managing (adding and removing)
devices of all connection types (parallel, USB, or JetDirect) which
should be controlled by the hpoj daemons. Click here for more
information on setting up basic device connectivity with the hpoj
software.

OPTIONS

· "command" is one of:
· "start", "restart", or "reload" to both stop and (re)start the
daemons
· "stop" to stop the daemons
· "setup" or "probe" to add or remove devices
· "status" to return 0 if started or 1 if not (any user may call
this)
· "condrestart" to restart only if already started
· "-verbose" -- also lists daemon start command lines for debugging
· "-quiet" -- suppresses the "stopping" and "starting" messages

NOTES

"ptal-init" contains a special comment line telling the RedHat
"chkconfig" to start "ptal-init" in runlevels 2, 3, 4, and 5, and stop
it in other runlevels, with a start order of 59 and a kill order of 61.
These settings are based on the following dependencies and assumptions:
· "lpd"’s start and kill orders are both 60, because "ptal-printd"
needs to be started before "lpd".
· CUPS’s start order is 90 and kill order is 10, because "ptal-mlcd"
needs to be started before CUPS.
The version of Perl shipped with RedHat 9 has a bug with regular-
expression parsing (such as when "ptal-init" reads its configuration
files) when used in a UTF8 locale (as defined by the "LANG" environment
variable). "ptal-init" works around this problem by re-invoking itself
with a non-UTF8 locale if necessary. If something goes wrong with this
workaround, an alternative way to fix this is to edit the file
"/etc/sysconfig/i18n" and change the "LANG" setting to "C". When
installing hpoj on other distributions that lack "chkconfig", start
"lpd" or CUPS in a different order, or don’t even have a SysV-style
init subsystem, then you may need to manually integrate "ptal-init"
into your system’s startup and shutdown sequences. ""ptal-init setup""
has a list of known possible wildcard patterns to match parallel and
USB printer device nodes on various platforms. If necessary you may
update this list by editing the definition of @parWildcards and/or
@usbWildcards near the top of the "ptal-init" script. "ptal-init" is
derived from "ptal-init.in" by the "./configure" script, after
substituting in the $prefix (installation base path) variable.
"ptal-init" erases and re-creates the socket/pipe directories needed by
"ptal-mlcd" and "ptal-printd". Previous hpoj versions expected these
directories in "/dev", but they are now located in "/var/run", because
some platforms have a read-only "/dev" file system. For backwards
compatibility it attempts to create a symlink from "/dev/ptal-printd"
to "/var/run/ptal-printd" so you don’t necessarily need to re-create
print queues when upgrading from an earlier hpoj version. If either
the directory "/var/lock/subsys" or "/var/lock" exists, "ptal-init"
creates and deletes the file "ptal-init" in that directory. This is
needed for the SysV init system in RedHat and possibly other
distributions. For Linux, "ptal-init" attempts to run the commands
""/sbin/modprobe lp"" and ""/sbin/modprobe printer"" before probing for
and starting daemons for the first parallel- and USB-connected device,
respectively. (Exception: this is not done for USB-connected devices
if "ptal-mlcd" was compiled for "libusb" support and it’s running on
SMP (multi-processor) Linux.) Previous versions didn’t do this for
""ptal-init start"", which sometimes resulted in a situation where
""ptal-init setup"" configured the device successfully but device
connectivity was lost after a reboot. ""ptal-init start"" delays two
seconds before starting the first instance of "ptal-photod", to
increase the chance that the kernel has had enough time to release the
TCP port used by the previous instance of "ptal-photod" so that the
same TCP port number (and therefore "mtools" drive letter) will be used
for the new instance. Notes on the "setup" command ""ptal-init setup""
walks you through the following steps, prompting you for confirmation
or other information when necessary:
· Deleting devices if desired
· Probing for parallel-connected devices (Linux and FreeBSD only)
· For Linux kernels 2.2.x, 2.4.x, and possibly later versions,
parallel ports are auto-detected based on information found in
the "/proc" file system.
· You may manually enter base address and kernel device node
information for parallel ports which were not auto-detected.
· Because probing a specific parallel port can be dangerous if
incorrect base address information is supplied, you must
confirm (default=no) the relevant port information before the
probe will take place.
· Probing for USB-connected devices (only Linux and (theoretically)
other "libusb"-supported platforms)
· "libusb" device names are of the form ""%bus%device"".
· Setting up JetDirect-connected devices
· Currently the network is not automatically probed for
JetDirect-connected devices. Instead, you must enter the
hostname or IP address and port number (for multi-port
JetDirects such as the 500X).
· Setting or un-setting the default device name (only if multiple
devices and/or a default device name have already been configured)
· Starting the daemons for currently registered devices
The following ""ptal-init setup"" yes/no prompts allow you to
optionally append (after an explicit "[y]es" response) additional
command-line switches that should be passed to "ptal-mlcd" probe
instances and to any new devices that are added as a result:
· whether to probe for parallel-connected devices in general
· whether to probe for a device on a specific parallel port
· whether to probe for USB-connected devices in general
For the sake of succinctness this capability is not mentioned in the
on-screen messages. For example, if you want to turn on more warning-
message output while "ptal-mlcd" probes devices, you can answer the
appropriate yes/no questions above as ""y -logwarn"" (be sure to put a
space between the explicit "[y]es" response and the appended command-
line option(s)). Or, a if composite USB device is giving you trouble
and you want to disable this capability and revert to a pure MLC/1284.4
communication model, then you can enter ""y -nocomp"". The Linux
kernel USB printer-class driver ("printer.o") currently has stability
issues on SMP (multi-processor) systems, at least through the 2.4
kernel series. ""ptal-init setup"" now checks whether your system is
running in SMP mode before probing for USB devices and (if necessary)
offers to update "/etc/modules.conf" and "/etc/hotplug/blacklist" to
prevent "printer.o" from being auto-loaded in the future. This allows
the more robust "libusb" communication method to be used instead. Note
that this will prevent all use of USB printers via direct access of
"/dev/usb/lpX" device nodes, which would be an issue in conjunction
with non-hpoj-supported single-function or non-HP printers. If you
ever want to undo these changes to allow "printer.o" to be loaded in
the future, then be sure to update both files ("/etc/modules.conf" and
"/etc/hotplug/blacklist"). Similarly, the Linux kernel USB "scanner.o"
driver has a bug where it inappropriately tries to bind to certain hpoj
devices (PSC 1210 in 2.4.22 and 2.5/2.6.0-test; also PSC 750 but in
practice this model isn’t actually affected). Therefore, ""ptal-init
setup"" tries to detect this situation by parsing the file
"/proc/bus/usb/devices" and offering to disable and unload "scanner.o"
the same way it does as described above with "printer.o" on SMP
systems. Note that this may break any USB single-function scanners you
might also have connected, and you will need to either reconfigure the
affected devices to use "libusb" if possible, or
modify/recompile/reinstall "scanner.o" to not bind to your hpoj device.
Both of the above "detect+blacklist+unload" workarounds for "printer.o"
and "scanner.o" issues will probably not work correctly if the relevant
kernel modules are renamed (or in the case of "scanner.o", compiled
into the kernel instead of dynamically loaded as a module). When
probing a device, ""ptal-init setup"" performs the following actions:
· Before probing the first USB device, starts a "glob" instance of
"ptal-mlcd" to return (via the special "PTAL-MLCD-GLOB-DEVNODES"
service) a list of possible USB kernel and "libusb" device nodes.
· Starts a "probe" instance of "ptal-mlcd", except for JetDirect-
connected devices.
· Queries the model and serial number strings and ensures that at
least a non-blank model name was returned, meaning that "ptal-mlcd"
was successful in establishing bidirectional communication with the
device.
· Else if the model name couldn’t be read, attempts to read the
"previous" device ID string to determine if "ptal-mlcd" could
read the device ID string but not establish bidirectional
communication.
· Uses the model name, serial number, and parallel-port base address
(if applicable) to determine if this device has already been set
up, except for JetDirect-connected devices.
· Proposes a default device name and prompts you to confirm or change
it or skip setting up this device, except for JetDirect-connected
devices.
· Deletes old devices which conflict with this new device in name or
parallel-port base address (if applicable), for example if you
moved a device around from one parallel port to another or replaced
a device with another of the same model with a different serial
number.
· Creates the new device’s configuration file:
· Writes the file version.
· Writes the model and serial-number strings (if any).
· Enables "ptal-mlcd" and "ptal-printd", except for JetDirect-
connected devices.
· Probes the device for photo card-reader support and enables
"ptal-photod" if appropriate.
· Reads the new configuration file back in so the necessary daemons
can be started later.
In most cases, "ptal-mlcd" now properly handles situations where you
have more than one instance of the same model connected locally, with
the following caveats:
· For parallel connections, different parallel ports (with different
base addresses) are sufficient to uniquely identify each device.
· For USB connections, each device must include a unique serial
number field in the device ID string, not just in the USB
descriptors.
· You still need to specify unique device names in the above cases,
unless you want to replace one device with the other.
· As a consequence of this more robust unique-device detection, if
you move devices between parallel ports or replace a device with
the same model but a different serial number, then you must re-run
""ptal-init setup"" to delete and re-probe the affected device
names. Alternatively, if you want to relax the unique-device
detection, you can comment out the lines in the device’s
configuration file that specify the model and/or serial number
strings.
· If you connect via USB two identical models with no unique serial
number in the device ID string (for example, two LaserJet 1220s or
3200s), then ""ptal-init setup"" will only create one device name,
with the effect of setting up a form of "fail-over" redundancy in
case one gets powered off or disconnected, but not necessarily
properly handling all possible failures. If you want to be able to
address each device separately, then "cd" into the "/etc/ptal"
directory and copy the applicable device configuration file to a
new name, keeping the "mlc:usb:" prefix, and run ""ptal-init
start"". Even so, it is still rather unpredictable which device
name maps to which device.
· For JetDirect connections, the hostname or IP address and port
number determine the device name. However, currently "ptal-init"
incorrectly adds duplicate device name entries if you’re
inconsistent about using either the IP address or the same hostname
all the time. If you accidentally add duplicate devices, then use
""ptal-init setup"" to prune the device list as necessary.
Device configuration file format hpoj device configuration files, which
"ptal-init" manages, are stored in the directory "/etc/ptal". For each
configured device, there is a file in this directory whose name is the
PTAL device name, such as "mlc:par:OfficeJet_Series_700",
"mlc:usb:PSC_750", or "hpjd:my-jdex.my-domain.com:3". "libptal"
applications such as "ptal-devid" or "libsane-hpoj" use the presence
and names of these files to determine the list of configured devices.
"ptal-init" uses the contents of each file to determine what daemons,
if any, it should start for the corresponding device and what command-
line parameters to pass. The following rules govern the format of
device configuration files:
· Comment lines start with a "#" character.
· The line ""key=value"" assigns "value" to "key", replacing any
previous value of "key".
· The line ""key+=value"" appends "value" to any existing value of
key. A space character is also added between the old and new
values if necessary.
· End-of-line comments and backslash-style line continuation are not
currently supported.
· The following keys are currently recognized:
· "init.version" -- The file format version. If this key is
missing or has a different value from that which "ptal-init"
expects, then "ptal-init" ignores the device, and you must run
""ptal-init setup"" to delete and re-probe the device.
· "init.mlcd.append" -- Additional command-line parameters to
pass to "ptal-mlcd".
· "init.printd.start" -- Non-zero to start "ptal-printd" (default
for parallel- and USB-connected devices), zero to not start
"ptal-printd" (default for JetDirect-connected devices).
· "init.printd.append" -- Additional command-line parameters to
pass to "ptal-printd".
· "init.photod.start" -- Non-zero to start "ptal-photod" (default
is zero, which means not to start; ""ptal-init setup"" sets
this to non-zero if it detects photo-card support on the
device).
· "init.photod.append" -- Additional command-line parameters to
pass to "ptal-photod".
· If you have multiple devices and want to set identical keys for all
devices, such as ""init.mlcd.append+=-remconsole"",
""init.printd.start=0"", or ""init.printd.start=1"", then you may
add them to the file "/etc/ptal/defaults", which has the same
format rules above, but any commands are read and processed before
the commands in each specific device configuration file.
In addition, the default device name (if set) is stored in the file
"/etc/ptal/default-device", and the file "/etc/ptal/ptal-printd-like"
stores permissions copied from a previously-seen printer-device node
and is passed as a template to ""ptal-printd -like"". The
"ptal-start.conf" and "ptal-stop.conf" files used in hpoj-0.8 are now
obsolete.