@@ -47,7 +47,7 @@ func IppService(log *LogMessage, services *DNSSdServices,
47
47
48
48
// Decode IPP service info
49
49
attrs := newIppDecoder (msg )
50
- ippinfo , ippScv := attrs .decode (usbinfo )
50
+ ippinfo , ippSvc := attrs .decode (usbinfo )
51
51
52
52
// Check for fax support
53
53
canFax := false
@@ -72,26 +72,26 @@ func IppService(log *LogMessage, services *DNSSdServices,
72
72
}
73
73
74
74
if canFax {
75
- ippScv .Txt .Add ("Fax" , "T" )
76
- ippScv .Txt .Add ("rfo" , "ipp/faxout" )
75
+ ippSvc .Txt .Add ("Fax" , "T" )
76
+ ippSvc .Txt .Add ("rfo" , "ipp/faxout" )
77
77
} else {
78
- ippScv .Txt .Add ("Fax" , "F" )
78
+ ippSvc .Txt .Add ("Fax" , "F" )
79
79
}
80
80
81
81
// Construct LPD info. Per Apple spec, we MUST advertise
82
82
// LPD with zero port, even if we don't support it
83
- lpdScv := DNSSdSvcInfo {
83
+ lpdSvc := DNSSdSvcInfo {
84
84
Type : "_printer._tcp" ,
85
85
Port : 0 ,
86
86
Txt : nil ,
87
87
}
88
88
89
89
// Pack it all together
90
- ippScv .Port = port
91
- services .Add (lpdScv )
90
+ ippSvc .Port = port
91
+ services .Add (lpdSvc )
92
92
93
93
ippinfo .IppSvcIndex = len (* services )
94
- services .Add (ippScv )
94
+ services .Add (ippSvc )
95
95
96
96
return
97
97
}
@@ -100,9 +100,9 @@ func IppService(log *LogMessage, services *DNSSdServices,
100
100
// using the specified http.Client and uri
101
101
//
102
102
// If this function returns nil error, it means that:
103
- // 1) HTTP transaction performed successfully
104
- // 2) Received reply successfully decoded
105
- // 3) It is not an IPP error response
103
+ // 1. HTTP transaction performed successfully
104
+ // 2. Received reply successfully decoded
105
+ // 3. It is not an IPP error response
106
106
//
107
107
// Otherwise, the appropriate error is generated and returned
108
108
func ippGetPrinterAttributes (log * LogMessage , c * http.Client ,
@@ -218,34 +218,33 @@ func newIppDecoder(msg *goipp.Message) ippAttrs {
218
218
//
219
219
// This is where information comes from:
220
220
//
221
- // DNS-SD name: "printer-dns-sd-name" with fallback to "printer-info",
222
- // "printer-make-and-model" and finally to MfgAndProduct
223
- // from the UsbDeviceInfo
224
- //
225
- // TXT fields:
226
- // air: hardcoded as "none"
227
- // mopria-certified: "mopria-certified"
228
- // rp: hardcoded as "ipp/print"
229
- // kind: "printer-kind"
230
- // PaperMax: based on decoding "media-size-supported"
231
- // URF: "urf-supported" with fallback to
232
- // URF extracted from "printer-device-id"
233
- // UUID: "printer-uuid", without "urn:uuid:" prefix
234
- // Color: "color-supported"
235
- // Duplex: search "sides-supported" for strings with
236
- // prefix "one" or "two"
237
- // note: "printer-location"
238
- // qtotal: hardcoded as "1"
239
- // usb_MDL: MDL, extracted from "printer-device-id"
240
- // usb_MFG: MFG, extracted from "printer-device-id"
241
- // usb_CMD: CMD, extracted from "printer-device-id"
242
- // ty: "printer-make-and-model"
243
- // priority: hardcoded as "50"
244
- // product: "printer-make-and-model", in round brackets
245
- // pdl: "document-format-supported"
246
- // txtvers: hardcoded as "1"
247
- // adminurl: "printer-more-info"
221
+ // DNS-SD name: "printer-dns-sd-name" with fallback to "printer-info",
222
+ // "printer-make-and-model" and finally to MfgAndProduct
223
+ // from the UsbDeviceInfo
248
224
//
225
+ // TXT fields:
226
+ // air: hardcoded as "none"
227
+ // mopria-certified: "mopria-certified"
228
+ // rp: hardcoded as "ipp/print"
229
+ // kind: "printer-kind"
230
+ // PaperMax: based on decoding "media-size-supported"
231
+ // URF: "urf-supported" with fallback to
232
+ // URF extracted from "printer-device-id"
233
+ // UUID: "printer-uuid", without "urn:uuid:" prefix
234
+ // Color: "color-supported"
235
+ // Duplex: search "sides-supported" for strings with
236
+ // prefix "one" or "two"
237
+ // note: "printer-location"
238
+ // qtotal: hardcoded as "1"
239
+ // usb_MDL: MDL, extracted from "printer-device-id"
240
+ // usb_MFG: MFG, extracted from "printer-device-id"
241
+ // usb_CMD: CMD, extracted from "printer-device-id"
242
+ // ty: "printer-make-and-model"
243
+ // priority: hardcoded as "50"
244
+ // product: "printer-make-and-model", in round brackets
245
+ // pdl: "document-format-supported"
246
+ // txtvers: hardcoded as "1"
247
+ // adminurl: "printer-more-info"
249
248
func (attrs ippAttrs ) decode (usbinfo UsbDeviceInfo ) (
250
249
ippinfo * IppPrinterInfo , svc DNSSdSvcInfo ) {
251
250
@@ -349,11 +348,12 @@ func (attrs ippAttrs) getDuplex() string {
349
348
//
350
349
// According to Bonjour Printing Specification, Version 1.2.1,
351
350
// it can take one of following values:
352
- // "<legal-A4"
353
- // "legal-A4"
354
- // "tabloid-A3"
355
- // "isoC-A2"
356
- // ">isoC-A2"
351
+ //
352
+ // "<legal-A4"
353
+ // "legal-A4"
354
+ // "tabloid-A3"
355
+ // "isoC-A2"
356
+ // ">isoC-A2"
357
357
//
358
358
// If PaperMax cannot be guessed, it returns empty string
359
359
func (attrs ippAttrs ) getPaperMax () string {
0 commit comments