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

Support Colour Printers (e.g. LBP7200Cdn, LBP5200, LBP5100, etc...) #10

Open
erosenst opened this issue Dec 29, 2021 · 20 comments
Open
Labels
enhancement New feature or request

Comments

@erosenst
Copy link

Hello how painful it would be to get LBP7200C to supported device?

I added prn_lbp2900.c LBP7200C but not success yet. screenshots before adding and after..

Screenshot_20211229_185333
Screenshot_20211229_185832
?

@mounaiban mounaiban changed the title LBP7200Cdn Support Colour Printers (e.g. LBP7200Cdn, LBP5200, LBP5100, etc...) Jan 4, 2022
@mounaiban
Copy link
Owner

mounaiban commented Jan 4, 2022

Are you good at Wireshark? 🦈 🧑‍💻
Or more importantly, do you have enough toner and paper? And some spare time to spend working with Ubuntu 14.04, macOS or Windows?

The basic data format for the currently supported devices (LBP2900, 3000, 3010, and a little bit of 3100) has been documented in SPECS by @agalakhov, but I expect the LBP7200Cdn to have significant but reasonably manageable differences from the personal-scale mono devices we support.

From the screenshots you have posted* I think it's going to be "hard" work at this stage to support the '7200. You know, that kind of iterative work to figure out something you know partially but not completely (as opposed to figuring out something completely unknown).

So you'll be hooking up Wireshark to sniff USB/Ethernet traffic on a system that is running the original Canon drivers, performing various tasks like roller cleaning or printing a page, then studying the captures for things we have missed out. Once you figured out the missing pieces, you'll write new functions for prn_lbp2900.c as needed. Sounds like fun?

What I really fear is that the compression may be different enough to require a new or extended encoder. I have zero experience in that kind of thing 😨

* The bad reply from printer message indicates that the printer device is returning three extra bytes 05 40 00 in front of the actual response A1 A1 40..., which makes me wonder if the format is largely the same with some extra data to handle the Ethernet, duplexing and colour printing...

@mounaiban
Copy link
Owner

@erosenst If you don't mind, would you post a snippet of your CUPS log for the LBP7200C containing a response to the 0xA1A1 command? This is mostly for agalakhov#38. I'm trying to find out how it looks like for colour printers.

You should be able to get this by doing grep -A 5 CAPT:\ recv.*A1\ A1 /var/log/cups/error_log, Run it with sudo privileges if necessary.

If there is nothing in the log, switch on CUPS debug logging with cupsctl --debug-logging or /usr/sbin/cupsctl --debug-logging and try printing again. thx

PROTIP for regex newbies who landed here from the future: Spaces in the pattern are preceded by a backslash, the * is only an operator that must be paired with another character, class or placeholder.

@erosenst
Copy link
Author

erosenst commented Feb 21, 2022 via email

@erosenst
Copy link
Author

erosenst commented Feb 21, 2022 via email

@erosenst
Copy link
Author

erosenst commented Feb 21, 2022 via email

@erosenst
Copy link
Author

erosenst commented Feb 21, 2022 via email

@erosenst
Copy link
Author

Hmm, missing wireshark log..
lbp7200.wireshark.pcapng.log

@mounaiban
Copy link
Owner

@erosenst Thanks for posting the Wireshark log, that's the first time I've seen stuff from a colour CAPT printer in such detail, and the first time I've seen CAPT work over Ethernet.

I haven't gotten around to picking it apart in detail, but it appears to be good old TCP/IP(v4?) and CAPT commands tagged on without any dramas.

The 0xA1A1 command in packet 21 of the log just proved me wrong on a few points already! 😅 I will be posting updates on agalakhov#38 soon.

Packet 23 is particularly interesting, it shows 0xA0A1, 0xA0A2, 0xA0A3 and 0xA0A4 commands in a single Ethernet frame 🕵️

@erosenst
Copy link
Author

I installed ubuntu 16 virtual, it dosn't work, then I installed w2k virtual and canon drivers. There is wireshark log from w2k testpage
lbp7200-w2k-testpage.pcapng.gz
:

@mounaiban
Copy link
Owner

@erosenst To answer your first question, Ubuntu 16.10 brought me to captdriver. 😉
I had lots of trouble with Ubuntu 16 and only managed to print a single page with the Canon drivers; being more clueless back then about how libraries and CUPS worked in Linux didn't help either.

I only tried Ubuntu 14 when I came to know this LXC-based solution by nerk. I did not deploy the containers, I just followed the most important parts (installing the prescribed packages) and remembered to start ccpd.

@mounaiban mounaiban added enhancement New feature or request help wanted Extra attention is needed and removed help wanted Extra attention is needed labels Feb 22, 2022
@mounaiban
Copy link
Owner

In the coming weeks, I will be requesting more '7200C tests and Wireshark logs if that is alright with you.

For now, I am just confirming your printer's configuration. From my guess, looking at the logs you sent:

  • The printer is a 7200Cdn, with duplex and the Ethernet+USB card
  • You are not using the optional second tray

Is this correct?

Also, which paper size are you normally using? All tests will use only this paper size. Thanks in advance!

@erosenst
Copy link
Author

erosenst commented Feb 24, 2022 via email

@mounaiban
Copy link
Owner

mounaiban commented Feb 24, 2022

Here's what I can figure out for now based on the Wireshark logs:

LBP7200 Command Format Preliminary Report

The LBP7200Cdn uses both TCP and UDP commands when on Ethernet. I don't know the UDP commands yet, but TCP commands are looking like their USB counterparts. The LBP7200 also features grouped responses.

TCP Commands are like USB commands

Packets 37 and 42 are examples; the printer accepts the same commands over TCP 😃

The 0x05 multi-response (TCP & USB)

The LBP7200 supports multi-command responses. The three-byte "outer command" 0x05 low(SIZE) hi(SIZE) indicates that there will be an arbitrary number of responses for the next SIZE bytes. SIZE is unsigned little endian 16-bit, so the maximum group is 65532 bytes (65535-3). This seems to occur only on response packets.

For example, in packet 31 of lbp7200-w2k-testpage.pcapng.gz, the TCP payload begins with 05 58 00: there is only one response in the 0x58 (88) bytes.

In packet 26, the payload starts with 05 1e 01, indicating that there are responses in the next 286 bytes. Five of them are to be found in the packet. Do you know where they start?

It was not known at this time if other CAPT 3.0 printers support this grouping.

0x00 command

Packet 62 contains an example of a 2-byte 0x00 outer command. Its use was unknown at this time.

EDIT: just realised that 0x05's are sent from printer to host, but I haven't found any outgoing 0x05's.

@mounaiban
Copy link
Owner

@erosenst The VM will not be needed until later, that is the middle of this year at the earliest. I think I might need two VMs, one running Ubuntu 14.04 (for logging) and the other running the latest Ubuntu (for testing our driver) when the time comes.

I am currently trying to build a more reliable USB backend for Captdriver, but I just ran into a dead end. My attempts at using a secondary libusb 1.0 handle within CUPS just didn't work. I suspect there is a limitation that there could only be one handle per device per process (like, multiple handles to the same device would thus need to be from different processes). 🤷

My next attempt will likely use PAPPL instead of CUPS.

@mounaiban
Copy link
Owner

In the meantime, here is a test for the LBP7200Cdn, if you are alright with doing this. It takes at least 8 A4 sheets and prints about 16 pages in total.

This test will use issue-10.pdf, a PDF with A4-sized pages.

Testing Procedure

Please use only Windows to run this test.

Before each test, check that the printer status window is monitoring the printer device.

  1. Turn on duplex/2-sided printing and full colour, then start capture, wait 15 seconds, print all pages of the PDF, wait another 15 seconds before ending the capture. (8 pages)

  2. Switch to 1-sided printing and black & white only mode. Start capture, wait 15 seconds, print first 4 pages, wait 15 seconds, end capture. (4 pages)

  3. Reset to default settings. Turn on 2-sided printing with Binding Location set to Long Edge. Start capture, wait 15 seconds, print the last 2 pages of the PDF, wait 15 seconds, end capture (2 pages)

  4. Reset to default settings; keep 2-sided printing on with Binding Location set to Short Edge. Start capture, wait 15 seconds, print last 2 pages of PDF, wait 15 seconds, end capture (2 pages).

Please post the test results as four separate *.pcap.gz logs. Thanks in advance! 🙇

Test PDF and Procedure Design Considerations

  • The PDF was meant to be easy to reproduce deterministically. This makes studies easier.

  • The first test's eight-page length attempts to find out how many pages the printer is able to buffer at once. At time of writing, this is suspected to be 5 pages.

  • The 15 second wait is to confirm that TCP is only used during a job, UDP when idle.

  • Both 1-sided and 2-sided print jobs are included to find out the CAPT command argument that enables and disables this feature.

  • Both CMYK/colour and B&W jobs are included in order to find out if different data formats are used for colour jobs.

  • I chose to use the Windows driver just for its authoritative value; most users of this printer are likely running Windows.

@Julf
Copy link

Julf commented Oct 14, 2024

Not sure if you still want to work on this, but I am happy to help. I have a LBP7210Cdn, and I am running devuan linux - can use tcpdump or wireshark.

@mounaiban
Copy link
Owner

Thanks for reaching out @Julf; colour support will be implemented sometime in the future, but we have to figure out the format for the colour rasters on CAPT. The key question: are rasters sent to the devices in RGB format (colour separation on device), or is it four black-and-white images for cyan, magenta, yellow and black? (separation on host)

For now, it would be great if you could post the response to the 0xA1A1 command for the LBP7210Cdn on agalakhov#38. You should be able to get it through Wireshark pretty easily. Please also mention if you have any optional equipment such as extra paper trays.

If you haven't found it yet, I hope this CAPT dissector for Wireshark helps. Just remember to add your device id to the section beginning at line 664 if it doesn't work. Please be aware that the dissector is only for USB devices.

@agalakhov
Copy link

agalakhov commented Nov 4, 2024

I bet it is CMYK. Color separation is virtually always done on the host due its complexity (color profile, dithering etc.) with the exception of high-end PostScript printers that have their own CPU and plenty of RAM. Also I bet it is sent in planes, that is, one stripe in each color (and not by pixel). This is the way laser color printers work, they are essentially four mostly independent B&W printers that print on the same sheet of paper (or on the same transfer band).

Many printers use K as the first color, then CMY in arbitrary order. This simplifies B&W printing as just omitting 2nd, 3rd and 4th colors result in printing in the 1st color only. Most likely the color order in the stream is the same as the physical drum and cartridge order of the printer. If service manual mentions numbered error codes, their order could also match the color order. But it is easy to test anyway.

@Julf
Copy link

Julf commented Nov 5, 2024 via email

@mounaiban
Copy link
Owner

I bet it is CMYK...

Meanwhile, I am going to bet the pages are sent as RGB 🤓
The colour CAPT devices I know don't seem to store jobs on the device, yet have amounts of RAM that seem well and above required for a single page, while not needing to hold more than a few pages in memory during printing, because CAPT. I am also under the impression colour separation can be done efficiently with a reasonably low-cost SoC with an embedded DSP.

Either way, I can't wait to find out...

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

No branches or pull requests

4 participants