man ptal-init (Administration système) - hpoj reference: CWptal-init

NAME

hpoj reference: CWptal-init

DESCRIPTION

The CWptal-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 (CWptal-mlcd, CWptal-printd, and CWptal-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

•
CWCIcommandCW is one of:
•
CWstart, CWrestart, or CWreload to both stop and (re)start the daemons
•
CWstop to stop the daemons
•
CWsetup or CWprobe to add or remove devices
•
CWstatus to return 0 if started or 1 if not (any user may call this)
•
CWcondrestart to restart only if already started
•
CW-verbose also lists daemon start command lines for debugging
•
CW-quiet suppresses the stopping and starting messages

NOTES

CWptal-init contains a special comment line telling the RedHat CWchkconfig to start CWptal-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:

•
CWlpd's start and kill orders are both 60, because CWptal-printd needs to be started before CWlpd.
•
CUPS's start order is 90 and kill order is 10, because CWptal-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 CWptal-init reads its configuration files) when used in a UTF8 locale (as defined by the CWLANG environment variable). CWptal-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 CW/etc/sysconfig/i18n and change the CWLANG setting to CW"C". When installing hpoj on other distributions that lack CWchkconfig, start CWlpd or CUPS in a different order, or don't even have a SysV-style init subsystem, then you may need to manually integrate CWptal-init into your system's startup and shutdown sequences. "CWptal-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 CW@parWildcards and/or CW@usbWildcards near the top of the CWptal-init script. CWptal-init is derived from CWptal-init.in by the CW./configure script, after substituting in the CW$prefix (installation base path) variable. CWptal-init erases and re-creates the socket/pipe directories needed by CWptal-mlcd and CWptal-printd. Previous hpoj versions expected these directories in CW/dev, but they are now located in CW/var/run, because some platforms have a read-only CW/dev file system. For backwards compatibility it attempts to create a symlink from CW/dev/ptal-printd to CW/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 CW/var/lock/subsys or CW/var/lock exists, CWptal-init creates and deletes the file CWptal-init in that directory. This is needed for the SysV init system in RedHat and possibly other distributions. For Linux, CWptal-init attempts to run the commands "CW/sbin/modprobe lp and CW/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 CWptal-mlcd was compiled for CWlibusb support and it's running on SMP (multi-processor) Linux.) Previous versions didn't do this for "CWptal-init start, which sometimes resulted in a situation where CWptal-init setup configured the device successfully but device connectivity was lost after a reboot. CWptal-init start" delays two seconds before starting the first instance of CWptal-photod, to increase the chance that the kernel has had enough time to release the TCP port used by the previous instance of CWptal-photod so that the same TCP port number (and therefore CWmtools drive letter) will be used for the new instance. Notes on the CWsetup command "CWptal-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 CW/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 CWlibusb-supported platforms)
•
CWlibusb device names are of the form "CW%CIbusCW%CIdeviceCW".
•
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 "CWptal-init setup" yes/no prompts allow you to optionally append (after an explicit CW[y]es response) additional command-line switches that should be passed to CWptal-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 CWptal-mlcd probes devices, you can answer the appropriate yes/no questions above as "CWy -logwarn" (be sure to put a space between the explicit CW[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 "CWy -nocomp". The Linux kernel USB printer-class driver (CWprinter.o) currently has stability issues on SMP (multi-processor) systems, at least through the 2.4 kernel series. "CWptal-init setup" now checks whether your system is running in SMP mode before probing for USB devices and (if necessary) offers to update CW/etc/modules.conf and CW/etc/hotplug/blacklist to prevent CWprinter.o from being auto-loaded in the future. This allows the more robust CWlibusb communication method to be used instead. Note that this will prevent all use of USB printers via direct access of CW/dev/usb/lpCIXCW 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 CWprinter.o to be loaded in the future, then be sure to update both files (CW/etc/modules.conf and CW/etc/hotplug/blacklist). Similarly, the Linux kernel USB CWscanner.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, "CWptal-init setup" tries to detect this situation by parsing the file CW/proc/bus/usb/devices and offering to disable and unload CWscanner.o the same way it does as described above with CWprinter.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 CWlibusb if possible, or modify/recompile/reinstall CWscanner.o to not bind to your hpoj device. Both of the above detect+blacklist+unload workarounds for CWprinter.o and CWscanner.o issues will probably not work correctly if the relevant kernel modules are renamed (or in the case of CWscanner.o, compiled into the kernel instead of dynamically loaded as a module). When probing a device, "CWptal-init setup" performs the following actions:

•
Before probing the first USB device, starts a glob instance of CWptal-mlcd to return (via the special CWPTAL-MLCD-GLOB-DEVNODES service) a list of possible USB kernel and CWlibusb device nodes.
•
Starts a probe instance of CWptal-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 CWptal-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 CWptal-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 CWptal-mlcd and CWptal-printd, except for JetDirect-connected devices.
•
Probes the device for photo card-reader support and enables CWptal-photod if appropriate.
•
Reads the new configuration file back in so the necessary daemons can be started later.

In most cases, CWptal-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 "CWptal-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 "CWptal-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 CWcd into the CW/etc/ptal directory and copy the applicable device configuration file to a new name, keeping the CWmlc:usb: prefix, and run "CWptal-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 CWptal-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 "CWptal-init setup" to prune the device list as necessary.

Device configuration file format hpoj device configuration files, which CWptal-init manages, are stored in the directory CW/etc/ptal. For each configured device, there is a file in this directory whose name is the PTAL device name, such as CWmlc:par:OfficeJet_Series_700, CWmlc:usb:PSC_750, or CWhpjd:my-jdex.my-domain.com:3. CWlibptal applications such as CWptal-devid or CWlibsane-hpoj use the presence and names of these files to determine the list of configured devices. CWptal-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 "CWCIkeyCW=CIvalueCW" assigns CWCIvalueCW to CWCIkeyCW, replacing any previous value of CWCIkeyCW.
•
The line "CWCIkeyCW+=CIvalueCW" appends CWCIvalueCW 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:
•
CWinit.version The file format version. If this key is missing or has a different value from that which CWptal-init expects, then CWptal-init ignores the device, and you must run "CWptal-init setup" to delete and re-probe the device.
•
CWinit.mlcd.append Additional command-line parameters to pass to CWptal-mlcd.
•
CWinit.printd.start Non-zero to start CWptal-printd (default for parallel- and USB-connected devices), zero to not start CWptal-printd (default for JetDirect-connected devices).
•
CWinit.printd.append Additional command-line parameters to pass to CWptal-printd.
•
CWinit.photod.start Non-zero to start CWptal-photod (default is zero, which means not to start; "CWptal-init setup" sets this to non-zero if it detects photo-card support on the device).
•
CWinit.photod.append Additional command-line parameters to pass to CWptal-photod.
•
If you have multiple devices and want to set identical keys for all devices, such as "CWinit.mlcd.append+=-remconsole, CWinit.printd.start=0, or CWinit.printd.start=1", then you may add them to the file CW/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 CW/etc/ptal/default-device, and the file CW/etc/ptal/ptal-printd-like stores permissions copied from a previously-seen printer-device node and is passed as a template to "CWptal-printd -like". The CWptal-start.conf and CWptal-stop.conf files used in hpoj-0.8 are now obsolete.