PTAL device name format
The PTAL (Peripheral Transport Abstraction Library) "device name" is an
important concept throughout the hpoj software, especially if you use more
than one device with it.
The format of the device name depends on how the device is connected:
Important: The PTAL device name is not the same as traditional
Unix device files, such as /dev[/usb]/lp0, or any other path/filename
combination. It must conform to the guidelines listed above.
- For local parallel and USB connections, the device name is of the form
"mlc:par:XXXX" and "mlc:usb:XXXX", respectively.
The XXXX suffix is a unique identifying label which you may provide
when setting up the device; the default is
based on the model name (as it appears in the device ID string) with space
and slash characters converted to underscores.
- For remote JetDirect connections, the device name is of the form
"hpjd:hostname[:portnum]". hostname is the
hostname or dotted-decimal IP address of the JetDirect. If you have a
multi-port JetDirect such as the 500X, you may optionally append a colon
and the port number (":1", ":2", or ":3") to
the device name to specify which device you're referring to.
The default port number is 1.
Specifying the device name
Most hpoj command-line utilities take a PTAL device name as the first
parameter so they'll know which device to access. In most cases the
device name is now optional on the command line, as long as you follow
the "ptal-init setup" procedure outlined
in the Setting up basic device connectivity
document for setting up your device(s).
Default device name
If you have set up only one device, then usually it is automatically used by
default. However, if you have set up multiple devices, then the default
could be any one of them, and not necessarily the "first" one in alphabetical
order. As described in
Setting up basic device connectivity, the
"ptal-init setup" command allows you
to set or unset the system-wide default device name if more than one device
Individual users may override the system-wide default device name (if any) by
any of the following methods:
- Specifying a device name when starting an application (highest precedence)
- Setting the environment variable PTAL_DEFAULT_DEVICE to the
desired default device name (medium precedence)
- Creating the file .ptal-default-device in the user's home
directory (specified by the HOME environment variable), with the
default device name as the one and only line in the file
Listing device names
There are several ways to see what device names are currently defined on
- Most of the hpoj command-line utilities display a list of known device
names in their help messages, when either you pass the -help
switch or they detect some sort of syntax or other error. The default
device is listed first.
- As root, you can re-run
"ptal-init setup", even if you don't
want to make any changes. The default device is denoted by "[*]".
- "ptal-init start" lists the
defined device names as it's starting daemons for each device.
- ptal-init called with no
parameters, even for non-root users, also lists the known devices.
The default device is denoted by "[*]".
- ptal-device lists known
devices, one per line, with no added information. It is therefore useful
for scripting purposes.
Renaming or reconfiguring existing devices
If you want to rename an already-set-up device or otherwise reconfigure
it (for example, switch it from a parallel to a USB connection), then run
"ptal-init setup", delete the
old device name when it offers to do so, let it re-probe your system
for the device, and specify the desired name suffix when it's found.
Since JetDirect-connected devices' names are based on the hostname or IP
address of the JetDirect, note that you can't specify an arbitrary device
name in this case unless you change the JetDirect's hostname.
Storage of device configuration information
For each device, "ptal-init setup"
creates a configuration file under the directory /etc/ptal, with
the filename being the PTAL device name. The file contents are used by
"ptal-init start" to know which
daemons (if any) to start for each device, and what parameters to pass.
hpoj applications use libptal to read in the device files under
/etc/ptal and build a list of defined devices. Devices which
have been designated as "default" (see above) are added to the list first,
and then other device files are read and added to the list.
Use the Back button on your browser to return to the previous document,
or click here to return to the