Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to simulate a USB printer that gets recognized by ipp-usb? #53

Open
Xerxekyran opened this issue Jun 13, 2022 · 5 comments
Open

How to simulate a USB printer that gets recognized by ipp-usb? #53

Xerxekyran opened this issue Jun 13, 2022 · 5 comments

Comments

@Xerxekyran
Copy link

Hi there,

thanks for the great work!

I am using IPP-USB but I also do want to programatically test its functionality. I have a linux system and am testing normal/non-ipp usb printers using the USB printer gadget (https://www.kernel.org/doc/Documentation/usb/gadget_printer.rst). Is there a way of simulating a usb printer that than will be found by IPP-USB?

Regards
Lars

@alexpevzner
Copy link
Member

Hi @Xerxekyran,

most likely, yes. All details are hard to explain on one short message. Basically, the virtual device should have some 7/1/4 interfaces (class = 7, subclass = 1, protocol = 4). Data, sent to these interfaces, should be interpreted as HTTP requests, and data, that could be read from these interfaces, should be HTTP responses to these requests.

It should also return a correct Device Info Descriptor (see IPP-USB specification, 4.3 and function (devhandle *UsbDevHandle) usbIppBasicCaps() for details). And also, vendor number, product number, device serial number must be reasonable, similar to the "real" USB devices. Manufacturer and product name strings must also be valid.

The IPP-USB protocol specification can be loaded from here: https://www.usb.org/document-library/ipp-protocol-10

@Xerxekyran
Copy link
Author

Thank you for your answer. I guess there does not yet exists any software which handles this type of "mocking" already?

@alexpevzner
Copy link
Member

I guess there does not yet exists any software which handles this type of "mocking" already?

No. And I'm not sure about usefulness of such a software. The real problems are mostly about firmware bugs, not about ipp-usb bugs.

@zdohnal
Copy link
Member

zdohnal commented Jun 15, 2022

Just my 2 cents - IMHO any functionality for testing is useful. Currently I have to go to our minilab, where I have IPP-over-USB device, and manually test whether the device is seen and prints via ipp-usb from a print dialog.

Although most real problems are in firmware, but some tests verifying the functionality of ipp-usb and checks whether there are no regressions are always good. I was looking for a mocking USB library myself, but no luck so far.

@yetamrra
Copy link

Drive-by comment here: ChromeOS has a (very basic) virtual MFP that can simulate an IPP-USB printer. It uses usbip to show up as a device with IPP-USB printer interfaces and implements just enough to submit an IPP print job or an eSCL scan. Like the comment above mentioned, it's probably not adequate to verify firmware quirks, but it's useful for verifying end-to-end connectivity from your client through ipp-usb (or ippusb_bridge).

You can find the source at https://chromium.googlesource.com/chromiumos/third_party/virtual-usb-printer . Building the source code depends on various other libraries from ChromeOS, so it might be tricky to build separately. I don't think it has any runtime dependencies that wouldn't be available on a typical Linux system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants