usbprn - USB printer class driver
#include <sys/usb/clients/printer/usb_printer.h>
#include <sys/ecppio.h>
usbprn@unit-address
The usbprn driver is a USBA (Solaris USB Architecture) compliant client driver that supports the USB Printer Class 1.0 specification. The usbprn driver supports a subset of the ecpp(7D) parallel port driver functionality. However, unlike the STREAMS-based ecpp driver, usbprn is a character driver.
The usbprn driver supports all USB printer-class compliant printers. For a list of recommended printers and USB parallel printer adapters, visit http://www.sun.com/io.
The usbrpn driver includes support for communicating with many different printers. To use these printers, it may be nesessary to install and configure additional format conversion packages available in the Solaris distribution. Configuration of these conversion packages under the Solaris printing system can be simplified through the use of the printmgr(1M). This tool allows selection of printer manufacturer/model information while creating a print queue. For USB connected printers, it attempts to pre-select the the manufacturer and model information based on the 1284 device id supplied by the printer.
The usbprn driver also supports a ugen(7D) interface allowing raw access to the device, for example by libusb(3LIB) applications, by passing the drivers bound to each interface. Because a libusb application might change the state of the device, you should not access the device through the child interface drivers.
With certain minor exceptions (outlined in the Notes sections below), the usbprn driver supports a subset of the ecpp(7D) ioctl interfaces:
Configuration variables are set to their default values each time the USB printer device is attached. The write_timeout period (defined in the ECPPIOC_SETPARMS ioctl description below) is set to 90 seconds. The mode is set to centronics mode (ECPP_CENTRONICS). Parameters can be changed through the ECPPIOC_SETPARMS ioctl and read through the ECPPIOC_GETPARMS ioctl. Each time the USB printer device is opened, the device is marked as busy and all further opens will return EBUSY. Once the device is open, applications can write to the device and the driver can send data and obtain device id and status.
Note -
A write(2) operation returns the number of bytes successfully written to the device. If a failure occurs while a driver is transferring data to printer, the contents of the status bits are captured at the time of the error and can be retrieved by the application program using the ECPPIOC_GETERR ioctl(2) call. The captured status information is overwritten each time an ECPPIOC_TESTIO ioctl(2) occurs.
The usbprn driver supports prnio(7I) interfaces. Note that the PRNIOC_RESET command has no effect on USB printers.
The following ioctl(2) calls are supported for backward compatibility and are not recommended for new applications.
ECPPIOC_GETPARMS
Note -
ECPPIOC_SETPARMS
The transfer parameters structure is defined in <sys/ecppio.h>:
struct ecpp_transfer_parms { int write_timeout; int mode; };
The write_timeout field, which specifies how long the driver will take to transfer 8192 bytes of data to the device, is set to a default value of 90 seconds. The write_timeout field must be greater than one second and less than 300 seconds (five minutes.)
Note -
BPPIOC_TESTIO
Note -
BPPIOC_GETERR
struct bpp_error_status { char timeout_occurred; /* not used */ char bus_error; /* not used */ uchar_t pin_status; /* status of pins which /* could cause error */ };
The pin_status field indicates possible error conditions. The error status structure bpp_error_status is defined in the include file <sys/bpp_io.h>. The valid bits for pin_status can be BPP_ERR_ERR, BPP_SLCT_ERR, and BPP_PE_ERR. A set bit indicates that the associated pin is asserted.
Note -
ECPPIOC_GETDEVID
The 1284 device ID structure:
struct ecpp_device_id { int mode; /* mode to use for reading device id */ int len; /* length of buffer */ int rlen; /* actual length of device id string */ char *addr; /* buffer address */
Note -
The read operation is not supported and returns EIO.
EBUSY
EINVAL
EIO
ENXIO
ENODEV
EPROTONOSUPPORT
/kernel/drv/usbprn
/kernel/drv/amd64/usbprn
/kernel/drv/sparcv9/usbprn
/dev/usb/*/*/*
/dev/printers/n
See attributes(5) for descriptions of the following attributes:
|
cfgadm_usb(1M), printmgr(1M), ioctl(2), open(2), read(2), write(2), libusb(3LIB), attributes(5), bpp(7D), ecpp(7D), ugen(7D), usba(7D)prnio(7I), attach(9E)
Writing Device Drivers
Universal Serial Bus Specification 1.0 and 1.1
USB Device Class Definition for Printing Devices 1.0
System Administration Guide: Basic Administration
http://www.sun.com/io
In addition to being logged, the following messages may appear on the system console. All messages are formatted in the following manner:
Warning: <device path> (usbprn<instance num>): Error Message...
Device was disconnected while open. Data may have been lost.
Cannot access <device>. Please reconnect.
Device is not identical to the previous one on this port. Please disconnect and reconnect.
Printer has been reconnected but data may have been lost.
The USB printer will be power managed if the device is closed.
If a printer is hot-removed before a job completes, the job is terminated and the driver will return EIO. All subsequent opens will return ENODEV. If a printer is hot-removed, an LP reconfiguration may not be needed if a printer is re-inserted on the same port. If re-inserted on a different port, an LP reconfiguration may be required.
The USB Parallel Printer Adapter is not hotpluggable. The printer should be connected to USB Parallel Printer Adapter before plugging the USB cable into host or hub port and should be removed only after disconnecting the USB cable of USB Parallel Printer Adapter from the host or hub port.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |