williamkapke / ipp

Internet Printing Protocol (IPP) for nodejs
412 stars 111 forks source link

The spec is not clear on how to handle tag 18. Please open a github issue to help find a solution! #26

Open luxlux opened 8 years ago

luxlux commented 8 years ago

I got this message while requesting printer attributes from a TOSHIBA e-STUDIO 525P. I hope it helps:

The spec is not clear on how to handle tag 18. Please open a github issue to help find a solution!
{ version: '2.0',
  statusCode: 'successful-ok',
  id: 5819511,
  'operation-attributes-tag': 
   { 'attributes-charset': 'utf-8',
     'attributes-natural-language': 'en-us' },
  'printer-attributes-tag': 
   { 'compression-supported': [ 'none', 'gzip' ],
     'charset-configured': 'utf-8',
     'charset-supported': [ 'utf-8', 'us-ascii' ],
     'natural-language-configured': 'en-us',
     'generated-natural-language-supported': 'en-us',
     'color-supported': false,
     'copies-default': 1,
     'copies-supported': [ 1, 999 ],
     'document-format-default': 'application/octet-stream',
     'document-format-supported': 
      [ 'application/octet-stream',
        'application/pdf',
        'image/jpeg',
        'application/postscript',
        'application/vnd.hp-PCL',
        'text/plain' ],
     'document-format-preferred': 'application/pdf',
     'finishings-default': 'none',
     'finishings-supported': 'none',
     'ipp-versions-supported': [ '1.0', '1.1', '2.0' ],
     'job-creation-attributes-supported': 
      [ 'copies',
        'finishings',
        'ipp-attribute-fidelity',
        'job-description',
        'job-id',
        'job-impressions',
        'job-impressions-completed',
        'job-k-octets-processed',
        'job-media-sheets',
        'job-media-sheets-completed',
        'job-name',
        'job-originating-user-name',
        'job-printer-up-time',
        'job-printer-uri',
        'job-sheets',
        'job-state',
        'job-state-reasons',
        'job-template',
        'job-uri',
        'job-uuid',
        'media',
        'media-bottom-margin',
        'media-col',
        'media-left-margin',
        'media-right-margin',
        'media-source',
        'media-top-margin',
        'media-type',
        'multiple-document-handling',
        'number-up',
        'orientation-requested',
        'output-bin',
        'output-mode',
        'page-ranges',
        'print-color-mode',
        'print-quality',
        'printer-resolution',
        'sides',
        'time-at-completed',
        'time-at-creation',
        'time-at-processing' ],
     'job-media-sheets-supported': [ 1, 2147483647 ],
     'job-sheets-default': 'none',
     'job-sheets-supported': [ 'none', 'standard' ],
     'job-impressions-supported': [ 1, 2147483647 ],
     'jpeg-k-octets-supported': [ 0, 131072 ],
     'jpeg-x-dimension-supported': [ 1, 32768 ],
     'jpeg-y-dimension-supported': [ 1, 32768 ],
     'landscape-orientation-requested-preferred': 4,
     'marker-colors': '#000000',
     'marker-low-levels': 10,
     'marker-levels': 28,
     'marker-high-levels': 100,
     'marker-names': 'Black',
     'marker-types': 'tonerCartridge',
     'media-supported': 
      [ 'na_letter_8.5x11in',
        'na_legal_8.5x14in',
        'jis_b5_182x257mm',
        'iso_a4_210x297mm',
        'na_executive_7.25x10.5in',
        'iso_a5_148x210mm',
        'om_universal_216x356mm',
        'na_foolscap_8.5x13in',
        'na_invoice_5.5x8.5in',
        'iso_a6_105x148mm',
        'na_foolscap_8.5x13.4in',
        'na_monarch_3.875x7.5in',
        'na_number-9_3.875x8.875in',
        'na_number-10_4.125x9.5in',
        'iso_dl_110x220mm',
        'iso_c5_162x229mm',
        'iso_b5_176x250mm',
        'custom_min_98.42x148mm',
        'custom_max_216x356mm' ],
     'media-ready': [ 'iso_a4_210x297mm', 'iso_a5_148x210mm', 'iso_a4_210x297mm' ],
     'media-default': 'iso_a4_210x297mm',
     'media-top-margin-default': 423,
     'media-bottom-margin-default': 423,
     'media-left-margin-default': 423,
     'media-right-margin-default': 423,
     'media-top-margin-supported': 423,
     'media-bottom-margin-supported': 423,
     'media-left-margin-supported': 423,
     'media-right-margin-supported': 423,
     'media-col-supported': 
      [ 'media-size',
        'media-top-margin',
        'media-bottom-margin',
        'media-left-margin',
        'media-right-margin',
        'media-source',
        'media-type' ],
     'media-col-default': 
      { 'media-size': [Object],
        'media-top-margin': 423,
        'media-bottom-margin': 423,
        'media-left-margin': 423,
        'media-right-margin': 423,
        'media-source': 'tray-2',
        'media-type': 'stationery' },
     'media-col-ready': [ [Object], [Object], [Object] ],
     'media-source-default': 'tray-2',
     'media-size-supported': 
      [ [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object] ],
     'media-source-supported': [ 'auto', 'alternate', 'tray-1', 'tray-2', 'envelope', 'manual' ],
     'media-type-default': 'stationery',
     'media-type-supported': 
      [ 'stationery',
        'cardstock',
        'transparency',
        'custom-media-type-recycled',
        'labels',
        'custom-media-type-vinyllabel',
        'custom-media-type-bond',
        'envelope',
        'custom-media-type-roughenv',
        'stationery-letterhead',
        'stationery-preprinted',
        'custom-media-type-coloredpaper',
        'stationery-lightweight',
        'stationery-heavyweight',
        'custom-media-type-rough',
        'custom-media-type-customtype1',
        'custom-media-type-customtype2',
        'custom-media-type-customtype3',
        'custom-media-type-customtype4',
        'custom-media-type-customtype5',
        'custom-media-type-customtype6' ],
     'multiple-document-handling-default': 'separate-documents-collated-copies',
     'multiple-document-handling-supported': 
      [ 'separate-documents-uncollated-copies',
        'separate-documents-collated-copies' ],
     'multiple-document-jobs-supported': false,
     'multiple-operation-time-out': 120,
     'number-up-default': 1,
     'number-up-supported': [ 1, 2, 3, 4, 6, 9, 12, 16 ],
     'orientation-requested-default': 'portrait',
     'orientation-requested-supported': [ 'portrait', 'landscape' ],
     'output-bin-default': 'face-down',
     'output-bin-supported': 'face-down',
     'output-mode-default': 'monochrome',
     'print-color-mode-default': 'monochrome',
     'output-mode-supported': [ 'auto', 'monochrome' ],
     'print-color-mode-supported': [ 'auto', 'monochrome' ],
     'operations-supported': 
      [ 'Print-Job',
        'Print-URI',
        'Validate-Job',
        'Create-Job',
        'Send-Document',
        'Cancel-Job',
        'Get-Job-Attributes',
        'Get-Jobs',
        'Get-Printer-Attributes',
        'Pause-Printer',
        'Resume-Printer',
        'Purge-Jobs' ],
     'pdf-k-octets-supported': [ 0, 85000 ],
     'page-ranges-supported': true,
     'pdl-override-supported': 'attempted',
     'pdf-versions-supported': 'iso-32000-1_2008',
     'printer-name': 'TOSHIBA e-STUDIO525P',
     'printer-make-and-model': 'TOSHIBA e-STUDIO525P',
     'pages-per-minute': 55,
     'printer-device-id': 'MANUFACTURER:TOSHIBA;COMMAND SET:PCL 6 Emulation, PostScript Level 3 Emulation, PDF, NPAP, PJL;MODEL:TOSHIBA e-STUDIO525P;CLS:PRINTER;DES:TOSHIBA e-STUDIO525P;CID:TOSHIBAMonoA;COMMENT:ECP1.0, LV_043D, LP_0229, LF_0084;',
     'printer-dns-sd-name': 'TOSHIBA e-STUDIO525P',
     'printer-geo-location': undefined,
     'printer-icons': 
      [ 'http://192.168.1.88:80/cgi-bin/dynamic/printer/images/printer.48x48.png',
        'http://192.168.1.88:80/cgi-bin/dynamic/printer/images/printer.128x128.png',
        'http://192.168.1.88:80/cgi-bin/dynamic/printer/images/printer.512x512.png' ],
     'printer-is-accepting-jobs': true,
     'printer-info': 'Monochrome - Up to 55 Pages/Minute',
     'printer-location': '',
     'printer-more-info': 'http://192.168.1.88/',
     'printer-state': 'idle',
     'printer-state-reasons': 'none',
     'printer-up-time': 2079253,
     'printer-supplies-info-uri': 'http://192.168.1.88:80/',
     'printer-supply-info-uri': 'http://192.168.1.88:80/',
     'printer-uri-supported': 
      [ 'ipp://192.168.1.88:631/ipp/print',
        'ipps://192.168.1.88:443/ipp/print' ],
     'printer-uuid': 'urn:uuid:e25dbead-c0c2-43b4-83f5-13ec1b194a31',
     'print-quality-default': 'normal',
     'print-quality-supported': 'normal',
     'printer-resolution-default': [ 600, 600, 'dpi' ],
     'printer-resolution-supported': [ [Object], [Object], [Object] ],
     'reference-uri-schemes-supported': [ 'http', 'https', 'ftp' ],
     'queued-job-count': 0,
     'sides-default': 'one-sided',
     'sides-supported': [ 'one-sided', 'two-sided-long-edge', 'two-sided-short-edge' ],
     'uri-security-supported': [ 'none', 'tls' ],
     'uri-authentication-supported': [ 'none', 'none' ] } }
williamkapke commented 8 years ago

Looks like tag 18 is unknown... and the spec is certainly unclear on THAT one. I added a handleUnknownTag function to allow customization of reading unknown tag values ... or to just silence the default log message. It also returns a bit more info in the message now.

I don't have access to a printer ATM to test this code- so, I didn't test it yet :/ My printers do not produce a tag 18- so it won't hit this code anyhow.

If you have a chance, can you test this out and comment back the new output?

If you want to just silence the output:

var ipp = require('ipp');
ipp.parse.handleUnknownTag = function(tag, name, length, read) {
  return length? read(length) : undefined;
};
rolinh commented 8 years ago

For what it's worth, I get similar messages but about tag 19:

The spec is not clear on how to handle tag 19: printer-dns-sd-name=undefined. Please open a github issue to help find a solution!
The spec is not clear on how to handle tag 19: orientation-requested-default=undefined. Please open a github issue to help find a solution!

Since I have the said printer at my disposable, I'm of course ready to help you debug this.

wifiprintguy commented 8 years ago

Greetings,

Assuming you are referring to the value tag 0x13 "no-value" (decimal value 19), the meaning is quite clearly articulated in RFC 2911 "IPP/1.1: Model and Semantics" section 4.1 https://tools.ietf.org/html/rfc2911#section-4.1 or in section 5.1.1 in the most recent draft updates https://tools.ietf.org/html/draft-sweet-rfc2911bis-11#section-5.1.1: ’no-value’: The attribute is supported by the Printer object, but the administrator has not yet configured a value. This is a legitimate value for the Printer to return if these conditions are met, even if the definition of the attribute itself doesn't list it as a possible value.

As a point of feedback, it would be best if this project and software using it used the more appropriate 'no-value' label rather than referring to it as 'undefined', which is not an identifier registered anywhere in the IANA IPP registry, and certainly not in the registry for out-of-band values (http://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml#ipp-registrations-8 http://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml#ipp-registrations-8).

Cheers,

Smith

/* Smith Kennedy Wireless Architect - Client Software - IPG-PPS Standards - IEEE ISTO PWG / Bluetooth SIG / Wi-Fi Alliance / NFC Forum / USB IF Chair, IEEE ISTO Printer Working Group HP Inc. /

On 2016-08-31, at 9:20 AM, Robin Hahling notifications@github.com wrote:

For what it's worth, I get similar messages but about tag 19:

The spec is not clear on how to handle tag 19: printer-dns-sd-name=undefined. Please open a github issue to help find a solution! The spec is not clear on how to handle tag 19: orientation-requested-default=undefined. Please open a github issue to help find a solution! Since I have the said printer at my disposable, I'm of course ready to help you debug this.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/williamkapke/ipp/issues/26#issuecomment-243799197, or mute the thread https://github.com/notifications/unsubscribe-auth/AIT6tpRf8Kp1Hh3byktzUu9fyePgIHyfks5qlZvLgaJpZM4HkjJS.