Arduino printer emulation

arduinoatmegainterfacelufausb

I'm working on a project in which an arduino should emulate a thermal printer.
I'm currently using an Arduino UNO R3 board with ATmega16U2 controller to handle the communication between USB and the ATmega328 microprocessor.
I used the FLIP suite from ATMEL to erase the firmware in the ATmega16U2 and reprogrammed again with the arduino firmware.
Which are the steps to take in order to make the board appear in the computer as a USB printing support? Is there any firmware available? What I need is basically to be able to use the arduino board with a standard windows printer driver and to catch the messages sent to the emulated printer.
I checked out the LUFA library but I do not have it clear how to use it.

Best Answer

edited to add: related question

You need to change the USB ID from the Arduino to match the code that Windows would expect to see from your printer. Here is a sample list. And an example from that list:

03f0  Hewlett-Packard
    0004  DeskJet 895c
    0011  OfficeJet G55

03f0:0011 appearing on the USB means the device appears to Windows as a HP OfficeJet G55. You can determine this number easily if you have one of the printers physically. Plug it into windows and Computer -> Properties -> Device Manager find the device, open it, click the Details tab, select Hardware Ids dropdown and the manufacturer ID and device ID are in the "Value" window.

The next part (and hard part) is to then program the Arduino to do what you need/want with the data once attached to Windows. Oh, and how to program the Arduino when Windows thinks it is a printer. THAT, I can only say what I already have and no more, as I haven't done this before. Normally, when I would dev USB or serial like this, there's an ethernet back door I use for programming the target system.

Sounds fun, please update with your progress, I'd like to learn from this.