Documentation ¶
Overview ¶
Package usbprinter provides an interface to configure and attach a virtual USB printer onto the system to be used for testing.
Index ¶
- type DevInfo
- type Option
- func ExpectUdevEventOnStop() Option
- func WaitUntilConfigured() Option
- func WithAttributes(path string) Option
- func WithDescriptors(path string) Option
- func WithESCLCapabilities(path string) Option
- func WithGenericIPPAttributes() Option
- func WithIPPUSBDescriptors() Option
- func WithOutputLogDirectory(directory string) Option
- func WithRecordPath(record string) Option
- type Printer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DevInfo ¶
type DevInfo struct { // VID contains the device's vendor ID. VID string // PID contains the devices's product ID. PID string }
DevInfo contains information used to identify a USB device.
type Option ¶
type Option func(*config) error
Option provides the type for functional options used to build a Printer via Start().
func ExpectUdevEventOnStop ¶
func ExpectUdevEventOnStop() Option
ExpectUdevEventOnStop causes Printer.Stop() to propagate errors if a udev event is not seen.
func WaitUntilConfigured ¶
func WaitUntilConfigured() Option
WaitUntilConfigured controls whether or not Start() blocks on printer autoconfiguration.
func WithDescriptors ¶
WithDescriptors sets the required descriptors.
func WithESCLCapabilities ¶
WithESCLCapabilities sets eSCL capabilities.
func WithGenericIPPAttributes ¶
func WithGenericIPPAttributes() Option
WithGenericIPPAttributes passes the most commonly used IPP attributes.
func WithIPPUSBDescriptors ¶
func WithIPPUSBDescriptors() Option
WithIPPUSBDescriptors passes the most commonly used USB descriptors.
func WithOutputLogDirectory ¶
WithOutputLogDirectory sets the output log directory.
func WithRecordPath ¶
WithRecordPath sets the document output path.
type Printer ¶
type Printer struct { // The printer name as detected by autoconfiguration. // Empty if Start() was called with info.WaitUntilConfigured // set false. ConfiguredName string // The printer's device information parsed from its USB // descriptors config. DevInfo DevInfo // contains filtered or unexported fields }
Printer provides an interface to interact with the running virtual-usb-printer instance.
func (*Printer) Stop ¶
Stop terminates and waits for the virtual-usb-printer. Users must call this when finished with the virtual-usb-printer.
Returns an error if we fail to terminate or wait for the virtual-usb-printer, or if we don't see an expected udev event upon stoppage.
This method is idempotent.