Move everything from /var/adm to /var/log
[unleashed.git] / share / man / man7d / usbprn.7d
blobce2d886a5e0ca6ee95d9ce433cfc2413738fc425
1 '\" te
2 .\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH USBPRN 7D "May 13, 2017"
7 .SH NAME
8 usbprn \- USB printer class driver
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <sys/usb/clients/printer/usb_printer.h>
13 .fi
15 .LP
16 .nf
17 #include <sys/ecppio.h>
18 .fi
20 .LP
21 .nf
22 usbprn@unit-address
23 .fi
25 .SH DESCRIPTION
26 .LP
27 The \fBusbprn\fR driver is a USBA (Solaris USB Architecture) compliant client
28 driver that supports the \fIUSB Printer Class 1.0\fR specification. The
29 \fBusbprn\fR driver supports a subset of the \fBecpp\fR(7D) parallel port
30 driver functionality. However, unlike the STREAMS-based \fBecpp\fR driver,
31 \fBusbprn\fR is a character driver.
32 .sp
33 .LP
34 The \fBusbprn\fR driver supports all USB printer-class compliant printers.
35 .sp
36 .LP
37 The \fBusbrpn\fR driver includes support for communicating with many different
38 printers. To use these printers, it may be necessary to install and configure
39 additional format conversion packages available in the Solaris distribution.
40 Configuration of these conversion packages under the Solaris printing system
41 can be simplified through the use of the \fBprintmgr\fR(8). This tool allows
42 selection of printer manufacturer/model information while creating a print
43 queue. For USB connected printers, it attempts to pre-select the
44 manufacturer and model information based on the 1284 device id supplied by the
45 printer.
46 .SS "UGEN (Generic USB)"
47 .LP
48 The \fBusbprn\fR driver also supports a \fBugen\fR(7D) interface allowing raw
49 access to the device, for example by libusb applications, by
50 passing the drivers bound to each interface. Because a libusb application might
51 change the state of the device, you should not access the device through the
52 child interface drivers.
53 .SH DEFAULT OPERATION
54 .LP
55 With certain minor exceptions (outlined in the Notes sections below), the
56 \fBusbprn\fR driver supports a subset of the \fBecpp\fR(7D) ioctl interfaces:
57 .sp
58 .LP
59 Configuration variables are set to their default values each time the USB
60 printer device is attached. The \fBwrite_timeout\fR period (defined in the
61 ECPPIOC_SETPARMS ioctl description below) is set to 90 seconds. The mode is set
62 to centronics mode (ECPP_CENTRONICS). Parameters can be changed through the
63 ECPPIOC_SETPARMS ioctl and read through the ECPPIOC_GETPARMS ioctl. Each time
64 the USB printer device is opened, the device is marked as busy and all further
65 opens will return EBUSY. Once the device is open, applications can write to the
66 device and the driver can send data and obtain device id and status.
67 .LP
68 Note -
69 .sp
70 .RS 2
71 Unlike the \fBecpp\fR(7D) driver, \fBusbprn\fR resets configuration variables
72 to their default values with each \fBattach\fR(9E). (The \fBecpp\fR(7D) driver
73 resets configuration variables with each \fBopen\fR(2).)
74 .RE
75 .SH WRITE OPERATION
76 .LP
77 A \fBwrite\fR(2) operation returns the number of bytes successfully written to
78 the device. If a failure occurs while a driver is transferring data to printer,
79 the contents of the status bits are captured at the time of the error and can
80 be retrieved by the application program using the ECPPIOC_GETERR \fBioctl\fR(2)
81 call. The captured status information is overwritten each time an
82 ECPPIOC_TESTIO \fBioctl\fR(2) occurs.
83 .SH IOCTLS
84 .LP
85 The \fBusbprn\fR driver supports \fBprnio\fR(7I) interfaces. Note that the
86 \fBPRNIOC_RESET\fR command has no effect on USB printers.
87 .sp
88 .LP
89 The following \fBioctl\fR(2) calls are supported for backward compatibility and
90 are not recommended for new applications.
91 .sp
92 .ne 2
93 .na
94 \fB\fBECPPIOC_GETPARMS\fR\fR
95 .ad
96 .RS 20n
97 Gets current transfer parameters. The argument is a pointer to \fBstruct
98 ecpp_transfer_parms\fR. If parameters are not configured after the device is
99 opened, the structure will be set to its default configuration.
101 Note -
103 .RS 2
104 Unlike the \fBecpp\fR(7D) driver, only the ECPP_CENTRONICS mode is currently
105 supported in \fBusbprn\fR.
110 .ne 2
112 \fB\fBECPPIOC_SETPARMS\fR\fR
114 .RS 20n
115 Sets transfer parameters. The argument is a pointer to a \fBstruct
116 ecpp_transfer_parms\fR. If a parameter is out of range, \fBEINVAL\fR is
117 returned. If the peripheral or host device cannot support the requested mode,
118 \fBEPROTONOSUPPORT\fR is returned.
120 The transfer parameters structure is defined in <\fBsys/ecppio.h\fR>:
122 .in +2
124 struct ecpp_transfer_parms {
125     int  write_timeout;
126     int  mode;
129 .in -2
131 The \fBwrite_timeout\fR field, which specifies how long the driver will take to
132 transfer 8192 bytes of data to the device, is set to a default value of 90
133 seconds. The \fBwrite_timeout\fR field must be greater than one second and less
134 than 300 seconds (five minutes.)
136 Note -
138 .RS 2
139 Unlike the \fBecpp\fR(7D) driver, only the ECPP_CENTRONICS mode is currently
140 supported in \fBusbprn\fR. Also, the semantics of \fBwrite_timeout\fR in
141 \fBusbprn\fR differ from \fBecpp\fR(7D). Refer to \fBecpp\fR(7D) for
142 information.
147 .ne 2
149 \fB\fBBPPIOC_TESTIO\fR\fR
151 .RS 20n
152 Tests the transfer readiness of a print device and checks status bits to
153 determine if a \fBwrite\fR(2) will succeed. If status bits are set, a transfer
154 will fail. If a transfer will succeed, zero is returned. If a transfer fails,
155 the driver returns \fBEIO\fR and the state of the status bits are captured. The
156 captured status can be retrieved using the BPPIOC_GETERR \fBioctl\fR(2) call.
157 BPPIOC_TESTIO and BPPIOC_GETERR are compatible to the ioctls specified in
158 \fBbpp\fR(7D).
160 Note -
162 .RS 2
163 Unlike the \fBecpp\fR(7D) driver, only the ECPP_CENTRONICS mode is currently
164 supported in \fBusbprn\fR. Additionally, \fBbus_error\fR and
165 \fBtimeout_occurred\fR fields are not used in the \fBusbprn\fR interface. (In
166 \fBecpp\fR(7D), \fBtimeout_occurred\fR is used.)
171 .ne 2
173 \fB\fBBPPIOC_GETERR\fR\fR
175 .RS 20n
176 Get last error status. The argument is a pointer to a \fBstruct
177 bpp_error_status\fR. This structure indicates the status of all the appropriate
178 status bits at the time of the most recent error condition during a
179 \fBwrite\fR(2) call, or the status of the bits at the most recent BPPIOC_TESTIO
180 \fBioctl\fR(2) call.
182 .in +2
184 struct bpp_error_status {
185    char    timeout_occurred; /* not used */
186    char    bus_error;        /* not used */
187    uchar_t pin_status;       /* status of pins which
188                              /* could cause error */
191 .in -2
193 The pin_status field indicates possible error conditions. The error status
194 structure \fBbpp_error_status\fR is defined in the include file
195 \fB<sys/bpp_io.h>\fR\&. The valid bits for \fBpin_status\fR can be
196 \fBBPP_ERR_ERR\fR, \fBBPP_SLCT_ERR\fR, and \fBBPP_PE_ERR\fR. A set bit
197 indicates that the associated pin is asserted.
199 Note -
201 .RS 2
202 Unlike the \fBecpp\fR(7D) driver, only the ECPP_CENTRONICS mode is currently
203 supported in \fBusbprn\fR. Additionally, the \fBbus_error\fR and
204 \fBtimeout_occurred\fR fields are not used in the \fBusbprn\fR interface. (In
205 \fBecpp\fR(7D), \fBtimeout_occurred\fR is used.) Unlike \fBecpp\fR(7D), the
206 BPP_BUSY_ERR status bit is not supported by USB printers.
211 .ne 2
213 \fB\fBECPPIOC_GETDEVID\fR\fR
215 .RS 20n
216 Gets the IEEE 1284 device ID from the peripheral. The argument is a pointer to
217 a \fBstruct ecpp_device_id\fR. Applications should set mode to ECPP_CENTRONICS.
218 If another mode is used, the driver will return \fBEPROTONOSUPPORT\fR.
219 \fBlen\fR is the length of the buffer pointed to by \fBaddr\fR. \fBrlen\fR is
220 the actual length of the device ID string returned from the peripheral. If the
221 returned \fBrlen\fR is greater than \fBlen\fR, the application should call
222 ECPPIOC_GETDEVID a second time with a buffer length equal to \fBrlen\fR.
224 The 1284 device ID structure:
226 .in +2
228 struct ecpp_device_id {
229   int  mode; /* mode to use for reading device id */
230   int  len;  /* length of buffer */
231   int  rlen;  /* actual length of device id string */
232   char *addr; /* buffer address */
234 .in -2
237 Note -
239 .RS 2
240 Unlike \fBecpp\fR(7D), only the ECPP_CENTRONICS mode is currently supported in
241 \fBusbprn\fR.
245 .SH READ OPERATION
247 The \fBread\fR operation is not supported and returns \fBEIO\fR.
248 .SH ERRORS
249 .ne 2
251 \fB\fBEBUSY\fR\fR
253 .RS 19n
254 The device has been opened and another open is attempted. An attempt has been
255 made to unload the driver while one of the units is open.
259 .ne 2
261 \fB\fBEINVAL\fR\fR
263 .RS 19n
264 An unsupported IOCTL has been received. A ECPPIOC_SETPARMS \fBioctl\fR(2) is
265 attempted with an out of range value in the \fBecpp_transfer_parms\fR
266 structure.
270 .ne 2
272 \fB\fBEIO\fR\fR
274 .RS 19n
275 The driver has received an unrecoverable device error, or the device is not
276 responding, or the device has stalled when attempting an access. A
277 \fBwrite\fR(2) or \fBioctl\fR(2) did not complete due to a peripheral access. A
278 \fBread\fR(2) system call has been issued.
282 .ne 2
284 \fB\fBENXIO\fR\fR
286 .RS 19n
287 The driver has received an \fBopen\fR(2) request for a unit for which the
288 attach failed.
292 .ne 2
294 \fB\fBENODEV\fR\fR
296 .RS 19n
297 The driver has received an \fBopen\fR(2) request for a device that has been
298 disconnected.
302 .ne 2
304 \fB\fBEPROTONOSUPPORT\fR\fR
306 .RS 19n
307 The driver has received a ECPPIOC_SETPARMS \fBioctl\fR(2) for a mode argument
308 other than ECPP_CENTRONICS in the \fBecpp_transfer_parms\fR structure.
311 .SH FILES
312 .ne 2
314 \fB\fB/kernel/drv/usbprn\fR\fR
316 .RS 30n
317 32-bit x86 ELF kernel module
321 .ne 2
323 \fB\fB/kernel/drv/amd64/usbprn\fR\fR
325 .RS 30n
326 64-bit x86 ELF kernel module
330 .ne 2
332 \fB\fB/kernel/drv/sparcv9/usbprn\fR\fR
334 .RS 30n
335 64-bit SPARC ELF kernel module
339 .ne 2
341 \fB/dev/usb/*/*/* \fR
343 .RS 30n
344 ugen(7D) nodes.
348 .ne 2
350 \fB\fB/dev/printers/\fIn\fR\fR\fR
352 .RS 30n
353 Character special files
356 .SH ATTRIBUTES
358 See \fBattributes\fR(5) for descriptions of the following attributes:
363 box;
364 c | c
365 l | l .
366 ATTRIBUTE TYPE  ATTRIBUTE VALUE
368 Architecture    SPARC, x86, PCI-based systems
371 .SH SEE ALSO
373 \fBcfgadm_usb\fR(8), \fBprintmgr\fR(8), \fBioctl\fR(2), \fBopen\fR(2),
374 \fBread\fR(2), \fBwrite\fR(2), \fBattributes\fR(5),
375 \fBbpp\fR(7D), \fBecpp\fR(7D), \fBugen\fR(7D), \fBusba\fR(7D), \fBprnio\fR(7I),
376 \fBattach\fR(9E)
379 \fIWriting Device Drivers\fR
382 \fIUniversal Serial Bus Specification 1.0 and 1.1\fR
385 \fIUSB Device Class Definition for Printing Devices 1.0\fR
388 \fISystem Administration Guide: Basic Administration\fR
389 .SH DIAGNOSTICS
391 In addition to being logged, the following messages may appear on the system
392 console. All messages are formatted in the following manner:
394 .in +2
396 Warning: <device path> (usbprn<instance num>): Error Message...
398 .in -2
402 .ne 2
404 \fBDevice was disconnected while open. Data may have been lost.\fR
406 .sp .6
407 .RS 4n
408 The device has been hot-removed or powered off while it was open and a possible
409 data transfer was in progress. The job may be aborted.
413 .ne 2
415 \fBCannot access <device>. Please reconnect.\fR
417 .sp .6
418 .RS 4n
419 There was an error in accessing the printer during reconnect. Please reconnect
420 the device.
424 .ne 2
426 \fBDevice is not identical to the previous one on this port. Please disconnect
427 and reconnect.\fR
429 .sp .6
430 .RS 4n
431 A USB printer was hot-removed while open. A new device was hot-inserted which
432 is not identical to the original USB printer. Please disconnect the USB device
433 and reconnect the printer to the same port.
437 .ne 2
439 \fBPrinter has been reconnected but data may have been lost.\fR
441 .sp .6
442 .RS 4n
443 The printer that was hot-removed from its USB port has been re-inserted again
444 to the same port. It is available for access but the job that was running prior
445 to the hot-removal may be lost.
448 .SH NOTES
450 The USB printer will be power managed if the device is closed.
453 If a printer is hot-removed before a job completes, the job is terminated and
454 the driver will return EIO. All subsequent opens will return \fBENODEV\fR. If a
455 printer is hot-removed, an LP reconfiguration may not be needed if a printer is
456 re-inserted on the same port. If re-inserted on a different port, an LP
457 reconfiguration may be required.
460 The USB Parallel Printer Adapter is not hotpluggable. The printer should be
461 connected to USB Parallel Printer Adapter before plugging the USB cable into
462 host or hub port and should be removed only after disconnecting the USB cable
463 of USB Parallel Printer Adapter from the host or hub port.