I’m trying to use Particle Photon as a replacement of a USB card reader connected to a printer, the reader I’m replacing works as a keyboard emulator, when connected a computer both the Photon and the Card Reader behave the same, but when connected to the printer the Photon is recognized and registered as a card reader but the key strokes are not recognized by the printer.
I used USB analyzer to compare the packets sent from both devices as well as a USB Keyboard, I notice the Photon sends each key as 9 bytes, while the reader and my keyboard send 8 bytes.
Here is an example of KEY_1 packet:
02 00 00 1E 00 00 00 00 00 from Photon
00 00 1E 00 00 00 00 00 from Keyboard & Card Reader
It’s the same packet but photons always adds 02 at the start!
Looks like your printer does not correctly parse the HID report descriptor that Photon provides. Due to the fact that we are limited in the number of endpoints available, mouse and keyboard data is transmitted over a single USB endpoint (i.e. the Photon does not report itself as having two separate HID interfaces (keyboard and mouse) and instead reports a single compound HID interface: a mouse, keyboard and digitizer), however if your printer is USB HID-compliant, it should be able to understand that format.
@avtolstoy I applied the keyboard only patch last night, the packet now include 8 bytes for each key stroke, however the photon doesn’t seem to work as a keyboard anymore, nothing happens when I send keystrokes to the host computer.