From: zhangruien <zhangru...@bytedance.com> Currently, printer support in QEMU can generally be considered with these approaches:
1) USB passthrough & redirection, with the limitation of flexibility and transport-specific issues that come along with. 2) Network reachability with network printers, which is also driver-specific, thus less friendly to small systems. Driverless Printing [1] may or may not be network-dependent, the former is the general case while the latter imposes less restraints on cloud environments, and it doesn't necessarily mean that we have to follow the methods in 1) to achieve this. Transport protocols targeted at devices such as USB printer class [2] with the extension of IPP-over-USB [3] and many others can be integrated into QEMU, presenting more flexibility and functionality. This patchset introduces: 1) Skeleton of QEMU printer subsystem with a dummy builtin driver. 2) USB printer device emulation, with definitions in the extension of IPP-over- USB [3]. WIP: 1) QEMU printer subsystem interfaces, which will be finalized with a concrete backend driver. 2) IPP-over-USB implementation. [1]: https://openprinting.github.io/driverless [2]: https://www.usb.org/sites/default/files/usbprint11a021811.pdf [3]: https://www.usb.org/document-library/ipp-protocol-10 zhangruien (2): printer: Introduce printer subsystem usb-printer: Introduce USB printer class MAINTAINERS | 7 + docs/system/devices/usb.rst | 3 + hw/usb/Kconfig | 5 + hw/usb/dev-printer.c | 423 ++++++++++++++++++++++++++++++++++++++++++++ hw/usb/meson.build | 1 + hw/usb/trace-events | 11 ++ include/hw/usb/printer.h | 93 ++++++++++ include/printer/printer.h | 42 +++++ meson.build | 12 +- meson_options.txt | 3 + printer/builtin.c | 61 +++++++ printer/meson.build | 14 ++ printer/printer.c | 191 ++++++++++++++++++++ printer/trace-events | 5 + printer/trace.h | 1 + qapi/meson.build | 1 + qapi/printer.json | 47 +++++ qapi/qapi-schema.json | 1 + qemu-options.hx | 8 + softmmu/vl.c | 4 + 20 files changed, 932 insertions(+), 1 deletion(-) create mode 100644 hw/usb/dev-printer.c create mode 100644 include/hw/usb/printer.h create mode 100644 include/printer/printer.h create mode 100644 printer/builtin.c create mode 100644 printer/meson.build create mode 100644 printer/printer.c create mode 100644 printer/trace-events create mode 100644 printer/trace.h create mode 100644 qapi/printer.json -- 2.11.0