Hello guys,
take a look at this possible scenario: you have a USB (PCL) printer and want to use it under Windows CE. You have included the USB printer class driver in your run time image, built it and then attached the USB printer to the device. In some cases you will get a message that the device wasn't recognized.
This is caused by the "IEEE-1284" device ID string. USB printers report their capabilities via the class-specific command GET_DEVICE_ID which returns a device ID string that is compatible with IEEE-1284.
This device ID string is fetched from USB printer devices by calling the GetDeviceID function (implemented here: .\public\common\oak\drivers\usb\class\printer\usbprn.c).
The received device ID is then handled in the function RegisterPrinterSettings ( .\public\common\oak\drivers\usb\class\printer\lpt.c).
The device ID has to at least match one of the following tags: "DESCRIPTION:", "DES:" or "MODEL" otherwise the RegisterPrinterSettings funtction will fail and you will get the message box with "Unrecognized USB device" as a result.
Unfortunately some USB printer manufacturers implement the "MDL" tag, which is currently not implemented in the Windows CE Versions 4.2 or 5.0
You can avoid this problem and increase the amount of supported USB (PCL) printer devices by modifying the RegisterPrinterSettings function (.\public\common\oak\drivers\usb\class\lpt.c) so it accepts a "MDL:" tag as a valid description field, e.g.:
//
// parse for a Description string
//
if ((p = strstr(buf, "DESCRIPTION:"))!=NULL)
p += sizeof("DESCRIPTION:") - 1;
else if ((p = strstr(buf, "DES:"))!=NULL)
p += sizeof("DES:") - 1;
else if ((p = strstr(buf, "MODEL:"))!=NULL)
p += sizeof("MODEL:") - 1;
else if ((p = strstr(buf, "MDL:"))!=NULL)
p += sizeof("MDL:") - 1;
Thanks
6 months ago
No comments:
Post a Comment