Warning: this project is work in progress and under the intensive development.
This project contains the foundation of the behavior-accurate simulator for multi-function printers (MFPs) that supports at least IPP 2.x for printing, eSCL and WSD for scanning, and DNS-SD and WS-Discovery for device discovery.
This simulator will consist of a core simulation engine that provides reference implementations of the aforementioned protocols, along with a customization engine that allows for the expression of implementation details specific to individual devices without the need to reimplement common functionalities repeatedly.
For the purpose of implementation of the MFP core simulation engine it contains many libraries (Go packages) that are aimed to be a part of the simulator, but can be useful as a general-purpose libraries as well.
It contains (partially done for now) the fairly complete eSCL and WSD WS-Scan implementations, DNS-SD and WS-Discovery published and querier, smart device discovery engine, able to bind various instances of the same device together, representing them as a sub-units of a single physical device (IPP/IPPS, AppSocket AKA JetDirect and LPD for printing, eSCL and WSD for scanning), based on the similar work previously done for scanners in the sane-airscan project and much more.
The ultimate goal of this project, among writing the MFP simulator, is to implement a comprehensive Go toolkit for printing and scanning on Linux and UNIX-like systems.
Building is quite straightforward: just type make at the root
directory.
It requires the following development packages to be installed:
- Golang compiler
- gcc compiler
- avahi-libs for the DNS-SD
- libjpeg, libpng for image conversion
- libusb
- libppd
- Python3 (cpython) development package
It also requires some external Go libraries, but if your build computer is connected to the network, they will be downloaded and cached automatically at the first build attrmpt:
- github.com/OpenPrinting/go-avahi - Go binding for Avahi
- github.com/OpenPrinting/goipp - Low-level IPP implementation
- github.com/google/go-cmp - used only for testing
- github.com/peterh/liner - line editor for the interactive shell
The project builds and runs under the Windows Subsystem for Linux
(WSL2). The USB device emulation relies on the USB/IP kernel
support (the vhci_hcd module), which recent WSL2 kernels already
include, so a separate virtual machine is not required.
The instructions below were tested on Ubuntu 24.04 under WSL2 (kernel 6.6.87 microsoft-standard-WSL2).
Install the build dependencies together with the USB/IP client tools:
sudo apt-get install -y \
golang gcc pkg-config make \
libavahi-client-dev libjpeg-dev libpng-dev \
libusb-1.0-0-dev python3-dev \
linux-tools-generic linux-tools-common linux-tools-virtual \
usbutils
Note that Ubuntu has no standalone usbip package: the usbip
client is shipped as part of linux-tools and installed under
/usr/lib/linux-tools-*/usbip. Put it on the PATH, for example:
sudo ln -sf "$(ls /usr/lib/linux-tools-*/usbip | head -1)" \
/usr/local/bin/usbip
Ubuntu does not package libppd, which is needed by a full
make. To just build and try the virtual MFP simulator, build
only that command:
go build -o mfp-virtual ./cmd/mfp-virtual
Run the simulator in USB/IP mode:
./mfp-virtual --usbip -d
In another terminal, load the kernel module and attach the emulated device:
sudo modprobe vhci-hcd
sudo usbip attach -r localhost -b 1-1
The virtual MFP now appears as a real USB device (lsusb lists it
as OpenPrinting Virtual MFP) and can be driven by the usual Linux
printing and scanning stack, including
ipp-usb.
This package contains definitions for the abstract (protocol-independent) printer and scanner.
This is a general-purpose library for parsing command options.
This is a root directory for all commands (executable files) build as a part of this project.
TODO
This is the command-line CUPS client.
This is the command-line device discovery tool.
This is the MFP masquerading tool. It allows to re-expose existent MFP device under the different name or different IP address and to sniff its traffic (which is convenient tool for troubleshooting).
This is interactive shell for all mfp-XXX commands.
This is the vurtual MFP simulator.
This is the CUPS API library. It uses the IPP protocol to communicate with the CUPS server.
This is the smart MFP discovery library.
This is the collection of internally used support libraries. These libraries are not exposed via the GO-MFP API.
This is the logging library, used across the project.
This is the collection of packages, that implement MFP protocols.
This is the eSCL protocol implementation.
This is the high-level IPP protocol implementation.
This is the WS-Discovery protocol implementation, querier and responder.
This is the low-level transport library, used for communication with devices.
This is the collection of internally used support libraries. These libraries are exposed via the GO-MFP API.